Browse Source

修改截流时间

hexiaojie 7 months ago
parent
commit
a03807d31f
1 changed files with 82 additions and 52 deletions
  1. 82 52
      GameClient/Assets/Game/HotUpdate/Views/MainUI/MainUIView.cs

+ 82 - 52
GameClient/Assets/Game/HotUpdate/Views/MainUI/MainUIView.cs

@@ -1617,6 +1617,78 @@ namespace GFGGame
             RefreshBtnActivityFYJY();
             RefreshBtnXdmhActivity();
         }
+        
+        private void ServerTimeUpdate(object param = null)
+        {
+            long timestamp = (long)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalMilliseconds;
+            if (Math.Abs(TimeHelper.ServerNow() - timestamp) >= 60000)
+            {
+                dateTime = unixStartTime.AddMilliseconds(TimeHelper.ServerNow());
+                _ui.m_serverTime.text = dateTime.ToString();
+                _ui.m_serverTime.visible = true;
+            }
+            else
+            {
+                _ui.m_serverTime.visible = false;
+            }
+        }
+
+        private void HideMainUI()
+        {
+            _ui.m_hide.Play();
+        }
+
+        private void ShowMainUI()
+        {
+            _ui.m_show.Play();
+        }
+
+        private void OnClickBtnGetYuanXiao()
+        {
+            ViewManager.Show<ActivityGetYuanXiaoEntryView>();
+        }
+
+        private void OnClickBtnGetZhongQiu()
+        {
+            ViewManager.Show<TurnTableView>();
+        }
+
+        private void OnClickBtnFYJY()
+        {
+            ViewManager.Show<ActivityHuaRongDaoEntryView>(5016);
+        }
+
+        private void OnClickBtnXDMH()
+        {
+            ViewManager.Show<BlindBoxView>();
+        }
+
+        public static bool IsOutsideWorkingHours()
+        {
+            // 获取当前时间
+            DateTime now = DateTime.Now;
+
+            // 判断今天是否是星期一到星期五(DayOfWeek.Monday 到 DayOfWeek.Friday)
+            if (now.DayOfWeek >= DayOfWeek.Monday && now.DayOfWeek <= DayOfWeek.Friday)
+            {
+                // 判断当前时间是否在 10:00 到 19:00 之间
+                if (now.Hour >= 10 && now.Hour < 19)
+                {
+                    return false; // 在工作时间内返回 false
+                }
+            }
+            else
+            {
+                // 判断当前时间是否在 10:00 到 19:00 之间
+                if (now.Hour >= 10 && now.Hour < 11)
+                {
+                    return false; // 在工作时间内返回 false
+                }
+            }
+
+            // 否则,返回 true
+            return true;
+        }
 
         private void CheckAutoShowViews()
         {
@@ -1626,7 +1698,7 @@ namespace GFGGame
             if (GameGlobal.AutoShowCompleted) return;
             
 #if !GFGZSB
-            if ( LauncherConfig.ChannelId != 101)
+            if (LauncherConfig.ChannelId != 101)
             {
                 int isRegisterRoleInfo = GameGlobal.myNumericComponent.GetAsInt(NumericType.IsRegisterRoleInfo);
                 if (isRegisterRoleInfo == 0)
@@ -1635,12 +1707,15 @@ namespace GFGGame
                     return;
                 }
             }
-            
-            // if (LauncherConfig.platformId == 1 && LauncherConfig.ChannelId == (int)ChannelID.DouYou)
-            // {
-            //     ViewManager.Show<QieHuanView>();
-            //     return; 
-            // }
+
+            if (IsOutsideWorkingHours())
+            {
+                if (LauncherConfig.platformId == 1 && LauncherConfig.ChannelId == (int)ChannelID.DouYou)
+                {
+                    ViewManager.Show<QieHuanView>();
+                    return; 
+                }
+            }
 #endif
             
             if (!GameGlobal.AfterDataInited) return;
@@ -1816,50 +1891,5 @@ namespace GFGGame
 
             GameGlobal.AutoShowCompleted = true;
         }
-
-        private void ServerTimeUpdate(object param = null)
-        {
-            long timestamp = (long)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalMilliseconds;
-            if (Math.Abs(TimeHelper.ServerNow() - timestamp) >= 60000)
-            {
-                dateTime = unixStartTime.AddMilliseconds(TimeHelper.ServerNow());
-                _ui.m_serverTime.text = dateTime.ToString();
-                _ui.m_serverTime.visible = true;
-            }
-            else
-            {
-                _ui.m_serverTime.visible = false;
-            }
-        }
-
-        private void HideMainUI()
-        {
-            _ui.m_hide.Play();
-        }
-
-        private void ShowMainUI()
-        {
-            _ui.m_show.Play();
-        }
-
-        private void OnClickBtnGetYuanXiao()
-        {
-            ViewManager.Show<ActivityGetYuanXiaoEntryView>();
-        }
-
-        private void OnClickBtnGetZhongQiu()
-        {
-            ViewManager.Show<TurnTableView>();
-        }
-
-        private void OnClickBtnFYJY()
-        {
-            ViewManager.Show<ActivityHuaRongDaoEntryView>(5016);
-        }
-
-        private void OnClickBtnXDMH()
-        {
-            ViewManager.Show<BlindBoxView>();
-        }
     }
 }