2 Commits ca110b214b ... 9277a38388

Author SHA1 Message Date
  xyh2000 9277a38388 Merge branch 'master' of http://115.29.205.206/kimoji/ET 1 month ago
  xyh2000 63a7f9da9b 提交。。 1 month ago

+ 62 - 61
Unity/Assets/Scripts/Codes/HotfixView/Client/Demo/UI/UIStartFightRoom/UIStartFightRoomComponentSystem.cs

@@ -46,7 +46,8 @@ namespace ET.Client
     #endregion
 
     [FriendOf(typeof(UIStartFightRoomComponent))]
-	public static class UIStartFightRoomComponentSystem
+    [FriendOfAttribute(typeof(ET.StartFightRoomInfo))]
+    public static class UIStartFightRoomComponentSystem
     {
         public static void Check(this UIStartFightRoomComponent self)
         {
@@ -70,10 +71,10 @@ namespace ET.Client
         }
 
         [ObjectSystem]
-		public class UIStartFightRoomComponentAwakeSystem : AwakeSystem<UIStartFightRoomComponent>
-		{
-			protected override void Awake(UIStartFightRoomComponent self, params object[] param)
-			{
+        public class UIStartFightRoomComponentAwakeSystem : AwakeSystem<UIStartFightRoomComponent>
+        {
+            protected override void Awake(UIStartFightRoomComponent self, params object[] param)
+            {
                 ReferenceCollector rc = self.GetParent<UI>().GameObject.GetComponent<ReferenceCollector>();
                 //头像部分
                 self.houseIdTxt = rc.Get<GameObject>("houseIdTxt");
@@ -132,7 +133,7 @@ namespace ET.Client
                 self.shakeDiceImage4 = rc.Get<GameObject>("shakeDiceImage4");
                 self.timeCountTxt = rc.Get<GameObject>("timeCountTxt").GetComponent<UnityEngine.UI.Text>();
 
-              
+
 
                 //玩
                 self.readyBtn = rc.Get<GameObject>("readyBtn");
@@ -142,11 +143,11 @@ namespace ET.Client
 
                 self.fightCardItem = rc.Get<GameObject>("fightCardItem");
                 self.fightCardItem.SetActive(false);
-                GameUtil.Instance.SetCardCloneItem(self.fightCardItem,0);
+                GameUtil.Instance.SetCardCloneItem(self.fightCardItem, 0);
                 self.fightCardItem1 = rc.Get<GameObject>("fightCardItem1");
                 self.fightCardItem1.SetActive(false);
                 GameUtil.Instance.SetCardCloneItem(self.fightCardItem1, 1);
-                for (int i = 1;i <= 4;i++)
+                for (int i = 1; i <= 4; i++)
                 {
                     UIStartFightRoomPlayerCom uIStartFightRoomPlayerCom = new UIStartFightRoomPlayerCom();
                     var playerObj = rc.Get<GameObject>("player" + i);
@@ -178,13 +179,13 @@ namespace ET.Client
                 //操作
                 self.operatorObj = rc.Get<GameObject>("operatorObj");
                 self.operatorObj.SetActive(false);
-                for (int i = 1;i <= 5;i++)
+                for (int i = 1; i <= 5; i++)
                 {
                     int operatorIndex = 1;
                     var operatorObjBtn = rc.Get<GameObject>("operatorBtn" + i);
                     var btn = operatorObjBtn.GetComponent<Button>();
                     operatorIndex = i;
-                    btn.onClick.AddListener(()=>
+                    btn.onClick.AddListener(() =>
                     {
                         self.OnOperatorBtn(operatorIndex);
                     });
@@ -256,7 +257,7 @@ namespace ET.Client
                             startFightRoomComponent.uIStartFightRoomPlayerComs[0].readyImage.SetActive(startFightRoomInfo.roomInfo.MyInfo.state == 1);
                         }
                         //处理其他玩家信息
-                        for (int i = 1;i < startFightRoomComponent.uIStartFightRoomPlayerComs.Count;i++)
+                        for (int i = 1; i < startFightRoomComponent.uIStartFightRoomPlayerComs.Count; i++)
                         {
                             startFightRoomComponent.uIStartFightRoomPlayerComs[i].playerObj.SetActive(false);
                         }
@@ -335,7 +336,7 @@ namespace ET.Client
                         if (myCardInfo != null && myCardInfo.cardInfo != null && myCardInfo.cardInfo.Acts.Count > 0 && roleInfo.roleId == myCardInfo.id)
                         {
                             //处理操作按钮
-                            for (int i = 0;i < startFightRoomComponentUI.operatorObj_btn.Count;i++)
+                            for (int i = 0; i < startFightRoomComponentUI.operatorObj_btn.Count; i++)
                             {
                                 startFightRoomComponentUI.operatorObj_btn[i].SetActive(false);
                             }
@@ -352,7 +353,7 @@ namespace ET.Client
                             }
                             //重置所有牌的状态
                             var parentNode = startFightRoomComponentUI.uIStartFightRoomPlayerComs[0].fightCardNode;
-                            for (int i = 0;i < parentNode.transform.childCount;i++)
+                            for (int i = 0; i < parentNode.transform.childCount; i++)
                             {
                                 StartFightCardItem startFightCardItem = parentNode.transform.GetChild(i).gameObject.GetComponent<StartFightCardItem>();
                                 startFightCardItem.GetDown();
@@ -368,7 +369,7 @@ namespace ET.Client
                                     DisCardPushWithOperator(parentNode.transform, myCardInfo.cardInfo.ActInfo[i]);
                                 }
                             }
-                            
+
                             //记录当前出的牌
                             GameUtil.Instance.curCardVal = startFightRoomInfo.roomInfo.CurDisCard;
 
@@ -381,7 +382,6 @@ namespace ET.Client
                         if (startFightRoomInfo.roomInfo.Time > 0)
                         {
                             startFightRoomComponentUI.startTimeCount = startFightRoomInfo.roomInfo.Time;
-                            //startFightRoomComponentUI.startTimer = TimerComponent.Instance.NewRepeatedTimer(ConstValue.fightTimeRefreshTime / 1 + 100, TimerInvokeType.startFightTimeCount, startFightRoomComponentUI);
                         }
                         else
                         {
@@ -389,16 +389,17 @@ namespace ET.Client
                             if (startFightRoomComponentUI.startTimer > 0)
                             {
                                 startFightRoomComponentUI.timeCountTxt.text = "";
-                                //TimerComponent.Instance?.Remove(ref startFightRoomComponentUI.startTimer);
                             }
                         }
+                        Log.Error("@@@@ 当前出牌: " + roomInfo.CurDisCard);
+                        RefreshPlayCardList(scene, startFightRoomInfo, startFightRoomComponentUI);
                         //刷新剩余牌数量和局数
                         RefreshCurentCardCount(startFightRoomComponentUI, startFightRoomInfo.roomInfo.CardNum, startFightRoomInfo.roomInfo.CurRound);
                         break;
                     }
                 case EventType.HGHHSettlementPush:
                     {
-                         Log.Error("@#@#@@@@@  " + startFightRoomInfo.settlementInfo.CurRound);
+                        Log.Error("@#@#@@@@@  " + startFightRoomInfo.settlementInfo.CurRound);
                         var startFightRoomComponentUI = ui.GetComponent<UIStartFightRoomComponent>();
                         if (startFightRoomComponentUI.startTimer > 0)
                         {
@@ -450,7 +451,7 @@ namespace ET.Client
                     self.ReturnMainUI().Coroutine();
                 }
             };
-            Dictionary<string,object> dic = new Dictionary<string, object>()
+            Dictionary<string, object> dic = new Dictionary<string, object>()
             {
                 { "callback",myAction},
                 { "title","提示"},
@@ -474,7 +475,7 @@ namespace ET.Client
         #endregion
 
         #region 表情
-        public static async void OnFaceFastToggleBtn(this UIStartFightRoomComponent self,int index)
+        public static async void OnFaceFastToggleBtn(this UIStartFightRoomComponent self, int index)
         {
             await SoundManager.Instance.PlaySound("clickbtnsound");
             self.LoadChatData(index);
@@ -488,7 +489,7 @@ namespace ET.Client
             await ResourcesComponentHelper.Instance.LoadSprite(self.ClientScene(), "commonatlas");
             Sprite sprite = ResourcesComponentHelper.Instance.GetSprite("commonatlas", abName[0]);
             Sprite sprite1 = ResourcesComponentHelper.Instance.GetSprite("commonatlas", abName[1]);
-            self.fastToggleBtn.GetComponent<UnityEngine.UI.Image>().sprite = index == 0 ? sprite: sprite1;
+            self.fastToggleBtn.GetComponent<UnityEngine.UI.Image>().sprite = index == 0 ? sprite : sprite1;
             self.faceToggleBtn.GetComponent<UnityEngine.UI.Image>().sprite = index == 1 ? sprite : sprite1;
             self.CleanChatItem(index);
             if (index == 0)
@@ -546,12 +547,12 @@ namespace ET.Client
                 }
             }
             else
-            { 
-            
+            {
+
             }
         }
 
-        static void CleanChatItem(this UIStartFightRoomComponent self,int index)
+        static void CleanChatItem(this UIStartFightRoomComponent self, int index)
         {
             Transform node = null;
             List<GameObject> list = null;
@@ -635,7 +636,7 @@ namespace ET.Client
 
         public static async void OnCloseAsync(this UIStartFightRoomComponent self)
         {
-            await UIHelper.Remove(self.ClientScene(),UIType.UIStartFightRoom);
+            await UIHelper.Remove(self.ClientScene(), UIType.UIStartFightRoom);
         }
 
         //操作请求
@@ -656,7 +657,7 @@ namespace ET.Client
                             { "OpType",operatorIndex},
                             { "Card",cardVal}
                         };
-                        await RequestServerUtil.Instance.OpenRequestServer(HGHHMessage.C2G_HGHHOperation, dic,async (messageObj, errorCode) =>
+                        await RequestServerUtil.Instance.OpenRequestServer(HGHHMessage.C2G_HGHHOperation, dic, async (messageObj, errorCode) =>
                         {
                             if (errorCode != ErrorCode.ERR_Success)
                             {
@@ -680,7 +681,7 @@ namespace ET.Client
                             var list = GameObjectPool.Instance.GetRealySelCardList();
                             cardType = list[0];
                         }
-                        
+
                         //peng 杠 guo
                         Dictionary<string, object> dic = new Dictionary<string, object>()
                         {
@@ -732,7 +733,7 @@ namespace ET.Client
             }
         }
 
-        public static async void RefreshPlayCardList(Scene scene,StartFightRoomInfo startFightRoomInfo, UIStartFightRoomComponent startFightRoomComponentUI)
+        public static async void RefreshPlayCardList(Scene scene, StartFightRoomInfo startFightRoomInfo, UIStartFightRoomComponent startFightRoomComponentUI)
         {
             var allPos = GetPosList(startFightRoomInfo.roomInfo.MyInfo.pos);
             List<PlayerInfo> allPlayerInfo = new List<PlayerInfo>();
@@ -864,7 +865,7 @@ namespace ET.Client
                     {
                         disCardParentNode.transform.parent.gameObject.SetActive(true);
                         disCardParentNode.SetActive(true);
-                        Log.Error("@@@@@@###  disCarsd:   " + string.Join(",",playInfo.cardInfo.DisCards));
+                        Log.Error("@@@@@@###  disCarsd:   " + string.Join(",", playInfo.cardInfo.DisCards));
                         for (int l = 0; l < playInfo.cardInfo.DisCards.Count; l++)
                         {
                             int value = playInfo.cardInfo.DisCards[l];
@@ -903,7 +904,7 @@ namespace ET.Client
                                             }
                                     }
                                 }
-                                var uiDisItem = GameUtil.Instance.InitializeObj(GameUtil.Instance.GetCardCloneItem(roleInfo.roleId == playInfo.id?0:1));
+                                var uiDisItem = GameUtil.Instance.InitializeObj(GameUtil.Instance.GetCardCloneItem(roleInfo.roleId == playInfo.id ? 0 : 1));
                                 uiDisItem.SetActive(true);
                                 uiDisItem.transform.SetParent(disCardParentNode.transform, false);
                                 var sprite = await GameObjectPool.Instance.AcquireSprite(spiring);
@@ -914,13 +915,13 @@ namespace ET.Client
                         }
                     }
 
-                    CleanCardItemList(haveBeenOutContentNode.transform,2);
+                    CleanCardItemList(haveBeenOutContentNode.transform, 2);
                     if (playInfo.cardInfo.UsedInfo != null && playInfo.cardInfo.UsedInfo.Count > 0)
                     {
                         haveBeenOutContentNode.transform.parent.gameObject.SetActive(true);
                         haveBeenOutContentNode.SetActive(true);
                         var len = playInfo.cardInfo.UsedInfo.Count;
-                        for (int l = 0;l < playInfo.cardInfo.UsedInfo.Count;l++)
+                        for (int l = 0; l < playInfo.cardInfo.UsedInfo.Count; l++)
                         {
                             //这里只存一张 根据类型 自己去补
                             ActInfo actInfo = playInfo.cardInfo.UsedInfo[l];
@@ -932,21 +933,21 @@ namespace ET.Client
                                 case ActInfoType.BackPole:
                                 case ActInfoType.DarkPole:
                                     {
-                                        havCardVals = new List<int>() { actInfo.Card, actInfo.Card, actInfo.Card, actInfo.Card};
+                                        havCardVals = new List<int>() { actInfo.Card, actInfo.Card, actInfo.Card, actInfo.Card };
                                         break;
                                     }
                                 case ActInfoType.Peng:
                                     {
-                                        havCardVals = new List<int>() { actInfo.Card, actInfo.Card, actInfo.Card};
+                                        havCardVals = new List<int>() { actInfo.Card, actInfo.Card, actInfo.Card };
                                         break;
                                     }
                                 case ActInfoType.Chi:
                                     {
-                                        havCardVals = new List<int>() { actInfo.Card, actInfo.Card + 1, actInfo.Card + 2};
+                                        havCardVals = new List<int>() { actInfo.Card, actInfo.Card + 1, actInfo.Card + 2 };
                                         break;
                                     }
                             }
-                            for (int k = 0;k < havCardVals.Count;k++)
+                            for (int k = 0; k < havCardVals.Count; k++)
                             {
                                 {
                                     string spiring = "";
@@ -1046,7 +1047,7 @@ namespace ET.Client
             await SoundManager.Instance.PlaySound(string.Concat(soundStrType, destSoundStr));
         }
 
-        public static void RefreshCurentCardCount(UIStartFightRoomComponent startFightRoomComponentUI,int CardNum,int CurRound)
+        public static void RefreshCurentCardCount(UIStartFightRoomComponent startFightRoomComponentUI, int CardNum, int CurRound)
         {
             startFightRoomComponentUI.curResidueTxt.GetComponent<Text>().text = $"剩 {CardNum} 张";
             startFightRoomComponentUI.gameNumTxt.GetComponent<Text>().text = $"局数 {CurRound}/8";
@@ -1061,7 +1062,7 @@ namespace ET.Client
             //uIStartFightRoomComponent.shakeDiceImage.sprite = sprite;
         }
 
-        public static void RefreshOrientation(int opPos,UIStartFightRoomComponent uIStartFightRoomComponent)
+        public static void RefreshOrientation(int opPos, UIStartFightRoomComponent uIStartFightRoomComponent)
         {
             uIStartFightRoomComponent.shakeDiceImage1.SetActive(false);
             uIStartFightRoomComponent.shakeDiceImage2.SetActive(false);
@@ -1082,7 +1083,7 @@ namespace ET.Client
                     uIStartFightRoomComponent.shakeDiceImage4.SetActive(true);
                     break;
             }
-            
+
         }
 
         public static void RestartPlayGame(this UIStartFightRoomComponent self)
@@ -1097,17 +1098,17 @@ namespace ET.Client
                 var disCardParentNode = self.uIStartFightRoomPlayerComs[i].disCardsNode;
                 //操作过的 如 吃 碰 杠 列表
                 var haveBeenOutContentNode = self.uIStartFightRoomPlayerComs[i].haveBeenOutContentNode;
-                CleanCardItemList(fightCardParentNode.transform,0);
+                CleanCardItemList(fightCardParentNode.transform, 0);
                 CleanCardItemList(disCardParentNode.transform, 1);
                 CleanCardItemList(haveBeenOutContentNode.transform, 2);
             }
-            
+
             self.Init();
         }
 
         #region 请求相关
         //操作,chi p hu
-        public static async ETTask OperationCardRequest(int operationType,int firstCard)
+        public static async ETTask OperationCardRequest(int operationType, int firstCard)
         {
             try
             {
@@ -1116,7 +1117,7 @@ namespace ET.Client
                 if (session != null)
                 {
                     G2C_HGHHOperation g2Operation = (G2C_HGHHOperation)await session.Call(
-                        new C2G_HGHHOperation() { OpType = operationType , Card = firstCard });
+                        new C2G_HGHHOperation() { OpType = operationType, Card = firstCard });
                     if (g2Operation.Error != ErrorCode.ERR_Success)
                     {
                         Log.Error($"操作 {operationType} 出错...errCode={g2Operation.Error}");
@@ -1156,7 +1157,7 @@ namespace ET.Client
                     {
                         startFightRoomComponentUI.timeCountTxt.text = "";
                     }
-                   
+
 
                 }
             }
@@ -1168,13 +1169,13 @@ namespace ET.Client
         #endregion
 
         //type 上下0 右1 左2
-        public static void CleanCardItemList(Transform node,int index)
+        public static void CleanCardItemList(Transform node, int index)
         {
-            for (int i = 0;i < node.childCount;i++)
-            { 
+            for (int i = 0; i < node.childCount; i++)
+            {
                 var child = node.GetChild(i);
                 StartFightCardItem startFightCardItem = child.gameObject.GetComponent<StartFightCardItem>();
-                if(startFightCardItem != null)
+                if (startFightCardItem != null)
                     startFightCardItem.GetDown();
                 child.gameObject.SetActive(false);
             }
@@ -1185,7 +1186,7 @@ namespace ET.Client
             Log.Error("@@@当前牌: " + actInfo.Card);
             ActInfoType actInfoType = (ActInfoType)actInfo.Type;
             switch (actInfoType)
-            { 
+            {
                 case ActInfoType.LightPole:
                 case ActInfoType.BackPole:
                 case ActInfoType.DarkPole:
@@ -1233,10 +1234,10 @@ namespace ET.Client
                 case ActInfoType.Chi:
                     {
                         var cardVal = actInfo.Card;
-                        bool IsExist(List<int> cardVals,int cardVal,out int outCardVal)
+                        bool IsExist(List<int> cardVals, int cardVal, out int outCardVal)
                         {
                             outCardVal = 0;
-                            for (int i = 0;i < cardVals.Count;i++)
+                            for (int i = 0; i < cardVals.Count; i++)
                             {
                                 if (cardVals[i] == cardVal)
                                 {
@@ -1246,7 +1247,7 @@ namespace ET.Client
                             }
                             return false;
                         }
-                        List<int> cardVals = new List<int>() { cardVal, cardVal + 1, cardVal + 2};
+                        List<int> cardVals = new List<int>() { cardVal, cardVal + 1, cardVal + 2 };
                         List<int> tempCards = new List<int>();
                         //发1
                         //出2  1233
@@ -1255,7 +1256,7 @@ namespace ET.Client
                             var child = node.GetChild(i);
                             StartFightCardItem startFightCardItem = child.gameObject.GetComponent<StartFightCardItem>();
                             int outCardVal = 0;
-                            if (IsExist(cardVals, startFightCardItem.val,out outCardVal))
+                            if (IsExist(cardVals, startFightCardItem.val, out outCardVal))
                             {
                                 Log.Error("#####  startFightCardItem.val:  " + startFightCardItem.val + "  outCardVal:  " + outCardVal);
                                 if (outCardVal == GameUtil.Instance.curCardVal || tempCards.Contains(startFightCardItem.val))
@@ -1273,12 +1274,12 @@ namespace ET.Client
             }
         }
 
-        public static PlayerInfo GetOtherPlayInfoByPos(List<PlayerInfo> allPlayerInfos,int pos)
+        public static PlayerInfo GetOtherPlayInfoByPos(List<PlayerInfo> allPlayerInfos, int pos)
         {
-            for (int i = 0;i < allPlayerInfos.Count;i++)
+            for (int i = 0; i < allPlayerInfos.Count; i++)
             {
                 if (allPlayerInfos[i].pos == pos)
-                { 
+                {
                     return allPlayerInfos[i];
                 }
             }
@@ -1290,25 +1291,25 @@ namespace ET.Client
         {
             List<int> list = null;
             switch (myPos)
-            { 
+            {
                 case 0:
                     {
-                        list = new List<int>() { 0,1,2,3};
-                        break ;
+                        list = new List<int>() { 0, 1, 2, 3 };
+                        break;
                     }
                 case 1:
                     {
-                        list = new List<int>() { 1,2,3,0};
+                        list = new List<int>() { 1, 2, 3, 0 };
                         break;
                     }
                 case 2:
                     {
-                        list = new List<int>() { 2,3,0,1};
+                        list = new List<int>() { 2, 3, 0, 1 };
                         break;
                     }
                 case 3:
                     {
-                        list = new List<int>() { 3,0,1,2};
+                        list = new List<int>() { 3, 0, 1, 2 };
                         break;
                     }
             }