Wanket 3 Posted June 14, 2017 Делаю: def onAccountShowGUI(ctx): mod.setUsers() Но вызов происходит до того как проходят все ивенты g_messengerEvents.users.onUserStatusUpdated Как отследить загрузку ангара, но после всех вывозов ивента? Именно тех ивентов, что вызываются после загрузки ангара. Quote Share this post Link to post Short link Share on other sites
spoter 1,402 #395292 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 Share this post Link to post Short link Share on other sites
Tester 5 #395294 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 Share this post Link to post Short link Share on other sites
spoter 1,402 #395295 Posted June 14, 2017 g_eventBus.addListener(events.GUICommonEvent.LOBBY_VIEW_LOADED, onLobbyLoaded) ЕРЕТИК! СОЖЖОМ ЕГО! Так скучно. 1 1 Quote Share this post Link to post Short link Share on other sites
Wanket 3 #395307 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 Share this post Link to post Short link Share on other sites
Wanket 3 #395326 Posted June 15, 2017 UPD: Некоторые ивенты g_messengerEvents.users.onUserStatusUpdated вызываются после events.GUICommonEvent.LOBBY_VIEW_LOADED поэтому все еще актуально Quote Share this post Link to post Short link Share on other sites
ShuraBB 1,151 #395336 Posted June 15, 2017 Может ты напишешь что именно ты хочешь сделать? Quote Share this post Link to post Short link Share on other sites
sirmax 5,499 #395342 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 Share this post Link to post Short link Share on other sites
Wanket 3 #395405 Posted June 15, 2017 (edited) @ShuraBB, хочу получить данные контактов(онлайн, не онлайн, в бою ли), но надо мне это сделать после подзагрузки этих самых контактов, иначе некоторые данные будут неверны(например все будут оффлайн). @sirmax, почему то g_appLoader.getApp(event) всегда возвращает None Edited June 15, 2017 by Wanket Quote Share this post Link to post Short link Share on other sites
sirmax 5,499 #395411 Posted June 15, 2017 @sirmax, почему то g_appLoader.getApp(event) всегда возвращает None Ошибся, надо: g_appLoader.getApp(event.ns) Quote Share this post Link to post Short link Share on other sites
Wanket 3 #395414 Posted June 15, 2017 Вызов все равно происходит раньше чем обновился список контактов Quote Share this post Link to post Short link Share on other sites
sirmax 5,499 #395418 Posted June 15, 2017 Вызов все равно происходит раньше чем обновился список контактов Так список контактов при нажатии кнопки обновляется. Ты же не сказал, что тебе список контактов нужен, ты написал "Как отследить загрузку ангара". Quote Share this post Link to post Short link Share on other sites
Wanket 3 #395420 Posted June 15, 2017 Он так же обновляется и при первой загрузке ангара. Вот это обновление и надо отследить Quote Share this post Link to post Short link Share on other sites
ShuraBB 1,151 #395476 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 Share this post Link to post Short link Share on other sites
Wanket 3 #395525 Posted June 16, 2017 user.isOnline() все равно у всех False, даже тех что онлайн Quote Share this post Link to post Short link Share on other sites
ShuraBB 1,151 #395529 Posted June 16, 2017 Они должны быть у тебя в друзьях ;-) Quote Share this post Link to post Short link Share on other sites
Wanket 3 #395531 Posted June 16, 2017 (edited) Специально проверяю на "friend" in user.getTags() UPD: Online показывает только у меня самого(Wanket), хотя есть друзья в сети UPD2: То ли я дурак, то ли магия какая, но вдруг все стало работать, ток не убивайте. Сработал метод sirmax'а, но пришлось немного доработать Edited June 16, 2017 by Wanket Quote Share this post Link to post Short link Share on other sites