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 void onCreation(final ChatViewManager manager) { final int idPrivate = ChatWindowManager.getInstance().getModeratorWindowId(); final GameDateConst tmp = BaseGameDateProvider.INSTANCE.getDate(); final String time = "[" + tmp.getHours() + ':' + tmp.getMinutes() + "] "; final TextWidgetFormater msg = new TextWidgetFormater(); msg.openText(); msg.addColor(new Color(0.84f, 0.27f, 0.29f, 1.0f)); msg.append(time); msg.b().u(); msg.addId("characterName_" + this.m_sourceId); msg.append(this.m_sourceName); msg._u()._b(); msg.append(WakfuTranslator.getInstance().getString("colon")).append(this.m_message); msg.closeText(); final ChatMessage chatMessage = new ChatMessage(msg.finishAndToString()); chatMessage.setPipeDestination(3); chatMessage.setWindowId(idPrivate); ChatManager.getInstance().pushMessage(chatMessage); }
@Override public boolean onMessage(final Message message) { switch (message.getId()) { case 19070: { this.askToCloseRequest(); return false; } case 19071: { final AbstractUIMessage msg = (AbstractUIMessage) message; final byte closedReason = msg.getByteValue(); final int idPrivate = ChatWindowManager.getInstance().getModeratorWindowId(); String translatorKey = "contactModerator.closed"; switch (closedReason) { case 4: { translatorKey = "contactModerator.closed"; break; } case 5: { translatorKey = "contactModerator.disconnected"; break; } } final ChatMessage chatMessage = new ChatMessage(WakfuTranslator.getInstance().getString(translatorKey)); chatMessage.setPipeDestination(3); chatMessage.setWindowId(idPrivate); ChatManager.getInstance().pushMessage(chatMessage); return this.m_isRunning = false; } default: { return true; } } }