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; }
MkWindowBaseNode* MkWindowFactory::CreateButtonTypeNode(const MkHashStr& name, MkWindowThemeData::eComponentType componentType, const MkStr& message) const { MkWindowBaseNode* node = NULL; const MkWindowThemeFormData* formData = MK_STATIC_RES.GetWindowThemeSet().GetFormData(m_ThemeName, componentType, MkHashStr::EMPTY); if ((formData != NULL) && formData->IsButtonFormType()) { // btn node node = CreateComponentNode(name, componentType); if (node != NULL) { // tag MkFloat2 textRegion; MkWindowTagNode* tagNode = CreateTextTagNode(OneAndOnlyTagName, message, textRegion); if (tagNode != NULL) { node->AttachChildNode(tagNode); tagNode->SetAlignmentPosition(eRAP_MiddleCenter); } // client size MkFloat2 clientSize = m_MinClientSizeForButton; clientSize.CompareAndKeepMax(textRegion); // btn 크기가 text 영역을 포괄하도록 갱신 node->SetClientSize(clientSize); } } return node; }
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; }
MkWindowBaseNode* MkSystemWindow::_CreateDefaultComponent(const MkHashStr& name, MkWindowThemeData::eComponentType componentType) { MkWindowBaseNode* node = MkWindowBaseNode::CreateChildNode(NULL, name); if (node != NULL) { node->SetThemeName(MkWindowThemeData::DefaultThemeName); node->SetComponentType(componentType); node->SetFormState(MkWindowThemeFormData::eS_Default); node->SetLocalDepth(-1.f); // 자동으로 1.f만큼 앞에 위치시킴 } return node; }
void MkWindowBaseNode::_StartCursorReport(ePA_SceneNodeEvent evt, const MkInt2& position) { // report MkFloat2 worldPos(static_cast<float>(position.x), static_cast<float>(position.y)); MkFloat2 localPos = worldPos - GetWorldPosition(); MkDataNode arg; arg.CreateUnit(MkWindowBaseNode::ArgKey_CursorLocalPosition, MkVec2(localPos.x, localPos.y)); arg.CreateUnit(MkWindowBaseNode::ArgKey_CursorWorldPosition, MkVec2(worldPos.x, worldPos.y)); StartNodeReportTypeEvent(evt, &arg); // call back if (!m_CallBackTargetWindowPath.Empty()) { do { MkSceneNode* mgrNode = FindNearestDerivedNode(ePA_SNT_WindowManagerNode); // 소속 window mananger if (mgrNode == NULL) break; MkSceneNode* targetNode = mgrNode->GetChildNode(m_CallBackTargetWindowPath); // call back을 호출 할 node if ((targetNode == NULL) || (!targetNode->IsDerivedFrom(ePA_SNT_WindowBaseNode))) break; MkWindowBaseNode* winBase = dynamic_cast<MkWindowBaseNode*>(targetNode); if (winBase == NULL) break; MkArray<MkHashStr> myPath; GetWindowPath(myPath); winBase->CallBackOperation(evt, &arg, myPath); return; } while (false); m_CallBackTargetWindowPath.Clear(); // 부정 경로. 초기화 } }
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; }