|
@@ -18,6 +18,8 @@ public class ManaData : MonoBehaviour
|
|
|
|
|
|
UpdateSkillStatus();
|
|
|
|
|
|
+ Data.SaveConfig("Level", _Level.ToString());
|
|
|
+
|
|
|
ManaLog.Log(string.Format("已升级 花园等级 : <color=red>{0}</color>", _Level));
|
|
|
}
|
|
|
}
|
|
@@ -29,6 +31,8 @@ public class ManaData : MonoBehaviour
|
|
|
_Person = value;
|
|
|
|
|
|
ManaReso.SetText("F_PersonLab", _Person.ToString("0"));
|
|
|
+
|
|
|
+ Data.SaveConfig("Person", _Person.ToString("0"));
|
|
|
}
|
|
|
}
|
|
|
public static float CoinPerson
|
|
@@ -39,6 +43,8 @@ public class ManaData : MonoBehaviour
|
|
|
_CoinPerson = value;
|
|
|
|
|
|
ManaReso.SetText("F_CoinPersonLab", _CoinPerson.ToString("0"));
|
|
|
+
|
|
|
+ Data.SaveConfig("CoinPerson", _CoinPerson.ToString("0"));
|
|
|
}
|
|
|
}
|
|
|
public static double Coin
|
|
@@ -50,6 +56,8 @@ public class ManaData : MonoBehaviour
|
|
|
|
|
|
ManaReso.SetText("F_CoinLab", _Coin.ToString("0"));
|
|
|
ManaReso.SetText("C_CoinLab", _Coin.ToString("0"));
|
|
|
+
|
|
|
+ Data.SaveConfig("Coin", _Coin.ToString("0"));
|
|
|
}
|
|
|
}
|
|
|
public static double Diamond
|
|
@@ -60,6 +68,8 @@ public class ManaData : MonoBehaviour
|
|
|
_Diamond = value;
|
|
|
|
|
|
ManaReso.SetText("F_DiamondLab", _Diamond.ToString("0"));
|
|
|
+
|
|
|
+ Data.SaveConfig("Diamond", _Diamond.ToString("0"));
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -69,20 +79,21 @@ public class ManaData : MonoBehaviour
|
|
|
private static double _Coin;
|
|
|
private static double _Diamond;
|
|
|
|
|
|
- public static float Circle; //收入周期
|
|
|
public static bool SkillBarValid; //是否有已解锁的大技能
|
|
|
+ public static double Circle; //收入周期
|
|
|
+ public static double CircleTimer;
|
|
|
+ public static double OfflineCoin; //离线收入
|
|
|
public static List<Skill> CoolList; //冷却中的技能
|
|
|
public static List<SkillRoot> SkillList;
|
|
|
public static List<SkillRoot> ProcessList; //正在使用的技能
|
|
|
public static Dictionary<string, SkillRoot> SkillDic;
|
|
|
|
|
|
- public static float SkillPlus;
|
|
|
public static float SkillPerson; //技能增益
|
|
|
+ public static float SkillPlusPerm; //技能增益
|
|
|
+ public static float SkillPlusTemp; //技能增益
|
|
|
public static float SkillPersonBuff; //技能增益
|
|
|
public static float SkillCoinPerson; //技能增益
|
|
|
- public static float SkillCoinPersonBuff; //技能增益
|
|
|
|
|
|
- private static float Timer;
|
|
|
private static float NewPerson;
|
|
|
private static float NewCoinPerson;
|
|
|
|
|
@@ -158,19 +169,21 @@ public class ManaData : MonoBehaviour
|
|
|
{
|
|
|
#region 计算参观收益
|
|
|
|
|
|
- Timer += Time.deltaTime;
|
|
|
+ CircleTimer -= Time.deltaTime;
|
|
|
|
|
|
- if (Timer >= Circle)
|
|
|
+ if (CircleTimer < 0)
|
|
|
{
|
|
|
- Timer = 0;
|
|
|
+ CircleTimer = Circle;
|
|
|
|
|
|
NewPerson = Person*(1 + SkillPersonBuff) + SkillPerson;
|
|
|
- NewCoinPerson = CoinPerson*(1 + SkillCoinPersonBuff) + SkillCoinPerson;
|
|
|
+ NewCoinPerson = CoinPerson + SkillCoinPerson;
|
|
|
|
|
|
- float income = (NewPerson*NewCoinPerson*Circle)*(1 + SkillPlus);
|
|
|
+ double income = (NewPerson*NewCoinPerson*Circle)*(1 + SkillPlusPerm);
|
|
|
Coin += income;
|
|
|
|
|
|
- ManaLog.Log(string.Format("参观收益<color=red>{0}</color> = <color=red>{1}</color> * <color=red>{2}</color> * <color=red>{3}</color> * <color=red>{4}</color> (人次*金币*时间*加成)", income, NewPerson, NewCoinPerson, Circle, 1 + SkillPlus));
|
|
|
+ Data.SaveConfig("QuitTime", DateTime.Now.ToString());
|
|
|
+
|
|
|
+ ManaLog.Log(string.Format("参观收益<color=red>{0}</color> = <color=red>{1}</color> * <color=red>{2}</color> * <color=red>{3}</color> * <color=red>{4}</color> (人次*金币*时间*加成)", income, NewPerson, NewCoinPerson, Circle, 1 + SkillPlusPerm));
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
@@ -219,6 +232,16 @@ public class ManaData : MonoBehaviour
|
|
|
skill.EffectTimer = float.Parse(xmlNodeList[i].Attributes[4].Value);
|
|
|
skill.ItemSkillStatus = (SkillStatus)Enum.Parse(typeof(SkillStatus), xmlNodeList[i].Attributes[1].Value);
|
|
|
}
|
|
|
+ else if (xmlNodeList[i].Attributes[0].Value == SkillCato.BigSkill.ToString())
|
|
|
+ {
|
|
|
+ BigSkill bigSkill = (BigSkill)SkillDic[xmlNodeList[i].Name];
|
|
|
+
|
|
|
+ bigSkill.Level = int.Parse(xmlNodeList[i].Attributes[3].Value);
|
|
|
+ bigSkill.CdTimer = float.Parse(xmlNodeList[i].Attributes[4].Value);
|
|
|
+ bigSkill.EffectTimer = float.Parse(xmlNodeList[i].Attributes[5].Value);
|
|
|
+ bigSkill.ItemSkillStatus = (SkillStatus)Enum.Parse(typeof(SkillStatus), xmlNodeList[i].Attributes[1].Value); //Sa0
|
|
|
+ bigSkill.BarSkillStatus = (SkillStatus)Enum.Parse(typeof(SkillStatus), xmlNodeList[i].Attributes[2].Value); //Sa1
|
|
|
+ }
|
|
|
else if (xmlNodeList[i].Attributes[0].Value == SkillCato.Pack.ToString())
|
|
|
{
|
|
|
Pack pack = (Pack)SkillDic[xmlNodeList[i].Attributes[1].Value];
|
|
@@ -233,16 +256,6 @@ public class ManaData : MonoBehaviour
|
|
|
ability.Level = int.Parse(xmlNodeList[i].Attributes[2].Value);
|
|
|
ability.ItemSkillStatus = (SkillStatus)Enum.Parse(typeof(SkillStatus), xmlNodeList[i].Attributes[1].Value);
|
|
|
}
|
|
|
- else if (xmlNodeList[i].Attributes[0].Value == SkillCato.BigSkill.ToString())
|
|
|
- {
|
|
|
- BigSkill bigSkill = (BigSkill)SkillDic[xmlNodeList[i].Name];
|
|
|
-
|
|
|
- bigSkill.Level = int.Parse(xmlNodeList[i].Attributes[3].Value);
|
|
|
- bigSkill.CdTimer = float.Parse(xmlNodeList[i].Attributes[4].Value);
|
|
|
- bigSkill.EffectTimer = float.Parse(xmlNodeList[i].Attributes[5].Value);
|
|
|
- bigSkill.ItemSkillStatus = (SkillStatus)Enum.Parse(typeof(SkillStatus), xmlNodeList[i].Attributes[1].Value); //Sa0
|
|
|
- bigSkill.BarSkillStatus = (SkillStatus)Enum.Parse(typeof(SkillStatus), xmlNodeList[i].Attributes[2].Value); //Sa1
|
|
|
- }
|
|
|
else
|
|
|
{
|
|
|
throw new Exception();
|
|
@@ -258,12 +271,15 @@ public class ManaData : MonoBehaviour
|
|
|
|
|
|
#region 读取已种植的花
|
|
|
|
|
|
- xmlNodeList = Data.PlayerNode.SelectSingleNode("PlantList").ChildNodes;
|
|
|
- for (int i = 0; i < xmlNodeList.Count; i++)
|
|
|
+ XmlAttributeCollection attributes = Data.PlayerNode.SelectSingleNode("PlantList").Attributes;
|
|
|
+ for (int i = 0; i < attributes.Count; i++)
|
|
|
{
|
|
|
- int id = int.Parse(xmlNodeList[i].Attributes[0].Value);
|
|
|
+ int id = int.Parse(attributes[i].Value);
|
|
|
|
|
|
- ManaGarden.PlaceFlower(id, ManaReso.Get(xmlNodeList[i].Name));
|
|
|
+ if (id != 0)
|
|
|
+ {
|
|
|
+ ManaGarden.PlaceFlower(id, ManaReso.Get(attributes[i].Name));
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
@@ -290,10 +306,37 @@ public class ManaData : MonoBehaviour
|
|
|
#endregion
|
|
|
|
|
|
Coin = double.Parse(Data.PlayerNode.SelectSingleNode("Coin").Attributes[0].Value);
|
|
|
+ Level = int.Parse(Data.PlayerNode.SelectSingleNode("Level").Attributes[0].Value);
|
|
|
Circle = 10;
|
|
|
Diamond = double.Parse(Data.PlayerNode.SelectSingleNode("Diamond").Attributes[0].Value);
|
|
|
+ OfflineCoin = 0;
|
|
|
|
|
|
- Level = int.Parse(Data.PlayerNode.SelectSingleNode("Level").Attributes[0].Value);
|
|
|
+ #region 离线期间的收入
|
|
|
+
|
|
|
+ double elapse = DateTime.Now.Subtract(DateTime.Parse(Data.PlayerNode.SelectSingleNode("QuitTime").Attributes[0].Value)).TotalSeconds; //离开时间
|
|
|
+
|
|
|
+ if (elapse > CircleTimer)
|
|
|
+ {
|
|
|
+ elapse -= CircleTimer;
|
|
|
+
|
|
|
+ int offlineCircle = 1 + Mathf.FloorToInt((float) (elapse/Circle)); //离线周期
|
|
|
+
|
|
|
+ for (int i = 0; i < SkillList.Count; i++)
|
|
|
+ {
|
|
|
+ SkillList[i].CollectOfflineCoin(offlineCircle);
|
|
|
+ }
|
|
|
+
|
|
|
+ OfflineCoin += (Person * CoinPerson * Circle * offlineCircle) * (1 + SkillPlusPerm);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ CircleTimer -= elapse;
|
|
|
+ }
|
|
|
+
|
|
|
+ Coin += OfflineCoin;
|
|
|
+ ManaReso.SetText("A_IconLab", OfflineCoin.ToString("0"));
|
|
|
+
|
|
|
+ #endregion
|
|
|
}
|
|
|
|
|
|
private void RegistReference()
|