void ZMeshViewList::RecalcBounds(void) { MRECT r = GetClientRect(); //m_pLeft->SetBounds(r.x, r.y, LEFTRIGHT_WIDTH, r.h); //m_pRight->SetBounds(r.x+r.w-LEFTRIGHT_WIDTH, r.y, LEFTRIGHT_WIDTH, r.h); m_pBmLeft->SetBounds(r.x, r.y, LEFTRIGHT_WIDTH, r.h); m_pBmRight->SetBounds(r.x+r.w-LEFTRIGHT_WIDTH, r.y, LEFTRIGHT_WIDTH, r.h); int nVisibleCount = GetVisibleCount(); int nItemWidth = GetItemWidth(); int nItemCount = GetItemCount(); if(m_nItemStartIndex+nVisibleCount>nItemCount) { m_nItemStartIndex = nItemCount - nVisibleCount; if(m_nItemStartIndex<0) m_nItemStartIndex = 0; } int nCount = GetItemCount(); if(m_nItemStartIndex>0) m_pBmLeft->Enable(true); else m_pBmLeft->Enable(false); //if(m_nItemStartIndex+nVisibleCount<nCount) m_pRight->Enable(true); //else m_pRight->Enable(false); if(m_nItemStartIndex+nVisibleCount<nCount) m_pBmRight->Enable(true); else m_pBmRight->Enable(false); for(int i=0; i<nCount; i++) { MWidget* pChild = GetItem(i); pChild->SetBounds(r.x+LEFTRIGHT_WIDTH+(i-m_nItemStartIndex)*nItemWidth, r.y, nItemWidth, r.h); if(i-m_nItemStartIndex<0 || i-m_nItemStartIndex>=nVisibleCount) pChild->Show(false); else pChild->Show(true); } }
void MScenePrivate::onDisplayChangeEvent(MOnDisplayChangeEvent *event) { Q_Q(MScene); if (event->state() == MOnDisplayChangeEvent::FullyOnDisplay || event->state() == MOnDisplayChangeEvent::FullyOffDisplay) { // Simple cases. Just forward the event as it is. sendEventToMWidgets(filterMWidgets(q->items()), event); return; } QList<MWidget *> fullyOnWidgets; QList<MWidget *> partiallyOnWidgets; QList<MWidget *> fullyOffWidgets; QList<MWidget *> intersectingWidgets = filterMWidgets(q->items(event->viewRect(), Qt::IntersectsItemBoundingRect)); QList<MWidget *> allWidgets = filterMWidgets(q->items()); // Find who is fully on, partially on and fully off QSet<MWidget *> fullyOffWidgetsSet = allWidgets.toSet().subtract(intersectingWidgets.toSet()); fullyOffWidgets = fullyOffWidgetsSet.toList(); int intersectingWidgetsCount = intersectingWidgets.count(); MWidget *widget; for (int i = 0; i < intersectingWidgetsCount; i++) { widget = intersectingWidgets.at(i); if (event->viewRect().contains(widget->sceneBoundingRect())) { fullyOnWidgets << widget; } else { partiallyOnWidgets << widget; } } // Send the events to the corresponding MWidgets if (fullyOnWidgets.count() > 0) { MOnDisplayChangeEvent fullyOnEvent(MOnDisplayChangeEvent::FullyOnDisplay, event->viewRect()); sendEventToMWidgets(fullyOnWidgets, &fullyOnEvent); } if (fullyOffWidgets.count() > 0) { MOnDisplayChangeEvent fullyOffEvent(MOnDisplayChangeEvent::FullyOffDisplay, event->viewRect()); sendEventToMWidgets(fullyOffWidgets, &fullyOffEvent); } if (partiallyOnWidgets.count() > 0) { MOnDisplayChangeEvent partiallyOnEvent(MOnDisplayChangeEvent::PartiallyOnDisplay, event->viewRect()); sendEventToMWidgets(partiallyOnWidgets, &partiallyOnEvent); } }
void ZGameClient::OnClanAskJoinAgreement(const char* szClanName, MUID& uidClanAdmin, const char* szClanAdmin) { // 받을수 없는 상황이면 무시 if(!ZGetGameInterface()->IsReadyToPropose()) return; m_uidRequestPlayer = uidClanAdmin; ZIDLResource* pResource = ZApplication::GetGameInterface()->GetIDLResource(); MTextArea* pTextEdit = (MTextArea*)pResource->FindWidget("ClanJoinerAgreementConfirm_Textarea"); if (pTextEdit) { char szTemp[256]; // ZTransMsg(szTemp, MSG_CLAN_JOINER_AGREEMENT_LABEL, 1, szClanName); ZTransMsg(szTemp, MSG_CLAN_JOINER_AGREEMENT_LABEL, 1, szClanName); pTextEdit->SetText(szTemp); } MWidget* pWidget = pResource->FindWidget("ClanJoinerAgreementConfirm"); if(pWidget!=NULL) { static ZCOUNTDOWN countDown = {30,"ClanJoinerAgreementConfirm_Remain", "ClanJoinerAgreementConfirm",OnClanAskJoinAgreement_OnExpire}; countDown.nSeconds=30; // static 이므로 재설정 ZApplication::GetTimer()->SetTimerEvent(0, &OnTimer_CountDown, &countDown, true); pWidget->Show(true, true); } }
void Ut_MWidget::testShowHidePropagation() { QGraphicsScene scene; QGraphicsView view(&scene); view.resize(500, 500); view.show(); MWidget* topLevel = new MWidget; MLayout *layout = new MLayout(topLevel); MLinearLayoutPolicy *policy = new MLinearLayoutPolicy(layout, Qt::Vertical); policy->addItem(widget); scene.addItem(topLevel); topLevel->setGeometry(10, 10, 50, 50); topLevel->hide(); m_dummySlotCalled = false; connect(widget, SIGNAL(displayEntered()), this, SLOT(dummySlot())); topLevel->show(); QVERIFY(m_dummySlotCalled == true); disconnect(widget, SIGNAL(displayEntered()), this, SLOT(dummySlot())); m_dummySlotCalled = false; connect(widget, SIGNAL(displayExited()), this, SLOT(dummySlot())); topLevel->hide(); QVERIFY(m_dummySlotCalled == true); disconnect(widget, SIGNAL(displayExited()), this, SLOT(dummySlot())); }
void ShowProposalWaitFrame(bool bVisible, const char* szTitle, const char* szMessage) { ZIDLResource* pResource = ZApplication::GetGameInterface()->GetIDLResource(); MWidget* pWidget = pResource->FindWidget("ProposalAgreementWait"); if(pWidget!=NULL) { if (bVisible) { pWidget->SetText(szTitle); MTextArea* pTextArea = (MTextArea*)pResource->FindWidget("ProposalAgreementWait_Textarea"); if (pTextArea) { pTextArea->SetText(szMessage); } static ZCOUNTDOWN countDown = {PROPOSAL_AGREEMENT_TIMEOUT_SEC, "ProposalAgreementWait_Remain", "ProposalAgreementWait", ShowProposalWaitFrame_OnExpire}; countDown.nSeconds=PROPOSAL_AGREEMENT_TIMEOUT_SEC; // static 이므로 재설정 ZApplication::GetTimer()->SetTimerEvent(0, &OnTimer_CountDown, &countDown, true); pWidget->Show(true, true); } else { pWidget->Show(false); } } }
void Ut_MSettingsLanguageTextFactory::testCreateWidget() { // Create a settings text MSettingsLanguageText settingsText("TestKey", "Title"); MSettingsLanguageWidget dds; MockDataStore dataStore; MWidget *widget = MSettingsLanguageTextFactory::createWidget(settingsText, dds, &dataStore); QVERIFY(widget != NULL); // Expecting the widget to have a layout and linear policy QGraphicsLinearLayout *layout = dynamic_cast<QGraphicsLinearLayout *>(widget->layout()); QVERIFY(layout != NULL); // Expecting the layout to contain a MLabel and a MTextEdit QCOMPARE(layout->count(), 2); // The label's title should be the SettingsText's title MLabel *label = dynamic_cast<MLabel *>(layout->itemAt(0)); QVERIFY(label != NULL); QCOMPARE(label->text(), settingsText.title()); // The label's title should be the specified key's value MTextEdit *textEdit = dynamic_cast<MTextEdit *>(layout->itemAt(1)); QVERIFY(textEdit != NULL); QCOMPARE(textEdit->text(), dataStore.value("TestKey").toString()); delete widget; }
void WidgetEnableShow(const char* szWidget, bool bEnable, bool bShow) { MWidget* pWidget = GetIDLResource()->FindWidget( szWidget); if (pWidget) { pWidget->Enable(bEnable); pWidget->Show(bShow); } }
bool Mint::ProcessEvent(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam) { if(!m_pMainFrame) return false; MEvent e; int nResult = e.TranslateEvent(hwnd, message, wparam, lparam); if(nResult&EVENT_MINT_TRANSLATED){ // Drag & Drop if(m_pDragSourceObject!=NULL){ #define DRAm_VISIBLE_LENGTH 2 // µå·¡±× ¿ÀºêÁ§Æ®¸¦ º¸¿©Áֱ⠽ÃÀÛÇÏ´Â °£°Ý if(e.nMessage==MWM_MOUSEMOVE){ MPOINT p = e.Pos; //MPOINT p = MEvent::GetMousePos(); int px = m_GrabPoint.x - p.x; if ( px < 0) px *= -1; int py = m_GrabPoint.y - p.y; if ( py < 0) py *= -1; if( m_bVisibleDragObject==false && ((px > DRAm_VISIBLE_LENGTH) || (py > DRAm_VISIBLE_LENGTH))) m_bVisibleDragObject = true; MWidget* pFind = FindWidget(p); if(pFind!=NULL && pFind->IsDropable(m_pDragSourceObject)==true) m_pDropableObject = pFind; else m_pDropableObject = NULL; } if(e.nMessage==MWM_LBUTTONUP){ MPOINT p = e.Pos; MWidget* pFind = FindWidgetDropAble(p); // MWidget* pFind = FindWidget(p); if(pFind!=NULL && pFind->IsDropable(m_pDragSourceObject)==true) pFind->Drop(m_pDragSourceObject, m_pDragObjectBitmap, m_szDragObjectString, m_szDragObjectItemString); // ÇØ´ç À§Á¬¿¡ µå·Ó m_pDragSourceObject = NULL; m_pMainFrame->ReleaseCapture(); return true; } } // Àü¿ª À̺¥Æ® ó¸® if (m_fnGlobalEventCallBack) { if (m_fnGlobalEventCallBack(&e) == true) return true; } // ÀÏ¹Ý À̺¥Æ® ó¸® if(m_pMainFrame->Event(&e)==true) return true; // ¾øÀ¸¸é Accelerator ó¸® if(m_pMainFrame->EventAccelerator(&e)==true) return true; // Default Key(Enter, ESC) ó¸® if(m_pMainFrame->EventDefaultKey(&e)==true) return true; } if(nResult&EVENT_PROCESSED) return true; // ¹«Á¶°Ç ó¸®µÊ return false; }
/// 클랜가입 동의을 기다리고 있는지의 여부 bool IsWaitingClanJoiningAgree() { ZIDLResource* pResource = ZApplication::GetGameInterface()->GetIDLResource(); MWidget* pWidget = pResource->FindWidget("ClanJoinerAgreementWait"); if(pWidget!=NULL) { return pWidget->IsVisible(); } return false; }
void Ut_MListView::testPrivateCellClicked() { MListViewPrivate *d = m_subject->d_func(); MWidget *dummyWidget = new MWidget(); dummyWidget->setPos(0,0); d->cellClicked(dummyWidget); delete dummyWidget; }
/// 동의을 기다리고 있는지의 여부 - ui로 체크한다. bool IsWaitingRepliersAgreement() { ZIDLResource* pResource = ZApplication::GetGameInterface()->GetIDLResource(); MWidget* pWidget = pResource->FindWidget("ProposalAgreementWait"); if(pWidget!=NULL) { return pWidget->IsVisible(); } return false; }
// 이렇게 된 곳도 있는데 이건 왜 숨기기만 하는지 모르겠다 -_-; void WidgetHideDisable(const char* szWidget) { MWidget* pWidget = GetIDLResource()->FindWidget( szWidget); if ( pWidget) { pWidget->Show( false); pWidget->Enable( false); //pWidget->Show( true); } }
bool ZGameInput::ShowCombatInputChat() { if( ZGetCombatInterface()->IsShowUI() && !ZGetCombatInterface()->IsShowResult() ) { // UI토글이 켜져 있을때만 채팅토글을 처리해준다. ZCombatInterface* pCombatInterface = ZGetGameInterface()->GetCombatInterface(); if ((pCombatInterface) && (!pCombatInterface->IsChat()) && !ZGetGame()->IsReplay()) { MWidget* pWidget = ZGetGameInterface()->GetIDLResource()->FindWidget("112Confirm"); if (pWidget && pWidget->IsVisible()) return false; pCombatInterface->EnableInputChat(true); } } return true; }
QString AppWindow::getItem(QString title, QString prompt, QStringList items) { MWidget *centralWidget = new MWidget; QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(Qt::Vertical); centralWidget->setLayout(layout); MComboBox *combobox = new MComboBox(centralWidget); combobox->setTitle(prompt); combobox->addItems(items); layout->addItem(combobox); MDialog* dialog = new MDialog(title, M::OkButton | M::CancelButton); dialog->setCentralWidget(centralWidget); connect(dialog, SIGNAL(disappeared()), SLOT(processDialogResult())); if (dialog->exec(this) == M::OkButton) return combobox->currentText(); return ""; }
void ShowClanSponsorAgreeWaitFrame(bool bVisible) { ZIDLResource* pResource = ZApplication::GetGameInterface()->GetIDLResource(); MWidget* pWidget = pResource->FindWidget("ClanSponsorAgreementWait"); if(pWidget!=NULL) { if (bVisible) { static ZCOUNTDOWN countDown = {30,"ClanSponsorAgreementWait_Remain", "ClanSponsorAgreementWait",ShowClanSponsorAgreeWaitFrame_OnExpire}; countDown.nSeconds=30; // static 이므로 재설정 ZApplication::GetTimer()->SetTimerEvent(0, &OnTimer_CountDown, &countDown, true); pWidget->Show(true, true); } else { pWidget->Show(false); } } }
QString AppWindow::getText(QString title, QString prompt, QString text) { MWidget *centralWidget = new MWidget; QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(Qt::Vertical); centralWidget->setLayout(layout); MLabel *label = new MLabel(prompt, centralWidget); label->setStyleName("CommonTitleInverted"); MTextEdit *textEdit = new MTextEdit(MTextEditModel::SingleLine, text, centralWidget); layout->addItem(label); layout->addItem(textEdit); MDialog* dialog = new MDialog(title, M::OkButton | M::CancelButton); dialog->setCentralWidget(centralWidget); connect(dialog, SIGNAL(disappeared()), SLOT(processDialogResult())); if (dialog->exec(this) == M::OkButton) return textEdit->text(); return ""; }
void SetCountdown(const ZCOUNTDOWN& Countdown) { auto Callback = [Countdown = Countdown]() mutable { ZIDLResource* pResource = ZApplication::GetGameInterface()->GetIDLResource(); MWidget* pTargetWidget = pResource->FindWidget(Countdown.szTargetWidget); if (!pTargetWidget || !pTargetWidget->IsVisible()) return true; if (Countdown.nSeconds > 0) { if (Countdown.szLabelWidget != NULL) { ZIDLResource* pResource = ZApplication::GetGameInterface()->GetIDLResource(); MWidget* pWidget = pResource->FindWidget(Countdown.szLabelWidget); if (pWidget) { char buffer[256]; sprintf_safe(buffer, "%d", Countdown.nSeconds); pWidget->SetText(buffer); } } Countdown.nSeconds--; return false; } pTargetWidget->Show(false); if (Countdown.pCallBack) Countdown.pCallBack(); return true; }; ZApplication::GetTimer()->SetTimerEvent(1000, Callback); }
OpenDialog::OpenDialog(QGraphicsWidget*, const QString ¤tFileName) { MWidget *centralWidget = new MWidget; MLayout *layout = new MLayout(); layout->setContentsMargins(0,0,0,0); MLinearLayoutPolicy* landscapePolicy = new MLinearLayoutPolicy(layout, Qt::Vertical); MLinearLayoutPolicy* portraitPolicy = new MLinearLayoutPolicy(layout, Qt::Vertical); // m_itemSize.setWidth(100); // m_itemSize.setHeight(100); m_columnsPortrait = 4; m_columnsLandscape = 5; m_columnsLandscapeSlider = 0; m_columnsPortraitSlider = 0; list = new MList(this); list->setObjectName("list"); landscapePolicy->addItem(list); portraitPolicy->addItem(list); landscapePolicy->setContentsMargins(20, 12, 20, 0); portraitPolicy->setContentsMargins(20, 24, 20, 0); layout->setLandscapePolicy(landscapePolicy); layout->setPortraitPolicy(portraitPolicy); //int initialWidth = MApplication::activeWindow()->visibleSceneSize().width(); /* if(MApplication::activeWindow()->orientation() == M::Portrait) { list->setColumns(m_columnsPortrait); m_itemSize.setWidth(initialWidth / m_columnsPortrait); m_itemSize.setHeight(m_itemSize.width()); } else { list->setColumns(m_columnsLandscape); m_itemSize.setWidth(initialWidth / m_columnsLandscape); m_itemSize.setHeight(m_itemSize.width()); }*/ m_itemSize.setWidth(110); m_itemSize.setHeight(110); ContentItemCreator *cellCreator = new ContentItemCreator(this); list->setCellCreator(cellCreator); QStringList mediaDirs; mediaDirs << APP_CATALOG; model = new OpenDialogModel(this, m_itemSize.toSize(), mediaDirs, currentFileName); model->setObjectName("gridModel"); list->setItemModel(model); connect(list, SIGNAL(itemClicked(QModelIndex)), this, SLOT(itemClicked(QModelIndex))); connect(list, SIGNAL(panningStarted()), this, SLOT(pauseLoaders())); connect(list, SIGNAL(panningStopped()), this, SLOT(resumeLoaders())); centralWidget->setLayout(layout); this->setTitle("Choose an image"); this->setModal(true); this->setCentralWidget(centralWidget); }
void MCreateSample(void) { MWidget* pMainFrame = Mint::GetInstance()->GetMainFrame(); MWidget* pNew = new MFileDialog("*.*", pMainFrame, pMainFrame); //pNew->SetBounds(10, 10, 300, 300); pNew->Show(true); class MFrameBitmap : public MFrame{ int m_nBitmap; protected: virtual void OnDraw(MDrawContext* pDC){ MFrame::OnDraw(pDC); MRECT r = GetClientRect(); if(MBitmapManager::GetCount()==0) return; m_nBitmap %= MBitmapManager::GetCount(); pDC->SetBitmap(MBitmapManager::Get(m_nBitmap)); m_nBitmap++; pDC->Draw(r.x, r.y); //pDC->Draw(r); } public: MFrameBitmap(const char* szName=NULL, MWidget* pParent=NULL, MListener* pListener=NULL) : MFrame(szName, pParent, pListener){ m_nBitmap = 0; } virtual ~MFrameBitmap(void){ } }; MWidget* pNewFrame = new MFrameBitmap("Bitmap Test", pMainFrame, pMainFrame); pNewFrame->SetBounds(0, 20, 200, 200); pNewFrame->Show(true); class MFrameInfo : public MFrame{ int m_nRenderCount; DWORD m_nPrevTime; int m_nFPS; protected: virtual void OnDraw(MDrawContext* pDC){ MFrame::OnDraw(pDC); MRECT r = GetClientRect(); char temp[256]; pDC->SetColor(MCOLOR(255,255,255)); // FPS DWORD nCurrTime = timeGetTime(); if(nCurrTime-m_nPrevTime>1000){ m_nFPS = m_nRenderCount; m_nPrevTime = nCurrTime; m_nRenderCount = 0; } m_nRenderCount++; sprintf(temp, "FPS = %d", m_nFPS); pDC->Text(r.x, r.y, temp); // Cursor Pos /* POINT p; GetCursorPos(&p); ScreenToClient(m_hWnd, &p); */ MPOINT p = MEvent::GetMousePos(); sprintf(temp, "Cursor Pos = %d, %d", p.x, p.y); pDC->Text(r.x, r.y+GetFont()->GetHeight(), temp); } public: MFrameInfo(const char* szName=NULL, MWidget* pParent=NULL, MListener* pListener=NULL) : MFrame(szName, pParent, pListener){ m_nRenderCount = 0; m_nPrevTime = timeGetTime(); m_nFPS = 0; } virtual ~MFrameInfo(void){ } }; MWidget* pNewCursorInfo = new MFrameInfo("Á¤º¸", pMainFrame, pMainFrame); pNewCursorInfo->SetBounds(400, 0, 200, 200); pNewCursorInfo->Show(true); class MFrameStar : public MFrame{ protected: virtual void OnDraw(MDrawContext* pDC){ MFrame::OnDraw(pDC); MRECT r = GetClientRect(); int nRawSize = sizeof(szStar)/sizeof(char*); static int nRaw = 0; pDC->SetColor(MCOLOR(128,128,255)); for(int i=0; i<20; i++){ pDC->Text(r.x, r.y+i*(GetFont()->GetHeight()+2), szStar[(nRaw+i)%nRawSize]); } nRaw++; nRaw%=nRawSize; } virtual bool OnCommand(MWidget* pWidget, const char* szMessage){ /* if(pWidget->GetID()==MGetResourceID("ID_OK") && IsMsg(szMessage, MBTN_CLK_MSG)==true){ Hide(); } */ return false; } public: MFrameStar(const char* szName=NULL, MWidget* pParent=NULL, MListener* pListener=NULL) : MFrame(szName, pParent, pListener){ } virtual ~MFrameStar(void){ } }; MWidget* pNewStar = new MFrameStar("º° Çì´Â ¹ã", pMainFrame, pMainFrame); pNewStar->SetBounds(30, 250, 500, 200); pNewStar->Show(true); MPopupMenu* pNewMenu = new MPopupMenu("SampleMenu", pMainFrame, pMainFrame, MPMT_HORIZONTAL); MMenuItem* pFile = pNewMenu->AddMenuItem("File"); MMenuItem* pWidget = pNewMenu->AddMenuItem("Widget"); MPopupMenu* pFileMenu = pFile->CreateSubMenu(); MPopupMenu* pWidgetMenu = pWidget->CreateSubMenu(); pFileMenu->AddMenuItem("Open"); pFileMenu->AddMenuItem("Exit"); pWidgetMenu->AddMenuItem("Info"); pWidgetMenu->AddMenuItem("º°Çì´Â¹ã"); pNewMenu->SetBounds(0, 0, MGetWorkspaceWidth(), 16); pNewMenu->Show(0, 0, true); pNewMenu->Show(true); }
void ZGameClient::OnAskAgreement(const MUID& uidProposer, void* pMemberNamesBlob, const MMatchProposalMode nProposalMode, const int nRequestID) { // 응답할 수 없는 상황이면 바로 거절한다. if ((IsWaitingRepliersAgreement()) || (!ZGetGameInterface()->IsReadyToPropose())) { char szCharName[MATCHOBJECT_NAME_LENGTH]; sprintf(szCharName, ZGetMyInfo()->GetCharName()); ZPostReplyAgreement(uidProposer, GetPlayerUID(), szCharName, nProposalMode, nRequestID, false); return; } char szMemberNames[MAX_REPLIER][256]; // 0 번째는 제안자 int nMemberCount = MGetBlobArrayCount(pMemberNamesBlob); if (nMemberCount < 1) return; for (int i = 0; i < nMemberCount; i++) { MTD_ReplierNode* pReplierNode = (MTD_ReplierNode*)MGetBlobArrayElement(pMemberNamesBlob, i); strcpy(szMemberNames[i], pReplierNode->szName); } m_nProposalMode = nProposalMode; m_nRequestID = nRequestID; m_uidRequestPlayer = uidProposer; ZIDLResource* pResource = ZApplication::GetGameInterface()->GetIDLResource(); MTextArea* pTextEdit = (MTextArea*)pResource->FindWidget("ProposalAgreementConfirm_Textarea"); if (pTextEdit) { // 여기서 각각의 상황에 맞는 대사를 넣어줘야한다. char szTemp[256] = ""; char szMembers[256] = " ("; for (int i = 0; i < nMemberCount; i++) { strcat(szMembers, szMemberNames[i]); if (i != nMemberCount-1) strcat(szMembers, ", "); } strcat(szMembers, ")"); switch (nProposalMode) { case MPROPOSAL_LADDER_INVITE: { // ZTransMsg(szTemp, MSG_LADDER_REPLIER_AGREEMENT_LABEL, 1, szMemberNames[0]); ZTransMsg(szTemp, MSG_LADDER_REPLIER_AGREEMENT_LABEL, 1, szMemberNames[0]); strcat(szTemp, szMembers); } break; case MPROPOSAL_CLAN_INVITE: { // ZTransMsg(szTemp, MSG_CLANBATTLE_REPLIER_AGREEMENT_LABEL, 1, szMemberNames[0]); ZTransMsg(szTemp, MSG_CLANBATTLE_REPLIER_AGREEMENT_LABEL, 1, szMemberNames[0]); strcat(szTemp, szMembers); } break; }; pTextEdit->SetText(szTemp); } MWidget* pWidget = pResource->FindWidget("ProposalAgreementConfirm"); if(pWidget!=NULL) { static ZCOUNTDOWN countDown = {PROPOSAL_AGREEMENT_TIMEOUT_SEC, "ProposalAgreementConfirm_Remain", "ProposalAgreementConfirm", OnAskReplierAgreement_OnExpire}; countDown.nSeconds=PROPOSAL_AGREEMENT_TIMEOUT_SEC; // static 이므로 재설정 ZApplication::GetTimer()->SetTimerEvent(0, &OnTimer_CountDown, &countDown, true); pWidget->Show(true, true); } }
void CreateEditPage::createContent(void) { MApplicationPage::createContent(); setStyleName("CommonApplicationPage"); setPannable(false); createActions(); QGraphicsAnchorLayout *anchor = new QGraphicsAnchorLayout(); anchor->setContentsMargins(0, 0, 0, 0); anchor->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); ViewHeader *header = new ViewHeader(m_tag == TagStorage::NULL_TAG ? tr("Create tag contents") : tr("Edit tag contents")); anchor->addCornerAnchors(header, Qt::TopLeftCorner, anchor, Qt::TopLeftCorner); #ifdef LABEL_SIZE m_size = new MLabel(); m_size->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); m_size->setAlignment(Qt::AlignRight); anchor->addAnchor(m_size, Qt::AnchorBottom, anchor, Qt::AnchorBottom); anchor->addAnchor(m_size, Qt::AnchorRight, anchor, Qt::AnchorRight); #endif MWidget *layoutContainer = new MWidget(); layoutContainer->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Minimum); m_layout = new QGraphicsLinearLayout(Qt::Vertical, layoutContainer); m_layout->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Minimum); m_name = new LabeledTextEdit(tr("Ok"), LabeledTextEdit::SingleLineEditAndLabel); m_name->setLabel(tr("Tag name")); m_name->setPrompt(tr("Enter tag name")); m_name->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed); m_layout->addItem(m_name); m_layout->setAlignment(m_name, Qt::AlignLeft); connect(m_name, SIGNAL(contentsChanged(void)), this, SLOT(nameChanged(void))); MSeparator *sep = new MSeparator; sep->setStyleName("CommonHorizontalSeparator"); sep->setOrientation(Qt::Horizontal); layout()->addItem(sep); createPageSpecificContent(); MPannableViewport *view = new MPannableViewport(); view->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Minimum); view->setPanDirection(Qt::Vertical); view->setMinimumSize(100, 100); view->setWidget(layoutContainer); anchor->addAnchor(view, Qt::AnchorTop, header, Qt::AnchorBottom); #ifdef LABEL_SIZE anchor->addAnchor(view, Qt::AnchorBottom, m_size, Qt::AnchorTop); #else anchor->addAnchor(view, Qt::AnchorBottom, anchor, Qt::AnchorBottom); #endif anchor->addAnchor(view, Qt::AnchorLeft, anchor, Qt::AnchorLeft); anchor->addAnchor(view, Qt::AnchorRight, anchor, Qt::AnchorRight); centralWidget()->setLayout(anchor); if (m_tag == TagStorage::NULL_TAG) { setContentValidity(false); setNameValidity(false); setupNewData(); } else { load(); } }
void ZGameClient::OnClanResponseClanInfo(void* pBlob) { int nCount = MGetBlobArrayCount(pBlob); if(nCount != 1) return; MTD_ClanInfo* pClanInfo = (MTD_ClanInfo*)MGetBlobArrayElement(pBlob, 0); // 이미 emblem을 가지고 있었으면 emblem interface 에 통보해준다 int nOldClanID = ZGetNetRepository()->GetClanInfo()->nCLID; // repository에 클랜정보를 보관한다 memcpy(ZGetNetRepository()->GetClanInfo(),pClanInfo,sizeof(MTD_ClanInfo)); // mlog("OnClanResponseClanInfo : "); // emblem interface 에 통보한다 ZGetEmblemInterface()->AddClanInfo(pClanInfo->nCLID); if(nOldClanID!=0) { ZGetEmblemInterface()->DeleteClanInfo(nOldClanID); } ZIDLResource* pRes = ZApplication::GetGameInterface()->GetIDLResource(); MPicture* pPicture= (MPicture*)pRes->FindWidget( "Lobby_ClanInfoEmblem" ); if ( pPicture) pPicture->SetBitmap( ZGetEmblemInterface()->GetClanEmblem2( pClanInfo->nCLID)); // 클랜 이름 MLabel* pLabel = (MLabel*)pRes->FindWidget("Lobby_ClanInfoName"); pLabel->SetText(ZGetNetRepository()->GetClanInfo()->szClanName); // 접속된 사람수 char szCount[16]; sprintf(szCount,"%d",ZGetNetRepository()->GetClanInfo()->nConnedMember); char szOutput[256]; // ZTranslateMessage(szOutput,MSG_LOBBY_CLAN_DETAIL,2, // ZGetNetRepository()->GetClanInfo()->szMaster,szCount); ZTransMsg(szOutput,MSG_LOBBY_CLAN_DETAIL,2, ZGetNetRepository()->GetClanInfo()->szMaster,szCount); pLabel = (MLabel*)pRes->FindWidget("Lobby_ClanInfoDetail"); pLabel->SetText(szOutput); sprintf(szOutput,"%d/%d",ZGetNetRepository()->GetClanInfo()->nWins,ZGetNetRepository()->GetClanInfo()->nLosses); ZBmNumLabel *pNumLabel = (ZBmNumLabel*)pRes->FindWidget("Lobby_ClanInfoWinLose"); pNumLabel->SetText(szOutput); sprintf(szOutput,"%d", ZGetNetRepository()->GetClanInfo()->nPoint); pNumLabel = (ZBmNumLabel*)pRes->FindWidget("Lobby_ClanInfoPoints"); pNumLabel->SetText(szOutput); pNumLabel = (ZBmNumLabel*)pRes->FindWidget("Lobby_ClanInfoTotalPoints"); // sprintf(szOutput,"%d",ZGetNetRepository()->GetClanInfo()->nWins,ZGetNetRepository()->GetClanInfo()->nXP); // pNumLabel->SetText(szOutput); pNumLabel->SetNumber(ZGetNetRepository()->GetClanInfo()->nTotalPoint,true); int nRanking = pClanInfo->nRanking; pNumLabel = (ZBmNumLabel*)pRes->FindWidget("Lobby_ClanInfoRanking"); pNumLabel->SetIndexOffset(16); // 아래쪽 색다른 글씨로 찍는다 MWidget *pUnranked = pRes->FindWidget("Lobby_ClanInfoUnranked"); if(nRanking == 0) { pNumLabel->Show(false); if ( pUnranked) pUnranked->Show(true); }else { pNumLabel->Show(true); pNumLabel->SetNumber(nRanking); if ( pUnranked) pUnranked->Show(false); } /* // UI상에 보여줘야 하지만 지금은 준비가 안되어있는 관계로 채팅창에 뿌린다. char szText[256]; sprintf(szText, "클랜명: %s", pClanInfo->szClanName); ZChatOutput(MCOLOR(ZCOLOR_CHAT_CLANMSG), szText); sprintf(szText, "레벨: %d", pClanInfo->nLevel); ZChatOutput(MCOLOR(ZCOLOR_CHAT_CLANMSG), szText); sprintf(szText, "경험치: %d", pClanInfo->nXP); ZChatOutput(MCOLOR(ZCOLOR_CHAT_CLANMSG), szText); sprintf(szText, "포인트: %d", pClanInfo->nPoint); ZChatOutput(MCOLOR(ZCOLOR_CHAT_CLANMSG), szText); sprintf(szText, "마스터: %s", pClanInfo->szMaster); ZChatOutput(MCOLOR(ZCOLOR_CHAT_CLANMSG), szText); sprintf(szText, "전적: %d승 %d패", pClanInfo->nWins, pClanInfo->nLoses); ZChatOutput(MCOLOR(ZCOLOR_CHAT_CLANMSG), szText); sprintf(szText, "클랜원정보: 총 %d명중 %d명 접속함", pClanInfo->nTotalMemberCount, pClanInfo->nConnedMember); ZChatOutput(MCOLOR(ZCOLOR_CHAT_CLANMSG), szText); */ }
void ZGameClient::OnClanStandbyClanList(int nPrevStageCount, int nNextStageCount, void* pBlob) { int nCount = MGetBlobArrayCount(pBlob); ZIDLResource* pRes = ZApplication::GetGameInterface()->GetIDLResource(); ZClanListBox* pListBox = (ZClanListBox*)pRes->FindWidget("Lobby_ClanList"); if (!pListBox) return; pListBox->ClearAll(); vector< int > vecClanID; for(int i=0; i<nCount; i++) { MTD_StandbyClanList* pNode = (MTD_StandbyClanList*)MGetBlobArrayElement(pBlob, i); _ASSERT(i<4); pListBox->SetInfo(i,pNode->nCLID,pNode->szClanName,pNode->nPlayers); //ProcessEmblem(pNode->nCLID, pNode->nEmblemChecksum); // Emblem // 클랜 URL이 없으면 Vector에 쌓는다 if (m_EmblemMgr.CheckEmblem(pNode->nCLID, pNode->nEmblemChecksum)) { // Begin Draw } else /*if (pNode->nEmblemChecksum != 0)*/ { vecClanID.push_back( pNode->nCLID ); } } //// Emblem // 클랜 URL이 없는 vector를 서버에 보낸다. if(vecClanID.size() > 0) { void* pBlob = MMakeBlobArray(sizeof(int), (int)vecClanID.size()); /// nOneBlobSize만큼 nBlobCount갯수만큼 배열한 블럭 만들기 int nCount = 0; for(vector<int>::iterator it = vecClanID.begin(); it != vecClanID.end(); it++, nCount++) { int *nClanID = (int*)MGetBlobArrayElement(pBlob, nCount); *nClanID = *it; } ZPostRequestEmblemURL(pBlob); MEraseBlobArray(pBlob); vecClanID.clear(); } ZIDLResource* pResource = ZApplication::GetGameInterface()->GetIDLResource(); MWidget* pBtn = pResource->FindWidget("StageBeforeBtn"); if (nPrevStageCount != -1) { if (nPrevStageCount == 0) { if (pBtn) pBtn->Enable(false); } else { if (pBtn) pBtn->Enable(true); } } pBtn = pResource->FindWidget("StageAfterBtn"); if (nNextStageCount != -1) { if (nNextStageCount == 0) { if (pBtn) pBtn->Enable(false); } else { if (pBtn) pBtn->Enable(true); } } }
bool ZGameInput::OnEvent(MEvent* pEvent) { int sel = 0; if ((ZGetGameInterface()->GetState() != GUNZ_GAME)) return false; if ( ZGetGameInterface()->GetGame() == NULL ) return false; MWidget* pMenuWidget = ZGetGameInterface()->GetIDLResource()->FindWidget("CombatMenuFrame"); if ((pMenuWidget) && (pMenuWidget->IsVisible())) return false; MWidget* pChatWidget = ZGetGameInterface()->GetIDLResource()->FindWidget("CombatChatInput"); if ((pChatWidget) && (pChatWidget->IsVisible())) return false; MWidget* p112ConfirmWidget = ZGetGameInterface()->GetIDLResource()->FindWidget("112Confirm"); if (p112ConfirmWidget->IsVisible()) return false; #ifndef _PUBLISH if (m_pInstance) { if (m_pInstance->OnDebugEvent(pEvent) == true) return true; } #endif ZMyCharacter* pMyCharacter = ZGetGameInterface()->GetGame()->m_pMyCharacter; if ((!pMyCharacter) || (!pMyCharacter->GetInitialized())) return false; //////////////////////////////////////////////////////////////////////////// switch(pEvent->nMessage){ case MWM_HOTKEY: { int nKey = pEvent->nKey; ZHOTKEY *hk=ZGetConfiguration()->GetHotkey(nKey); //if(ProcessLowLevelCommand(hk->command.c_str())==false) char buffer[256]; strcpy(buffer,hk->command.c_str()); ZApplication::GetGameInterface()->GetChat()->Input(buffer); // ConsoleInputEvent(hk->command.c_str()); }break; case MWM_LBUTTONDOWN: { ZCombatInterface* pCombatInterface = ZGetGameInterface()->GetCombatInterface(); if ( ZGetCombatInterface()->IsShowResult()) { if ( ((ZGetCombatInterface()->m_nReservedOutTime - timeGetTime()) / 1000) < 13) { if(ZGetGameClient()->IsLadderGame() || ZGetGameClient()->IsDuelTournamentGame()) ZChangeGameState(GUNZ_LOBBY); else ZChangeGameState(GUNZ_STAGE); return true; } } if (pCombatInterface->IsChat()) { pCombatInterface->EnableInputChat(false); } if (pCombatInterface->GetObserver()->IsVisible()) { pCombatInterface->GetObserver()->ChangeToNextTarget(); return true; } /* if ((pMyCharacter) && (pMyCharacter->IsDie())) //// 실서비스에서 스폰안되는 버그유발. 원인불명(_PUBLISH누락) 영구봉쇄. { // 혼자테스트할때 되살아나기 if(g_pGame->m_CharacterManager.size()==1) { #ifndef _PUBLISH ZGetGameInterface()->RespawnMyCharacter(); return true; #endif } }*/ if (ZGetGameInterface()->IsCursorEnable()) return false; } return true; case MWM_RBUTTONDOWN: { if (ZGetGameInterface()->GetCombatInterface()->IsChat()) { ZGetGameInterface()->GetCombatInterface()->EnableInputChat(false); } ZCombatInterface* pCombatInterface = ZGetGameInterface()->GetCombatInterface(); if (pCombatInterface->GetObserver()->IsVisible()) { pCombatInterface->GetObserver()->NextLookMode(); } } return true; case MWM_MBUTTONDOWN: if (ZGetGameInterface()->GetCombatInterface()->IsChat()) { ZGetGameInterface()->GetCombatInterface()->EnableInputChat(false); } return true; case MWM_ACTIONRELEASED: { switch(pEvent->nKey){ case ZACTION_FORWARD: case ZACTION_BACK: case ZACTION_LEFT: case ZACTION_RIGHT: if (m_pInstance) m_pInstance->m_ActionKeyHistory.push_back(ZACTIONKEYITEM(ZGetGame()->GetTime(),false,pEvent->nKey)); return true; case ZACTION_DEFENCE: { if(ZGetGame()->m_pMyCharacter) ZGetGame()->m_pMyCharacter->m_statusFlags.Ref().m_bGuardKey = false; } return true; } }break; case MWM_ACTIONPRESSED: if ( !ZGetGame()->IsReservedSuicide()) // 자살 예정인 경우 대쉬를 할수없게 막는다 { switch(pEvent->nKey){ case ZACTION_FORWARD: case ZACTION_BACK: case ZACTION_LEFT: case ZACTION_RIGHT: case ZACTION_JUMP: if (m_pInstance) m_pInstance->m_ActionKeyHistory.push_back(ZACTIONKEYITEM(ZGetGame()->GetTime(),true,pEvent->nKey)); return true; case ZACTION_MELEE_WEAPON: { if ( !ZGetGame()->IsReplay()) ZGetGameInterface()->ChangeWeapon(ZCWT_MELEE); } return true; case ZACTION_PRIMARY_WEAPON: { if ( !ZGetGame()->IsReplay()) ZGetGameInterface()->ChangeWeapon(ZCWT_PRIMARY); } return true; case ZACTION_SECONDARY_WEAPON: { if ( !ZGetGame()->IsReplay()) ZGetGameInterface()->ChangeWeapon(ZCWT_SECONDARY); } return true; case ZACTION_ITEM1: case ZACTION_ITEM2: { int nIndex = pEvent->nKey - ZACTION_ITEM1 + ZCWT_CUSTOM1; if ( !ZGetGame()->IsReplay()) { ZGetGameInterface()->ChangeWeapon(ZChangeWeaponType(nIndex)); } } return true; case ZACTION_COMMUNITYITEM1: mlog("Community Item1 Selected!\n"); return true; case ZACTION_COMMUNITYITEM2: mlog("Community Item2 Selected!\n"); return true; case ZACTION_PREV_WEAPON: { if ( !ZGetGame()->IsReplay()) ZGetGameInterface()->ChangeWeapon(ZCWT_PREV); } return true; case ZACTION_NEXT_WEAPON: { if ( !ZGetGame()->IsReplay()) ZGetGameInterface()->ChangeWeapon(ZCWT_NEXT); } return true; case ZACTION_RELOAD: { if ( !ZGetGame()->IsReplay()) ZGetGameInterface()->Reload(); } return true; case ZACTION_DEFENCE: { if ( ZGetGame()->m_pMyCharacter && !ZGetGame()->IsReplay()) ZGetGame()->m_pMyCharacter->m_statusFlags.Ref().m_bGuardKey = true; } return true; case ZACTION_TAUNT: // 틸다키 case ZACTION_BOW: case ZACTION_WAVE: case ZACTION_LAUGH: case ZACTION_CRY: case ZACTION_DANCE: { if ( ZGetGame()->IsReplay()) break; if ( MEvent::GetShiftState()) break; if(ZGetGameInterface()->GetCombatInterface()->GetObserverMode()) break; ZC_SPMOTION_TYPE mtype; if(pEvent->nKey == ZACTION_TAUNT) mtype = ZC_SPMOTION_TAUNT; else if(pEvent->nKey == ZACTION_BOW ) mtype = ZC_SPMOTION_BOW; else if(pEvent->nKey == ZACTION_WAVE ) mtype = ZC_SPMOTION_WAVE; else if(pEvent->nKey == ZACTION_LAUGH) mtype = ZC_SPMOTION_LAUGH; else if(pEvent->nKey == ZACTION_CRY ) mtype = ZC_SPMOTION_CRY; else if(pEvent->nKey == ZACTION_DANCE) mtype = ZC_SPMOTION_DANCE; else return true; if(ZGetGame()) ZGetGame()->PostSpMotion( mtype ); // ZPostSpMotion(mtype); } return true; case ZACTION_RECORD: { if ( ZGetGame() && !ZGetGame()->IsReplay()) ZGetGame()->ToggleRecording(); } return true; case ZACTION_MOVING_PICTURE: { // 동영상 캡쳐...2008.10.02 if (ZGetGameInterface()->GetBandiCapturer() != NULL) ZGetGameInterface()->GetBandiCapturer()->ToggleStart(); } return true; case ZACTION_TOGGLE_CHAT: { if(ZGetCombatInterface()->IsShowUI()) { // UI토글이 켜져 있을때만 채팅토글을 처리해준다. if (ZGetGame()) { ZCombatInterface* pCombatInterface = ZGetGameInterface()->GetCombatInterface(); ZGetSoundEngine()->PlaySound("if_error"); pCombatInterface->ShowChatOutput(!ZGetConfiguration()->GetViewGameChat()); } } } return true; case ZACTION_USE_WEAPON: case ZACTION_USE_WEAPON2: { return true; } case ZACTION_SENSITIVITY_INC: case ZACTION_SENSITIVITY_DEC: { int nPrev = ZGetConfiguration()->GetMouseSensitivityInInt(); float senstivity = Z_MOUSE_SENSITIVITY; if (pEvent->nKey == ZACTION_SENSITIVITY_INC) senstivity += 0.01f; else senstivity -= 0.01f; ZGetConfiguration()->SetMouseSensitivityInFloat(senstivity); int nNew = ZGetConfiguration()->GetMouseSensitivityInInt(); ZGetConfiguration()->ReserveSave(); ZChatOutputMouseSensitivityChanged(nPrev, nNew); return true; } } // switch } break; case MWM_KEYDOWN: { ZCombatInterface* pCombatInterface = ZGetGameInterface()->GetCombatInterface(); switch (pEvent->nKey) { case VK_F1: case VK_F2: case VK_F3: case VK_F4: case VK_F5: case VK_F6: case VK_F7: case VK_F8: if( pEvent->nKey == VK_F1 ) sel = 0; else if( pEvent->nKey == VK_F2 ) sel = 1; else if( pEvent->nKey == VK_F3 ) sel = 2; else if( pEvent->nKey == VK_F4 ) sel = 3; else if( pEvent->nKey == VK_F5 ) sel = 4; else if( pEvent->nKey == VK_F6 ) sel = 5; else if( pEvent->nKey == VK_F7 ) sel = 6; else if( pEvent->nKey == VK_F8 ) sel = 7; if(ZGetConfiguration()) { char* str = ZGetConfiguration()->GetMacro()->GetString( sel ); if(str) { if(ZApplication::GetGameInterface()) if(ZApplication::GetGameInterface()->GetChat()) ZApplication::GetGameInterface()->GetChat()->Input(str); } } return true; case VK_F9: if (ZIsLaunchDevelop()) { ZApplication::GetGameInterface()->GetScreenDebugger()->SwitchDebugInfo(); } else { // 애들이 어떻게 알고서 쓰길래 막음... -_-; // if (pEvent->bCtrl) // ZApplication::GetGameInterface()->GetScreenDebugger()->SwitchDebugInfo(); } return true; case VK_RETURN: case VK_OEM_2: { if (!ShowCombatInputChat()) return false; } return true; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': case 'Y': case 'N': if (pCombatInterface->GetObserver()->IsVisible()) pCombatInterface->GetObserver()->OnKeyEvent(pEvent->bCtrl, pEvent->nKey); if (ZGetGameClient()->CanVote() || ZGetGameInterface()->GetCombatInterface()->GetVoteInterface()->GetShowTargetList() ) { ZGetGameInterface()->GetCombatInterface()->GetVoteInterface()->VoteInput(pEvent->nKey); } break; case VK_ESCAPE: // 메뉴를 부르거나 kick player를 취소한다 if (ZGetGameInterface()->GetCombatInterface()->GetVoteInterface()->GetShowTargetList()) { ZGetGameInterface()->GetCombatInterface()->GetVoteInterface()->CancelVote(); } else { ZGetGameInterface()->ShowMenu(!ZGetGameInterface()->IsMenuVisible()); ZGetGameInterface()->Show112Dialog(false); } return true; case 'M' : if ( ZGetGame()->IsReplay() && pCombatInterface->GetObserver()->IsVisible()) { if(ZGetGameInterface()->GetCamera()->GetLookMode()==ZCAMERA_FREELOOK) ZGetGameInterface()->GetCamera()->SetLookMode(ZCAMERA_MINIMAP); else ZGetGameInterface()->GetCamera()->SetLookMode(ZCAMERA_FREELOOK); } break; case 'T' : if(ZGetGame()->m_pMyCharacter->GetTeamID()==MMT_SPECTATOR && ZGetGame()->GetMatch()->IsTeamPlay() && pCombatInterface->GetObserver()->IsVisible()) { ZObserver *pObserver = pCombatInterface->GetObserver(); pObserver->SetType(pObserver->GetType()==ZOM_BLUE ? ZOM_RED : ZOM_BLUE); pObserver->ChangeToNextTarget(); } case 'H': if ( ZGetGame()->IsReplay() && pCombatInterface->GetObserver()->IsVisible()) { if ( ZGetGame()->IsShowReplayInfo()) ZGetGame()->ShowReplayInfo( false); else ZGetGame()->ShowReplayInfo( true); } break; case 'J': { #ifdef _CMD_PROFILE if ((pEvent->bCtrl) && (ZIsLaunchDevelop())) { #ifndef _PUBLISH ZGetGameClient()->m_CommandProfiler.Analysis(); #endif } #endif } break; #ifdef _DEBUG case 'K': { rvector pos = ZGetGame()->m_pMyCharacter->GetPosition(); pos.x+=1; ZGetGame()->m_pMyCharacter->SetPosition(pos); } break; case 'L': { rvector pos = ZGetGame()->m_pMyCharacter->GetPosition(); pos.x-=1; ZGetGame()->m_pMyCharacter->SetPosition(pos); } break; //case 'J': // { // ZGetGame()->m_pMyCharacter->GetPosition().z = ZGetGame()->m_pMyCharacter->GetPosition().z+1; // } // break; //case 'M': // { // ZGetGame()->m_pMyCharacter->GetPosition().z = ZGetGame()->m_pMyCharacter->GetPosition().z-1; // } // break; case 'U': { rvector pos = ZGetGame()->m_pMyCharacter->GetPosition(); pos.x = -3809; pos.y = -1330; pos.z = 100; ZGetGame()->m_pMyCharacter->SetPosition(pos); //ZGetGame()->m_pMyCharacter->GetPosition().x = -3809; //ZGetGame()->m_pMyCharacter->GetPosition().y = -1337.5; //ZGetGame()->m_pMyCharacter->GetPosition().z = 461; } break; #endif } } break; case MWM_CHAR: { ZMatch* pMatch = ZGetGame()->GetMatch(); if (pMatch->IsTeamPlay()) { switch(pEvent->nKey) { case '\'': case '\"': { ZCombatInterface* pCombatInterface = ZGetGameInterface()->GetCombatInterface(); pCombatInterface->EnableInputChat(true, true); } return true; }; } // for deutsch, spanish keyboard if (pEvent->nKey == '/') { if (!ShowCombatInputChat()) return false; } } break; case MWM_SYSKEYDOWN: { // alt+a ~ z(65~90) if(pEvent->nKey==90){ // Alt+'Z' // 모든 UI 감추기... by kammir 20081020 ZGetCombatInterface()->SetIsShowUI(!ZGetCombatInterface()->IsShowUI()); if (ZGetGame()) { ZCombatInterface* pCombatInterface = ZGetGameInterface()->GetCombatInterface(); ZGetSoundEngine()->PlaySound("if_error"); pCombatInterface->ShowChatOutput(ZGetCombatInterface()->IsShowUI()); } } } break; case MWM_MOUSEWHEEL: { if ( ZGetGame()->IsReplay()) break; int nDelta = pEvent->nDelta; if ( (ZGetMyInfo()->IsAdminGrade() && ZGetCombatInterface()->GetObserver()->IsVisible()) || (ZGetGameInterface()->GetScreenDebugger()->IsVisible()) || (!ZGetGameInterface()->m_bViewUI)) { ZCamera* pCamera = ZGetGameInterface()->GetCamera(); pCamera->m_fDist+=-(float)nDelta; pCamera->m_fDist=max(CAMERA_DIST_MIN,pCamera->m_fDist); pCamera->m_fDist=min(CAMERA_DIST_MAX,pCamera->m_fDist); break; } // if (nDelta > 0) ZGetGameInterface()->ChangeWeapon(ZCWT_PREV); // else if (nDelta < 0) ZGetGameInterface()->ChangeWeapon(ZCWT_NEXT); }break; case MWM_MOUSEMOVE: { if(ZGetGameInterface()->IsCursorEnable()==false) { return true; } } break; } // switch (message) return false; }
void ZInterfaceBackground::Draw(void) { #ifdef _FASTDEBUG MWidget* pWidget = (MWidget*)ZApplication::GetGameInterface()->GetIDLResource()->FindWidget( "CharSelection"); if ( pWidget) { if ( ZApplication::GetGameInterface()->GetState() == GUNZ_CHARSELECTION) pWidget->Show( true); } MPicture* pPicture = (MPicture*)ZApplication::GetGameInterface()->GetIDLResource()->FindWidget( "CharSel_TopScreen"); if ( pPicture) pPicture->SetOpacity( 0); return; #endif // Set rendering state RSetViewport( 0, 0, RGetScreenWidth(), RGetScreenHeight()); RGetDevice()->SetRenderState( D3DRS_CULLMODE ,D3DCULL_CW); // from rbs rendering RGetDevice()->SetRenderState( D3DRS_NORMALIZENORMALS , TRUE ); RGetDevice()->SetSamplerState( 0, D3DSAMP_MINFILTER , D3DTEXF_LINEAR); // Texture filtering RGetDevice()->SetSamplerState( 0, D3DSAMP_MAGFILTER , D3DTEXF_LINEAR); RGetDevice()->SetSamplerState( 0, D3DSAMP_MIPFILTER , D3DTEXF_LINEAR); // Set camera position and direction rvector vCamPos, vCamDir; float fForgDensity; switch ( m_nSceneNumber) { case LOGIN_SCENE_FIXEDSKY : { // Fixed camera vCamPos = m_vCamPosSt; vCamDir = m_vCamDirSt; // Fixed fog -> black screen fForgDensity = 0.0f; break; } case LOGIN_SCENE_FALLDOWN : { // Get current clock DWORD dwClock = ( timeGetTime() - m_dwClock); /* // Show maiet logo if ( !m_bShowMaietLogo) { m_bShowMaietLogo = true; ZGetScreenEffectManager()->AddScreenEffect( "maiet_logo"); } */ // Set fog density fForgDensity = dwClock * 15.0f; // Set wait time if ( dwClock < 500) dwClock = 0; else dwClock -= 500; // Play BGM music //PenguinGuy // if ( dwClock > 2000) // ZApplication::GetSoundEngine()->PlayMusic( true); // End of scroll camera float fSeed = dwClock * 0.00035f; // 카메라가 전부 다 내려오기 까지 걸리는 시간( dwClock에 곱해주는 값이 // 작을수록 빨리 내려옴) if ( fSeed > 3.14) { m_nSceneNumber = LOGIN_SCENE_FIXEDCHAR; // m_bShowMaietLogo = false; } // Move camera position & direction float fGain = ( cos( fSeed) + 1.0f) / 2.0f; // 0 < fGain < 1.0 vCamPos = m_vCamPosEd + ( m_vCamPosSt - m_vCamPosEd) * fGain; vCamDir = m_vCamDirEd + ( m_vCamDirSt - m_vCamDirEd) * fGain; //if (m_bShowMaietLogo) //{ // ZGetScreenEffectManager()->UpdateEffects(); ZGetScreenEffectManager()->DrawEffects(); //} break; } case LOGIN_SCENE_FIXEDCHAR : { // Show menu UI MWidget* pWidget = (MWidget*)ZApplication::GetGameInterface()->GetIDLResource()->FindWidget( "CharSelection"); if ( pWidget) { if ( ZApplication::GetGameInterface()->GetState() == GUNZ_CHARSELECTION) pWidget->Show( true); } MPicture* pPicture = (MPicture*)ZApplication::GetGameInterface()->GetIDLResource()->FindWidget( "CharSel_TopScreen"); if ( pPicture) pPicture->SetOpacity( 0); // Play BGM music //PenguinGuy // ZApplication::GetSoundEngine()->PlayMusic( true); // Fixed camera vCamPos = m_vCamPosEd; vCamDir = m_vCamDirEd; #define FADE_IN_TIME 500 DWORD dwClock = ( timeGetTime() - m_dwClock); float fGain = ((float)dwClock / (float)FADE_IN_TIME); if (fGain > 1.0f) fGain = 1.0f; SetFogMulti(fGain); // Cleared fog fForgDensity = 50000.0f; break; } case LOGIN_SCENE_SELECTCHAR : { // Get current clock DWORD dwClock = ( timeGetTime() - m_dwClock); float fGain = ( cos( dwClock * 0.0012f) + 1.0f) / 2.0f; //vCamPos = m_vCamPosEd + ( m_vCamPosSt - m_vCamPosEd) * fGain; //vCamDir = m_vCamDirEd + ( m_vCamDirSt - m_vCamDirEd) * fGain; vCamPos = m_vCamPosSt; vCamDir = m_vCamDirSt; MPicture* pPicture = (MPicture*)ZApplication::GetGameInterface()->GetIDLResource()->FindWidget( "CharSel_TopScreen"); if ( pPicture) { // Set wait time if ( dwClock < 2000) dwClock = 0; else dwClock -= 2000; // Set opacity of black screen int nOpacity = (int)( dwClock / 3.0f); if ( nOpacity > 255) nOpacity = 255; pPicture->SetOpacity( nOpacity); } // Cleared fog fForgDensity = 50000.0f; break; } case LOGIN_ROAMING : { #define ROAM_SPEED 10000 DWORD dwClock = ( timeGetTime() - m_dwClock); /*if (GetAsyncKeyState(VK_NUMPAD2) & 0x8000) off.y -= 1.0f; if (GetAsyncKeyState(VK_NUMPAD8) & 0x8000) off.y += 1.0f; if (GetAsyncKeyState(VK_NUMPAD4) & 0x8000) off.x += 1.0f; if (GetAsyncKeyState(VK_NUMPAD6) & 0x8000) off.x -= 1.0f; if (GetAsyncKeyState(VK_NUMPAD7) & 0x8000) off.z -= 1.0f; if (GetAsyncKeyState(VK_NUMPAD9) & 0x8000) off.z += 1.0f; vCamPos = m_vCamPosEd + off; vCamDir = m_vCamDirEd; // Cleared fog fForgDensity = 50000.0f;*/ float fGain = ((float)dwClock / (float)ROAM_SPEED); if (fGain > 1.0f) fGain = 1.0f; //vCamDir = mapVecs[mapIndex].second - mapVecs[mapIndex].first; vCamDir = m_vCamDirEd; vCamPos = mapVecs[mapIndex].first + ((mapVecs[mapIndex].second - mapVecs[mapIndex].first) * fGain) + D3DXVECTOR3(0.f,-100.f,0.f); if (dwClock > ROAM_SPEED) { m_dwClock = timeGetTime(); mapIndex = rand() % mapVecs.size(); } //fForgDensity = 50000.0f; //Clear fForgDensity = ((-4 * fGain * fGain) + (4 * fGain)) * 20000.f; break; } } //Fog adjust fForgDensity *= m_fFogMulti; // Set camera RSetCamera( vCamPos, (vCamPos + vCamDir), rvector( 0, 0, 1)); // Draw RSetProjection( D3DX_PI * 70 / 180, RGetScreenWidth() / (float)RGetScreenHeight(), 10.0f, 15000.0f); SetFogState( fForgDensity-10000.0f, fForgDensity, 0x00000000); D3DXMatrixTranslation( &m_matWorld, 0, 0, 0); RGetDevice()->SetTransform( D3DTS_WORLD, &m_matWorld); // Draw background if ( m_pLogin) { m_pLogin->Draw(); m_pLogin->DrawObjects(); } if ( m_pMapDesc) m_pMapDesc->DrawMapDesc(); // Draw effects(smoke, cloud) // ZGetEffectManager()->Draw( timeGetTime()); // Draw maiet logo effect // ZGetScreenEffectManager()->DrawEffects(); }
void ZShopEquipInterface::SelectEquipmentFrameList( const char* szName, bool bOpen) { if (szName == NULL) { SelectEquipmentFrameList("Shop", bOpen); SelectEquipmentFrameList("Equip", bOpen); return; } char szTemp[256]; ZIDLResource* pResource = GetIDLResource(); // Frame open/close background image MPicture* pPicture; strcpy( szTemp, szName); strcat( szTemp, "_ArmorBGListFrameOpen"); pPicture = (MPicture*)pResource->FindWidget( szTemp); if(pPicture != NULL) { if( bOpen && GetArmorWeaponTabIndex() == 0 ) { pPicture->Show(true); } else { pPicture->Show(false);} } strcpy( szTemp, szName); strcat( szTemp, "_ArmorBGListFrameClose"); pPicture = (MPicture*)pResource->FindWidget( szTemp); if(pPicture != NULL) { if( !bOpen && GetArmorWeaponTabIndex() == 0 ) { pPicture->Show(true); } else { pPicture->Show(false);} } // Frame open/close background image strcpy( szTemp, szName); strcat( szTemp, "_WeaponBGListFrameOpen"); pPicture = (MPicture*)pResource->FindWidget( szTemp); if(pPicture != NULL) { if( bOpen && GetArmorWeaponTabIndex() == 1 ) { pPicture->Show(true); } else { pPicture->Show(false);} } strcpy( szTemp, szName); strcat( szTemp, "_WeaponBGListFrameClose"); pPicture = (MPicture*)pResource->FindWidget( szTemp); if(pPicture != NULL) { if( !bOpen && GetArmorWeaponTabIndex() == 1 ) { pPicture->Show(true); } else { pPicture->Show(false);} } // Frame open/close image MButton* pButton; strcpy( szTemp, szName); strcat( szTemp, "_EquipListFrameCloseButton"); pButton = (MButton*)pResource->FindWidget( szTemp); if ( pButton != NULL) pButton->Show( bOpen); strcpy( szTemp, szName); strcat( szTemp, "_EquipListFrameOpenButton"); pButton = (MButton*)pResource->FindWidget( szTemp); if ( pButton != NULL) pButton->Show( !bOpen); // Resize item slot char szWidgetName[ 256]; sprintf( szWidgetName, "%s_EquipmentSlot_Head", szName); MWidget* itemSlot = (MWidget*)pResource->FindWidget( szWidgetName); if (itemSlot) { MRECT rect = itemSlot->GetRect(); int nWidth; if ( bOpen) nWidth = 220.0f * (float)RGetScreenWidth() / 800.0f; else nWidth = min( rect.w, rect.h); for ( int i = 0; i < MMCIP_END; i++) { itemSlot = (MWidget*)pResource->FindWidget( GetItemSlotName( szName, i)); if (itemSlot) { if(GetArmorWeaponTabIndex() == GetArmorWeaponTabIndexContainItemParts((MMatchCharItemParts)i)) { rect = itemSlot->GetRect(); itemSlot->SetBounds( rect.x, rect.y, nWidth, rect.h); itemSlot->Show(true); } else { itemSlot->Show(false); } } } } // 상점과 장비창의 탭 버튼 눌림 상태를 동기화해주자 -_-; MBmButton* pTabBtn; if (GetArmorWeaponTabIndex() == 0) { pTabBtn = (MBmButton*)pResource->FindWidget("Shop_ArmorEquipmentTab"); if (pTabBtn) pTabBtn->SetCheck(true); pTabBtn = (MBmButton*)pResource->FindWidget("Equip_ArmorEquipmentTab"); if (pTabBtn) pTabBtn->SetCheck(true); } else if (GetArmorWeaponTabIndex() == 1) { pTabBtn = (MBmButton*)pResource->FindWidget("Shop_WeaponEquipmentTab"); if (pTabBtn) pTabBtn->SetCheck(true); pTabBtn = (MBmButton*)pResource->FindWidget("Equip_WeaponEquipmentTab"); if (pTabBtn) pTabBtn->SetCheck(true); } }
void ZShopEquipInterface::SelectEquipmentTab(int nTabIndex) { if (nTabIndex == -1) nTabIndex = m_nEquipTabNum; ZIDLResource* pResource = GetIDLResource(); SetKindableItem( MMIST_NONE); // Set filter MComboBox* pComboBox = (MComboBox*)pResource->FindWidget( "Equip_AllEquipmentFilter"); if(pComboBox) { int sel = pComboBox->GetSelIndex(); ZMyItemList* pil = ZGetMyInfo()->GetItemList(); if ( pil) { pil->m_ListFilter = sel; pil->Serialize(); } } // EQUIPMENTLISTBOX MWidget* pWidget = pResource->FindWidget("EquipmentList"); if (pWidget != NULL) pWidget->Show(nTabIndex==0 ? true:false); pWidget = pResource->FindWidget("AccountItemList"); if (pWidget != NULL) pWidget->Show(nTabIndex==0 ? false:true); // 탭 버튼 MButton* pButton = (MButton*)pResource->FindWidget( "Equip"); if ( pButton) { pButton->Show( false); pButton->Enable( false); } pButton = (MButton*)pResource->FindWidget( "SendAccountItemBtn"); if ( pButton) { pButton->Show( false); pButton->Enable( false); } pButton = (MButton*)pResource->FindWidget( "BringAccountItemBtn"); if ( pButton) { pButton->Show( false); pButton->Enable( false); } pButton = (MButton*)pResource->FindWidget( "BringAccountSpendableItemConfirmOpen"); if ( pButton) { pButton->Show( false); pButton->Enable( false); } if ( nTabIndex == 0) { pButton = (MButton*)pResource->FindWidget( "Equip"); if (pButton) pButton->Show(true); pButton = (MButton*)pResource->FindWidget( "SendAccountItemBtn"); if (pButton) pButton->Show(true); } else if ( nTabIndex == 1) { pButton = (MButton*)pResource->FindWidget( "BringAccountItemBtn"); if ( pButton) pButton->Show( true); pButton = (MButton*)pResource->FindWidget( "BringAccountSpendableItemConfirmOpen"); if ( pButton) pButton->Show( false); } pButton = (MButton*)pResource->FindWidget("Equipment_CharacterTab"); if (pButton) pButton->Show( nTabIndex==0 ? false : true); pButton = (MButton*)pResource->FindWidget("Equipment_AccountTab"); if (pButton) pButton->Show( nTabIndex==1 ? false : true); // 탭 라벨 MLabel* pLabel; pLabel = (MLabel*)pResource->FindWidget("Equipment_FrameTabLabel1"); if ( pLabel) pLabel->Show( nTabIndex==0 ? true : false); pLabel = (MLabel*)pResource->FindWidget("Equipment_FrameTabLabel2"); if ( pLabel) pLabel->Show( nTabIndex==1 ? true : false); // 탭 리스트 MPicture* pPicture; pPicture = (MPicture*)pResource->FindWidget("Equip_ListLabel1"); if ( pPicture) pPicture->Show( nTabIndex==0 ? true : false); pPicture = (MPicture*)pResource->FindWidget("Equip_ListLabel2"); if ( pPicture) pPicture->Show( nTabIndex==1 ? true : false); // 프레임 탭 pPicture = (MPicture*)pResource->FindWidget("Equip_TabLabel"); MBitmap* pBitmap; if ( pPicture) { if ( nTabIndex == 0) pBitmap = MBitmapManager::Get( "framepaneltab1.tga"); else pBitmap = MBitmapManager::Get( "framepaneltab2.tga"); if ( pBitmap) pPicture->SetBitmap( pBitmap); } // 중앙은행 if (nTabIndex == 1) { ZGetMyInfo()->GetItemList()->ClearAccountItems(); ZGetMyInfo()->GetItemList()->SerializeAccountItem(); } // 아이템 슬롯 Enable/Disable for(int i = 0; i < MMCIP_END; i++) { ZItemSlotView* pItemSlot = (ZItemSlotView*)GetIDLResource()->FindWidget( GetItemSlotName( "Equip", i)); if( pItemSlot ) pItemSlot->EnableDragAndDrop( nTabIndex==0 ? true : false); } m_nEquipTabNum = nTabIndex; DrawCharInfoText(); }
void ZShopEquipInterface::SelectShopTab(int nTabIndex) { if (nTabIndex == -1) nTabIndex = m_nShopTabNum; ZIDLResource* pResource = GetIDLResource(); // 프리미엄 샵 - 설정되는 국가대로 하나씩 지워나간다 #ifndef _DEBUG #if defined(LOCALE_BRAZIL) || defined(LOCALE_INDIA) || defined(LOCALE_US) || defined(LOCALE_JAPAN) || defined(LOCALE_KOREA) || defined(LOCALE_NHNUSA) { if ( nTabIndex == 2) return; } #endif #endif MWidget* pWidget = pResource->FindWidget("AllEquipmentList"); if (pWidget != NULL) pWidget->Show(nTabIndex==0 ? true : false); pWidget = pResource->FindWidget("MyAllEquipmentList"); if (pWidget != NULL) pWidget->Show(nTabIndex==1 ? true : false); pWidget = pResource->FindWidget("CashEquipmentList"); if (pWidget != NULL) pWidget->Show(nTabIndex==2 ? true : false); // Set filter MComboBox* pComboBox = (MComboBox*)pResource->FindWidget( "Shop_AllEquipmentFilter"); if(pComboBox) { int sel = pComboBox->GetSelIndex(); ZMyItemList* pil = ZGetMyInfo()->GetItemList(); if ( pil) { pil->m_ListFilter = sel; pil->Serialize(); } } // 버튼 설정 MButton* pButton = (MButton*)pResource->FindWidget( "BuyConfirmCaller"); if ( pButton) { pButton->Show( false); pButton->Enable( false); } pButton = (MButton*)pResource->FindWidget( "SellConfirmCaller"); if ( pButton) { pButton->Show( false); pButton->Enable( false); } if ( nTabIndex == 0) { pButton = (MButton*)pResource->FindWidget( "BuyConfirmCaller"); if ( pButton) pButton->Show( true); } else if ( nTabIndex == 1) { pButton = (MButton*)pResource->FindWidget( "SellConfirmCaller"); if ( pButton) pButton->Show( true); } /* 수년전 만들다만 프리미엄 탭(캐쉬템) 코드임. 제거 예정 else if ( nTabIndex == 2) { pButton = (MButton*)pResource->FindWidget( "BuyCashConfirmCaller"); if ( pButton) pButton->Show( true); } */ pButton = (MButton*)pResource->FindWidget("AllEquipmentListCaller"); if (pButton != NULL) pButton->Show(nTabIndex!=0 ? true : false); pButton = (MButton*)pResource->FindWidget("MyAllEquipmentListCaller"); if (pButton != NULL) pButton->Show(nTabIndex!=1 ? true : false); pButton = (MButton*)pResource->FindWidget("CashEquipmentListCaller"); if (pButton != NULL) pButton->Show(nTabIndex!=2 ? true : false); // 구입, 판매 라벨 MPicture* pPicture; MBitmap* pBitmap; pPicture = (MPicture*)pResource->FindWidget("Shop_FrameTabLabel1"); if ( pPicture) pPicture->Show(nTabIndex==0 ? true : false); pPicture = (MPicture*)pResource->FindWidget("Shop_FrameTabLabel2"); if ( pPicture) pPicture->Show(nTabIndex==1 ? true : false); pPicture = (MPicture*)pResource->FindWidget("Shop_FrameTabLabel3"); if ( pPicture) pPicture->Show(nTabIndex==2 ? true : false); // 프레임 탭 pPicture = (MPicture*)pResource->FindWidget("Shop_TabLabel"); if ( pPicture) { if ( nTabIndex == 0) pBitmap = MBitmapManager::Get( "framepaneltab1.tga"); else if ( nTabIndex == 1) pBitmap = MBitmapManager::Get( "framepaneltab2.tga"); else if ( nTabIndex == 2) pBitmap = MBitmapManager::Get( "framepaneltab3.tga"); if ( pBitmap) pPicture->SetBitmap( pBitmap); } // 프리미엄 샵 - 설정되는 국가대로 하나씩 지워나간다 #ifndef _DEBUG #if defined(LOCALE_BRAZIL) || defined(LOCALE_INDIA) || defined(LOCALE_US) || defined(LOCALE_JAPAN) || defined(LOCALE_KOREA) || defined(LOCALE_NHNUSA) { pWidget = pResource->FindWidget( "Shop_TabLabelBg"); if ( pWidget) pWidget->Show( false); pWidget = pResource->FindWidget( "CashEquipmentListCaller"); if ( pWidget) pWidget->Show( false); pWidget = pResource->FindWidget( "Shop_FrameTabLabel3"); if ( pWidget) pWidget->Show( false); } #endif #endif m_nShopTabNum = nTabIndex; DrawCharInfoText(); }