98 lines
2.5 KiB
C++
98 lines
2.5 KiB
C++
#include "dl_tool_manager.h"
|
|
|
|
namespace dl::Tool
|
|
{
|
|
|
|
void Manager::_init()
|
|
{
|
|
_debugInfo = Tool::DebugInfo::Create();
|
|
_ruler = Tool::Ruler::Create();
|
|
|
|
_panel = g_ui->CreatePanel();
|
|
_panel->SetOrderMode(UI::Panel::FORCE);
|
|
_panel->SetOrder(Math::OffsetOrder(0));
|
|
_panel->SetAutoRun(false);
|
|
_panel->SetSize({ 600, 400 });
|
|
_panel->SetPosScale({ 0.5f, 0.5f });
|
|
_panel->SetAlign(Align::CC);
|
|
_panel->SetDebugName("DL Tool Manager");
|
|
{
|
|
UI::Background* bg = g_ui->CreateBackgroundDefault();
|
|
bg->SetSize({ 600, 400 });
|
|
_drag._bControlPanel = true;
|
|
bg->GetCpt()->PushBack(&_drag);
|
|
_panel->Add(bg);
|
|
|
|
auto btn = g_ui->CreateButtonSpriteDefault(UI::Manager::ButtonStyle::CLOSE);
|
|
btn->SetElementData(Align::RT, { 600, 0 });
|
|
_panel->Add(btn);
|
|
_btnClose = btn;
|
|
}
|
|
{
|
|
_panelSwt = g_ui->CreatePanel(_panel);
|
|
_panelSwt->SetLocator(createLocatorY(20));
|
|
_panelSwt->SetPosPixel({ 60, 54 });
|
|
|
|
auto arr = { "总开关", "显示帧率", "使用尺子", "F1显示ui框架", "F2隐藏UI", "UI拾取显示"};
|
|
for (auto& str : arr)
|
|
{
|
|
auto btn = g_ui->CreateButtonSpriteDefault(UI::Manager::ButtonStyle::SWITCH);
|
|
btn->SetString(str);
|
|
btn->SetSelect(true);
|
|
_panelSwt->Add(btn);
|
|
}
|
|
}
|
|
{
|
|
_panelBtn = g_ui->CreatePanel(_panel);
|
|
_panelBtn->SetLocator(createLocatorY(20));
|
|
_panelBtn->SetPosPixel({ 60 + 400, 54 });
|
|
|
|
auto arr = { "清除缓存" };
|
|
for (auto& str : arr)
|
|
{
|
|
auto btn = g_ui->CreateButtonSpriteDefault(UI::Manager::ButtonStyle::NORMAL);
|
|
btn->SetString(str);
|
|
_panelBtn->Add(btn);
|
|
}
|
|
}
|
|
}
|
|
|
|
void Manager::Update()
|
|
{
|
|
if (g_input->KeyDown(KeyCode::F11))
|
|
_bVisible = !_bVisible;
|
|
else if (_btnClose->IsClick())
|
|
_bVisible = false;
|
|
|
|
if (_bVisible)
|
|
_panel->Update();
|
|
//
|
|
if (_panelSwt->IsSelectIndex(0))
|
|
{
|
|
if (_panelSwt->IsSelectIndex(2))
|
|
_ruler->Update();
|
|
if (_panelSwt->IsSelectIndex(4))
|
|
g_ui->SetHide(g_input->KeyState(KeyCode::F2));
|
|
if (_panelSwt->IsSelectIndex(5))
|
|
g_factory->SetOrderPickupShow(true);
|
|
else
|
|
g_factory->SetOrderPickupShow(false);
|
|
}
|
|
else
|
|
g_factory->SetOrderPickupShow(false);
|
|
// 删除缓存
|
|
if (_panelBtn->GetClickIndex() == 0)
|
|
{
|
|
g_factory->DeleteBinary(false, true, false);
|
|
}
|
|
|
|
// 分辨率控制
|
|
/*if (g_input->KeyUp(KeyCode::KEY1))
|
|
g_system->SetFullScreen(FullScreenMode::WINDOW, { 800, 600 });
|
|
else if (g_input->KeyUp(KeyCode::KEY2))
|
|
g_system->SetFullScreen(FullScreenMode::FULL, { 800, 600 });
|
|
else if (g_input->KeyUp(KeyCode::KEY3))
|
|
g_system->SetFullScreen(FullScreenMode::FULL_WINDOW);*/
|
|
}
|
|
|
|
} |