-
This commit is contained in:
@@ -54,7 +54,7 @@ class GroupView extends SpriteView implements IGroupView<Sprite> {
|
|||||||
public function addView(view:IView<Dynamic>):IView<Dynamic> {
|
public function addView(view:IView<Dynamic>):IView<Dynamic> {
|
||||||
views.push(view);
|
views.push(view);
|
||||||
viewsById.set(view.id, view);
|
viewsById.set(view.id, view);
|
||||||
content.addChild(view.content);
|
if (view.content != null) content.addChild(view.content);
|
||||||
view.parent = this;
|
view.parent = this;
|
||||||
invalidate();
|
invalidate();
|
||||||
return view;
|
return view;
|
||||||
@@ -73,7 +73,7 @@ class GroupView extends SpriteView implements IGroupView<Sprite> {
|
|||||||
view.parent = null;
|
view.parent = null;
|
||||||
viewsById.remove(view.id);
|
viewsById.remove(view.id);
|
||||||
views.remove(view);
|
views.remove(view);
|
||||||
content.removeChild(view.content);
|
if (view.content != null) content.removeChild(view.content);
|
||||||
invalidate();
|
invalidate();
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,11 +68,11 @@ class GuiB {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static function instance(type:String):Dynamic {
|
private static function instance(type:String):Dynamic {
|
||||||
var clazz:Class<Dynamic> = Type.resolveClass(type);
|
var clazz:Class<Dynamic> = Type.resolveClass(type);
|
||||||
if (clazz == null) throw new TypeError("Class \"" + type + "\" not found");
|
if (clazz == null) throw new TypeError("Class \"" + type + "\" not found");
|
||||||
var instance:Dynamic = Type.createInstance(clazz, []);
|
var instance:Dynamic = Type.createInstance(clazz, []);
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class GuiF {
|
class GuiF {
|
||||||
|
|||||||
@@ -1,10 +1,13 @@
|
|||||||
package haxework.gui;
|
package haxework.gui;
|
||||||
|
|
||||||
|
import haxework.net.SwfLoader;
|
||||||
import flash.display.MovieClip;
|
import flash.display.MovieClip;
|
||||||
|
|
||||||
|
//ToDo: sprite wrapper?
|
||||||
class MovieView extends View<MovieClip> {
|
class MovieView extends View<MovieClip> {
|
||||||
|
|
||||||
public var movie(get, set):MovieClip;
|
public var movie(get, set):MovieClip;
|
||||||
|
public var movieUrl(default, set):String;
|
||||||
|
|
||||||
public function new(?movie:MovieClip) {
|
public function new(?movie:MovieClip) {
|
||||||
super(movie);
|
super(movie);
|
||||||
@@ -21,6 +24,7 @@ class MovieView extends View<MovieClip> {
|
|||||||
parent.content.removeChild(content);
|
parent.content.removeChild(content);
|
||||||
}
|
}
|
||||||
content = value;
|
content = value;
|
||||||
|
content.visible = visible;
|
||||||
if (parent != null) {
|
if (parent != null) {
|
||||||
parent.content.addChildAt(content, index);
|
parent.content.addChildAt(content, index);
|
||||||
}
|
}
|
||||||
@@ -28,11 +32,26 @@ class MovieView extends View<MovieClip> {
|
|||||||
return content;
|
return content;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function set_movieUrl(value:String):String {
|
||||||
|
movieUrl = value;
|
||||||
|
new SwfLoader().GET(movieUrl)
|
||||||
|
.success(function(data:MovieClip):Void {
|
||||||
|
movie = data;
|
||||||
|
});
|
||||||
|
return movieUrl;
|
||||||
|
}
|
||||||
|
|
||||||
override public function update():Void {
|
override public function update():Void {
|
||||||
if (contentSize && movie != null) {
|
if (contentSize && content != null) {
|
||||||
width = movie.loaderInfo.width;
|
width = content.loaderInfo.width;
|
||||||
height = movie.loaderInfo.height;
|
height = content.loaderInfo.height;
|
||||||
}
|
}
|
||||||
super.update();
|
super.update();
|
||||||
|
if (!contentSize && content != null) {
|
||||||
|
var s:Float = Math.min(width / content.loaderInfo.width, height / content.loaderInfo.height);
|
||||||
|
content.scaleX = content.scaleY = s;
|
||||||
|
content.x = (width - content.loaderInfo.width * s) / 2;
|
||||||
|
content.y = (height - content.loaderInfo.height * s) / 2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -86,8 +86,10 @@ class View<C:Content> implements IView<C> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function update():Void {
|
public function update():Void {
|
||||||
content.x = x;
|
if (content != null) {
|
||||||
content.y = y;
|
content.x = x;
|
||||||
|
content.y = y;
|
||||||
|
}
|
||||||
var skin:ISkin<C, IView<C>> = currentSkin();
|
var skin:ISkin<C, IView<C>> = currentSkin();
|
||||||
if (contentSize && skin != null && Std.is(skin, ISize)) {
|
if (contentSize && skin != null && Std.is(skin, ISize)) {
|
||||||
var size:ISize = cast(skin, ISize);
|
var size:ISize = cast(skin, ISize);
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ class ButtonColorSkin implements ISkin<Sprite, ButtonView> {
|
|||||||
|
|
||||||
public var color(default, set_color):Int;
|
public var color(default, set_color):Int;
|
||||||
public var alpha(default, default):Float;
|
public var alpha(default, default):Float;
|
||||||
|
public var disable(default, default):Int;
|
||||||
private var colors:Map<ButtonState, Int>;
|
private var colors:Map<ButtonState, Int>;
|
||||||
private var disable:Int;
|
|
||||||
|
|
||||||
public function new(?color:Int = 0xffffff, ?alpha:Float = 1.0) {
|
public function new(?color:Int = 0xffffff, ?alpha:Float = 1.0) {
|
||||||
this.color = color;
|
this.color = color;
|
||||||
@@ -22,7 +22,7 @@ class ButtonColorSkin implements ISkin<Sprite, ButtonView> {
|
|||||||
colors.set(ButtonState.UP, value);
|
colors.set(ButtonState.UP, value);
|
||||||
colors.set(ButtonState.DOWN, ColorUtils.diff(value, -64));
|
colors.set(ButtonState.DOWN, ColorUtils.diff(value, -64));
|
||||||
colors.set(ButtonState.OVER, ColorUtils.diff(value, 64));
|
colors.set(ButtonState.OVER, ColorUtils.diff(value, 64));
|
||||||
disable = ColorUtils.multiply(value, 0.6);
|
//disable = ColorUtils.multiply(value, 0.6);
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ class Callback<T> implements ICallback<T> {
|
|||||||
public function glue(callback:ICallback<T>):ICallback<T> {
|
public function glue(callback:ICallback<T>):ICallback<T> {
|
||||||
this._success = callback.callSuccess;
|
this._success = callback.callSuccess;
|
||||||
this._fail = callback.callFail;
|
this._fail = callback.callFail;
|
||||||
callback.dispose();
|
//callback.dispose(); //ToDo:
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user