mirror of
https://github.com/devZoGok/PlanetFleet.git
synced 2026-08-26 19:43:29 +00:00
correctly deleting GUI rects when changing trading screens
This commit is contained in:
@@ -44,18 +44,21 @@ gui = {
|
||||
},
|
||||
{
|
||||
guiType = GuiType.GUI_RECTANGLE,
|
||||
name = 'refineds',
|
||||
pos = {x = 0, y = 0, z = 0},
|
||||
size = {x = s, y = s},
|
||||
imagePath = resIconBasePath .. 'refineds.png',
|
||||
},
|
||||
{
|
||||
guiType = GuiType.GUI_RECTANGLE,
|
||||
name = 'wealth',
|
||||
pos = {x = 200, y = 0, z = 0},
|
||||
size = {x = s, y = s},
|
||||
imagePath = resIconBasePath .. 'wealth.png',
|
||||
},
|
||||
{
|
||||
guiType = GuiType.GUI_RECTANGLE,
|
||||
name = 'research',
|
||||
pos = {x = 400, y = 0, z = 0},
|
||||
size = {x = s, y = s},
|
||||
imagePath = resIconBasePath .. 'research.png',
|
||||
|
||||
@@ -58,6 +58,12 @@ function createResourceTrayGui(cpuPlayer, lineId, guiId, imgPath)
|
||||
end
|
||||
|
||||
gui = {
|
||||
{
|
||||
guiType = GuiType.GUI_RECTANGLE,
|
||||
pos = HubPos,
|
||||
size = HubSize,
|
||||
color = {x = 0, y = 0, z = 0, w = .6}
|
||||
},
|
||||
{
|
||||
guiType = GuiType.TEXT,
|
||||
name = 'P0',
|
||||
|
||||
@@ -33,7 +33,11 @@ namespace battleship{
|
||||
vector<Checkbox*> checkboxes{};
|
||||
vector<Slider*> sliders{};
|
||||
vector<Textbox*> textboxes{};
|
||||
vector<Node*> guiRects = guiManager->getGuiRectangles();
|
||||
vector<Node*> guiRects{
|
||||
guiManager->getGuiRectangle("refineds"),
|
||||
guiManager->getGuiRectangle("wealth"),
|
||||
guiManager->getGuiRectangle("research"),
|
||||
};
|
||||
vector<Text*> texts{
|
||||
guiManager->getText("depth"),
|
||||
guiManager->getText("refineds"),
|
||||
|
||||
@@ -441,6 +441,7 @@ namespace battleship{
|
||||
return textbox;
|
||||
}
|
||||
|
||||
//TODO factor out checking for optional lua values
|
||||
Node* ConcreteGuiManager::parseGuiRectangle(int guiId){
|
||||
sol::state_view SOL_LUA_STATE = generateView();
|
||||
sol::table guiTable = SOL_LUA_STATE["gui"][guiId + 1];
|
||||
@@ -454,6 +455,10 @@ namespace battleship{
|
||||
string imagePath = (pathOpt != sol::nullopt ? (string)guiTable[ipk] : "");
|
||||
bool texturingEnabled = (imagePath != "");
|
||||
|
||||
string nk = "name";
|
||||
sol::optional<string> nameOpt = guiTable[nk];
|
||||
string name = (nameOpt != sol::nullopt ? (string)guiTable[nk] : "");
|
||||
|
||||
mat->addBoolUniform("texturingEnabled", texturingEnabled);
|
||||
|
||||
if(texturingEnabled){
|
||||
@@ -471,7 +476,7 @@ namespace battleship{
|
||||
quad->setMaterial(mat);
|
||||
|
||||
sol::table posTable = guiTable["pos"];
|
||||
Node *guiRectangle = new Node(Vector3(posTable["x"], posTable["y"], posTable["z"]));
|
||||
Node *guiRectangle = new Node(Vector3(posTable["x"], posTable["y"], posTable["z"]), Quaternion::QUAT_W, Vector3::VEC_IJK, name);
|
||||
guiRectangle->attachMesh(quad);
|
||||
root->getGuiNode()->attachChild(guiRectangle);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user