jet пре 8 година
родитељ
комит
1e1436782d

+ 4 - 0
Assets/Resource/Logo.unity

@@ -663,6 +663,10 @@ Prefab:
       propertyPath: m_Pivot.y
       value: 0
       objectReference: {fileID: 0}
+    - target: {fileID: 1948781497737682, guid: 8647d80b558fa724a84d05f9e6aee9bc, type: 2}
+      propertyPath: m_IsActive
+      value: 0
+      objectReference: {fileID: 0}
     m_RemovedComponents: []
   m_ParentPrefab: {fileID: 100100000, guid: 8647d80b558fa724a84d05f9e6aee9bc, type: 2}
   m_IsPrefabParent: 0

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

@@ -1,23 +1,23 @@
 <data>
-  <item id="1" coin_rate="1" cool_time="0.4" award_min="1000" award_max="5000" />
-  <item id="2" coin_rate="2" cool_time="0.3" award_min="20" award_max="80" />
-  <item id="3" coin_rate="3" cool_time="0.2" award_min="1,11" award_max="10,20" />
-  <item id="4" coin_rate="4" cool_time="0.1" award_min="201,401" award_max="217,415" />
+  <item id="1" type="1" rate="0.4" left_border="1000" right_border="5000" />
+  <item id="2" type="2" rate="0.3" left_border="20" right_border="80" />
+  <item id="3" type="3" rate="0.2" left_border="1,11" right_border="10,20" />
+  <item id="4" type="4" rate="0.1" left_border="201,401,2" right_border="217,415,30" />
   <comment>
     <id>
 id
 </id>
-    <coin_rate>
+    <type>
 奖励种类
-</coin_rate>
-    <cool_time>
+</type>
+    <rate>
 出现该奖励的概率
-</cool_time>
-    <award_min>
+</rate>
+    <left_border>
 奖励区间左
-</award_min>
-    <award_max>
+</left_border>
+    <right_border>
 奖励区间右
-</award_max>
+</right_border>
   </comment>
 </data>

BIN
Assets/Resource/Xlsx/lottery_config.xlsx


+ 2 - 0
Assets/Script/Manage/Initializer.cs

@@ -135,6 +135,8 @@ public class Initializer : MonoBehaviour
 
         ManaVisit.Initialize();
 
+        ManaPlayer.InitializeDressRoom();
+
         ManaReso.Get("I_BlackMask").TweenForCG();
 
         ManaReso.SetActive("I_Lab", false);

+ 114 - 21
Assets/Script/Manage/ManaSign.cs

@@ -5,7 +5,7 @@ using System;
 using System.Xml;
 using System.Collections;
 using System.Collections.Generic;
-
+using System.Linq;
 using Random = UnityEngine.Random;
 
 public class Sign
@@ -237,16 +237,15 @@ public class Lottery
 
     #endregion
 
-
     public static void Configure(List<XmlAttributeCollection> attributeList)
     {
         for (int i = 0; i < attributeList.Count; i++)
         {
-            RateList.Add((float) Auxiliary.FmlParse(attributeList[i][0].Value));
+            RateList.Add((float) Auxiliary.FmlParse(attributeList[i][2].Value));
             TypeList.Add((int) Auxiliary.FmlParse(attributeList[i][1].Value));
 
-            List<string> leftBorderStrList = Auxiliary.StringListParse(',', attributeList[i][2].Value, null);
-            List<string> rightBorderStrList = Auxiliary.StringListParse(',', attributeList[i][3].Value, null);
+            List<string> leftBorderStrList = Auxiliary.StringListParse(',', attributeList[i][3].Value, null);
+            List<string> rightBorderStrList = Auxiliary.StringListParse(',', attributeList[i][4].Value, null);
 
             List<int> leftBorderList = new List<int>();
             List<int> rightBorderList = new List<int>();
@@ -266,18 +265,16 @@ public class Lottery
     {
         Lottery lottery = new Lottery();
 
-        float random = Random.Range(0f, 1f);
-
         #region 默认值
 
         lottery.Type = TypeList[0];
 
-        int tempIndex = Random.Range(0, LeftBorderDList[0].Count);
-
-        lottery.Value = Random.Range(LeftBorderDList[0][tempIndex], RightBorderDList[0][tempIndex] + 1);
-
+        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 (random <= RateList.MySum(f => f, i + 1))
@@ -287,6 +284,83 @@ public class Lottery
                 int index = Random.Range(0, LeftBorderDList[i].Count);
 
                 lottery.Value = Random.Range(LeftBorderDList[i][index], RightBorderDList[i][index] + 1);
+
+                if (lottery.Type == 3)
+                {
+                    #region
+
+                    FlowerInfo flowerInfo = ManaGarden.FlowerInfoDic[lottery.Value];
+
+                    if (!flowerInfo.Unlock)
+                    {
+                        break;
+                    }
+
+                    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)
+                            {
+                                lottery.Value = k;
+
+                                break;
+                            }
+                        }
+                    }
+
+                    if (flowerInfo.UnlockCur == Current.Coin)
+                    {
+                        lottery.Type = 1;
+                        lottery.Value = flowerInfo.UnlockAmt/5;
+                    }
+                    else if (flowerInfo.UnlockCur == Current.Diamond)
+                    {
+                        lottery.Type = 2;
+                        lottery.Value = flowerInfo.UnlockAmt / 5;
+                    }
+
+                    #endregion
+                }
+                else if (lottery.Type == 4)
+                {
+                    #region
+
+                    CloseUnit closeUnit = ManaPlayer.CloseUnitDic[lottery.Value];
+
+                    if (!closeUnit.Bought)
+                    {
+                        break;
+                    }
+
+                    for (int j = 0; j < LeftBorderDList[i].Count; j++)
+                    {
+                        for (int k = LeftBorderDList[i][j]; k < RightBorderDList[i][j] + 1; k++)
+                        {
+                            if (!ManaPlayer.CloseUnitDic[k].Bought)
+                            {
+                                lottery.Value = k;
+
+                                break;
+                            }
+                        }
+                    }
+
+                    if (closeUnit.BuyCurrent == Current.Coin)
+                    {
+                        lottery.Type = 1;
+                        lottery.Value = (int) closeUnit.BuyAmt/5;
+                    }
+                    else if (closeUnit.BuyCurrent == Current.Diamond)
+                    {
+                        lottery.Type = 2;
+                        lottery.Value = (int) closeUnit.BuyAmt/5;
+                    }
+
+                    #endregion
+                }
+
+                break;
             }
         }
 
@@ -302,26 +376,40 @@ public class Lottery
         if (lottery.Type == 1)
         {
             lottery.Icon1.SetActive(false);
+
             lottery.Icon2.sprite = ManaReso.LoadSprite("金币", Folder.UI);
+
             lottery.Icon2.Resize(true, 1, 1);
 
+            lottery.Icon2.transform.localPosition = new Vector3(0, 7.5f, 0);
+
             lottery.Lab.SetActive(true);
+
             lottery.Lab.text = lottery.Value.ToString();
         }
         else if (lottery.Type == 2)
         {
             lottery.Icon1.SetActive(false);
+
             lottery.Icon2.sprite = ManaReso.LoadSprite("钻石", Folder.UI);
+
             lottery.Icon2.Resize(true, 1, 1);
 
+            lottery.Icon2.transform.localPosition = new Vector3(0, 7.5f, 0);
+
             lottery.Lab.SetActive(true);
+
             lottery.Lab.text = lottery.Value.ToString();
         }
         else if (lottery.Type == 3)
         {
             lottery.Icon1.SetActive(false);
+
             lottery.Icon2.sprite = ManaGarden.FlowerInfoDic[lottery.Value].Icon;
-            lottery.Icon2.Resize(true, 0.2f, 0.2f);
+
+            lottery.Icon2.Resize(true, 0.25f, 0.25f);
+
+            lottery.Icon2.transform.localPosition = new Vector3();
 
             lottery.Lab.SetActive(false);
         }
@@ -329,25 +417,30 @@ public class Lottery
         {
             CloseUnit closeUnit = ManaPlayer.CloseUnitDic[lottery.Value];
 
+            float newSize = closeUnit.PixelSize / closeUnit.Sprites[0].rect.width;
+
+            lottery.Icon2.sprite = closeUnit.Sprites[0];
+
+            lottery.Icon2.Resize(true, newSize, newSize);
+
+            lottery.Icon2.transform.localPosition = new Vector2(0, closeUnit.IconOffset);
+
+            lottery.Lab.SetActive(false);
+
             if (closeUnit.Sprites.Length>1)
             {
                 lottery.Icon1.SetActive(true);
+
                 lottery.Icon1.sprite = closeUnit.Sprites[1];
-                lottery.Icon1.Resize(true, closeUnit.PixelSize, closeUnit.PixelSize);
 
-                lottery.Icon1.transform.localPosition = new Vector2(0, closeUnit.IconOffset) + closeUnit.IconOffset1;
+                lottery.Icon1.Resize(true, newSize, newSize);
+
+                lottery.Icon1.transform.localPosition = new Vector2(0, closeUnit.IconOffset) + closeUnit.IconOffset1*newSize;
             }
             else
             {
                 lottery.Icon1.SetActive(false);
             }
-
-            lottery.Icon2.sprite = ManaGarden.FlowerInfoDic[lottery.Value].Icon;
-            lottery.Icon2.Resize(true, 0.2f, 0.2f);
-
-            lottery.Icon2.transform.localPosition = new Vector2(0, closeUnit.IconOffset);
-
-            lottery.Lab.SetActive(false);
         }
     }
 

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

@@ -229,7 +229,7 @@ public static class ExtList
 
         float result = 0;
         
-        for (int i = 0; i < list.Count; i++)
+        for (int i = 0; i < count; i++)
         {
             result += func(list[i]);
         }

+ 7 - 2
ToList.txt

@@ -1,13 +1,18 @@
 修改了离线时间和签到参数
 
-测试Lottery类
+测试Lottery类 随机到的那个已经解锁的情况(剩下的还有未解锁 剩下的全部都解锁)
 
 SignItem中的Get
 
-Lottery界面的重复出现
+Lottery界面的重复出现(重设Icon1 Icon2的位置)
 
 如果填公式需要说下字母的含义
 
+Ex
+{
+  List和Dic的Random方法要先对所有对象检查一次,如果都不满足randomAction则返回null
+}
+
 
 还原PlayerConfig