diff --git a/LICENSE b/LICENSE index 87e7c9e..b96a810 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2018 GambitER +Copyright (c) 2017 Vlad Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/gambiter.guiflash_0.2.5.wotmod b/gambiter.guiflash_0.2.5.wotmod deleted file mode 100644 index 0562f2d..0000000 Binary files a/gambiter.guiflash_0.2.5.wotmod and /dev/null differ diff --git a/gambiter.guiflash_0.2.8.wotmod b/gambiter.guiflash_0.2.8.wotmod new file mode 100644 index 0000000..01b0a7a Binary files /dev/null and b/gambiter.guiflash_0.2.8.wotmod differ diff --git a/meta.xml b/meta.xml index 0fa75bd..476b80f 100644 --- a/meta.xml +++ b/meta.xml @@ -1,6 +1,6 @@ gambiter.guiflash - 0.2.5 + 0.2.8 GUIFlash Flash components for use in python mods. diff --git a/res/gui/flash/GUIFlash.swf b/res/gui/flash/GUIFlash.swf index 70fff4e..0b74a61 100644 Binary files a/res/gui/flash/GUIFlash.swf and b/res/gui/flash/GUIFlash.swf differ diff --git a/res/gui/flash/as3proj/obj/GUIFlashConfig.old b/res/gui/flash/as3proj/obj/GUIFlashConfig.old index d167082..a4f2191 100644 --- a/res/gui/flash/as3proj/obj/GUIFlashConfig.old +++ b/res/gui/flash/as3proj/obj/GUIFlashConfig.old @@ -16,7 +16,7 @@ CONFIG::timeStamp - '24.12.2017' + '04.04.2019' CONFIG::air @@ -34,22 +34,22 @@ true false - C:\Games\OneDrive\WoT_Mods\GUIFlash\source\res\gui\flash\as3proj\src + E:\OneDrive\WoT_Mods\GUIFlash\source\res\gui\flash\as3proj\src C:\Program Files (x86)\FlashDevelop\Library\AS3\classes - C:\Games\OneDrive\WoT_Mods\GUIFlash\source\res\gui\flash\as3proj\swc\wg\base_app-1.0-SNAPSHOT.swc - C:\Games\OneDrive\WoT_Mods\GUIFlash\source\res\gui\flash\as3proj\swc\wg\battle.swc - C:\Games\OneDrive\WoT_Mods\GUIFlash\source\res\gui\flash\as3proj\swc\wg\common_i18n_library-1.0-SNAPSHOT.swc - C:\Games\OneDrive\WoT_Mods\GUIFlash\source\res\gui\flash\as3proj\swc\wg\common-1.0-SNAPSHOT.swc - C:\Games\OneDrive\WoT_Mods\GUIFlash\source\res\gui\flash\as3proj\swc\wg\gui_base-1.0-SNAPSHOT.swc - C:\Games\OneDrive\WoT_Mods\GUIFlash\source\res\gui\flash\as3proj\swc\wg\gui_battle-1.0-SNAPSHOT.swc - C:\Games\OneDrive\WoT_Mods\GUIFlash\source\res\gui\flash\as3proj\swc\wg\gui_lobby-1.0-SNAPSHOT.swc - C:\Games\OneDrive\WoT_Mods\GUIFlash\source\res\gui\flash\as3proj\swc\wg\lobby.swc + E:\OneDrive\WoT_Mods\GUIFlash\source\res\gui\flash\as3proj\swc\wg\base_app-1.0-SNAPSHOT.swc + E:\OneDrive\WoT_Mods\GUIFlash\source\res\gui\flash\as3proj\swc\wg\battle.swc + E:\OneDrive\WoT_Mods\GUIFlash\source\res\gui\flash\as3proj\swc\wg\common_i18n_library-1.0-SNAPSHOT.swc + E:\OneDrive\WoT_Mods\GUIFlash\source\res\gui\flash\as3proj\swc\wg\common-1.0-SNAPSHOT.swc + E:\OneDrive\WoT_Mods\GUIFlash\source\res\gui\flash\as3proj\swc\wg\gui_base-1.0-SNAPSHOT.swc + E:\OneDrive\WoT_Mods\GUIFlash\source\res\gui\flash\as3proj\swc\wg\gui_battle-1.0-SNAPSHOT.swc + E:\OneDrive\WoT_Mods\GUIFlash\source\res\gui\flash\as3proj\swc\wg\gui_lobby-1.0-SNAPSHOT.swc + E:\OneDrive\WoT_Mods\GUIFlash\source\res\gui\flash\as3proj\swc\wg\lobby.swc - C:\Games\OneDrive\WoT_Mods\GUIFlash\source\res\gui\flash\as3proj\src\net\gambiter\FlashUI.as + E:\OneDrive\WoT_Mods\GUIFlash\source\res\gui\flash\as3proj\src\net\gambiter\FlashUI.as #FFFFFF 50 diff --git a/res/gui/flash/as3proj/obj/GUIFlashConfig.xml b/res/gui/flash/as3proj/obj/GUIFlashConfig.xml index d167082..0322afe 100644 --- a/res/gui/flash/as3proj/obj/GUIFlashConfig.xml +++ b/res/gui/flash/as3proj/obj/GUIFlashConfig.xml @@ -16,7 +16,7 @@ CONFIG::timeStamp - '24.12.2017' + '24.04.2019' CONFIG::air @@ -34,22 +34,22 @@ true false - C:\Games\OneDrive\WoT_Mods\GUIFlash\source\res\gui\flash\as3proj\src + E:\OneDrive\WoT_Mods\GUIFlash\source\res\gui\flash\as3proj\src C:\Program Files (x86)\FlashDevelop\Library\AS3\classes - C:\Games\OneDrive\WoT_Mods\GUIFlash\source\res\gui\flash\as3proj\swc\wg\base_app-1.0-SNAPSHOT.swc - C:\Games\OneDrive\WoT_Mods\GUIFlash\source\res\gui\flash\as3proj\swc\wg\battle.swc - C:\Games\OneDrive\WoT_Mods\GUIFlash\source\res\gui\flash\as3proj\swc\wg\common_i18n_library-1.0-SNAPSHOT.swc - C:\Games\OneDrive\WoT_Mods\GUIFlash\source\res\gui\flash\as3proj\swc\wg\common-1.0-SNAPSHOT.swc - C:\Games\OneDrive\WoT_Mods\GUIFlash\source\res\gui\flash\as3proj\swc\wg\gui_base-1.0-SNAPSHOT.swc - C:\Games\OneDrive\WoT_Mods\GUIFlash\source\res\gui\flash\as3proj\swc\wg\gui_battle-1.0-SNAPSHOT.swc - C:\Games\OneDrive\WoT_Mods\GUIFlash\source\res\gui\flash\as3proj\swc\wg\gui_lobby-1.0-SNAPSHOT.swc - C:\Games\OneDrive\WoT_Mods\GUIFlash\source\res\gui\flash\as3proj\swc\wg\lobby.swc + E:\OneDrive\WoT_Mods\GUIFlash\source\res\gui\flash\as3proj\swc\wg\base_app-1.0-SNAPSHOT.swc + E:\OneDrive\WoT_Mods\GUIFlash\source\res\gui\flash\as3proj\swc\wg\battle.swc + E:\OneDrive\WoT_Mods\GUIFlash\source\res\gui\flash\as3proj\swc\wg\common_i18n_library-1.0-SNAPSHOT.swc + E:\OneDrive\WoT_Mods\GUIFlash\source\res\gui\flash\as3proj\swc\wg\common-1.0-SNAPSHOT.swc + E:\OneDrive\WoT_Mods\GUIFlash\source\res\gui\flash\as3proj\swc\wg\gui_base-1.0-SNAPSHOT.swc + E:\OneDrive\WoT_Mods\GUIFlash\source\res\gui\flash\as3proj\swc\wg\gui_battle-1.0-SNAPSHOT.swc + E:\OneDrive\WoT_Mods\GUIFlash\source\res\gui\flash\as3proj\swc\wg\gui_lobby-1.0-SNAPSHOT.swc + E:\OneDrive\WoT_Mods\GUIFlash\source\res\gui\flash\as3proj\swc\wg\lobby.swc - C:\Games\OneDrive\WoT_Mods\GUIFlash\source\res\gui\flash\as3proj\src\net\gambiter\FlashUI.as + E:\OneDrive\WoT_Mods\GUIFlash\source\res\gui\flash\as3proj\src\net\gambiter\FlashUI.as #FFFFFF 50 diff --git a/res/gui/flash/as3proj/src/net/gambiter/FlashUI.as b/res/gui/flash/as3proj/src/net/gambiter/FlashUI.as index 3e4e0cd..e0ca783 100644 --- a/res/gui/flash/as3proj/src/net/gambiter/FlashUI.as +++ b/res/gui/flash/as3proj/src/net/gambiter/FlashUI.as @@ -7,19 +7,27 @@ import net.wg.infrastructure.managers.impl.ContainerManagerBase; import net.wg.gui.components.containers.MainViewContainer; - import net.wg.data.constants.generated.APP_CONTAINERS_NAMES; import net.wg.infrastructure.base.AbstractView; + import net.wg.data.constants.generated.APP_CONTAINERS_NAMES; public class FlashUI extends AbstractView { + private static const SCREEN_WIDTH:Number = 1024; + private static const SCREEN_HEIGHT:Number = 768; + + private static const NAME_MAIN:String = "main"; + public static var ui:FlashUI; public var py_log:Function; public var py_update:Function; public var showCursor:Boolean; - public var showFullStats:Boolean; public var showRadialMenu:Boolean; + public var showFullStats:Boolean; + public var showFullStatsQuestProgress:Boolean; + + public var screenSize:Object; private var viewContainer:MainViewContainer; private var viewPage:DisplayObjectContainer; @@ -45,8 +53,11 @@ mouseEnabled = false; showCursor = false; - showFullStats = false; showRadialMenu = false; + showFullStats = false; + showFullStatsQuestProgress = false; + + screenSize = {width: SCREEN_WIDTH, height: SCREEN_HEIGHT}; } override protected function onPopulate():void @@ -58,7 +69,7 @@ parent.removeChild(this); viewContainer = (App.containerMgr as ContainerManagerBase).containersMap[APP_CONTAINERS_NAMES.VIEWS]; viewContainer.setFocusedView(viewContainer.getTopmostView()); - viewPage = viewContainer.getChildByName("main") as DisplayObjectContainer; + viewPage = viewContainer.getChildByName(NAME_MAIN) as DisplayObjectContainer; } catch (error:Error) { @@ -71,40 +82,49 @@ super.onDispose(); } + public function as_resize(screenWidth:Number, screenHeight:Number):void + { + screenSize = {width: screenWidth, height: screenHeight}; + for (var alias:String in components) components[alias].updatePosition(); + } + public function as_cursor(arg:Boolean):void { if (arg != showCursor) showCursor = arg; - if (showCursor) - null; // App.cursor.loader.hitTestObject / App.cursor.loader.hitTestPoint - else - for (var alias:String in components) components[alias].hideCursor(); + if (!showCursor) for (var alias:String in components) components[alias].hideCursor(); } - public function as_fullStats(arg:Boolean):void + public function as_radialMenu(arg:Boolean):void { - if (arg != showFullStats) showFullStats = arg; + if (arg != showRadialMenu) showRadialMenu = arg; for (var alias:String in components) components[alias].updateVisible(); } - public function as_radialMenu(arg:Boolean):void + public function as_fullStats(arg:Boolean):void { - if (arg != showRadialMenu) showRadialMenu = arg; + if (arg != showFullStats) showFullStats = arg; for (var alias:String in components) components[alias].updateVisible(); } + public function as_fullStatsQuestProgress(arg:Boolean):void + { + if (arg != showFullStatsQuestProgress) showFullStatsQuestProgress = arg; + for (var alias:String in components) components[alias].updateVisible(); + } + public function as_create(alias:String, type:String, props:Object):void { - if (viewPage) this.createComponent(alias, type, props); + if (viewPage) createComponent(alias, type, props); } public function as_update(alias:String, props:Object):void { - if (viewPage) this.updateComponent(alias, props); + if (viewPage) updateComponent(alias, props); } public function as_delete(alias:String):void { - if (viewPage) this.deleteComponent(alias); + if (viewPage) deleteComponent(alias); } private function createComponent(alias:String, type:String, props:Object):void @@ -113,7 +133,7 @@ { var _path:Array = alias.split("."); var _name:String = _path.pop(); - var _container:DisplayObjectContainer = Properties.getComponentByPath(viewPage, _path) as DisplayObjectContainer; + var _container:DisplayObjectContainer = Properties.getComponentByPath(viewPage, _path) as DisplayObjectContainer; if (!components.hasOwnProperty(alias) && _container && !_container.getChildByName(_name)) { diff --git a/res/gui/flash/as3proj/src/net/gambiter/components/LabelEx.as b/res/gui/flash/as3proj/src/net/gambiter/components/LabelEx.as index ead3018..0d1c640 100644 --- a/res/gui/flash/as3proj/src/net/gambiter/components/LabelEx.as +++ b/res/gui/flash/as3proj/src/net/gambiter/components/LabelEx.as @@ -15,6 +15,8 @@ public class LabelEx extends UIComponentEx { + public static const NAME_FONT:String = "$UniversCondC"; + private var textField:TextField; private var _text:String; @@ -50,7 +52,7 @@ textField.autoSize = TextFieldAutoSize.LEFT; textField.antiAliasType = AntiAliasType.ADVANCED; - textField.defaultTextFormat = new TextFormat("$UniversCondC", 12, 0xFFFFFF, false, false, false, "", "", "left", 0, 0, 0, 0); + textField.defaultTextFormat = new TextFormat(NAME_FONT, 12, 0xFFFFFF, false, false, false, "", "", "left", 0, 0, 0, 0); Properties.setShadow(textField, {"distance": 4, "angle": 45, "color": 0x999999, "alpha": 1, "blurX": 4, "blurY": 4, "strength": 1, "quality": 1}); } diff --git a/res/gui/flash/as3proj/src/net/gambiter/core/UIBorderEx.as b/res/gui/flash/as3proj/src/net/gambiter/core/UIBorderEx.as index 8307daa..1687a6f 100644 --- a/res/gui/flash/as3proj/src/net/gambiter/core/UIBorderEx.as +++ b/res/gui/flash/as3proj/src/net/gambiter/core/UIBorderEx.as @@ -1,8 +1,8 @@ package net.gambiter.core { - import flash.display.Shape; - import flash.display.DisplayObject; import flash.geom.Rectangle; + import flash.display.Shape; + import flash.display.DisplayObject; public class UIBorderEx extends Shape { @@ -14,8 +14,7 @@ super(); visible = false; - _rect = new Rectangle(0, 0, 0, 0); - + _rect = new Rectangle(0, 0, 0, 0); } private function draw():void @@ -29,7 +28,7 @@ public function show():void { - if (obj) _rect = obj.getRect(obj); + if (_obj) _rect = _obj.getRect(_obj); draw(); visible = true; } @@ -38,12 +37,12 @@ { graphics.clear(); visible = false; - } + } public function update(_x_:Number, _y_:Number, _w_:Number, _h_:Number):void { _rect = new Rectangle(_x_, _y_, _w_, _h_); - } + } public function get obj():DisplayObject { diff --git a/res/gui/flash/as3proj/src/net/gambiter/core/UIComponentEx.as b/res/gui/flash/as3proj/src/net/gambiter/core/UIComponentEx.as index 70522c5..a889786 100644 --- a/res/gui/flash/as3proj/src/net/gambiter/core/UIComponentEx.as +++ b/res/gui/flash/as3proj/src/net/gambiter/core/UIComponentEx.as @@ -1,5 +1,5 @@ package net.gambiter.core -{ +{ import flash.events.Event; import flash.events.MouseEvent; import flash.display.InteractiveObject; @@ -8,7 +8,8 @@ import net.wg.infrastructure.interfaces.entity.IDraggable; import net.gambiter.FlashUI; - import net.gambiter.utils.Align; + import net.gambiter.utils.Align; + import net.gambiter.utils.Properties; import net.gambiter.core.UIBorderEx; import scaleform.clik.core.UIComponent; @@ -20,8 +21,9 @@ private var _y:Number; private var _autoSize:Boolean; private var _alignX:String; - private var _alignY:String; + private var _alignY:String; private var _drag:Boolean; + private var _limit:Boolean; private var _isDragging:Boolean; private var _border:Boolean; private var _tooltip:String; @@ -29,8 +31,9 @@ private var _index:Number; private var _visible:Boolean; - private var _fullStats:Boolean; private var _radialMenu:Boolean; + private var _fullStats:Boolean; + private var _fullStatsQuestProgress:Boolean; public function UIComponentEx() { @@ -42,6 +45,7 @@ _x = 0; _y = 0; _drag = false; + _limit = true; _border = false; _autoSize = true; _isDragging = false; @@ -49,8 +53,9 @@ _alignY = Align.TOP; _visible = true; - _fullStats = false; _radialMenu = false; + _fullStats = false; + _fullStatsQuestProgress = false; focusable = false; } @@ -59,7 +64,6 @@ { super.configUI(); App.cursor.registerDragging(this); - addEventListener(Event.RESIZE, onResize, false, 0, true); addEventListener(MouseEvent.MOUSE_OVER, onMouseOver, false, 0, true); addEventListener(MouseEvent.MOUSE_OUT, onMouseOut, false, 0, true); } @@ -67,7 +71,6 @@ override protected function onDispose():void { App.cursor.unRegisterDragging(this); - removeEventListener(Event.RESIZE, onResize); removeEventListener(MouseEvent.MOUSE_OVER, onMouseOver); removeEventListener(MouseEvent.MOUSE_OUT, onMouseOut); super.onDispose(); @@ -76,7 +79,7 @@ override protected function draw():void { super.draw(); - refresh(); + // refresh(); } public function refresh():void @@ -90,12 +93,12 @@ public function updateVisible():void { - super.visible = _visible && (!FlashUI.ui.showFullStats || _fullStats) && (!FlashUI.ui.showRadialMenu || _radialMenu); + super.visible = _visible && (!FlashUI.ui.showRadialMenu || _radialMenu) && (!FlashUI.ui.showFullStats || _fullStats) && (!FlashUI.ui.showFullStatsQuestProgress || _fullStatsQuestProgress); } private function updateIndex():void { - if ((_index != undefined) && (_index != parent.getChildIndex(this))) parent.setChildIndex(this, Math.min(_index, parent.numChildren - 1)); + if (!isNaN(_index) && (_index != parent.getChildIndex(this))) parent.setChildIndex(this, Math.min(_index, parent.numChildren - 1)); } protected function updateSize():void @@ -107,32 +110,24 @@ { null; } - - private function updatePosition():void - { - if (_alignX == Align.LEFT) super.x = Math.round(_x); - else if (_alignX == Align.CENTER) super.x = Math.round(_x + (parent.width - width) * 0.5); - else if (_alignX == Align.RIGHT) super.x = Math.round(_x + parent.width - width); - - if (_alignY == Align.TOP) super.y = Math.round(_y); - else if (_alignY == Align.CENTER) super.y = Math.round(_y + (parent.height - height) * 0.5); - else if (_alignY == Align.BOTTOM) super.y = Math.round(_y + parent.height - height); + + public function updatePosition():void + { + super.x = Math.round(_x + (parent.width - width) * Align.getFactor(_alignX)); + super.y = Math.round(_y + (parent.height - height) * Align.getFactor(_alignY)); + if (!_limit) return; + var point:Object = Properties.getLimiter(this, super.x, super.y); + super.x = point.x; + super.y = point.y; } private function updateProps():void { - var _x_:Number = _x; - var _y_:Number = _y; - - if (_alignX == Align.LEFT) _x = Math.round(super.x); - else if (_alignX == Align.CENTER) _x = Math.round(super.x - (parent.width - width) * 0.5); - else if (_alignX == Align.RIGHT) _x = Math.round(super.x - parent.width + width); - - if (_alignY == Align.TOP) _y = Math.round(super.y); - else if (_alignY == Align.CENTER) _y = Math.round(super.y - (parent.height - height) * 0.5); - else if (_alignY == Align.BOTTOM) _y = Math.round(super.y - parent.height + height); - - if ((_x != _x_) || (_y != _y_)) py_updateProps({"x": _x, "y": _y}); + var last_x:Number = _x; + var last_y:Number = _y; + _x = Math.round(super.x - (parent.width - width) * Align.getFactor(_alignX)); + _y = Math.round(super.y - (parent.height - height) * Align.getFactor(_alignY)); + if ((_x != last_x) || (_y != last_y)) py_updateProps({"x": _x, "y": _y}); } private function py_updateProps(props:Object):void @@ -140,11 +135,6 @@ FlashUI.ui.py_update(alias, props); } - private function onResize(event:Event):void - { - refresh(); - } - public function hideCursor():void { App.toolTipMgr.hide(); @@ -185,7 +175,7 @@ if (!FlashUI.ui.showCursor) return; if (!_drag) return; _isDragging = true; - startDrag(); + _limit ? startDrag(false, Properties.getBound(this)) : startDrag(); App.toolTipMgr.hide(); } @@ -195,7 +185,7 @@ _isDragging = false; stopDrag(); updateProps(); - } + } public function get drag():Boolean { @@ -207,6 +197,16 @@ if (value != _drag) _drag = value; } + public function get limit():Boolean + { + return _limit; + } + + public function set limit(value:Boolean):void + { + if (value != _limit) _limit = value; + } + public function get tooltip():String { return _tooltip; @@ -254,7 +254,7 @@ public function set alignX(value:String):void { - if ((Align.isValidH(value)) && (value != _alignX)) _alignX = value; + if ((Align.isValidX(value)) && (value != _alignX)) _alignX = value; } public function get alignY():String @@ -264,7 +264,7 @@ public function set alignY(value:String):void { - if ((Align.isValidV(value)) && (value != _alignY)) _alignY = value; + if ((Align.isValidY(value)) && (value != _alignY)) _alignY = value; } public function get autoSize():Boolean @@ -304,6 +304,16 @@ _visible = value; } + public function get radialMenu():Boolean + { + return _radialMenu; + } + + public function set radialMenu(value:Boolean):void + { + if (value != _radialMenu) _radialMenu = value; + } + public function get fullStats():Boolean { return _fullStats; @@ -314,14 +324,15 @@ if (value != _fullStats) _fullStats = value; } - public function get radialMenu():Boolean + public function get fullStatsQuestProgress():Boolean { - return _radialMenu; + return _fullStatsQuestProgress; } - public function set radialMenu(value:Boolean):void + public function set fullStatsQuestProgress(value:Boolean):void { - if (value != _radialMenu) _radialMenu = value; - } + if (value != _fullStatsQuestProgress) _fullStatsQuestProgress = value; + } + } -} +} \ No newline at end of file diff --git a/res/gui/flash/as3proj/src/net/gambiter/utils/Align.as b/res/gui/flash/as3proj/src/net/gambiter/utils/Align.as index 3e72f54..1658cde 100644 --- a/res/gui/flash/as3proj/src/net/gambiter/utils/Align.as +++ b/res/gui/flash/as3proj/src/net/gambiter/utils/Align.as @@ -10,19 +10,42 @@ public static const TOP:String = "top"; public static const BOTTOM:String = "bottom"; + private static const ZERO:Number = 0; + private static const HALF:Number = .5; + private static const FULL:Number = 1; + public static function isValid(align:String):Boolean { return align == LEFT || align == RIGHT || align == CENTER || align == TOP || align == BOTTOM; } - public static function isValidH(align:String):Boolean + public static function isValidX(align:String):Boolean { return align == LEFT || align == CENTER || align == RIGHT; } - public static function isValidV(align:String):Boolean + public static function isValidY(align:String):Boolean { return align == TOP || align == CENTER || align == BOTTOM; } + + public static function getFactor(align:String):Number + { + switch (align) + { + case LEFT: + return ZERO; + case RIGHT: + return FULL; + case CENTER: + return HALF; + case TOP: + return ZERO; + case BOTTOM: + return FULL; + default: + return ZERO; + } + } } } \ No newline at end of file diff --git a/res/gui/flash/as3proj/src/net/gambiter/utils/Components.as b/res/gui/flash/as3proj/src/net/gambiter/utils/Components.as index 8975187..3784f53 100644 --- a/res/gui/flash/as3proj/src/net/gambiter/utils/Components.as +++ b/res/gui/flash/as3proj/src/net/gambiter/utils/Components.as @@ -18,16 +18,16 @@ { switch (value) { - case COMPONENT_TYPE_PANEL: - return new PanelEx(); - case COMPONENT_TYPE_LABEL: - return new LabelEx(); - case COMPONENT_TYPE_IMAGE: - return new ImageEx(); - // case COMPONENT_TYPE_SHAPE: - // return new ShapeEx(); - default: - return null; + case COMPONENT_TYPE_PANEL: + return new PanelEx(); + case COMPONENT_TYPE_LABEL: + return new LabelEx(); + case COMPONENT_TYPE_IMAGE: + return new ImageEx(); + // case COMPONENT_TYPE_SHAPE: + // return new ShapeEx(); + default: + return null; } } } diff --git a/res/gui/flash/as3proj/src/net/gambiter/utils/Properties.as b/res/gui/flash/as3proj/src/net/gambiter/utils/Properties.as index e4cbcd8..763ece6 100644 --- a/res/gui/flash/as3proj/src/net/gambiter/utils/Properties.as +++ b/res/gui/flash/as3proj/src/net/gambiter/utils/Properties.as @@ -1,14 +1,40 @@ package net.gambiter.utils -{ +{ + import flash.geom.Point; + import flash.geom.Rectangle; import flash.display.DisplayObject; import flash.display.DisplayObjectContainer; import flash.filters.DropShadowFilter; import net.gambiter.FlashUI; import net.gambiter.core.UIComponentEx; + import net.gambiter.components.ImageEx; public class Properties - { + { + public static function getBound(obj:DisplayObject):Rectangle + { + var objRect:Rectangle = obj.getRect(obj); + var objPoint:Point = obj.localToGlobal(new Point(0, 0)); + return new Rectangle( + obj.x - objPoint.x - objRect.x, + obj.y - objPoint.y - objRect.y, + FlashUI.ui.screenSize.width - objRect.width, + FlashUI.ui.screenSize.height - objRect.height + ); + } + + public static function getLimiter(obj:DisplayObject, obj_x:Number, obj_y:Number):Object + { + var point:Object = {x: obj_x, y: obj_y}; + var rect:Rectangle = getBound(obj); + point.x = Math.max(point.x, rect.x); + point.y = Math.max(point.y, rect.y); + point.x = Math.min(point.x, rect.width); + point.y = Math.min(point.y, rect.height); + return point; + } + public static function setShadow(obj:DisplayObject, args:Object):void { if (!obj || !args) return; @@ -36,17 +62,7 @@ } FlashUI.ui.py_log("Object with linkage \'" + obj.name + "\' doesn`t contain property " + "with name \'" + arg + "\'."); } - if (obj is UIComponentEx) (obj as UIComponentEx).refresh(); - } - - public static function traceDisplayList(container:DisplayObjectContainer, indent:String = ""):void - { - for (var i:uint = 0; i < container.numChildren; i++) - { - var component:DisplayObject = container.getChildAt(i); - FlashUI.ui.py_log(indent, i, component.name); - if (container.getChildAt(i) is DisplayObjectContainer) traceDisplayList(component as DisplayObjectContainer, indent + " --| ") - } + if (obj is UIComponentEx && !(obj is ImageEx)) (obj as UIComponentEx).refresh(); } public static function getComponentByPath(container:DisplayObjectContainer, path:Array):DisplayObject @@ -61,5 +77,15 @@ } return component; } + + public static function traceDisplayList(container:DisplayObjectContainer, indent:String = ""):void + { + for (var i:uint = 0; i < container.numChildren; i++) + { + var component:DisplayObject = container.getChildAt(i); + FlashUI.ui.py_log(indent, i, component.name); + if (container.getChildAt(i) is DisplayObjectContainer) traceDisplayList(component as DisplayObjectContainer, indent + " --| ") + } + } } } \ No newline at end of file diff --git a/res/gui/flash/as3proj/swc/wg/base_app-1.0-SNAPSHOT.swc b/res/gui/flash/as3proj/swc/wg/base_app-1.0-SNAPSHOT.swc index e888b8c..c91fd09 100644 Binary files a/res/gui/flash/as3proj/swc/wg/base_app-1.0-SNAPSHOT.swc and b/res/gui/flash/as3proj/swc/wg/base_app-1.0-SNAPSHOT.swc differ diff --git a/res/gui/flash/as3proj/swc/wg/battle.swc b/res/gui/flash/as3proj/swc/wg/battle.swc index 3910960..34b4ca3 100644 Binary files a/res/gui/flash/as3proj/swc/wg/battle.swc and b/res/gui/flash/as3proj/swc/wg/battle.swc differ diff --git a/res/gui/flash/as3proj/swc/wg/common-1.0-SNAPSHOT.swc b/res/gui/flash/as3proj/swc/wg/common-1.0-SNAPSHOT.swc index 48d3007..0697284 100644 Binary files a/res/gui/flash/as3proj/swc/wg/common-1.0-SNAPSHOT.swc and b/res/gui/flash/as3proj/swc/wg/common-1.0-SNAPSHOT.swc differ diff --git a/res/gui/flash/as3proj/swc/wg/common_i18n_library-1.0-SNAPSHOT.swc b/res/gui/flash/as3proj/swc/wg/common_i18n_library-1.0-SNAPSHOT.swc index 1371c81..d26f057 100644 Binary files a/res/gui/flash/as3proj/swc/wg/common_i18n_library-1.0-SNAPSHOT.swc and b/res/gui/flash/as3proj/swc/wg/common_i18n_library-1.0-SNAPSHOT.swc differ diff --git a/res/gui/flash/as3proj/swc/wg/gui_base-1.0-SNAPSHOT.swc b/res/gui/flash/as3proj/swc/wg/gui_base-1.0-SNAPSHOT.swc index f6ff2df..3951ac6 100644 Binary files a/res/gui/flash/as3proj/swc/wg/gui_base-1.0-SNAPSHOT.swc and b/res/gui/flash/as3proj/swc/wg/gui_base-1.0-SNAPSHOT.swc differ diff --git a/res/gui/flash/as3proj/swc/wg/gui_battle-1.0-SNAPSHOT.swc b/res/gui/flash/as3proj/swc/wg/gui_battle-1.0-SNAPSHOT.swc index cb51a55..3aac0f7 100644 Binary files a/res/gui/flash/as3proj/swc/wg/gui_battle-1.0-SNAPSHOT.swc and b/res/gui/flash/as3proj/swc/wg/gui_battle-1.0-SNAPSHOT.swc differ diff --git a/res/gui/flash/as3proj/swc/wg/gui_lobby-1.0-SNAPSHOT.swc b/res/gui/flash/as3proj/swc/wg/gui_lobby-1.0-SNAPSHOT.swc index e6ec508..92be1f9 100644 Binary files a/res/gui/flash/as3proj/swc/wg/gui_lobby-1.0-SNAPSHOT.swc and b/res/gui/flash/as3proj/swc/wg/gui_lobby-1.0-SNAPSHOT.swc differ diff --git a/res/gui/flash/as3proj/swc/wg/lobby.swc b/res/gui/flash/as3proj/swc/wg/lobby.swc index 4fe97a3..fd2f5e9 100644 Binary files a/res/gui/flash/as3proj/swc/wg/lobby.swc and b/res/gui/flash/as3proj/swc/wg/lobby.swc differ diff --git a/res/scripts/client/gui/mods/gambiter/__init__.py b/res/scripts/client/gui/mods/gambiter/__init__.py index 30f9338..4243422 100644 --- a/res/scripts/client/gui/mods/gambiter/__init__.py +++ b/res/scripts/client/gui/mods/gambiter/__init__.py @@ -2,4 +2,4 @@ from flash import GUIFlash -g_guiFlash = GUIFlash() \ No newline at end of file +g_guiFlash = GUIFlash() diff --git a/res/scripts/client/gui/mods/gambiter/__init__.pyc b/res/scripts/client/gui/mods/gambiter/__init__.pyc index f8d429d..d5cf4d3 100644 Binary files a/res/scripts/client/gui/mods/gambiter/__init__.pyc and b/res/scripts/client/gui/mods/gambiter/__init__.pyc differ diff --git a/res/scripts/client/gui/mods/gambiter/flash.py b/res/scripts/client/gui/mods/gambiter/flash.py index dd7f949..142ce2e 100644 --- a/res/scripts/client/gui/mods/gambiter/flash.py +++ b/res/scripts/client/gui/mods/gambiter/flash.py @@ -2,9 +2,11 @@ __all__ = ['COMPONENT_TYPE', 'COMPONENT_ALIGN', 'COMPONENT_EVENT'] +import GUI import Event import BattleReplay import json, codecs +from gui import g_guiResetters from gui.app_loader import g_appLoader from gui.app_loader.settings import GUI_GLOBAL_SPACE_ID as SPACE_ID from gui.shared import g_eventBus, events, EVENT_BUS_SCOPE @@ -122,17 +124,26 @@ def delete(self, alias): self.ui.as_deleteS(alias) LOG_DEBUG('GUIFlash :', 'Component "%s" deleted.' % alias) + def resize(self): + if self.ui is not None: + width, height = GUI.screenResolution() + self.ui.as_resizeS(width, height) + def cursor(self, isShow): if self.ui is not None: self.ui.as_cursorS(isShow) + def radialMenu(self, isShow): + if self.ui is not None: + self.ui.as_radialMenuS(isShow) + def fullStats(self, isShow): if self.ui is not None: self.ui.as_fullStatsS(isShow) - def radialMenu(self, isShow): + def fullStatsQuestProgress(self, isShow): if self.ui is not None: - self.ui.as_radialMenuS(isShow) + self.ui.as_fullStatsQuestProgressS(isShow) class Hooks(object): @@ -150,13 +161,16 @@ def _populate(self): g_eventBus.addListener(events.GameEvent.HIDE_CURSOR, self.__handleHideCursor, EVENT_BUS_SCOPE.GLOBAL) g_eventBus.addListener(events.GameEvent.RADIAL_MENU_CMD, self.__toggleRadialMenu, scope=EVENT_BUS_SCOPE.BATTLE) g_eventBus.addListener(events.GameEvent.FULL_STATS, self.__toggleFullStats, scope=EVENT_BUS_SCOPE.BATTLE) + g_eventBus.addListener(events.GameEvent.FULL_STATS_QUEST_PROGRESS, self.__toggleFullStatsQuestProgress, scope=EVENT_BUS_SCOPE.BATTLE) + g_guiResetters.add(self.__onResizeStage) def _dispose(self): g_eventBus.removeListener(events.GameEvent.SHOW_CURSOR, self.__handleShowCursor, EVENT_BUS_SCOPE.GLOBAL) g_eventBus.removeListener(events.GameEvent.HIDE_CURSOR, self.__handleHideCursor, EVENT_BUS_SCOPE.GLOBAL) - g_eventBus.removeListener(events.GameEvent.RADIAL_MENU_CMD, self.__toggleRadialMenu, - scope=EVENT_BUS_SCOPE.BATTLE) + g_eventBus.removeListener(events.GameEvent.RADIAL_MENU_CMD, self.__toggleRadialMenu, scope=EVENT_BUS_SCOPE.BATTLE) g_eventBus.removeListener(events.GameEvent.FULL_STATS, self.__toggleFullStats, scope=EVENT_BUS_SCOPE.BATTLE) + g_eventBus.removeListener(events.GameEvent.FULL_STATS_QUEST_PROGRESS, self.__toggleFullStatsQuestProgress, scope=EVENT_BUS_SCOPE.BATTLE) + g_guiResetters.discard(self.__onResizeStage) def __onGUISpaceEntered(self, spaceID): if spaceID == SPACE_ID.LOGIN: @@ -174,6 +188,9 @@ def __onGUISpaceLeft(self, spaceID): elif spaceID == SPACE_ID.BATTLE: g_guiEvents.leaveBattle() + def __onResizeStage(self): + g_guiEvents.resizeStage() + def __handleShowCursor(self, _): isShow = True g_guiEvents.toggleCursor(isShow) @@ -182,16 +199,20 @@ def __handleHideCursor(self, _): isShow = False g_guiEvents.toggleCursor(isShow) - def __toggleFullStats(self, event): - isDown = event.ctx['isDown'] - g_guiEvents.toggleFullStats(isDown) - def __toggleRadialMenu(self, event): if BattleReplay.isPlaying(): return isDown = event.ctx['isDown'] g_guiEvents.toggleRadialMenu(isDown) + def __toggleFullStats(self, event): + isDown = event.ctx['isDown'] + g_guiEvents.toggleFullStats(isDown) + + def __toggleFullStatsQuestProgress(self, event): + isDown = event.ctx['isDown'] + g_guiEvents.toggleFullStatsQuestProgress(isDown) + class Events(object): @@ -213,21 +234,26 @@ def leaveLobby(self): def leaveBattle(self): pass + def resizeStage(self): + g_guiViews.resize() + def toggleCursor(self, isShow): g_guiViews.cursor(isShow) + def toggleRadialMenu(self, isShow): + g_guiViews.radialMenu(isShow) + def toggleFullStats(self, isShow): g_guiViews.fullStats(isShow) - def toggleRadialMenu(self, isShow): - g_guiViews.radialMenu(isShow) + def toggleFullStatsQuestProgress(self, isShow): + g_guiViews.fullStatsQuestProgress(isShow) class Settings(object): def _start(self): - g_entitiesFactories.addSettings( - ViewSettings(CONSTANTS.VIEW_ALIAS, Flash_UI, CONSTANTS.FILE_NAME, ViewTypes.WINDOW, None, ScopeTemplates.GLOBAL_SCOPE)) + g_entitiesFactories.addSettings(ViewSettings(CONSTANTS.VIEW_ALIAS, Flash_UI, CONSTANTS.FILE_NAME, ViewTypes.WINDOW, None, ScopeTemplates.GLOBAL_SCOPE)) def _destroy(self): g_entitiesFactories.removeSettings(CONSTANTS.VIEW_ALIAS) @@ -253,17 +279,25 @@ def as_deleteS(self, alias): if self._isDAAPIInited(): return self.flashObject.as_delete(alias) + def as_resizeS(self, width, height): + if self._isDAAPIInited(): + return self.flashObject.as_resize(width, height) + def as_cursorS(self, isShow): if self._isDAAPIInited(): return self.flashObject.as_cursor(isShow) + def as_radialMenuS(self, isShow): + if self._isDAAPIInited(): + return self.flashObject.as_radialMenu(isShow) + def as_fullStatsS(self, isShow): if self._isDAAPIInited(): return self.flashObject.as_fullStats(isShow) - def as_radialMenuS(self, isShow): + def as_fullStatsQuestProgressS(self, isShow): if self._isDAAPIInited(): - return self.flashObject.as_radialMenu(isShow) + return self.flashObject.as_fullStatsQuestProgress(isShow) class Flash_UI(Flash_Meta): @@ -272,6 +306,7 @@ def _populate(self): super(Flash_UI, self)._populate() g_guiHooks._populate() g_guiViews.ui = self + g_guiViews.resize() g_guiViews.createAll() def _dispose(self): @@ -283,8 +318,9 @@ def py_log(self, *args): LOG_NOTE('GUIFlash :', *args) def py_update(self, alias, props): - g_guiCache.update(alias, props.toDict()) - COMPONENT_EVENT.UPDATED(alias, props.toDict()) + if g_guiCache.isComponent(alias): + g_guiCache.update(alias, props.toDict()) + COMPONENT_EVENT.UPDATED(alias, props.toDict()) class GUIFlash(object): diff --git a/res/scripts/client/gui/mods/gambiter/flash.pyc b/res/scripts/client/gui/mods/gambiter/flash.pyc index 547fe88..6b0412f 100644 Binary files a/res/scripts/client/gui/mods/gambiter/flash.pyc and b/res/scripts/client/gui/mods/gambiter/flash.pyc differ diff --git a/res/scripts/client/gui/mods/gambiter/utils.py b/res/scripts/client/gui/mods/gambiter/utils.py index c133d61..70fada9 100644 --- a/res/scripts/client/gui/mods/gambiter/utils.py +++ b/res/scripts/client/gui/mods/gambiter/utils.py @@ -4,6 +4,7 @@ IS_DEBUG = False + def LOG(arg, *args): print str(arg), ' '.join([str(arg) for arg in args]) @@ -22,9 +23,7 @@ def LOG_DEBUG(*args): def LOG_TRACE(exc=None): - import traceback - print('=') * 25 if exc is not None: LOG_ERROR(exc) @@ -160,4 +159,4 @@ def decorator2(handler): registerEvent = _hook_decorator(_RegisterEvent) overrideMethod = _hook_decorator(_OverrideMethod) overrideStaticMethod = _hook_decorator(_OverrideStaticMethod) -overrideClassMethod = _hook_decorator(_OverrideClassMethod) +overrideClassMethod = _hook_decorator(_OverrideClassMethod) \ No newline at end of file diff --git a/res/scripts/client/gui/mods/gambiter/utils.pyc b/res/scripts/client/gui/mods/gambiter/utils.pyc index aa644a7..a1916e1 100644 Binary files a/res/scripts/client/gui/mods/gambiter/utils.pyc and b/res/scripts/client/gui/mods/gambiter/utils.pyc differ