Skip to content

Commit

Permalink
Merge pull request #61 from Shadow-Wizard-Games/develop-user-interfac…
Browse files Browse the repository at this point in the history
…es-fixes

Final Additions on the Game Sequence and UI for 1.5
  • Loading branch information
JanNetoLlorens authored Apr 15, 2024
2 parents f6a2a47 + a4bee88 commit b86924b
Show file tree
Hide file tree
Showing 55 changed files with 171,027 additions and 2,513 deletions.
Binary file modified TheOneEditor/Assets/Meshes/MK_Ship_Room2.fbx
Binary file not shown.
Binary file added TheOneEditor/Assets/Meshes/MK_Ship_Room3.fbx
Binary file not shown.
Binary file added TheOneEditor/Assets/Meshes/MK_Ship_Room5.fbx
Binary file not shown.
Binary file modified TheOneEditor/Assets/Meshes/M_BigServerComputer_BC.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified TheOneEditor/Assets/Meshes/M_ComputerDesk_BC.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified TheOneEditor/Assets/Meshes/SM_Chestburster.fbx
Binary file not shown.
Binary file added TheOneEditor/Assets/Meshes/SM_Corpse.fbx
Binary file not shown.
490 changes: 0 additions & 490 deletions TheOneEditor/Assets/Meshes/SM_CorpseHuman.fbx

This file was deleted.

Binary file not shown.
Binary file modified TheOneEditor/Assets/Meshes/T_Box_BC.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified TheOneEditor/Assets/Meshes/T_Corpse_BC.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified TheOneEditor/Assets/Meshes/T_MainCharacter_BC.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified TheOneEditor/Assets/Meshes/T_Oil_Drums_BC.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified TheOneEditor/Assets/Meshes/T_Pipes_BC.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified TheOneEditor/Assets/Meshes/T_Ship_Floor_Short_BC.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added TheOneEditor/Assets/Meshes/ship3.fbx
Binary file not shown.
1,814 changes: 1,280 additions & 534 deletions TheOneEditor/Assets/Scenes/HUD_scene.toe

Large diffs are not rendered by default.

4,142 changes: 3,172 additions & 970 deletions TheOneEditor/Assets/Scenes/Level1.toe → TheOneEditor/Assets/Scenes/L1R1.toe

Large diffs are not rendered by default.

38,287 changes: 38,287 additions & 0 deletions TheOneEditor/Assets/Scenes/L1R2.toe

Large diffs are not rendered by default.

91,019 changes: 91,019 additions & 0 deletions TheOneEditor/Assets/Scenes/L1R3.toe

Large diffs are not rendered by default.

35,909 changes: 35,909 additions & 0 deletions TheOneEditor/Assets/Scenes/L1R5.toe

Large diffs are not rendered by default.

451 changes: 0 additions & 451 deletions TheOneEditor/Assets/Scenes/NewUntitledScene.toe

This file was deleted.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified TheOneEditor/Assets/Textures/Hud/HUD_SpriteSheet.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
278 changes: 277 additions & 1 deletion TheOneEditor/PanelInspector.cpp

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions TheOneEditor/PanelInspector.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ class PanelInspector : public Panel
"Circle",
"Square",
};

int slilderDesignOptionToModify = 0;
};

#endif // !__PANEL_INSPECTOR_H__
33 changes: 17 additions & 16 deletions TheOneEditor/imgui.ini
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
[Window][Inspector]
Pos=817,19
Size=463,701
Pos=1550,19
Size=370,1038
Collapsed=0
DockId=0x0000000D,0

[Window][DockSpace]
Pos=0,0
Size=1280,720
Size=1920,1057
Collapsed=0

[Window][Debug##Default]
Expand All @@ -20,20 +20,20 @@ Size=339,180
Collapsed=0

[Window][Console]
Pos=443,525
Size=372,195
Pos=791,862
Size=757,195
Collapsed=0
DockId=0x0000000A,0

[Window][Hierarchy]
Pos=0,19
Size=370,504
Size=370,841
Collapsed=0
DockId=0x00000006,0

[Window][Scene]
Pos=372,19
Size=443,504
Size=1176,841
Collapsed=0
DockId=0x00000009,0

Expand All @@ -49,8 +49,8 @@ Size=465,277
Collapsed=0

[Window][Project]
Pos=0,525
Size=441,195
Pos=0,862
Size=789,195
Collapsed=0
DockId=0x00000005,0

Expand All @@ -71,7 +71,7 @@ Collapsed=0

[Window][Game]
Pos=372,19
Size=443,504
Size=1176,841
Collapsed=0
DockId=0x00000009,1

Expand All @@ -91,7 +91,8 @@ Size=400,400
Collapsed=0

[Window][Particles name]
Pos=1623,351
ViewportPos=0,0
ViewportId=0x86993A87
Size=222,60
Collapsed=0

Expand All @@ -107,17 +108,17 @@ Column 2 Weight=1.0539
Column 3 Weight=1.0180

[Docking][Data]
DockSpace ID=0x09EF459F Window=0x9A404470 Pos=640,379 Size=1280,701 Split=X
DockNode ID=0x00000007 Parent=0x09EF459F SizeRef=1455,701 Split=Y
DockSpace ID=0x09EF459F Window=0x9A404470 Pos=0,42 Size=1920,1038 Split=X
DockNode ID=0x00000007 Parent=0x09EF459F SizeRef=1548,701 Split=Y
DockNode ID=0x00000001 Parent=0x00000007 SizeRef=1280,143
DockNode ID=0x00000002 Parent=0x00000007 SizeRef=1280,575 Split=Y
DockNode ID=0x00000003 Parent=0x00000002 SizeRef=763,793 Split=X Selected=0xE192E354
DockNode ID=0x00000006 Parent=0x00000003 SizeRef=370,487 Selected=0x29EABFBD
DockNode ID=0x00000009 Parent=0x00000003 SizeRef=1083,487 CentralNode=1 Selected=0xE192E354
DockNode ID=0x00000009 Parent=0x00000003 SizeRef=1176,487 CentralNode=1 Selected=0xE192E354
DockNode ID=0x00000004 Parent=0x00000002 SizeRef=763,195 Split=X Selected=0xD04A4B96
DockNode ID=0x00000005 Parent=0x00000004 SizeRef=789,214 Selected=0xD04A4B96
DockNode ID=0x0000000A Parent=0x00000004 SizeRef=664,214 Selected=0x49278EEE
DockNode ID=0x0000000B Parent=0x09EF459F SizeRef=463,701 Split=Y Selected=0xE7039252
DockNode ID=0x0000000A Parent=0x00000004 SizeRef=757,214 Selected=0x49278EEE
DockNode ID=0x0000000B Parent=0x09EF459F SizeRef=370,701 Split=Y Selected=0xE7039252
DockNode ID=0x0000000D Parent=0x0000000B SizeRef=315,695 Selected=0xE7039252
DockNode ID=0x0000000E Parent=0x0000000B SizeRef=315,298 Selected=0x54723243

6 changes: 6 additions & 0 deletions TheOneEngine/Canvas.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "ItemUI.h"
#include "ImageUI.h"
#include "ButtonImageUI.h"
#include "SliderUI.h"

Canvas::Canvas(std::shared_ptr<GameObject> containerGO) : Component(containerGO, ComponentType::Canvas)
{}
Expand Down Expand Up @@ -223,6 +224,11 @@ void Canvas::LoadComponent(const json& canvasJSON)
int id = this->AddItemUI<ButtonImageUI>();
this->GetItemUI<ButtonImageUI>(id)->LoadUIElement(item);
}
if (item["Type"] == (int)UiType::SLIDER)
{
int id = this->AddItemUI<SliderUI>();
this->GetItemUI<SliderUI>(id)->LoadUIElement(item);
}
if (item["Type"] == (int)UiType::UNKNOWN)
{
//default
Expand Down
15 changes: 6 additions & 9 deletions TheOneEngine/CollisionSolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ bool CollisionSolver::Update(double dt)
case CollisionType::Player:
if (CheckCollision(item, item2))
{
LOG(LogType::LOG_WARNING, "Player Hit");
MonoManager::CallScriptFunction(item2->GetComponent<Script>()->monoBehaviourInstance, "ReduceLife");
item->AddToDelete(engine->N_sceneManager->objectsToDelete);
}
break;
Expand Down Expand Up @@ -445,18 +445,15 @@ bool CollisionSolver::CheckCollision(GameObject* objA, GameObject* objB)

void CollisionSolver::LoadCollisions(std::shared_ptr<GameObject> go)
{
if (go->GetComponent<Collider2D>())
{
goWithCollision.push_back(go.get());
}
for (auto& item : go->children)
{
if (item->IsEnabled())
{
if (item->GetComponent<Collider2D>())
{
goWithCollision.push_back(item.get());
}
if (!item->children.empty())
{
LoadCollisions(item);
}
LoadCollisions(item);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion TheOneEngine/GameObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ void GameObject::DrawUI(Camera* camera, const DrawMode mode)
auto canvas = this->GetComponent<Canvas>();

if (canvas && canvas->IsEnabled())
if (mode == DrawMode::GAME || canvas->debugDraw)
if (mode == DrawMode::GAME || canvas->debugDraw || engine->N_sceneManager->GetSceneIsPlaying())
canvas->DrawComponent(camera);
}

Expand Down
1 change: 1 addition & 0 deletions TheOneEngine/ItemUI.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
enum class UiType {
IMAGE,
BUTTONIMAGE,
SLIDER,
UNKNOWN
};

Expand Down
3 changes: 2 additions & 1 deletion TheOneEngine/Mesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,8 @@ json Mesh::SaveComponent()
Model* mesh = Resources::GetResourceById<Model>(meshID);
meshJSON["MeshPath"] = mesh->path;
Material* mat = Resources::GetResourceById<Material>(materialID);
meshJSON["MaterialPath"] = mat->getPath();
std::string matPath = mat->getPath();
meshJSON["MaterialPath"] = matPath;

return meshJSON;
}
Expand Down
61 changes: 61 additions & 0 deletions TheOneEngine/MonoRegisterer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "Transform.h"
#include "Canvas.h"
#include "ImageUI.h"
#include "SliderUI.h"
#include "Collider2D.h"
#include "ParticleSystem.h"
#include "N_SceneManager.h"
Expand Down Expand Up @@ -119,6 +120,7 @@ static GameObject* InstantiateBullet(vec3f* initialPosition, vec3f* direction)
go->GetComponent<Collider2D>()->colliderType = ColliderType::Circle;
go->GetComponent<Collider2D>()->collisionType = CollisionType::Bullet;
go->GetComponent<Collider2D>()->radius = 0.4f;
engine->collisionSolver->LoadCollisions(engine->N_sceneManager->objectsToAdd.back());
return go;
}

Expand Down Expand Up @@ -164,6 +166,9 @@ static GameObject* RecursiveFindGO(std::string _name, GameObject* refGO)
return go.get();
}
returnedGO = RecursiveFindGO(_name, go.get());

if (returnedGO != nullptr)
break;
}
return returnedGO;
}
Expand Down Expand Up @@ -230,6 +235,11 @@ static void Disable(GameObject* GOtoDisable)
GOtoDisable->Disable();
}

static void Enable(GameObject* GOtoEnable)
{
GOtoEnable->Enable();
}

//Scene Management
static void LoadScene(MonoString* sceneName)
{
Expand Down Expand Up @@ -308,6 +318,53 @@ static void ChangeSectImg(GameObject* containerGO, MonoString* name, int x, int
}
}

static int GetSliderValue(GameObject* containerGO, MonoString* name)
{
std::string itemName = MonoRegisterer::MonoStringToUTF8(name);
std::vector<ItemUI*> uiElements = containerGO->GetComponent<Canvas>()->GetUiElements();
for (size_t i = 0; i < uiElements.size(); i++)
{
if (uiElements[i]->GetType() == UiType::SLIDER && uiElements[i]->GetName() == itemName)
{
SliderUI* ui = containerGO->GetComponent<Canvas>()->GetItemUI<SliderUI>(uiElements[i]->GetID());
return ui->GetValue();
}
}

return -1;
}

static int GetSliderMaxValue(GameObject* containerGO, MonoString* name)
{
std::string itemName = MonoRegisterer::MonoStringToUTF8(name);
std::vector<ItemUI*> uiElements = containerGO->GetComponent<Canvas>()->GetUiElements();
for (size_t i = 0; i < uiElements.size(); i++)
{
if (uiElements[i]->GetType() == UiType::SLIDER && uiElements[i]->GetName() == itemName)
{
SliderUI* ui = containerGO->GetComponent<Canvas>()->GetItemUI<SliderUI>(uiElements[i]->GetID());
return ui->GetMaxValue();
}
}

return -1;
}

static void SetSliderValue(GameObject* containerGO, int value, MonoString* name)
{
std::string itemName = MonoRegisterer::MonoStringToUTF8(name);
std::vector<ItemUI*> uiElements = containerGO->GetComponent<Canvas>()->GetUiElements();
for (size_t i = 0; i < uiElements.size(); i++)
{
if (uiElements[i]->GetType() == UiType::SLIDER && uiElements[i]->GetName() == itemName)
{
SliderUI* ui = containerGO->GetComponent<Canvas>()->GetItemUI<SliderUI>(uiElements[i]->GetID());
ui->SetValue(value);
break;
}
}
}

//Helpers
static float GetAppDeltaTime()
{
Expand Down Expand Up @@ -519,6 +576,7 @@ void MonoRegisterer::RegisterFunctions()
mono_add_internal_call("InternalCalls::ComponentCheck", ComponentCheck);
mono_add_internal_call("InternalCalls::GetScript", GetScript);
mono_add_internal_call("InternalCalls::Disable", Disable);
mono_add_internal_call("InternalCalls::Enable", Enable);

//Input
mono_add_internal_call("InternalCalls::GetKeyboardButton", GetKeyboardButton);
Expand Down Expand Up @@ -546,6 +604,9 @@ void MonoRegisterer::RegisterFunctions()
mono_add_internal_call("InternalCalls::GetSelectedButton", GetSelectedButton);
mono_add_internal_call("InternalCalls::MoveSelectedButton", MoveSelectedButton);
mono_add_internal_call("InternalCalls::ChangeSectImg", ChangeSectImg);
mono_add_internal_call("InternalCalls::GetSliderValue", GetSliderValue);
mono_add_internal_call("InternalCalls::SetSliderValue", SetSliderValue);
mono_add_internal_call("InternalCalls::GetSliderMaxValue", GetSliderMaxValue);

//Helpers
mono_add_internal_call("InternalCalls::GetAppDeltaTime", GetAppDeltaTime);
Expand Down
5 changes: 4 additions & 1 deletion TheOneEngine/ResourcesImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ std::filesystem::path Resources::ImportPathImpl(const std::filesystem::path& pat

std::string Resources::FindFileInAssets(const std::string& name)
{
std::string standarizeName = name;
StandarizePath(standarizeName);

if (name.find("Assets") && std::filesystem::exists(name))
return name;

Expand All @@ -95,7 +98,7 @@ std::string Resources::FindFileInAssets(const std::string& name)
std::string relPath = p.path().string();
std::string fileName = p.path().filename().replace_extension("").string();
StandarizePath(relPath);
if (fileName == name || relPath == name)
if (fileName == name || relPath == standarizeName)
return relPath;
}

Expand Down
2 changes: 1 addition & 1 deletion TheOneEngine/Script.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Script::~Script()

void Script::Start()
{
MonoManager::CallScriptFunction(monoBehaviourInstance, "Start");
MonoManager::CallScriptFunction(monoBehaviourInstance, "Start");
}

void Script::Enable()
Expand Down
Loading

0 comments on commit b86924b

Please sign in to comment.