LiuQilin 8 роки тому
батько
коміт
a791181693

BIN
.vs/MyLovelyGarden/v14/.suo


+ 1 - 1
Assets/Resources/Font/SourceHanSansCN-Regular.otf.meta

@@ -17,5 +17,5 @@ TrueTypeFontImporter:
   fontRenderingMode: 0
   ascentCalculationMode: 1
   userData: 
-  assetBundleName: 
+  assetBundleName: ui
   assetBundleVariant: 

BIN
Assets/Resources/Logo.unity


+ 1 - 1
Assets/Resources/Shader/Gray.shader.meta

@@ -5,5 +5,5 @@ licenseType: Pro
 ShaderImporter:
   defaultTextures: []
   userData: 
-  assetBundleName: 
+  assetBundleName: shader
   assetBundleVariant: 

BIN
Assets/Resources/Shader/Gray.mat → Assets/Resources/Shader/GrayMat.mat


+ 0 - 0
Assets/Resources/Shader/Gray.mat.meta → Assets/Resources/Shader/GrayMat.mat.meta


+ 1 - 1
Assets/Resources/Shader/HighLight.shader.meta

@@ -5,5 +5,5 @@ licenseType: Pro
 ShaderImporter:
   defaultTextures: []
   userData: 
-  assetBundleName: 
+  assetBundleName: shader
   assetBundleVariant: 

BIN
Assets/Resources/Shader/HighLight.mat → Assets/Resources/Shader/HighLightMat.mat


+ 0 - 0
Assets/Resources/Shader/HighLight.mat.meta → Assets/Resources/Shader/HighLightMat.mat.meta


+ 2 - 1
Assets/Resources/XML/Config/PlayerConfig.xml

@@ -6,8 +6,9 @@
   <Person value="0" />
   <Diamond value="0" />
   <QuitTime value="3/24/2017 10:40:04 PM" />
-  <CoinPerson value="0" />
+  <MiniTimer value="0" />
   <CircleTimer value="0" />
+  <CoinPerson value="0" />
   <PlantList SlotA1="1" SlotA2="2" SlotA3="3" SlotA4="4" SlotA5="5" SlotA6="6" SlotA7="7" SlotA8="8" SlotA9="9" />
   <FlowerList ID="1 2 3 4 5 6 7 8 9 10" />
   <SkillList>

+ 6 - 0
Assets/Script/Editor/EditorBundle.cs

@@ -17,4 +17,10 @@ public class Bundle
     {
         BuildPipeline.BuildAssetBundles(Application.streamingAssetsPath + "/Bundle/IOS", BuildAssetBundleOptions.None, BuildTarget.iOS);
     }
+
+    [MenuItem("DashGame/Bundle/PackWindows")]
+    public static void PackWindows()
+    {
+        BuildPipeline.BuildAssetBundles(Application.streamingAssetsPath + "/Bundle/Windows", BuildAssetBundleOptions.None, BuildTarget.StandaloneWindows64);
+    }
 }

+ 25 - 10
Assets/Script/Manage/Initializer.cs

@@ -16,12 +16,15 @@ public class Initializer : MonoBehaviour
 
     #endregion
 
-    private void Start()
+    private void Awake()
     {
         RegistList = new List<Regist>();
 
-	    gameObject.AddComponent<Bundle>();
-
+        if (Bundle.Instance == null)
+        {
+            gameObject.AddScript<Bundle>();
+        }
+           
 	    gameObject.AddScript<Auxiliary>();
         gameObject.AddScript<ManaReso>();
         gameObject.AddScript<ManaAnim>();
@@ -35,13 +38,7 @@ public class Initializer : MonoBehaviour
         gameObject.AddScript<ManaDebug>();
         gameObject.AddScript<ManaMiniGame>();
 
-        Bundle.Instance.LoadAll
-        (
-            () =>
-            {
-                Initialize();
-            }
-        );
+        StartCoroutine(IInitialize());
     }
 
     public static void Initialize()
@@ -72,5 +69,23 @@ public class Initializer : MonoBehaviour
         {
             RegistList[i].RegistValueC();
         }
+
+        //Bundle.UI.Unload(true);
+        //Bundle.Skill.Unload(true);
+        //Bundle.Config.Unload(true);
+        //Bundle.Object.Unload(true);
+        //Bundle.Shader.Unload(true);
+        //Bundle.Garden.Unload(true);
+        //Bundle.Character.Unload(true);
+    }
+
+    public IEnumerator IInitialize()
+    {
+        while (Bundle.LoadComplete == false)
+        {
+            yield return null;
+        }
+
+        Initialize();
     }
 }

+ 6 - 0
Assets/Script/Manage/ManaData.cs

@@ -196,6 +196,7 @@ public class ManaData : Regist
         #endregion
     }
 
+
     private void Update()
     {
         if (Pause)
@@ -209,6 +210,8 @@ public class ManaData : Regist
 
             if (MiniTimer < 0)
             {
+                Mini = true;
+
                 ManaReso.Get("C_MiniGame").TweenForCG();
             }
         }
@@ -448,6 +451,9 @@ public class ManaData : Regist
         #region 读数据存档
 
         Level = int.Parse(Data.PlayerNode.SelectSingleNode("Level").Attributes[0].Value);
+        MiniTimer = float.Parse(Data.PlayerNode.SelectSingleNode("MiniTimer").Attributes[0].Value);
+
+        ManaDebug.Log(string.Format("<color=red>{0:0}</color>后激活小游戏", MiniTimer));
 
         Coin = double.Parse(Data.PlayerNode.SelectSingleNode("Coin").Attributes[0].Value);
         Diamond = double.Parse(Data.PlayerNode.SelectSingleNode("Diamond").Attributes[0].Value);

+ 26 - 1
Assets/Script/Manage/ManaMiniGame.cs

@@ -192,6 +192,19 @@ public class ManaMiniGame : Regist
             }
         }
     }
+    public static bool Prepare
+    {
+        get { return _Prepare; }
+        set
+        {
+            _Prepare = value;
+
+            if (Prepare)
+            {
+                PrepareTimer = 3;
+            }
+        }
+    }
     public static float GameTimer
     {
         get { return _GameTimer; }
@@ -219,6 +232,7 @@ public class ManaMiniGame : Regist
     private static bool _Game;
     private static bool _Pause;
     private static bool _Panalty;
+    private static bool _Prepare;
     private static float _GameTimer;
     private static float _PrepareTimer;
 
@@ -241,7 +255,7 @@ public class ManaMiniGame : Regist
 
     private void FixedUpdate()
     {
-        if (PrepareTimer > 0)
+        if (Prepare)
         {
             PrepareTimer -= Time.fixedDeltaTime;
 
@@ -427,6 +441,7 @@ public class ManaMiniGame : Regist
         Game = true;
         Pause = false;
         Panalty = false;
+        Prepare = false;
 
         OpTimer = OpTime;
         GameTimer = GameTime;
@@ -440,6 +455,15 @@ public class ManaMiniGame : Regist
 
     public static void GameAbort()
     {
+        if (Game)
+        {
+            ManaData.Mini = false;
+
+            ManaData.MiniTimer = Mathf.Lerp(180, 300, Random.Range(0, 1f));
+
+            ManaDebug.Log(string.Format("<color=red>{0:0}</color>秒后激活小游戏", ManaData.MiniTimer));
+        }
+
         ManaReso.SetActive("D_Rip1", false);
         ManaReso.SetActive("D_Water1", false);
         ManaReso.SetActive("D_Fertilize1", false);
@@ -453,6 +477,7 @@ public class ManaMiniGame : Regist
         Game = false;
         Pause = false;
         Panalty = false;
+        Prepare = false;
 
         OpTimer = OpTime;
         GameTimer = GameTime;

+ 35 - 0
Assets/Script/Manage/ManaReso.cs

@@ -70,30 +70,65 @@ public class ManaReso : Regist
             if (folder == Folder.UI)
             {
                 t = Bundle.UI.LoadAsset<T>(goName);
+
+                if (t == null)
+                {
+                    t = Bundle.TempUI.LoadAsset<T>(goName);
+                }
             }
             else if (folder == Folder.Skill)
             {
                 t = Bundle.Skill.LoadAsset<T>(goName);
+
+                if (t == null)
+                {
+                    t = Bundle.TempSkill.LoadAsset<T>(goName);
+                }
             }
             else if (folder == Folder.Config)
             {
                 t = Bundle.Config.LoadAsset<T>(goName);
+
+                if (t == null)
+                {
+                    t = Bundle.TempConfig.LoadAsset<T>(goName);
+                }
             }
             else if (folder == Folder.Object)
             {
                 t = Bundle.Object.LoadAsset<T>(goName);
+
+                if (t == null)
+                {
+                    t = Bundle.TempObject.LoadAsset<T>(goName);
+                }
             }
             else if (folder == Folder.Shader)
             {
                 t = Bundle.Shader.LoadAsset<T>(goName);
+
+                if (t == null)
+                {
+                    t = Bundle.TempShader.LoadAsset<T>(goName);
+                }
             }
             else if (folder == Folder.Garden)
             {
                 t = Bundle.Garden.LoadAsset<T>(goName);
+
+                if (t == null)
+                {
+                    t = Bundle.TempGarden.LoadAsset<T>(goName);
+                }
             }
             else if (folder == Folder.Character)
             {
                 t = Bundle.Character.LoadAsset<T>(goName);
+
+                if (t == null)
+                {
+                    t = Bundle.TempCharacter.LoadAsset<T>(goName);
+                }
             }
             else
             {

+ 8 - 13
Assets/Script/Manage/ManaUI.cs

@@ -284,8 +284,6 @@ public class ManaUI : Regist
 
         tween.OnForwardStart += () =>
         {
-            ManaData.Mini = true;
-
             ManaReso.SetText("Da_CoinLab", "");
             ManaReso.SetText("Da_FlowerLab", "");
             ManaReso.SetText("Da_DiamondLab", "");
@@ -295,15 +293,6 @@ public class ManaUI : Regist
             ManaReso.SetActive("Da_Diamond", true);
         };
 
-        tween.OnBackwardStart += () =>
-        {
-            ManaData.Mini = false;
-
-            ManaData.MiniTimer = Mathf.Lerp(180, 300, Random.Range(0, 1f));
-
-            ManaDebug.Log(string.Format("<color=red>{0:0}</color>秒后激活小游戏", ManaData.MiniTimer));
-        };
-
         ManaReso.AddButtonEvent
         (
             "C_MiniGame",
@@ -373,7 +362,7 @@ public class ManaUI : Regist
             "D_Begin",
             () =>
             {
-                ManaMiniGame.PrepareTimer = 3;
+                ManaMiniGame.Prepare = true;
             }
         );
 
@@ -425,6 +414,13 @@ public class ManaUI : Regist
 
         tween.OnBackwardStart += () =>
         {
+            ManaReso.SetText("D_BeginLab", Language.GetStr("UI", "D_BeginLab0"));
+
+            if (ManaData.Mini == false)
+            {
+                ManaReso.Get("C_MiniGame").TweenBacCG();
+            }
+
             ManaReso.Get("MusicMini").TweenBacAudio();
         };
 
@@ -447,7 +443,6 @@ public class ManaUI : Regist
             {
                 ManaReso.Get("C_Main").TweenForCG();
 
-                ManaReso.Get("C_MiniGame").TweenBacCG();
                 ManaReso.Get("D_MiniGame").TweenBacCG();
 
                 ManaReso.Get("GardenMini").TweenBacVec();

+ 9 - 2
Assets/Script/Object/Skill/Ability.cs

@@ -220,10 +220,10 @@ public class Ability : SkillRoot
     {
         if (ManaData.Pay(UnlockAmt, UnlockCur))
         {
-            ManaDebug.Log(string.Format("技能<color=red>{0}</color>已解锁", Name));
-
             UseConti();
 
+            ManaDebug.Log(string.Format("技能<color=red>{0}</color>已解锁", Name));
+
             if (UpgradeCur != Current.Free)
             {
                 ItemStatus = SkillStatus.Upgrade;
@@ -414,6 +414,13 @@ public class Ability : SkillRoot
             strb.AppendFormat(" 减少冷却上限<color=red>{0}%</color>", SkillCdBuff * 100);
         }
 
+        if (!string.IsNullOrEmpty(UnlockPos))
+        {
+            int amt = int.Parse(UnlockPos);
+
+            strb.AppendFormat(" 解锁了<color=red>{0}</color>块土地", amt);
+        }
+
         strb.Append(" <color=red>永久有效</color>");
 
         ManaDebug.Log(strb.ToString());

+ 1 - 1
Assets/Script/Object/Skill/BigSkill.cs

@@ -45,7 +45,7 @@ public class BigSkill : Skill
                     BarBtn.interactable = false;
                     BarLab.text = "";
 
-                    BarBk1.material = ManaReso.Load<Material>("Gray", Folder.Shader);
+                    BarBk1.material = ManaReso.Load<Material>("GrayMat", Folder.Shader);
                 }
                 else
                 {

+ 32 - 0
Assets/Script/Tool/Auxiliary.cs

@@ -10,6 +10,7 @@ using System.Linq;
 using System.Text;
 using System.Collections;
 using System.Collections.Generic;
+using System.Runtime.Serialization.Formatters.Binary;
 using System.Security.Cryptography;
 
 public class Auxiliary : MonoBehaviour 
@@ -26,6 +27,20 @@ public class Auxiliary : MonoBehaviour
     public static bool AnyKeyUp;
     public static bool AnyKeyDown;
     public static Auxiliary Inst;
+
+    public static MD5 MD5
+    {
+        get
+        {
+            if (_MD5 == null)
+            {
+                _MD5 = new MD5CryptoServiceProvider();
+            }
+
+            return _MD5;
+        }
+        set { _MD5 = value; }
+    }
     public static DESCryptoServiceProvider Des
     {
         get
@@ -42,6 +57,7 @@ public class Auxiliary : MonoBehaviour
         set { _Des = value; }
     }
 
+    private static MD5 _MD5;
     private static DESCryptoServiceProvider _Des;
 
     #endregion
@@ -124,6 +140,22 @@ public class Auxiliary : MonoBehaviour
     }
 
 
+    public static byte[] GetMD5(object obj)
+    {
+        
+        MemoryStream memoryStream = new MemoryStream();
+        BinaryFormatter binaryFormatter = new BinaryFormatter();
+
+        binaryFormatter.Serialize(memoryStream, obj);
+
+        byte[] bytes = memoryStream.GetBuffer();
+
+        memoryStream.Dispose();
+
+        return MD5.ComputeHash(bytes);
+    }
+
+
     public static byte[] Encrypt(string str)
     {
         byte[] bytes = Encoding.UTF8.GetBytes(str);

+ 86 - 2
Assets/Script/Tool/Bundle.cs

@@ -7,7 +7,10 @@ public class Bundle : MonoBehaviour
 {
     #region
 
+    public static bool LoadComplete;
+
     public static Bundle Instance;
+
     public static AssetBundle UI;
     public static AssetBundle Skill;
     public static AssetBundle Config;
@@ -16,17 +19,32 @@ public class Bundle : MonoBehaviour
     public static AssetBundle Garden;
     public static AssetBundle Character;
 
+    public static AssetBundle TempUI;
+    public static AssetBundle TempSkill;
+    public static AssetBundle TempConfig;
+    public static AssetBundle TempObject;
+    public static AssetBundle TempShader;
+    public static AssetBundle TempGarden;
+    public static AssetBundle TempCharacter;
+
     #endregion
 
     public void Awake()
     {
         Instance = this;
+
+        DontDestroyOnLoad(gameObject);
+
+        LoadAll
+        (
+            () => LoadComplete = true
+        );
     }
 
 
     public static string GetStreamPath()
     {
-        return "file://" + Application.streamingAssetsPath + "/Bundle/Andriod/";
+        return "file://" + Application.streamingAssetsPath + "/Bundle/Windows/";
     }
 
 
@@ -45,7 +63,10 @@ public class Bundle : MonoBehaviour
         yield return LoadGarden();
         yield return LoadCharacter();
 
-        callback.Invoke();
+        if (callback != null)
+        {
+            callback.Invoke();
+        }
     }
 
 
@@ -63,6 +84,15 @@ public class Bundle : MonoBehaviour
         {
             Debug.Log(www.error);
         }
+
+        www = new WWW(GetStreamPath() + "uitemp");
+
+        yield return www;
+
+        if (string.IsNullOrEmpty(www.error))
+        {
+            TempUI = www.assetBundle;
+        }
     }
 
     public static IEnumerator LoadSkill()
@@ -79,6 +109,15 @@ public class Bundle : MonoBehaviour
         {
             Debug.Log(www.error);
         }
+
+        www = new WWW(GetStreamPath() + "skilltemp");
+
+        yield return www;
+
+        if (string.IsNullOrEmpty(www.error))
+        {
+            TempSkill = www.assetBundle;
+        }
     }
 
     public static IEnumerator LoadConfig()
@@ -95,6 +134,15 @@ public class Bundle : MonoBehaviour
         {
             Debug.Log(www.error);
         }
+
+        www = new WWW(GetStreamPath() + "configtemp");
+
+        yield return www;
+
+        if (string.IsNullOrEmpty(www.error))
+        {
+            TempConfig = www.assetBundle;
+        }
     }
 
     public static IEnumerator LoadObject()
@@ -111,6 +159,15 @@ public class Bundle : MonoBehaviour
         {
             Debug.Log(www.error);
         }
+
+        www = new WWW(GetStreamPath() + "objecttemp");
+
+        yield return www;
+
+        if (string.IsNullOrEmpty(www.error))
+        {
+            TempObject = www.assetBundle;
+        }
     }
 
     public static IEnumerator LoadShader()
@@ -127,6 +184,15 @@ public class Bundle : MonoBehaviour
         {
             Debug.Log(www.error);
         }
+
+        www = new WWW(GetStreamPath() + "shadertemp");
+
+        yield return www;
+
+        if (string.IsNullOrEmpty(www.error))
+        {
+            TempShader = www.assetBundle;
+        }
     }
 
     public static IEnumerator LoadGarden()
@@ -143,6 +209,15 @@ public class Bundle : MonoBehaviour
         {
             Debug.Log(www.error);
         }
+
+        www = new WWW(GetStreamPath() + "gardentemp");
+
+        yield return www;
+
+        if (string.IsNullOrEmpty(www.error))
+        {
+            TempGarden = www.assetBundle;
+        }
     }
 
     public static IEnumerator LoadCharacter()
@@ -159,5 +234,14 @@ public class Bundle : MonoBehaviour
         {
             Debug.Log(www.error);
         }
+
+        www = new WWW(GetStreamPath() + "charactertemp");
+
+        yield return www;
+
+        if (string.IsNullOrEmpty(www.error))
+        {
+            TempCharacter = www.assetBundle;
+        }
     }
 }

+ 2 - 0
Assets/Script/Tool/Data.cs

@@ -204,6 +204,7 @@ public class Data
         PlayerNode.SelectSingleNode("Diamond").Attributes[0].Value = ManaData.Diamond.ToString();
         PlayerNode.SelectSingleNode("QuitTime").Attributes[0].Value = DateTime.Now.ToString();
         PlayerNode.SelectSingleNode("CoinPerson").Attributes[0].Value = ManaData.CoinPerson.ToString();
+        PlayerNode.SelectSingleNode("MiniTimer").Attributes[0].Value = ManaData.MiniTimer.ToString();
         PlayerNode.SelectSingleNode("CircleTimer").Attributes[0].Value = ManaData.CircleTimer.ToString();
     }
 
@@ -393,6 +394,7 @@ public class Data
         PlayerNode.SelectSingleNode("Diamond").Attributes[0].Value = "0";
         PlayerNode.SelectSingleNode("QuitTime").Attributes[0].Value = DateTime.Now.ToString();
         PlayerNode.SelectSingleNode("CoinPerson").Attributes[0].Value = "0";
+        PlayerNode.SelectSingleNode("MiniTimer").Attributes[0].Value = "0";
         PlayerNode.SelectSingleNode("CircleTimer").Attributes[0].Value = "10";
     }
 

+ 2 - 13
MyLovelyGarden.txt

@@ -1,22 +1,11 @@
-Shader加载出来是粉色、变为全透明了
-
-异步加载 Bundle的释放 Assetbundle签名 
-
-存档加密
-
-小游戏激活存档
-
-小游戏奖励加成如何显示
-
-Tab的Shader
-
-
 字体
 
 Anchor
 
 RichText
 
+存档加密
+
 OverFlow
 
 RaycastTarget

BIN
ProjectSettings/GraphicsSettings.asset