zhaoyang 2 سال پیش
والد
کامیت
a14e44e3a2

+ 3 - 3
FGUIProject/assets/League/LeagueAnsweringUI.xml

@@ -4,7 +4,7 @@
     <remark page="0" value="有图标"/>
     <remark page="1" value="无图标"/>
   </controller>
-  <controller name="ctrlQuestionState" pages="0,,1," selected="0">
+  <controller name="ctrlQuestionState" pages="0,,1," selected="1">
     <remark page="0" value="答题中"/>
     <remark page="1" value="cd中"/>
   </controller>
@@ -34,7 +34,7 @@
     <component id="n5_pvb4" name="btnBack" src="9xlo8" fileName="components/BtnBack.xml" pkg="eg2y0ldp" xy="35,80">
       <relation target="" sidePair="left-left,top-top"/>
     </component>
-    <text id="n7_pvb4" name="txtTime" xy="706,713" size="298,44" font="ui://eg2y0ldpa0cftks" fontSize="32" color="#ceb188" text="活动剩余时间:00:00"/>
+    <text id="n7_pvb4" name="txtTime" xy="706,713" size="275,44" font="ui://eg2y0ldpa0cftks" fontSize="32" color="#ceb188" text="活动剩余时间 00:00"/>
     <component id="n8_pvb4" name="btnRule" src="psphtkg" fileName="components/BtnRule.xml" pkg="eg2y0ldp" xy="663,718" size="36,37">
       <Button icon="ui://tw70qm9do9gh4b"/>
     </component>
@@ -114,7 +114,7 @@
       <item/>
     </list>
     <list id="n30_pvb4" name="listChat" xy="366,794" size="664,869" overflow="scroll" defaultItem="ui://tw70qm9dpvb456" autoClearItems="true">
-      <relation target="" sidePair="bottom-bottom"/>
+      <relation target="" sidePair="bottomext-bottom"/>
       <item/>
       <item/>
       <item/>

+ 10 - 0
GameClient/Assets/Game/HotUpdate/Data/RoleDataManager.cs

@@ -190,6 +190,16 @@ namespace GFGGame
             otherRoleInfoData.offlineTimeSec = otherRoleInfo.OfflineTimeSec;
             return otherRoleInfoData;
         }
+        public static OtherRoleInfoData GetMineRoleInfoData()
+        {
+            OtherRoleInfoData otherRoleInfoData = new OtherRoleInfoData();
+            otherRoleInfoData.roleId = roleId;
+            otherRoleInfoData.headId = headId;
+            otherRoleInfoData.headBorderId = headBorderId;
+            otherRoleInfoData.roleName = roleName;
+            otherRoleInfoData.roleLv = lvl;
+            return otherRoleInfoData;
+        }
         private static int oldLvValue;
         public static void RoleLvUp(int oldValue)
         {

+ 15 - 24
GameClient/Assets/Game/HotUpdate/ServerProxy/ChatSProxy.cs

@@ -14,30 +14,7 @@ namespace ET
             chatData.TargetId = chatData.RoleInfo.roleId;
             chatData.Content = message.Content;
             chatData.Time = message.Time;
-            // if (message.Type == ChatType.Private)
-            // {
-            //     if (!ChatDataManager.Instance.PrivateChatDatas.ContainsKey(chatData.TargetId))
-            //     {
-            //         ChatDataManager.Instance.PrivateChatDatas[chatData.TargetId] = new List<ChatData>();
-            //     }
-            //     ChatDataManager.Instance.PrivateChatDatas[chatData.TargetId].Add(chatData);
-            //     if (response.ChatMsgs[i].Type == ChatType.Private)
-            //     {
-            //         ChatDataManager.Instance.GetChatDatas(chatData.TargetId).Add(chatData);
-            //     }
-            //     else
-            //     {
-            //         ChatDataManager.Instance.GetChatDatas(chatData.Type).Add(chatData);
-            //     }
-            // }
-            // else
-            // {
-            //     if (!ChatDataManager.Instance.PrivateChatDatas.ContainsKey(chatData.Type))
-            //     {
-            //         ChatDataManager.Instance.PrivateChatDatas[chatData.Type] = new List<ChatData>();
-            //     }
-            //     ChatDataManager.Instance.PrivateChatDatas[chatData.Type].Add(chatData);
-            // }
+
             if (chatData.Type == ChatType.Private)
             {
                 ChatDataManager.Instance.GetChatDatas(chatData.TargetId).Add(chatData);
@@ -61,8 +38,22 @@ namespace GFGGame
             response = (S2C_SendChatMsg)await MessageHelper.SendToServer(new C2S_SendChatMsg() { Type = type, Content = content, TargetId = targetId });
             if (response != null)
             {
+                ChatData chatData = new ChatData();
+                chatData.Type = type;
+                chatData.RoleInfo = RoleDataManager.GetMineRoleInfoData();
+                chatData.TargetId = targetId;
+                chatData.Content = content;
+                chatData.Time = TimeHelper.ServerNow();
                 if (response.Error == ErrorCode.ERR_Success)
                 {
+                    if (type == ChatType.Private)
+                    {
+                        ChatDataManager.Instance.GetChatDatas(targetId).Add(chatData);
+                    }
+                    else
+                    {
+                        ChatDataManager.Instance.GetChatDatas(type).Add(chatData);
+                    }
                     return true;
                 }
             }

+ 12 - 0
GameClient/Assets/Game/HotUpdate/Utils/TimeUtil.cs

@@ -156,5 +156,17 @@ namespace GFGGame
 
             return str;
         }
+        /// <summary>
+        /// <summary>
+        /// 将时间戳转换成HH:mm格式
+        /// </summary>
+        /// <param name="timeMsec">毫秒</param>
+        public static string FormattingTime7(long timeMsec)
+        {
+            DateTime date = TimeInfo.Instance.ToDateTime(timeMsec);
+            string str = date.ToString("mm:ss");
+
+            return str;
+        }
     }
 }

+ 40 - 8
GameClient/Assets/Game/HotUpdate/Views/League/LeagueAnsweringView.cs

@@ -67,12 +67,15 @@ namespace GFGGame
                 UpdateJoinList();
                 UpdateChatList();
             }
+            Timers.inst.Add(1, 0, UpdateActiveTime);
         }
 
         protected override void OnHide()
         {
             base.OnHide();
             Timers.inst.Remove(UpdateAnswerTime);
+            Timers.inst.Remove(UpdateResultTime);
+            Timers.inst.Remove(UpdateActiveTime);
         }
 
         protected override void RemoveEventListener()
@@ -89,9 +92,37 @@ namespace GFGGame
         {
             ViewManager.Show<LeagueAnswerRewardView>();
         }
-        private void OnBtnSendClick()
+        private async void OnBtnSendClick()
         {
-
+            bool result = await ChatSProxy.ReqSendChatMsg(ChatType.LeagueQuestion, _ui.m_txtChat.text);
+            if (result)
+            {
+                _ui.m_txtChat.text = "";
+                UpdateChatList();
+            }
+        }
+        private void UpdateActiveTime(object param)
+        {
+            long curTime = TimeHelper.ServerNow();
+            long endTime = 0;
+            string str = "";
+            if (LeagueDataManager.Instance.GetNumeriValue(LeagueNumericType.LeagueQuestionStatus) == LeagueQuestionStatus.End)
+            {
+                endTime = TimeUtil.GetCurDayTime(GlobalCfgArray.globalCfg.leagueQuestionCloseTime);
+                str = "房间剩余时间 ";
+            }
+            else
+            {
+                endTime = TimeUtil.GetCurDayTime(GlobalCfgArray.globalCfg.leagueQuestionEndTime);
+                str = "活动剩余时间 ";
+            }
+            if (endTime - curTime < 0)
+            {
+                Timers.inst.Remove(UpdateResultTime);
+                OnBtnBackClick();
+                return;
+            }
+            _ui.m_txtTime.text = string.Format("{0}{1}", str, TimeUtil.FormattingTime7(endTime - curTime));
         }
         private void UpdateQuestionState()
         {
@@ -126,7 +157,7 @@ namespace GFGGame
             {
                 _ui.m_listResult.numItems = questionCfg.answerArr.Length;
             }
-            _ui.m_txtTime.text = "";
+            _ui.m_txtAnswerTime.text = "";
 
             Timers.inst.Remove(UpdateAnswerTime);
             Timers.inst.Add(1, 0, UpdateAnswerTime);
@@ -135,14 +166,14 @@ namespace GFGGame
         {
             long curTime = TimeHelper.ServerNow();
             long endTime = LeagueDataManager.Instance.GetNumeriValue(LeagueNumericType.LeagueQuestionStatusEndTime);
-            if (LeagueDataManager.Instance.GetNumeriValue(LeagueNumericType.LeagueQuestionStatus) > LeagueQuestionStatus.End
+            if (LeagueDataManager.Instance.GetNumeriValue(LeagueNumericType.LeagueQuestionStatus) == LeagueQuestionStatus.End
+            || LeagueDataManager.Instance.GetNumeriValue(LeagueNumericType.LeagueQuestionStatus) == LeagueQuestionStatus.AnswerEnd
             || endTime - curTime < 0)
             {
                 Timers.inst.Remove(UpdateAnswerTime);
                 return;
             }
-            _ui.m_txtTime.text = TimeUtil.FormattingTime5((int)(endTime - curTime));
-
+            _ui.m_txtAnswerTime.text = TimeUtil.FormattingTime5((int)(endTime - curTime));
         }
         private void UpdateResult()
         {
@@ -196,7 +227,7 @@ namespace GFGGame
                 return;
             }
             // _ui.m_txtTime.text = (endTime - curTime) / 1000 + "秒后开始下一题";
-            _ui.m_txtTime.SetVar("value", ((endTime - curTime) / 1000).ToString());
+            _ui.m_txtCdTime.SetVar("value", ((endTime - curTime) / 1000).ToString());
 
         }
         private void UpdateJoinList()
@@ -212,7 +243,8 @@ namespace GFGGame
         }
         private void RenderListResultItem(int index, GObject obj)
         {
-            LeagueQuestionCfg cfg = LeagueQuestionCfgArray.Instance.dataArray[index];
+            int questionId = (int)_dataManager.GetNumeriValue(LeagueNumericType.LeagueQuestionId);
+            LeagueQuestionCfg cfg = LeagueQuestionCfgArray.Instance.GetCfg(questionId); ;
             UI_Button123 item = UI_Button123.Proxy(obj);
             int data = index + 1;
             item.target.title = string.Format("{0}.{1}", data, cfg.answerArr[index]);

BIN
GameClient/Assets/ResIn/UI/League/League_fui.bytes