Skip to content

Commit

Permalink
v0.2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
GambitER committed Dec 19, 2017
1 parent 2a6e824 commit e6e5d96
Show file tree
Hide file tree
Showing 24 changed files with 363 additions and 413 deletions.
4 changes: 2 additions & 2 deletions meta.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<root>
<id>gambiter.guiflash</id>
<version>0.2.1</version>
<version>0.2.2</version>
<name>GUIFlash</name>
<description>Flash components for use in python mods.</description>
</root>
</root>
Binary file modified res/gui/flash/GUIFlash.swf
Binary file not shown.
11 changes: 1 addition & 10 deletions res/gui/flash/as3proj/obj/GUIFlashConfig.old
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,7 @@
<path-element>C:\Games\OneDrive\WoT_Mods\GUIFlash\source\res\gui\flash\as3proj\src</path-element>
<path-element>C:\Program Files (x86)\FlashDevelop\Library\AS3\classes</path-element>
</source-path>
<external-library-path append="true">
<path-element>C:\Games\OneDrive\WoT_Mods\GUIFlash\source\res\gui\flash\as3proj\swc\wg\base_app-1.0-SNAPSHOT.swc</path-element>
<path-element>C:\Games\OneDrive\WoT_Mods\GUIFlash\source\res\gui\flash\as3proj\swc\wg\battle.swc</path-element>
<path-element>C:\Games\OneDrive\WoT_Mods\GUIFlash\source\res\gui\flash\as3proj\swc\wg\common_i18n_library-1.0-SNAPSHOT.swc</path-element>
<path-element>C:\Games\OneDrive\WoT_Mods\GUIFlash\source\res\gui\flash\as3proj\swc\wg\common-1.0-SNAPSHOT.swc</path-element>
<path-element>C:\Games\OneDrive\WoT_Mods\GUIFlash\source\res\gui\flash\as3proj\swc\wg\gui_base-1.0-SNAPSHOT.swc</path-element>
<path-element>C:\Games\OneDrive\WoT_Mods\GUIFlash\source\res\gui\flash\as3proj\swc\wg\gui_battle-1.0-SNAPSHOT.swc</path-element>
<path-element>C:\Games\OneDrive\WoT_Mods\GUIFlash\source\res\gui\flash\as3proj\swc\wg\gui_lobby-1.0-SNAPSHOT.swc</path-element>
<path-element>C:\Games\OneDrive\WoT_Mods\GUIFlash\source\res\gui\flash\as3proj\swc\wg\lobby.swc</path-element>
</external-library-path>
<external-library-path append="true" />
</compiler>
<file-specs>
<path-element>C:\Games\OneDrive\WoT_Mods\GUIFlash\source\res\gui\flash\as3proj\src\net\gambiter\FlashUI.as</path-element>
Expand Down
158 changes: 77 additions & 81 deletions res/gui/flash/as3proj/src/net/gambiter/FlashUI.as
Original file line number Diff line number Diff line change
@@ -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 = {};
}

Expand All @@ -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());
Expand All @@ -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];
}
}
}
}
41 changes: 13 additions & 28 deletions res/gui/flash/as3proj/src/net/gambiter/components/ImageEx.as
Original file line number Diff line number Diff line change
@@ -1,42 +1,36 @@
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()
{
super();

loader = new Loader();
loader.name = "image";
addChild(loader);

_source = "";
_sourceAlt = "";

_autoSize = true;

_loadFailed = false;
_loadInProgress = false;

_previousContentUnloaded = true;

addLoaderListener();
Expand All @@ -48,7 +42,7 @@
}

override protected function onDispose():void
{
{
if (loader != null)
{
removeLoaderListener();
Expand All @@ -58,11 +52,10 @@
}
super.onDispose();
}


override public function refresh():void
{
if (_loadFailed || _loadInProgress) return;
{
if (_loadFailed || _loadInProgress) return;
if (_autoSize)
{
loader.width = _originalWidth;
Expand All @@ -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;
Expand Down Expand Up @@ -194,7 +179,7 @@
private function onLoaderCompleteHandler(e:Event):void
{
_loadFailed = false;
_loadInProgress = false;
_loadInProgress = false;
initialize();
refresh();
loadComplete();
Expand Down
Loading

0 comments on commit e6e5d96

Please sign in to comment.