@Override public void onFrameAdd(final FrameHandler frameHandler, final boolean isAboutToBeAdded) { if (!isAboutToBeAdded) { this.m_dialogUnloadListener = new DialogUnloadListener() { @Override public void dialogUnloaded(final String id) { if (id.equals("moderatorChatDialog")) { UIModeratorChatFrame.this.askToCloseRequest(); } } }; Xulor.getInstance().addDialogUnloadListener(this.m_dialogUnloadListener); Xulor.getInstance() .load( "moderatorChatDialog", Dialogs.getDialogPath("moderatorChatDialog"), 40977L, (short) 10000); Xulor.getInstance().putActionClass("wakfu.moderatorChat", ModeratorChatDialogActions.class); final Message msg = new UIChatCreationRequestMessage( (short) 19067, this.m_remoteUser, new Listener(this.m_firstMessage, this.m_sourceId, this.m_remoteUser)); Worker.getInstance().pushMessage(msg); this.m_isRunning = true; } }
@Override public void onFrameRemove(final FrameHandler frameHandler, final boolean isAboutToBeRemoved) { if (!isAboutToBeRemoved) { Xulor.getInstance().removeDialogUnloadListener(this.m_dialogUnloadListener); UIChatFrameHelper.closeModeratorChatWindow(); Xulor.getInstance().unload("moderatorChatDialog"); Xulor.getInstance().removeActionClass("wakfu.moderatorChat"); if (this.m_isRunning) { final Message notifyToOtherSide = new CloseModeratorRequestMessage(); WakfuGameEntity.getInstance().getNetworkEntity().sendMessage(notifyToOtherSide); this.m_isRunning = false; } } }
public static void valid(final Event e) { final MessageBoxControler msgBox = Xulor.getInstance() .msgBox( WakfuTranslator.getInstance().getString("setItemElements.question"), WakfuMessageBoxConstants.getMessageBoxIconUrl(0), 2073L, 102, 1); msgBox.addEventListener( new MessageBoxEventListener() { @Override public void messageBoxClosed(final int type, final String userEntry) { if (type == 8) { final SelectItemElementsView elementsView = SelectItemElementsView.INSTANCE; final Item item = elementsView.getConcernedItem(); final SetItemElementsRequestMessage netMsg = new SetItemElementsRequestMessage(); netMsg.setItemUid(item.getUniqueId()); netMsg.setDamageElementMask( elementsView.getElementMask(SelectItemElementsView.DAMAGE_ACTION_ID)); netMsg.setResElementMask( elementsView.getElementMask(SelectItemElementsView.RES_ACTION_ID)); WakfuGameEntity.getInstance().getNetworkEntity().sendMessage(netMsg); WakfuGameEntity.getInstance().removeFrame(UISelectItemElementsFrame.getInstance()); } } }); }
private void askToCloseRequest() { if (this.m_isRunning) { final MessageBoxData data = new MessageBoxData( 102, 0, WakfuTranslator.getInstance().getString("contactModerator.suretoclose"), 24L); final MessageBoxControler controler = Xulor.getInstance().msgBox(data); controler.addEventListener( new MessageBoxEventListener() { @Override public void messageBoxClosed(final int type, final String userEntry) { if (type == 8) { WakfuGameEntity.getInstance().removeFrame(UIModeratorChatFrame.this); } } }); } else { WakfuGameEntity.getInstance().removeFrame(this); } }
@Override public boolean run(final Message message) { final MessageBoxControler controler = Xulor.getInstance() .msgBox(WakfuTranslator.getInstance().getString("guild.leave.validate"), 6L, 102, 3); controler.addEventListener( new MessageBoxEventListener() { @Override public void messageBoxClosed(final int type, final String userEntry) { if (type != 2) { return; } final LocalPlayerCharacter localPlayer = WakfuGameEntity.getInstance().getLocalPlayer(); WakfuGuildView.getInstance().requestRemoveById(localPlayer.getId()); WakfuGameEntity.getInstance().removeFrame(UIGuildManagementFrame.getInstance()); } }); return false; }
@Override public void onCloseEvent() { if (SWFWrapper.INSTANCE.isOpened()) { SWFWrapper.INSTANCE.unload(); return; } final MessageBoxControler messageBoxControler = Xulor.getInstance() .msgBox( WakfuTranslator.getInstance().getString("question.quit"), WakfuMessageBoxConstants.getMessageBoxIconUrl(0), 2073L, 102, 1); messageBoxControler.addEventListener( new MessageBoxEventListener() { @Override public void messageBoxClosed(final int type, final String userEntry) { if (type == 8) { WakfuApplicationUI.this.onCloseEvent(); } } }); }