Advertisement
deutscher_Adler

Untitled

Jul 22nd, 2015
396
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 26.09 KB | None | 0 0
  1. __application__ = 'Walhalla_Reload_Enemy'
  2. __autor__ = 'Walhalla'
  3. __version__ = '0.9.6'
  4. __status__ = 'Final'
  5. __build__ = '001'
  6. __stamp__ = '12.02.2015'
  7. import BigWorld, Vehicle, Keys, ResMgr
  8. import ProjectileMover
  9. from messenger import MessengerEntry
  10. from Avatar import PlayerAvatar
  11. from gui.WindowsManager import g_windowsManager
  12. from gui.Scaleform.daapi.view.lobby.LobbyView import LobbyView
  13. from Account import PlayerAccount
  14. from gui import SystemMessages
  15. from gui.Scaleform.Minimap import Minimap
  16. import constants
  17. from constants import ARENA_PERIOD
  18. from debug_utils import *
  19. from functools import partial
  20. SWF_FILE_NAME = 'Ext_Marker_red.swf'
  21.  
  22. class I_MarkerReLoad(object):
  23.  
  24. def __init__(self):
  25. self.application = __application__
  26. self.autor = __autor__
  27. self.version = __version__
  28. self.status = __status__
  29. self.build = __build__
  30. self.stamp = __stamp__
  31. self.arenaPeriod = False
  32. self.startTime = 0
  33. self.arenaGuiTyps = 0
  34. self.extTanks = {}
  35. self.visible_list = []
  36. self.enemies_list = {}
  37. self.allies_list = {}
  38. self.timer_list = {}
  39. self.mod_markers = {}
  40. self.shoot_timer_list = {}
  41. self.timeOutReload = {}
  42. self.FlagTXT = True
  43. self.configModule()
  44. self.moduleMarker()
  45.  
  46. def configModule(self):
  47. self.modEnable = True
  48. self.startAlliesEnable = True
  49. self.minimapEnable = False
  50. self.bonusBrotherhood = True
  51. self.bonusStimulator = True
  52. self.bonusAuto = True
  53. self.timeOutAutoReload = True
  54. self.timeOutReloadDelay = 0.0
  55. self.timeReloadCorrect = 0.0
  56. self.toggleKey = 'KEY_F10'
  57. self.modOFFKey = 'KEY_F11'
  58. self.modOFF = False
  59. self.unVisibleReload = False
  60. self.alliesEnable = True
  61. self.SWF_FILE_NAME_ENEMIES = 'Ext_Marker_red.swf'
  62. self.SWF_FILE_NAME_ALLIES = 'Ext_Marker_green.swf'
  63. self.marker_timeUpdate = 0.5
  64. self.marker_timeCorrect = 0.5
  65. self.configMarker = ResMgr.openSection('scripts/client/mods/Walhalla_Reload_Enemy.xml')
  66. if self.configMarker != None:
  67. self.modEnable = self.configMarker.readBool('modEnable')
  68. self.modEnable = self.configMarker.readBool('modEnable')
  69. self.startAlliesEnable = self.configMarker.readBool('startAlliesEnable')
  70. self.minimapEnable = self.configMarker.readBool('minimapEnable')
  71. self.bonusBrotherhood = self.configMarker.readBool('bonusBrotherhood')
  72. self.bonusStimulator = self.configMarker.readBool('bonusStimulator')
  73. self.bonusAuto = self.configMarker.readBool('bonusAuto')
  74. self.timeOutAutoReload = self.configMarker.readBool('timeOutAutoReload')
  75. self.timeOutReloadDelay = self.configMarker.readInt('timeOutReloadDelay')
  76. self.timeReloadCorrect = self.configMarker.readInt('timeReloadCorrect')
  77. self.toggleKey = self.configMarker.readString('toggleKey')
  78. self.modOFFKey = self.configMarker.readString('modOFFKey')
  79. self.unVisibleReload = self.configMarker.readBool('unVisibleReload')
  80. self.alliesEnable = self.configMarker.readBool('alliesEnable')
  81. self.SWF_FILE_NAME_ENEMIES = self.configMarker.readString('SWF_FILE_NAME_ENEMIES')
  82. self.SWF_FILE_NAME_ALLIES = self.configMarker.readString('SWF_FILE_NAME_ALLIES')
  83. self.marker_timeUpdate = self.configMarker.readFloat('reload_tout')
  84. self.marker_timeCorrect = self.configMarker.readFloat('self.marker_timeCorrect')
  85. print 'Walhalla_Reload_Enemy config successfully loaded.'
  86. return
  87.  
  88. def moduleMarker(self):
  89.  
  90. def new_showTracer(current, shooterID, shotID, isRicochet, effectsIndex, refStartPoint, velocity, gravity, maxShotDist):
  91. pre_showTracer(current, shooterID, shotID, isRicochet, effectsIndex, refStartPoint, velocity, gravity, maxShotDist)
  92. if self.modOFF:
  93. return
  94. else:
  95. shooter = BigWorld.entity(shooterID)
  96. if shooter is not None and self.minimapEnable:
  97. __MiniMapAndMarkReload(shooterID)
  98. __Reloading__Marker_Action(shooterID)
  99. return
  100. return
  101.  
  102. def __MiniMapAndMarkReload(id, rlFlag = False):
  103. try:
  104. if not __getIsFriendly(id) and not __isPlayer(id) and self.minimapEnable:
  105. if g_windowsManager.battleWindow is not None and g_windowsManager.battleWindow.minimap is not None:
  106. mm_handle = g_windowsManager.battleWindow.minimap._Minimap__enemyEntries[id]['handle']
  107. if mm_handle is not None:
  108. g_windowsManager.battleWindow.minimap._Minimap__ownUI.entryInvoke(mm_handle, ('showAction', 'reloading_gun'))
  109. g_windowsManager.battleWindow.minimap._Minimap__parentUI.call('minimap.entryInited', [])
  110. if rlFlag:
  111. entity = BigWorld.entity(id)
  112. if entity is not None and entity.isStarted:
  113. pass
  114. except KeyError:
  115. return
  116.  
  117. return
  118.  
  119. def __Reloading__Marker_Action(id):
  120. global SWF_FILE_NAME
  121. if self.modOFF:
  122. return
  123. else:
  124. if __Remaining(id):
  125. reload_time = __calculateReload(id)
  126. if reload_time > 1.0 and self.modEnable:
  127. flashID = str(''.join([str(id), 'vehicleMarkersManager']))
  128. if not __getIsFriendly(id):
  129. SWF_FILE_NAME = self.SWF_FILE_NAME_ENEMIES
  130. else:
  131. SWF_FILE_NAME = self.SWF_FILE_NAME_ALLIES
  132. Mod_Marker = _VehicleMarkersManager()
  133. self.mod_markers[flashID] = Mod_Marker
  134. Mod_Marker.start(flashID)
  135. try:
  136. mm_handle = Mod_Marker.createMarker(BigWorld.entity(id))
  137. if mm_handle is not None:
  138. enout = BigWorld.time() + reload_time + self.marker_timeCorrect
  139. Mod_Marker.showActionMarker(mm_handle, 'attack', int(reload_time))
  140. except:
  141. return
  142. finally:
  143.  
  144. def marker_check():
  145. try:
  146. stop_mark = True
  147. if __Remaining(id) and self.modEnable and not (__getIsFriendly(id) and not self.alliesEnable):
  148. if BigWorld.time() < enout:
  149. if self.mod_markers[flashID] == Mod_Marker:
  150. stop_mark = False
  151. if stop_mark or self.modOFF or not self.unVisibleReload and id not in self.visible_list:
  152. Mod_Marker.destroy_light(flashID)
  153. else:
  154. BigWorld.callback(self.marker_timeUpdate, marker_check)
  155. except:
  156. Mod_Marker.destroy_light(flashID)
  157.  
  158. marker_check()
  159.  
  160. return
  161. return
  162.  
  163. def __GetBonus(id):
  164. try:
  165. ventil_bonus = False
  166. rammer_bonus = False
  167. comander = 100
  168. loader = 100
  169. veh = BigWorld.player().arena.vehicles.get(id)
  170. for item in veh['vehicleType'].optionalDevices:
  171. if item is not None and 'improvedVentilation' in item.name:
  172. ventil_bonus = True
  173. if item is not None and 'Rammer' in item.name:
  174. rammer_bonus = True
  175. continue
  176.  
  177. bonusVBS = 0
  178. if ventil_bonus:
  179. bonusVBS += 5
  180. if self.bonusBrotherhood or self.bonusAuto and BigWorld.player().arena.guiType == constants.ARENA_GUI_TYPE.COMPANY:
  181. bonusVBS += 5
  182. if self.bonusStimulator or self.bonusAuto and BigWorld.player().arena.guiType == constants.ARENA_GUI_TYPE.COMPANY:
  183. bonusVBS += 10
  184. comander_bonus = comander + bonusVBS
  185. loader_bonus = comander_bonus * 0.1 + bonusVBS + loader
  186. bonus = 1 / (1 + (loader_bonus - 100) * 0.00434294482)
  187. if rammer_bonus:
  188. bonus *= 0.9
  189. return bonus
  190. except:
  191. return 1
  192.  
  193. return
  194.  
  195. def __timeOutNoShoot(id):
  196. if id in self.timeOutReload:
  197. del self.timeOutReload[id]
  198. if id in self.shoot_timer_list:
  199. timer = BigWorld.time() - self.shoot_timer_list[id]
  200. veh = BigWorld.player().arena.vehicles.get(id)
  201. shortUserString = veh['vehicleType'].type.shortUserString
  202. reloadTime = veh['vehicleType'].gun['reloadTime']
  203. ammo = self.extTanks[id]['ammo']
  204. if not __getIsFriendly(id):
  205. self.enemies_list.update({id: {'ammo': ammo,
  206. 'time': self.shoot_timer_list[id]}})
  207. else:
  208. self.allies_list.update({id: {'ammo': ammo,
  209. 'time': self.shoot_timer_list[id]}})
  210. __MiniMapAndMarkReload(id, True)
  211.  
  212. def __calculateReload(id):
  213. try:
  214. veh = BigWorld.player().arena.vehicles.get(id)
  215. shortUserString = veh['vehicleType'].type.shortUserString
  216. reloadTime = veh['vehicleType'].gun['reloadTime']
  217. bonusReloadTime = reloadTime * __GetBonus(id)
  218. time = BigWorld.time()
  219. battleTime = time - self.startTime
  220. if bonusReloadTime > battleTime:
  221. bonusReloadTime -= battleTime
  222. return bonusReloadTime
  223. if id in self.timer_list:
  224. if not self.timer_list[id]['shootFlag']:
  225. reloadTimeResidue = bonusReloadTime - (time - self.timer_list[id]['time'])
  226. if reloadTimeResidue > 0:
  227. if id in self.timer_list:
  228. del self.timer_list[id]
  229. return reloadTimeResidue
  230. if id not in self.extTanks:
  231. if not __getIsFriendly(id):
  232. self.enemies_list[id]['time'] = time
  233. else:
  234. self.allies_list[id]['time'] = time
  235. self.timer_list.update({id: {'time': time,
  236. 'shootFlag': True}})
  237. return bonusReloadTime
  238. if self.timeOutAutoReload:
  239. self.shoot_timer_list.update({id: time})
  240. if id in self.timeOutReload:
  241. BigWorld.cancelCallback(self.timeOutReload[id])
  242. self.timeOutReload.update({id: BigWorld.callback(self.extTanks[id]['reloadTime'] * __GetBonus(id) + self.timeOutReloadDelay, partial(__timeOutNoShoot, id))})
  243. if not __getIsFriendly(id):
  244. ammo = self.enemies_list[id]['ammo']
  245. if ammo > 1:
  246. ammo -= 1
  247. bonusReloadTime = self.extTanks[id]['clipReloadTime']
  248. else:
  249. self.timer_list.update({id: {'time': time,
  250. 'shootFlag': True}})
  251. ammo = self.extTanks[id]['ammo']
  252. if id in self.shoot_timer_list:
  253. del self.shoot_timer_list[id]
  254. self.enemies_list.update({id: {'ammo': ammo,
  255. 'time': time}})
  256. if __getIsFriendly(id):
  257. ammo = self.allies_list[id]['ammo']
  258. if ammo > 1:
  259. ammo -= 1
  260. bonusReloadTime = self.extTanks[id]['clipReloadTime']
  261. else:
  262. self.timer_list.update({id: {'time': time,
  263. 'shootFlag': True}})
  264. ammo = self.extTanks[id]['ammo']
  265. if id in self.shoot_timer_list:
  266. del self.shoot_timer_list[id]
  267. self.allies_list.update({id: {'ammo': ammo,
  268. 'time': time}})
  269. return bonusReloadTime
  270. except:
  271. return 0
  272.  
  273. def __Remaining(id):
  274. return __getBattleOn() and __getIsLive(id) and not __isPlayer(id)
  275.  
  276. def __isPlayer(id):
  277. return BigWorld.player().playerVehicleID == id
  278.  
  279. def __getBattleOn():
  280. return hasattr(BigWorld.player(), 'arena')
  281.  
  282. def __getIsLive(id):
  283. return __getBattleOn() and BigWorld.player().arena.vehicles.get(id)['isAlive']
  284.  
  285. def __getIsFriendly(id):
  286. return __getBattleOn() and BigWorld.player().arena.vehicles[BigWorld.player().playerVehicleID]['team'] == BigWorld.player().arena.vehicles[id]['team']
  287.  
  288. def new_vehicle_onEnterWorld(current, vehicle):
  289. pre_vehicle_onEnterWorld(current, vehicle)
  290. if self.modOFF:
  291. return
  292. if not self.arenaPeriod:
  293. return
  294. if not __getIsLive(vehicle.id) or __isPlayer(vehicle.id):
  295. return
  296. id = vehicle.id
  297. if id not in self.visible_list:
  298. self.visible_list.append(id)
  299. veh = BigWorld.player().arena.vehicles.get(id)
  300. shortUserString = veh['vehicleType'].type.shortUserString
  301. reloadTime = veh['vehicleType'].gun['reloadTime']
  302. clip = veh['vehicleType'].gun['clip']
  303. burst = veh['vehicleType'].gun['burst']
  304. if clip[0] > 1:
  305. if id not in self.extTanks:
  306. self.extTanks.update({id: {'reloadTime': reloadTime,
  307. 'clipReloadTime': clip[1],
  308. 'ammo': clip[0]}})
  309. time = BigWorld.time()
  310. battleTime = time - self.startTime
  311. bonusReloadTime = reloadTime * __GetBonus(id)
  312. if id in self.timer_list:
  313. reloadTimeResidue = bonusReloadTime - (time - self.timer_list[id]['time'])
  314. if reloadTimeResidue > 0:
  315. self.timer_list[id]['shootFlag'] = False
  316. __Reloading__Marker_Action(id)
  317. return
  318. if not __getIsFriendly(id):
  319. if id not in self.enemies_list:
  320. ammo = 1
  321. self.enemies_list.update({id: {'ammo': ammo,
  322. 'time': time - bonusReloadTime}})
  323. if id in self.extTanks:
  324. rlt = bonusReloadTime
  325. bonusReloadTime = self.extTanks[id]['clipReloadTime']
  326. timer = time - self.enemies_list[id]['time']
  327. if timer >= bonusReloadTime - self.timeReloadCorrect:
  328. ammo = self.extTanks[id]['ammo']
  329. self.enemies_list[id]['ammo'] = ammo
  330. bonusReloadTime = rlt
  331. if __getIsFriendly(id):
  332. if id not in self.allies_list:
  333. ammo = 1
  334. self.allies_list.update({id: {'ammo': ammo,
  335. 'time': time - bonusReloadTime}})
  336. if id in self.extTanks:
  337. rlt = bonusReloadTime
  338. bonusReloadTime = self.extTanks[id]['clipReloadTime']
  339. timer = time - self.allies_list[id]['time']
  340. if timer >= bonusReloadTime - self.timeReloadCorrect:
  341. ammo = self.extTanks[id]['ammo']
  342. self.allies_list[id]['ammo'] = ammo
  343. bonusReloadTime = rlt
  344. if bonusReloadTime > battleTime:
  345. __Reloading__Marker_Action(id)
  346.  
  347. def new_vehicle_onLeaveWorld(current, vehicle):
  348. pre_vehicle_onLeaveWorld(current, vehicle)
  349. id = vehicle.id
  350. if id in self.visible_list:
  351. self.visible_list.remove(id)
  352.  
  353. def __onVehicleKilled(targetID, atackerID, reason):
  354. if self.modOFF:
  355. return
  356. id = targetID
  357. if id in self.visible_list:
  358. self.visible_list.remove(id)
  359. if self.enemies_list.has_key(id):
  360. del self.enemies_list[id]
  361. if self.allies_list.has_key(id):
  362. del self.allies_list[id]
  363. if self.timer_list.has_key(id):
  364. del self.timer_list[id]
  365. if self.shoot_timer_list.has_key(id):
  366. del self.shoot_timer_list[id]
  367.  
  368. def __clearVars():
  369. self.visible_list = []
  370. self.enemies_list = {}
  371. self.allies_list = {}
  372. self.timer_list = {}
  373. self.mod_markers = {}
  374. self.extTanks = {}
  375. self.shoot_timer_list = {}
  376. self.timeOutReload = {}
  377. self.startTime = 0
  378.  
  379. def __startBattle():
  380. BigWorld.player().arena.onVehicleKilled += __onVehicleKilled
  381. self.arenaPeriod = False
  382. __clearVars()
  383.  
  384. def __stopBattle():
  385. BigWorld.player().arena.onVehicleKilled -= __onVehicleKilled
  386. self.arenaPeriod = False
  387. __clearVars()
  388.  
  389. def vehicles_to_list():
  390. for id, entityVehicle in BigWorld.entities.items():
  391. if isinstance(entityVehicle, Vehicle.Vehicle) and not __isPlayer(id):
  392. veh = BigWorld.player().arena.vehicles.get(id)
  393. shortUserString = veh['vehicleType'].type.shortUserString
  394. reloadTime = veh['vehicleType'].gun['reloadTime']
  395. clip = veh['vehicleType'].gun['clip']
  396. if clip[0] > 1:
  397. self.extTanks.update({id: {'reloadTime': reloadTime,
  398. 'clipReloadTime': clip[1],
  399. 'ammo': clip[0]}})
  400. if id not in self.visible_list:
  401. self.visible_list.append(id)
  402. if not __getIsFriendly(id):
  403. if id not in self.enemies_list:
  404. ammo = 1
  405. self.enemies_list.update({id: {'ammo': ammo,
  406. 'time': 0}})
  407. if id in self.extTanks:
  408. ammo = self.extTanks[id]['ammo']
  409. self.enemies_list[id]['ammo'] = ammo
  410. if __getIsFriendly(id):
  411. if id not in self.allies_list:
  412. ammo = 1
  413. self.allies_list.update({id: {'ammo': ammo,
  414. 'time': 0}})
  415. if id in self.extTanks:
  416. ammo = self.extTanks[id]['ammo']
  417. self.allies_list[id]['ammo'] = ammo
  418.  
  419. def new_onArenaPeriodChange(current, period, periodEndTime, periodLength, periodAdditionalInfo):
  420. pre_onArenaPeriodChange(current, period, periodEndTime, periodLength, periodAdditionalInfo)
  421. if period == ARENA_PERIOD.PREBATTLE:
  422. vehicles_to_list()
  423. if period == ARENA_PERIOD.BATTLE:
  424. self.arenaPeriod = True
  425. self.startTime = BigWorld.time()
  426. if self.startAlliesEnable:
  427. for id in self.allies_list:
  428. __Reloading__Marker_Action(id)
  429.  
  430. pre_onArenaPeriodChange = PlayerAvatar._PlayerAvatar__onArenaPeriodChange
  431. PlayerAvatar._PlayerAvatar__onArenaPeriodChange = new_onArenaPeriodChange
  432.  
  433. def new_PlayerHandleKey_init(current, isDown, key, mods):
  434. pre_PlayerHandleKey_init(current, isDown, key, mods)
  435. if g_windowsManager.battleWindow is not None:
  436. if self.modOFF and key == getattr(Keys, self.toggleKey, None) and isDown:
  437. g_windowsManager.battleWindow.call('battle.PlayerMessagesPanel.ShowMessage', ['0', self.application + ' MOD-OFF', 'red'])
  438. return
  439. if not self.modOFF and key == getattr(Keys, self.modOFFKey, None) and isDown:
  440. g_windowsManager.battleWindow.call('battle.PlayerMessagesPanel.ShowMessage', ['0', self.application + ' MOD-OFF', 'red'])
  441. self.modOFF = True
  442. __clearVars()
  443. return
  444. if self.modOFF and key == getattr(Keys, self.modOFFKey, None) and isDown:
  445. g_windowsManager.battleWindow.call('battle.PlayerMessagesPanel.ShowMessage', ['0', self.application + ' MOD-ON', 'green'])
  446. self.modOFF = False
  447. vehicles_to_list()
  448. if not self.modEnable and key == getattr(Keys, self.toggleKey, None) and isDown:
  449. self.modEnable = True
  450. g_windowsManager.battleWindow.call('battle.PlayerMessagesPanel.ShowMessage', ['0', self.application + ' ON', 'green'])
  451. return
  452. if self.modEnable and key == getattr(Keys, self.toggleKey, None) and isDown:
  453. if not self.alliesEnable:
  454. self.alliesEnable = True
  455. g_windowsManager.battleWindow.call('battle.PlayerMessagesPanel.ShowMessage', ['0', self.application + ' + allies ON', 'green'])
  456. return
  457. self.alliesEnable = False
  458. self.modEnable = False
  459. g_windowsManager.battleWindow.call('battle.PlayerMessagesPanel.ShowMessage', ['0', self.application + ' OFF', 'gold'])
  460. return
  461.  
  462. pre_PlayerHandleKey_init = PlayerAvatar.handleKey
  463. PlayerAvatar.handleKey = new_PlayerHandleKey_init
  464.  
  465. def new_LobbyView_populate(current):
  466. old_LobbyView_populate(current)
  467. if self.configMarker == None:
  468. SystemMessages.pushI18nMessage('<font color="#ff9933"><B>' + self.application + ' v' + self.version + ' build ' + self.build + ' ' + self.status + '</B></font><br><br><font color="#cc0000"> Walhalla_Reload_Enemy Config loading failure!</font>', type=SystemMessages.SM_TYPE.Warning)
  469. elif self.FlagTXT:
  470. SystemMessages.pushI18nMessage('<font color="#ff9933"><B>' + self.application + ' v' + self.version + ' build ' + self.build + ' ' + self.status + '</B></font><br><br><font color="#33cc00"> Walhalla_Reload_Enemy config successfully loaded.</font>', type=SystemMessages.SM_TYPE.Warning)
  471. self.FlagTXT = False
  472. return
  473.  
  474. old_LobbyView_populate = LobbyView._populate
  475. LobbyView._populate = new_LobbyView_populate
  476. pre_vehicle_onEnterWorld = PlayerAvatar.vehicle_onEnterWorld
  477. PlayerAvatar.vehicle_onEnterWorld = new_vehicle_onEnterWorld
  478. pre_vehicle_onLeaveWorld = PlayerAvatar.vehicle_onLeaveWorld
  479. PlayerAvatar.vehicle_onLeaveWorld = new_vehicle_onLeaveWorld
  480. pre_showTracer = PlayerAvatar.showTracer
  481. PlayerAvatar.showTracer = new_showTracer
  482. g_windowsManager.onInitBattleGUI += __startBattle
  483. g_windowsManager.onDestroyBattleGUI += __stopBattle
  484.  
  485.  
  486. from Account import _readClientServerVersion
  487.  
  488. def getClientVersion():
  489. v0, v1 = _readClientServerVersion()
  490. v0 = v0.replace('requiredVersion_', '')[:-2]
  491. version = '0.' + v0[0] + '.' + v0[1:]
  492. return version
  493.  
  494.  
  495. if getClientVersion() == getClientVersion():
  496. VM = I_MarkerReLoad()
  497. else:
  498. print '***** Please update ' + __application__ + ' ! *****'
  499. import weakref
  500. import GUI
  501. from gui.Scaleform.Flash import Flash
  502.  
  503. class _VehicleMarkersManager(Flash):
  504. __FLASH_CLASS = 'Flash'
  505. __FLASH_PATH = 'scripts/client/mods/Walhalla_Reload_Enemy/flash'
  506. __FLASH_ARGS = None
  507.  
  508. def __init__(self):
  509. Flash.__init__(self, SWF_FILE_NAME, self.__FLASH_CLASS, self.__FLASH_ARGS, self.__FLASH_PATH)
  510. self.component.wg_inputKeyMode = 2
  511. self.component.drawWithRestrictedViewPort = False
  512. self.movie.backgroundAlpha = 0
  513. self.__parentUI = weakref.proxy(g_windowsManager.battleWindow)
  514. self.__parentUIcomp = self.__parentUI.component
  515. self.__ownUI = None
  516. return
  517.  
  518. def start(self, flashID):
  519. self.active(True)
  520. self.__ownUI = GUI.WGVehicleMarkersCanvasFlash(self.movie)
  521. self.__ownUI.wg_inputKeyMode = 2
  522. self.__ownUIProxy = weakref.proxy(self.__ownUI)
  523. self.__parentUIcomp.addChild(self.__ownUI, flashID)
  524.  
  525. def destroy_light(self, flashID):
  526. self.__parentUI = None
  527. self.__ownUI = None
  528. self.close()
  529. return
  530.  
  531. def destroy(self, flashID):
  532. if self.__parentUIcomp is not None:
  533. if hasattr(self.__parentUIcomp, flashID):
  534. setattr(self.__parentUIcomp, flashID, None)
  535. self.__parentUI = None
  536. self.__ownUI = None
  537. self.close()
  538. return
  539.  
  540. def createMarker(self, vProxy):
  541. mProv = vProxy.model.node('HP_gui')
  542. handle = self.__ownUI.addMarker(mProv, 'VehicleMarkerEnemy')
  543. self.invokeMarker(handle, 'init', [])
  544. return handle
  545.  
  546. def showActionMarker(self, handle, newState = '', time_value = 0):
  547. self.invokeMarker(handle, 'showActionMarker', [newState, time_value])
  548.  
  549. def invokeMarker(self, handle, function, args = None):
  550. if handle != -1:
  551. if args is None:
  552. args = []
  553. self.__ownUI.markerInvoke(handle, (function, args))
  554. return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement