Wanket Posted June 14, 2017 Share Posted June 14, 2017 Делаю: def onAccountShowGUI(ctx): mod.setUsers() Но вызов происходит до того как проходят все ивенты g_messengerEvents.users.onUserStatusUpdated Как отследить загрузку ангара, но после всех вывозов ивента? Именно тех ивентов, что вызываются после загрузки ангара. @ Quote Link to comment Short link Share on other sites More sharing options...
spoter Posted June 14, 2017 Share Posted June 14, 2017 (edited) import BigWorld from gui.shared.utils.HangarSpace import g_hangarSpace from gui.Scaleform.daapi.view.lobby.LobbyView import LobbyView from gui.mods.mod_mods_gui import inject def p__pop_up_text(self): if g_hangarSpace is not None and g_hangarSpace.inited: print 'test' @inject.hook(LobbyView, '_populate') @inject.log def hookPopulate(hooked, *args): hooked(*args) BigWorld.callback(5.0, pop_up_text) Я делаю так, когда мне скучно :) Edited June 14, 2017 by spoter 1 1 @ Quote Link to comment Short link Share on other sites More sharing options...
Tester Posted June 14, 2017 Share Posted June 14, 2017 from gui.shared import events, g_eventBus def onLobbyLoaded(event): pass g_eventBus.addListener(events.GUICommonEvent.LOBBY_VIEW_LOADED, onLobbyLoaded) 4 @ Quote Link to comment Short link Share on other sites More sharing options...
spoter Posted June 14, 2017 Share Posted June 14, 2017 g_eventBus.addListener(events.GUICommonEvent.LOBBY_VIEW_LOADED, onLobbyLoaded) ЕРЕТИК! СОЖЖОМ ЕГО! Так скучно. 1 1 @ Quote Link to comment Short link Share on other sites More sharing options...
Wanket Posted June 15, 2017 Author Share Posted June 15, 2017 (edited) @spoter, callback, серьезно? from gui.shared import events, g_eventBus def onLobbyLoaded(event): pass g_eventBus.addListener(events.GUICommonEvent.LOBBY_VIEW_LOADED, onLobbyLoaded) Это помогло. Edited June 15, 2017 by Wanket @ Quote Link to comment Short link Share on other sites More sharing options...
Wanket Posted June 15, 2017 Author Share Posted June 15, 2017 UPD: Некоторые ивенты g_messengerEvents.users.onUserStatusUpdated вызываются после events.GUICommonEvent.LOBBY_VIEW_LOADED поэтому все еще актуально @ Quote Link to comment Short link Share on other sites More sharing options...
ShuraBB Posted June 15, 2017 Share Posted June 15, 2017 Может ты напишешь что именно ты хочешь сделать? @ Quote Link to comment Short link Share on other sites More sharing options...
sirmax Posted June 15, 2017 Share Posted June 15, 2017 в XVM сделано примерно так: def start(): g_eventBus.addListener(events.AppLifeCycleEvent.INITIALIZED, onAppInitialized) g_eventBus.addListener(events.AppLifeCycleEvent.DESTROYED, onAppDestroyed) BigWorld.callback(0, start) def onAppInitialized(event): if event.ns == APP_NAME_SPACE.SF_LOBBY: app = g_appLoader.getApp(event) app.loaderManager.onViewLoaded += onViewLoaded def onAppDestroyed(event): if event.ns == APP_NAME_SPACE.SF_LOBBY: onHangarDispose() def onViewLoaded(view=None): if view and view.uniqueName == VIEW_ALIAS.LOBBY_HANGAR: onHangarInit() def onHangarInit(): pass def onHangarDispose(): pass нужно учесть, что будет срабатывать каждый раз, когда ангар загружается, например, при переходе в магазин и обратно в ангар. необходимые импорты сам добавишь @ Quote Link to comment Short link Share on other sites More sharing options...
Wanket Posted June 15, 2017 Author Share Posted June 15, 2017 (edited) @ShuraBB, хочу получить данные контактов(онлайн, не онлайн, в бою ли), но надо мне это сделать после подзагрузки этих самых контактов, иначе некоторые данные будут неверны(например все будут оффлайн). @sirmax, почему то g_appLoader.getApp(event) всегда возвращает None Edited June 15, 2017 by Wanket @ Quote Link to comment Short link Share on other sites More sharing options...
sirmax Posted June 15, 2017 Share Posted June 15, 2017 @sirmax, почему то g_appLoader.getApp(event) всегда возвращает None Ошибся, надо: g_appLoader.getApp(event.ns) @ Quote Link to comment Short link Share on other sites More sharing options...
Wanket Posted June 15, 2017 Author Share Posted June 15, 2017 Вызов все равно происходит раньше чем обновился список контактов @ Quote Link to comment Short link Share on other sites More sharing options...
sirmax Posted June 15, 2017 Share Posted June 15, 2017 Вызов все равно происходит раньше чем обновился список контактов Так список контактов при нажатии кнопки обновляется. Ты же не сказал, что тебе список контактов нужен, ты написал "Как отследить загрузку ангара". @ Quote Link to comment Short link Share on other sites More sharing options...
Wanket Posted June 15, 2017 Author Share Posted June 15, 2017 Он так же обновляется и при первой загрузке ангара. Вот это обновление и надо отследить @ Quote Link to comment Short link Share on other sites More sharing options...
ShuraBB Posted June 16, 2017 Share Posted June 16, 2017 (edited) >Он так же обновляется и при первой загрузке ангара И при первой и при любом изменении состояния в списке from messenger.storage import storage_getter from messenger.gui.Scaleform.data.contacts_data_provider import _ContactsCategories @storage_getter('users') def usersStorage(self): return None def onAccountShowGUI(ctx): for user in usersStorage.getList(_ContactsCategories().getCriteria()): print user Edited June 16, 2017 by ShuraBB @ Quote Link to comment Short link Share on other sites More sharing options...
Wanket Posted June 16, 2017 Author Share Posted June 16, 2017 user.isOnline() все равно у всех False, даже тех что онлайн @ Quote Link to comment Short link Share on other sites More sharing options...
ShuraBB Posted June 16, 2017 Share Posted June 16, 2017 Они должны быть у тебя в друзьях ;-) @ Quote Link to comment Short link Share on other sites More sharing options...
Wanket Posted June 16, 2017 Author Share Posted June 16, 2017 (edited) Специально проверяю на "friend" in user.getTags() UPD: Online показывает только у меня самого(Wanket), хотя есть друзья в сети UPD2: То ли я дурак, то ли магия какая, но вдруг все стало работать, ток не убивайте. Сработал метод sirmax'а, но пришлось немного доработать Edited June 16, 2017 by Wanket @ Quote Link to comment Short link Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.