浏览代码

道友修改

lzx 3 天之前
父节点
当前提交
4b127b5a39

+ 180 - 0
Assets/Res/UI/MainPanel/MainPanel.prefab

@@ -164,6 +164,86 @@ MonoBehaviour:
   topOrLeftColor: {r: 0, g: 0, b: 0, a: 1}
   topOrLeftColor: {r: 0, g: 0, b: 0, a: 1}
   bottomOrRightColor: {r: 0.509434, g: 0.33882165, b: 0.33882165, a: 1}
   bottomOrRightColor: {r: 0.509434, g: 0.33882165, b: 0.33882165, a: 1}
   direction: 1
   direction: 1
+--- !u!1 &1603581646805343573
+GameObject:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  serializedVersion: 7
+  m_Component:
+  - component: {fileID: 1103492875219824872}
+  - component: {fileID: 8750832862381625297}
+  - component: {fileID: 6334637622796270846}
+  m_Layer: 5
+  m_HasEditorInfo: 1
+  m_Name: Text_DaoyouCount
+  m_TagString: Untagged
+  m_Icon: {fileID: 0}
+  m_NavMeshLayer: 0
+  m_StaticEditorFlags: 0
+  m_IsActive: 1
+--- !u!224 &1103492875219824872
+RectTransform:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 1603581646805343573}
+  m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+  m_LocalPosition: {x: 0, y: 0, z: 0}
+  m_LocalScale: {x: 1, y: 1, z: 1}
+  m_ConstrainProportionsScale: 0
+  m_Children: []
+  m_Father: {fileID: 6224376037976265680}
+  m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+  m_AnchorMin: {x: 0.5, y: 0.5}
+  m_AnchorMax: {x: 0.5, y: 0.5}
+  m_AnchoredPosition: {x: 21.4, y: -20.1}
+  m_SizeDelta: {x: 52.143, y: 35.6069}
+  m_Pivot: {x: 0.5, y: 0.5}
+--- !u!222 &8750832862381625297
+CanvasRenderer:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 1603581646805343573}
+  m_CullTransparentMesh: 1
+--- !u!114 &6334637622796270846
+MonoBehaviour:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 1603581646805343573}
+  m_Enabled: 1
+  m_EditorHideFlags: 0
+  m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3}
+  m_Name: 
+  m_EditorClassIdentifier: 
+  m_Material: {fileID: 0}
+  m_Color: {r: 1, g: 1, b: 1, a: 1}
+  m_RaycastTarget: 1
+  m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
+  m_Maskable: 1
+  m_OnCullStateChanged:
+    m_PersistentCalls:
+      m_Calls: []
+  m_FontData:
+    m_Font: {fileID: 12800000, guid: e588d93665211944387ec8c03c8726ae, type: 3}
+    m_FontSize: 30
+    m_FontStyle: 1
+    m_BestFit: 0
+    m_MinSize: 10
+    m_MaxSize: 40
+    m_Alignment: 4
+    m_AlignByGeometry: 0
+    m_RichText: 1
+    m_HorizontalOverflow: 0
+    m_VerticalOverflow: 0
+    m_LineSpacing: 1
+  m_Text: 5
 --- !u!1 &1760937640502948944
 --- !u!1 &1760937640502948944
 GameObject:
 GameObject:
   m_ObjectHideFlags: 0
   m_ObjectHideFlags: 0
@@ -197,6 +277,7 @@ RectTransform:
   - {fileID: 6120901728442020656}
   - {fileID: 6120901728442020656}
   - {fileID: 8620268506487690809}
   - {fileID: 8620268506487690809}
   - {fileID: 3932465254798203391}
   - {fileID: 3932465254798203391}
+  - {fileID: 6224376037976265680}
   - {fileID: 1509586097304940563}
   - {fileID: 1509586097304940563}
   m_Father: {fileID: 9037135992368401232}
   m_Father: {fileID: 9037135992368401232}
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@@ -2176,6 +2257,95 @@ MonoBehaviour:
   m_EffectColor: {r: 0, g: 0, b: 0, a: 0.5}
   m_EffectColor: {r: 0, g: 0, b: 0, a: 0.5}
   m_EffectDistance: {x: 1, y: -1}
   m_EffectDistance: {x: 1, y: -1}
   m_UseGraphicAlpha: 1
   m_UseGraphicAlpha: 1
+--- !u!1 &8816327462997807595
+GameObject:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  serializedVersion: 7
+  m_Component:
+  - component: {fileID: 6224376037976265680}
+  - component: {fileID: 8210925538578532506}
+  - component: {fileID: 8753960067471709537}
+  m_Layer: 5
+  m_HasEditorInfo: 1
+  m_Name: Icon_Daoyou
+  m_TagString: Untagged
+  m_Icon: {fileID: 0}
+  m_NavMeshLayer: 0
+  m_StaticEditorFlags: 0
+  m_IsActive: 1
+--- !u!224 &6224376037976265680
+RectTransform:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 8816327462997807595}
+  m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
+  m_LocalPosition: {x: 0, y: 0, z: 0}
+  m_LocalScale: {x: 1, y: 1, z: 1}
+  m_ConstrainProportionsScale: 0
+  m_Children:
+  - {fileID: 1103492875219824872}
+  m_Father: {fileID: 1798015912972164048}
+  m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+  m_AnchorMin: {x: 0, y: 1}
+  m_AnchorMax: {x: 0, y: 1}
+  m_AnchoredPosition: {x: 623.8, y: -300.7}
+  m_SizeDelta: {x: 56.4862, y: 56.4862}
+  m_Pivot: {x: 0, y: 1}
+--- !u!222 &8210925538578532506
+CanvasRenderer:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 8816327462997807595}
+  m_CullTransparentMesh: 1
+--- !u!114 &8753960067471709537
+MonoBehaviour:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 8816327462997807595}
+  m_Enabled: 1
+  m_EditorHideFlags: 0
+  m_Script: {fileID: 11500000, guid: 3c247620ca3a1fd4ab2a2f3a5b287e07, type: 3}
+  m_Name: 
+  m_EditorClassIdentifier: 
+  m_Material: {fileID: 0}
+  m_Color: {r: 1, g: 1, b: 1, a: 1}
+  m_RaycastTarget: 1
+  m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
+  m_Maskable: 1
+  m_OnCullStateChanged:
+    m_PersistentCalls:
+      m_Calls: []
+  m_Sprite: {fileID: 0}
+  m_Type: 0
+  m_PreserveAspect: 0
+  m_FillCenter: 1
+  m_FillMethod: 4
+  m_FillAmount: 1
+  m_FillClockwise: 1
+  m_FillOrigin: 0
+  m_UseSpriteMesh: 0
+  m_PixelsPerUnitMultiplier: 1
+  _icon_name: dec_touxiang
+  isNotLoadDeftIcon: 0
+  CurrSpriteAtlas: {fileID: 100100200, guid: bec1e4479c1593746876da07861f4d67, type: 3}
+  packInfo:
+    packName: mainUI
+    packgJsonPath: /Art/UIAssets/TextrueJson\mainUI.txt
+    packgSpritePath: Assets/Res/UIAtlas/mainUI.spriteatlasv2
+    lasetJsonGUID: e1c5b270b3ca9ddf87be5864ad756cc0
+  useGradient: 0
+  topOrLeftColor: {r: 1, g: 1, b: 1, a: 1}
+  bottomOrRightColor: {r: 0, g: 0, b: 0, a: 1}
+  direction: 0
 --- !u!1 &8986363544919513421
 --- !u!1 &8986363544919513421
 GameObject:
 GameObject:
   m_ObjectHideFlags: 0
   m_ObjectHideFlags: 0
@@ -2374,6 +2544,16 @@ MonoBehaviour:
     isAssetBundle: 0
     isAssetBundle: 0
     isList: 0
     isList: 0
     ListCollectorDatas: []
     ListCollectorDatas: []
+  - key: Icon_Daoyou
+    gameObject: {fileID: 8753960067471709537}
+    isAssetBundle: 0
+    isList: 0
+    ListCollectorDatas: []
+  - key: Text_DaoyouCount
+    gameObject: {fileID: 6334637622796270846}
+    isAssetBundle: 0
+    isList: 0
+    ListCollectorDatas: []
   isAssetBundle: 0
   isAssetBundle: 0
 --- !u!1 &9153091249090986804
 --- !u!1 &9153091249090986804
 GameObject:
 GameObject:

+ 2 - 1
Assets/Scripts/Core/Event/Event/CustomEventType.cs

@@ -114,7 +114,8 @@ namespace Fort23.Core
       /// <summary>
       /// <summary>
       /// 获得道具
       /// 获得道具
       /// </summary>
       /// </summary>
-      AddItem
+      AddItem,
+      DaoYouCounUpdate
       
       
     }
     }
 }
 }

+ 53 - 5
Assets/Scripts/GameLogic/Player/PlayerManager.cs

@@ -22,7 +22,7 @@ public class PlayerManager : Singleton<PlayerManager>
     public FaBaoControl FaBaoControl;
     public FaBaoControl FaBaoControl;
     public BagController BagController;
     public BagController BagController;
 
 
-    public List<AccountFileInfo.DaoYouData> GuaijiDaoYou = new List<AccountFileInfo.DaoYouData>();
+    public Map<long, List<AccountFileInfo.DaoYouData>> GuaijiDaoYou = new Map<long, List<AccountFileInfo.DaoYouData>>();
 
 
     public bool isTest;
     public bool isTest;
 
 
@@ -51,8 +51,8 @@ public class PlayerManager : Singleton<PlayerManager>
 
 
         InitGameData();
         InitGameData();
 
 
-        int m = Random.Range(0, 4 * 60 * 1000);
-        RandownDaoYou(m);
+        // int m = Random.Range(0, 4 * 60 * 1000);
+        RandownDaoYou(gameConstantConfig.Daoyoushowuptime + 1000);
     }
     }
 
 
     public void RandownDaoYou(int m)
     public void RandownDaoYou(int m)
@@ -61,16 +61,38 @@ public class PlayerManager : Singleton<PlayerManager>
         _timerEntity = null;
         _timerEntity = null;
         _timerEntity = TimerComponent.Instance.AddTimer(m, () =>
         _timerEntity = TimerComponent.Instance.AddTimer(m, () =>
         {
         {
-            int count = Random.Range(0, AccountFileInfo.Instance.playerData.daoYouDatas.Count);
+          
             List<AccountFileInfo.DaoYouData> daoYouDatas = AccountFileInfo.Instance.playerData.daoYouDatas.ToList();
             List<AccountFileInfo.DaoYouData> daoYouDatas = AccountFileInfo.Instance.playerData.daoYouDatas.ToList();
+            foreach (var keyValuePair in GuaijiDaoYou)
+            {
+                foreach (var daoYouData in keyValuePair.Value)
+                {
+                    if (daoYouDatas.Contains(daoYouData))
+                    {
+                        daoYouDatas.Remove(daoYouData);
+                    }
+                }
+            }
+            int count = Random.Range(0,GuaijiDaoYou.Count+1);
+            List<AccountFileInfo.DaoYouData> daoyou = new List<AccountFileInfo.DaoYouData>();
             for (int i = 0; i < count; i++)
             for (int i = 0; i < count; i++)
             {
             {
                 int index = Random.Range(0, daoYouDatas.Count);
                 int index = Random.Range(0, daoYouDatas.Count);
-                GuaijiDaoYou.Add(daoYouDatas[index]);
+
+                daoyou.Add(daoYouDatas[index]);
+
                 daoYouDatas.RemoveAt(index);
                 daoYouDatas.RemoveAt(index);
                 _timerEntity?.Dispose();
                 _timerEntity?.Dispose();
                 _timerEntity = null;
                 _timerEntity = null;
             }
             }
+
+            if (daoyou.Count > 0)
+            {
+                GuaijiDaoYou.Add(TimeHelper.ClientNow() + Random.Range(gameConstantConfig.DaoyouguajiDuration[0], gameConstantConfig.DaoyouguajiDuration[1]) * 1000, daoyou);
+                EventManager.Instance.Dispatch(CustomEventType.DaoYouCounUpdate, null);
+            }
+
+            RandownDaoYou(gameConstantConfig.Daoyoushowuptime + 1000);
         });
         });
     }
     }
 
 
@@ -130,6 +152,10 @@ public class PlayerManager : Singleton<PlayerManager>
         // ))
         // ))
     }
     }
 
 
+    List<long> removeKey = new List<long>();
+
+    private bool isUpdate = false;
+
     private void Update()
     private void Update()
     {
     {
         timer += Time.deltaTime;
         timer += Time.deltaTime;
@@ -148,6 +174,28 @@ public class PlayerManager : Singleton<PlayerManager>
             AccountFileInfo.Instance.playerData.todayUseExpElixrPanelCount = 0;
             AccountFileInfo.Instance.playerData.todayUseExpElixrPanelCount = 0;
             AccountFileInfo.Instance.SavePlayerData();
             AccountFileInfo.Instance.SavePlayerData();
         }
         }
+
+        foreach (var keyValuePair in GuaijiDaoYou)
+        {
+            if (TimeHelper.ClientNow() > keyValuePair.Key)
+            {
+                //判断概率给奖励
+                isUpdate = true;
+                //移除
+                removeKey.Add(keyValuePair.Key);
+            }
+        }
+
+        foreach (var l in removeKey)
+        {
+            GuaijiDaoYou.Remove(l);
+        }
+
+        if (isUpdate)
+        {
+            EventManager.Instance.Dispatch(CustomEventType.DaoYouCounUpdate, null);
+            isUpdate = false;
+        }
     }
     }
 
 
 
 

+ 27 - 0
Assets/Scripts/GameUI/UI/MainPanel/MainPanel.cs

@@ -30,6 +30,12 @@ namespace Fort23.Mono
             EventManager.Instance.AddEventListener(CustomEventType.CompleteEvent, CompleteEvent);
             EventManager.Instance.AddEventListener(CustomEventType.CompleteEvent, CompleteEvent);
             EventManager.Instance.AddEventListener(CustomEventType.RemoveEvent, RemoveEvent);
             EventManager.Instance.AddEventListener(CustomEventType.RemoveEvent, RemoveEvent);
             EventManager.Instance.AddEventListener(CustomEventType.ChangeMap, ChangeMap);
             EventManager.Instance.AddEventListener(CustomEventType.ChangeMap, ChangeMap);
+            EventManager.Instance.AddEventListener(CustomEventType.DaoYouCounUpdate, DaoYouCounUpdate);
+        }
+
+        private void DaoYouCounUpdate(IEventData e)
+        {
+            UpdateDaoYouCoun();
         }
         }
 
 
 
 
@@ -54,6 +60,25 @@ namespace Fort23.Mono
             ChagneShenshiBtnActive();
             ChagneShenshiBtnActive();
         }
         }
 
 
+        public void UpdateDaoYouCoun()
+        {
+            int count = 0;
+            foreach (var keyValuePair in PlayerManager.Instance.GuaijiDaoYou)
+            {
+                count += keyValuePair.Value.Count;
+            }
+
+            if (count > 0)
+            {
+                Icon_Daoyou.gameObject.SetActive(true);
+                Text_DaoyouCount.text = count.ToString();
+            }
+            else
+            {
+                Icon_Daoyou.gameObject.SetActive(true);
+            }
+        }
+
 
 
         private void ChagneShenshiBtnActive()
         private void ChagneShenshiBtnActive()
         {
         {
@@ -66,6 +91,7 @@ namespace Fort23.Mono
             EventManager.Instance.RemoveEventListener(CustomEventType.RemoveEvent, RemoveEvent);
             EventManager.Instance.RemoveEventListener(CustomEventType.RemoveEvent, RemoveEvent);
             EventManager.Instance.RemoveEventListener(CustomEventType.ShengShiOnClick, ShengShiOnClick);
             EventManager.Instance.RemoveEventListener(CustomEventType.ShengShiOnClick, ShengShiOnClick);
             EventManager.Instance.RemoveEventListener(CustomEventType.ChangeMap, ChangeMap);
             EventManager.Instance.RemoveEventListener(CustomEventType.ChangeMap, ChangeMap);
+            EventManager.Instance.RemoveEventListener(CustomEventType.DaoYouCounUpdate, DaoYouCounUpdate);
         }
         }
 
 
         public override void AddButtonEvent()
         public override void AddButtonEvent()
@@ -102,6 +128,7 @@ namespace Fort23.Mono
             ChagneShenshiBtnActive();
             ChagneShenshiBtnActive();
             CreatShengShiEvent();
             CreatShengShiEvent();
             ChangeMap(null);
             ChangeMap(null);
+            UpdateDaoYouCoun();
 
 
             bool isHIde = false;
             bool isHIde = false;
             foreach (var skillInfo in PlayerManager.Instance.GongFaControl.allUseSkill)
             foreach (var skillInfo in PlayerManager.Instance.GongFaControl.allUseSkill)

+ 22 - 0
Assets/Scripts/GameUI/UI/MainPanel/MainPanelData.cs

@@ -151,6 +151,28 @@ namespace Fort23.Mono
 	      return _Btn_DaoYou;
 	      return _Btn_DaoYou;
 	     }
 	     }
 	   }
 	   }
+	  private MyImage _Icon_Daoyou;
+	  public MyImage Icon_Daoyou
+	   {
+	   get{
+	      if (_Icon_Daoyou == null)
+	       {
+	         _Icon_Daoyou  = GetUIUnit<MyImage>("Icon_Daoyou"); 
+	       }
+	      return _Icon_Daoyou;
+	     }
+	   }
+	  private Text _Text_DaoyouCount;
+	  public Text Text_DaoyouCount
+	   {
+	   get{
+	      if (_Text_DaoyouCount == null)
+	       {
+	         _Text_DaoyouCount  = GetUIUnit<Text>("Text_DaoyouCount"); 
+	       }
+	      return _Text_DaoyouCount;
+	     }
+	   }
 	  #endregion 自定义数据结束 
 	  #endregion 自定义数据结束 
 	 public override async CTask SetUIGameObject(GameObject gObjectPoolInterface)
 	 public override async CTask SetUIGameObject(GameObject gObjectPoolInterface)
 	{
 	{