Procházet zdrojové kódy

限制猜宝箱次数

liuqilin před 7 roky
rodič
revize
1eb83ceb53

+ 4 - 3
Assets/Resource/Logo.unity

@@ -445,9 +445,10 @@ MonoBehaviour:
   m_Script: {fileID: 11500000, guid: f1828554d8ffa12449b221fe29b2c32c, type: 3}
   m_Name: 
   m_EditorClassIdentifier: 
-  DebugMode: 0
-  CatchException: 1
-  DebugModeGo: {fileID: 0}
+  DebugMode: 1
+  CatchException: 0
+  DebugModeGo: {fileID: 1264531325540048, guid: b22fd2d9abc702d43ac62a412537d4e9,
+    type: 2}
 --- !u!4 &1833966245
 Transform:
   m_ObjectHideFlags: 0

binární
Assets/Resource/Xlsx/language_config.xlsx


+ 37 - 9
Assets/Script/Object/PlazaRoomChest.cs

@@ -210,7 +210,29 @@ public class PlazaRoomChest : MonoBehaviour, IPointerClickHandler
 
     private void GuessFailed()
     {
-        Bubble.Show(null, Language.GetStr("UI", "Y_GuessWrong"));
+        ChestOperateData chestOperateData;
+        ChestMge.OperateDataDictionary.TryGetValue(CurrentChest.ChestData.ID, out chestOperateData);
+        int remainGuessAmt;
+        if (chestOperateData == null)
+        {
+            remainGuessAmt = ChestMge.PlayerMaxGuessAmt - 1;
+        }
+        else
+        {
+            remainGuessAmt = (int) chestOperateData.GuessedAmt - 1;
+            chestOperateData.GuessedAmt -= 1;
+        }
+
+        if (remainGuessAmt <= 0)
+        {
+            Bubble.Show(null, Language.GetStr("UI", "Y_GuessWrong"));
+            Deactive();
+            TurnGray();
+        }
+        else
+        {
+            Bubble.Show(null, Language.GetStr("UI", "Y_GuessWrong"));
+        }
     }
 
     private void GuessSucceed()
@@ -241,12 +263,15 @@ public class PlazaRoomChest : MonoBehaviour, IPointerClickHandler
         BaseInit(chestData);
 
         Deactive();
+        TurnGray();
 
         SystemChest = this;
     }
 
     private void BaseInit(ChestData chestData)
     {
+        ChestData = chestData;
+
         if (InputField == null)
         {
             InputField = ManaReso.Get<InputField>("Y_InputField");
@@ -283,12 +308,9 @@ public class PlazaRoomChest : MonoBehaviour, IPointerClickHandler
         ShadowMR.sharedMaterial = UnityFactory.Materials[0];
 
         GetMesh(chestData.ChestType);
-        Active();
 
         TweenGrayMesh = new TweenGrayMesh(ChestMF, 1, 0, 0.25f, true, true, Curve.EaseOutQuad);
         TweenGrayMesh.InDestination = true;
-
-        ChestData = chestData;
     }
 
     private void GetMesh(ChestType chestType)
@@ -323,11 +345,6 @@ public class PlazaRoomChest : MonoBehaviour, IPointerClickHandler
 
     public void Deactive()
     {
-        if (ChestData.ChestType == ChestType.System)
-        {
-            TweenGrayMesh.StartBackward();
-        }
-
         IsActive = false;
     }
 
@@ -344,6 +361,17 @@ public class PlazaRoomChest : MonoBehaviour, IPointerClickHandler
         }
     }
 
+    public void TurnGray()
+    {
+        TweenGrayMesh.StartBackward();
+    }
+
+    public void TurnNormalColor()
+    {
+        TweenGrayMesh.StartForward();
+    }
+
+
     public void OnPointerClick(PointerEventData eventData)
     {
         CurrentChest = this;

+ 86 - 21
Assets/Script/SFS/Manager/ChestMge.cs

@@ -3,6 +3,7 @@ using System.Collections;
 using System.Collections.Generic;
 using System.IO;
 using System.Linq;
+using System.Text;
 using System.Xml;
 using Sfs2X.Entities.Data;
 using UnityEngine;
@@ -83,10 +84,61 @@ public class ChestData
     }
 }
 
+public class ChestOperateData
+{
+    public long ChestID;
+    public bool Received;
+    public int DatabaseRoomID;
+    public int? GuessedAmt;
+    public DateTime? LastActivatedTime; //只有系统宝箱才用
+
+    public ChestOperateData(string str)
+    {
+        string[] strings = str.Split('|');
+        ChestID = long.Parse(strings[0]);
+        DatabaseRoomID = int.Parse(strings[1]);
+        Received = int.Parse(strings[2]).ToBool();
+        if (strings.Length > 3)
+        {
+            GuessedAmt = int.Parse(strings[3]);
+        }
+        if (strings.Length > 4)
+        {
+            LastActivatedTime = DateUtil.GetTimeFromSecends(strings[4]);
+        }
+    }
+
+    public ChestOperateData(bool received, long chestID, int databaseRoomID)
+    {
+        Received = received;
+        ChestID = chestID;
+        DatabaseRoomID = databaseRoomID;
+    }
+
+    public override string ToString()
+    {
+        StringBuilder stringBuilder = new StringBuilder();
+        stringBuilder.Append(ChestID);
+        stringBuilder.Append('|' + DatabaseRoomID);
+        if (GuessedAmt != null)
+        {
+            stringBuilder.Append('|' + GuessedAmt);
+        }
+        if (LastActivatedTime != null)
+        {
+            stringBuilder.Append('|' + LastActivatedTime.ToString());
+        }
+        return stringBuilder.ToString();
+    }
+}
+
+
 public class ChestMge : Regist
 {
     #region Config
 
+    public static int PlayerMaxGuessAmt = 3;
+
     private static Text Desc;
     private static Text BtnLab;
     private static Text SliderValueLab;
@@ -99,8 +151,8 @@ public class ChestMge : Regist
 
     public static List<PlazaRoomChest> PlazaRoomChests = new List<PlazaRoomChest>();
 
-    private static List<int> RefundRoomIDs = new List<int>();
-    private static Dictionary<long, int> ChestRoomDictionary = new Dictionary<long, int>();
+    public static List<int> RefundRoomIDs = new List<int>();
+    public static Dictionary<long, ChestOperateData> OperateDataDictionary = new Dictionary<long, ChestOperateData>();
 
     #endregion
 
@@ -114,9 +166,8 @@ public class ChestMge : Regist
         }
         for (int i = 0; i < ReceivedNodes.Count; i++)
         {
-            string[] strings = ReceivedNodes[i].InnerText.Split('|');
-            long chestID = long.Parse(strings[0]);
-            ChestRoomDictionary.Add(chestID, int.Parse(strings[1]));
+            ChestOperateData chestOperateData = new ChestOperateData(ReceivedNodes[i].InnerText);
+            OperateDataDictionary.Add(chestOperateData.ChestID, chestOperateData);
         }
         //foreach (var VARIABLE in RefundRoomIDs)
         //{
@@ -304,12 +355,12 @@ public class ChestMge : Regist
 
     private static void GetChestExpireStatus()
     {
-        if (ChestRoomDictionary.Keys.Count == 0)
+        if (OperateDataDictionary.Keys.Count == 0)
         {
             return;
         }
 
-        SFSManager.GardenSmartFox.EventManager.PlazaRoomEvent.GetChestExpireStatus(ChestRoomDictionary.Keys.ToList());
+        SFSManager.GardenSmartFox.EventManager.PlazaRoomEvent.GetChestExpireStatus(OperateDataDictionary.Keys.ToList());
     }
 
     public static void OnReceiveChestExpireStatus(List<long> chestIDs)
@@ -317,7 +368,7 @@ public class ChestMge : Regist
         foreach (var chestID in chestIDs)
         {
             //Debug.LogWarning("expire " + chestID);
-            ChestRoomDictionary.Remove(chestID);
+            OperateDataDictionary.Remove(chestID);
         }
     }
 
@@ -335,19 +386,31 @@ public class ChestMge : Regist
     {
         if (chestData.ChestType != ChestType.System)
         {
-            if (ChestRoomDictionary.Keys.Contains(chestData.ID))
+            if (chestData.RemainRound <= 0 || chestData.RemainValue <= 0)
             {
                 return;
             }
 
-            if (chestData.RemainRound <= 0 || chestData.RemainValue <= 0)
+            ChestOperateData chestOperateData;
+            OperateDataDictionary.TryGetValue(chestData.ID, out chestOperateData);
+
+            if (chestOperateData == null || chestOperateData.Received == false)
             {
-                return;
+                PlazaRoomChest chest = ManaReso.GetPlazaRoomChest(chestData.Position);
+                chest.Init(chestData);
+                PlazaRoomChests.Add(chest);
+
+                if (chestOperateData.GuessedAmt == null || chestOperateData.GuessedAmt < PlayerMaxGuessAmt)
+                {
+                    chest.Active();
+                    chest.TurnNormalColor();
+                }
+                else
+                {
+                    chest.Deactive();
+                    chest.TurnGray();
+                }
             }
-
-            PlazaRoomChest chest = ManaReso.GetPlazaRoomChest(chestData.Position);
-            chest.Init(chestData);
-            PlazaRoomChests.Add(chest);
         }
         else
         {
@@ -370,7 +433,6 @@ public class ChestMge : Regist
 
     public static void ActivateSystemChest()
     {
-
         if (!SFSManager.GardenSmartFox.PlazaRoomManager.JoinedPlazaRoom)
         {
             return;
@@ -381,12 +443,13 @@ public class ChestMge : Regist
             return;
         }
 
-        if (ChestRoomDictionary.Keys.Contains(PlazaRoomChest.SystemChest.ChestData.ID))
+        if (OperateDataDictionary.Keys.Contains(PlazaRoomChest.SystemChest.ChestData.ID))
         {
             return;
         }
 
         PlazaRoomChest.SystemChest.Active();
+        PlazaRoomChest.SystemChest.TurnNormalColor();
     }
 
     public static void ReactivateSystemChest()
@@ -401,8 +464,9 @@ public class ChestMge : Regist
             return;
         }
 
-        ChestRoomDictionary.Remove(PlazaRoomChest.SystemChest.ChestData.ID);
+        OperateDataDictionary.Remove(PlazaRoomChest.SystemChest.ChestData.ID);
         PlazaRoomChest.SystemChest.Active();
+        PlazaRoomChest.SystemChest.TurnNormalColor();
     }
 
     public static void DeactivateSystemChest()
@@ -417,13 +481,14 @@ public class ChestMge : Regist
             return;
         }
 
-        //PlazaRoomChest.SystemChest.SetColliders(false);
         PlazaRoomChest.SystemChest.Deactive();
+        PlazaRoomChest.SystemChest.TurnGray();
     }
 
     public static void ReceiveChestAward(int award, long chestID)
     {
-        ChestRoomDictionary.Add(PlazaRoomChest.CurrentChest.ChestData.ID, PlazaRoomChest.CurrentChest.ChestData.DatabaseRoomID);
+        ChestOperateData chestOperateData = new ChestOperateData(true, PlazaRoomChest.CurrentChest.ChestData.ID, PlazaRoomChest.CurrentChest.ChestData.DatabaseRoomID);
+        OperateDataDictionary.Add(chestOperateData.ChestID, chestOperateData);
 
         ManaReso.Get<CanvasGroup>("Y_Chest").interactable = true;
 
@@ -494,7 +559,7 @@ public class ChestMge : Regist
             node.InnerText = id.ToString();
             ManaData.PlayerNode.AppendChild(node);
         }
-        foreach (var kv in ChestRoomDictionary)
+        foreach (var kv in OperateDataDictionary)
         {
             node = ManaData.PlayerDoc.CreateNode(XmlNodeType.Element, ReceivedNodeName, null);
             node.InnerText = $"{kv.Key}|{kv.Value}";

+ 3 - 3
ProjectSettings/GraphicsSettings.asset

@@ -43,13 +43,13 @@ GraphicsSettings:
     type: 0}
   m_TierSettings_Tier1:
     renderingPath: 1
-    useCascadedShadowMaps: 0
+    useCascadedShadowMaps: 1
   m_TierSettings_Tier2:
     renderingPath: 1
-    useCascadedShadowMaps: 0
+    useCascadedShadowMaps: 1
   m_TierSettings_Tier3:
     renderingPath: 1
-    useCascadedShadowMaps: 0
+    useCascadedShadowMaps: 1
   m_DefaultRenderingPath: 1
   m_DefaultMobileRenderingPath: 1
   m_TierSettings: []

+ 4 - 0
第三期.txt

@@ -1,3 +1,5 @@
+激活宝箱逻辑是否需要修改
+
 利用shader控制深度
 
 
@@ -18,6 +20,8 @@ IOS
 
 缺排行榜按钮 公告按钮
 
+Dragonbones 使用tight
+
 内存优化(释放掉loading界面)
 
 Drawcall优化(聊天界面 表情 广场背景图片 宝箱 评论 点赞 公告 截图按钮 派对图标 上衣按钮需要打入图集)