jet vor 8 Jahren
Ursprung
Commit
dddc04e131

+ 9 - 0
Assets/Advertisements/Editor/Resources/Android/builds.meta

@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 8d2d384f78b29a44a9c70c3daf45d1cb
+folderAsset: yes
+timeCreated: 1494301205
+licenseType: Pro
+DefaultImporter:
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 9 - 0
Assets/Advertisements/Editor/Resources/iOS/builds.meta

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

+ 4 - 4
Assets/Resource/XML/Config/lottery_config.xml

@@ -1,8 +1,8 @@
 <data>
-  <item id="1" type="1" rate="0.25" left_border="100000" right_border="200000" />
-  <item id="2" type="2" rate="0.25" left_border="100" right_border="200" />
-  <item id="3" type="3" rate="0.25" left_border="3" right_border="36" />
-  <item id="4" type="4" rate="0.25" left_border="2,201" right_border="30,217" />
+  <item id="1" type="1" rate="0.25" left_border="333" right_border="333" />
+  <item id="2" type="2" rate="0.25" left_border="333" right_border="333" />
+  <item id="3" type="3" rate="0.25" left_border="3" right_border="5" />
+  <item id="4" type="4" rate="0.25" left_border="2" right_border="4" />
   <comment>
     <id>
 id

BIN
Assets/Resource/Xlsx/lottery_config.xlsx


+ 175 - 159
Assets/Script/Manage/ManaSign.cs

@@ -90,7 +90,7 @@ public class Sign
     {
         if (IsLottery)
         {
-            Lottery.PlayAnimation();
+            Lottery.EnterAnimation();
 
             return;
         }
@@ -229,16 +229,21 @@ public class Lottery
 {
     #region Var
 
+    public int PosIndex;
     public int Type;
     public int Value;
     public Text Lab;
-    public Transform BK;
     public Image Icon1;
     public Image Icon2;
     public Button Button;
+    public Transform BK;
+    public Transform Item;
+
+    public static List<int> TempTypeList = new List<int>();
+    public static List<int> TempValueList = new List<int>();
+    public static List<Lottery> TempLotteryList = new List<Lottery>();
 
     public static List<int> TypeList = new List<int>();
-    public static List<int> ValueList = new List<int>();
     public static List<float> RateList = new List<float>();
     public static List<Vector3> PosList = new List<Vector3>();
     public static List<List<int>> LeftBorderDList = new List<List<int>>();
@@ -274,160 +279,143 @@ public class Lottery
         }
     }
 
-    public static void CreateLottery(Transform lotteryItem)
+    public static Lottery CreateLottery(int type, int posIndex, Transform lotteryItem)
     {
         Lottery lottery = new Lottery();
 
-        #region 默认值
-
-        lottery.Type = TypeList[0];
+        lottery.Type = type;
 
         lottery.Value = Random.Range(LeftBorderDList[0][0], RightBorderDList[0][0] + 1);
-        
-        #endregion
-
-        float random = Random.Range(0f, 1f);
 
-        for (int i = 0; i < RateList.Count; i++)
+        if (lottery.Type == 3)
         {
-            if (random <= RateList.MySum(f => f, i + 1))
-            {
-                lottery.Type = TypeList[i];
+            #region
 
-                if (lottery.Type == 3)
-                {
-                    #region
+            bool allUnlock = true;
 
-                    bool allUnlock = true;
-
-                    for (int j = 0; j < LeftBorderDList[i].Count; j++)
-                    {
-                        for (int k = LeftBorderDList[i][j]; k < RightBorderDList[i][j] + 1; k++)
-                        {
-                            if (!ManaGarden.FlowerInfoDic[k].Unlock && !ValueList.Contains(k))
-                            {
-                                allUnlock = false;
-                                
-                                goto exit;
-                            }
-                        }
-                    }
-                    exit :
-
-                    if (allUnlock)
+            for (int j = 0; j < LeftBorderDList[type - 1].Count; j++)
+            {
+                for (int k = LeftBorderDList[type - 1][j]; k < RightBorderDList[type - 1][j] + 1; k++)
+                {
+                    if (!ManaGarden.FlowerInfoDic[k].Unlock && !TempValueList.Contains(k))
                     {
-                        int index = Random.Range(0, LeftBorderDList[i].Count);
-
-                        lottery.Value = Random.Range(LeftBorderDList[i][index], RightBorderDList[i][index] + 1);
+                        allUnlock = false;
 
-                        FlowerInfo flowerInfo = ManaGarden.FlowerInfoDic[lottery.Value];
-
-                        lottery.Value = flowerInfo.UnlockAmt/5;
-
-                        if (flowerInfo.UnlockCur == Current.Coin)
-                        {
-                            lottery.Type = 1;
-                        }
-                        else if (flowerInfo.UnlockCur == Current.Diamond)
-                        {
-                            lottery.Type = 2;
-                        }
+                        goto exit;
                     }
-                    else
-                    {
-                        int anticrush = 0;
+                }
+            }
+            exit :
 
-                        do
-                        {
-                            if (anticrush++>10000)
-                            {
-                                throw new Exception();
-                            }
+            if (allUnlock)
+            {
+                int index = Random.Range(0, LeftBorderDList[type - 1].Count);
 
-                            int index = Random.Range(0, LeftBorderDList[i].Count);
+                lottery.Value = Random.Range(LeftBorderDList[type - 1][index], RightBorderDList[type - 1][index] + 1);
 
-                            lottery.Value = Random.Range(LeftBorderDList[i][index], RightBorderDList[i][index] + 1);
-                        }
-                        while (ManaGarden.FlowerInfoDic[lottery.Value].Unlock || ValueList.Contains(lottery.Value));
+                FlowerInfo flowerInfo = ManaGarden.FlowerInfoDic[lottery.Value];
 
-                        ValueList.Add(lottery.Value);
-                    }
+                lottery.Value = flowerInfo.UnlockAmt/5;
 
-                    #endregion
+                if (flowerInfo.UnlockCur == Current.Coin)
+                {
+                    lottery.Type = 1;
                 }
-                else if (lottery.Type == 4)
+                else if (flowerInfo.UnlockCur == Current.Diamond)
                 {
-                    #region
-
-                    bool allBought = true;
+                    lottery.Type = 2;
+                }
+            }
+            else
+            {
+                int anticrush = 0;
 
-                    for (int j = 0; j < LeftBorderDList[i].Count; j++)
+                do
+                {
+                    if (anticrush++ > 10000)
                     {
-                        for (int k = LeftBorderDList[i][j]; k < RightBorderDList[i][j] + 1; k++)
-                        {
-                            if (!ManaPlayer.CloseUnitDic[k].Bought && !ValueList.Contains(k))
-                            {
-                                allBought = false;
-                                
-                                goto exit;
-                            }
-                        }
+                        throw new Exception();
                     }
-                    exit :
 
-                    if (allBought)
-                    {
-                        int index = Random.Range(0, LeftBorderDList[i].Count);
+                    int index = Random.Range(0, LeftBorderDList[type - 1].Count);
 
-                        lottery.Value = Random.Range(LeftBorderDList[i][index], RightBorderDList[i][index] + 1);
+                    lottery.Value = Random.Range(LeftBorderDList[type - 1][index], RightBorderDList[type - 1][index] + 1);
+                } while (ManaGarden.FlowerInfoDic[lottery.Value].Unlock || TempValueList.Contains(lottery.Value));
 
-                        CloseUnit closeUnit = ManaPlayer.CloseUnitDic[lottery.Value];
+                TempValueList.Add(lottery.Value);
+            }
 
-                        lottery.Value = (int) closeUnit.BuyAmt/5;
+            #endregion
+        }
+        else if (lottery.Type == 4)
+        {
+            #region
 
-                        if (closeUnit.BuyCurrent == Current.Coin)
-                        {
-                            lottery.Type = 1;
-                        }
-                        else if (closeUnit.BuyCurrent == Current.Diamond)
-                        {
-                            lottery.Type = 2;
-                        }
-                    }
-                    else
+            bool allBought = true;
+
+            for (int j = 0; j < LeftBorderDList[type - 1].Count; j++)
+            {
+                for (int k = LeftBorderDList[type - 1][j]; k < RightBorderDList[type - 1][j] + 1; k++)
+                {
+                    if (!ManaPlayer.CloseUnitDic[k].Bought && !TempValueList.Contains(k))
                     {
-                        int anticrush = 0;
+                        allBought = false;
 
-                        do
-                        {
-                            if (anticrush++ > 10000)
-                            {
-                                throw new Exception();
-                            }
+                        goto exit;
+                    }
+                }
+            }
+            exit :
 
-                            int index = Random.Range(0, LeftBorderDList[i].Count);
+            if (allBought)
+            {
+                int index = Random.Range(0, LeftBorderDList[type - 1].Count);
 
-                            lottery.Value = Random.Range(LeftBorderDList[i][index], RightBorderDList[i][index] + 1);
-                        }
-                        while (ManaPlayer.CloseUnitDic[lottery.Value].Bought || ValueList.Contains(lottery.Value));
+                lottery.Value = Random.Range(LeftBorderDList[type - 1][index], RightBorderDList[type - 1][index] + 1);
 
-                        ValueList.Add(lottery.Value);
-                    }
+                CloseUnit closeUnit = ManaPlayer.CloseUnitDic[lottery.Value];
+
+                lottery.Value = (int) closeUnit.BuyAmt/5;
 
-                    #endregion
+                if (closeUnit.BuyCurrent == Current.Coin)
+                {
+                    lottery.Type = 1;
                 }
-                else
+                else if (closeUnit.BuyCurrent == Current.Diamond)
                 {
-                    int index = Random.Range(0, LeftBorderDList[i].Count);
-
-                    lottery.Value = Random.Range(LeftBorderDList[i][index], RightBorderDList[i][index] + 1);
+                    lottery.Type = 2;
                 }
+            }
+            else
+            {
+                int anticrush = 0;
 
-                break;
+                do
+                {
+                    if (anticrush++ > 10000)
+                    {
+                        throw new Exception();
+                    }
+
+                    int index = Random.Range(0, LeftBorderDList[type - 1].Count);
+
+                    lottery.Value = Random.Range(LeftBorderDList[type - 1][index], RightBorderDList[type - 1][index] + 1);
+                } while (ManaPlayer.CloseUnitDic[lottery.Value].Bought || TempValueList.Contains(lottery.Value));
+
+                TempValueList.Add(lottery.Value);
             }
+
+            #endregion
         }
+        else
+        {
+            int index = Random.Range(0, LeftBorderDList[type - 1].Count);
 
+            lottery.Value = Random.Range(LeftBorderDList[type - 1][index], RightBorderDList[type - 1][index] + 1);
+        }
 
+        lottery.PosIndex = posIndex;
+        lottery.Item = lotteryItem;
         lottery.BK = lotteryItem.GetChild(0);
         lottery.Icon1 = lotteryItem.GetChild(1).GetChild(0).GetComponent<Image>();
         lottery.Icon2 = lotteryItem.GetChild(1).GetChild(1).GetComponent<Image>();
@@ -480,7 +468,7 @@ public class Lottery
         {
             CloseUnit closeUnit = ManaPlayer.CloseUnitDic[lottery.Value];
 
-            float newSize = closeUnit.PixelSize / closeUnit.Sprites[0].rect.width;
+            float newSize = closeUnit.PixelSize/closeUnit.Sprites[0].rect.width;
 
             lottery.Icon2.sprite = closeUnit.Sprites[0];
 
@@ -490,7 +478,7 @@ public class Lottery
 
             lottery.Lab.SetActive(false);
 
-            if (closeUnit.Sprites.Length>1)
+            if (closeUnit.Sprites.Length > 1)
             {
                 lottery.Icon1.SetActive(true);
 
@@ -508,47 +496,39 @@ public class Lottery
 
         lottery.Button.onClick = new Button.ButtonClickedEvent();
 
-        lottery.Button.onClick.AddListener
-        (
-            () =>
-            {
-                ManaAudio.PlayClip(Clip.CurrentClip);
-                
-                ManaReso.Get<Button>("Bc_LotteryBack1").interactable = false;
-                ManaReso.Get<Button>("Bc_LotteryBack2").interactable = false;
-                ManaReso.Get<Button>("Bc_LotteryBack3").interactable = false;
-
-                lotteryItem.TweenBacEuler();
-
-                lottery.BK.SetActive(true);
-                
-                lottery.GetAward();
+        lottery.Button.onClick.AddListener(() => { OnClick(posIndex); });
 
-                Auxiliary.Instance.DelayCall
-                (
-                    () =>
-                    {
-                        ManaReso.Get("Bc_Confirm").TweenForCG();
-
-                        ManaReso.Get("Bc_LotteryItem1").TweenBacEuler();
-                        ManaReso.Get("Bc_LotteryItem2").TweenBacEuler();
-                        ManaReso.Get("Bc_LotteryItem3").TweenBacEuler();
-                    },
-                    1f
-                );
-            }
-        );
+        return lottery;
     }
 
-    public static void PlayAnimation()
+    public static void EnterAnimation()
     {
         ManaReso.Get("Bc_Lottery").TweenForCG();
         ManaReso.Get("Ba_Notice0").TweenBacCG();
 
-        CreateLottery(ManaReso.Get("Bc_LotteryItem1"));
-        CreateLottery(ManaReso.Get("Bc_LotteryItem2"));
-        CreateLottery(ManaReso.Get("Bc_LotteryItem3"));
-        
+        float random = Random.Range(0f, 1f);
+
+        for (int i = 0; i < RateList.Count; i++)
+        {
+            if (random <= RateList.MySum(f => f, i + 1))
+            {
+                TempTypeList.Add(TypeList[i]);
+                TempTypeList.AddRange(TypeList.Random(2, true, false, type => !TempTypeList.Contains(type)));
+
+                break;
+            }
+        }
+
+        TempLotteryList.Add(CreateLottery(TempTypeList[0], 0, ManaReso.Get("Bc_LotteryItem1")));
+        TempLotteryList.Add(CreateLottery(TempTypeList[1], 1, ManaReso.Get("Bc_LotteryItem2")));
+        TempLotteryList.Add(CreateLottery(TempTypeList[2], 2, ManaReso.Get("Bc_LotteryItem3")));
+
+        List<Vector3> posList = PosList.Disturb();
+
+        TempLotteryList[0].Item.position = posList[0];
+        TempLotteryList[1].Item.position = posList[1];
+        TempLotteryList[2].Item.position = posList[2];
+
         Button button1 = ManaReso.Get<Button>("Bc_LotteryBack1");
         Button button2 = ManaReso.Get<Button>("Bc_LotteryBack2");
         Button button3 = ManaReso.Get<Button>("Bc_LotteryBack3");
@@ -587,11 +567,9 @@ public class Lottery
                 button2.interactable = true;
                 button3.interactable = true;
 
-                List<Vector3> posList = PosList.Disturb();
-
-                ManaReso.Get("Bc_LotteryItem1").Move2D(posList[0], 0.25f, false, Curve.EaseOutQuad);
-                ManaReso.Get("Bc_LotteryItem2").Move2D(posList[1], 0.25f, false, Curve.EaseOutQuad);
-                ManaReso.Get("Bc_LotteryItem3").Move2D(posList[2], 0.25f, false, Curve.EaseOutQuad);
+                ManaReso.Get("Bc_LotteryItem1").Move2D(PosList[0], 0.25f, false, Curve.EaseOutQuad);
+                ManaReso.Get("Bc_LotteryItem2").Move2D(PosList[1], 0.25f, false, Curve.EaseOutQuad);
+                ManaReso.Get("Bc_LotteryItem3").Move2D(PosList[2], 0.25f, false, Curve.EaseOutQuad);
             },
             2f
         );
@@ -608,9 +586,11 @@ public class Lottery
         );
     }
 
-    public static void EndLottery()
+    public static void EndAnimation()
     {
-        ValueList = new List<int>();
+        TempTypeList = new List<int>();
+        TempValueList = new List<int>();
+        TempLotteryList = new List<Lottery>();
 
         ManaReso.Get("Bc_Lab").TweenBacCG();
         ManaReso.Get("Bc_Confirm").TweenBacCG();
@@ -626,6 +606,42 @@ public class Lottery
     }
 
 
+    public static void OnClick(int index)
+    {
+        ManaAudio.PlayClip(Clip.CurrentClip);
+
+        ManaReso.Get<Button>("Bc_LotteryBack1").interactable = false;
+        ManaReso.Get<Button>("Bc_LotteryBack2").interactable = false;
+        ManaReso.Get<Button>("Bc_LotteryBack3").interactable = false;
+
+        TempLotteryList[0].Item.TweenBacEuler();
+
+        TempLotteryList[0].BK.SetActive(true);
+
+        TempLotteryList[0].GetAward();
+
+        List<Vector3> posList = new List<Vector3>(PosList);
+        posList.Remove(PosList[index]);
+        posList = posList.Disturb();
+
+        TempLotteryList[0].Item.position = PosList[index];
+        TempLotteryList[1].Item.position = posList[0];
+        TempLotteryList[2].Item.position = posList[1];
+
+        Auxiliary.Instance.DelayCall
+            (
+                () =>
+                {
+                    ManaReso.Get("Bc_Confirm").TweenForCG();
+
+                    ManaReso.Get("Bc_LotteryItem1").TweenBacEuler();
+                    ManaReso.Get("Bc_LotteryItem2").TweenBacEuler();
+                    ManaReso.Get("Bc_LotteryItem3").TweenBacEuler();
+                },
+                1f
+            );
+    }
+
     public void GetAward()
     {
         Sign.ResetSign();

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

@@ -234,7 +234,7 @@ public class ManaUI : Regist
         tween.PingPong = true;
         tween.StartForward();
 
-        ManaReso.SetButtonEvent("Bc_Confirm", Lottery.EndLottery);
+        ManaReso.SetButtonEvent("Bc_Confirm", Lottery.EndAnimation);
 
         #endregion
 

+ 1 - 12
Assets/Script/Tool/AtlasUtil/ExtList.cs

@@ -98,20 +98,9 @@ public static class ExtList
 
     public static List<T> Disturb<T>(this List<T> list)
     {
-        int antiCrush = 0;
-
         List<T> resultList = new List<T>();
-        List<T> originList = new List<T>(list);
 
-        while (originList.Count > 0)
-        {
-            if (antiCrush++ > 10000)
-            {
-                throw new Exception();
-            }
-
-            resultList.Add(originList.Random(1, true, true)[0]);
-        }
+        resultList.AddRange(list.Random(list.Count));
 
         return resultList;
     }

+ 4 - 2
Assets/Script/Tool/Auxiliary.cs

@@ -161,9 +161,11 @@ public class Auxiliary : Regist
 
         if (Input.GetKeyDown(KeyCode.X))
         {
-            Lottery.ValueList = new List<int>();
+            Lottery.TempTypeList = new List<int>();
+            Lottery.TempValueList = new List<int>();
+            Lottery.TempLotteryList = new List<Lottery>();
 
-            Lottery.PlayAnimation();
+            Lottery.EnterAnimation();
 
             //ManaReso.Get("Bc_LotteryItem1").TweenForEuler();
             //ManaReso.Get("Bc_LotteryItem2").TweenForEuler();

+ 14 - 0
Assets/Test.cs

@@ -0,0 +1,14 @@
+using System.Collections;
+using System.Collections.Generic;
+
+using System.IO;
+//using UnityEditor;
+using UnityEngine;
+
+public class Test// : AssetPostprocessor
+{
+    static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths)
+    {
+        
+    }
+}

+ 12 - 0
Assets/Test.cs.meta

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

+ 2 - 2
ToList.txt

@@ -1,6 +1,6 @@
-一种类型的一个
+试衣间返回按钮
 
-覆盖安装不能更新逻辑?
+防止删除 删除前事件 HideFlag
 
 
 还原PlayerConfig