bool CUIChat::Load(HANDLE hFile) { if (false == CN3UIBase::Load(hFile)) return false; m_pChatOut = (CN3UIString*)GetChildByID("text0"); __ASSERT(m_pChatOut, "NULL UI Component!!"); m_pScrollbar = (CN3UIScrollBar*)GetChildByID("scroll"); __ASSERT(m_pScrollbar, "NULL UI Component!!"); m_pNoticeTitle = (CN3UIString*)GetChildByID("text_notice_title"); __ASSERT(m_pNoticeTitle, "NULL UI Component!!"); m_rcChatOutRegion = m_pChatOut->GetRegion(); CreateLines(); __ASSERT(0<m_iChatLineCount,"채팅창이 너무 작아요"); //son, chat_in m_pEdit = (CN3UIEdit*)GetChildByID("edit0"); __ASSERT(m_pEdit, "NULL UI Component!!"); m_pEdit->SetMaxString(256); // 채팅 문자열 길이 제한.. //son, chat_in m_pBtn_Normal = GetChildByID("btn_normal"); __ASSERT(m_pBtn_Normal, "NULL UI Component!!"); m_pBtn_Private = GetChildByID("btn_private"); __ASSERT(m_pBtn_Private, "NULL UI Component!!"); m_pBtn_PartyOrForce = GetChildByID("btn_party_force"); __ASSERT(m_pBtn_PartyOrForce, "NULL UI Component!!"); //m_pBtn_KnightsOrGuild = GetChildByID("btn_knights_guild"); __ASSERT(m_pBtn_KnightsOrGuild, "NULL UI Component!!"); m_pBtn_KnightsOrGuild = GetChildByID("btn_clan"); __ASSERT(m_pBtn_KnightsOrGuild, "NULL UI Component!!"); m_pBtn_Shout = GetChildByID("btn_shout"); __ASSERT(m_pBtn_Shout, "NULL UI Component!!"); m_pBtn_Check = GetChildByID("btn_check_normal"); __ASSERT(m_pBtn_Check, "NULL UI Component!!"); this->ChangeChattingMode(N3_CHAT_NORMAL); // 보통 채팅 모드이다.. return true; }
bool CUICreateClanName::Load(HANDLE hFile) { if(CN3UIBase::Load(hFile)==false) return false; m_pText_Title = (CN3UIString*)GetChildByID("Text_Message"); __ASSERT(m_pText_Title, "NULL UI Component!!"); m_pEdit_ClanName = (CN3UIEdit*)GetChildByID("Edit_Clan"); __ASSERT(m_pEdit_ClanName, "NULL UI Component!!"); return true; }
bool CUIItemExchange::Load(HANDLE hFile) { if(CN3UIBase::Load(hFile)==false) return false; m_pImage_Repair = (CN3UIImage*)GetChildByID("img_repair"); m_pImage_Exchange = (CN3UIImage*)GetChildByID("img_change"); return true; }
bool CUITradeBBSSelector::Load(HANDLE hFile) { if(CN3UIBase::Load(hFile)==false) return false; m_pBtn_BBSSell = (CN3UIButton*)GetChildByID("btn_sell"); __ASSERT(m_pBtn_BBSSell, "NULL UI Component!!");; m_pBtn_BBSBuy = (CN3UIButton*)GetChildByID("btn_buy"); __ASSERT(m_pBtn_BBSBuy, "NULL UI Component!!");; m_pBtn_BBSCancel = (CN3UIButton*)GetChildByID("btn_cancel"); __ASSERT(m_pBtn_BBSCancel, "NULL UI Component!!");; return true; }
bool CUINPCEvent::Load(HANDLE hFile) { if(CN3UIBase::Load(hFile)==false) return false; m_pBtn_Repair = (CN3UIButton*)GetChildByID("Btn_Repair"); __ASSERT(m_pBtn_Repair, "NULL UI Component!!"); m_pText_Repair = (CN3UIString*)GetChildByID("Text_Repair"); __ASSERT(m_pText_Repair, "NULL UI Component!!"); m_pText_Title = (CN3UIString*)GetChildByID("Text_Title"); __ASSERT(m_pText_Title, "NULL UI Component!!"); return true; }
bool CUIWarp::Load(HANDLE hFile) { if(CN3UIBase::Load(hFile)==false) return false; m_pBtn_Ok = (CN3UIButton*)GetChildByID("Btn_Ok"); __ASSERT(m_pBtn_Ok, "NULL UI Component!!"); m_pBtn_Cancel = (CN3UIButton*)GetChildByID("Btn_Cancel"); __ASSERT(m_pBtn_Cancel, "NULL UI Component!!"); m_pList_Infos = (CN3UIList*)GetChildByID("List_Infos"); __ASSERT(m_pList_Infos, "NULL UI Component!!"); m_pText_Agreement = (CN3UIString*)(this->GetChildByID("Text_Agreement")); __ASSERT(m_pText_Agreement, "NULL UI Component!!!"); return true; }
bool CUIPointInitDlg::Load(HANDLE hFile) { if(CN3UIBase::Load(hFile)==false) return false; m_pBtn_Ok = (CN3UIButton*)GetChildByID("btn_ok"); __ASSERT(m_pBtn_Ok, "NULL UI Component!!"); m_pBtn_Cancel = (CN3UIButton*)GetChildByID("btn_cancel"); __ASSERT(m_pBtn_Cancel, "NULL UI Component!!"); m_pText_NeedGold = (CN3UIString*)GetChildByID("string_gold"); __ASSERT(m_pText_NeedGold, "NULL UI Component!!"); return true; }
void CUIImageTooltipDlg::InitPos() { std::string str; char cstr[4]; for (int i = 0; i < MAX_TOOLTIP_COUNT; i++) { str = "string_"; sprintf(cstr, "%d", i); str += cstr; m_pStr[i] = (CN3UIString* )GetChildByID(str); __ASSERT(m_pStr[i], "NULL UI Component!!"); } m_pImg = (CN3UIImage* )GetChildByID("mins"); __ASSERT(m_pImg, "NULL UI Component!!"); }
bool CUITradeList::Load(HANDLE hFile) { if(CN3UIBase::Load(hFile)==false) return false; m_pScrollbar = (CN3UIScrollBar*)GetChildByID("scroll");// __ASSERT(m_pScrollbar, "NULL UI Component!!"); m_pStr_List[0] = (CN3UIString*)GetChildByID("string_list0");// __ASSERT(m_pStr_List[0], "NULL UI Component!!"); m_pStr_List[1] = (CN3UIString*)GetChildByID("string_list1");// __ASSERT(m_pStr_List[1], "NULL UI Component!!"); m_pStr_List[2] = (CN3UIString*)GetChildByID("string_list2");// __ASSERT(m_pStr_List[2], "NULL UI Component!!"); m_pStr_List[3] = (CN3UIString*)GetChildByID("string_list3");// __ASSERT(m_pStr_List[3], "NULL UI Component!!"); m_pStr_List[4] = (CN3UIString*)GetChildByID("string_list4");// __ASSERT(m_pStr_List[4], "NULL UI Component!!"); m_pStr_List[5] = (CN3UIString*)GetChildByID("string_list5");// __ASSERT(m_pStr_List[5], "NULL UI Component!!"); m_pStr_List[6] = (CN3UIString*)GetChildByID("string_list6");// __ASSERT(m_pStr_List[6], "NULL UI Component!!"); m_pStr_List[7] = (CN3UIString*)GetChildByID("string_list7");// __ASSERT(m_pStr_List[7], "NULL UI Component!!"); m_pStr_List[8] = (CN3UIString*)GetChildByID("string_list8");// __ASSERT(m_pStr_List[8], "NULL UI Component!!"); return true; }
void LD32::Unlock(WeaponType wt){ m_unlocks[wt] = true; if (m_scene) { auto selector = m_scene->GetUi()->GetChildByID("selector"); if (selector) { auto s = static_cast<engine::SpriteNode*>(selector->GetChildByID(weapons[wt].name)); if (s) { s->PlayAnimation("default"); } } } }
void CUIItemExchange::UpdateGoldValue() { char szGold[32]; CN3UIString* pStrGold = (CN3UIString* )GetChildByID("string_gold"); __ASSERT(pStrGold, "NULL UI Component!!"); if ( pStrGold ) { // 돈 업데이트.. sprintf(szGold, "%d", m_pTotalPrice); pStrGold->SetString(szGold); } }
bool CUILogIn::Load(HANDLE hFile) { if(CN3UIBase::Load(hFile)==false) return false; m_pGroup_LogIn = GetChildByID("Group_LogIn"); __ASSERT(m_pGroup_LogIn, "NULL UI Component!!"); if(m_pGroup_LogIn) { m_pBtn_LogIn = (CN3UIButton*)m_pGroup_LogIn->GetChildByID("Btn_Login"); __ASSERT(m_pBtn_LogIn, "NULL UI Component!!"); m_pBtn_Cancel = (CN3UIButton*)m_pGroup_LogIn->GetChildByID("Btn_Cancel"); __ASSERT(m_pBtn_Cancel, "NULL UI Component!!"); m_pBtn_Option = (CN3UIButton*)m_pGroup_LogIn->GetChildByID("Btn_Option"); __ASSERT(m_pBtn_Option, "NULL UI Component!!"); m_pEdit_id = (CN3UIEdit*)m_pGroup_LogIn->GetChildByID("Edit_ID"); __ASSERT(m_pEdit_id, "NULL UI Component!!"); m_pEdit_pw = (CN3UIEdit*)m_pGroup_LogIn->GetChildByID("Edit_PW"); __ASSERT(m_pEdit_pw, "NULL UI Component!!"); //m_pImg_GradeLogo = m_pGroup_LogIn->GetChildByID("Img_Grade"); __ASSERT(m_pImg_GradeLogo, "NULL UI Component!!"); } //m_pText_Rights = GetChildByID("Text_Rights"); __ASSERT(m_pText_Rights, "NULL UI Component!!"); m_pImg_MGameLogo = GetChildByID("Img_MGame"); __ASSERT(m_pImg_MGameLogo, "NULL UI Component!!"); m_pImg_DaumLogo = GetChildByID("Img_Daum"); __ASSERT(m_pImg_DaumLogo, "NULL UI Component!!"); if(m_pText_Rights) m_pText_Rights->SetVisible(false); if(m_pImg_MGameLogo) m_pImg_MGameLogo->SetVisible(false); if(m_pImg_DaumLogo) m_pImg_DaumLogo->SetVisible(false); m_pGroup_ServerList = GetChildByID("Group_ServerList"); __ASSERT(m_pGroup_ServerList, "NULL UI Component!!"); if(m_pGroup_ServerList) { m_pList_Server = (CN3UIList*)(m_pGroup_ServerList->GetChildByID("List_Server")); __ASSERT(m_pList_Server, "NULL UI Component!!"); m_pBtn_Connect = (CN3UIButton*)m_pGroup_ServerList->GetChildByID("Btn_Connect"); __ASSERT(m_pBtn_Connect, "NULL UI Component!!"); m_pGroup_ServerList->SetVisible(false); } return true; }
void Level::OnUpdate(sf::Time interval) { if (m_over && sf::Keyboard::isKeyPressed(sf::Keyboard::Down) && sf::Keyboard::isKeyPressed(sf::Keyboard::Up)) { m_game->SwitchScene(engine::Factory::create<Level>("assets/scripts/level.json", m_game)); } engine::util::RandomFloat xpos(0, m_size.x); engine::util::RandomFloat rotation(0, 360); engine::Scene::OnUpdate(interval); float delta = interval.asSeconds(); m_spawnTimer -= delta; m_rainbowTime -= delta; m_doubleTime -= delta; m_speedTime -= delta; m_healthTime -= delta; m_scoreAdd -= delta; m_zigzagTime -= delta; if (m_speedTime > 0 && !m_speed) { m_speed = true; m_world->SetGravity(b2Vec2(0.0, 6.0)); } else if (m_speed && m_speedTime < 0) { m_speed = false; m_world->SetGravity(b2Vec2(0.0, 3.0)); } if (m_spawnTimer < 0) { engine::util::RandomFloat chance(0.0, 1.0); if (m_rainbowTime > 0) { m_spawnTimer = 0.1; engine::Node *o = engine::Factory::CreateChildFromFile("assets/scripts/sheep_rainbow.json", m_objectNode); o->SetPosition(xpos(), -200); o->SetRotation(rotation()); } else if (m_zigzagTime > 0) { m_spawnTimer = 0.3; float c = chance(); // MEH engine::Node *o = nullptr; if (c < 0.3) o= engine::Factory::CreateChildFromFile("assets/scripts/cow.json", m_objectNode); else if (c < 0.6) o= engine::Factory::CreateChildFromFile("assets/scripts/pig.json", m_objectNode); else if (c < 0.75) o= engine::Factory::CreateChildFromFile("assets/scripts/sheep_white.json", m_objectNode); else if (c < 0.9) o= engine::Factory::CreateChildFromFile("assets/scripts/sheep_brown.json", m_objectNode); else o= engine::Factory::CreateChildFromFile("assets/scripts/sheep_black.json", m_objectNode); o->SetPosition(m_zig?362:662, -200); m_zig = !m_zig; o->SetRotation(rotation()); } else { m_spawnTimer = 0.5; if (m_speed) m_spawnTimer /= 4; if (m_doubleTime > 0) m_spawnTimer /= 2; for (auto &obj: m_objects) { float c = obj.chance; if (m_doubleTime > 0) c *= 2; if (chance() < c) { engine::Node *o = engine::Factory::CreateChildFromFile(obj.script, m_objectNode); o->SetPosition(xpos(), -200); o->SetRotation(rotation()); } } } } if (m_mouse) { if (!m_mouse->IsRender()) { m_mouse->GetBody()->SetGravityScale(1); m_game->GetWindow()->setMouseCursorVisible(false); m_mouse = nullptr; } else { auto pos = m_game->GetMousePosition(); if (pos.y > 576) pos.y = -10; m_mouse->SetPosition(pos.x, pos.y); } } if (m_healthTime > 0) { Player *player = static_cast<Player *>(GetChildByID("player")); if (player) { player->ChangeEnergy(1.5f); } } if (m_scoreAdd < 0 && !m_over) { AddScore(1); m_scoreAdd = 0.5; } }
void Level::OnInitializeDone() { m_objectNode = GetChildByID("objects"); m_mouse = GetChildByID("mouse"); }