diff --git a/meta.xml b/meta.xml index e199e84..43901fc 100644 --- a/meta.xml +++ b/meta.xml @@ -1,6 +1,6 @@ gambiter.guiflash - 0.2.1 + 0.2.2 GUIFlash Flash components for use in python mods. - \ No newline at end of file + diff --git a/res/gui/flash/GUIFlash.swf b/res/gui/flash/GUIFlash.swf index 972844b..2a5132f 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 97cc61d..be3a2c8 100644 --- a/res/gui/flash/as3proj/obj/GUIFlashConfig.old +++ b/res/gui/flash/as3proj/obj/GUIFlashConfig.old @@ -37,16 +37,7 @@ C:\Games\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 - + C:\Games\OneDrive\WoT_Mods\GUIFlash\source\res\gui\flash\as3proj\src\net\gambiter\FlashUI.as diff --git a/res/gui/flash/as3proj/src/net/gambiter/FlashUI.as b/res/gui/flash/as3proj/src/net/gambiter/FlashUI.as index 71af8be..d57fe2c 100644 --- a/res/gui/flash/as3proj/src/net/gambiter/FlashUI.as +++ b/res/gui/flash/as3proj/src/net/gambiter/FlashUI.as @@ -1,41 +1,36 @@ package net.gambiter { import flash.display.DisplayObjectContainer; - import flash.events.Event; - import net.wg.infrastructure.base.AbstractView; - import net.wg.gui.components.containers.MainViewContainer; + import net.gambiter.utils.Components; + import net.gambiter.utils.Properties; + import net.wg.infrastructure.managers.impl.ContainerManagerBase; + import net.wg.gui.components.containers.MainViewContainer; import net.wg.data.constants.ContainerTypes; - - import net.gambiter.utils.Properties; - import net.gambiter.utils.Components; - + import net.wg.infrastructure.base.AbstractView; + public class FlashUI extends AbstractView { - public static var ui:FlashUI = null; - - private var viewContainer:MainViewContainer = null; - - private var viewPage:DisplayObjectContainer = null; - - public var py_update:Function; + public static var ui:FlashUI; public var py_log:Function; + public var py_update:Function; - private var components:Object = null; + public var showCursor:Boolean; + public var showFullStats:Boolean; + public var showRadialMenu:Boolean; - public var showCursor:Boolean = false; + private var viewContainer:MainViewContainer; + private var viewPage:DisplayObjectContainer; - public var showFullStats:Boolean = false; + private var components:Object; - public var showRadialMenu:Boolean = false; - public function FlashUI() { super(); - ui = this; + ui = this; components = {}; } @@ -48,14 +43,18 @@ tabEnabled = false; tabChildren = false; mouseEnabled = false; + + showCursor = false; + showFullStats = false; + showRadialMenu = false; } - override protected function onPopulate() : void - { + override protected function onPopulate():void + { super.onPopulate(); try - { + { parent.removeChild(this); viewContainer = (App.containerMgr as ContainerManagerBase).containersMap[ContainerTypes.VIEW]; viewContainer.setFocusedView(viewContainer.getTopmostView()); @@ -65,102 +64,99 @@ { py_log(error.getStackTrace()); } - } - - override protected function onDispose() : void - { + } + + override protected function onDispose():void + { super.onDispose(); - } + } - public function as_cursor(arg:Boolean) : void + 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) null; // App.cursor.loader.hitTestObject / App.cursor.loader.hitTestPoint + else + for (var alias:String in components) components[alias].hideCursor(); } - public function as_fullStats(arg:Boolean) : void + public function as_fullStats(arg:Boolean):void { if (arg != showFullStats) showFullStats = arg; for (var alias:String in components) components[alias].visible = !(showFullStats || showRadialMenu); } - public function as_radialMenu(arg:Boolean) : void + public function as_radialMenu(arg:Boolean):void { if (arg != showRadialMenu) showRadialMenu = arg; for (var alias:String in components) components[alias].visible = !(showFullStats || showRadialMenu); } - public function as_create(alias:String, type:String, props:Object) : void - { + public function as_create(alias:String, type:String, props:Object):void + { + if (viewPage) this.createComponent(alias, type, props); + } + + public function as_update(alias:String, props:Object):void + { + if (viewPage) this.updateComponent(alias, props); + } + + public function as_delete(alias:String):void + { + if (viewPage) this.deleteComponent(alias); + } + + private function createComponent(alias:String, type:String, props:Object):void + { try { - if (viewPage) this.createComponent(alias, type, props); + var _path:Array = alias.split("."); + var _name:String = _path.pop(); + var _container:DisplayObjectContainer = Properties.getComponentByPath(viewPage, _path) as DisplayObjectContainer; + + if (!components.hasOwnProperty(alias) && _container && !_container.getChildByName(_name)) + { + components[alias] = Components.getClass(type); + components[alias].name = _name; + components[alias].alias = alias; + _container.addChild(components[alias]); + Properties.setProperty(components[alias], props); + } + else py_log("Error creating component '" + _name + "' (" + alias + ")!"); } catch (error:Error) { py_log(error.getStackTrace()); } - } + } - public function as_update(alias:String, props:Object) : void - { + private function updateComponent(alias:String, props:Object):void + { try { - if (viewPage) this.updateComponent(alias, props); + if (components.hasOwnProperty(alias)) Properties.setProperty(components[alias], props); + else Properties.setProperty(Properties.getComponentByPath(viewPage, alias.split(".")), props); } catch (error:Error) { py_log(error.getStackTrace()); } - } - - public function as_delete(alias:String) : void - { + } + + private function deleteComponent(alias:String):void + { try { - if (viewPage) this.deleteComponent(alias); + if (components.hasOwnProperty(alias)) + { + components[alias].parent.removeChild(components[alias]); + delete components[alias]; + } } catch (error:Error) { py_log(error.getStackTrace()); } - } - - private function createComponent(alias:String, type:String, props:Object) : void - { - var _path:Array = alias.split("."); - - var _name:String = _path.pop(); - - var _container:DisplayObjectContainer = Properties.getComponentByPath(viewPage, _path) as DisplayObjectContainer; - - if (!components.hasOwnProperty(alias) && _container && !_container.getChildByName(_name)) - { - components[alias] = Components.getClass(type); - components[alias].name = _name; - components[alias].alias = alias; - - _container.addChild(components[alias]); - - Properties.setProperty(components[alias], props); - } - else py_log("Error creating component '" + _name + "' (" + alias + ")!"); } - - private function updateComponent(alias:String, props:Object) : void - { - if (components.hasOwnProperty(alias)) Properties.setProperty(components[alias], props); - else Properties.setProperty(Properties.getComponentByPath(viewPage, alias.split(".")), props); - } - - private function deleteComponent(alias:String) : void - { - if (components.hasOwnProperty(alias)) - { - components[alias].parent.removeChild(components[alias]); - delete components[alias]; - } - } } } \ No newline at end of file diff --git a/res/gui/flash/as3proj/src/net/gambiter/components/ImageEx.as b/res/gui/flash/as3proj/src/net/gambiter/components/ImageEx.as index 7867fdb..3b82a2d 100644 --- a/res/gui/flash/as3proj/src/net/gambiter/components/ImageEx.as +++ b/res/gui/flash/as3proj/src/net/gambiter/components/ImageEx.as @@ -1,25 +1,21 @@ package net.gambiter.components { import flash.display.Loader; - import flash.net.URLRequest; - import flash.events.IOErrorEvent; import flash.events.Event; - - import scaleform.clik.constants.InvalidationType; - - import net.gambiter.FlashUI; + import flash.events.IOErrorEvent; + import flash.net.URLRequest; import net.gambiter.core.UIComponentEx; public class ImageEx extends UIComponentEx - { - public var loader:Loader; + { + private var loader:Loader; - private var _source:String; + private var _source:String; private var _sourceAlt:String; - private var _autoSize:Boolean; - private var _loadFailed:Boolean; - private var _loadInProgress:Boolean; + private var _autoSize:Boolean; + private var _loadFailed:Boolean; + private var _loadInProgress:Boolean; private var _previousContentUnloaded:Boolean; public function ImageEx() @@ -27,16 +23,14 @@ super(); loader = new Loader(); + loader.name = "image"; addChild(loader); _source = ""; _sourceAlt = ""; - _autoSize = true; - _loadFailed = false; _loadInProgress = false; - _previousContentUnloaded = true; addLoaderListener(); @@ -48,7 +42,7 @@ } override protected function onDispose():void - { + { if (loader != null) { removeLoaderListener(); @@ -58,11 +52,10 @@ } super.onDispose(); } - override public function refresh():void - { - if (_loadFailed || _loadInProgress) return; + { + if (_loadFailed || _loadInProgress) return; if (_autoSize) { loader.width = _originalWidth; @@ -76,14 +69,6 @@ super.refresh(); } - override protected function updateRect() : void - { - borderRect.x = loader.x; - borderRect.y = loader.y; - borderRect.width = loader.width; - borderRect.height = loader.height; - } - private function startLoad(url:String):void { _source = url; @@ -194,7 +179,7 @@ private function onLoaderCompleteHandler(e:Event):void { _loadFailed = false; - _loadInProgress = false; + _loadInProgress = false; initialize(); refresh(); loadComplete(); 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 16a6bbb..b2f04a9 100644 --- a/res/gui/flash/as3proj/src/net/gambiter/components/LabelEx.as +++ b/res/gui/flash/as3proj/src/net/gambiter/components/LabelEx.as @@ -1,5 +1,7 @@ package net.gambiter.components { + import flash.geom.Rectangle; + import flash.text.TextField; import flash.text.TextFormat; import flash.text.AntiAliasType; @@ -7,49 +9,47 @@ import scaleform.gfx.TextFieldEx; import net.gambiter.FlashUI; - - import net.gambiter.utils.Constants; + import net.gambiter.utils.Constants; import net.gambiter.utils.Properties; - import net.gambiter.core.UIComponentEx; public class LabelEx extends UIComponentEx { - public var textField:TextField; + private var textField:TextField; - private var _text:String; - private var _html:Boolean; - private var _hAlign:String; - private var _vAlign:String; - private var _autoSize:Boolean; + private var _text:String; + private var _isHtml:Boolean; + private var _autoSize:Boolean; + private var _textAlignX:String; + private var _textAlignY:String; public function LabelEx() { super(); - textField = new TextField(); + textField = new TextField(); + textField.name = "textField"; addChild(textField); - _html = true; + _isHtml = true; _autoSize = true; - - _hAlign = Constants.ALIGN_LEFT; - _vAlign = Constants.ALIGN_TOP; + _textAlignX = Constants.ALIGN_LEFT; + _textAlignY = Constants.ALIGN_TOP; textField.multiline = false; textField.embedFonts = true; textField.selectable = false; - textField.tabEnabled = false; + textField.tabEnabled = false; textField.mouseEnabled = false; textField.condenseWhite = false; textField.antiAliasType = AntiAliasType.ADVANCED; - textField.defaultTextFormat = new TextFormat("$UniversCondC", 12, 0xFFFFFF, false, false, false, "", "", "left", 0, 0, 0, 0); + textField.defaultTextFormat = new TextFormat("$UniversCondC", 12, 0xFFFFFF, false, false, false, "", "", "left", 0, 0, 0, 0); Properties.setShadow(textField, {"distance": 4, "angle": 45, "color": 0, "alpha": 1, "blurX": 4, "blurY": 4, "strength": 1, "quality": 1}); } override protected function configUI():void { - super.configUI(); + super.configUI(); } override protected function onDispose():void @@ -58,120 +58,128 @@ } override public function refresh():void - { + { updateSize(); super.refresh(); } - override protected function updateRect() : void - { - borderRect.x = textField.x; - borderRect.y = textField.y; - borderRect.width = textField.width; - borderRect.height = textField.height; + override protected function updateRect():void + { + _rect.x = 0; + _rect.y = 0; + _rect.width = width; + _rect.height = height; } - private function updateText() : void - { - if (_text == null || textField == null) return; - if (_html) textField.htmlText = _text; + private function updateText():void + { + if (_text == null || textField == null) return; + if (_isHtml) textField.htmlText = _text; else textField.text = _text; - updateSize(); - } + } - private function updateSize() : void - { - if (_autoSize) - { - - textField.width = Math.ceil(textField.textWidth + 4); - textField.height = Math.ceil(textField.textHeight + 2); - // Добавить выравнивание по ширине и высоте. - // if (_align == "left") textField.y = 0; - // else if (_align == "center") textField.y = Math.round((textField.height - textField.textHeight) * 0.5); - // else if (_align == "right") textField.y = Math.round(textField.height - textField.textHeight); - textField.x = 0; // .. - textField.y = 0; // .. - - super.width = textField.width; - super.height = textField.height; - - FlashUI.ui.py_update(alias, {"width": _width, "height": _height}); - } + private function updateSize():void + { + textField.x = 1; + textField.y = 1; + textField.width = _originalWidth; + textField.height = _originalHeight; + + if (_autoSize) textField.autoSize = Constants.ALIGN_LEFT; else { - textField.x = 0; - textField.y = 0; - textField.width = _width; - textField.height = _height; - } - } - - public function get text() : String - { - return _text; - } - - public function set text(value:String) : void - { - _text = value || ""; - updateText(); - } - - public function get html() : Boolean - { - return _html; - } - - public function set html(value:Boolean) : void - { - _html = value; - updateText(); - } - - public function get autoSize() : Boolean - { - return _autoSize; - } - - public function set autoSize(value:Boolean) : void - { - if (value == _autoSize) return; - _autoSize = value; - } - - public function get multiline() : Boolean - { - return textField.multiline; - } - - public function set multiline(value:Boolean) : void - { - textField.multiline = value; - updateText(); - } - - public function get selectable() : Boolean - { - return textField.selectable; - } - - public function set selectable(value:Boolean) : void - { - textField.selectable = value; + textField.autoSize = _textAlignX; + TextFieldEx.setVerticalAlign(textField, _textAlignY); + } + } + + public function get text():String + { + return _text; + } + + public function set text(value:String):void + { + _text = value || ""; updateText(); - } - - public function get condenseWhite() : Boolean - { - return textField.condenseWhite; - } - - public function set condenseWhite(value:Boolean) : void - { - textField.condenseWhite = value; + } + + public function get isHtml():Boolean + { + return _isHtml; + } + + public function set isHtml(value:Boolean):void + { + _isHtml = value; updateText(); - } + } + + public function get autoSize():Boolean + { + return _autoSize; + } + + public function set autoSize(value:Boolean):void + { + if (value == _autoSize) return; + _autoSize = value; + } + + public function get textAlignX():String + { + return _textAlignX; + } + + public function set textAlignX(value:String):void + { + if (value == _textAlignX) return; + _textAlignX = value; + } + + public function get textAlignY():String + { + return _textAlignY; + } + + public function set textAlignY(value:String):void + { + if (value == _textAlignY) return; + _textAlignY = value; + } + + public function get multiline():Boolean + { + return textField.multiline; + } + + public function set multiline(value:Boolean):void + { + if (value == textField.multiline) return; + textField.multiline = value; + } + + public function get selectable():Boolean + { + return textField.selectable; + } + + public function set selectable(value:Boolean):void + { + if (value == textField.selectable) return; + textField.selectable = value; + } + + public function get condenseWhite():Boolean + { + return textField.condenseWhite; + } + + public function set condenseWhite(value:Boolean):void + { + if (value == textField.condenseWhite) return; + textField.condenseWhite = value; + } public function set shadow(args:Object):void { @@ -179,15 +187,17 @@ } override public function set width(value:Number):void - { + { _autoSize = false; + _originalWidth = value; super.width = value; } override public function set height(value:Number):void { _autoSize = false; - super.height = value; + _originalHeight = value; + super.height = value; } } } \ No newline at end of file diff --git a/res/gui/flash/as3proj/src/net/gambiter/components/PanelEx.as b/res/gui/flash/as3proj/src/net/gambiter/components/PanelEx.as index 2fa88ca..c572c53 100644 --- a/res/gui/flash/as3proj/src/net/gambiter/components/PanelEx.as +++ b/res/gui/flash/as3proj/src/net/gambiter/components/PanelEx.as @@ -2,21 +2,12 @@ { import net.gambiter.core.UIComponentEx; - public class PanelEx extends UIComponentEx - { + public class PanelEx extends UIComponentEx + { public function PanelEx() - { - super(); - } - - override protected function updateRect() : void - { - borderRect = getRect(parent); - borderRect.x = Math.round(borderRect.x - x); - borderRect.y = Math.round(borderRect.y - y); - borderRect.width = Math.round(borderRect.x + borderRect.width); - borderRect.height = Math.round(borderRect.y + borderRect.height); + { + super(); } - } + } } 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 d2a1fdf..622e9d2 100644 --- a/res/gui/flash/as3proj/src/net/gambiter/core/UIComponentEx.as +++ b/res/gui/flash/as3proj/src/net/gambiter/core/UIComponentEx.as @@ -1,69 +1,64 @@ package net.gambiter.core { - import flash.display.DisplayObject; import flash.display.Shape; import flash.geom.Rectangle; - import net.gambiter.utils.Constants; - import net.gambiter.utils.Properties; - - import net.gambiter.FlashUI; - import flash.events.Event; import flash.events.MouseEvent; import flash.display.InteractiveObject; - import scaleform.clik.constants.InvalidationType; - - import net.wg.data.constants.Errors; import net.wg.data.constants.DragType; import net.wg.infrastructure.interfaces.entity.IDraggable; + import net.gambiter.FlashUI; + import net.gambiter.utils.Constants; + import scaleform.clik.core.UIComponent; - public class UIComponentEx extends UIComponent implements IDraggable - { - protected var borderRect:Rectangle; - private var borderEx : Shape; - private var _x : Number; - private var _y : Number; - private var _alignX : String; - private var _alignY : String; - private var _drag : Boolean; - private var _isDragging : Boolean; - private var _border : Boolean; - private var _tooltip : String; - private var _alias : String; - private var _index : Number; - + public class UIComponentEx extends UIComponent implements IDraggable + { + private var borderEx:Shape; + + private var _x:Number; + private var _y:Number; + private var _alignX:String; + private var _alignY:String; + private var _drag:Boolean; + private var _isDragging:Boolean; + private var _border:Boolean; + private var _tooltip:String; + private var _alias:String; + private var _index:Number; + + protected var _rect:Rectangle; + public function UIComponentEx() - { - super(); - + { + super(); + borderEx = new Shape(); - addChild(borderEx); borderEx.visible = false; - borderRect = new Rectangle(); - + addChild(borderEx); + + _rect = new Rectangle(); + _x = 0; _y = 0; - _drag = false; _isDragging = false; - _alignX = Constants.ALIGN_LEFT; _alignY = Constants.ALIGN_TOP; - - focusable = false; - } + + focusable = false; + } override protected function configUI():void { - super.configUI(); + 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); + addEventListener(MouseEvent.MOUSE_OVER, onMouseOver, false, 0, true); + addEventListener(MouseEvent.MOUSE_OUT, onMouseOut, false, 0, true); } override protected function onDispose():void @@ -81,46 +76,50 @@ } public function refresh():void - { - updatePosition(); - } + { + updatePosition(); + } - protected function updateRect() : void - { - borderRect.x = 0; - borderRect.y = 0; - borderRect.width = 0; - borderRect.height = 0; + protected function updateRect():void + { + _rect = getBounds(parent); + _rect.x = Math.round(_rect.x - x); + _rect.y = Math.round(_rect.y - y); + _rect.width = Math.round(_rect.width); + _rect.height = Math.round(_rect.height); } private function showBorder():void { - updateRect(); - var color:uint = 10066329; borderEx.graphics.clear(); - borderEx.graphics.beginFill(color, 0.1); - borderEx.graphics.lineStyle(1, color, 1, true); - borderEx.graphics.moveTo(borderRect.x, borderRect.y); - borderEx.graphics.lineTo(borderRect.width, borderRect.y); - borderEx.graphics.lineTo(borderRect.width, borderRect.height); - borderEx.graphics.lineTo(borderRect.x, borderRect.height); - borderEx.graphics.lineTo(borderRect.x, borderRect.y); + + updateRect(); + + borderEx.graphics.beginFill(0x999999, 0.1); + borderEx.graphics.lineStyle(1, 0x999999, 1, true); + borderEx.graphics.drawRect(_rect.x, _rect.y, _rect.width, _rect.height); borderEx.graphics.endFill(); + borderEx.visible = true; } private function hideBorder():void - { + { if (borderEx.visible) borderEx.visible = false; } + private function updateProps(props:Object):void + { + FlashUI.ui.py_update(_alias, props); + } + private function updateIndex():void - { + { parent.setChildIndex(this, _index || parent.numChildren - 1); } private function updatePosition():void - { + { if (_alignX == Constants.ALIGN_LEFT) super.x = Math.round(_x); else if (_alignX == Constants.ALIGN_CENTER) super.x = Math.round(_x + (parent.width - width) * 0.5); else if (_alignX == Constants.ALIGN_RIGHT) super.x = Math.round(_x + parent.width - width); @@ -131,7 +130,10 @@ } private function getPosition():void - { + { + var _x_:Number = _x; + var _y_:Number = _y; + if (_alignX == Constants.ALIGN_LEFT) _x = Math.round(super.x); else if (_alignX == Constants.ALIGN_CENTER) _x = Math.round(super.x - (parent.width - width) * 0.5); else if (_alignX == Constants.ALIGN_RIGHT) _x = Math.round(super.x - parent.width + width); @@ -139,64 +141,65 @@ if (_alignY == Constants.ALIGN_TOP) _y = Math.round(super.y); else if (_alignY == Constants.ALIGN_CENTER) _y = Math.round(super.y - (parent.height - height) * 0.5); else if (_alignY == Constants.ALIGN_BOTTOM) _y = Math.round(super.y - parent.height + height); + + if ((_x != _x_) || (_y != _y_)) updateProps({"x": _x, "y": _y}); } private function onResize(event:Event):void - { + { refresh(); } - public function hideCursor() : void + public function hideCursor():void { App.toolTipMgr.hide(); onEndDrag(); hideBorder(); } - private function onMouseOver(event:MouseEvent) : void + private function onMouseOver(event:MouseEvent):void { if (!FlashUI.ui.showCursor) return; if (_tooltip && !_isDragging) App.toolTipMgr.show(_tooltip); if (_border) showBorder(); } - - private function onMouseOut(event:MouseEvent) : void + + private function onMouseOut(event:MouseEvent):void { if (_tooltip) App.toolTipMgr.hide(); hideBorder(); } - public function getHitArea() : InteractiveObject - { - return this; - } + public function getHitArea():InteractiveObject + { + return this; + } + + public function getDragType():String + { + return DragType.SOFT; + } - public function getDragType() : String - { - return DragType.SOFT; - } - - public function onDragging(_x:Number, _y:Number) : void + public function onDragging(_x:Number, _y:Number):void { null; } - public function onStartDrag() : void - { + public function onStartDrag():void + { if (!FlashUI.ui.showCursor) return; if (!_drag) return; _isDragging = true; - startDrag(); + startDrag(); App.toolTipMgr.hide(); } - public function onEndDrag() : void - { + public function onEndDrag():void + { if (!_isDragging) return; - _isDragging = false; - stopDrag(); - getPosition(); - FlashUI.ui.py_update(_alias, {"x": _x, "y": _y}); + _isDragging = false; + stopDrag(); + getPosition(); } public function set drag(value:Boolean):void @@ -209,90 +212,78 @@ return _drag; } - public function set tooltip(value:String) : void + public function set tooltip(value:String):void { if (_tooltip != value) _tooltip = value; } - public function get tooltip() : String + public function get tooltip():String { return _tooltip; } - public function set alias(value:String) : void + public function set alias(value:String):void { if (_alias != value) _alias = value; } - public function get alias() : String + public function get alias():String { return _alias; } - public function set border(value:Boolean) : void + public function set border(value:Boolean):void { if (value != _border) _border = value; } - public function get border() : Boolean + public function get border():Boolean { return _border; } - public function set index(value:Number) : void + public function set index(value:Number):void { if (value == _index) return; _index = value; updateIndex(); } - public function get index() : Number + public function get index():Number { return _index; } - public function set alignX(value:String) : void + public function set alignX(value:String):void { if (value != Constants.ALIGN_LEFT && value != Constants.ALIGN_CENTER && value != Constants.ALIGN_RIGHT) return; if (_alignX != value) _alignX = value; } - public function get alignX() : String + public function get alignX():String { return _alignX; } - public function set alignY(value:String) : void + public function set alignY(value:String):void { if (value != Constants.ALIGN_TOP && value != Constants.ALIGN_CENTER && value != Constants.ALIGN_BOTTOM) return; if (alignY != value) _alignY = value; } - public function get alignY() : String + public function get alignY():String { return _alignY; } - override public function set width(value:Number) : void - { - super.width = value; - // refresh(); - } - - override public function set height(value:Number) : void - { - super.height = value; - // refresh(); - } - - override public function set x(value:Number) : void + override public function set x(value:Number):void { _x = value; } - override public function set y(value:Number) : void + override public function set y(value:Number):void { _y = value; } - } + } } 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 a5582f0..efe6aec 100644 --- a/res/gui/flash/as3proj/src/net/gambiter/utils/Components.as +++ b/res/gui/flash/as3proj/src/net/gambiter/utils/Components.as @@ -5,6 +5,7 @@ import net.gambiter.components.PanelEx; import net.gambiter.components.LabelEx; import net.gambiter.components.ImageEx; + // import net.gambiter.components.ScopeEx; public class Components @@ -14,15 +15,19 @@ public static const COMPONENT_TYPE_IMAGE:String = "image"; public static const COMPONENT_TYPE_SCOPE:String = "scope"; - public static function getClass(value:String) : DisplayObject + public static function getClass(value:String):DisplayObject { switch (value.toLowerCase()) { - case COMPONENT_TYPE_PANEL: return new PanelEx(); - case COMPONENT_TYPE_LABEL: return new LabelEx(); - case COMPONENT_TYPE_IMAGE: return new ImageEx(); - // case COMPONENT_TYPE_SCOPE: return new ScopeEx(); - 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_SCOPE: return new ScopeEx(); + default: + return null; } } } diff --git a/res/gui/flash/as3proj/src/net/gambiter/utils/Constants.as b/res/gui/flash/as3proj/src/net/gambiter/utils/Constants.as index e171957..2c599a0 100644 --- a/res/gui/flash/as3proj/src/net/gambiter/utils/Constants.as +++ b/res/gui/flash/as3proj/src/net/gambiter/utils/Constants.as @@ -1,5 +1,6 @@ package net.gambiter.utils { + public class Constants { public static const ALIGN_LEFT:String = "left"; 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 6eb3ead..38dd91d 100644 --- a/res/gui/flash/as3proj/src/net/gambiter/utils/Properties.as +++ b/res/gui/flash/as3proj/src/net/gambiter/utils/Properties.as @@ -2,49 +2,31 @@ { import flash.display.DisplayObject; import flash.display.DisplayObjectContainer; - - import flash.text.TextField; - import flash.text.TextFormat; - import flash.filters.DropShadowFilter; import net.gambiter.FlashUI; - import net.gambiter.core.UIComponentEx; public class Properties { - public static function setShadow(obj:DisplayObject, args:Object) : void + public static function setShadow(obj:DisplayObject, args:Object):void { + if (!obj || !args) return; var shadow:DropShadowFilter = new DropShadowFilter(); - var arg:String = null; - if (args) { for (arg in args) - { - if (shadow.hasOwnProperty(arg)) - { - shadow[arg] = args[arg]; - } - } - + if (shadow.hasOwnProperty(arg)) shadow[arg] = args[arg]; obj.filters = [shadow]; } - else - { - obj.filters = null; - } + else obj.filters = null; } - public static function setProperty(obj:DisplayObject, args:Object) : void + public static function setProperty(obj:DisplayObject, args:Object):void { if (!obj || !args) return; - var arg:String = null; - var exc:String = null; - for (arg in args) { if (obj.hasOwnProperty(arg)) @@ -52,32 +34,30 @@ obj[arg] = args[arg]; continue; } - exc = "Object with linkage \'" + obj.name + "\' doesn`t contain property " + "with name \'" + arg + "\'."; - FlashUI.ui.py_log(exc); + 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 + " --| ") - } + 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 + " --| ") + } } - public static function getComponentByPath(container:DisplayObjectContainer, path:Array) : DisplayObject + public static function getComponentByPath(container:DisplayObjectContainer, path:Array):DisplayObject { var component:DisplayObject = container as DisplayObject; - for each(var item:String in path) + for each (var item:String in path) { if (!container) break; component = container.getChildByName(item); if (!component) break; - container = component as DisplayObjectContainer; + container = component as DisplayObjectContainer; } return component; } 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 48b9608..37dc8a8 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 ead43bc..fb5b15e 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 58cb767..50121c2 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 b44cd12..e943249 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 d93bcda..6d35348 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 ec69d3f..0a0265b 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 67851a6..605b39d 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 fbb16fe..a4ee609 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 646c619..f708e6a 100644 --- a/res/scripts/client/gui/mods/gambiter/__init__.py +++ b/res/scripts/client/gui/mods/gambiter/__init__.py @@ -3,8 +3,8 @@ from flash import GUIFlash title = 'GUIFlash' -version = '0.2.1' -date = '13.12.2017' +version = '0.2.2' +date = '19.12.2017' author = 'GambitER' print '[LOAD] %s .. v.%s (%s) by %s' % (title, version, date, author) diff --git a/res/scripts/client/gui/mods/gambiter/__init__.pyc b/res/scripts/client/gui/mods/gambiter/__init__.pyc index 60e925c..ebaf3c3 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.pyc b/res/scripts/client/gui/mods/gambiter/flash.pyc index add0242..d4187a5 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 7186ace..4306d4c 100644 --- a/res/scripts/client/gui/mods/gambiter/utils.py +++ b/res/scripts/client/gui/mods/gambiter/utils.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- -IS_DEBUG = True +IS_DEBUG = False def LOG(arg, *args): diff --git a/res/scripts/client/gui/mods/gambiter/utils.pyc b/res/scripts/client/gui/mods/gambiter/utils.pyc index 71407a4..77c066f 100644 Binary files a/res/scripts/client/gui/mods/gambiter/utils.pyc and b/res/scripts/client/gui/mods/gambiter/utils.pyc differ