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;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-11-07 14:20:59 +08:00
|
|
|
|
public float Stones = 10000;
|
|
|
|
|
public float Forging = 10000;
|
|
|
|
|
public float Coins = 10000;
|
|
|
|
|
public float Ore = 10000;
|
2024-10-30 21:49:13 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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;
|
2024-11-05 14:29:51 +08:00
|
|
|
|
Promptmgr.assestPanel.SetStoneText(Stones);
|
2024-10-30 21:49:13 +08:00
|
|
|
|
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;
|
2024-11-05 14:29:51 +08:00
|
|
|
|
Promptmgr.assestPanel.SetForgingText(Forging);
|
2024-10-30 21:49:13 +08:00
|
|
|
|
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;
|
2024-11-05 14:29:51 +08:00
|
|
|
|
Promptmgr.assestPanel.SetCoinText(Coins);
|
2024-10-30 21:49:13 +08:00
|
|
|
|
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;
|
2024-11-05 14:29:51 +08:00
|
|
|
|
Promptmgr.assestPanel.SetOreText(Ore);
|
2024-10-30 21:49:13 +08:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-10-30 23:18:31 +08:00
|
|
|
|
|
|
|
|
|
public float GetNumer(MoneyType type)
|
|
|
|
|
{
|
|
|
|
|
switch (type)
|
|
|
|
|
{
|
|
|
|
|
case MoneyType.Stones:
|
|
|
|
|
return Stones;
|
|
|
|
|
case MoneyType.Forging:
|
|
|
|
|
return Forging;
|
|
|
|
|
case MoneyType.Coins:
|
|
|
|
|
return Coins;
|
|
|
|
|
case MoneyType.Ore:
|
|
|
|
|
return Ore;
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|