Cute_demon_attacks/meng_yao/Assets/script/Player/PlayerManager.cs

83 lines
2.0 KiB
C#
Raw Normal View History

2024-10-30 21:49:13 +08:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public enum MoneyType {
Stones,//<2F><>ʯ
Forging,//<2F><><EFBFBD><EFBFBD>
Coins,//<2F><><EFBFBD><EFBFBD>
Ore//<2F><>ʯ
}
public class PlayerManager
{
private static PlayerManager _instance;
public static PlayerManager Instance
{
get
{
if (_instance == null)
{
_instance = new PlayerManager();
}
return _instance;
}
}
public float Stones = 100;
public float Forging = 100;
public float Coins = 100;
public float Ore = 100;
public void SetMoney(MoneyType type,float num)
{
switch (type)
{
case MoneyType.Stones:
if ((Stones + num) < 0)
{
Promptmgr.Instance.PromptBubble("שʯ<D7A9><CAAF><EFBFBD><EFBFBD><E3A3A1><EFBFBD><EFBFBD>",Color.black,Color.red);
return;
}
Stones += num;
AssestPanel.instance.SetStoneText(Stones);
break;
case MoneyType.Forging:
if((Forging + num) < 0)
{
Promptmgr.Instance.PromptBubble("<22><><EFBFBD><EFBFBD><EFBFBD>Ҳ<EFBFBD><D2B2><EFBFBD><E3A3A1><EFBFBD><EFBFBD>", Color.black, Color.red);
return;
}
Forging += num;
AssestPanel.instance.SetForgingText(Forging);
break;
case MoneyType.Coins:
if ((Coins + num) < 0)
{
Promptmgr.Instance.PromptBubble("<22><><EFBFBD><EFBFBD><EFBFBD>Ҳ<EFBFBD><D2B2><EFBFBD><E3A3A1><EFBFBD><EFBFBD>", Color.black, Color.red);
return;
}
Coins += num;
AssestPanel.instance.SetCoinText(Coins);
break;
case MoneyType.Ore:
if ((Ore + num) < 0)
{
Promptmgr.Instance.PromptBubble("<22><>ʯ<EFBFBD><CAAF><EFBFBD><EFBFBD><E3A3A1><EFBFBD><EFBFBD>", Color.black, Color.red);
return;
}
Ore += num;
AssestPanel.instance.SetOreText(Ore);
break;
}
}
}