瀏覽代碼

每个回合倒计时以及表示当前操作玩家状态显示。

xyh1985 1 年之前
父節點
當前提交
02110a9881

+ 89 - 89
Unity/Assets/Bundles/UI/UIStartFightRoom.prefab

@@ -307,7 +307,7 @@ RectTransform:
   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: 0, y: -39}
+  m_AnchoredPosition: {x: 0, y: -43.5}
   m_SizeDelta: {x: 17.8, y: 21.0786}
   m_Pivot: {x: 0.5, y: 0.5}
 --- !u!222 &7637151334217358597
@@ -925,6 +925,82 @@ MonoBehaviour:
   m_OnClick:
     m_PersistentCalls:
       m_Calls: []
+--- !u!1 &582536803192665448
+GameObject:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  serializedVersion: 6
+  m_Component:
+  - component: {fileID: 2281558622730368310}
+  - component: {fileID: 1050045494188011231}
+  - component: {fileID: 1559209943190978985}
+  m_Layer: 5
+  m_Name: shakeDiceImage
+  m_TagString: Untagged
+  m_Icon: {fileID: 0}
+  m_NavMeshLayer: 0
+  m_StaticEditorFlags: 0
+  m_IsActive: 1
+--- !u!224 &2281558622730368310
+RectTransform:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 582536803192665448}
+  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: 695807334824640198}
+  m_RootOrder: 4
+  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: 0, y: 0}
+  m_SizeDelta: {x: 130, y: 130}
+  m_Pivot: {x: 0.5, y: 0.5}
+--- !u!222 &1050045494188011231
+CanvasRenderer:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 582536803192665448}
+  m_CullTransparentMesh: 1
+--- !u!114 &1559209943190978985
+MonoBehaviour:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 582536803192665448}
+  m_Enabled: 1
+  m_EditorHideFlags: 0
+  m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, 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: 21300000, guid: dca02ca1fdbd7c44c83e50818351fc64, type: 3}
+  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
 --- !u!1 &592144104138032820
 GameObject:
   m_ObjectHideFlags: 0
@@ -4814,7 +4890,7 @@ RectTransform:
   m_LocalScale: {x: 1, y: 1, z: 1}
   m_ConstrainProportionsScale: 0
   m_Children: []
-  m_Father: {fileID: 4062708289069504894}
+  m_Father: {fileID: 7473033234659732463}
   m_RootOrder: 0
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
   m_AnchorMin: {x: 0.5, y: 0.5}
@@ -5721,12 +5797,12 @@ RectTransform:
   m_ConstrainProportionsScale: 0
   m_Children: []
   m_Father: {fileID: 695807334824640198}
-  m_RootOrder: 2
+  m_RootOrder: 3
   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: 0, y: 41.6}
-  m_SizeDelta: {x: 17.8, y: 16.041}
+  m_AnchoredPosition: {x: 0.0000076294, y: 43.8}
+  m_SizeDelta: {x: 26.5557, y: 23.0455}
   m_Pivot: {x: 0.5, y: 0.5}
 --- !u!222 &3927559419829797294
 CanvasRenderer:
@@ -5770,83 +5846,6 @@ MonoBehaviour:
     m_VerticalOverflow: 0
     m_LineSpacing: 1
   m_Text: "\u897F"
---- !u!1 &4124740683487294874
-GameObject:
-  m_ObjectHideFlags: 0
-  m_CorrespondingSourceObject: {fileID: 0}
-  m_PrefabInstance: {fileID: 0}
-  m_PrefabAsset: {fileID: 0}
-  serializedVersion: 6
-  m_Component:
-  - component: {fileID: 4062708289069504894}
-  - component: {fileID: 2728250465752227859}
-  - component: {fileID: 5241390619337803455}
-  m_Layer: 5
-  m_Name: bg
-  m_TagString: Untagged
-  m_Icon: {fileID: 0}
-  m_NavMeshLayer: 0
-  m_StaticEditorFlags: 0
-  m_IsActive: 1
---- !u!224 &4062708289069504894
-RectTransform:
-  m_ObjectHideFlags: 0
-  m_CorrespondingSourceObject: {fileID: 0}
-  m_PrefabInstance: {fileID: 0}
-  m_PrefabAsset: {fileID: 0}
-  m_GameObject: {fileID: 4124740683487294874}
-  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: 797416703502431060}
-  m_Father: {fileID: 7473033234659732463}
-  m_RootOrder: 0
-  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: 0, y: 0}
-  m_SizeDelta: {x: 231, y: 70}
-  m_Pivot: {x: 0.5, y: 0.5}
---- !u!222 &2728250465752227859
-CanvasRenderer:
-  m_ObjectHideFlags: 0
-  m_CorrespondingSourceObject: {fileID: 0}
-  m_PrefabInstance: {fileID: 0}
-  m_PrefabAsset: {fileID: 0}
-  m_GameObject: {fileID: 4124740683487294874}
-  m_CullTransparentMesh: 1
---- !u!114 &5241390619337803455
-MonoBehaviour:
-  m_ObjectHideFlags: 0
-  m_CorrespondingSourceObject: {fileID: 0}
-  m_PrefabInstance: {fileID: 0}
-  m_PrefabAsset: {fileID: 0}
-  m_GameObject: {fileID: 4124740683487294874}
-  m_Enabled: 1
-  m_EditorHideFlags: 0
-  m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, 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: 21300000, guid: dc8ea38b27a05074186d0468a6fb98cf, type: 3}
-  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
 --- !u!1 &4174834058210497546
 GameObject:
   m_ObjectHideFlags: 0
@@ -10961,7 +10960,7 @@ GameObject:
   m_Icon: {fileID: 0}
   m_NavMeshLayer: 0
   m_StaticEditorFlags: 0
-  m_IsActive: 0
+  m_IsActive: 1
 --- !u!224 &7473033234659732463
 RectTransform:
   m_ObjectHideFlags: 0
@@ -10974,7 +10973,7 @@ RectTransform:
   m_LocalScale: {x: 1, y: 1, z: 1}
   m_ConstrainProportionsScale: 0
   m_Children:
-  - {fileID: 4062708289069504894}
+  - {fileID: 797416703502431060}
   m_Father: {fileID: 1305246044504690397}
   m_RootOrder: 1
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@@ -11900,7 +11899,7 @@ RectTransform:
   m_ConstrainProportionsScale: 0
   m_Children: []
   m_Father: {fileID: 695807334824640198}
-  m_RootOrder: 3
+  m_RootOrder: 2
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
   m_AnchorMin: {x: 0.5, y: 0.5}
   m_AnchorMax: {x: 0.5, y: 0.5}
@@ -12489,7 +12488,7 @@ GameObject:
   m_Icon: {fileID: 0}
   m_NavMeshLayer: 0
   m_StaticEditorFlags: 0
-  m_IsActive: 0
+  m_IsActive: 1
 --- !u!224 &695807334824640198
 RectTransform:
   m_ObjectHideFlags: 0
@@ -12504,8 +12503,9 @@ RectTransform:
   m_Children:
   - {fileID: 5321352810883712049}
   - {fileID: 1659319275232938336}
-  - {fileID: 4588007140052152669}
   - {fileID: 3458717468839940986}
+  - {fileID: 4588007140052152669}
+  - {fileID: 2281558622730368310}
   m_Father: {fileID: 1305246044504690397}
   m_RootOrder: 0
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@@ -13753,8 +13753,6 @@ MonoBehaviour:
     gameObject: {fileID: 6387050206569559713}
   - key: fightCardItem
     gameObject: {fileID: 3256062659208714710}
-  - key: timeCountObj
-    gameObject: {fileID: 6985478614524532918}
   - key: timeCountTxt
     gameObject: {fileID: 3153060181768729541}
   - key: fightCardItem1
@@ -13791,6 +13789,8 @@ MonoBehaviour:
     gameObject: {fileID: 338371614641849239}
   - key: operatorBtn5
     gameObject: {fileID: 8041415629072857608}
+  - key: shakeDiceImage
+    gameObject: {fileID: 582536803192665448}
 --- !u!1 &8778774692199793961
 GameObject:
   m_ObjectHideFlags: 0

+ 39 - 22
Unity/Assets/Scripts/Codes/HotfixView/Client/Demo/UI/UIStartFightRoom/UIStartFightRoomComponentSystem.cs

@@ -57,14 +57,13 @@ namespace ET.Client
         {
             if (self.startTimeCount > 0)
             {
-                self.timeCountObj.SetActive(true);
                 self.timeCountTxt.text = self.startTimeCount.ToString();
             }
             else
             {
-                self.timeCountObj.SetActive(false);
                 if (self.startTimer > 0)
                     TimerComponent.Instance?.Remove(ref self.startTimer);
+                self.timeCountTxt.text = "";
             }
             self.startTimeCount = self.startTimeCount - 1;
         }
@@ -127,7 +126,7 @@ namespace ET.Client
                 self.listFaceContent = rc.Get<GameObject>("listFaceContent");
                 self.gridFaceItem = rc.Get<GameObject>("gridFaceItem");
 
-                self.timeCountObj = rc.Get<GameObject>("timeCountObj");
+                self.shakeDiceImage = rc.Get<GameObject>("shakeDiceImage").GetComponent<UnityEngine.UI.Image>();
                 self.timeCountTxt = rc.Get<GameObject>("timeCountTxt").GetComponent<UnityEngine.UI.Text>();
 
                 //玩
@@ -200,13 +199,13 @@ namespace ET.Client
 
         private static void DispathPush(Scene scene, object type)
         {
+            var ui = scene.GetComponent<UIComponent>().Get(UIType.UIStartFightRoom);
+            var startFightRoomInfo = scene.GetComponent<StartFightRoomComponment>().GetStartFightRoomInfo();
             switch (type)
             {
                 case EventType.JoinRoomPush:
                     {
-                        var ui = scene.GetComponent<UIComponent>().Get(UIType.UIStartFightRoom);
                         var startFightRoomComponentUI = ui.GetComponent<UIStartFightRoomComponent>();
-                        var startFightRoomInfo = scene.GetComponent<StartFightRoomComponment>().GetStartFightRoomInfo();
                         //处理其他玩家信息
                         for (int i = 1; i < startFightRoomComponentUI.uIStartFightRoomPlayerComs.Count; i++)
                         {
@@ -230,15 +229,9 @@ namespace ET.Client
                         }
                         break;
                     }
-                case EventType.KickPush:
-                    {
-                        break;
-                    }
                 case EventType.ReadyPush:
                     {
-                        var ui = scene.GetComponent<UIComponent>().Get(UIType.UIStartFightRoom);
                         var startFightRoomComponent = ui.GetComponent<UIStartFightRoomComponent>();
-                        var startFightRoomInfo = scene.GetComponent<StartFightRoomComponment>().GetStartFightRoomInfo();
                         //先处理自己的信息
                         if (startFightRoomInfo.roomInfo.MyInfo != null)
                         {
@@ -274,9 +267,7 @@ namespace ET.Client
                 case EventType.ReadyStartPush:
                     {
                         //开始 倒计时
-                        var startFightRoomInfo = scene.GetComponent<StartFightRoomComponment>().GetStartFightRoomInfo();
                         Log.Error("@@@@@  倒计时: " + startFightRoomInfo.readyStartTimeCount);
-                        var ui = scene.GetComponent<UIComponent>().Get(UIType.UIStartFightRoom);
                         var startFightRoomComponentUI = ui.GetComponent<UIStartFightRoomComponent>();
                         startFightRoomComponentUI.startTimeCount = startFightRoomInfo.readyStartTimeCount;
                         startFightRoomComponentUI.startTimer = TimerComponent.Instance.NewRepeatedTimer(ConstValue.fightTimeRefreshTime / 2 + 100, TimerInvokeType.startFightTimeCount, startFightRoomComponentUI);
@@ -285,11 +276,10 @@ namespace ET.Client
                 case EventType.GameStartPush:
                 case EventType.GameDrawCardPush:
                 case EventType.GameOperationPush:
+                case EventType.KickPush:
                     {
                         //正式开始 发牌
-                        var ui = scene.GetComponent<UIComponent>().Get(UIType.UIStartFightRoom);
                         var startFightRoomComponentUI = ui.GetComponent<UIStartFightRoomComponent>();
-                        var startFightRoomInfo = scene.GetComponent<StartFightRoomComponment>().GetStartFightRoomInfo();
                         var myCardInfo = startFightRoomInfo.roomInfo.MyInfo;
                         var otherCardInfo = startFightRoomInfo.roomInfo.OtherInfo;
                         #region 其他玩家牌处理
@@ -316,12 +306,11 @@ namespace ET.Client
                 case EventType.GameDisCardPush:
                     {
                         //其他玩家出推送,处理自己的操作
-                        var startFightRoomInfo = scene.GetComponent<StartFightRoomComponment>().GetStartFightRoomInfo();
-                        var myCardInfo = startFightRoomInfo.roomInfo.MyInfo;
+                        var startFightRoomComponentUI = ui.GetComponent<UIStartFightRoomComponent>();
+                        var roomInfo = startFightRoomInfo.roomInfo;
+                        var myCardInfo = roomInfo.MyInfo;
                         if (myCardInfo != null && myCardInfo.cardInfo != null && myCardInfo.cardInfo.Acts.Count > 0)
                         {
-                            var ui = scene.GetComponent<UIComponent>().Get(UIType.UIStartFightRoom);
-                            var startFightRoomComponentUI = ui.GetComponent<UIStartFightRoomComponent>();
                             startFightRoomComponentUI.operatorObj.SetActive(true);
                             //处理操作按钮
                             for (int i = 0;i < startFightRoomComponentUI.operatorObj_btn.Count;i++)
@@ -354,6 +343,18 @@ namespace ET.Client
                             startFightRoomComponentUI.curCardVal = startFightRoomInfo.roomInfo.CurDisCard;
                             Log.Error("当前出的牌: " + startFightRoomComponentUI.curCardVal);
                         }
+
+                        //处理每个回合倒计时
+                        Log.Error("当前自己回合");
+                        startFightRoomComponentUI.startTimeCount = startFightRoomInfo.roomInfo.Time;
+                        if (startFightRoomComponentUI.startTimer > 0)
+                        {
+                            startFightRoomComponentUI.timeCountTxt.text = "";
+                            TimerComponent.Instance?.Remove(ref startFightRoomComponentUI.startTimer);
+                        }
+                        startFightRoomComponentUI.startTimer = TimerComponent.Instance.NewRepeatedTimer(ConstValue.fightTimeRefreshTime / 2 + 100, TimerInvokeType.startFightTimeCount, startFightRoomComponentUI);
+                        //处理当前操作玩家的状态显示
+                        RefreshCenterOperationState(startFightRoomInfo.roomInfo.OpPos, startFightRoomComponentUI);
                         break;
                     }
             }
@@ -835,7 +836,7 @@ namespace ET.Client
                                 Log.Error("不是自己回合");
                                 return;
                             }
-                            DisCardRequest(val).Coroutine();
+                            DisCardRequest(val, startFightRoomComponentUI).Coroutine();
                         });
                     }
                     else
@@ -854,7 +855,7 @@ namespace ET.Client
                                 Log.Error("不是自己回合");
                                 return;
                             }
-                            DisCardRequest(val).Coroutine();
+                            DisCardRequest(val, startFightRoomComponentUI).Coroutine();
                         });
                     }
                 }
@@ -891,6 +892,15 @@ namespace ET.Client
             } 
         }
 
+        //刷新中间表示当前操作玩家
+        public static async void RefreshCenterOperationState(int OpPos, UIStartFightRoomComponent uIStartFightRoomComponent)
+        {
+            await ResourcesComponentHelper.Instance.LoadSprite(GameUtil.Instance.GetSceneComponent(), "fightatlas");
+            string abName = string.Concat("TimePoint",OpPos);
+            Sprite sprite = ResourcesComponentHelper.Instance.GetSprite("fightatlas", abName);
+            uIStartFightRoomComponent.shakeDiceImage.sprite = sprite;
+        }
+
         #region 请求相关
         //操作,chi p hu
         public static async ETTask OperationCardRequest(int operationType,int firstCard)
@@ -918,7 +928,7 @@ namespace ET.Client
         }
 
         //出
-        public static async ETTask DisCardRequest(int disCard)
+        public static async ETTask DisCardRequest(int disCard, UIStartFightRoomComponent startFightRoomComponentUI)
         {
             try
             {
@@ -937,6 +947,13 @@ namespace ET.Client
                     int sexType = startFightRoomInfo.roomInfo.MyInfo.sex;
                     string soundStrType = sexType == 0 ? GameSetting.Instance.disCardBoySoundName : GameSetting.Instance.disCardGirlSoundName;
                     await SoundManager.Instance.PlaySound(string.Concat(soundStrType, disCard));
+                    //出牌之后 暂停回合倒计时
+                    if (startFightRoomComponentUI.startTimer > 0)
+                    {
+                        startFightRoomComponentUI.timeCountTxt.text = "";
+                        TimerComponent.Instance?.Remove(ref startFightRoomComponentUI.startTimer);
+                    }
+                    startFightRoomComponentUI.shakeDiceImage.sprite = null;
                     //之后走推送
                 }
             }

+ 2 - 2
Unity/Assets/Scripts/Codes/Model/Share/TimerInvokeType.cs

@@ -13,7 +13,7 @@
         public const int MoveTimer = 201;
         public const int AITimer = 202;
         public const int SessionAcceptTimeout = 203;
-        public const int fightTimeShow = 204;
-        public const int startFightTimeCount = 205;
+        public const int fightTimeShow = 204; //显示系统时间
+        public const int startFightTimeCount = 205; //显示FIGHT倒计时,和每个回合倒计时
     }
 }

+ 2 - 2
Unity/Assets/Scripts/Codes/ModelView/Client/Demo/UI/UIStartFightRoom/UIStartFightRoomComponent.cs

@@ -66,7 +66,7 @@ namespace ET.Client
         //战斗聊天弹框
         public List<GameObject> playChatObjList = new List<GameObject>();
 
-        public GameObject timeCountObj;
+        public Image shakeDiceImage;
         public Text timeCountTxt;
 
         //操作
@@ -76,7 +76,7 @@ namespace ET.Client
         public long RepeatedTimer;
 
         public long startTimer;
-        public long startTimeCount = 0;
+        public long startTimeCount = 0; //用于开始倒计时,以及每个回合倒计时
         public int curCardVal = -1;
     }
 }

+ 1 - 13
Unity/Assets/Testtext.cs

@@ -13,19 +13,7 @@ namespace ET
         // Start is called before the first frame update
         void Start()
         {
-            testObj.OnClick(() => 
-            {
-                Debug.LogError("OnClick");
-            });
-            testObj.OnDoubleClick(() =>
-            {
-                Debug.LogError("OnDoubleClick");
-            });
-            testObj.OnPress(() =>
-            {
-                Debug.LogError("OnPress");
-            });
-            testObj.transform.DOKill();
+            
         }