瀏覽代碼

摘星移除MP4 同时移除一些报错的特效, 尝试着优化打开游戏的速度. 在主界面对任务, 背包界面预加载方案的尝试

hexiaojie 6 月之前
父節點
當前提交
b5f76a60b3

+ 6 - 1
GameClient/Assets/Game/HotUpdate/Controller/LoginController.cs

@@ -222,6 +222,7 @@ namespace GFGGame
             GameGlobal.OpenServerTime = GameGlobal.zoneScene.GetComponent<ServerInfosComponent>().GetCurrentServerInfo()
                 .OpenServerTime;
             ViewManager.Show<ModalStatusView>("获取角色信息...");
+
             int errorCode = await LoginHelper.GetRoles(GameGlobal.zoneScene);
             if (errorCode != ErrorCode.ERR_Success)
             {
@@ -285,7 +286,11 @@ namespace GFGGame
             ViewManager.Show<ModalStatusView>("请求进入游戏...");
             ViewManager.Show<LoadingView>(0.01f);
             ViewManager.Show<ModalStatusView>("正在加载游戏配置...");
-            CommonDataManager.InitAllAsync(() => { OnLoadConfigsEnterGame().Coroutine(); });
+            CommonDataManager.InitAllAsync(() =>
+            {
+                ViewManager.Show<ModalStatusView>("正在加载游戏UI资源...");
+                ViewManager.Init2(() => { OnLoadConfigsEnterGame().Coroutine(); });
+            });
         }
 
         public static async ETTask OnLoadConfigsEnterGame()

+ 7 - 4
GameClient/Assets/Game/HotUpdate/ServerProxy/TaskSProxy.cs

@@ -41,10 +41,13 @@ namespace ET
             var changeIds = new List<int>();
             message.TaskList.ForEach(proto =>
             {
-                var taskInfo = new TaskInfo
-                    { ID = proto.Id, State = proto.Status, Progress = proto.Progress, FuncType = proto.FuncType };
-                TaskDataManager.Instance.UpdateTaskInfo(taskInfo.ID, taskInfo);
-                changeIds.Add(taskInfo.ID);
+                if (proto != null)
+                {
+                    var taskInfo = new TaskInfo
+                        { ID = proto.Id, State = proto.Status, Progress = proto.Progress, FuncType = proto.FuncType };
+                    TaskDataManager.Instance.UpdateTaskInfo(taskInfo.ID, taskInfo);
+                    changeIds.Add(taskInfo.ID);
+                }
             });
             //NOTICE_TASK_STATE_CHANGE
             //NOTICE_BATCH_TASK_STATE_CHANGE

+ 2 - 1
GameClient/Assets/Game/HotUpdate/Views/LuckyBox/LuckyBoxStarView.cs

@@ -349,7 +349,8 @@ namespace GFGGame
             {
                 RemoveListener();
                 this.Hide();
-                LuckyBoxVideoView.Instance.Show(_rewardList);
+                //LuckyBoxVideoView.Instance.Show(_rewardList);
+                ViewManager.Show<LuckyBoxBonusShowView>(_rewardList);
             }
         }
 

+ 4 - 0
GameClient/Assets/Game/HotUpdate/Views/MainUI/MainUIView.cs

@@ -178,6 +178,10 @@ namespace GFGGame
             firstIn = true;
             //这个是东8时区的0时间戳
             unixStartTime = new DateTime(1970, 1, 1, 8, 0, 0);
+            
+            //测试任务,背包预加载处理方案
+            ViewManager.PreloadViews<TaskView>();
+            ViewManager.PreloadViews<BagView>();
         }
 
         protected override void AddEventListener()

+ 78 - 37
GameClient/Assets/Game/HotUpdate/Views/ViewManager.cs

@@ -59,41 +59,42 @@ namespace GFGGame
                 "Login",
                 "Common",
                 "CommonGame",
-                "ActivityAfternoonTea",
-                "ActivityAFuGift",
-                "ActivityDay7",
-                "ActivityGetYuanXiao",
-                "ActivityHuaRongDao",
-                "ActivityMain",
-                "ActivityThemeLuckyBox",
-                "ActivityWanShiLi",
-                "Arena",
-                "Bag",
-                "BlindBox",
-                "BornLimit",
-                "Card",
-                "CardSynthetic",
-                "ClothingDecompose",
-                "ClothingFoster",
-                "ClothingShop",
-                "ClothingSynthetic",
-                "ClothingUpgrade",
                 "CreateRole",
-                "DailyWelfare",
-                "DeleteAccount",
-                "DressUp",
-                "EnduringGiftBox",
-                "Field",
-                "FieldGuide",
-                "FieldWork",
-                "Friend",
-                "Guide",
-                "InstanceZones",
-                "League",
                 "Loading",
-                "LuckyBox",
-                "Mail",
                 "Main",
+                "TimeTracing",
+            };
+
+            _totalPackagesToLoad = packagePaths.Length;
+
+            foreach (var package in packagePaths)
+            {
+                string path = ResPathUtil.GetUIPackagePath(package);
+                GFGUIPackage.AddPackage(path, () =>
+                    {
+                        _packagesLoaded++;
+                        if (_packagesLoaded == _totalPackagesToLoad)
+                        {
+                            FinalizeInit();
+                        }
+                    },
+                    (error) => { _onPackageError?.Invoke(error); });
+            }
+        }
+
+        public static void Init2(Action onComplete, Action<string> onError = null)
+        {
+            //设置CustomLoader
+            //UIObjectFactory.SetLoaderExtension(typeof(GFGGLoader));
+
+            _onPackageError = onError;
+            _packagesLoaded = 0;
+
+            string[] packagePaths = new string[]
+            {
+                "Travel",
+                "TurnTable",
+                "XiuFang",
                 "MatchingCompetition",
                 "MiniGame",
                 "NewYearLogin",
@@ -108,10 +109,38 @@ namespace GFGGame
                 "Store",
                 "Studio",
                 "Task",
-                "TimeTracing",
-                "Travel",
-                "TurnTable",
-                "XiuFang"
+                "LuckyBox",
+                "Mail",
+                "DailyWelfare",
+                "DeleteAccount",
+                "DressUp",
+                "EnduringGiftBox",
+                "Field",
+                "FieldGuide",
+                "FieldWork",
+                "Friend",
+                "Guide",
+                "InstanceZones",
+                "League",
+                "Arena",
+                "Bag",
+                "BlindBox",
+                "BornLimit",
+                "Card",
+                "CardSynthetic",
+                "ClothingDecompose",
+                "ClothingFoster",
+                "ClothingShop",
+                "ClothingSynthetic",
+                "ClothingUpgrade",
+                "ActivityAfternoonTea",
+                "ActivityAFuGift",
+                "ActivityDay7",
+                "ActivityGetYuanXiao",
+                "ActivityHuaRongDao",
+                "ActivityMain",
+                "ActivityThemeLuckyBox",
+                "ActivityWanShiLi",
             };
 
             _totalPackagesToLoad = packagePaths.Length;
@@ -124,7 +153,7 @@ namespace GFGGame
                         _packagesLoaded++;
                         if (_packagesLoaded == _totalPackagesToLoad)
                         {
-                            FinalizeInit();
+                            onComplete?.Invoke();
                         }
                     },
                     (error) => { _onPackageError?.Invoke(error); });
@@ -682,5 +711,17 @@ namespace GFGGame
 
             onSuccess?.Invoke();
         }
+
+        // 在ViewManager中添加预加载方法
+        public static void PreloadViews<T>()
+        {
+            string name = GetName(typeof(T).FullName);
+            var obj = CreateViewInstance(typeof(T).FullName) as IUIView;
+            obj.viewName = name;
+            if (!_viewDic.ContainsKey(name))
+            {
+                _viewDic.Add(name, obj);
+            }
+        }
     }
 }

+ 1 - 1
GameClient/Assets/Game/Launcher/LauncherConfig.cs

@@ -72,7 +72,7 @@ namespace GFGGame
         public static bool isHttps;
 
         public static string rechargeAddress;
-        
+
         public static bool IsTest = false;
 
         public static void InitScriptCompilation()

二進制
GameClient/Assets/ResIn/UI/LuckyBox/LuckyBox_atlas0.png


二進制
GameClient/Assets/ResIn/UI/LuckyBox/LuckyBox_atlas0_10!a.png


二進制
GameClient/Assets/ResIn/UI/LuckyBox/LuckyBox_atlas0_10.png


二進制
GameClient/Assets/ResIn/UI/LuckyBox/LuckyBox_atlas0_11!a.png


二進制
GameClient/Assets/ResIn/UI/LuckyBox/LuckyBox_atlas0_11.png


二進制
GameClient/Assets/ResIn/UI/LuckyBox/LuckyBox_atlas0_8!a.png


二進制
GameClient/Assets/ResIn/UI/LuckyBox/LuckyBox_atlas0_8.png


二進制
GameClient/Assets/ResIn/UI/LuckyBox/LuckyBox_fui.bytes


+ 1 - 0
GameClient/GameClient.sln.DotSettings.user

@@ -10,6 +10,7 @@
 	<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AEditorUtility_002Ecs_002Fl_003AC_0021_003FUsers_003Fss510_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E2_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F8d4895b259be41298a685a0c9b42357576b400_003F3f_003Fa805acc1_003FEditorUtility_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
 	<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AEnumerable_002Ecs_002Fl_003AC_0021_003FUsers_003Fss510_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F351e49e2a5bf4fd6beabb458ce2255f3ff600_003F4e_003F84b60bbd_003FEnumerable_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
 	<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AFile_002Ecs_002Fl_003AC_0021_003FUsers_003Fss510_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F695d1cc93cca45069c528c15c9fdd7493e2800_003Fc3_003F83d8926e_003FFile_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
+	<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AGameObject_002Ecs_002Fl_003AC_0021_003FUsers_003Fss510_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F683a2b31bf9142429c44f02c75dbc6c913ce00_003F88_003F39e0e101_003FGameObject_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
 	<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AIBufferWriter_00601_002Ecs_002Fl_003AC_0021_003FUsers_003Fadmin_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fa5006ea2ea344a8e8c71a2eb982aadc024518_003Fef_003F2e83f7a0_003FIBufferWriter_00601_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
 	<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AIEnumerator_00601_002Ecs_002Fl_003AC_0021_003FUsers_003Fss510_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F3789ee403a53437cbb6b5d9ab6311f51573620_003F4e_003Faad6c3b2_003FIEnumerator_00601_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
 	<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AIPEndPoint_002Ecs_002Fl_003AC_0021_003FUsers_003Fss510_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fd6e153aa051345dc96d9a55ee3adc812360448_003Fa6_003F47eb89a0_003FIPEndPoint_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>