Browse Source

抽奖时间表现

zhaoyang 3 years ago
parent
commit
6c31925f8f

+ 12 - 3
FGUIProject/assets/LuckyBox/components/ComListBgItem.xml

@@ -10,15 +10,24 @@
     <graph id="n31_qi04" name="holder1" xy="697,779" size="100,100">
       <relation target="" sidePair="top-middle"/>
     </graph>
-    <text id="n28_vek8" name="txtTime" xy="324,409" size="70,902" fontSize="40" color="#fffbdd" align="center" vAlign="middle" ubb="true" autoSize="none" text="剩余811小时">
-      <relation target="" sidePair="height-height,top-top"/>
-    </text>
     <graph id="n30_qi04" name="holder" xy="312,700" size="100,100">
       <relation target="" sidePair="top-middle"/>
     </graph>
     <image id="n29_qi04" name="imgTitle" src="qi041j" fileName="images/cj_zizi_2.png" xy="92,337">
       <relation target="" sidePair="top-middle"/>
     </image>
+    <text id="n33_ez2u" name="n33" xy="336,727" size="61,108" group="n36_ez2u" fontSize="41" color="#fffbdd" align="center" vAlign="middle" ubb="true" autoSize="height" text="剩余">
+      <relation target="" sidePair="height-height,top-top"/>
+    </text>
+    <text id="n34_ez2u" name="txtTime" xy="326,835" size="80,55" group="n36_ez2u" fontSize="41" color="#fffbdd" align="center" vAlign="middle" ubb="true" text="811">
+      <relation target="" sidePair="height-height,top-top"/>
+    </text>
+    <text id="n35_ez2u" name="txtTimeStr" xy="336,890" size="61,108" group="n36_ez2u" fontSize="41" color="#fffbdd" align="center" vAlign="middle" ubb="true" autoSize="height" text="小时">
+      <relation target="" sidePair="height-height,top-top"/>
+    </text>
+    <group id="n36_ez2u" name="grpTime" xy="326,727" size="80,271" advanced="true" layout="vt" excludeInvisibles="true">
+      <relation target="n29_qi04" sidePair="top-top"/>
+    </group>
   </displayList>
   <customProperty target="loaBg" propertyId="1"/>
 </component>

+ 1 - 1
GameClient/Assets/Game/CSShare

@@ -1 +1 @@
-Subproject commit d9711126125a385777a56e2532deb16b2e825b31
+Subproject commit 17f5b6c6f334d6716e8abd0abb0e06749064df04

+ 9 - 3
GameClient/Assets/Game/HotUpdate/FairyGUI/GenCode/LuckyBox/UI_ComListBgItem.cs

@@ -10,9 +10,11 @@ namespace UI.LuckyBox
         public GLoader m_loaBg;
         public GLoader m_loaImg;
         public GGraph m_holder1;
-        public GTextField m_txtTime;
         public GGraph m_holder;
         public GImage m_imgTitle;
+        public GTextField m_txtTime;
+        public GTextField m_txtTimeStr;
+        public GGroup m_grpTime;
         public const string URL = "ui://drx9d1usvek811";
         public const string PACKAGE_NAME = "LuckyBox";
         public const string RES_NAME = "ComListBgItem";
@@ -63,18 +65,22 @@ namespace UI.LuckyBox
             m_loaBg = (GLoader)comp.GetChild("loaBg");
             m_loaImg = (GLoader)comp.GetChild("loaImg");
             m_holder1 = (GGraph)comp.GetChild("holder1");
-            m_txtTime = (GTextField)comp.GetChild("txtTime");
             m_holder = (GGraph)comp.GetChild("holder");
             m_imgTitle = (GImage)comp.GetChild("imgTitle");
+            m_txtTime = (GTextField)comp.GetChild("txtTime");
+            m_txtTimeStr = (GTextField)comp.GetChild("txtTimeStr");
+            m_grpTime = (GGroup)comp.GetChild("grpTime");
         }
         public void Dispose(bool disposeTarget = false)
         {
             m_loaBg = null;
             m_loaImg = null;
             m_holder1 = null;
-            m_txtTime = null;
             m_holder = null;
             m_imgTitle = null;
+            m_txtTime = null;
+            m_txtTimeStr = null;
+            m_grpTime = null;
             if(disposeTarget && target != null)
             {
                 target.RemoveFromParent();

+ 33 - 1
GameClient/Assets/Game/HotUpdate/Utils/TimeUtil.cs

@@ -9,7 +9,11 @@ namespace GFGGame
         public static string FormattingTime(int curTime, int endTime)
         {
             int time = endTime - curTime;
-
+            int days = (int)Math.Floor((decimal)time / TimeUtil.SECOND_PER_DAY);
+            if (days >= 1)
+            {
+                return string.Format("{0}天", days);
+            }
             int hours = (int)Math.Floor((decimal)time / TimeUtil.SECOND_PER_HOUR);
             if (hours >= 1)
             {
@@ -22,5 +26,33 @@ namespace GFGGame
             }
             return string.Format("{0}秒", minutes);
         }
+
+        public static void FormattingTime(int curTime, int endTime, out int num, out string str)
+        {
+            int time = endTime - curTime;
+            int days = (int)Math.Floor((decimal)time / TimeUtil.SECOND_PER_DAY);
+            if (days >= 1)
+            {
+                num = days;
+                str = "天";
+                return;
+            }
+            int hours = (int)Math.Floor((decimal)time / TimeUtil.SECOND_PER_HOUR);
+            if (hours >= 1)
+            {
+                num = hours;
+                str = "小时";
+                return;
+            }
+            int minutes = (int)Math.Floor((decimal)time / TimeUtil.SECOND_PER_MUNITE);
+            if (minutes >= 1)
+            {
+                num = minutes;
+                str = "分钟";
+                return;
+            }
+            num = minutes;
+            str = "秒";
+        }
     }
 }

+ 1 - 5
GameClient/Assets/Game/HotUpdate/Views/ClothingDecompose/ClothingDecomposeView.cs

@@ -35,14 +35,10 @@ namespace GFGGame
             _valueBarController = new ValueBarController(_ui.m_valueBar);
 
             _ui.m_btnBack.onClick.Add(OnClickBtnBack);
-            // _ui.m_comBtnTab.m_btnRarity0.onClick.Add(() => OnClickBtnRarity(ConstDressRarity.Rarity_FANPIN));
-            // _ui.m_comBtnTab.m_btnRarity1.onClick.Add(() => OnClickBtnRarity(ConstDressRarity.Rarity_ZHENXI));
-            // _ui.m_comBtnTab.m_btnRarity2.onClick.Add(() => OnClickBtnRarity(ConstDressRarity.Rarity_DIANCANG));
-            // _ui.m_comBtnTab.m_btnRarity3.onClick.Add(() => OnClickBtnRarity(ConstDressRarity.Rarity_TIANYI));
+
             _ui.m_listTab.onClickItem.Add((EventContext context) =>
             {
                 int index = _ui.m_listTab.GetChildIndex(context.data as GObject);
-                // int rarity =ConstDressRarity.DressRarityList().GetByIndex(index);
                 OnClickBtnRarity(index + 1);
             });
 

+ 4 - 2
GameClient/Assets/Game/HotUpdate/Views/LuckyBox/LuckyBoxView.cs

@@ -113,13 +113,15 @@ namespace GFGGame
             }
             int endTime = LuckyBoxDataManager.Instance.endTime;
             int curTime = TimeHelper.ServerNowSecs;
-            UI_ComListBgItem.Proxy(_ui.m_listBg.GetChildAt(0)).m_txtTime.text = string.Format("剩余\n{0}", TimeUtil.FormattingTime(curTime, endTime));
+            TimeUtil.FormattingTime(curTime, endTime, out int num, out string str);
+            UI_ComListBgItem.Proxy(_ui.m_listBg.GetChildAt(0)).m_txtTime.text = string.Format("{0}", num);
+            UI_ComListBgItem.Proxy(_ui.m_listBg.GetChildAt(0)).m_txtTimeStr.text = string.Format("{0}", str);
         }
         private void OnListBgScroll()
         {
             UI_ComListBgItem item = UI_ComListBgItem.Proxy(_ui.m_listBg.GetChildAt(_ui.m_c1.selectedIndex));
             LuckyBoxDataManager.Instance.currentBoxId = LuckyBoxDataManager.Instance.luckyBoxIds[_ui.m_c1.selectedIndex];
-            item.m_txtTime.visible = LuckyBoxDataManager.Instance.currentBoxId == LuckyBoxDataManager.BOX_ID_1;
+            item.m_grpTime.visible = LuckyBoxDataManager.Instance.currentBoxId == LuckyBoxDataManager.BOX_ID_1;
             item.m_imgTitle.visible = LuckyBoxDataManager.Instance.currentBoxId == LuckyBoxDataManager.BOX_ID_1;
             item.m_holder.visible = isActiveBoxOpen && LuckyBoxDataManager.Instance.currentBoxId == LuckyBoxDataManager.BOX_ID_1;
             item.m_holder1.visible = isActiveBoxOpen && LuckyBoxDataManager.Instance.currentBoxId == LuckyBoxDataManager.BOX_ID_1;

BIN
GameClient/Assets/ResIn/UI/LuckyBox/LuckyBox_fui.bytes