LiuQilin 8 vuotta sitten
vanhempi
commit
0bfa8c9516
39 muutettua tiedostoa jossa 574 lisäystä ja 401 poistoa
  1. BIN
      .vs/MyLovelyGarden/v14/.suo
  2. BIN
      Assets/Resources/Prefab/Object/Flower10.prefab
  3. BIN
      Assets/Resources/Prefab/Object/Flower12.prefab
  4. BIN
      Assets/Resources/Prefab/Object/Garden.prefab
  5. BIN
      Assets/Resources/Prefab/PrefabUI/Canvas.prefab
  6. BIN
      Assets/Resources/Prefab/PrefabUI/HudText.prefab
  7. 0 0
      Assets/Resources/Prefab/PrefabUI/HudText.prefab.meta
  8. 2 2
      Assets/Resources/Sprite/Garden/Flower11.png.meta
  9. 1 1
      Assets/Resources/Sprite/Garden/Flower6.png.meta
  10. 1 1
      Assets/Resources/Sprite/Garden/Flower7.png.meta
  11. 1 1
      Assets/Resources/Sprite/Garden/Flower9.png.meta
  12. 11 15
      Assets/Resources/XML/Config/pack_config.xml
  13. 28 17
      Assets/Script/Manage/ManaAnim.cs
  14. 1 1
      Assets/Script/Manage/ManaData.cs
  15. 57 84
      Assets/Script/Manage/ManaReso.cs
  16. 49 48
      Assets/Script/Object/Flower.cs
  17. 107 62
      Assets/Script/Object/Garden.cs
  18. 0 55
      Assets/Script/Object/HUD.cs
  19. 9 0
      Assets/Script/Object/Hud.meta
  20. 17 0
      Assets/Script/Object/Hud/HudTarget.cs
  21. 12 0
      Assets/Script/Object/Hud/HudTarget.cs.meta
  22. 43 0
      Assets/Script/Object/Hud/HudText.cs
  23. 0 0
      Assets/Script/Object/Hud/HudText.cs.meta
  24. 2 2
      Assets/Script/Object/Player.cs
  25. 21 37
      Assets/Script/Object/Skill/Ability.cs
  26. 14 14
      Assets/Script/Object/Skill/Pack.cs
  27. 3 18
      Assets/Script/Object/Skill/Skill.cs
  28. 130 0
      Assets/Script/Object/Skill/SkillRoot.cs
  29. 9 0
      Assets/Script/Tool/Anim.meta
  30. 9 20
      Assets/Script/Tool/Anim/Move.cs
  31. 0 0
      Assets/Script/Tool/Anim/Move.cs.meta
  32. 0 0
      Assets/Script/Tool/Anim/Tween.cs
  33. 0 0
      Assets/Script/Tool/Anim/Tween.cs.meta
  34. 6 6
      Assets/Script/Tool/Anim/TweenCG.cs
  35. 0 0
      Assets/Script/Tool/Anim/TweenCG.cs.meta
  36. 4 4
      Assets/Script/Tool/Anim/TweenVector.cs
  37. 0 0
      Assets/Script/Tool/Anim/TweenVector.cs.meta
  38. 23 4
      Assets/Script/Tool/Extension.cs
  39. 14 9
      MyLovelyGarden.csproj

BIN
.vs/MyLovelyGarden/v14/.suo


BIN
Assets/Resources/Prefab/Object/Flower10.prefab


BIN
Assets/Resources/Prefab/Object/Flower12.prefab


BIN
Assets/Resources/Prefab/Object/Garden.prefab


BIN
Assets/Resources/Prefab/PrefabUI/Canvas.prefab


BIN
Assets/Resources/Prefab/PrefabUI/HUD.prefab → Assets/Resources/Prefab/PrefabUI/HudText.prefab


+ 0 - 0
Assets/Resources/Prefab/PrefabUI/HUD.prefab.meta → Assets/Resources/Prefab/PrefabUI/HudText.prefab.meta


+ 2 - 2
Assets/Resources/Sprite/Garden/Flower11.png.meta

@@ -1,6 +1,6 @@
 fileFormatVersion: 2
-guid: efc82d3850d7f3444aa6b4490ae9a2a8
-timeCreated: 1486601829
+guid: b7d083c187fd2ad47b4c8d905af6af48
+timeCreated: 1486900934
 licenseType: Pro
 TextureImporter:
   fileIDToRecycleName: {}

+ 1 - 1
Assets/Resources/Sprite/Garden/Flower6.png.meta

@@ -1,5 +1,5 @@
 fileFormatVersion: 2
-guid: d3058080258373d4e87ad4acd5767ac9
+guid: 06892e67e81ef9742a9a2846b54363ab
 timeCreated: 1486900934
 licenseType: Pro
 TextureImporter:

+ 1 - 1
Assets/Resources/Sprite/Garden/Flower7.png.meta

@@ -1,5 +1,5 @@
 fileFormatVersion: 2
-guid: 2281497cc8538ec46aa8e611d10bf5b1
+guid: adb700f01ab714d4aa4dd80ac0241cf5
 timeCreated: 1486900934
 licenseType: Pro
 TextureImporter:

+ 1 - 1
Assets/Resources/Sprite/Garden/Flower9.png.meta

@@ -1,5 +1,5 @@
 fileFormatVersion: 2
-guid: 443cfcc7f448e7d448867a418a50b88e
+guid: 2281497cc8538ec46aa8e611d10bf5b1
 timeCreated: 1486900934
 licenseType: Pro
 TextureImporter:

+ 11 - 15
Assets/Resources/XML/Config/pack_config.xml

@@ -1,15 +1,15 @@
 <data>
-  <item id="1" name="金币大礼包" class="3" class_id="2" coin_person="" person="" skill_cd="" upgrade_plus="" coin="500" diamond="500" flower="500" use_lv="" use_cur="2" use_amnt="200" desc="立即获得金币 [&amp;coin&amp;]" icon="" anim="" label="" />
-  <item id="2" name="天赐大礼包" class="3" class_id="3" coin_person="" person="" skill_cd="" upgrade_plus="" coin="" diamond="" flower="" use_lv="" use_cur="2" use_amnt="400" desc="立即获得金币 [&amp;coin&amp;]" icon="" anim="" label="" />
-  <item id="3" name="花神大礼包" class="3" class_id="4" coin_person="" person="" skill_cd="" upgrade_plus="" coin="15000" diamond="" flower="" use_lv="" use_cur="2" use_amnt="800" desc="立即获得金币 [&amp;coin&amp;]" icon="" anim="" label="" />
-  <item id="4" name="新手礼包" class="4" class_id="2" coin_person="110%" person="100%" skill_cd="" upgrade_plus="110%" coin="" diamond="500" flower="10" use_lv="50,150" use_cur="3" use_amnt="6" desc="获得[&amp;flower&amp;],[&amp;diamond&amp;]钻石&#xA;所有金币产出提升[&amp;coin_person&amp;],永久有效" icon="" anim="" label="" />
-  <item id="5" name="中级礼包" class="4" class_id="3" coin_person="" person="" skill_cd="" upgrade_plus="110%" coin="" diamond="2000" flower="11" use_lv="" use_cur="3" use_amnt="30" desc="获得[&amp;flower&amp;],[&amp;diamond&amp;]钻石&#xA;所有金币产出提升[&amp;coin_person&amp;],永久有效" icon="" anim="" label="" />
-  <item id="6" name="高级礼包" class="4" class_id="4" coin_person="" person="" skill_cd="" upgrade_plus="110%" coin="" diamond="4000" flower="12" use_lv="" use_cur="3" use_amnt="68" desc="获得[&amp;flower&amp;],[&amp;diamond&amp;]钻石&#xA;所有金币产出提升[&amp;coin_person&amp;],永久有效" icon="" anim="" label="" />
-  <item id="7" name="钻石100" class="4" class_id="5" coin_person="" person="" skill_cd="" upgrade_plus="" coin="" diamond="100" flower="" use_lv="" use_cur="3" use_amnt="6" desc="购买 [&amp;diamond&amp;]钻石" icon="" anim="" label="" />
-  <item id="8" name="钻石500 赠送50" class="4" class_id="6" coin_person="" person="" skill_cd="" upgrade_plus="" coin="" diamond="550" flower="" use_lv="" use_cur="3" use_amnt="30" desc="共计 [&amp;diamond&amp;]钻石" icon="" anim="" label="热卖" />
-  <item id="9" name="钻石2000 赠送500" class="4" class_id="7" coin_person="" person="" skill_cd="" upgrade_plus="" coin="" diamond="2500" flower="" use_lv="" use_cur="3" use_amnt="68" desc="共计 [&amp;diamond&amp;]钻石" icon="" anim="" label="超值" />
-  <item id="10" name="钻石6000 赠送600" class="4" class_id="8" coin_person="" person="" skill_cd="" upgrade_plus="" coin="" diamond="6600" flower="" use_lv="" use_cur="3" use_amnt="128" desc="共计 [&amp;diamond&amp;]钻石" icon="" anim="" label="" />
-  <item id="11" name="钻石10000 赠送2000" class="4" class_id="9" coin_person="" person="" skill_cd="" upgrade_plus="" coin="" diamond="12000" flower="" use_lv="" use_cur="3" use_amnt="328" desc="共计 [&amp;diamond&amp;]钻石" icon="" anim="" label="" />
+  <item id="1" name="金币大礼包" class="3" class_id="2" coin_person="" person="" skill_cd="" coin="500" diamond="500" flower="500" use_lv="" use_cur="2" use_amnt="200" desc="立即获得金币 [&amp;coin&amp;]" icon="" anim="" label="" />
+  <item id="2" name="天赐大礼包" class="3" class_id="3" coin_person="" person="" skill_cd="" coin="" diamond="" flower="" use_lv="" use_cur="2" use_amnt="400" desc="立即获得金币 [&amp;coin&amp;]" icon="" anim="" label="" />
+  <item id="3" name="花神大礼包" class="3" class_id="4" coin_person="" person="" skill_cd="" coin="15000" diamond="" flower="" use_lv="" use_cur="2" use_amnt="800" desc="立即获得金币 [&amp;coin&amp;]" icon="" anim="" label="" />
+  <item id="4" name="新手礼包" class="4" class_id="2" coin_person="110%" person="" skill_cd="" coin="" diamond="500" flower="10" use_lv="50,150" use_cur="3" use_amnt="6" desc="获得[&amp;flower&amp;],[&amp;diamond&amp;]钻石&#xA;所有金币产出提升[&amp;coin_person&amp;],永久有效" icon="" anim="" label="" />
+  <item id="5" name="中级礼包" class="4" class_id="3" coin_person="110%" person="" skill_cd="" coin="" diamond="2000" flower="11" use_lv="" use_cur="3" use_amnt="30" desc="获得[&amp;flower&amp;],[&amp;diamond&amp;]钻石&#xA;所有金币产出提升[&amp;coin_person&amp;],永久有效" icon="" anim="" label="" />
+  <item id="6" name="高级礼包" class="4" class_id="4" coin_person="110%" person="" skill_cd="" coin="" diamond="4000" flower="12" use_lv="" use_cur="3" use_amnt="68" desc="获得[&amp;flower&amp;],[&amp;diamond&amp;]钻石&#xA;所有金币产出提升[&amp;coin_person&amp;],永久有效" icon="" anim="" label="" />
+  <item id="7" name="钻石100" class="4" class_id="5" coin_person="" person="" skill_cd="" coin="" diamond="100" flower="" use_lv="" use_cur="3" use_amnt="6" desc="购买 [&amp;diamond&amp;]钻石" icon="" anim="" label="" />
+  <item id="8" name="钻石500 赠送50" class="4" class_id="6" coin_person="" person="" skill_cd="" coin="" diamond="550" flower="" use_lv="" use_cur="3" use_amnt="30" desc="共计 [&amp;diamond&amp;]钻石" icon="" anim="" label="热卖" />
+  <item id="9" name="钻石2000 赠送500" class="4" class_id="7" coin_person="" person="" skill_cd="" coin="" diamond="2500" flower="" use_lv="" use_cur="3" use_amnt="68" desc="共计 [&amp;diamond&amp;]钻石" icon="" anim="" label="超值" />
+  <item id="10" name="钻石6000 赠送600" class="4" class_id="8" coin_person="" person="" skill_cd="" coin="" diamond="6600" flower="" use_lv="" use_cur="3" use_amnt="128" desc="共计 [&amp;diamond&amp;]钻石" icon="" anim="" label="" />
+  <item id="11" name="钻石10000 赠送2000" class="4" class_id="9" coin_person="" person="" skill_cd="" coin="" diamond="12000" flower="" use_lv="" use_cur="3" use_amnt="328" desc="共计 [&amp;diamond&amp;]钻石" icon="" anim="" label="" />
   <comment>
     <id>
 id
@@ -35,10 +35,6 @@ id
     <skill_cd>
 技能冷却
 </skill_cd>
-    <upgrade_plus>
-升级
-收入加成
-</upgrade_plus>
     <coin>
 获得金币
 </coin>

+ 28 - 17
Assets/Script/Manage/ManaAnim.cs

@@ -19,9 +19,9 @@ public enum TweenType
     Position,
 }
 
-public delegate float CurveFunctionF(float timer, float duration, float start, float variation);
+public delegate float CurveFunctionF(float timer, float duration, float start, float delta);
 
-public delegate Vector3 CurveFunctionV(float timer, float duration, Vector3 start, Vector3 variation);
+public delegate Vector3 CurveFunctionV(float timer, float duration, Vector3 start, Vector3 delta);
 
 public class ManaAnim : MonoBehaviour 
 {
@@ -86,36 +86,47 @@ public class ManaAnim : MonoBehaviour
     }
 
 
-    public static float Linear(float timer, float duration, float start, float variation)
+    public static float Linear(float timer, float duration, float start, float delta)
     {
-        return variation*timer/duration + start;
+        return delta*timer/duration + start;
     }
 
-    public static float EaseOutQuad(float timer, float duration, float start, float variation)
+    public static float EaseOutQuad(float timer, float duration, float start, float delta)
     {
         timer /= duration;
 
-        return -variation*timer*(timer - 2) + start;
+        return -delta*timer*(timer - 2) + start;
     }
 
-    public static Vector3 Linear(float timer, float duration, Vector3 start, Vector3 variation)
+    public static Vector3 Linear(float timer, float duration, Vector3 start, Vector3 delta)
     {
-        return new Vector3(Linear(timer, duration, start.x, variation.x), Linear(timer, duration, start.y, variation.y), Linear(timer, duration, start.z, variation.z));
+        return new Vector3(Linear(timer, duration, start.x, delta.x), Linear(timer, duration, start.y, delta.y), Linear(timer, duration, start.z, delta.z));
     }
 
-    public static Vector3 EaseOutQuad(float timer, float duration, Vector3 start, Vector3 variation)
+    public static Vector3 EaseOutQuad(float timer, float duration, Vector3 start, Vector3 delta)
     {
-        return new Vector3(EaseOutQuad(timer, duration, start.x, variation.x), EaseOutQuad(timer, duration, start.y, variation.y), EaseOutQuad(timer, duration, start.z, variation.z));
+        return new Vector3(EaseOutQuad(timer, duration, start.x, delta.x), EaseOutQuad(timer, duration, start.y, delta.y), EaseOutQuad(timer, duration, start.z, delta.z));
     }
 
 
     public static void Move(Transform target, Vector3 offset, float duration = 0, Curve curve = Curve.Null)
     {
-        Move move = MoveDic[target];
+        Move move;
 
-        move.StartMove(offset, duration, curve);
+        if (MoveDic.TryGetValue(target, out move))
+        {
+            move.StartMove(offset, duration, curve);
+
+            MoveList.Add(move);
+        }
+        else
+        {
+            move = CreateMove(target);
 
-        MoveList.Add(move);
+            move.StartMove(offset, duration, curve);
+
+            MoveList.Add(move);
+        }
     }
 
     public static void Forward(Transform target, TweenType tweenType)
@@ -168,10 +179,10 @@ public class ManaAnim : MonoBehaviour
         return MoveDic[target];
     }
 
-    public static Move CreateMove(Transform target, float duration, Curve curve)
+    public static Move CreateMove(Transform target)
     {
-        Move move = new Move(target, duration, curve);
-
+        Move move = new Move(target);
+        
         MoveDic.Add(target, move);
 
         return move;
@@ -196,7 +207,7 @@ public class ManaAnim : MonoBehaviour
 
     public static Tween CreateTween(Transform target, float origin, float destination,  float duration, bool originActive, bool destActive, Curve curve)
     {
-        TweenCanvasGroup tween = new TweenCanvasGroup(target, origin, destination, duration, originActive, destActive, curve);
+        TweenCG tween = new TweenCG(target, origin, destination, duration, originActive, destActive, curve);
 
         TweenAlphaDic.Add(target, tween);
 

+ 1 - 1
Assets/Script/Manage/ManaData.cs

@@ -114,7 +114,7 @@ public class ManaData : MonoBehaviour
             {
                 attributes = xmlNodeList[j].Attributes;
 
-                if (attributes.Count == 18) //Pack配置
+                if (attributes.Count == 17) //Pack配置
                 {
                     PackList.Add(new Pack(attributes)); 
                 }

+ 57 - 84
Assets/Script/Manage/ManaReso.cs

@@ -23,7 +23,6 @@ public enum Folder
 public enum ObjType
 {
     Null,
-    HUD,
     Flower1,
     Flower2,
     Flower3,
@@ -36,6 +35,7 @@ public enum ObjType
     Flower10,
     Flower11,
     Flower12,
+    HudText,
 }
 
 public class ManaReso : MonoBehaviour
@@ -765,7 +765,7 @@ public class ManaReso : MonoBehaviour
 
             goList.Add(go);
 
-            if (objRoot.ObjType != ObjType.HUD)
+            if (objRoot.ObjType != ObjType.HudText)
             {
                 go.transform.parent = TraDic["ObjPool"];
             }
@@ -774,7 +774,7 @@ public class ManaReso : MonoBehaviour
         {
             throw new Exception();
         }
-    }
+    } //ObjPool
 
     public static void Save(GameObject go)
     {
@@ -798,7 +798,7 @@ public class ManaReso : MonoBehaviour
 
             goList.Add(go);
 
-            if (objRoot.ObjType != ObjType.HUD)
+            if (objRoot.ObjType != ObjType.HudText)
             {
                 go.transform.parent = TraDic["ObjPool"];
             }
@@ -807,7 +807,7 @@ public class ManaReso : MonoBehaviour
         {
             throw new Exception();
         }
-    }
+    } //TraDic
 
 
     public static T Get<T>(string goName)
@@ -829,7 +829,27 @@ public class ManaReso : MonoBehaviour
         {
             throw new Exception(goName);
         }
-    }
+    } //TraDic
+
+    public static T Get<T>(ObjType objType)
+    {
+        List<GameObject> goList;
+
+        if (ObjectPool.TryGetValue(objType, out goList))
+        {
+            if (goList.Count > 0)
+            {
+                GameObject go = goList[0];
+
+                go.SetActive(true);
+                goList.RemoveAt(0);
+
+                return go.GetComponent<T>();
+            }
+        }
+
+        return default(T);
+    } //ObjPool
 
     public static Transform Get(string goName)
     {
@@ -843,7 +863,7 @@ public class ManaReso : MonoBehaviour
         {
             throw new Exception(goName);
         }
-    }
+    } //TraDic
 
     public static Transform Get(string prefabName, Folder folder, bool compile = true, ObjType objType = ObjType.Null)
     {
@@ -858,7 +878,7 @@ public class ManaReso : MonoBehaviour
         }
 
         return go.transform;
-    }
+    } //实例化
 
     public static Transform Get(string prefabName, Folder folder, Vector3 pos, Quaternion rot, Transform par, bool compile = true, ObjType objType = ObjType.Null)
     {
@@ -873,7 +893,7 @@ public class ManaReso : MonoBehaviour
         }
 
         return go.transform;
-    }
+    } //实例化
 
     public static Transform Get(string prefabName, Folder folder, Transform par, bool worldSpace, bool compile = true, ObjType objType = ObjType.Null)
     {
@@ -888,7 +908,7 @@ public class ManaReso : MonoBehaviour
         }
 
         return go.transform;
-    }
+    } //实例化
 
 
     public static T Load<T>(string url) where T: Object
@@ -971,97 +991,41 @@ public class ManaReso : MonoBehaviour
     }
 
 
-    public static Text GetHUD(Color color, Transform target, bool isStatic = false, string message = "", float speed = 0.5f, float time = 0f)
+    public static Text GetHudText(string message, Color color, Transform target)
     {
-        HUD hud;
-        GameObject go;
-        List<GameObject> goList;
+        HudText hudText = Get<HudText>(ObjType.HudText);
 
-        #region 从对象池中获得
-
-        if (ObjectPool.TryGetValue(ObjType.HUD, out goList))
+        if (hudText == null)
         {
-            if (goList.Count > 0)
-            {
-                go = goList[0];
-                goList.RemoveAt(0);
-
-                go.SetActive(true);
-                go.transform.position = Camera.main.WorldToScreenPoint(target.position);
-
-                hud = go.GetComponent<HUD>();
-
-                hud.Set(color, isStatic, message, speed, time);
-
-                return go.GetComponent<Text>();
-            }
+            hudText = Get("HudText", Folder.PrefabUI, Camera.main.WorldToScreenPoint(target.position), Quaternion.identity, TraDic["HudParent"], false, ObjType.HudText).AddComponent<HudText>();
         }
 
-        #endregion
-
-        #region 实例化
-
-        go = Get("HUD", Folder.PrefabUI, Camera.main.WorldToScreenPoint(target.position), Quaternion.identity, TraDic["HudParent"], false,ObjType.HUD).gameObject;
-
-        hud = go.AddComponent<HUD>();
+        hudText.transform.position = Camera.main.WorldToScreenPoint(target.position);
+        hudText.Set(message, color);
 
-        hud.Set(color, isStatic, message, speed, time);
-
-        return go.GetComponent<Text>();
-
-        #endregion
+        return hudText.GetComponent<Text>();
     }
 
     public static Flower GetFlower(bool enableCollider, Transform posTra, ObjType objType)
     {
-        Flower flower;
-        List<GameObject> goList;
-
-        #region 从对象池中获得
+        Flower flower = Get<Flower>(objType);
 
-        if (ObjectPool.TryGetValue(objType, out goList))
+        if (flower == null)
         {
-            if (goList.Count > 0)
-            {
-                GameObject go = goList[0];
-                GameObject prefab = Load<GameObject>(objType.ToString(), Folder.Object);
-
-                goList.RemoveAt(0);
-
-                go.transform.parent = posTra;
-                go.transform.localPosition = prefab.transform.localPosition;
-
-                go.SetActive(true);
-                go.SetCollider(enableCollider);
-
-                return go.GetComponent<Flower>();
-            }
+            flower = Get(objType.ToString(), Folder.Object, posTra, false, false, objType).AddComponent<Flower>();
+            
+            flower.ObjType = objType;
+            flower.LocalPos = flower.transform.localPosition;
         }
-
-        #endregion
-
-        #region 实例化
-
-        flower = Get(objType.ToString(), Folder.Object, posTra, false, false, objType).AddComponent<Flower>();
-
-        flower.SetCollider(enableCollider);
-        flower.GetComponent<ObjRoot>().ObjType = objType;
-
-        return flower;
-
-        #endregion
-    }
-
-    public static Transform GetUI(string prefabName, Transform posTra, Transform parent = null)
-    {
-        if (parent == null)
+        else
         {
-            parent = Get("Canvas");
+            flower.transform.parent = posTra;
+            flower.transform.localPosition = flower.LocalPos;
         }
 
-        Transform tra = Get(prefabName, Folder.PrefabUI, Camera.main.WorldToScreenPoint(posTra.position), Quaternion.identity, parent);
+        flower.SetCollider(enableCollider);
 
-        return tra;
+        return flower;
     }
 
     public static Transform GetSkillItem(SkillRoot skillRoot)
@@ -1096,4 +1060,13 @@ public class ManaReso : MonoBehaviour
 
         return tra;
     }
+
+    public static HudTarget GetHudTarget(string prefabName, Transform posTra, Transform par)
+    {
+        HudTarget hudTarget = Get(prefabName, Folder.PrefabUI, par, true).AddComponent<HudTarget>();
+
+        hudTarget.PosTra = posTra;
+
+        return hudTarget;
+    }
 }

+ 49 - 48
Assets/Script/Object/Flower.cs

@@ -14,6 +14,53 @@ public enum OpType
     Fertilizing,
 }
 
+public class FlowerInfo
+{
+    public int ID;
+    public int Plant; //该类花种了几朵
+    public bool Special;
+    public string Name;
+    public string Description;
+
+    public Text Text;
+    public Sprite Sprite;
+    public Image Image;
+    public Button Button;
+    public ObjType ObjType;
+
+    public FlowerInfo(Sprite sprite, XmlAttributeCollection attributes)
+    {
+        Transform tra = ManaReso.Get("G_FlowerItem", Folder.PrefabUI, ManaReso.Get("G_RegularGrid"), false, false);
+
+        Text = tra.FindChild("G_FlowerItemLab").GetComponent<Text>();
+        Image = tra.FindChild("G_FlowerItemIcon").GetComponent<Image>();
+        Button = tra.GetComponent<Button>();
+
+        ID = int.Parse(attributes[0].Value);
+        Sprite = sprite;
+        Name = attributes[1].Value;
+        Description = attributes[2].Value;
+
+        Image.sprite = sprite;
+        if (sprite != null)
+        {
+            float scale = tra.GetComponent<RectTransform>().sizeDelta.x / sprite.rect.size.x;
+            Vector2 newSize = sprite.rect.size;
+            newSize.x = scale * tra.GetComponent<RectTransform>().sizeDelta.x;
+            newSize.y = scale * tra.GetComponent<RectTransform>().sizeDelta.y;
+            Image.rectTransform.sizeDelta = newSize;
+        }
+
+        Button.onClick.AddListener
+        (
+            () =>
+            {
+                ManaGarden.PlaceFlower(ID);
+            }
+        );
+    }
+}
+
 public class Flower : ObjRoot, IPointerClickHandler
 {
     #region 变量
@@ -42,6 +89,7 @@ public class Flower : ObjRoot, IPointerClickHandler
     #endregion
 
     public int ID;
+    public Vector3 LocalPos;
     public Transform PosTra;
 
     private Dictionary<string, Transform> ChildDic;
@@ -171,7 +219,7 @@ public class Flower : ObjRoot, IPointerClickHandler
 
     private void FullLevel()
     {
-        ManaReso.GetHUD(Color.red, ChildDic["ScoreHudTra"], false, "得分+1");
+        ManaReso.GetHudText("得分+1", Color.red, ChildDic["ScoreHudTra"]);
         ManaMiniGame.GetScore(1);
 
         ResetA();
@@ -215,51 +263,4 @@ public class Flower : ObjRoot, IPointerClickHandler
         ManaReso.Get("H_FlowerCard").Forward(TweenType.Alpha);
         ManaReso.Get("G_FlowerHouse").Forward(TweenType.Alpha);
     }
-}
-
-public class FlowerInfo
-{
-    public int ID;
-    public int Plant; //该类花种了几朵
-    public bool Special;
-    public string Name;
-    public string Description;
-
-    public Text Text;
-    public Sprite Sprite;
-    public Image Image;
-    public Button Button;
-    public ObjType ObjType;
-
-    public FlowerInfo(Sprite sprite, XmlAttributeCollection attributes)
-    {
-        Transform tra = ManaReso.Get("G_FlowerItem", Folder.PrefabUI, ManaReso.Get("G_RegularGrid"), false, false);
-
-        Text = tra.FindChild("G_FlowerItemLab").GetComponent<Text>();
-        Image = tra.FindChild("G_FlowerItemIcon").GetComponent<Image>();
-        Button = tra.GetComponent<Button>();
-
-        ID = int.Parse(attributes[0].Value);
-        Sprite = sprite;
-        Name = attributes[1].Value;
-        Description = attributes[2].Value;
-
-        Image.sprite = sprite;
-        if(sprite != null)
-        {
-            float scale = tra.GetComponent<RectTransform>().sizeDelta.x / sprite.rect.size.x;
-            Vector2 newSize = sprite.rect.size;
-            newSize.x = scale * tra.GetComponent<RectTransform>().sizeDelta.x;
-            newSize.y = scale * tra.GetComponent<RectTransform>().sizeDelta.y;
-            Image.rectTransform.sizeDelta = newSize;
-        }
-
-        Button.onClick.AddListener
-        (
-            () =>
-            {
-                ManaGarden.PlaceFlower(ID);
-            }
-        );
-    }
 }

+ 107 - 62
Assets/Script/Object/Garden.cs

@@ -1,28 +1,32 @@
 using UnityEngine;
 using UnityEngine.EventSystems;
 
+using UnityEngine.UI;
 using System.Collections;
+using System.Collections.Generic;
 
 public class Garden : MonoBehaviour, IDragHandler, IPointerClickHandler, IEndDragHandler
 {
     #region 变量
 
-    private int SlideIndex;
-    private int SlideCount;
+    private int Page;
     private bool Flag1;
+    private bool Flag2;
     private float Ratio2;
     private float Ratio3;
     private float Ratio4;
-    private float SliderX;
-    private float ExtentX;
-    private float SlideSpeed;
     private float LeftBorder;
+    private float SlideSpeed;
     private float RightBorder;
     private Transform Garden2;
     private Transform Garden3;
     private Transform Garden4;
     private Transform GardenA;
-    private SpriteRenderer GardenSrA;
+    
+    private List<Vector3> VectorList2;
+    private List<Vector3> VectorList3;
+    private List<Vector3> VectorList4;
+    private List<Vector3> VectorListA;
 
     #endregion
 
@@ -34,30 +38,43 @@ public class Garden : MonoBehaviour, IDragHandler, IPointerClickHandler, IEndDra
 
     private void Update()
     {
-        
+        if (Input.GetKeyDown(KeyCode.U))
+        {
+            NextPage();
+        }
+
+        if (Input.GetKeyDown(KeyCode.Y))
+        {
+            PrevPage();
+        }
     }
 
 
     private void RegistValue()
     {
         Flag1 = true;
-        SlideIndex = 1;
-        SlideCount = 2;
+        Flag2 = true;
+
+        Page = 0;
+        Ratio2 = 0.25f;
+        Ratio3 = 0.5f;
+        Ratio4 = 0.75f;
         SlideSpeed = 0.1f;
 
-        ExtentX = GardenSrA.bounds.extents.x;
-        LeftBorder = GardenA.position.x - 2*ExtentX;
-        RightBorder = GardenA.position.x;
+        LeftBorder = VectorListA[0].x;
+        RightBorder = VectorListA[VectorListA.Count - 1].x;
 
-        Ratio2 = 0.5f/ExtentX;
-        Ratio3 = 1f/ExtentX;
-        Ratio4 = 1.5f/ExtentX;
+        Move move = GardenA.CreateMove();
 
-        Garden2.CreateMove(1f, Curve.EaseOutQuad);
-        Garden3.CreateMove(1f, Curve.EaseOutQuad);
-        Garden4.CreateMove(1f, Curve.EaseOutQuad);
+        move.OnStart += () =>
+        {
+            Flag2 = false;
+        };
 
-        GardenA.CreateMove(1f, Curve.EaseOutQuad);
+        move.OnFinish += () =>
+        {
+            Flag2 = true;
+        };
     }
 
     private void RegistReference()
@@ -65,27 +82,49 @@ public class Garden : MonoBehaviour, IDragHandler, IPointerClickHandler, IEndDra
         Garden2 = ManaReso.Get("GardenSr2");
         Garden3 = ManaReso.Get("GardenSr3");
         Garden4 = ManaReso.Get("GardenSr4");
+
         GardenA = ManaReso.Get("GardenSrA");
-        GardenSrA = ManaReso.Get<SpriteRenderer>("GardenSrA");
+
+        VectorList2 = new List<Vector3>()
+        {
+            ManaReso.Get("Tra21").position,
+            ManaReso.Get("Tra22").position,
+        };
+
+        VectorList3 = new List<Vector3>()
+        {
+            ManaReso.Get("Tra31").position,
+            ManaReso.Get("Tra32").position,
+        };
+
+        VectorList4 = new List<Vector3>()
+        {
+            ManaReso.Get("Tra41").position,
+            ManaReso.Get("Tra42").position,
+        };
+
+        VectorListA = new List<Vector3>()
+        {
+            ManaReso.Get("TraA1").position,
+            ManaReso.Get("TraB1").position,
+        };
     }
 
 
     public void OnDrag(PointerEventData eventData)
     {
-        if (Flag1)
+        if (Flag1 && Flag2)
         {
             float rawDeltaX = Mathf.Abs(eventData.pressPosition.x - eventData.position.x);
 
-            if (eventData.delta.x < 0) //向右滑
+            if (eventData.delta.x < 0)
             {
                 #region MyRegion
-
-                if (GardenA.position.x > LeftBorder)
+                
+                if (GardenA.position.x > RightBorder)
                 {
                     float tempX = Mathf.Clamp(eventData.delta.x / 10, -2, 2) * SlideSpeed;
 
-                    SliderX += tempX;
-
                     GardenA.Translate(GardenA.right * tempX, Space.World);
 
                     Garden2.Translate(Garden2.right * tempX * Ratio2, Space.World);
@@ -95,34 +134,22 @@ public class Garden : MonoBehaviour, IDragHandler, IPointerClickHandler, IEndDra
 
                 if (rawDeltaX > 300)
                 {
-                    if (SlideIndex < SlideCount)
+                    if (Page < VectorListA.Count - 1)
                     {
-                        float flipDist = -2*ExtentX - SliderX;
-
-                        GardenA.Move(new Vector3(flipDist, 0, 0), 0.75f);
-
-                        Garden2.Move(new Vector3(flipDist * Ratio2, 0, 0), 0.75f);
-                        Garden3.Move(new Vector3(flipDist * Ratio3, 0, 0), 0.75f);
-                        Garden4.Move(new Vector3(flipDist * Ratio4, 0, 0), 0.75f);
-
-                        Flag1 = false;
-                        SliderX = 0;
-                        SlideIndex++;
+                        NextPage();
                     }
                 }
 
                 #endregion
             }
-            else //向左滑
+            else
             {
                 #region MyRegion
-
-                if (GardenA.position.x < RightBorder)
+                
+                if (GardenA.position.x < LeftBorder)
                 {
                     float tempX = Mathf.Clamp(eventData.delta.x / 10, -2, 2) * SlideSpeed;
 
-                    SliderX += tempX;
-
                     GardenA.Translate(GardenA.right * tempX, Space.World);
 
                     Garden2.Translate(Garden2.right * tempX * Ratio2, Space.World);
@@ -132,19 +159,9 @@ public class Garden : MonoBehaviour, IDragHandler, IPointerClickHandler, IEndDra
 
                 if (rawDeltaX > 300)
                 {
-                    if (SlideIndex > 1)
+                    if (Page > 0)
                     {
-                        float flipDist = 2*ExtentX - SliderX;
-                        
-                        GardenA.Move(new Vector3(flipDist, 0, 0), 0.75f);
-
-                        Garden2.Move(new Vector3(flipDist * Ratio2, 0, 0), 0.75f);
-                        Garden3.Move(new Vector3(flipDist * Ratio3, 0, 0), 0.75f);
-                        Garden4.Move(new Vector3(flipDist * Ratio4, 0, 0), 0.75f);
-
-                        Flag1 = false;
-                        SliderX = 0;
-                        SlideIndex--;
+                        PrevPage();
                     }
                 }
 
@@ -155,17 +172,12 @@ public class Garden : MonoBehaviour, IDragHandler, IPointerClickHandler, IEndDra
 
     public void OnEndDrag(PointerEventData eventData)
     {
-        if (Flag1) //没有翻页则返回
+        if (Flag1 && Flag2) //没有翻页则返回
         {
-            GardenA.Move(new Vector3(-SliderX, 0, 0), 0.1f, Curve.EaseOutQuad);
-
-            Garden2.Move(new Vector3(-SliderX * Ratio2, 0, 0), 0.1f, Curve.EaseOutQuad);
-            Garden3.Move(new Vector3(-SliderX * Ratio3, 0, 0), 0.1f, Curve.EaseOutQuad);
-            Garden4.Move(new Vector3(-SliderX * Ratio4, 0, 0), 0.1f, Curve.EaseOutQuad);
+            Return();
         }
 
         Flag1 = true;
-        SliderX = 0;
     }
 
     public void OnPointerClick(PointerEventData eventData)
@@ -189,4 +201,37 @@ public class Garden : MonoBehaviour, IDragHandler, IPointerClickHandler, IEndDra
             ManaReso.Get("H_FlowerCard").Forward(TweenType.Alpha);
         }
     }
+
+
+    private void Return()
+    {
+        Garden2.Move(VectorList2[Page], 0.25f, Curve.EaseOutQuad);
+        Garden3.Move(VectorList3[Page], 0.25f, Curve.EaseOutQuad);
+        Garden4.Move(VectorList4[Page], 0.25f, Curve.EaseOutQuad);
+        GardenA.Move(VectorListA[Page], 0.25f, Curve.EaseOutQuad);
+    }
+
+    private void PrevPage()
+    {
+        Page--;
+        
+        Flag1 = false;
+
+        Garden2.Move(VectorList2[Page], 0.5f, Curve.EaseOutQuad);
+        Garden3.Move(VectorList3[Page], 0.5f, Curve.EaseOutQuad);
+        Garden4.Move(VectorList4[Page], 0.5f, Curve.EaseOutQuad);
+        GardenA.Move(VectorListA[Page], 0.5f, Curve.EaseOutQuad);
+    }
+
+    private void NextPage()
+    {
+        Page++;
+        
+        Flag1 = false;
+
+        Garden2.Move(VectorList2[Page], 0.5f, Curve.EaseOutQuad);
+        Garden3.Move(VectorList3[Page], 0.5f, Curve.EaseOutQuad);
+        Garden4.Move(VectorList4[Page], 0.5f, Curve.EaseOutQuad);
+        GardenA.Move(VectorListA[Page], 0.5f, Curve.EaseOutQuad);
+    }
 }

+ 0 - 55
Assets/Script/Object/HUD.cs

@@ -1,55 +0,0 @@
-using UnityEngine;
-using UnityEngine.UI;
-
-using System;
-using System.Collections;
-
-public class HUD : ObjRoot 
-{
-    #region 变量
-
-    public float Speed;
-    public bool Static;
-
-    private float Timer; //显示时间
-    private Text HudLab;
-
-    #endregion
-
-    private void Awake()
-    {
-        ObjType = ObjType.HUD;
-
-        HudLab = GetComponent<Text>();
-    }
-
-    private void FixedUpdate()
-    {
-        if (!Static)
-        {
-            Timer -= Time.fixedDeltaTime;
-
-            if (Timer <= 0)
-            {
-                transform.position += new Vector3(0, Speed * 10 * Time.fixedDeltaTime, 0);
-                
-                HudLab.SetAlpha(Mathf.Lerp(HudLab.color.a, 0, Time.fixedDeltaTime*2));
-
-                if (HudLab.color.a <= 0.05f)
-                {
-                    ManaReso.Save(gameObject);
-                }
-            }
-        }
-    }
-
-
-    public  void Set(Color color, bool isStatic, string message, float speed, float time)
-    {
-        Static = isStatic;
-        Timer = time;
-        Speed = speed;
-        HudLab.text = message;
-        HudLab.color = new Color(color.r, color.g, color.b, 1);
-    }
-}

+ 9 - 0
Assets/Script/Object/Hud.meta

@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 3d54bc43d13b52244af8c6c72adc8697
+folderAsset: yes
+timeCreated: 1488422938
+licenseType: Pro
+DefaultImporter:
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 17 - 0
Assets/Script/Object/Hud/HudTarget.cs

@@ -0,0 +1,17 @@
+using UnityEngine;
+
+using System.Collections;
+
+public class HudTarget : MonoBehaviour 
+{
+    #region 变量
+
+    public Transform PosTra;
+
+    #endregion
+
+    private void FixedUpdate()
+    {
+        transform.position = Camera.main.WorldToScreenPoint(PosTra.position);
+    }
+}

+ 12 - 0
Assets/Script/Object/Hud/HudTarget.cs.meta

@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 75b514611e68b894cbd8cc7814234c05
+timeCreated: 1488423004
+licenseType: Pro
+MonoImporter:
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 43 - 0
Assets/Script/Object/Hud/HudText.cs

@@ -0,0 +1,43 @@
+using UnityEngine;
+using UnityEngine.UI;
+
+using System;
+using System.Collections;
+
+public class HudText : ObjRoot 
+{
+    #region 变量
+
+    private float Speed;
+    private Text HudLab;
+
+    #endregion
+
+    private void Awake()
+    {
+        Speed = 5f;
+        ObjType = ObjType.HudText;
+
+        HudLab = GetComponent<Text>();
+    }
+
+
+    private void FixedUpdate()
+    {
+        transform.position += new Vector3(0, Speed*Time.fixedDeltaTime, 0);
+
+        HudLab.SetAlpha(Mathf.Lerp(HudLab.color.a, 0, Time.fixedDeltaTime*2));
+
+        if (HudLab.color.a <= 0.05f)
+        {
+            ManaReso.Save(gameObject);
+        }
+    }
+
+
+    public  void Set(string message, Color color)
+    {
+        HudLab.text = message;
+        HudLab.color = color;
+    }
+}

+ 0 - 0
Assets/Script/Object/HUD.cs.meta → Assets/Script/Object/Hud/HudText.cs.meta


+ 2 - 2
Assets/Script/Object/Player.cs

@@ -84,7 +84,7 @@ public class Player : MonoBehaviour
         {
             ChildDic["Head1"].gameObject,
             ChildDic["Head2"].gameObject,
-            ChildDic["Head3"].gameObject
+            ChildDic["Head3"].gameObject,
         };
 
         HeadWearList = new List<GameObject>
@@ -98,7 +98,7 @@ public class Player : MonoBehaviour
 
         #endregion
 
-        ManaReso.GetUI("C_EnterGameA", ChildDic["GameBtnTraA"], ManaReso.Get("C_Main"));
+        ManaReso.GetHudTarget("C_EnterGameA", ChildDic["GameBtnTraA"], ManaReso.Get("C_Main"));
     }
 
 

+ 21 - 37
Assets/Script/Object/Skill/Ability.cs

@@ -264,6 +264,26 @@ public class Ability : SkillRoot
     }
 
 
+    protected void Upgrade()
+    {
+        if (ManaData.Pay(NewUpgradeAmt, UpgradeCur))
+        {
+            Level++;
+
+            UpgradeEffect();
+
+            NewUpgradeAmt = FmlParse(UpgradeFml, NewUpgradeAmt);
+
+            ItemLab.text = GetDescription(0);
+            ManaReso.SetText("Fe_Lab0", GetDescription(0));
+            ManaReso.SetText("Fe_Lab1", GetDescription(1));
+            ManaReso.SetText("Fe_BtnLab", string.Format("升级({0}{1:0})", UpgradeCur, NewUpgradeAmt));
+
+            ManaLog.Log(string.Format("<color=red>{0}</color> 升级 : {1}", Name, Level));
+        }
+    }
+
+
     protected void UnlockEffect()
     {
         SkillProcessor processor = new SkillProcessor();
@@ -302,48 +322,12 @@ public class Ability : SkillRoot
         processor.Process();
     }
 
-
-    protected void Upgrade()
-    {
-        if (ManaData.Pay(NewUpgradeAmt, UpgradeCur))
-        {
-            Level++;
-
-            UpgradeEffect();
-
-            UpgradeValue();
-
-            ItemLab.text = GetDescription(0);
-            ManaReso.SetText("Fe_Lab0", GetDescription(0));
-            ManaReso.SetText("Fe_Lab1", GetDescription(1));
-            ManaReso.SetText("Fe_BtnLab", string.Format("升级({0}{1:0})", UpgradeCur, NewUpgradeAmt));
-
-            ManaLog.Log(string.Format("<color=red>{0}</color> 升级 : {1}", Name, Level));
-        }
-    }
-
-    protected void UpgradeValue()
-    {
-        string[] strings = UpgradeFml.Split('*');
-
-        if (strings.Length == 1)
-        {
-
-        }
-        else
-        {
-            float factor = FloatParse(strings[1]);
-            
-            NewUpgradeAmt *= factor;
-        }
-    } //计算NewUpgradeAmt
-
     #region 解读器
 
     protected string GetDescription(int offset)
     {
         float temp;
-        string[] strings = Desc.Split(new char[] { '[', ']' });
+        string[] strings = Desc.Split('[', ']');
 
         StringBuilder stringBuilder = new StringBuilder();
 

+ 14 - 14
Assets/Script/Object/Skill/Pack.cs

@@ -70,22 +70,22 @@ public class Pack : SkillRoot
     {
         #region 配置
 
-        Icon = attributes[15].Value;
-        Desc = attributes[14].Value;
-        Anim = attributes[16].Value;
-        Label = attributes[17].Value;
+        Icon = attributes[14].Value;
+        Desc = attributes[13].Value;
+        Anim = attributes[15].Value;
+        Label = attributes[16].Value;
         Name = attributes[1].Value;
 
-        Flower = IntParse(attributes[10].Value);
+        Flower = IntParse(attributes[9].Value);
         ClassId = IntParse(attributes[3].Value);
-        UseAmt = FloatParse(attributes[13].Value);
-        CoinOnce = FloatParse(attributes[8].Value);
-        DiamondOnce = FloatParse(attributes[9].Value);
-
+        UseAmt = FloatParse(attributes[12].Value);
+        CoinOnce = FloatParse(attributes[7].Value);
+        DiamondOnce = FloatParse(attributes[8].Value);
+        
         Class = SkillClassParse(attributes[2].Value);
-        UseCur = CurrentParse(attributes[12].Value);
-        MinUseLv = MinLevelParse(attributes[11].Value);
-        MaxUseLv = MaxLevelParse(attributes[11].Value);
+        UseCur = CurrentParse(attributes[11].Value);
+        MinUseLv = MinLevelParse(attributes[10].Value);
+        MaxUseLv = MaxLevelParse(attributes[10].Value);
 
         ValueBuffParse(out Person, out PersonBuff, attributes[5].Value);
         ValueBuffParse(out SkillCD, out SkillCdBuff, attributes[6].Value);
@@ -189,7 +189,7 @@ public class Pack : SkillRoot
             processor.CoinOnce = CoinOnce;
             processor.CoinPerson = CoinPerson;
             processor.DiamondOnce = DiamondOnce;
-
+            
             processor.Process();
         }
     }
@@ -223,7 +223,7 @@ public class Pack : SkillRoot
 
     protected string GetDescription(int offset)
     {
-        string[] strings = Desc.Split(new char[] { '[', ']' });
+        string[] strings = Desc.Split('[', ']');
 
         StringBuilder stringBuilder = new StringBuilder();
 

+ 3 - 18
Assets/Script/Object/Skill/Skill.cs

@@ -417,12 +417,13 @@ public class Skill : SkillRoot
         {
             Level++;
 
+            NewUpgradeAmt = FmlParse(UpgradeFml, NewUpgradeAmt);
+
             UpgradeValue(ref NewPlus, Plus, UpgradePlus, 1);
             UpgradeValue(ref NewSkillCdBuff, UpgradeCD, 1);
             UpgradeValue(ref NewPersonBuff, PersonBuff, UpgradePerson, 1);
             UpgradeValue(ref NewCoinOnceBuff, UpgradeCoinOnce, 1);
 
-            UpgradeValue();
             UpgradeValue(ref NewPerson, Person, UpgradePerson, 1);
             UpgradeValue(ref NewSkillCD, SkillCD, UpgradeCD, 1);
             UpgradeValue(ref NewDuration, Duration, UpgradeDuration, 1);
@@ -438,22 +439,6 @@ public class Skill : SkillRoot
         }
     }
 
-    protected void UpgradeValue()
-    {
-        string[] strings = UpgradeFml.Split('*');
-
-        if (strings.Length == 1)
-        {
-            
-        }
-        else
-        {
-            float factor = FloatParse(strings[1]);
-
-            NewUpgradeAmt *= factor;
-        }
-    } //计算NewUpgradeAmt
-
     protected void UpgradeValue(ref float target, float baseValue, string fml, int offset)
     {
         if (Math.Abs(target) < 0.0005f)
@@ -482,7 +467,7 @@ public class Skill : SkillRoot
     protected string GetDescription(int offset)
     {
         float temp;
-        string[] strings = Desc.Split(new char[] { '[', ']' });
+        string[] strings = Desc.Split('[', ']');
 
         StringBuilder stringBuilder = new StringBuilder();
 

+ 130 - 0
Assets/Script/Object/Skill/SkillRoot.cs

@@ -88,6 +88,110 @@ public abstract class SkillRoot : IComparable
 
     #region 解读器
 
+    private string Calculate1(string str)
+    {
+        int index = 0;
+        int openIndex = 0;
+        bool flag = false;
+        bool group = false;
+
+        for (int i = 0; i < str.Length; i++)
+        {
+            if (group)
+            {
+                if (str[i] == '+' || str[i] == '-' || str[i] == '*' || str[i] == '/')
+                {
+                    str = str.Replace(openIndex, i - 1, Calculate2(str[index], str.Between(openIndex, index - 1), str.Between(index + 1, i - 1)));
+
+                    i = 0;
+                    group = false;
+                }
+                else if (i == str.Length - 1)
+                {
+                    str = str.Replace(openIndex, i, Calculate2(str[index], str.Between(openIndex, index - 1), str.Between(index + 1, i)));
+
+                    break;
+                }
+            }
+            else
+            {
+                if (str[i] == '+' || str[i] == '-')
+                {
+                    flag = true;
+                    openIndex = i + 1;
+                }
+                else if (str[i] == '*' || str[i] == '/')
+                {
+                    index = i;
+                    group = true;
+
+                    if (!flag)
+                    {
+                        openIndex = 0;
+                    }
+                }
+            }
+        }
+
+        group = false;
+
+        for (int i = 0; i < str.Length; i++)
+        {
+            if (group)
+            {
+                if (str[i] == '+' || str[i] == '-')
+                {
+                    str = str.Replace(0, i - 1, Calculate2(str[index], str.Between(0, index - 1), str.Between(index + 1, i - 1)));
+
+                    i = -1;
+                    group = false;
+                }
+                else if (i == str.Length - 1)
+                {
+                    return Calculate2(str[index], str.Between(0, index - 1), str.Between(index + 1, i));
+                }
+            }
+            else
+            {
+                if (str[i] == '+' || str[i] == '-')
+                {
+                    index = i;
+                    group = true;
+                }
+            }
+        }
+
+        return str;
+    }
+
+    private string Calculate2(char operatorR, string str1, string str2)
+    {
+        double var1 = double.Parse(str1);
+        double var2 = double.Parse(str2);
+
+        if (operatorR == '+')
+        {
+            return (var1 + var2).ToString();
+        }
+        else if (operatorR == '-')
+        {
+            return (var1 - var2).ToString();
+        }
+        else if (operatorR == '*')
+        {
+            return (var1 * var2).ToString();
+        }
+        else if (operatorR == '/')
+        {
+            return (var1 / var2).ToString();
+        }
+        else
+        {
+            throw new Exception(operatorR.ToString());
+        }
+    }
+
+
     protected int IntParse(string str)
     {
         if (string.IsNullOrEmpty(str))
@@ -112,6 +216,32 @@ public abstract class SkillRoot : IComparable
         }
     }
 
+    protected double FmlParse(string str, params double[] vars)
+    {
+        for (int i = 0; i < vars.Length; i++)
+        {
+            str = str.Replace(((char) (97 + i)).ToString(), vars[i].ToString());
+        }
+
+        int openIndex = 0;
+
+        for (int i = 0; i < str.Length; i++)
+        {
+            if (str[i] == '(')
+            {
+                openIndex = i;
+            }
+            else if (str[i] == ')')
+            {
+                str = str.Replace(openIndex, i, Calculate1(str.Between(openIndex + 1, i - 1)));
+
+                i = -1;
+            }
+        }
+
+        return double.Parse(Calculate1(str));
+    }
+
 
     protected bool BoolParse(string str)
     {

+ 9 - 0
Assets/Script/Tool/Anim.meta

@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 149af328c2f6f10459d9862729739297
+folderAsset: yes
+timeCreated: 1488381314
+licenseType: Pro
+DefaultImporter:
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 9 - 20
Assets/Script/Tool/Move.cs → Assets/Script/Tool/Anim/Move.cs

@@ -14,22 +14,18 @@ public class Move
 
     protected float Timer;
     protected float Duration;
+    protected Vector3 Delta;
     protected Vector3 Origin;
-    protected Vector3 Variation;
     protected Vector3 Destination;
     protected Transform Target;
-    protected CanvasGroup CanvasGroup;
 
     protected CurveFunctionV Func;
 
     #endregion
 
-    public Move(Transform target, float duration, Curve curve)
+    public Move(Transform target)
     {
         Target = target;
-        Duration = duration;
-
-        Func = ManaAnim.FunctionDicV[curve];
     }
 
 
@@ -50,7 +46,7 @@ public class Move
         }
         else
         {
-            Target.position = Func(Timer, Duration, Origin, Variation);
+            Target.position = Func(Timer, Duration, Origin, Delta);
 
             Timer += Time.fixedDeltaTime;
 
@@ -58,27 +54,20 @@ public class Move
         }
     }
 
-    public void StartMove(Vector3 variation, float duration = 0, Curve curve = Curve.Null)
+    public void StartMove(Vector3 destination, float duration, Curve curve)
     {
         Finish = false;
 
+        Delta = destination - Target.position;
         Origin = Target.position;
-        Variation = variation;
-        Destination = Target.position + variation;
+        Duration = duration;
+        Destination = destination;
+
+        Func = ManaAnim.FunctionDicV[curve];
 
         if (OnStart != null)
         {
             OnStart.Invoke();
         }
-
-        if (Math.Abs(duration) > 0.005f)
-        {
-            Duration = duration;
-        }
-
-        if (curve != Curve.Null)
-        {
-            Func = ManaAnim.FunctionDicV[curve];
-        }
     }
 }

+ 0 - 0
Assets/Script/Tool/Move.cs.meta → Assets/Script/Tool/Anim/Move.cs.meta


+ 0 - 0
Assets/Script/Tool/Tween.cs → Assets/Script/Tool/Anim/Tween.cs


+ 0 - 0
Assets/Script/Tool/Tween.cs.meta → Assets/Script/Tool/Anim/Tween.cs.meta


+ 6 - 6
Assets/Script/Tool/TweenCanvasGroup.cs → Assets/Script/Tool/Anim/TweenCG.cs

@@ -3,23 +3,23 @@
 using System;
 using System.Collections;
 
-public class TweenCanvasGroup : Tween
+public class TweenCG : Tween
 {
+    protected float Delta;
     protected float Origin;
-    protected float Variation;
     protected float Destination;
     protected CanvasGroup Target;
     protected CurveFunctionF Func;
 
-    public TweenCanvasGroup(Transform target, float origin, float destination, float duration, bool originActive, bool destActive, Curve curve)
+    public TweenCG(Transform target, float origin, float destination, float duration, bool originActive, bool destActive, Curve curve)
     {
         Target = target.GetComponent<CanvasGroup>();
         Duration = duration;
         DestActive = destActive;
         OriginActive = originActive;
 
+        Delta = destination - origin;
         Origin = origin;
-        Variation = destination - origin;
         Destination = destination;
 
         OnForwardStart += () => Target.SetActive(true);
@@ -54,7 +54,7 @@ public class TweenCanvasGroup : Tween
         }
         else
         {
-            Target.alpha = Func(Timer, Duration, Origin, Variation);
+            Target.alpha = Func(Timer, Duration, Origin, Delta);
 
             Timer += Time.fixedDeltaTime;
 
@@ -76,7 +76,7 @@ public class TweenCanvasGroup : Tween
         }
         else
         {
-            Target.alpha = Func(Timer, Duration, Destination, -Variation);
+            Target.alpha = Func(Timer, Duration, Destination, -Delta);
 
             Timer += Time.fixedDeltaTime;
 

+ 0 - 0
Assets/Script/Tool/TweenCanvasGroup.cs.meta → Assets/Script/Tool/Anim/TweenCG.cs.meta


+ 4 - 4
Assets/Script/Tool/TweenVector.cs → Assets/Script/Tool/Anim/TweenVector.cs

@@ -5,8 +5,8 @@ using System.Collections;
 
 public class TweenVector : Tween
 {
+    protected Vector3 Delta;
     protected Vector3 Origin;
-    protected Vector3 Variation;
     protected Vector3 Destination;
     protected Transform Target;
     protected CanvasGroup CanvasGroup;
@@ -19,8 +19,8 @@ public class TweenVector : Tween
         DestActive = destActive;
         OriginActive = originActive;
 
+        Delta = destination - origin;
         Origin = origin;
-        Variation = destination - origin;
         Destination = destination;
 
         CanvasGroup = Target.GetComponent<CanvasGroup>();
@@ -65,7 +65,7 @@ public class TweenVector : Tween
         }
         else
         {
-            Target.position = Func(Timer, Duration, Origin, Variation);
+            Target.position = Func(Timer, Duration, Origin, Delta);
 
             Timer += Time.fixedDeltaTime;
 
@@ -87,7 +87,7 @@ public class TweenVector : Tween
         }
         else
         {
-            Target.position = Func(Timer, Duration, Destination, -Variation);
+            Target.position = Func(Timer, Duration, Destination, -Delta);
 
             Timer += Time.fixedDeltaTime;
 

+ 0 - 0
Assets/Script/Tool/TweenVector.cs.meta → Assets/Script/Tool/Anim/TweenVector.cs.meta


+ 23 - 4
Assets/Script/Tool/Extension.cs

@@ -2,14 +2,15 @@
 using UnityEngine.UI;
 
 using System.Collections;
+using System.Collections.Generic;
 
 public static class Extension
 {
     #region Move
 
-    public static void Move<T>(this T t, Vector3 offset, float duration = 0, Curve curve = Curve.Null) where T : Component
+    public static void Move<T>(this T t, Vector3 destination, float duration, Curve curve) where T : Component
     {
-        ManaAnim.Move(t.transform, offset, duration, curve);
+        ManaAnim.Move(t.transform, destination, duration, curve);
     }
 
     public static Move GetMove<T>(this T t) where T : Component
@@ -17,9 +18,9 @@ public static class Extension
         return ManaAnim.GetMove(t.transform);
     }
 
-    public static Move CreateMove<T>(this T t, float duration, Curve curve) where T : Component
+    public static Move CreateMove<T>(this T t) where T : Component
     {
-        return ManaAnim.CreateMove(t.transform, duration, curve);
+        return ManaAnim.CreateMove(t.transform);
     }
 
     #endregion
@@ -52,6 +53,24 @@ public static class Extension
 
     #endregion
 
+    #region String
+
+    public static string Replace(this string str, int startIndex, int endIndex, string newStr)
+    {
+        str = str.Remove(startIndex, endIndex - startIndex + 1);
+
+        str = str.Insert(startIndex, newStr);
+
+        return str;
+    }
+
+    public static string Between(this string str, int startIndex, int endIndex)
+    {
+        return str.Substring(startIndex, endIndex - startIndex + 1);
+    }
+
+    #endregion
+
     #region Active
 
     public static void SetActive<T>(this T t, bool active) where T : Component

+ 14 - 9
MyLovelyGarden.csproj

@@ -13,11 +13,13 @@
     <TargetFrameworkIdentifier>.NETFramework</TargetFrameworkIdentifier>
     <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
     <TargetFrameworkProfile>Unity Subset v3.5</TargetFrameworkProfile>
-    <CompilerResponseFile></CompilerResponseFile>
+    <CompilerResponseFile>
+    </CompilerResponseFile>
     <UnityProjectType>Game:1</UnityProjectType>
     <UnityBuildTarget>Android:13</UnityBuildTarget>
     <UnityVersion>5.5.0f3</UnityVersion>
-    <RootNamespace></RootNamespace>
+    <RootNamespace>
+    </RootNamespace>
     <LangVersion Condition=" '$(VisualStudioVersion)' != '10.0' ">4</LangVersion>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
@@ -107,7 +109,8 @@
     <Compile Include="Assets\Script\Manage\ManaReso.cs" />
     <Compile Include="Assets\Script\Object\Flower.cs" />
     <Compile Include="Assets\Script\Object\Garden.cs" />
-    <Compile Include="Assets\Script\Object\HUD.cs" />
+    <Compile Include="Assets\Script\Object\Hud\HudTarget.cs" />
+    <Compile Include="Assets\Script\Object\Hud\HudText.cs" />
     <Compile Include="Assets\Script\Object\ObjRoot.cs" />
     <Compile Include="Assets\Script\Object\Player.cs" />
     <Compile Include="Assets\Script\Object\Skill\Ability.cs" />
@@ -116,15 +119,15 @@
     <Compile Include="Assets\Script\Object\Skill\Skill.cs" />
     <Compile Include="Assets\Script\Object\Skill\SkillProcessor.cs" />
     <Compile Include="Assets\Script\Object\Skill\SkillRoot.cs" />
+    <Compile Include="Assets\Script\Tool\Anim\Move.cs" />
+    <Compile Include="Assets\Script\Tool\Anim\Tween.cs" />
+    <Compile Include="Assets\Script\Tool\Anim\TweenCG.cs" />
+    <Compile Include="Assets\Script\Tool\Anim\TweenVector.cs" />
     <Compile Include="Assets\Script\Tool\Auxiliary.cs" />
     <Compile Include="Assets\Script\Tool\Data.cs" />
     <Compile Include="Assets\Script\Tool\DelayCall.cs" />
     <Compile Include="Assets\Script\Tool\Extension.cs" />
     <Compile Include="Assets\Script\Tool\Language.cs" />
-    <Compile Include="Assets\Script\Tool\Move.cs" />
-    <Compile Include="Assets\Script\Tool\Tween.cs" />
-    <Compile Include="Assets\Script\Tool\TweenCanvasGroup.cs" />
-    <Compile Include="Assets\Script\Tool\TweenVector.cs" />
     <Compile Include="Assets\Script\Utils\DGFileUtil.cs" />
     <Compile Include="Assets\Script\Utils\JsonUtil.cs" />
     <Compile Include="Assets\Script\Utils\MD5Util.cs" />
@@ -134,11 +137,13 @@
   <ItemGroup>
     <None Include="Assets\Resources\XML\Config\ability_config.xml" />
     <None Include="Assets\Resources\XML\Config\flower_config.xml" />
-    <None Include="Assets\Resources\XML\Config\pack_config.xml" />
+    <None Include="Assets\Resources\XML\Config\pack_config.xml">
+      <SubType>Designer</SubType>
+    </None>
     <None Include="Assets\Resources\XML\Config\skill_config.xml" />
     <None Include="Assets\Resources\XML\lan\ChineseSimplified.xml" />
     <None Include="Assets\Resources\XML\lan\English.xml" />
   </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <Target Name="GenerateTargetFrameworkMonikerAttribute" />
-</Project>
+</Project>