|
@@ -9,130 +9,11 @@ using System.Collections.Generic;
|
|
|
|
|
|
using Random = UnityEngine.Random;
|
|
|
|
|
|
-public class Sign
|
|
|
-{
|
|
|
- public int Coin;
|
|
|
- public int Diamond;
|
|
|
- public Text Lab1;
|
|
|
- public Text Lab2;
|
|
|
- public Image Icon;
|
|
|
- public Image Mark;
|
|
|
- public List<int> FlowerList;
|
|
|
-
|
|
|
- public Sign(int index, Transform tra, XmlAttributeCollection attribute)
|
|
|
- {
|
|
|
- Dictionary<string, Transform> dic = new Dictionary<string, Transform>();
|
|
|
-
|
|
|
- Auxiliary.CompileDic(tra, dic);
|
|
|
-
|
|
|
- Lab1 = dic["Lab1"].GetComponent<Text>();
|
|
|
- Lab2 = dic["Lab2"].GetComponent<Text>();
|
|
|
- Icon = dic["Icon1"].GetComponent<Image>();
|
|
|
- Mark = dic["Icon2"].GetComponent<Image>();
|
|
|
-
|
|
|
- Lab2.text = index.ToString();
|
|
|
-
|
|
|
- if (!string.IsNullOrEmpty(attribute[1].Value))
|
|
|
- {
|
|
|
- FlowerList = new List<int>();
|
|
|
-
|
|
|
- string[] strings = attribute[1].Value.Split(',');
|
|
|
-
|
|
|
- for (int i = 0; i < strings.Length; i++)
|
|
|
- {
|
|
|
- FlowerList.Add(int.Parse(strings[i]));
|
|
|
- }
|
|
|
-
|
|
|
- Icon.sprite = ManaReso.Load<Sprite>("管理花园按钮", Folder.UI);
|
|
|
- }
|
|
|
-
|
|
|
- if (!string.IsNullOrEmpty(attribute[2].Value))
|
|
|
- {
|
|
|
- Diamond = int.Parse(attribute[2].Value);
|
|
|
-
|
|
|
- if (FlowerList == null)
|
|
|
- {
|
|
|
- Lab1.text = Diamond.ToString("0");
|
|
|
-
|
|
|
- Icon.sprite = ManaReso.Load<Sprite>("钻石", Folder.UI);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- if (!string.IsNullOrEmpty(attribute[3].Value))
|
|
|
- {
|
|
|
- Coin = int.Parse(attribute[3].Value);
|
|
|
-
|
|
|
- Lab1.text = Coin.ToString("0");
|
|
|
-
|
|
|
- Icon.sprite = ManaReso.Load<Sprite>("金币", Folder.UI);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- public void Get()
|
|
|
- {
|
|
|
- Mark.SetActive(true);
|
|
|
-
|
|
|
- if (FlowerList != null)
|
|
|
- {
|
|
|
- for (int i = 0; i < FlowerList.Count; i++)
|
|
|
- {
|
|
|
- if (ManaGarden.FlowerInfoList[FlowerList[i]].Unlock == false)
|
|
|
- {
|
|
|
- ManaGarden.FlowerInfoList[FlowerList[i]].Unlock = true;
|
|
|
-
|
|
|
- if (ManaData.Sign < 20)
|
|
|
- {
|
|
|
- ManaData.Sign++;
|
|
|
- }
|
|
|
-
|
|
|
- ManaReso.SetText("Bb_InfoLab", Language.GetStr("FlowerName", "Flower" + FlowerList[i]));
|
|
|
-
|
|
|
- ManaReso.SetSprite("Bb_Info", ManaReso.Load<Sprite>("管理花园按钮", Folder.UI));
|
|
|
-
|
|
|
- return;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- if (Diamond > 0)
|
|
|
- {
|
|
|
- if (ManaData.Sign < 27)
|
|
|
- {
|
|
|
- ManaData.Sign++;
|
|
|
- }
|
|
|
-
|
|
|
- ManaData.Diamond += Diamond;
|
|
|
-
|
|
|
- ManaReso.SetText("Bb_InfoLab", Diamond.ToString());
|
|
|
-
|
|
|
- ManaReso.SetSprite("Bb_Info", ManaReso.Load<Sprite>("钻石", Folder.UI));
|
|
|
- }
|
|
|
- else if (Coin > 0)
|
|
|
- {
|
|
|
- if (ManaData.Sign < 27)
|
|
|
- {
|
|
|
- ManaData.Sign++;
|
|
|
- }
|
|
|
-
|
|
|
- ManaData.Coin += Coin;
|
|
|
-
|
|
|
- ManaReso.SetText("Bb_InfoLab", Coin.ToString());
|
|
|
-
|
|
|
- ManaReso.SetSprite("Bb_Info", ManaReso.Load<Sprite>("金币", Folder.UI));
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- throw new Exception();
|
|
|
- }
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
public class ManaUI : Regist
|
|
|
{
|
|
|
#region 变量
|
|
|
|
|
|
- public static List<Sign> SignList;
|
|
|
+
|
|
|
|
|
|
#endregion
|
|
|
|
|
@@ -194,7 +75,7 @@ public class ManaUI : Regist
|
|
|
"Bb_Get",
|
|
|
() =>
|
|
|
{
|
|
|
- SignList[ManaData.Sign].Get();
|
|
|
+ ManaSign.Get();
|
|
|
|
|
|
ManaReso.SetActive("Bb_Get", false);
|
|
|
ManaReso.SetActive("Bb_Info", true);
|
|
@@ -209,24 +90,6 @@ public class ManaUI : Regist
|
|
|
|
|
|
ManaReso.Get("Bb_SignIn").CreateTweenCG(0f, 1f, 0.5f, false, true, Curve.EaseOutQuad);
|
|
|
|
|
|
- Transform tra = ManaReso.Get("Bb_Grid");
|
|
|
-
|
|
|
- List<XmlAttributeCollection> attributeList = Data.GetSignConfig();
|
|
|
-
|
|
|
- SignList = new List<Sign>();
|
|
|
-
|
|
|
- for (int i = 0; i < attributeList.Count; i++)
|
|
|
- {
|
|
|
- Transform tra1 = ManaReso.Get("SignInItem", Folder.UI, false, tra, false);
|
|
|
-
|
|
|
- SignList.Add(new Sign(i + 1, tra1, attributeList[i]));
|
|
|
- }
|
|
|
-
|
|
|
- for (int i = 0; i < ManaData.Sign; i++)
|
|
|
- {
|
|
|
- tra.GetChild(i).GetChild(1).SetActive(true);
|
|
|
- }
|
|
|
-
|
|
|
#endregion
|
|
|
|
|
|
#region Bb_Confirm
|