diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..a2d2425
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,22 @@
+# no idea files at all
+.idea/
+
+# we don't want compiled flash files here
+*.swc
+*.swf
+
+# we even don't want new flash folders
+/res/gui/flash/as3proj/obj
+/res/gui/flash/as3proj/swc
+
+# we also don't want compiled wotmod files
+*.wotmod
+
+# and for sure no compiled python files
+*.pyc
+
+# and we also say no to log-files
+*.log
+
+# we also no longer wan't the build folder
+/build/
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
new file mode 100644
index 0000000..0211ddd
--- /dev/null
+++ b/CONTRIBUTING.md
@@ -0,0 +1,23 @@
+# Some notes for contribution to this project:
+
+If you want to contribute to the project you should discuss things with the project maintainer before you request a pull request.
+
+Feel free to create a new topic here on the forum and let's discuss things and what do you want to change/enhance and why it's needed.
+
+## Version numbering
+The version numbering of the project follows the following format:
+
+xx.yy.zz
+
+xx - major version
+yy - minor version
+zz - build
+
+Version numbering is done by the project maintainer and should never be done by the project contributor itself. Please keep this in mind if you want to create a pull request.
+
+
+## wotmod-file
+Never try to merge the .wotmod-file into the repo. This will also be created by the project maintainer after your pull request was accepted or a new update was released. You can find the current release version here: [**Releases**](https://github.com/CH4MPi/GUIFlash/releases)
+
+## a personal note
+Help is always welcome. If you sent in a pull request, please wait if it will be accepted. You shouldn't release your changes to the community before the pull-request was accepted to avoid that there is more than one GUIFlash version outside.
diff --git a/LICENSE b/LICENSE
index f3201e5..a4c1c6d 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,6 +1,6 @@
MIT License
-Copyright (c) 2017-2019 GambitER
+Copyright (c) 2017-2019 GambitER, 2020 CH4MPi
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/README.md b/README.md
index 76995fc..08262e2 100644
--- a/README.md
+++ b/README.md
@@ -2,6 +2,19 @@
## .. GUIFlash ..
-_Позволяет динамически создавать компоненты для отображения текстовой и графической информации в Flash интерфейсе игры World of Tanks. Создание и управление компонентами производится через Python скрипты (модификации клиента)._
+Copyright: (c) 2017-2019 GambitER, since 2020 CH4MPi
+
+This project is maintained by CH4MPi
+
+## English
+Allows you to dynamically create components for displaying text and graphic information in the Flash interface of the game World of Tanks. Components are created and managed using Python scripts (client modifications).
+
+Learn more @ [**Wiki**](https://github.com/CH4MPi/GUIFlash/wiki).
+
+## Russian
+Позволяет динамически создавать компоненты для отображения текстовой и графической информации в Flash интерфейсе игры World of Tanks. Создание и управление компонентами производится через Python скрипты (модификации клиента)._
Подробнее в [**Wiki**](https://github.com/GambitER/GUIFlash/wiki).
+
+
+  
diff --git a/build.json b/build.json
new file mode 100644
index 0000000..271d6a5
--- /dev/null
+++ b/build.json
@@ -0,0 +1,18 @@
+{
+ "version": 1,
+ "software": {
+ "animate": "C:\\Program Files\\Adobe\\Adobe Animate 2020\\Animate.exe",
+ "python": "C:\\Program Files\\Python\\python.exe"
+ },
+ "game": {
+ "folder": "X:\\wot\\ct",
+ "version": "1.26.0.0"
+ },
+ "info": {
+ "id": "guiflash",
+ "author": "gambiter",
+ "name": "GUIFlash",
+ "description": "Flash components for use in python mods.",
+ "version": "0.6.4"
+ }
+}
diff --git a/build.py b/build.py
new file mode 100644
index 0000000..91ae5fd
--- /dev/null
+++ b/build.py
@@ -0,0 +1,275 @@
+import datetime
+import json
+import os
+import shutil
+import subprocess
+import sys
+import time
+import zipfile
+
+
+def copytree(source, destination, ignore=None):
+ """implementation of shutil.copytree
+ original sometimes throw error on folders create"""
+ for item in os.listdir(source):
+ # skip git files
+ if '.gitkeep' in item:
+ continue
+ sourcePath = os.path.join(source, item)
+ destinationPath = os.path.join(destination, item)
+ # use copytree for directory
+ if not os.path.isfile(sourcePath):
+ copytree(sourcePath, destinationPath, ignore)
+ continue
+ # make dir by os module
+ dirName, fileName = os.path.split(destinationPath)
+ if not os.path.isdir(dirName):
+ os.makedirs(dirName)
+ # skip files by ignore pattern
+ if ignore:
+ ignored_names = ignore(source, os.listdir(source))
+ if fileName in ignored_names:
+ continue
+ # copy file
+ shutil.copy2(sourcePath, destinationPath)
+
+
+def zipFolder(source, destination, mode='w', compression=zipfile.ZIP_STORED):
+ """ ZipFile by default don't create folders info in result zip """
+
+ def dirInfo(path):
+ """return fixed ZipInfo for directory"""
+ info = zipfile.ZipInfo(path, now)
+ info.filename = info.filename[seek_offset:]
+ if not info.filename:
+ return None
+ if not info.filename.endswith('/'):
+ info.filename += '/'
+ info.compress_type = compression
+ return info
+
+ def fileInfo(path):
+ """return fixed ZipInfo for file"""
+ info = zipfile.ZipInfo(path, now)
+ info.external_attr = 33206 << 16 # -rw-rw-rw-
+ info.filename = info.filename[seek_offset:]
+ info.compress_type = compression
+ return info
+
+ with zipfile.ZipFile(destination, mode, compression) as zipfh:
+ now = tuple(datetime.datetime.now().timetuple())[:6]
+ seek_offset = len(source) + 1
+ for dirName, _, files in os.walk(source):
+ info = dirInfo(dirName)
+ if info:
+ zipfh.writestr(info, '')
+ for fileName in files:
+ filePath = os.path.join(dirName, fileName)
+ info = fileInfo(filePath)
+ zipfh.writestr(info, open(filePath, 'rb').read())
+
+
+def processRunning(path):
+ """Cheek is process running, no"""
+ processName = os.path.basename(path).lower()
+ try:
+ import psutil
+ for proc in psutil.process_iter():
+ if proc.name().lower() == processName:
+ return True
+ return False
+ except ImportError:
+ if os.name == 'nt':
+ for task in (x.split() for x in subprocess.check_output('tasklist').splitlines()):
+ if task and task[0].lower() == processName:
+ return True
+ return False
+ else:
+ print('cant list process on your system')
+ print('run -> pip install psutil')
+ raise NotImplementedError
+
+
+def buildFlash():
+ if not BUILD_FLASH:
+ return
+
+ # working directory URI for Animate
+ flashWD = os.getcwd().replace('\\', '/').replace(':', '|')
+
+ # JSFL file with commands for Animate
+ jsflFile = 'build.jsfl'
+ jsflContent = ''
+
+ files = set()
+
+ # add publishDocument command for all *.fla and *.xfl files
+ for dirPath, _, fileNames in os.walk('as3'):
+ for fileName in fileNames:
+ if fileName.endswith('.fla') or fileName.endswith('.xfl'):
+ dirPath = dirPath.replace('\\', '/')
+ logName = fileName.replace('.fla', '.log').replace('.xfl', '.log')
+ files.add((dirPath, fileName, logName))
+
+ if not files:
+ return
+
+ for dirPath, fileName, logName in files:
+ documentURI = 'file:///{}/{}/{}'.format(flashWD, dirPath, fileName)
+ logFileURI = 'file:///{}/{}'.format(flashWD, logName)
+ jsflContent += 'fl.publishDocument("{}", "Default");\n'.format(documentURI)
+ jsflContent += 'fl.compilerErrors.save("{}", false, true);\n'.format(logFileURI)
+ jsflContent += '\n'
+
+ # add close command only if Animate not opened
+ if not processRunning(CONFIG.software.animate):
+ jsflContent += 'fl.quit(false);'
+
+ # save commands for Animate
+ with open(jsflFile, 'w') as fh:
+ fh.write(jsflContent)
+
+ # run Animate
+ try:
+ subprocess.call([CONFIG.software.animate, '-e', jsflFile, '-AlwaysRunJSFL'], stderr=subprocess.STDOUT)
+ except subprocess.CalledProcessError as e:
+ print (e)
+
+ # publishing can be asynchronous when Animate is already opened
+ # so waiting script file unlock to remove, which means publishing is done
+ while os.path.exists(jsflFile):
+ try:
+ os.remove(jsflFile)
+ except: # NOSONAR
+ time.sleep(.1)
+
+ for dirPath, fileName, logName in files:
+ log_data = ''
+ if os.path.isfile(logName):
+ data = open(logName, 'r').read().splitlines()
+ if len(data) > 1:
+ log_data = '\n'.join(data[:-2])
+ os.remove(logName)
+
+ if log_data:
+ print ('Failed publish: {}/{}'.format(dirPath, fileName))
+ print (log_data)
+ else:
+ print ('Published: {}/{}'.format(dirPath, fileName))
+
+
+def buildPython():
+ for dirPath, _, fileNames in os.walk('res/scripts'):
+ for fileName in fileNames:
+ if not fileName.endswith('.py'):
+ continue
+ filePath = "{}/{}".format(dirPath, fileName).replace('\\', '/')
+ try:
+ subprocess.check_output([CONFIG['software']['python'], '-m', 'py_compile', filePath],
+ stderr=subprocess.STDOUT).decode()
+ print ('Compiled: {}'.format(filePath))
+ except subprocess.CalledProcessError as e:
+ print ('\nFailed compile: {}'.format(filePath))
+ output = e.output.decode()
+ print (output)
+
+
+# handle args from command line
+BUILD_FLASH = 'flash' in sys.argv
+COPY_INTO_GAME = 'ingame' in sys.argv
+CREATE_DISTRIBUTE = 'distribute' in sys.argv
+
+# load config
+assert os.path.isfile('build.json'), 'Config not found'
+with open('build.json', 'r') as fh:
+ CONFIG = json.loads(fh.read())
+
+GAME_FOLDER = CONFIG['game']['folder']
+GAME_VERSION = CONFIG['game']['version']
+
+# cheek in-game folder
+WOT_PACKAGES_DIR = '{wot}/mods/{version}/'.format(wot=GAME_FOLDER, version=GAME_VERSION)
+if COPY_INTO_GAME:
+ assert os.path.isdir(WOT_PACKAGES_DIR), 'WoT mods folder not found'
+
+# package data
+PACKAGE_NAME = '{author}.{name}_{version}.wotmod'.format(author=CONFIG['info']['author'],
+ name=CONFIG['info']['id'], version=CONFIG['info']['version'])
+
+# generate package meta file
+META = """
+
+ {author}.{id}
+
+ {version}
+
+ {name}
+
+ {description}
+""".format(author=CONFIG['info']['author'], id=CONFIG['info']['id'], name=CONFIG['info']['name'],
+ description=CONFIG['info']['description'], version=CONFIG['info']['version'])
+
+# prepare folders
+if os.path.isdir('temp'):
+ shutil.rmtree('temp')
+os.makedirs('temp')
+if os.path.isdir('build'):
+ shutil.rmtree('build')
+os.makedirs('build')
+
+# build flash
+buildFlash()
+
+# build python
+buildPython()
+
+# copy all staff
+if os.path.isdir('resources/in'):
+ copytree('resources/in', 'temp/res')
+if os.path.isfile('LICENSE'):
+ shutil.copy2('LICENSE', 'temp')
+if os.path.isfile('README.md'):
+ shutil.copy2('README.md', 'temp')
+if os.path.isfile('res/gui/flash/GUIFlash.swf'):
+ os.makedirs('temp/res/gui/flash')
+ shutil.copy2('res/gui/flash/GUIFlash.swf', 'temp/res/gui/flash')
+copytree('res/scripts', 'temp/res/scripts', ignore=shutil.ignore_patterns('*.py'))
+with open('temp/meta.xml', 'w') as fh:
+ fh.write(META)
+
+# create package
+zipFolder('temp', 'build/{}'.format(PACKAGE_NAME))
+
+# copy package into game
+if COPY_INTO_GAME:
+ shutil.copy2('build/{}'.format(PACKAGE_NAME), WOT_PACKAGES_DIR)
+
+# create distribution
+if CREATE_DISTRIBUTE:
+ os.makedirs('temp/distribute/mods/{}'.format(GAME_VERSION))
+ shutil.copy2('build/{}'.format(PACKAGE_NAME), 'temp/distribute/mods/{}'.format(GAME_VERSION))
+ if os.path.isdir('resources/out'):
+ copytree('resources/out', 'temp/distribute')
+ zipFolder('temp/distribute', 'build/{name}_{version}_{wotversion}.zip'.format(name=CONFIG['info']['id'], version=CONFIG['info']['version'], wotversion=GAME_VERSION), compression=zipfile.ZIP_DEFLATED)
+# list for cleaning
+cleanup_list = set([])
+
+# builder temporary
+cleanup_list.add('temp')
+
+# Animate unnecessary
+cleanup_list.add('EvalScript error.tmp')
+cleanup_list.add('as3/DataStore')
+
+# python bytecode
+for dirName, _, files in os.walk('res'):
+ for fileName in files:
+ if fileName.endswith('.pyc'):
+ cleanup_list.add(os.path.join(dirName, fileName))
+
+# delete files
+for path in cleanup_list:
+ if os.path.isdir(path):
+ shutil.rmtree(path)
+ elif os.path.isfile(path):
+ os.remove(path)
diff --git a/gambiter.guiflash_0.3.1.wotmod b/gambiter.guiflash_0.3.1.wotmod
deleted file mode 100644
index 3ae3e28..0000000
Binary files a/gambiter.guiflash_0.3.1.wotmod and /dev/null differ
diff --git a/meta.xml b/meta.xml
deleted file mode 100644
index 9fc96fc..0000000
--- a/meta.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
- gambiter.guiflash
- 0.3.1
- GUIFlash
- Flash components for use in python mods.
-
diff --git a/res/gui/flash/GUIFlash.swf b/res/gui/flash/GUIFlash.swf
index da4a979..6cd315d 100644
Binary files a/res/gui/flash/GUIFlash.swf and b/res/gui/flash/GUIFlash.swf differ
diff --git a/res/gui/flash/as3proj/GUIFlash.as3proj b/res/gui/flash/as3proj/GUIFlash.as3proj
index d4a84d5..a8e5c2b 100644
--- a/res/gui/flash/as3proj/GUIFlash.as3proj
+++ b/res/gui/flash/as3proj/GUIFlash.as3proj
@@ -16,6 +16,7 @@
+
@@ -64,6 +65,14 @@
+
+
+
+
+
+
+
+
diff --git a/res/gui/flash/as3proj/obj/GUIFlashConfig.old b/res/gui/flash/as3proj/obj/GUIFlashConfig.old
index c3cfec6..71e071f 100644
--- a/res/gui/flash/as3proj/obj/GUIFlashConfig.old
+++ b/res/gui/flash/as3proj/obj/GUIFlashConfig.old
@@ -16,7 +16,7 @@
CONFIG::timeStamp
- '07.05.2019'
+ '06.04.2024'
CONFIG::air
@@ -34,22 +34,23 @@
true
false
- E:\OneDrive\WoT_Mods\GUIFlash\source\res\gui\flash\as3proj\src
+ D:\Coding\PythonProjects\GUIFlash\res\gui\flash\as3proj\src
+ D:\Coding\PythonProjects\champiMODS\res\flash\swc
C:\Program Files (x86)\FlashDevelop\Library\AS3\classes
- 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
+ D:\Coding\PythonProjects\champiMODS\res\flash\swc\base_app-1.0-SNAPSHOT.swc
+ D:\Coding\PythonProjects\champiMODS\res\flash\swc\battle.swc
+ D:\Coding\PythonProjects\champiMODS\res\flash\swc\common_i18n_library-1.0-SNAPSHOT.swc
+ D:\Coding\PythonProjects\champiMODS\res\flash\swc\common-1.0-SNAPSHOT.swc
+ D:\Coding\PythonProjects\champiMODS\res\flash\swc\gui_base-1.0-SNAPSHOT.swc
+ D:\Coding\PythonProjects\champiMODS\res\flash\swc\gui_battle-1.0-SNAPSHOT.swc
+ D:\Coding\PythonProjects\champiMODS\res\flash\swc\gui_lobby-1.0-SNAPSHOT.swc
+ D:\Coding\PythonProjects\champiMODS\res\flash\swc\lobby.swc
- E:\OneDrive\WoT_Mods\GUIFlash\source\res\gui\flash\as3proj\src\net\gambiter\FlashUI.as
+ D:\Coding\PythonProjects\GUIFlash\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 c3cfec6..71e071f 100644
--- a/res/gui/flash/as3proj/obj/GUIFlashConfig.xml
+++ b/res/gui/flash/as3proj/obj/GUIFlashConfig.xml
@@ -16,7 +16,7 @@
CONFIG::timeStamp
- '07.05.2019'
+ '06.04.2024'
CONFIG::air
@@ -34,22 +34,23 @@
true
false
- E:\OneDrive\WoT_Mods\GUIFlash\source\res\gui\flash\as3proj\src
+ D:\Coding\PythonProjects\GUIFlash\res\gui\flash\as3proj\src
+ D:\Coding\PythonProjects\champiMODS\res\flash\swc
C:\Program Files (x86)\FlashDevelop\Library\AS3\classes
- 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
+ D:\Coding\PythonProjects\champiMODS\res\flash\swc\base_app-1.0-SNAPSHOT.swc
+ D:\Coding\PythonProjects\champiMODS\res\flash\swc\battle.swc
+ D:\Coding\PythonProjects\champiMODS\res\flash\swc\common_i18n_library-1.0-SNAPSHOT.swc
+ D:\Coding\PythonProjects\champiMODS\res\flash\swc\common-1.0-SNAPSHOT.swc
+ D:\Coding\PythonProjects\champiMODS\res\flash\swc\gui_base-1.0-SNAPSHOT.swc
+ D:\Coding\PythonProjects\champiMODS\res\flash\swc\gui_battle-1.0-SNAPSHOT.swc
+ D:\Coding\PythonProjects\champiMODS\res\flash\swc\gui_lobby-1.0-SNAPSHOT.swc
+ D:\Coding\PythonProjects\champiMODS\res\flash\swc\lobby.swc
- E:\OneDrive\WoT_Mods\GUIFlash\source\res\gui\flash\as3proj\src\net\gambiter\FlashUI.as
+ D:\Coding\PythonProjects\GUIFlash\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 319bd9c..d4a5f4a 100644
--- a/res/gui/flash/as3proj/src/net/gambiter/FlashUI.as
+++ b/res/gui/flash/as3proj/src/net/gambiter/FlashUI.as
@@ -2,14 +2,13 @@
{
import flash.display.DisplayObject;
import flash.display.DisplayObjectContainer;
-
import net.gambiter.utils.Components;
import net.gambiter.utils.Properties;
-
- import net.wg.infrastructure.managers.impl.ContainerManagerBase;
+ import net.wg.data.constants.generated.LAYER_NAMES;
import net.wg.gui.components.containers.MainViewContainer;
import net.wg.infrastructure.base.AbstractView;
- import net.wg.data.constants.generated.APP_CONTAINERS_NAMES;
+ import net.wg.infrastructure.interfaces.IManagedContent;
+ import net.wg.infrastructure.interfaces.ISimpleManagedContainer;
public class FlashUI extends AbstractView
{
@@ -27,12 +26,14 @@
public var showRadialMenu:Boolean;
public var showFullStats:Boolean;
public var showFullStatsQuestProgress:Boolean;
-
+ public var showFullStatsPersonalReserves:Boolean;
+ public var epicMapOverlayVisibility:Boolean;
+ public var epicRespawnOverlayVisibility:Boolean;
+ public var battleRoyaleRespawnVisibility:Boolean;
+ public var killCamVisibility:Boolean;
+
public var screenSize:Object;
-
- private var viewContainer:MainViewContainer;
private var viewPage:DisplayObjectContainer;
-
private var components:Object;
public function FlashUI()
@@ -57,6 +58,11 @@
showRadialMenu = false;
showFullStats = false;
showFullStatsQuestProgress = false;
+ showFullStatsPersonalReserves = false;
+ epicMapOverlayVisibility = false;
+ epicRespawnOverlayVisibility = false;
+ battleRoyaleRespawnVisibility = false
+ killCamVisibility = false;
screenSize = {width: SCREEN_WIDTH, height: SCREEN_HEIGHT};
}
@@ -68,9 +74,24 @@
try
{
parent.removeChild(this);
- viewContainer = (App.containerMgr as ContainerManagerBase).containersMap[APP_CONTAINERS_NAMES.VIEWS];
- viewContainer.setFocusedView(viewContainer.getTopmostView());
- viewPage = viewContainer.getChildByName(NAME_MAIN) as DisplayObjectContainer;
+ var viewContainer:MainViewContainer = _getContainer(LAYER_NAMES.VIEWS) as MainViewContainer;
+ if (viewContainer != null)
+ {
+ var topmostView:IManagedContent = viewContainer.getTopmostView();
+ if (topmostView != null)
+ {
+ viewContainer.setFocusedView(topmostView);
+ }
+ else
+ {
+ py_log("Error: topmostView is NULL!");
+ }
+ viewPage = viewContainer.getChildByName(NAME_MAIN) as DisplayObjectContainer;
+ }
+ else
+ {
+ py_log("Error: viewContainer is NULL!");
+ }
}
catch (error:Error)
{
@@ -78,6 +99,12 @@
}
}
+ // since WoT 1.10.1
+ private function _getContainer(containerName:String):ISimpleManagedContainer
+ {
+ return App.containerMgr.getContainer(LAYER_NAMES.LAYER_ORDER.indexOf(containerName))
+ }
+
override protected function onDispose():void
{
super.onDispose();
@@ -92,7 +119,8 @@
public function as_cursor(arg:Boolean):void
{
if (arg != showCursor) showCursor = arg;
- if (!showCursor) for (var alias:String in components) components[alias].hideCursor();
+ if (!showCursor)
+ for (var alias:String in components) components[alias].hideCursor();
}
public function as_radialMenu(arg:Boolean):void
@@ -110,9 +138,45 @@
public function as_fullStatsQuestProgress(arg:Boolean):void
{
if (arg != showFullStatsQuestProgress) showFullStatsQuestProgress = arg;
- for (var alias:String in components) components[alias].updateVisible();
+ for (var alias:String in components) components[alias].updateVisible();
}
-
+
+ public function as_fullStatsPersonalReserves(arg:Boolean):void
+ {
+ if (arg != showFullStatsPersonalReserves) showFullStatsPersonalReserves = arg;
+ for (var alias:String in components) components[alias].updateVisible();
+ }
+
+ public function as_epicMapOverlayVisibility(arg:Boolean):void
+ {
+ if (arg != epicMapOverlayVisibility) epicMapOverlayVisibility = arg;
+ for (var alias:String in components) components[alias].updateVisible();
+ }
+
+ public function as_epicRespawnOverlayVisibility(arg:Boolean):void
+ {
+ if (arg != epicRespawnOverlayVisibility) epicRespawnOverlayVisibility = arg;
+ for (var alias:String in components) components[alias].updateVisible();
+ }
+
+ public function as_battleRoyaleRespawnVisibility(isVisible:Boolean):void
+ {
+ //py_log("as_battleRoyaleRespawnVisibility called: isVisible:" + isVisible + "!");
+ if (isVisible != battleRoyaleRespawnVisibility)
+ battleRoyaleRespawnVisibility = isVisible;
+ for (var alias:String in components)
+ components[alias].updateVisible();
+ }
+
+ public function as_killCamVisibility(isVisible:Boolean):void
+ {
+ //py_log("as_killCamVisibility called: isVisible:" + isVisible + "!");
+ if (isVisible != killCamVisibility)
+ killCamVisibility = isVisible;
+ for (var alias:String in components)
+ components[alias].updateVisible();
+ }
+
public function as_create(alias:String, type:String, props:Object):void
{
if (viewPage) createComponent(alias, type, props);
@@ -134,7 +198,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))
{
@@ -158,18 +222,24 @@
{
var obj:DisplayObject = null;
- if (components.hasOwnProperty(alias)) obj = components[alias];
- else obj = Properties.getComponentByPath(viewPage, alias.split("."));
+ if (components.hasOwnProperty(alias)) {
+ obj = components[alias];
+ } else {
+ obj = Properties.getComponentByPath(viewPage, alias.split("."));
+ }
- if (params) Properties.setAnimateProperty(obj, props, params);
- else Properties.setProperty(obj, props);
+ if (params) {
+ Properties.setAnimateProperty(obj, props, params);
+ } else {
+ Properties.setProperty(obj, props);
+ }
}
catch (error:Error)
{
py_log(error.getStackTrace());
}
}
-
+
private function deleteComponent(alias:String):void
{
try
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 78677b4..d8b093f 100644
--- a/res/gui/flash/as3proj/src/net/gambiter/components/LabelEx.as
+++ b/res/gui/flash/as3proj/src/net/gambiter/components/LabelEx.as
@@ -4,6 +4,11 @@
import flash.text.TextFormat;
import flash.text.AntiAliasType;
import flash.text.TextFieldAutoSize;
+
+ import flash.display.Sprite;
+ import flash.display.LineScaleMode;
+ import flash.display.CapsStyle;
+ import flash.display.JointStyle;
import net.gambiter.FlashUI;
import net.gambiter.utils.Align;
@@ -12,14 +17,31 @@
public class LabelEx extends UIComponentEx
{
- public static const NAME_FONT:String = "$UniversCondC";
+ public static const NAME_FONT:String = "$FieldFont";
private var textField:TextField;
+ private var customBG:Sprite;
private var _text:String;
private var _isHtml:Boolean;
private var _hAlign:String;
private var _vAlign:String;
+
+ // new custom background
+ private var bg_alpha:Number;
+ private var bg_border:Boolean;
+ private var bg_borderColor:uint;
+ private var bg_caps:String;
+ private var bg_color:uint;
+ private var bg_ellipseWidth:Number;
+ private var bg_fill:Boolean;
+ private var bg_joints:String;
+ private var bg_margin:Number;
+ private var bg_miterLimit:Number;
+ private var bg_pixelHinting:Boolean;
+ private var bg_scaleMode:String;
+ private var bg_thickness:Number;
+ // !new custom background
public function LabelEx()
{
@@ -27,15 +49,15 @@
textField = new TextField();
textField.name = "label";
- addChild(textField);
-
+// addChild(textField);
+
_isHtml = true;
_hAlign = Align.LEFT;
_vAlign = Align.TOP;
textField.width = 0;
textField.height = 0;
-
+
textField.mouseEnabled = false;
textField.wordWrap = false;
@@ -49,7 +71,17 @@
textField.antiAliasType = AntiAliasType.ADVANCED;
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});
+ Properties.setShadow(textField, {
+ "distance": 4,
+ "angle": 45,
+ "color": 0x999999,
+ "alpha": 1,
+ "blurX": 4,
+ "blurY": 4,
+ "strength": 1,
+ "quality": 1
+ });
+ addChild(textField);
}
override protected function configUI():void
@@ -59,6 +91,10 @@
override protected function onDispose():void
{
+ if (customBG != null) {
+ removeChild(customBG);
+ customBG = null;
+ }
if (textField != null)
{
removeChild(textField);
@@ -66,42 +102,60 @@
}
super.onDispose();
}
-
+
override public function refresh():void
{
super.refresh();
}
-
+
private function updateText():void
{
- if (text == null || textField == null) return;
- if (isHtml) textField.htmlText = text;
- else textField.text = text;
+ if (text == null || textField == null) {
+ return;
+ }
+ if (isHtml) {
+ textField.htmlText = text;
+ }
+ else {
+ textField.text = text;
+ }
+ if (customBG != null) {
+ updateCustomBackground();
+ }
initialize();
}
-
+
override protected function updateBorder():void
{
- borderEx.update(textField.x, textField.y, textField.width, textField.height);
+ if (customBG != null) {
+ borderEx.update(textField.x - bg_margin - bg_thickness, textField.y - bg_margin - bg_thickness, textField.width + (bg_margin*2) + (bg_thickness*2), textField.height + (bg_margin*2) + (bg_thickness*2));
+ } else {
+ borderEx.update(textField.x, textField.y, textField.width, textField.height);
+ }
}
override protected function updateSize():void
- {
+ {
if (autoSize)
{
textField.autoSize = TextFieldAutoSize.LEFT;
// textField.width = _originalWidth;
// textField.height = _originalHeight;
+
+ // special case for textfield! - we need to update the super class 'width' without setting autosize to none!
+ super.setLabelSizes(textField.width, textField.height);
+ //FlashUI.ui.py_log("LabelEx:updateSize autoSize:true " + " w:" + textField.width + " h:" + textField.height + " text:"+ textField.htmlText);
}
else
{
textField.autoSize = TextFieldAutoSize.NONE;
textField.width = width;
textField.height = height;
+ //FlashUI.ui.py_log("LabelEx:updateSize autoSize:false " + " w:" + textField.width + " h:" + textField.height + " text:"+ textField.htmlText);
}
super.updateSize();
}
-
+
public function get text():String
{
return _text;
@@ -198,5 +252,68 @@
{
Properties.setShadow(textField, args);
}
+
+ public function set glowfilter(args:Object):void
+ {
+ Properties.setGlowFilter(textField, args);
+ }
+
+ protected function updateCustomBackground():void
+ {
+ if (customBG == null)
+ return;
+ customBG.x = textField.x;
+ customBG.y = textField.y;
+ customBG.graphics.clear();
+
+ // 1. select if just the border or a filled rect
+ customBG.graphics.beginFill(bg_color, bg_fill ? 1.0 : 0);
+
+ //customBG.graphics.lineStyle(bg_thickness, bg_borderColor, 1.0, bg_pixelHinting, bg_scaleMode, bg_caps, bg_joints, bg_miterLimit);
+ customBG.graphics.lineStyle(bg_thickness, bg_border ? bg_borderColor : bg_color, 1.0);
+ //customBG.graphics.drawRect(0 - bg_margin - bg_thickness, 0 - bg_margin - bg_thickness, textField.width + (bg_margin * 2) + (bg_thickness * 2), textField.height + (bg_margin * 2) + (bg_thickness * 2));
+ if (bg_ellipseWidth > 0) {
+ //customBG.graphics.moveTo(0,0)
+ customBG.graphics.drawRoundRect(0 - bg_margin - bg_thickness, 0 - bg_margin - bg_thickness, textField.width + (bg_margin*2) + (bg_thickness*2), textField.height + (bg_margin*2) + (bg_thickness*2), bg_ellipseWidth);
+ } else {
+ customBG.graphics.drawRect(0 - bg_margin - bg_thickness, 0 - bg_margin - bg_thickness, textField.width + (bg_margin*2) + (bg_thickness*2), textField.height + (bg_margin*2) + (bg_thickness*2));
+ }
+
+ if (bg_fill)
+ customBG.graphics.endFill();
+
+ customBG.alpha = bg_alpha;
+
+ }
+
+ public function set customBackground(args:Object):void
+ {
+ if (!args && customBG != null)
+ {
+ removeChild(customBG);
+ customBG = null;
+ return;
+ }
+ bg_alpha = args.hasOwnProperty('alpha') ? args.alpha : 1.0;
+ bg_color = args.hasOwnProperty('color') ? args.color : 0x000000;
+ bg_border = args.hasOwnProperty('border') ? args.border : true;
+ bg_borderColor = args.hasOwnProperty('borderColor') ? args.borderColor : 0x000000;
+ bg_thickness = args.hasOwnProperty('thickness') ? args.thickness : NaN;
+ bg_pixelHinting = args.hasOwnProperty('pixelHinting') ? args.pixelHinting : false;
+ bg_scaleMode = args.hasOwnProperty('scaleMode') ? args.scaleMode : LineScaleMode.NORMAL;
+ bg_caps = args.hasOwnProperty('caps') ? args.caps : CapsStyle.ROUND;
+ bg_joints = args.hasOwnProperty('joints') ? args.joints : JointStyle.ROUND;
+ bg_miterLimit = args.hasOwnProperty('miterLimit') ? args.miterLimit : 3
+ bg_margin = args.hasOwnProperty('margin') ? args.margin : 0
+ bg_ellipseWidth = args.hasOwnProperty('ellipseWidth') ? args.ellipseWidth : 0
+ bg_fill = args.hasOwnProperty('fill') ? args.fill : true;
+
+ if (customBG == null)
+ {
+ customBG = new Sprite();
+ addChildAt(customBG, 0);
+ }
+ updateCustomBackground();
+ }
}
-}
\ No newline at end of file
+}
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 a889786..ad55b54 100644
--- a/res/gui/flash/as3proj/src/net/gambiter/core/UIComponentEx.as
+++ b/res/gui/flash/as3proj/src/net/gambiter/core/UIComponentEx.as
@@ -3,6 +3,7 @@
import flash.events.Event;
import flash.events.MouseEvent;
import flash.display.InteractiveObject;
+ import flash.text.TextFieldAutoSize;
import net.wg.data.constants.DragType;
import net.wg.infrastructure.interfaces.entity.IDraggable;
@@ -10,15 +11,16 @@
import net.gambiter.FlashUI;
import net.gambiter.utils.Align;
import net.gambiter.utils.Properties;
- import net.gambiter.core.UIBorderEx;
+ import net.gambiter.core.UIBorderEx;
import scaleform.clik.core.UIComponent;
public class UIComponentEx extends UIComponent implements IDraggable
{
protected var borderEx:UIBorderEx;
- private var _x:Number;
- private var _y:Number;
+ public var _x:Number;
+ public var _y:Number;
+
private var _autoSize:Boolean;
private var _alignX:String;
private var _alignY:String;
@@ -34,7 +36,13 @@
private var _radialMenu:Boolean;
private var _fullStats:Boolean;
private var _fullStatsQuestProgress:Boolean;
-
+ private var _fullStatsPersonalReserves:Boolean;
+ private var _epicMapOverlayVisible:Boolean;
+ private var _epicRespawnOverlayVisible:Boolean;
+ private var _battleRoyaleRespawnVisibility:Boolean;
+ private var _killCamVisibility:Boolean;
+ //public var py_log:Function;
+
public function UIComponentEx()
{
super();
@@ -55,22 +63,27 @@
_visible = true;
_radialMenu = false;
_fullStats = false;
- _fullStatsQuestProgress = false;
-
+ _fullStatsQuestProgress = false;
+ _fullStatsPersonalReserves = false;
+ _epicMapOverlayVisible = false;
+ _epicRespawnOverlayVisible = false;
+ _battleRoyaleRespawnVisibility = false;
+ _killCamVisibility = false;
focusable = false;
}
override protected function configUI():void
{
super.configUI();
- App.cursor.registerDragging(this);
addEventListener(MouseEvent.MOUSE_OVER, onMouseOver, false, 0, true);
addEventListener(MouseEvent.MOUSE_OUT, onMouseOut, false, 0, true);
}
override protected function onDispose():void
{
- App.cursor.unRegisterDragging(this);
+ if (_drag) {
+ App.cursor.unRegisterDragging(this);
+ }
removeEventListener(MouseEvent.MOUSE_OVER, onMouseOver);
removeEventListener(MouseEvent.MOUSE_OUT, onMouseOut);
super.onDispose();
@@ -93,7 +106,15 @@
public function updateVisible():void
{
- super.visible = _visible && (!FlashUI.ui.showRadialMenu || _radialMenu) && (!FlashUI.ui.showFullStats || _fullStats) && (!FlashUI.ui.showFullStatsQuestProgress || _fullStatsQuestProgress);
+ super.visible = _visible &&
+ (!FlashUI.ui.showRadialMenu || _radialMenu) &&
+ (!FlashUI.ui.showFullStats || _fullStats) &&
+ (!FlashUI.ui.showFullStatsQuestProgress || _fullStatsQuestProgress) &&
+ (!FlashUI.ui.showFullStatsPersonalReserves || _fullStatsPersonalReserves) &&
+ (!FlashUI.ui.epicMapOverlayVisibility || _epicMapOverlayVisible) &&
+ (!FlashUI.ui.epicRespawnOverlayVisibility || _epicRespawnOverlayVisible) &&
+ (!FlashUI.ui.battleRoyaleRespawnVisibility || _battleRoyaleRespawnVisibility) &&
+ (!FlashUI.ui.killCamVisibility || _killCamVisibility);
}
private function updateIndex():void
@@ -112,13 +133,20 @@
}
public function updatePosition():void
- {
+ {
+ //FlashUI.ui.py_log("UIComponentEx: 1 x:"+ super.x + " y:"+ super.y + " parent.width:"+ parent.width + " parent.height:"+ parent.height + " width:"+ width);
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;
+ //FlashUI.ui.py_log("UIComponentEx: 2 x:" + super.x + " y:" + super.y);
+ if (!_limit) {
+ return;
+
+ }
+ //FlashUI.ui.py_log("UIComponentEx: limnit true!");
var point:Object = Properties.getLimiter(this, super.x, super.y);
super.x = point.x;
super.y = point.y;
+ //FlashUI.ui.py_log("UIComponentEx: 3 x:" + super.x + " y:" + super.y);
}
private function updateProps():void
@@ -127,7 +155,11 @@
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});
+ //FlashUI.ui.py_log("UIComponentEx: updateProps called! last_x:" + last_x + " last_y:" + last_y + " _x:"+ _x + " _y:"+_y);
+ if ((_x != last_x) || (_y != last_y))
+ {
+ py_updateProps({"x": _x, "y": _y});
+ }
}
private function py_updateProps(props:Object):void
@@ -148,13 +180,14 @@
if (_tooltip && !_isDragging) App.toolTipMgr.show(_tooltip);
if (_border) borderEx.show();
}
-
+
private function onMouseOut(event:MouseEvent):void
{
+ if (!_drag) return;
if (_tooltip) App.toolTipMgr.hide();
if (_border) borderEx.hide();
}
-
+
public function getHitArea():InteractiveObject
{
return this;
@@ -194,7 +227,15 @@
public function set drag(value:Boolean):void
{
- if (value != _drag) _drag = value;
+ if (value != _drag) {
+ if (value) {
+ App.cursor.registerDragging(this);
+ }
+ else {
+ App.cursor.unRegisterDragging(this);
+ }
+ _drag = value;
+ }
}
public function get limit():Boolean
@@ -266,12 +307,12 @@
{
if ((Align.isValidY(value)) && (value != _alignY)) _alignY = value;
}
-
+
public function get autoSize():Boolean
{
return _autoSize;
}
-
+
public function set autoSize(value:Boolean):void
{
if (value != _autoSize) _autoSize = value;
@@ -282,6 +323,13 @@
_autoSize = false;
super.width = value;
}
+
+ // NOTE: only used for LabelEx component - we can move this later
+ public function setLabelSizes(width:Number, height:Number):void
+ {
+ super.width = width;
+ super.height = height;
+ }
override public function set height(value:Number):void
{
@@ -332,6 +380,26 @@
public function set fullStatsQuestProgress(value:Boolean):void
{
if (value != _fullStatsQuestProgress) _fullStatsQuestProgress = value;
+ }
+
+ public function get fullStatsPersonalReserves():Boolean
+ {
+ return _fullStatsPersonalReserves;
+ }
+
+ public function set fullStatsPersonalReserves(value:Boolean):void
+ {
+ if (value != _fullStatsPersonalReserves) _fullStatsPersonalReserves = value;
+ }
+
+ public function get killCamVisibility():Boolean
+ {
+ return _killCamVisibility;
+ }
+
+ public function set killCamVisibility(value:Boolean):void
+ {
+ if (value != _killCamVisibility) _killCamVisibility = value;
}
}
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 1658cde..c50c2a1 100644
--- a/res/gui/flash/as3proj/src/net/gambiter/utils/Align.as
+++ b/res/gui/flash/as3proj/src/net/gambiter/utils/Align.as
@@ -47,5 +47,11 @@
return ZERO;
}
}
+
+ public static function isValidAutoSize(align:String):Boolean
+ {
+ return align == LEFT || align == RIGHT || align == CENTER || align == NONE;
+ }
+
}
}
\ No newline at end of file
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 3f31e10..1c6235c 100644
--- a/res/gui/flash/as3proj/src/net/gambiter/utils/Properties.as
+++ b/res/gui/flash/as3proj/src/net/gambiter/utils/Properties.as
@@ -1,16 +1,20 @@
package net.gambiter.utils
{
- import flash.geom.Point;
- import flash.geom.Rectangle;
+ import com.greensock.TweenLite;
import flash.display.DisplayObject;
import flash.display.DisplayObjectContainer;
+ import flash.display.Sprite;
+ import flash.display.LineScaleMode;
+ import flash.display.CapsStyle;
+ import flash.display.JointStyle;
import flash.filters.DropShadowFilter;
-
- import com.greensock.TweenLite;
-
+ import flash.filters.GlowFilter;
+ import flash.geom.Point;
+ import flash.geom.Rectangle;
import net.gambiter.FlashUI;
import net.gambiter.core.UIComponentEx;
- import net.gambiter.components.ImageEx;
+
+
public class Properties
{
@@ -44,28 +48,52 @@
{
if (!obj) return;
- var shadow:DropShadowFilter = new DropShadowFilter();
-
if (props)
{
- for (var prop:String in props)
- if (shadow.hasOwnProperty(prop)) shadow[prop] = props[prop];
+ var shadow:DropShadowFilter = new DropShadowFilter();
+ for (var prop:String in props) {
+ if (shadow.hasOwnProperty(prop)) {
+ shadow[prop] = props[prop];
+ }
+ }
obj.filters = [shadow];
}
else obj.filters = null;
}
+ public static function setGlowFilter(obj:DisplayObject, props:Object = null):void
+ {
+ if (!obj) return;
+ if (props)
+ {
+ var filter:GlowFilter = new GlowFilter();
+ for (var prop:String in props) {
+ if (filter.hasOwnProperty(prop)) {
+ filter[prop] = props[prop];
+ }
+ }
+ obj.filters = [filter];
+ }
+ else obj.filters = null;
+ }
+
public static function setProperty(obj:DisplayObject, props:Object):void
{
if (!obj || !props) return;
-
+
for (var prop:String in props)
- {
- if (obj.hasOwnProperty(prop)) { obj[prop] = props[prop]; continue; }
+ {
+ if (obj.hasOwnProperty(prop)) {
+ obj[prop] = props[prop];
+ continue;
+ }
FlashUI.ui.py_log("Object with linkage \'" + obj.name + "\' doesn`t contain property " + "with name \'" + prop + "\'.");
}
- if (obj is UIComponentEx && !(obj is ImageEx)) (obj as UIComponentEx).refresh();
+ if (obj is UIComponentEx /* && !(obj is ImageEx)*/ ) {
+ //(obj as UIComponentEx).invalidate()
+ (obj as UIComponentEx).refresh();
+ }
}
public static function setAnimateProperty(obj:DisplayObject, props:Object, params:Object):void
@@ -93,10 +121,10 @@
if (obj is UIComponentEx) tweens.onUpdate = (obj as UIComponentEx).refresh;
if (start) { tweens.onStart = setProperty; tweens.onStartParams = [obj, props]; }
- else { tweens.onComplete = setProperty; tweens.onCompleteParams = [obj, props]; }
+ else { tweens.onComplete = setProperty; tweens.onCompleteParams = [obj, props]; }
if (from) TweenLite.from(obj, duration, tweens);
- else TweenLite.to(obj, duration, tweens);
+ else TweenLite.to(obj, duration, tweens);
}
private static function isEmptyObject(obj:Object):Boolean
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
deleted file mode 100644
index 769150a..0000000
Binary files a/res/gui/flash/as3proj/swc/wg/base_app-1.0-SNAPSHOT.swc and /dev/null differ
diff --git a/res/gui/flash/as3proj/swc/wg/battle.swc b/res/gui/flash/as3proj/swc/wg/battle.swc
deleted file mode 100644
index 8610045..0000000
Binary files a/res/gui/flash/as3proj/swc/wg/battle.swc and /dev/null 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
deleted file mode 100644
index d5fdc18..0000000
Binary files a/res/gui/flash/as3proj/swc/wg/common-1.0-SNAPSHOT.swc and /dev/null 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
deleted file mode 100644
index 97c9d2b..0000000
Binary files a/res/gui/flash/as3proj/swc/wg/common_i18n_library-1.0-SNAPSHOT.swc and /dev/null 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
deleted file mode 100644
index e26c8db..0000000
Binary files a/res/gui/flash/as3proj/swc/wg/gui_base-1.0-SNAPSHOT.swc and /dev/null 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
deleted file mode 100644
index 61800a4..0000000
Binary files a/res/gui/flash/as3proj/swc/wg/gui_battle-1.0-SNAPSHOT.swc and /dev/null 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
deleted file mode 100644
index dcc864c..0000000
Binary files a/res/gui/flash/as3proj/swc/wg/gui_lobby-1.0-SNAPSHOT.swc and /dev/null differ
diff --git a/res/gui/flash/as3proj/swc/wg/lobby.swc b/res/gui/flash/as3proj/swc/wg/lobby.swc
deleted file mode 100644
index b99434b..0000000
Binary files a/res/gui/flash/as3proj/swc/wg/lobby.swc and /dev/null differ
diff --git a/res/gui/flash/as3proj/swc/wg/swc.md b/res/gui/flash/as3proj/swc/wg/swc.md
new file mode 100644
index 0000000..d709919
--- /dev/null
+++ b/res/gui/flash/as3proj/swc/wg/swc.md
@@ -0,0 +1 @@
+To build the flash files, you need to place WG swc files found in gui-part1.pkg/gui/flash/swc/ (lobby) and gui-part2.pkg/gui/flash/swc/ (battle) into this folder beside this file.
diff --git a/res/scripts/client/gui/mods/gambiter/__init__.py b/res/scripts/client/gui/mods/gambiter/__init__.py
index 4243422..a7a207a 100644
--- a/res/scripts/client/gui/mods/gambiter/__init__.py
+++ b/res/scripts/client/gui/mods/gambiter/__init__.py
@@ -2,4 +2,13 @@
from flash import GUIFlash
+GUIFLASH_VERSION = '0.6.4'
+
+
+def getVersion():
+ return GUIFLASH_VERSION
+
+
g_guiFlash = GUIFlash()
+
+print 'GUIFlash v%s by GambitER initialized. (maintained by CHAMPi - fork: https://github.com/CH4MPi/GUIFlash)' % GUIFLASH_VERSION
diff --git a/res/scripts/client/gui/mods/gambiter/__init__.pyc b/res/scripts/client/gui/mods/gambiter/__init__.pyc
deleted file mode 100644
index d5cf4d3..0000000
Binary files a/res/scripts/client/gui/mods/gambiter/__init__.pyc and /dev/null differ
diff --git a/res/scripts/client/gui/mods/gambiter/flash.py b/res/scripts/client/gui/mods/gambiter/flash.py
index 36225a7..ddce6e9 100644
--- a/res/scripts/client/gui/mods/gambiter/flash.py
+++ b/res/scripts/client/gui/mods/gambiter/flash.py
@@ -1,19 +1,28 @@
# -*- coding: utf-8 -*-
-__all__ = ['COMPONENT_TYPE', 'COMPONENT_ALIGN', 'COMPONENT_EVENT']
+__all__ = ['COMPONENT_TYPE', 'COMPONENT_ALIGN', 'COMPONENT_EVENT', 'GUIFlash']
+import codecs
+import json
+
+# noinspection PyUnresolvedReferences
+import BigWorld
+# noinspection PyUnresolvedReferences
import GUI
-import Event
+
import BattleReplay
-import json, codecs
+import Event
+from frameworks.wulf import WindowLayer
from gui import g_guiResetters
-from gui.shared.personality import ServicesLocator
-from skeletons.gui.app_loader import GuiGlobalSpaceID as SPACE_ID
-from gui.shared import g_eventBus, events, EVENT_BUS_SCOPE
+from gui.Scaleform.framework import g_entitiesFactories, ScopeTemplates, ViewSettings
from gui.Scaleform.framework.entities.View import View
from gui.Scaleform.framework.managers.loaders import SFViewLoadParams
-from gui.Scaleform.framework import g_entitiesFactories, ViewSettings, ViewTypes, ScopeTemplates
-from utils import LOG_NOTE, LOG_DEBUG, LOG_ERROR
+from gui.shared import EVENT_BUS_SCOPE, events, g_eventBus
+from gui.shared.personality import ServicesLocator
+from helpers import dependency
+from skeletons.gui.app_loader import GuiGlobalSpaceID as SPACE_ID
+from skeletons.gui.battle_session import IBattleSessionProvider
+from utils import LOG_DEBUG, LOG_ERROR, LOG_NOTE, getParentWindow
class CONSTANTS(object):
@@ -37,6 +46,7 @@ class COMPONENT_ALIGN(object):
CENTER = 'center'
TOP = "top"
BOTTOM = 'bottom'
+ NONE = 'none'
class COMPONENT_STATE(object):
@@ -45,20 +55,22 @@ class COMPONENT_STATE(object):
UNLOAD = 3
DESTROY = 4
+
class COMPONENT_EVENT(object):
LOADED = Event.Event()
UPDATED = Event.Event()
UNLOADED = Event.Event()
+# noinspection PyMethodMayBeStatic
class Cache(object):
def __init__(self):
self.components = {}
- def create(self, alias, type, props):
- LOG_DEBUG("Create cache: '%s' [%s] -> Properties: %s" % (alias, type, props))
- self.components[alias] = {'type': type, 'props': props}
+ def create(self, alias, _type, props, battle=True, lobby=False):
+ LOG_DEBUG("Create cache: '%s' [%s] -> Properties: %s, battle: %s, lobby: %s" % (alias, _type, props, battle, lobby))
+ self.components[alias] = {'type': _type, 'props': props, 'battle': battle, 'lobby': lobby}
def update(self, alias, props):
LOG_DEBUG("Change cache: '%s' -> Properties: %s" % (alias, props))
@@ -71,32 +83,33 @@ def delete(self, alias):
def isComponent(self, alias):
return alias in self.components
+ def isActiveComponent(self, alias):
+ if alias not in self.components:
+ return False
+ return self.components[alias]['battle'] if hasattr(BigWorld.player(), 'arena') else self.components[alias]['lobby']
+
def getComponent(self, alias=None):
- if alias is None:
- return self.components
- return self.components.get(alias)
+ return self.components if alias is None else self.components.get(alias)
def getKeys(self):
- return sorted(self.components.keys())
+ return sorted(filter(self.isActiveComponent, self.components.keys()))
- def getCustomizedType(self, type):
- return ''.join(type.split()).capitalize()
+ def getCustomizedType(self, compType):
+ return ''.join(compType.split()).capitalize()
- def isTypeValid(self, type):
- return type in ALL_COMPONENT_TYPES
+ def isTypeValid(self, compType):
+ return compType in ALL_COMPONENT_TYPES
- # ..
- def readConfig(self, file):
- LOG_DEBUG("Read config from file '%s'." % file)
- with open(file, "r") as file:
- data = json.load(file)
+ def readConfig(self, path):
+ LOG_DEBUG("Read config from file '%s'." % path)
+ with open(path, "r") as f:
+ data = json.load(f)
return data
- # ..
- def saveConfig(self, file, data):
- LOG_DEBUG("Save config in file '%s'." % file)
- with open(file, 'wb') as file:
- json.dump(data, codecs.getwriter('utf-8')(file), indent=4, sort_keys=True, ensure_ascii=False)
+ def saveConfig(self, path, data):
+ LOG_DEBUG("Save config in file '%s'." % path)
+ with codecs.open(path, 'w', 'utf-8') as f:
+ json.dump(data, f, indent=4, sort_keys=True, ensure_ascii=False)
class Views(object):
@@ -108,11 +121,13 @@ def createAll(self):
for alias in g_guiCache.getKeys():
component = g_guiCache.getComponent(alias)
self.create(alias, component.get('type'), component.get('props'))
+ if not hasattr(BigWorld.player(), 'arena'):
+ self.cursor(True)
- def create(self, alias, type, props):
+ def create(self, alias, compType, props):
if self.ui is not None:
- LOG_DEBUG("Create component: '%s' [%s] -> Properties: %s" % (alias, type, props))
- self.ui.as_createS(alias, type, props)
+ LOG_DEBUG("Create component: '%s' [%s] -> Properties: %s" % (alias, compType, props))
+ self.ui.as_createS(alias, compType, props)
def update(self, alias, props, params):
if self.ui is not None:
@@ -127,7 +142,8 @@ def delete(self, alias):
def resize(self):
if self.ui is not None:
width, height = GUI.screenResolution()
- self.ui.as_resizeS(width, height)
+ scale = float(ServicesLocator.settingsCore.interfaceScale.get())
+ self.ui.as_resizeS(int(width / scale), int(height / scale))
def cursor(self, isShow):
if self.ui is not None:
@@ -145,8 +161,30 @@ def fullStatsQuestProgress(self, isShow):
if self.ui is not None:
self.ui.as_fullStatsQuestProgressS(isShow)
+ def fullStatsPersonalReserves(self, isShow):
+ if self.ui is not None:
+ self.ui.as_fullStatsPersonalReservesS(isShow)
+
+ def epicMapOverlayVisibility(self, isShow):
+ if self.ui is not None:
+ self.ui.as_epicMapOverlayVisibilityS(isShow)
+ def epicRespawnOverlayVisibility(self, isShow):
+ if self.ui is not None:
+ self.ui.as_epicRespawnOverlayVisibilityS(isShow)
+
+ def battleRoyaleSpawnVisibility(self, isVisible):
+ if self.ui is not None:
+ self.ui.as_battleRoyaleRespawnVisibilityS(isVisible)
+
+ def killCamVisibility(self, isVisible):
+ if self.ui is not None:
+ self.ui.as_killCamVisibilityS(isVisible)
+
+
+# noinspection PyMethodMayBeStatic
class Hooks(object):
+ sessionProvider = dependency.descriptor(IBattleSessionProvider)
def _start(self):
ServicesLocator.appLoader.onGUISpaceEntered += self.__onGUISpaceEntered
@@ -162,16 +200,77 @@ def _populate(self):
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_eventBus.addListener(events.GameEvent.FULL_STATS_PERSONAL_RESERVES, self.__toggleFullStatsPersonalReserves, scope=EVENT_BUS_SCOPE.BATTLE)
g_guiResetters.add(self.__onResizeStage)
+ ctrl = self.sessionProvider.dynamic.maps
+ if ctrl is not None and hasattr(ctrl, 'onVisibilityChanged'):
+ ctrl.onVisibilityChanged += self.__onMapVisibilityChanged
+
+ # NOTE: frontline respawn screen
+ ctrl = self.sessionProvider.dynamic.respawn
+ if ctrl is not None and hasattr(ctrl, 'onRespawnVisibilityChanged'):
+ ctrl.onRespawnVisibilityChanged += self.__onRespawnVisibilityChanged
+
+ # WoT 1.24.1 - KILL CAM - throws an error on other clients like Lesta, so we catch and ignore it
+ try:
+ if hasattr(self.sessionProvider.shared, 'killCamCtrl') and self.sessionProvider.shared.killCamCtrl:
+ self.sessionProvider.shared.killCamCtrl.onKillCamModeStateChanged += self.__onKillCamModeStateChanged
+ except AttributeError:
+ LOG_DEBUG('killCamCtrl not found!')
+
+ # NOTE: steel hunter select spawn screen
+ try:
+ from battle_royale.gui.Scaleform.daapi.view.battle import BattleRoyalePage
+ spawnCtrl = self.sessionProvider.dynamic.spawn
+ if spawnCtrl is not None:
+ if hasattr(BattleRoyalePage, 'showSpawnPoints'):
+ global hooked_showSpawnPoints
+ if hooked_showSpawnPoints is None:
+ hooked_showSpawnPoints = BattleRoyalePage.showSpawnPoints
+ BattleRoyalePage.showSpawnPoints = newBattleRoyalePageShowSpawnPoints
+ LOG_DEBUG('BattleRoyalePage:showSpawnPoints hooked!')
+
+ if hasattr(BattleRoyalePage, 'closeSpawnPoints'):
+ global hooked_closeSpawnPoints
+ if hooked_closeSpawnPoints is None:
+ hooked_closeSpawnPoints = BattleRoyalePage.closeSpawnPoints
+ BattleRoyalePage.closeSpawnPoints = newBattleRoyalePageCloseSpawnPoints
+ LOG_DEBUG('BattleRoyalePage:closeSpawnPoints hooked!')
+
+ # TEST: check if this works more accurate
+ # ctrl = self.sessionProvider.dynamic.maps
+ # if ctrl is not None:
+ # ctrl.onOverlayTriggered += self.onBattleRoyaleSpawnVisibilityChanged
+ # self.onBattleRoyaleSpawnVisibilityChanged(ctrl.overlayActive)
+ # TEST: !check if this works more accurate
+ except ImportError:
+ pass
+
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.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_eventBus.removeListener(events.GameEvent.FULL_STATS_PERSONAL_RESERVES, self.__toggleFullStatsPersonalReserves, scope=EVENT_BUS_SCOPE.BATTLE)
g_guiResetters.discard(self.__onResizeStage)
+ ctrl = self.sessionProvider.dynamic.maps
+ if ctrl and hasattr(ctrl, 'onVisibilityChanged'):
+ ctrl.onVisibilityChanged -= self.__onMapVisibilityChanged
+
+ ctrl = self.sessionProvider.dynamic.respawn
+ if ctrl is not None:
+ ctrl.onRespawnVisibilityChanged -= self.__onRespawnVisibilityChanged
+
+ # WoT 1.24.1 - KILL CAM
+ try:
+ if hasattr(self.sessionProvider.shared, 'killCamCtrl') and self.sessionProvider.shared.killCamCtrl:
+ self.sessionProvider.shared.killCamCtrl.onKillCamModeStateChanged -= self.__onKillCamModeStateChanged
+ except AttributeError:
+ LOG_DEBUG('killCamCtrl not found!')
+
def __onGUISpaceEntered(self, spaceID):
if spaceID == SPACE_ID.LOGIN:
g_guiEvents.goToLogin()
@@ -192,12 +291,10 @@ def __onResizeStage(self):
g_guiEvents.resizeStage()
def __handleShowCursor(self, _):
- isShow = True
- g_guiEvents.toggleCursor(isShow)
+ g_guiEvents.toggleCursor(True)
def __handleHideCursor(self, _):
- isShow = False
- g_guiEvents.toggleCursor(isShow)
+ g_guiEvents.toggleCursor(False)
def __toggleRadialMenu(self, event):
if BattleReplay.isPlaying():
@@ -213,26 +310,53 @@ def __toggleFullStatsQuestProgress(self, event):
isDown = event.ctx['isDown']
g_guiEvents.toggleFullStatsQuestProgress(isDown)
+ def __toggleFullStatsPersonalReserves(self, event):
+ isDown = event.ctx['isDown']
+ g_guiEvents.toggleFullStatsPersonalReserves(isDown)
+
+ def __onKillCamModeStateChanged(self, state, *args, **kwargs):
+ try:
+ from gui.shared.events import DeathCamEvent
+ if state is DeathCamEvent.State.NONE:
+ return
+ g_guiEvents.killCamVisible(state not in (DeathCamEvent.State.INACTIVE, DeathCamEvent.State.PREPARING, DeathCamEvent.State.FINISHED))
+ except ImportError:
+ pass
+
+ def __onMapVisibilityChanged(self, isVisible):
+ g_guiEvents.epicMapOverlayVisibility(isVisible)
+
+ def __onRespawnVisibilityChanged(self, isVisible):
+ g_guiEvents.epicRespawnOverlayVisibility(isVisible)
+
+ def onBattleRoyaleSpawnVisibilityChanged(self, isVisible):
+ g_guiEvents.battleRoyaleSpawnVisibility(isVisible)
+
+# noinspection PyMethodMayBeStatic
class Events(object):
def goToLogin(self):
pass
def goToLobby(self):
- pass
+ ServicesLocator.appLoader.getApp().loadView(SFViewLoadParams(CONSTANTS.VIEW_ALIAS, parent=getParentWindow()))
def goToBattleLoading(self):
pass
def goToBattle(self):
- ServicesLocator.appLoader.getApp().loadView(SFViewLoadParams(CONSTANTS.VIEW_ALIAS))
+ ServicesLocator.appLoader.getApp().loadView(SFViewLoadParams(CONSTANTS.VIEW_ALIAS, parent=getParentWindow()))
def leaveLobby(self):
- pass
+ if g_guiViews.ui is not None:
+ g_guiViews.ui.destroy()
+ return
def leaveBattle(self):
- pass
+ if g_guiViews.ui is not None:
+ g_guiViews.ui.destroy()
+ return
def resizeStage(self):
g_guiViews.resize()
@@ -249,11 +373,28 @@ def toggleFullStats(self, isShow):
def toggleFullStatsQuestProgress(self, isShow):
g_guiViews.fullStatsQuestProgress(isShow)
+ def toggleFullStatsPersonalReserves(self, isShow):
+ g_guiViews.fullStatsPersonalReserves(isShow)
+
+ def epicMapOverlayVisibility(self, isShow):
+ g_guiViews.epicMapOverlayVisibility(isShow)
+
+ def epicRespawnOverlayVisibility(self, isShow):
+ g_guiViews.epicRespawnOverlayVisibility(isShow)
+
+ def battleRoyaleSpawnVisibility(self, isShow):
+ g_guiViews.battleRoyaleSpawnVisibility(isShow)
+
+ def killCamVisible(self, isVisible):
+ g_guiViews.killCamVisibility(isVisible)
+
+# noinspection PyMethodMayBeStatic
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, WindowLayer.WINDOW, None, ScopeTemplates.GLOBAL_SCOPE))
+ return
def _destroy(self):
g_entitiesFactories.removeSettings(CONSTANTS.VIEW_ALIAS)
@@ -267,37 +408,44 @@ def py_log(self, *args):
def py_update(self, alias, props):
self._printOverrideError('py_update')
- def as_createS(self, alias, type, props):
- if self._isDAAPIInited():
- return self.flashObject.as_create(alias, type, props)
+ def as_createS(self, alias, compType, props):
+ return self.flashObject.as_create(alias, compType, props) if self._isDAAPIInited() else None
def as_updateS(self, alias, props, params):
- if self._isDAAPIInited():
- return self.flashObject.as_update(alias, props, params)
+ return self.flashObject.as_update(alias, props, params) if self._isDAAPIInited() else None
def as_deleteS(self, alias):
- if self._isDAAPIInited():
- return self.flashObject.as_delete(alias)
+ return self.flashObject.as_delete(alias) if self._isDAAPIInited() else None
def as_resizeS(self, width, height):
- if self._isDAAPIInited():
- return self.flashObject.as_resize(width, height)
+ return self.flashObject.as_resize(width, height) if self._isDAAPIInited() else None
- def as_cursorS(self, isShow):
- if self._isDAAPIInited():
- return self.flashObject.as_cursor(isShow)
+ def as_cursorS(self, isVisible):
+ return self.flashObject.as_cursor(isVisible) if self._isDAAPIInited() else None
- def as_radialMenuS(self, isShow):
- if self._isDAAPIInited():
- return self.flashObject.as_radialMenu(isShow)
+ def as_radialMenuS(self, isVisible):
+ return self.flashObject.as_radialMenu(isVisible) if self._isDAAPIInited() else None
- def as_fullStatsS(self, isShow):
- if self._isDAAPIInited():
- return self.flashObject.as_fullStats(isShow)
+ def as_fullStatsS(self, isVisible):
+ return self.flashObject.as_fullStats(isVisible) if self._isDAAPIInited() else None
- def as_fullStatsQuestProgressS(self, isShow):
- if self._isDAAPIInited():
- return self.flashObject.as_fullStatsQuestProgress(isShow)
+ def as_fullStatsQuestProgressS(self, isVisible):
+ return self.flashObject.as_fullStatsQuestProgress(isVisible) if self._isDAAPIInited() else None
+
+ def as_fullStatsPersonalReservesS(self, isVisible):
+ return self.flashObject.as_fullStatsPersonalReserves(isVisible) if self._isDAAPIInited() else None
+
+ def as_epicMapOverlayVisibilityS(self, isVisible):
+ return self.flashObject.as_epicMapOverlayVisibility(isVisible) if self._isDAAPIInited() else None
+
+ def as_epicRespawnOverlayVisibilityS(self, isVisible):
+ return self.flashObject.as_epicRespawnOverlayVisibility(isVisible) if self._isDAAPIInited() else None
+
+ def as_battleRoyaleRespawnVisibilityS(self, isVisible):
+ return self.flashObject.as_battleRoyaleRespawnVisibility(isVisible) if self._isDAAPIInited() else None
+
+ def as_killCamVisibilityS(self, isVisible):
+ return self.flashObject.as_killCamVisibility(isVisible) if self._isDAAPIInited() else None
class Flash_UI(Flash_Meta):
@@ -313,6 +461,7 @@ def _dispose(self):
g_guiViews.ui = None
g_guiHooks._dispose()
super(Flash_UI, self)._dispose()
+ return
def py_log(self, *args):
LOG_NOTE(*args)
@@ -323,6 +472,7 @@ def py_update(self, alias, props):
COMPONENT_EVENT.UPDATED(alias, props.toDict())
+# noinspection PyMethodMayBeStatic
class GUIFlash(object):
def __init__(self):
@@ -333,28 +483,31 @@ def __del__(self):
g_guiHooks._destroy()
g_guiSettings._destroy()
- def createComponent(self, alias, type, props=None):
+ def createComponent(self, alias, compType, props=None, battle=True, lobby=False):
if not g_guiCache.isComponent(alias):
- type = g_guiCache.getCustomizedType(type)
- if g_guiCache.isTypeValid(type):
- g_guiCache.create(alias, type, props)
- g_guiViews.create(alias, type, props)
+ compType = g_guiCache.getCustomizedType(compType)
+ if g_guiCache.isTypeValid(compType):
+ g_guiCache.create(alias, compType, props, battle, lobby)
+ if g_guiCache.isActiveComponent(alias):
+ g_guiViews.create(alias, compType, props)
else:
- LOG_ERROR("Invalid type of component '%s'!" % alias)
+ LOG_ERROR("Invalid component type '%s'!" % alias)
else:
LOG_ERROR("Component '%s' already exists!" % alias)
def updateComponent(self, alias, props, params=None):
if g_guiCache.isComponent(alias):
g_guiCache.update(alias, props)
- g_guiViews.update(alias, props, params)
+ if g_guiCache.isActiveComponent(alias):
+ g_guiViews.update(alias, props, params)
else:
LOG_ERROR("Component '%s' not found!" % alias)
def deleteComponent(self, alias):
if g_guiCache.isComponent(alias):
+ if g_guiCache.isActiveComponent(alias):
+ g_guiViews.delete(alias)
g_guiCache.delete(alias)
- g_guiViews.delete(alias)
else:
LOG_ERROR("Component '%s' not found" % alias)
@@ -364,3 +517,28 @@ def deleteComponent(self, alias):
g_guiHooks = Hooks()
g_guiEvents = Events()
g_guiSettings = Settings()
+
+hooked_showSpawnPoints = None # Type: Callable
+hooked_closeSpawnPoints = None
+
+
+# noinspection PyCallingNonCallable
+def newBattleRoyalePageShowSpawnPoints(self):
+ try:
+ LOG_DEBUG('newBattleRoyalePageShowSpawnPoints called!')
+ g_guiHooks.onBattleRoyaleSpawnVisibilityChanged(True)
+ except StandardError:
+ pass
+ finally:
+ hooked_showSpawnPoints(self)
+
+
+# noinspection PyCallingNonCallable
+def newBattleRoyalePageCloseSpawnPoints(self):
+ try:
+ LOG_DEBUG('newBattleRoyalePageCloseSpawnPoints called!')
+ g_guiHooks.onBattleRoyaleSpawnVisibilityChanged(False)
+ except StandardError:
+ pass
+ finally:
+ hooked_closeSpawnPoints(self)
diff --git a/res/scripts/client/gui/mods/gambiter/flash.pyc b/res/scripts/client/gui/mods/gambiter/flash.pyc
deleted file mode 100644
index 076f7ef..0000000
Binary files a/res/scripts/client/gui/mods/gambiter/flash.pyc and /dev/null differ
diff --git a/res/scripts/client/gui/mods/gambiter/utils.py b/res/scripts/client/gui/mods/gambiter/utils.py
index f9fdb7c..435db19 100644
--- a/res/scripts/client/gui/mods/gambiter/utils.py
+++ b/res/scripts/client/gui/mods/gambiter/utils.py
@@ -1,9 +1,7 @@
# -*- coding: utf-8 -*-
-
IS_DEBUG = False
-
def LOG(arg, *args):
print str(arg), ' '.join([str(arg) for arg in args])
@@ -23,24 +21,24 @@ def LOG_DEBUG(*args):
def LOG_TRACE(exc=None):
import traceback
- print('=') * 25
+ print '=' * 25
if exc is not None:
LOG_ERROR(exc)
traceback.print_exc()
else:
traceback.print_stack()
- print('=') * 25
+ print '=' * 25
def LOG_DIR(object, include=None, exclude=None):
- print('=') * 25
+ print '=' * 25
for attr in dir(object):
if (include is None or attr.find(include) >= 0) and (exclude is None or attr.find(exclude) == -1):
try:
LOG('GUIFlash: [DIR]', 'object.%s = %s' % (attr, getattr(object, attr)))
except:
LOG('GUIFlash: [DIR]', 'object.%s = %s' % (attr, ''))
- print('=') * 25
+ print '=' * 25
def debugLog(func):
@@ -66,6 +64,14 @@ def wrapper(*args, **kwargs):
return wrapper
+def getParentWindow():
+ from skeletons.gui.impl import IGuiLoader
+ from helpers import dependency
+ uiLoader = dependency.instance(IGuiLoader)
+ if uiLoader and uiLoader.windowsManager:
+ return uiLoader.windowsManager.getMainWindow()
+
+
class EventHook(object):
def __init__(self):
@@ -158,4 +164,4 @@ def decorator2(handler):
registerEvent = _hook_decorator(_RegisterEvent)
overrideMethod = _hook_decorator(_OverrideMethod)
overrideStaticMethod = _hook_decorator(_OverrideStaticMethod)
-overrideClassMethod = _hook_decorator(_OverrideClassMethod)
\ No newline at end of file
+overrideClassMethod = _hook_decorator(_OverrideClassMethod)
diff --git a/res/scripts/client/gui/mods/gambiter/utils.pyc b/res/scripts/client/gui/mods/gambiter/utils.pyc
deleted file mode 100644
index 1299ff7..0000000
Binary files a/res/scripts/client/gui/mods/gambiter/utils.pyc and /dev/null differ