本文整理汇总了C++中UIElement::GetChild方法的典型用法代码示例。如果您正苦于以下问题:C++ UIElement::GetChild方法的具体用法?C++ UIElement::GetChild怎么用?C++ UIElement::GetChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UIElement
的用法示例。
在下文中一共展示了UIElement::GetChild方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HandlerConfigurationWindowButtonPressed
/// Get the button
void GameEconomicGameClient::HandlerConfigurationWindowButtonPressed(StringHash eventType, VariantMap& eventData)
{
/// Get needed resources
Renderer* renderer = GetSubsystem<Renderer>();
ResourceCache* cache = GetSubsystem<ResourceCache>();
UI* ui_ = GetSubsystem<UI>();
UIElement * UIRoot = ui_->GetRoot();
GameStateHandlerComponent * gamestatehandlercomponent_ = GetSubsystem<GameStateHandlerComponent>();
/// get the button that was clicked
Button* clicked = static_cast<Button*>(eventData[UIMouseClick::P_ELEMENT].GetPtr());
/// Get TheName
String ClickedButton(clicked->GetName().ToLower());
/// If exit was clicked
if (ClickedButton.Contains("apply")==true)
{
/// Get parameters
Slider * VideoBloomParam1= (Slider *)UIRoot->GetChild("VideoBloomParam1Slider",true);
Slider * VideoBloomParam2= (Slider *)UIRoot->GetChild("VideoBloomParam2Slider",true);
float VideoBloomParam1Value = VideoBloomParam1->GetValue();
float VideoBloomParam2Value = VideoBloomParam2->GetValue();
/// Set parameter
effectRenderPath->SetShaderParameter("BloomMix", Vector2(VideoBloomParam1Value,VideoBloomParam2Value));
return;
}
/// If exit was clicked
if (ClickedButton.Contains("save")==true)
{
/// Get parameters
Slider * VideoBloomParam1= (Slider *)UIRoot->GetChild("VideoBloomParam1Slider",true);
Slider * VideoBloomParam2= (Slider *)UIRoot->GetChild("VideoBloomParam2Slider",true);
CheckBox * GameForceTabletModeCheckBox = (CheckBox *) UIRoot->GetChild("GameForceTabletModeCheckBox",true);
///Create new config
Configuration SaveNewConfig;
/// Copy info
SaveNewConfig.GameModeForceTablet= GameForceTabletModeCheckBox->IsChecked();
SaveNewConfig.VideoBloomParam1 = VideoBloomParam1->GetValue();
SaveNewConfig.VideoBloomParam2 = VideoBloomParam2->GetValue();
/// Save new config
SaveConfiguration(SaveNewConfig);
return;
}
return;
}
示例2: HandleUpdate
void UIDrag::HandleUpdate(StringHash eventType, VariantMap& eventData)
{
auto* ui = GetSubsystem<UI>();
UIElement* root = ui->GetRoot();
auto* input = GetSubsystem<Input>();
unsigned n = input->GetNumTouches();
for (unsigned i = 0; i < n; i++)
{
Text* t = (Text*)root->GetChild("Touch " + String(i));
TouchState* ts = input->GetTouch(i);
t->SetText("Touch " + String(ts->touchID_));
IntVector2 pos = ts->position_;
pos.y_ -= 30;
t->SetPosition(pos);
t->SetVisible(true);
}
for (unsigned i = n; i < 10; i++)
{
Text* t = (Text*)root->GetChild("Touch " + String(i));
t->SetVisible(false);
}
if (input->GetKeyPress(KEY_SPACE))
{
PODVector<UIElement*> elements;
root->GetChildrenWithTag(elements, "SomeTag");
for (PODVector<UIElement*>::ConstIterator i = elements.Begin(); i != elements.End(); ++i)
{
UIElement* element = *i;
element->SetVisible(!element->IsVisible());
}
}
}
示例3: UpdateNetworkStatusUI
void GameEconomicGameClient::UpdateNetworkStatusUI(bool online)
{
/// Get Urho3D Subsystem
UI* ui_ = GetSubsystem<UI>();
/// load window
UIElement * uiroot = ui_-> GetRoot ();
Text * NetworkStatusUpdateText = (Text *) uiroot->GetChild("ServerStatusUpdateText",true);
if(NetworkStatusUpdateText)
{
if(online)
{
NetworkStatusUpdateText->SetText("Online");
}
else
{
NetworkStatusUpdateText->SetText("Offline");
}
}
return;
}
示例4: Update
void Board::Update(float timeStep)
{
if (gameOver_)
{
if (score_ > record_)
{
record_ = score_;
SaveRecord();
}
Restart();
return;
}
selectionNode_->Rotate(Quaternion(0.0f, timeStep * 50, 0.0f));
if (Path::GetTotalCount() > 0)
return;
if (needCheckLines_)
{
if (CheckLines())
{
needSpawnBalls_ = false;
}
needCheckLines_ = false;
// может быть что поле полностью занято, новых шаров спанить не надо и ходить некуда
// не работает чот
gameOver_ = true;
for (int i = 0; i < height_; i++)
{
for (int j = 0; j < width_; j++)
{
if (!board_[i][j] || board_[i][j]->GetBallState() == BS_GHOST)
{
gameOver_ = false;
break;
}
}
}
if (gameOver_)
return;
}
if (needSpawnBalls_)
{
for (int i = 0; i < numAddBalls_; i++)
{
if (!SpawnBall())
{
gameOver_ = true;
return;
}
}
if (difficulty_ <= D_NORMAL)
{
for (int i = 0; i < numAddBalls_; i++)
CreateBall(true);
}
needSpawnBalls_ = false;
}
UIElement* uiRoot = GetSubsystem<UI>()->GetRoot();
Text* t = static_cast<Text*>(uiRoot->GetChild("Score", true));
t->SetText("Score: " + String(score_));
t = static_cast<Text*>(uiRoot->GetChild("Colors", true));
t->SetText("Colors: " + String(numColors_));
t = static_cast<Text*>(uiRoot->GetChild("LineLength", true));
t->SetText("Line length: " + String(lineLength_));
t = static_cast<Text*>(uiRoot->GetChild("Record", true));
t->SetText("Record: " + String(record_));
// нужно выбрасывать шары если после уделаения линий поле пустое
}