diff --git a/Assembly-CSharp.csproj b/Assembly-CSharp.csproj index a143a67..435cb55 100644 --- a/Assembly-CSharp.csproj +++ b/Assembly-CSharp.csproj @@ -169,6 +169,7 @@ + diff --git a/Assets/Scripts/Controller/UI/InfoImageController.cs b/Assets/Scripts/Controller/UI/InfoImageController.cs index 1567506..765a89c 100644 --- a/Assets/Scripts/Controller/UI/InfoImageController.cs +++ b/Assets/Scripts/Controller/UI/InfoImageController.cs @@ -15,8 +15,10 @@ public class InfoImageController : MonoBehaviour } public void SetText(string text) - { - _infoText.text = text; + { + _animator = GetComponent(); + _infoText = GetComponentInChildren(); + _infoText.text = text; } public void DestroySelf() diff --git a/Assets/Scripts/Event/Item/EventItemOther3.cs b/Assets/Scripts/Event/Item/EventItemOther3.cs index 9ac16fa..c3eb0b2 100644 --- a/Assets/Scripts/Event/Item/EventItemOther3.cs +++ b/Assets/Scripts/Event/Item/EventItemOther3.cs @@ -8,6 +8,14 @@ public class EventItemOther3 : MonoBehaviour, IInteraction // 对称飞行 public bool Interaction() { + //暂时禁用 + switch (GameManager.Instance.LevelManager.Level) + { + case 40: + GameManager.Instance.UIManager.ShowInfo("BOSS层无法使用"); + break; + } + // 获取对称坐标 Vector2 point = GameManager.Instance.PlayerManager.PlayerController.transform.position * -1; // 判断坐标是否可以传送 diff --git a/Assets/Scripts/Event/Level/EventLevel12Actor3.cs b/Assets/Scripts/Event/Level/EventLevel12Actor3.cs index 4053dd9..e6fa81f 100644 --- a/Assets/Scripts/Event/Level/EventLevel12Actor3.cs +++ b/Assets/Scripts/Event/Level/EventLevel12Actor3.cs @@ -1,65 +1,14 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - public class EventLevel12Actor3 : ActorController { - public override bool Interaction() - { - // 打开商店界面 - GameManager.Instance.EventManager.OnShopShow?.Invoke(GetComponent().Name, 50, ShopShowCallback); - return false; - } - - /// - /// 打开商店回调 - /// - private void ShopShowCallback() - { - // 判断金币是否足够 - if (GameManager.Instance.PlayerManager.PlayerInfo.Gold < 50) - { - GameManager.Instance.UIManager.ShowInfo($"不会有人连 50 金币都没有吧!"); - // 音频播放 - GameManager.Instance.SoundManager.PlaySound(ESoundType.Effect, "No"); - return; - } - GameManager.Instance.PlayerManager.PlayerInfo.Gold -= 50; - // 随机一个属性 - ERandomShopType type = ERandomShopType.Health; - int randomNumber = Random.Range(0, 100); - if (randomNumber <= 30) type = ERandomShopType.Health; - else if (randomNumber > 30 && randomNumber <= 60) type = ERandomShopType.Attack; - else if (randomNumber > 60 && randomNumber <= 90) type = ERandomShopType.Defence; - else type = ERandomShopType.Gold; - // 随机数值 - switch (type) - { - case ERandomShopType.Health: - randomNumber = Random.Range(100, 400); - GameManager.Instance.PlayerManager.PlayerInfo.Health += randomNumber; - GameManager.Instance.UIManager.ShowInfo($"获得 {randomNumber} 点生命值提升!"); - break; - case ERandomShopType.Attack: - randomNumber = Random.Range(4, 20); - GameManager.Instance.PlayerManager.PlayerInfo.Attack += randomNumber; - GameManager.Instance.UIManager.ShowInfo($"获得 {randomNumber} 点攻击力提升!"); - break; - case ERandomShopType.Defence: - randomNumber = Random.Range(4, 20); - GameManager.Instance.PlayerManager.PlayerInfo.Defence += randomNumber; - GameManager.Instance.UIManager.ShowInfo($"获得 {randomNumber} 点防御力提升!"); - break; - case ERandomShopType.Gold: - randomNumber = Random.Range(40, 200); - GameManager.Instance.PlayerManager.PlayerInfo.Gold += randomNumber; - GameManager.Instance.UIManager.ShowInfo($"运气爆棚!获得 {randomNumber} 金币!"); - break; - default: - print("商店随机了个什么玩意儿?"); - break; - } - // 音频播放 - GameManager.Instance.SoundManager.PlaySound(ESoundType.Effect, "Yes"); - } + ShopComm.E_ShopFloor floor = ShopComm.E_ShopFloor.F12; + public override bool Interaction() + { + // 打开商店界面 + GameManager.Instance.EventManager.OnShopShow?.Invoke(GetComponent().Name, floor, + this, + () => ShopComm.BuyHP(floor), + () => ShopComm.BuyAtk(floor), + () => ShopComm.BuyDef(floor)); + return false; + } } diff --git a/Assets/Scripts/Event/Level/EventLevel28Actor1.cs b/Assets/Scripts/Event/Level/EventLevel28Actor1.cs index 516b45e..4ca4563 100644 --- a/Assets/Scripts/Event/Level/EventLevel28Actor1.cs +++ b/Assets/Scripts/Event/Level/EventLevel28Actor1.cs @@ -6,6 +6,31 @@ public class EventLevel28Actor1 : ActorController { public override bool Interaction() { + + GameManager.Instance.UIManager.ShowInteractionDialog(GetComponent().Name, "我按100个金币一把的价格回收黄钥匙,你出售吗?", "成交!", "算了吧", () => + { + if (GameManager.Instance.BackpackManager.ConsumeItem(1)) + { + GameManager.Instance.PlayerManager.PlayerInfo.Gold += 100; + + GameManager.Instance.UIManager.ShowInfo("失去黄色钥匙x1"); + GameManager.Instance.UIManager.ShowInfo("获得100金币"); + // 打开人物控制器 + GameManager.Instance.PlayerManager.Enable = true; + // 音频播放 + GameManager.Instance.SoundManager.PlaySound(ESoundType.Effect, "Yes"); + } + else + { + GameManager.Instance.UIManager.ShowInfo("你没有黄钥匙"); + // 打开人物控制器 + GameManager.Instance.PlayerManager.Enable = true; + } + + }); + return false; + + /* GameManager.Instance.UIManager.ShowInteractionDialog(GetComponent().Name, "我会随机赋予你属性,但同样我也会收取你一部分属性,你确定要试试吗?", "谁怕谁", "我走了", () => { // 随机两个属性 @@ -63,5 +88,6 @@ public class EventLevel28Actor1 : ActorController GameManager.Instance.SoundManager.PlaySound(ESoundType.Effect, "Yes"); }); return false; - } + */ + } } diff --git a/Assets/Scripts/Event/Level/EventLevel32Actor1.cs b/Assets/Scripts/Event/Level/EventLevel32Actor1.cs index 59851d9..6a12e54 100644 --- a/Assets/Scripts/Event/Level/EventLevel32Actor1.cs +++ b/Assets/Scripts/Event/Level/EventLevel32Actor1.cs @@ -1,65 +1,14 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - public class EventLevel32Actor1 : ActorController { - public override bool Interaction() - { - // 打开商店界面 - GameManager.Instance.EventManager.OnShopShow?.Invoke(GetComponent().Name, 100, ShopShowCallback); - return false; - } - - /// - /// 打开商店回调 - /// - private void ShopShowCallback() - { - // 判断金币是否足够 - if (GameManager.Instance.PlayerManager.PlayerInfo.Gold < 100) - { - GameManager.Instance.UIManager.ShowInfo($"不会有人连 100 金币都没有吧!"); - // 音频播放 - GameManager.Instance.SoundManager.PlaySound(ESoundType.Effect, "No"); - return; - } - GameManager.Instance.PlayerManager.PlayerInfo.Gold -= 100; - // 随机一个属性 - ERandomShopType type = ERandomShopType.Health; - int randomNumber = Random.Range(0, 100); - if (randomNumber <= 30) type = ERandomShopType.Health; - else if (randomNumber > 30 && randomNumber <= 60) type = ERandomShopType.Attack; - else if (randomNumber > 60 && randomNumber <= 90) type = ERandomShopType.Defence; - else type = ERandomShopType.Gold; - // 随机数值 - switch (type) - { - case ERandomShopType.Health: - randomNumber = Random.Range(200, 800); - GameManager.Instance.PlayerManager.PlayerInfo.Health += randomNumber; - GameManager.Instance.UIManager.ShowInfo($"获得 {randomNumber} 点生命值提升!"); - break; - case ERandomShopType.Attack: - randomNumber = Random.Range(8, 40); - GameManager.Instance.PlayerManager.PlayerInfo.Attack += randomNumber; - GameManager.Instance.UIManager.ShowInfo($"获得 {randomNumber} 点攻击力提升!"); - break; - case ERandomShopType.Defence: - randomNumber = Random.Range(8, 40); - GameManager.Instance.PlayerManager.PlayerInfo.Defence += randomNumber; - GameManager.Instance.UIManager.ShowInfo($"获得 {randomNumber} 点防御力提升!"); - break; - case ERandomShopType.Gold: - randomNumber = Random.Range(80, 400); - GameManager.Instance.PlayerManager.PlayerInfo.Gold += randomNumber; - GameManager.Instance.UIManager.ShowInfo($"运气爆棚!获得 {randomNumber} 金币!"); - break; - default: - print("商店随机了个什么玩意儿?"); - break; - } - // 音频播放 - GameManager.Instance.SoundManager.PlaySound(ESoundType.Effect, "Yes"); - } + ShopComm.E_ShopFloor floor = ShopComm.E_ShopFloor.F32; + public override bool Interaction() + { + // 打开商店界面 + GameManager.Instance.EventManager.OnShopShow?.Invoke(GetComponent().Name, floor, + this, + () => ShopComm.BuyHP(floor), + () => ShopComm.BuyAtk(floor), + () => ShopComm.BuyDef(floor)); + return false; + } } diff --git a/Assets/Scripts/Event/Level/EventLevel46Actor2.cs b/Assets/Scripts/Event/Level/EventLevel46Actor2.cs index c9cffdf..2fca807 100644 --- a/Assets/Scripts/Event/Level/EventLevel46Actor2.cs +++ b/Assets/Scripts/Event/Level/EventLevel46Actor2.cs @@ -1,65 +1,14 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - public class EventLevel46Actor2 : ActorController { - public override bool Interaction() - { - // 打开商店界面 - GameManager.Instance.EventManager.OnShopShow?.Invoke(GetComponent().Name, 200, ShopShowCallback); - return false; - } - - /// - /// 打开商店回调 - /// - private void ShopShowCallback() - { - // 判断金币是否足够 - if (GameManager.Instance.PlayerManager.PlayerInfo.Gold < 200) - { - GameManager.Instance.UIManager.ShowInfo($"不会有人连 200 金币都没有吧!"); - // 音频播放 - GameManager.Instance.SoundManager.PlaySound(ESoundType.Effect, "No"); - return; - } - GameManager.Instance.PlayerManager.PlayerInfo.Gold -= 200; - // 随机一个属性 - ERandomShopType type = ERandomShopType.Health; - int randomNumber = Random.Range(0, 100); - if (randomNumber <= 30) type = ERandomShopType.Health; - else if (randomNumber > 30 && randomNumber <= 60) type = ERandomShopType.Attack; - else if (randomNumber > 60 && randomNumber <= 90) type = ERandomShopType.Defence; - else type = ERandomShopType.Gold; - // 随机数值 - switch (type) - { - case ERandomShopType.Health: - randomNumber = Random.Range(400, 1600); - GameManager.Instance.PlayerManager.PlayerInfo.Health += randomNumber; - GameManager.Instance.UIManager.ShowInfo($"获得 {randomNumber} 点生命值提升!"); - break; - case ERandomShopType.Attack: - randomNumber = Random.Range(16, 80); - GameManager.Instance.PlayerManager.PlayerInfo.Attack += randomNumber; - GameManager.Instance.UIManager.ShowInfo($"获得 {randomNumber} 点攻击力提升!"); - break; - case ERandomShopType.Defence: - randomNumber = Random.Range(16, 80); - GameManager.Instance.PlayerManager.PlayerInfo.Defence += randomNumber; - GameManager.Instance.UIManager.ShowInfo($"获得 {randomNumber} 点防御力提升!"); - break; - case ERandomShopType.Gold: - randomNumber = Random.Range(160, 800); - GameManager.Instance.PlayerManager.PlayerInfo.Gold += randomNumber; - GameManager.Instance.UIManager.ShowInfo($"运气爆棚!获得 {randomNumber} 金币!"); - break; - default: - print("商店随机了个什么玩意儿?"); - break; - } - // 音频播放 - GameManager.Instance.SoundManager.PlaySound(ESoundType.Effect, "Yes"); - } + ShopComm.E_ShopFloor floor = ShopComm.E_ShopFloor.F46; + public override bool Interaction() + { + // 打开商店界面 + GameManager.Instance.EventManager.OnShopShow?.Invoke(GetComponent().Name, floor, + this, + () => ShopComm.BuyHP(floor), + () => ShopComm.BuyAtk(floor), + () => ShopComm.BuyDef(floor)); + return false; + } } diff --git a/Assets/Scripts/Event/Level/EventLevel4Actor1.cs b/Assets/Scripts/Event/Level/EventLevel4Actor1.cs index 9321128..c9e176e 100644 --- a/Assets/Scripts/Event/Level/EventLevel4Actor1.cs +++ b/Assets/Scripts/Event/Level/EventLevel4Actor1.cs @@ -1,7 +1,3 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - public enum ERandomShopType { Health, @@ -12,62 +8,15 @@ public enum ERandomShopType public class EventLevel4Actor1 : ActorController { - public override bool Interaction() + ShopComm.E_ShopFloor floor = ShopComm.E_ShopFloor.F4; + public override bool Interaction() { - // 打开商店界面 - GameManager.Instance.EventManager.OnShopShow?.Invoke(GetComponent().Name, 25, ShopShowCallback); - return false; - } - - /// - /// 打开商店回调 - /// - private void ShopShowCallback() - { - // 判断金币是否足够 - if (GameManager.Instance.PlayerManager.PlayerInfo.Gold < 25) - { - GameManager.Instance.UIManager.ShowInfo($"不会有人连 25 金币都没有吧!"); - // 音频播放 - GameManager.Instance.SoundManager.PlaySound(ESoundType.Effect, "No"); - return; - } - GameManager.Instance.PlayerManager.PlayerInfo.Gold -= 25; - // 随机一个属性 - ERandomShopType type = ERandomShopType.Health; - int randomNumber = Random.Range(0, 100); - if (randomNumber <= 30) type = ERandomShopType.Health; - else if (randomNumber > 30 && randomNumber <= 60) type = ERandomShopType.Attack; - else if (randomNumber > 60 && randomNumber <= 90) type = ERandomShopType.Defence; - else type = ERandomShopType.Gold; - // 随机数值 - switch (type) - { - case ERandomShopType.Health: - randomNumber = Random.Range(50, 200); - GameManager.Instance.PlayerManager.PlayerInfo.Health += randomNumber; - GameManager.Instance.UIManager.ShowInfo($"获得 {randomNumber} 点生命值提升!"); - break; - case ERandomShopType.Attack: - randomNumber = Random.Range(2, 10); - GameManager.Instance.PlayerManager.PlayerInfo.Attack += randomNumber; - GameManager.Instance.UIManager.ShowInfo($"获得 {randomNumber} 点攻击力提升!"); - break; - case ERandomShopType.Defence: - randomNumber = Random.Range(2, 10); - GameManager.Instance.PlayerManager.PlayerInfo.Defence += randomNumber; - GameManager.Instance.UIManager.ShowInfo($"获得 {randomNumber} 点防御力提升!"); - break; - case ERandomShopType.Gold: - randomNumber = Random.Range(20, 100); - GameManager.Instance.PlayerManager.PlayerInfo.Gold += randomNumber; - GameManager.Instance.UIManager.ShowInfo($"运气爆棚!获得 {randomNumber} 金币!"); - break; - default: - print("商店随机了个什么玩意儿?"); - break; - } - // 音频播放 - GameManager.Instance.SoundManager.PlaySound(ESoundType.Effect, "Yes"); + // 打开商店界面 + GameManager.Instance.EventManager.OnShopShow?.Invoke(GetComponent().Name, floor, + this, + () => ShopComm.BuyHP(floor), + () => ShopComm.BuyAtk(floor), + () => ShopComm.BuyDef(floor)); + return false; } } diff --git a/Assets/Scripts/Event/Level/ShopComm.cs b/Assets/Scripts/Event/Level/ShopComm.cs new file mode 100644 index 0000000..6fdb601 --- /dev/null +++ b/Assets/Scripts/Event/Level/ShopComm.cs @@ -0,0 +1,111 @@ +using System.Collections.Generic; +using UnityEngine; + + +public class ShopComm +{ + /* + 初始价格是20金币,购买后会涨价,第n次购买所需金币10n*(n-1)+20 +4层商店每次加2点攻或4点防 +12层商店每次加4点攻或8点防 +32层商店每次加8点攻或16点防 +46层商店每次加10点攻或20点防 + */ + public enum E_ShopFloor + { + F4, + F12, + F32, + F46 + } + public class FloorShopInfo + { + public E_ShopFloor Floor; + public int AddHP; + public int AddAtk; + public int AddDef; + } + + static Dictionary dictShopFloor = new Dictionary() + { + { E_ShopFloor.F4,new FloorShopInfo(){Floor = E_ShopFloor.F4,AddAtk = 2,AddDef = 4 ,AddHP = 100}}, + { E_ShopFloor.F12,new FloorShopInfo(){Floor = E_ShopFloor.F4,AddAtk = 4,AddDef = 8,AddHP = 100 }}, + { E_ShopFloor.F32,new FloorShopInfo(){Floor = E_ShopFloor.F4,AddAtk = 8,AddDef = 16,AddHP = 100 }}, + { E_ShopFloor.F46,new FloorShopInfo(){Floor = E_ShopFloor.F4,AddAtk = 10,AddDef = 20,AddHP = 100 }}, + }; + + public static FloorShopInfo GetFloorShopInfo(E_ShopFloor floor) + { + return dictShopFloor[floor]; + } + public static int GetShopNeedMoney(E_ShopFloor floor) + { + int BuyNum = 0; + switch (floor) + { + case E_ShopFloor.F4: BuyNum = GameManager.Instance.PlayerManager.PlayerInfo.StoreBuyNum_F4; break; + case E_ShopFloor.F12: BuyNum = GameManager.Instance.PlayerManager.PlayerInfo.StoreBuyNum_F12; break; + case E_ShopFloor.F32: BuyNum = GameManager.Instance.PlayerManager.PlayerInfo.StoreBuyNum_F32; break; + case E_ShopFloor.F46: BuyNum = GameManager.Instance.PlayerManager.PlayerInfo.StoreBuyNum_F46; break; + } + return (10 * BuyNum * (BuyNum - 1) + 20); + } + public static bool CheckMoney(E_ShopFloor floor) + { + int needMoney = GetShopNeedMoney(floor); + // 判断金币是否足够 + if (GameManager.Instance.PlayerManager.PlayerInfo.Gold < needMoney) + { + GameManager.Instance.UIManager.ShowInfo($"不会有人连 {needMoney} 金币都没有吧!"); + // 音频播放 + GameManager.Instance.SoundManager.PlaySound(ESoundType.Effect, "No"); + return false; + } + return true; + } + public static void SetShopUseMoney(E_ShopFloor floor) + { + int needMoney = GetShopNeedMoney(floor); + GameManager.Instance.PlayerManager.PlayerInfo.Gold -= needMoney; + + //追加购买次数 + switch (floor) + { + case E_ShopFloor.F4: GameManager.Instance.PlayerManager.PlayerInfo.StoreBuyNum_F4++; break; + case E_ShopFloor.F12: GameManager.Instance.PlayerManager.PlayerInfo.StoreBuyNum_F12++; break; + case E_ShopFloor.F32: GameManager.Instance.PlayerManager.PlayerInfo.StoreBuyNum_F32++; break; + case E_ShopFloor.F46: GameManager.Instance.PlayerManager.PlayerInfo.StoreBuyNum_F46++; break; + } + + } + public static void BuyHP(E_ShopFloor floor) + { + if (!CheckMoney(floor)) + return; + SetShopUseMoney(floor); + int hp = dictShopFloor[floor].AddHP; + GameManager.Instance.PlayerManager.PlayerInfo.Health += hp; + GameManager.Instance.UIManager.ShowInfo($"获得 {hp} 点生命值提升!"); + // 音频播放 + GameManager.Instance.SoundManager.PlaySound(ESoundType.Effect, "Yes"); + } + public static void BuyAtk(E_ShopFloor floor) + { + if (!CheckMoney(floor)) + return; + SetShopUseMoney(floor); + int atk = dictShopFloor[floor].AddAtk; + GameManager.Instance.PlayerManager.PlayerInfo.Attack += atk; + GameManager.Instance.UIManager.ShowInfo($"获得 {atk} 点攻击力提升!"); + } + public static void BuyDef(E_ShopFloor floor) + { + if (!CheckMoney(floor)) + return; + SetShopUseMoney(floor); + int def = dictShopFloor[floor].AddDef; + GameManager.Instance.PlayerManager.PlayerInfo.Defence += def; + GameManager.Instance.UIManager.ShowInfo($"获得 {def} 点防御力提升!"); + } + +} \ No newline at end of file diff --git a/Assets/Scripts/Event/Level/ShopComm.cs.meta b/Assets/Scripts/Event/Level/ShopComm.cs.meta new file mode 100644 index 0000000..9ac13c3 --- /dev/null +++ b/Assets/Scripts/Event/Level/ShopComm.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 289293a7d8170934dbba5f74dc889cc6 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Manager/EventManager.cs b/Assets/Scripts/Manager/EventManager.cs index 18e54c9..e08d239 100644 --- a/Assets/Scripts/Manager/EventManager.cs +++ b/Assets/Scripts/Manager/EventManager.cs @@ -2,6 +2,7 @@ using System; using System.Collections; using System.Collections.Generic; using UnityEngine; +using static ShopComm; public class EventManager : Singleton { @@ -74,15 +75,16 @@ public class EventManager : Singleton /// public Action OnResourceLoaded; - /// - /// 打开商店事件 - /// - public Action OnShopShow; + /// + /// 打开商店事件 + /// + public Action OnShopShow; + //public Action OnShopShow; - /// - /// 法老权杖上楼事件 - /// - public Action OnArtifactUp; + /// + /// 法老权杖上楼事件 + /// + public Action OnArtifactUp; /// /// 法老权杖下楼事件 /// diff --git a/Assets/Scripts/Manager/PlayerManager.cs b/Assets/Scripts/Manager/PlayerManager.cs index 8032a8a..f98f062 100644 --- a/Assets/Scripts/Manager/PlayerManager.cs +++ b/Assets/Scripts/Manager/PlayerManager.cs @@ -35,7 +35,16 @@ public class PlayerInfo [SerializeField] private string _notepadInfo; - public int Health + [SerializeField] + public int StoreBuyNum_F4 = 1; + [SerializeField] + public int StoreBuyNum_F12 = 1; + [SerializeField] + public int StoreBuyNum_F32 = 1; + [SerializeField] + public int StoreBuyNum_F46 = 1; + + public int Health { get => _health; set diff --git a/Assets/Scripts/Manager/ResourceManager.cs b/Assets/Scripts/Manager/ResourceManager.cs index f33f45e..916dba6 100644 --- a/Assets/Scripts/Manager/ResourceManager.cs +++ b/Assets/Scripts/Manager/ResourceManager.cs @@ -51,6 +51,11 @@ public class GameInfo public int MaxLevelInfo; public string BackpackInfo; public string PlotInfo; + //每个层商店购买次数 + public int StoreBuyNum_F4 = 0; + public int StoreBuyNum_F12 = 0; + public int StoreBuyNum_F32 = 0; + public int StoreBuyNum_F46 = 0; } public class ResourceManager : Singleton @@ -357,7 +362,8 @@ public class ResourceManager : Singleton MaxLevelInfo = GameManager.Instance.LevelManager.MaxLevel, BackpackInfo = JsonUtility.ToJson(new Serialization(GameManager.Instance.BackpackManager.BackpackDictionary)), PlotInfo = JsonUtility.ToJson(new Serialization(GameManager.Instance.PlotManager.PlotDictionary)), - }; + + }; // 保存资源信息 PlayerPrefs.SetString("GameInfo", JsonUtility.ToJson(gameInfo)); // UI 提示 diff --git a/Assets/Scripts/Manager/UIManager.cs b/Assets/Scripts/Manager/UIManager.cs index c4e5d18..c42d104 100644 --- a/Assets/Scripts/Manager/UIManager.cs +++ b/Assets/Scripts/Manager/UIManager.cs @@ -44,8 +44,14 @@ public class UIManager : MonoSingleton private GameObject _shopPanel; private Text _shopNameValueText; private Text _shopInfoValueText; - private Button _shopYesButton; - private Button _shopNoButton; + private Button _shopAddHPButton; + private Text _shopAddHPButtonText; + private Button _shopAddAtkButton; + private Text _shopAddAtkButtonText; + private Button _shopAddDefButton; + private Text _shopAddDefButtonText; + + private Button _shopNoButton; private GameObject _infoPanel; @@ -117,8 +123,13 @@ public class UIManager : MonoSingleton _shopPanel = MainCanvas.transform.Find("ShopPanel").gameObject; _shopNameValueText = _shopPanel.transform.Find("ShopNameValueText").GetComponent(); _shopInfoValueText = _shopPanel.transform.Find("ShopValueText").GetComponent(); - _shopYesButton = _shopPanel.transform.Find("YesButton").GetComponent