building shop UI and grouped objects

This commit is contained in:
Lorenzo 2022-04-13 17:59:58 +02:00
parent c6a8c5c7f3
commit 20fa8f1218
6 changed files with 14613 additions and 5988 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -31,8 +31,15 @@ public class Building : MonoBehaviour
public async Task Upgrade(){ public async Task Upgrade(){
if(curLevel >= buildingData.levels.Count-1){Debug.Log("Already max");return;} if(curLevel >= buildingData.levels.Count-1){Debug.Log("Already max");return;}
int cost = buildingData.levels[curLevel+1].price; int cost = buildingData.levels[curLevel+1].price;
Debug.Log("Upgrading " + buildingData.buildingName + " for " + cost + " coins"); // Debug.Log("Upgrading " + buildingData.buildingName + " for " + cost + " coins");
switch (curLevel)
{
case 0: Debug.Log("1 Star"); break;
case 1: Debug.Log("2 Stars"); break;
}
await (DBmanager.SetCoins(DBmanager.Coins-cost)); await (DBmanager.SetCoins(DBmanager.Coins-cost));
Mathf.Clamp(curLevel++,0, buildingData.levels.Count-1); Mathf.Clamp(curLevel++,0, buildingData.levels.Count-1);
} }

View File

@ -52,7 +52,7 @@ public class SelectedItemMenu : MonoBehaviour
void OnUpgradeMenuClicked() void OnUpgradeMenuClicked()
{ {
Debug.Log("Opening Upgrade Menu for : " + Selector.selectedBuilding.buildingData.name); // Debug.Log("Opening Upgrade Menu for : " + Selector.selectedBuilding.buildingData.name);
upgradeMenu.SetActive(true); upgradeMenu.SetActive(true);
@ -60,7 +60,7 @@ public class SelectedItemMenu : MonoBehaviour
{ {
upgradeBtn.interactable = (Selector.selectedData.levels[Selector.selectedBuilding.curLevel + 1].price < DBmanager.Coins); upgradeBtn.interactable = (Selector.selectedData.levels[Selector.selectedBuilding.curLevel + 1].price < DBmanager.Coins);
upgradeBtn.GetComponentInChildren<TMP_Text>().text = Selector.selectedData.levels[Selector.selectedBuilding.curLevel + 1].price.ToString(); upgradeBtn.GetComponentInChildren<TMP_Text>().text = Selector.selectedData.levels[Selector.selectedBuilding.curLevel + 1].price.ToString();
} }
else else
{ {

View File

@ -5,8 +5,9 @@ using UnityEngine.EventSystems;
public class ShopScript : MonoBehaviour public class ShopScript : MonoBehaviour
{ {
public GameObject shopUI; public GameObject CoinMenu;
public GameObject GemsMenu; public GameObject GemsMenu;
public GameObject BuildMenu;
public string shopButtonName; public string shopButtonName;
@ -51,18 +52,31 @@ public class ShopScript : MonoBehaviour
checkButton(); checkButton();
} }
public void openBuildingShop()
{
BuildMenu.SetActive(true);
}
public void closeBuildingShop()
{
BuildMenu.SetActive(false);
}
public void checkButton() public void checkButton()
{ {
switch (shopButtonName) switch (shopButtonName)
{ {
case "Button_Shop": shopUI.SetActive(true); break; case "Button_Shop": CoinMenu.SetActive(true); break;
case "Coin": shopUI.SetActive(true); GemsMenu.SetActive(false); break; case "Coin": CoinMenu.SetActive(true); GemsMenu.SetActive(false); break;
case "Gem": GemsMenu.SetActive(true); shopUI.SetActive(false); break; case "Gem": GemsMenu.SetActive(true); CoinMenu.SetActive(false); break;
} }
} }
public void closeShop() public void closeShop()
{ {
shopUI.SetActive(false); CoinMenu.SetActive(false);
GemsMenu.SetActive(false); GemsMenu.SetActive(false);
} }
} }

113
UPF.sln
View File

@ -1,119 +1,18 @@
 
Microsoft Visual Studio Solution File, Format Version 11.00 Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010 # Visual Studio 2010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnityEngine.UI", "UnityEngine.UI.csproj", "{b4ac23e1-f788-99ec-b4d4-f4db4249a6d3}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Assembly-CSharp", "Assembly-CSharp.csproj", "{81D9F3F8-C93A-B7A8-EA43-2868619EFE2A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unity.RenderPipelines.Core.Runtime", "Unity.RenderPipelines.Core.Runtime.csproj", "{b0558cdb-64c9-3a15-92e8-c93ae5b494ac}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnityEngine.TestRunner", "UnityEngine.TestRunner.csproj", "{4b099d95-4be9-a4aa-edb7-33f78a7d2efe}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unity.Mathematics", "Unity.Mathematics.csproj", "{0bd64dde-46cc-a28c-b84b-e0522f6fed97}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Assembly-CSharp", "Assembly-CSharp.csproj", "{f8f3d981-3ac9-a8b7-ea43-2868619efe2a}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unity.Timeline", "Unity.Timeline.csproj", "{3c396443-9c6c-69d1-7248-8e6b6a3580d2}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unity.RenderPipelines.Universal.Runtime", "Unity.RenderPipelines.Universal.Runtime.csproj", "{e581676b-e515-94dc-c7ee-e5158f5af96b}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unity.TextMeshPro", "Unity.TextMeshPro.csproj", "{968fcd68-5785-2424-a8b1-57d977f064ee}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unity.RenderPipelines.Core.ShaderLibrary", "Unity.RenderPipelines.Core.ShaderLibrary.csproj", "{c9a516c3-de53-877b-b458-f8a67e878a04}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unity.RenderPipelines.Universal.Shaders", "Unity.RenderPipelines.Universal.Shaders.csproj", "{a565100f-fe57-c681-fc17-3c645ba47452}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary", "Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary.csproj", "{8e40b3fc-8515-5589-cc5f-4fbc4ecf3ab2}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unity.RenderPipeline.Universal.ShaderLibrary", "Unity.RenderPipeline.Universal.ShaderLibrary.csproj", "{72f9865c-6891-ed55-bfc3-e1d7c8e26394}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnityEditor.TestRunner", "UnityEditor.TestRunner.csproj", "{26f23d52-7433-1b44-0570-9da4a33f7995}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unity.PlasticSCM.Editor", "Unity.PlasticSCM.Editor.csproj", "{3fc5e71b-00d4-6906-3b4f-dab1d0795696}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unity.ShaderGraph.Editor", "Unity.ShaderGraph.Editor.csproj", "{885e274e-7f50-a377-4930-562fc60828cc}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnityEditor.UI", "UnityEditor.UI.csproj", "{d6fbbd1f-59ed-334c-8652-133616ce63a4}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unity.VisualStudio.Editor", "Unity.VisualStudio.Editor.csproj", "{ed8b43dd-4d8e-01b1-673f-fd1a268b0a02}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unity.Timeline.Editor", "Unity.Timeline.Editor.csproj", "{bbd5d945-3371-201c-a412-b472d2b13b80}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unity.Services.Core.Editor", "Unity.Services.Core.Editor.csproj", "{02de4d4e-b0e9-6f14-19ec-bc90a8fc62a5}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unity.TextMeshPro.Editor", "Unity.TextMeshPro.Editor.csproj", "{52312059-599b-ab0f-8b82-9e6cc546efd5}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unity.RenderPipelines.Core.Editor", "Unity.RenderPipelines.Core.Editor.csproj", "{b4be5cdf-66d4-ea8e-f726-9bf045e13587}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unity.CollabProxy.Editor", "Unity.CollabProxy.Editor.csproj", "{40c3d5a7-8695-a89e-b884-01ff4239925b}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unity.ShaderGraph.Utilities", "Unity.ShaderGraph.Utilities.csproj", "{4bb84661-785f-28e0-8162-52d940cc5908}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unity.RenderPipelines.Universal.Editor", "Unity.RenderPipelines.Universal.Editor.csproj", "{0944cd92-8f3d-69a1-8713-2c99f884a0a8}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unity.Searcher.Editor", "Unity.Searcher.Editor.csproj", "{c57ac926-239a-b887-19f0-e9834f17b0fe}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unity.VSCode.Editor", "Unity.VSCode.Editor.csproj", "{46971bd6-6e06-6e02-f6cc-f2a57fe23d9b}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unity.Mathematics.Editor", "Unity.Mathematics.Editor.csproj", "{d322fda3-5976-c697-265b-cc32f8c52c18}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution GlobalSection(ProjectConfigurationPlatforms) = postSolution
{b4ac23e1-f788-99ec-b4d4-f4db4249a6d3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {81D9F3F8-C93A-B7A8-EA43-2868619EFE2A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{b4ac23e1-f788-99ec-b4d4-f4db4249a6d3}.Debug|Any CPU.Build.0 = Debug|Any CPU {81D9F3F8-C93A-B7A8-EA43-2868619EFE2A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{b0558cdb-64c9-3a15-92e8-c93ae5b494ac}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {81D9F3F8-C93A-B7A8-EA43-2868619EFE2A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{b0558cdb-64c9-3a15-92e8-c93ae5b494ac}.Debug|Any CPU.Build.0 = Debug|Any CPU {81D9F3F8-C93A-B7A8-EA43-2868619EFE2A}.Release|Any CPU.Build.0 = Release|Any CPU
{4b099d95-4be9-a4aa-edb7-33f78a7d2efe}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4b099d95-4be9-a4aa-edb7-33f78a7d2efe}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0bd64dde-46cc-a28c-b84b-e0522f6fed97}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0bd64dde-46cc-a28c-b84b-e0522f6fed97}.Debug|Any CPU.Build.0 = Debug|Any CPU
{f8f3d981-3ac9-a8b7-ea43-2868619efe2a}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{f8f3d981-3ac9-a8b7-ea43-2868619efe2a}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3c396443-9c6c-69d1-7248-8e6b6a3580d2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3c396443-9c6c-69d1-7248-8e6b6a3580d2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{e581676b-e515-94dc-c7ee-e5158f5af96b}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{e581676b-e515-94dc-c7ee-e5158f5af96b}.Debug|Any CPU.Build.0 = Debug|Any CPU
{968fcd68-5785-2424-a8b1-57d977f064ee}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{968fcd68-5785-2424-a8b1-57d977f064ee}.Debug|Any CPU.Build.0 = Debug|Any CPU
{c9a516c3-de53-877b-b458-f8a67e878a04}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{c9a516c3-de53-877b-b458-f8a67e878a04}.Debug|Any CPU.Build.0 = Debug|Any CPU
{a565100f-fe57-c681-fc17-3c645ba47452}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{a565100f-fe57-c681-fc17-3c645ba47452}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8e40b3fc-8515-5589-cc5f-4fbc4ecf3ab2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8e40b3fc-8515-5589-cc5f-4fbc4ecf3ab2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{72f9865c-6891-ed55-bfc3-e1d7c8e26394}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{72f9865c-6891-ed55-bfc3-e1d7c8e26394}.Debug|Any CPU.Build.0 = Debug|Any CPU
{26f23d52-7433-1b44-0570-9da4a33f7995}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{26f23d52-7433-1b44-0570-9da4a33f7995}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3fc5e71b-00d4-6906-3b4f-dab1d0795696}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3fc5e71b-00d4-6906-3b4f-dab1d0795696}.Debug|Any CPU.Build.0 = Debug|Any CPU
{885e274e-7f50-a377-4930-562fc60828cc}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{885e274e-7f50-a377-4930-562fc60828cc}.Debug|Any CPU.Build.0 = Debug|Any CPU
{d6fbbd1f-59ed-334c-8652-133616ce63a4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{d6fbbd1f-59ed-334c-8652-133616ce63a4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{ed8b43dd-4d8e-01b1-673f-fd1a268b0a02}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{ed8b43dd-4d8e-01b1-673f-fd1a268b0a02}.Debug|Any CPU.Build.0 = Debug|Any CPU
{bbd5d945-3371-201c-a412-b472d2b13b80}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{bbd5d945-3371-201c-a412-b472d2b13b80}.Debug|Any CPU.Build.0 = Debug|Any CPU
{02de4d4e-b0e9-6f14-19ec-bc90a8fc62a5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{02de4d4e-b0e9-6f14-19ec-bc90a8fc62a5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{52312059-599b-ab0f-8b82-9e6cc546efd5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{52312059-599b-ab0f-8b82-9e6cc546efd5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{b4be5cdf-66d4-ea8e-f726-9bf045e13587}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{b4be5cdf-66d4-ea8e-f726-9bf045e13587}.Debug|Any CPU.Build.0 = Debug|Any CPU
{40c3d5a7-8695-a89e-b884-01ff4239925b}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{40c3d5a7-8695-a89e-b884-01ff4239925b}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4bb84661-785f-28e0-8162-52d940cc5908}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4bb84661-785f-28e0-8162-52d940cc5908}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0944cd92-8f3d-69a1-8713-2c99f884a0a8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0944cd92-8f3d-69a1-8713-2c99f884a0a8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{c57ac926-239a-b887-19f0-e9834f17b0fe}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{c57ac926-239a-b887-19f0-e9834f17b0fe}.Debug|Any CPU.Build.0 = Debug|Any CPU
{46971bd6-6e06-6e02-f6cc-f2a57fe23d9b}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{46971bd6-6e06-6e02-f6cc-f2a57fe23d9b}.Debug|Any CPU.Build.0 = Debug|Any CPU
{d322fda3-5976-c697-265b-cc32f8c52c18}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{d322fda3-5976-c697-265b-cc32f8c52c18}.Debug|Any CPU.Build.0 = Debug|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE