bool GamePageAppLobby::SetUp(MkDataNode& sharingNode) { if (!GamePageBase::SetUp(sharingNode)) return false; m_RootSceneNode->SetLocalDepth(10.f); // window factory MkWindowFactory winFactory; winFactory.SetFrameType(MkWindowThemeData::eFT_Large); winFactory.SetMinClientSizeForButton(MkFloat2(200.f, 50.f)); // window mgr GPAppLobbyWinMgr* winMgrNode = new GPAppLobbyWinMgr(L"WinMgr"); if (winMgrNode != NULL) { m_RootSceneNode->AttachChildNode(winMgrNode); // battle MkWindowBaseNode* battleBtn = winFactory.CreateNormalButtonNode(BattleBtnName, L"ÀüÅõ »ùÇÃ"); if (winMgrNode->AttachWindow(battleBtn)) { winMgrNode->ActivateWindow(battleBtn->GetNodeName()); battleBtn->SetLocalPosition(MkFloat2(600.f, 300.f)); } } return true; }
bool GamePageAppBriefingRoom::SetUp(MkDataNode& sharingNode) { if (!GamePageBase::SetUp(sharingNode)) return false; m_RootSceneNode->SetLocalDepth(10.f); MkFloat2 screenSize = MkFloat2(static_cast<float>(MK_DEVICE_MGR.GetCurrentResolution().x), static_cast<float>(MK_DEVICE_MGR.GetCurrentResolution().y)); // window factory MkWindowFactory winFactory; winFactory.SetFrameType(MkWindowThemeData::eFT_Large); winFactory.SetMinClientSizeForButton(MkFloat2(200.f, 50.f)); // window mgr GPAppBriefingRoomWinMgr* winMgrNode = new GPAppBriefingRoomWinMgr(L"WinMgr"); if (winMgrNode != NULL) { m_RootSceneNode->AttachChildNode(winMgrNode); // battle MkWindowBaseNode* battleBtn = winFactory.CreateNormalButtonNode(BattleBtnName, L"ÀüÅõ ½ÃÀÛ"); if (winMgrNode->AttachWindow(battleBtn)) { winMgrNode->ActivateWindow(battleBtn->GetNodeName()); MkFloat2 pos; pos.x = screenSize.x - winFactory.GetMinClientSizeForButton().x - 30.f; pos.y = 20.f; battleBtn->SetLocalPosition(pos); } } return true; }
MkTitleBarControlNode* MkWindowFactory::_CreateMessageBox (const MkHashStr& name, const MkStr& titleStr, const MkArray<MkHashStr>& titleTextName, const MkStr& descStr, const MkArray<MkHashStr>& descTextName, MkWindowBaseNode* callBackWindow, eMsgBoxType boxType, eMsgBoxButton btnType) const { // icon type MkWindowThemeData::eIconType iconType = MkWindowThemeData::eIT_None; MkWindowThemeData::eComponentType bodyType = MkWindowThemeData::eCT_None; switch (boxType) { case eMBT_Default: iconType = MkWindowThemeData::eIT_Default; bodyType = MkWindowThemeData::eCT_DefaultBox; break; case eMBT_Notice: iconType = MkWindowThemeData::eIT_Notice; bodyType = MkWindowThemeData::eCT_DefaultBox; break; case eMBT_Information: iconType = MkWindowThemeData::eIT_Information; bodyType = MkWindowThemeData::eCT_DefaultBox; break; case eMBT_Warning: iconType = MkWindowThemeData::eIT_Warning; bodyType = MkWindowThemeData::eCT_NoticeBox; break; case eMBT_EditMode: iconType = MkWindowThemeData::eIT_EditMode; bodyType = MkWindowThemeData::eCT_DefaultBox; break; } if ((iconType == MkWindowThemeData::eIT_None) || (bodyType == MkWindowThemeData::eCT_None)) return NULL; // create title MkTitleBarControlNode* titleNode = MkTitleBarControlNode::CreateChildNode(NULL, name); if (titleNode != NULL) { do { titleNode->SetTitleBar(m_ThemeName, m_FrameType, 10.f, (btnType == eMBB_None)); // length는 의미 없음. 이후 body frame에서 재설정 할 것임 titleNode->SetIcon(iconType); if (titleTextName.Empty()) { titleNode->SetCaption(titleStr); } else { titleNode->SetCaption(titleTextName); } // create body frame MkBodyFrameControlNode* bodyFrame = MkBodyFrameControlNode::CreateChildNode(titleNode, BodyFrameName); if (bodyFrame == NULL) break; // body frame dispositioner MkWindowDispositioner windowDispositioner; windowDispositioner.SetMargin(MkFloat2(8.f, 8.f)); // border windowDispositioner.AddNewLine(); // title에 해당하는 빈 영역 windowDispositioner.AddDummyToCurrentLine(titleNode->CalculateWindowSize()); // create text tag MkFloat2 textRegion; MkWindowTagNode* tagNode = descTextName.Empty() ? CreateTextTagNode(OneAndOnlyTagName, descStr, textRegion) : CreateTextTagNode(OneAndOnlyTagName, descTextName, textRegion); if (tagNode == NULL) break; bodyFrame->AttachChildNode(tagNode); windowDispositioner.AddNewLine(MkWindowDispositioner::eLHA_Center); // text tag는 중앙 정렬 windowDispositioner.AddRectToCurrentLine(OneAndOnlyTagName, textRegion); // call back target path MkArray<MkHashStr> callbackTarget; if (callBackWindow != NULL) { callBackWindow->GetWindowPath(callbackTarget); } MkWindowBaseNode* okBtn = NULL; MkWindowBaseNode* cancelBtn = NULL; if (btnType != eMBB_None) { // create ok btn okBtn = CreateOkButtonNode(); if (okBtn == NULL) break; bodyFrame->AttachChildNode(okBtn); if (!callbackTarget.Empty()) { okBtn->SetCallBackTargetWindowPath(callbackTarget); } windowDispositioner.AddNewLine(MkWindowDispositioner::eLHA_Center); // button set도 중앙 정렬 windowDispositioner.AddRectToCurrentLine(okBtn->GetNodeName(), okBtn->CalculateWindowSize()); // create cancel btn if (btnType == eMBB_OkCancel) { cancelBtn = CreateCancelButtonNode(); if (cancelBtn == NULL) break; bodyFrame->AttachChildNode(cancelBtn); if (!callbackTarget.Empty()) { cancelBtn->SetCallBackTargetWindowPath(callbackTarget); } windowDispositioner.AddRectToCurrentLine(cancelBtn->GetNodeName(), cancelBtn->CalculateWindowSize()); } } // dispositioner 계산 windowDispositioner.Calculate(); // body frame size MkFloat2 clientSize = windowDispositioner.GetRegion(); //clientSize += MkFloat2(10.f, 10.f); // border bodyFrame->SetBodyFrame(m_ThemeName, bodyType, true, MkBodyFrameControlNode::eHT_IncludeParentAtTop, clientSize); // 하위 node 위치 반영 windowDispositioner.ApplyPositionToNode(tagNode); windowDispositioner.ApplyPositionToNode(okBtn); windowDispositioner.ApplyPositionToNode(cancelBtn); return titleNode; } while (false); MK_DELETE(titleNode); } return NULL; }