Skip to content

Commit

Permalink
Move popup to shop window
Browse files Browse the repository at this point in the history
  • Loading branch information
mertwole committed Aug 27, 2024
1 parent ba3b79d commit 5687994
Show file tree
Hide file tree
Showing 4 changed files with 209 additions and 13 deletions.
15 changes: 15 additions & 0 deletions JamGame/Assets/Scenes/Main.unity
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,10 @@ PrefabInstance:
propertyPath: inventoryController
value:
objectReference: {fileID: 163902199920453719}
- target: {fileID: 6112419006844250274, guid: 936d2a4fd9a084f4cbd27dcab84fd81d, type: 3}
propertyPath: notEnoughMoneyPopup
value:
objectReference: {fileID: 528034638}
- target: {fileID: 6987645456429325457, guid: 936d2a4fd9a084f4cbd27dcab84fd81d, type: 3}
propertyPath: m_SizeDelta.x
value: 0
Expand All @@ -535,6 +539,17 @@ RectTransform:
m_CorrespondingSourceObject: {fileID: 2893449463177979563, guid: 936d2a4fd9a084f4cbd27dcab84fd81d, type: 3}
m_PrefabInstance: {fileID: 439256173}
m_PrefabAsset: {fileID: 0}
--- !u!114 &528034638 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 5641301930047383313, guid: 936d2a4fd9a084f4cbd27dcab84fd81d, type: 3}
m_PrefabInstance: {fileID: 439256173}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 9b55119cf31ab9a4cba69e754e2826ef, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &530393659
GameObject:
m_ObjectHideFlags: 0
Expand Down
11 changes: 2 additions & 9 deletions JamGame/Assets/Scripts/Level/InfoPopup.cs
Original file line number Diff line number Diff line change
@@ -1,31 +1,24 @@
using Sirenix.OdinInspector;
using TMPro;
using UnityEngine;

namespace Level
{
[AddComponentMenu("Scripts/Level/Level.InfoPopup")]
internal class InfoPopup : MonoBehaviour
{
[Required]
[SerializeField]
private TMP_Text infoLabel;

[Required]
[SerializeField]
private GameObject viewRoot;

[Button]
public void HidePopup()
public void Hide()
{
infoLabel.text = "Hidden";
viewRoot.SetActive(false);
}

[Button]
public void ShowPopup(string info)
public void Show()
{
infoLabel.text = info;
viewRoot.SetActive(true);
}
}
Expand Down
9 changes: 5 additions & 4 deletions JamGame/Assets/Scripts/Level/Shop/Controller.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ public class Controller : MonoBehaviour
[RequiredIn(PrefabKind.PrefabInstanceAndNonPrefabInstance)]
private Location.EmployeeManager.Model employeeManager;

[SerializeField]
private InfoPopup notEnoughMoneyPopup;

public void SetShopRooms(IEnumerable<ShopRoomConfig> roomConfigs)
{
IEnumerable<CoreModel> newCoreModels = roomConfigs.Select(x =>
Expand All @@ -42,8 +45,7 @@ public Result TryBuyRoom(InternalUid roomUid, int cost)
Result takeMoneyResult = financesController.TryTakeMoney(cost);
if (takeMoneyResult.Failure)
{
// TODO: #172
Debug.Log(takeMoneyResult.Error);
notEnoughMoneyPopup.Show();
return new FailResult(takeMoneyResult.Error);
}

Expand Down Expand Up @@ -78,8 +80,7 @@ public Result TryBuyEmployee(PersonalityImpl employee)
}
else
{
// TODO: #172
Debug.Log(result.Error);
notEnoughMoneyPopup.Show();
return result;
}
}
Expand Down
187 changes: 187 additions & 0 deletions JamGame/Assets/UI/Prefabs/Shop/ShopUI.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -1755,6 +1755,7 @@ RectTransform:
- {fileID: 2645519020617429313}
- {fileID: 26431160061850571}
- {fileID: 5097289731240004600}
- {fileID: 2471681866722084169}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
Expand All @@ -1778,6 +1779,7 @@ MonoBehaviour:
shopModel: {fileID: 3546836253939363253}
financesController: {fileID: 0}
employeeManager: {fileID: 0}
notEnoughMoneyPopup: {fileID: 5641301930047383313}
--- !u!114 &3546836253939363253
MonoBehaviour:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -2789,6 +2791,191 @@ MonoBehaviour:
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!1001 &580906204495973766
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 2893449463177979563}
m_Modifications:
- target: {fileID: 327193864442717209, guid: b293213f7a479c542a9d22e6bce8c02c, type: 3}
propertyPath: m_Name
value: InfoPopup
objectReference: {fileID: 0}
- target: {fileID: 356313613216295985, guid: b293213f7a479c542a9d22e6bce8c02c, type: 3}
propertyPath: m_Color.a
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2933436326991226981, guid: b293213f7a479c542a9d22e6bce8c02c, type: 3}
propertyPath: m_IsActive
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3045249815235725519, guid: b293213f7a479c542a9d22e6bce8c02c, type: 3}
propertyPath: m_Pivot.x
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 3045249815235725519, guid: b293213f7a479c542a9d22e6bce8c02c, type: 3}
propertyPath: m_Pivot.y
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 3045249815235725519, guid: b293213f7a479c542a9d22e6bce8c02c, type: 3}
propertyPath: m_AnchorMax.x
value: 1
objectReference: {fileID: 0}
- target: {fileID: 3045249815235725519, guid: b293213f7a479c542a9d22e6bce8c02c, type: 3}
propertyPath: m_AnchorMax.y
value: 1
objectReference: {fileID: 0}
- target: {fileID: 3045249815235725519, guid: b293213f7a479c542a9d22e6bce8c02c, type: 3}
propertyPath: m_AnchorMin.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3045249815235725519, guid: b293213f7a479c542a9d22e6bce8c02c, type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3045249815235725519, guid: b293213f7a479c542a9d22e6bce8c02c, type: 3}
propertyPath: m_SizeDelta.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3045249815235725519, guid: b293213f7a479c542a9d22e6bce8c02c, type: 3}
propertyPath: m_SizeDelta.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3045249815235725519, guid: b293213f7a479c542a9d22e6bce8c02c, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3045249815235725519, guid: b293213f7a479c542a9d22e6bce8c02c, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3045249815235725519, guid: b293213f7a479c542a9d22e6bce8c02c, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3045249815235725519, guid: b293213f7a479c542a9d22e6bce8c02c, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 3045249815235725519, guid: b293213f7a479c542a9d22e6bce8c02c, type: 3}
propertyPath: m_LocalRotation.x
value: -0
objectReference: {fileID: 0}
- target: {fileID: 3045249815235725519, guid: b293213f7a479c542a9d22e6bce8c02c, type: 3}
propertyPath: m_LocalRotation.y
value: -0
objectReference: {fileID: 0}
- target: {fileID: 3045249815235725519, guid: b293213f7a479c542a9d22e6bce8c02c, type: 3}
propertyPath: m_LocalRotation.z
value: -0
objectReference: {fileID: 0}
- target: {fileID: 3045249815235725519, guid: b293213f7a479c542a9d22e6bce8c02c, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3045249815235725519, guid: b293213f7a479c542a9d22e6bce8c02c, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3045249815235725519, guid: b293213f7a479c542a9d22e6bce8c02c, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3045249815235725519, guid: b293213f7a479c542a9d22e6bce8c02c, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3045249815235725519, guid: b293213f7a479c542a9d22e6bce8c02c, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3249452312226196255, guid: b293213f7a479c542a9d22e6bce8c02c, type: 3}
propertyPath: m_SizeDelta.x
value: 442.29
objectReference: {fileID: 0}
- target: {fileID: 3249452312226196255, guid: b293213f7a479c542a9d22e6bce8c02c, type: 3}
propertyPath: m_SizeDelta.y
value: 154.8
objectReference: {fileID: 0}
- target: {fileID: 5738335771717985130, guid: b293213f7a479c542a9d22e6bce8c02c, type: 3}
propertyPath: m_text
value: Not Enough Money
objectReference: {fileID: 0}
- target: {fileID: 5965123619139454308, guid: b293213f7a479c542a9d22e6bce8c02c, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5965123619139454308, guid: b293213f7a479c542a9d22e6bce8c02c, type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5965123619139454308, guid: b293213f7a479c542a9d22e6bce8c02c, type: 3}
propertyPath: m_SizeDelta.x
value: 372.29
objectReference: {fileID: 0}
- target: {fileID: 5965123619139454308, guid: b293213f7a479c542a9d22e6bce8c02c, type: 3}
propertyPath: m_SizeDelta.y
value: 84.8
objectReference: {fileID: 0}
- target: {fileID: 5965123619139454308, guid: b293213f7a479c542a9d22e6bce8c02c, type: 3}
propertyPath: m_AnchoredPosition.x
value: 221.145
objectReference: {fileID: 0}
- target: {fileID: 5965123619139454308, guid: b293213f7a479c542a9d22e6bce8c02c, type: 3}
propertyPath: m_AnchoredPosition.y
value: -77.4
objectReference: {fileID: 0}
- target: {fileID: 6653530753852172380, guid: b293213f7a479c542a9d22e6bce8c02c, type: 3}
propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_MethodName
value: Hide
objectReference: {fileID: 0}
- target: {fileID: 7264041106713767898, guid: b293213f7a479c542a9d22e6bce8c02c, type: 3}
propertyPath: m_AnchorMax.y
value: 1
objectReference: {fileID: 0}
- target: {fileID: 7264041106713767898, guid: b293213f7a479c542a9d22e6bce8c02c, type: 3}
propertyPath: m_AnchorMin.y
value: 1
objectReference: {fileID: 0}
- target: {fileID: 7264041106713767898, guid: b293213f7a479c542a9d22e6bce8c02c, type: 3}
propertyPath: m_SizeDelta.x
value: 332.29
objectReference: {fileID: 0}
- target: {fileID: 7264041106713767898, guid: b293213f7a479c542a9d22e6bce8c02c, type: 3}
propertyPath: m_SizeDelta.y
value: 44.8
objectReference: {fileID: 0}
- target: {fileID: 7264041106713767898, guid: b293213f7a479c542a9d22e6bce8c02c, type: 3}
propertyPath: m_AnchoredPosition.x
value: 186.145
objectReference: {fileID: 0}
- target: {fileID: 7264041106713767898, guid: b293213f7a479c542a9d22e6bce8c02c, type: 3}
propertyPath: m_AnchoredPosition.y
value: -42.4
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: b293213f7a479c542a9d22e6bce8c02c, type: 3}
--- !u!224 &2471681866722084169 stripped
RectTransform:
m_CorrespondingSourceObject: {fileID: 3045249815235725519, guid: b293213f7a479c542a9d22e6bce8c02c, type: 3}
m_PrefabInstance: {fileID: 580906204495973766}
m_PrefabAsset: {fileID: 0}
--- !u!114 &5641301930047383313 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 5063775693712566935, guid: b293213f7a479c542a9d22e6bce8c02c, type: 3}
m_PrefabInstance: {fileID: 580906204495973766}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 9b55119cf31ab9a4cba69e754e2826ef, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1001 &5926364194939241123
PrefabInstance:
m_ObjectHideFlags: 0
Expand Down

0 comments on commit 5687994

Please sign in to comment.