guodong пре 3 година
родитељ
комит
40db0ba663
36 измењених фајлова са 301 додато и 196 уклоњено
  1. 20 3
      GameClient/Assets/Game/HotUpdate/Controller/GameController.cs
  2. 27 0
      GameClient/Assets/Game/HotUpdate/Controller/LogServerHelper.cs
  3. 1 1
      GameClient/Assets/Game/HotUpdate/Controller/LogServerHelper.cs.meta
  4. 7 4
      GameClient/Assets/Game/HotUpdate/Controller/LoginController.cs
  5. 4 0
      GameClient/Assets/Game/HotUpdate/ETCodes/Hotfix/App/Account/AccountInfoComponentSystem.cs
  6. 4 7
      GameClient/Assets/Game/HotUpdate/ETCodes/Hotfix/App/Login/LoginHelper.cs
  7. 3 0
      GameClient/Assets/Game/HotUpdate/ETCodes/Hotfix/App/Scene/SceneFactory.cs
  8. 1 1
      GameClient/Assets/Game/HotUpdate/ETCodes/HotfixView/AppStart_Init.cs
  9. 1 0
      GameClient/Assets/Game/HotUpdate/ETCodes/Model/App/Account/AccountInfoComponent.cs
  10. 1 1
      GameClient/Assets/Game/HotUpdate/ETCodes/Model/App/ServerInfo/ServerInfosComponent.cs
  11. 28 28
      GameClient/Assets/Game/HotUpdate/GameGlobal.cs
  12. 1 15
      GameClient/Assets/Game/HotUpdate/HotUpdateEntry.cs
  13. 0 8
      GameClient/Assets/Game/HotUpdate/HttpProxy/Entity.meta
  14. 0 8
      GameClient/Assets/Game/HotUpdate/HttpProxy/Entity/HttpResult.cs
  15. 0 19
      GameClient/Assets/Game/HotUpdate/HttpProxy/Entity/LoginResult.cs
  16. 0 8
      GameClient/Assets/Game/HotUpdate/HttpProxy/ProtoBuf.meta
  17. 0 8
      GameClient/Assets/Game/HotUpdate/HttpProxy/ProtoBuf/GenCode.meta
  18. 0 8
      GameClient/Assets/Game/HotUpdate/HttpProxy/Proxy.meta
  19. 0 41
      GameClient/Assets/Game/HotUpdate/HttpProxy/Proxy/LoginProxy.cs
  20. 18 0
      GameClient/Assets/Game/HotUpdate/ServerProxy/LogSProxy.cs
  21. 1 1
      GameClient/Assets/Game/HotUpdate/ServerProxy/LogSProxy.cs.meta
  22. 1 0
      GameClient/Assets/Game/HotUpdate/Views/CreateRole/CreateRoleView.cs
  23. 2 0
      GameClient/Assets/Game/HotUpdate/Views/Login/LoginView.cs
  24. 1 0
      GameClient/Assets/Game/HotUpdate/Views/Login/RegisterView.cs
  25. 36 0
      GameClient/Assets/Game/HotUpdate/Views/ViewGlobal.cs
  26. 1 1
      GameClient/Assets/Game/HotUpdate/Views/ViewGlobal.cs.meta
  27. 2 3
      GameClient/Assets/Game/Launcher/GameLauncher.cs
  28. 1 0
      GameClient/Assets/Game/Launcher/HotUpdateProxy/HotUpdateCodeLoader.cs
  29. 15 6
      GameClient/Assets/Game/Launcher/LauncherConfig.cs
  30. 1 1
      GameClient/Assets/Game/Launcher/Log.meta
  31. 28 0
      GameClient/Assets/Game/Launcher/Log/LogServerHelperHttp.cs
  32. 11 0
      GameClient/Assets/Game/Launcher/Log/LogServerHelperHttp.cs.meta
  33. 34 0
      GameClient/Assets/Game/Launcher/LogNode.cs
  34. 11 0
      GameClient/Assets/Game/Launcher/LogNode.cs.meta
  35. 38 24
      GameClient/Assets/Game/Launcher/Net/Http/HttpTool.cs
  36. 2 0
      GameClient/Assets/Game/Launcher/Version/VersionController.cs

+ 20 - 3
GameClient/Assets/Game/HotUpdate/Controller/GameController.cs

@@ -1,14 +1,31 @@
 using FairyGUI;
 using UnityEngine;
 using ET;
-using System.Threading.Tasks;
 
 namespace GFGGame
 {
     public class GameController
     {
 
-        public static async ET.ETTask Start()
+        public static async ETTask Init()
+        {
+            //界面
+            ViewManager.Init();
+            //日志
+            LogController.Instance.Init();
+            //全局
+            GameGlobal.Init();
+            //缓存
+            LocalCache.InitLocalData();
+            //sqlite
+            SqliteController.Instance.Init(false, ResPathUtil.SQLITE_FILE_PATH);
+            //全局点击效果
+            ViewGlobal.CreatClickEffect();
+            GameGlobal.GetGameCfg();
+            ViewManager.SetMaskAlpha(0.6f);
+        }
+
+        public static async ETTask Start()
         {
             await LoginController.CheckVersion();
             CheckShowLoginView();
@@ -69,7 +86,7 @@ namespace GFGGame
             ViewManager.Show(ViewName.CREATE_ROLE_VIEW);
         }
 
-        public static async Task PreEnterGameAsync()
+        public static async ETTask PreEnterGameAsync()
         {
             //RoleInfo roleInfo = null;
             GetSuitItemController.enable = false;

+ 27 - 0
GameClient/Assets/Game/HotUpdate/Controller/LogServerHelper.cs

@@ -0,0 +1,27 @@
+using ET;
+using UnityEngine;
+
+namespace GFGGame
+{
+    public class LogServerHelper
+    {
+        /// <summary>
+        /// 发送节点日志
+        /// </summary>
+        /// <param name="node"></param>
+        public static void SendNodeLog(ReasonEnum node)
+        {
+            var zoneScene = GameGlobal.zoneScene;
+            var logData = new EventTrackFlow2();
+            logData.iEventId = GenerateIDUtil.GenerateId();
+            logData.dtEventTime = DateTimeUtil.GetNowTime(DateTimeUtil.FormatE);
+            logData.iOperatorId = GameGlobal.platformId;
+            logData.iServerId = zoneScene.GetComponent<ServerInfosComponent>().CurrentServerId;
+            logData.sAccount = SystemInfo.deviceUniqueIdentifier;
+            logData.iEvent = (int)node;
+            logData.iServerId = GameGlobal.zoneScene.GetComponent<ServerInfosComponent>().CurrentServerId;
+            var logStr = zoneScene.GetComponent<LogSplicingComponent>().LogObjectToStr(logData);
+            LogSProxy.SendLog(logStr);
+        }
+    }
+}

+ 1 - 1
GameClient/Assets/Game/HotUpdate/HttpProxy/Proxy/LoginProxy.cs.meta → GameClient/Assets/Game/HotUpdate/Controller/LogServerHelper.cs.meta

@@ -1,5 +1,5 @@
 fileFormatVersion: 2
-guid: 21d0f0608248f2a4d8a92f5651e6d050
+guid: 1f7b80059c1be6a4a9ce6b4824837657
 MonoImporter:
   externalObjects: {}
   serializedVersion: 2

+ 7 - 4
GameClient/Assets/Game/HotUpdate/Controller/LoginController.cs

@@ -6,16 +6,16 @@ namespace GFGGame
     public class LoginController
     {
 
-        public static async ET.ETTask CheckVersion()
+        public static async ETTask CheckVersion()
         {
             ViewManager.Show<ModalStatusView>("连接中...");
             int errorCode = 0;
-            errorCode = await ET.LoginHelper.CheckVersion(GameGlobal.zoneScene, ET.ConstValue.LoginAddress, GameConst.SERVER_VERSION);
+            errorCode = await LoginHelper.CheckVersion(GameGlobal.zoneScene, ET.ConstValue.LoginAddress, GameConst.SERVER_VERSION);
             ViewManager.Hide<ModalStatusView>();
-            if (errorCode != ET.ErrorCode.ERR_Success)
+            if (errorCode != ErrorCode.ERR_Success)
             {
                 ErrorCodeController.Handler(errorCode);
-                await ETTask.Create();
+                return;
             }
         }
 
@@ -227,6 +227,7 @@ namespace GFGGame
 
         public static async ETTask ReqEnterGame()
         {
+            LogServerHelperHttp.SendNodeLog((int)LogNode.StartEnterGame);
             int errorCode = await LoginHelper.GetRealmKey(GameGlobal.zoneScene);
             if (errorCode != ErrorCode.ERR_Success)
             {
@@ -241,6 +242,8 @@ namespace GFGGame
             }
             await GameController.PreEnterGameAsync();
             ViewManager.Hide<ModalStatusView>();
+
+            LogServerHelperHttp.SendNodeLog((int)LogNode.OnEnterGame);
         }
     }
 }

+ 4 - 0
GameClient/Assets/Game/HotUpdate/ETCodes/Hotfix/App/Account/AccountInfoComponentSystem.cs

@@ -6,6 +6,10 @@
         {
             self.Token = string.Empty;
             self.AccountId = 0;
+            self.RealmKey = string.Empty;
+            self.RealmAddress = string.Empty;
+            self.Age = 0;
+            self.Account = string.Empty;
         }
     }
 

+ 4 - 7
GameClient/Assets/Game/HotUpdate/ETCodes/Hotfix/App/Login/LoginHelper.cs

@@ -52,7 +52,7 @@ namespace ET
                 accountSession?.Dispose();
                 return a2CLoginAccount.Error;
             }
-            OnLoginSuccess(zoneScene, a2CLoginAccount, accountSession);
+            OnLoginSuccess(zoneScene, a2CLoginAccount, accountSession, account);
 
             return ErrorCode.ERR_Success;
         }
@@ -84,23 +84,20 @@ namespace ET
                 accountSession?.Dispose();
                 return a2CLoginAccount.Error;
             }
-            OnLoginSuccess(zoneScene, a2CLoginAccount, accountSession);
+            OnLoginSuccess(zoneScene, a2CLoginAccount, accountSession, account);
 
             return ErrorCode.ERR_Success;
         }
 
-        public static void OnLoginSuccess(Scene zoneScene, A2C_LoginAccount a2CLoginAccount, Session accountSession)
+        public static void OnLoginSuccess(Scene zoneScene, A2C_LoginAccount a2CLoginAccount, Session accountSession, string account)
         {
-            if (zoneScene.GetComponent<SessionComponent>() == null)
-            {
-                zoneScene.AddComponent<SessionComponent>();
-            }
             zoneScene.GetComponent<SessionComponent>().AccountSession = accountSession;
             accountSession.AddComponent<PingComponent>();
             accountSession.AddComponent<DisConnectedCompnent>();
             AccountInfoComponent accountInfoComponent = zoneScene.GetComponent<AccountInfoComponent>();
             accountInfoComponent.Token = a2CLoginAccount.Token;
             accountInfoComponent.AccountId = a2CLoginAccount.AccountId;
+            accountInfoComponent.Account = account;
 
         }
 

+ 3 - 0
GameClient/Assets/Game/HotUpdate/ETCodes/Hotfix/App/Scene/SceneFactory.cs

@@ -1,4 +1,5 @@
 using System.Collections;
+using GFGGame;
 using UnityEngine;
 
 namespace ET
@@ -16,6 +17,8 @@ namespace ET
             zoneScene.AddComponent<AccountInfoComponent>();
             zoneScene.AddComponent<ServerInfosComponent>();
             zoneScene.AddComponent<RoleInfosComponent>();
+            zoneScene.AddComponent<SessionComponent>();
+            zoneScene.AddComponent<LogSplicingComponent>();
             return zoneScene;
         }
 

+ 1 - 1
GameClient/Assets/Game/HotUpdate/ETCodes/HotfixView/AppStart_Init.cs

@@ -17,7 +17,7 @@ namespace ET
             Game.Scene.AddComponent<NumericWatcherComponent>();
 
             GameGlobal.zoneScene = SceneFactory.CreateZoneScene(1, "Game", Game.Scene);
-            ET.Log.Trace("AppStart completed");
+            //LogServerHelper.SendNodeLog(ReasonEnum.SYS_INIT);
         }
     }
 }

+ 1 - 0
GameClient/Assets/Game/HotUpdate/ETCodes/Model/App/Account/AccountInfoComponent.cs

@@ -7,5 +7,6 @@
         public string RealmKey;
         public string RealmAddress;
         public int Age;
+        public string Account;
     }
 }

+ 1 - 1
GameClient/Assets/Game/HotUpdate/ETCodes/Model/App/ServerInfo/ServerInfosComponent.cs

@@ -7,7 +7,7 @@ namespace ET
         // public List<ServerInfo> ServerInfoList = new List<ServerInfo>();
         public Dictionary<long, ServerInfo> ServerInfoList = new Dictionary<long, ServerInfo>();
 
-        public int CurrentServerId = 1;
+        public int CurrentServerId = 0;
 
         public ServerInfo recentlyServerInfo;
     }

+ 28 - 28
GameClient/Assets/Game/HotUpdate/GameGlobal.cs

@@ -1,8 +1,6 @@
-using FairyGUI;
 using UnityEngine;
 using ET;
-using UI.Common;
-
+using LitJson;
 
 namespace GFGGame
 {
@@ -11,6 +9,8 @@ namespace GFGGame
         public static bool isVisitor = false;
         public static bool isFirstEntry = false;
 
+        public static string cfgName;
+
         //防沉迷开关
         public static bool antiAddiction = true;
         public static long userId = 0;
@@ -22,24 +22,20 @@ namespace GFGGame
 
 
         public static string loginApiUrl;
-        public static string gameApiUrl;
-        public static string gameApiUrlTest;
 
         //ET
         public static Scene zoneScene;
         public static Unit myUnit;
         public static NumericComponent myNumericComponent;
 
-        private static UI_ComHolder comHolder;
-        private static GameObject _gameObj;
-        private static GoWrapper _wrapper;
+        
+
+        //平台
+        public static int platformId = 1;
 
         public static void Init()
         {
-            loginApiUrl = LauncherConfig.loginApiUrl;
-            gameApiUrl = loginApiUrl;//外网
-            gameApiUrlTest = "http://localhost:8081/api/";
-            CreatClickEffect();
+            cfgName = LauncherConfig.cfgName + "_in";
         }
 
         public static string version
@@ -49,27 +45,31 @@ namespace GFGGame
                 return Application.version + "." + VEngine.Versions.ManifestsVersion;
             }
         }
-        private static void CreatClickEffect()
+
+        /// <summary>
+        /// 获取游戏配置
+        /// </summary>
+        public static void GetGameCfg()
         {
-            if (comHolder == null)
-            {
-                comHolder = UI_ComHolder.Create();
-                comHolder.target.touchable = false;
-                ViewManager.AddChildToTopLayer(comHolder.target);
-                comHolder.target.SetPosition(-100, -100, 0);
+            var url = LauncherConfig.cfgUrl.Replace("{cfgName}", cfgName);
+            HttpTool.Instance.Get(url, (string data) => {
+                ResultHandler(data);
+            });
+        }
 
-                string resPath = ResPathUtil.GetViewEffectPath("ui_dj", "ui_dj");
-                SceneController.AddObjectToView(_gameObj, _wrapper, comHolder.m_holder, resPath, out _gameObj, out _wrapper);
 
-                GRoot.inst.onTouchBegin.Add(SetClickPos);
-            }
+        private static void ResultHandler(string data)
+        {
+            var result = JsonMapper.ToObject<Result>(data);
+            loginApiUrl = result.loginApiUrl;
+            ConstValue.LoginAddress = loginApiUrl;
+            //开始游戏
+            GameController.Start().Coroutine();
         }
-        private static void SetClickPos()
+
+        private struct Result
         {
-            Vector2 pos = GRoot.inst.GlobalToLocal(Stage.inst.touchPosition);
-            comHolder.m_holder.visible = false;
-            comHolder.m_holder.visible = true;
-            comHolder.target.SetPosition(pos.x, pos.y, 0);
+            public string loginApiUrl;
         }
     }
 }

+ 1 - 15
GameClient/Assets/Game/HotUpdate/HotUpdateEntry.cs

@@ -11,7 +11,6 @@ namespace GFGGame.HotUpdate
         public static void Start()
         {
             VEngine.Logger.Loggable = false;
-            Debug.Log("HotUpdateEntry Start");
             //ET
             try
             {
@@ -28,20 +27,7 @@ namespace GFGGame.HotUpdate
             {
                 Log.Error(e);
             }
-            ViewManager.Init();
-            //日志
-            LogController.Instance.Init();
-            //全局
-            GameGlobal.Init();
-            //缓存
-            LocalCache.InitLocalData();
-            //sqlite
-            SqliteController.Instance.Init(false, ResPathUtil.SQLITE_FILE_PATH);
-            //开始游戏
-            GameController.Start().Coroutine();
-            Debug.Log("HotUpdateEntry Start completed");
-            ViewManager.SetMaskAlpha(0.6f);
-
+            GameController.Init().Coroutine();
         }
 
     }

+ 0 - 8
GameClient/Assets/Game/HotUpdate/HttpProxy/Entity.meta

@@ -1,8 +0,0 @@
-fileFormatVersion: 2
-guid: 148d947496e31e44b88efbdc5eb33e1a
-folderAsset: yes
-DefaultImporter:
-  externalObjects: {}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 8
GameClient/Assets/Game/HotUpdate/HttpProxy/Entity/HttpResult.cs

@@ -1,8 +0,0 @@
-namespace GFGGame
-{
-    public class HttpResult
-    {
-        public int code;
-        public string message;
-    }
-}

+ 0 - 19
GameClient/Assets/Game/HotUpdate/HttpProxy/Entity/LoginResult.cs

@@ -1,19 +0,0 @@
-namespace GFGGame
-{
-    public class LoginResult : HttpResult
-    {
-        public User user;
-        public string version;
-    }
-
-    public class User
-    {
-        public long id;
-        public string account;
-        public string password;
-        public string name;
-        public string identityNum;
-	    public int age;
-    }
-
-}

+ 0 - 8
GameClient/Assets/Game/HotUpdate/HttpProxy/ProtoBuf.meta

@@ -1,8 +0,0 @@
-fileFormatVersion: 2
-guid: ad5a5890967cde644ae4664bf855adc4
-folderAsset: yes
-DefaultImporter:
-  externalObjects: {}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 8
GameClient/Assets/Game/HotUpdate/HttpProxy/ProtoBuf/GenCode.meta

@@ -1,8 +0,0 @@
-fileFormatVersion: 2
-guid: a874daad47f340949bf7593e2a261bf2
-folderAsset: yes
-DefaultImporter:
-  externalObjects: {}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 8
GameClient/Assets/Game/HotUpdate/HttpProxy/Proxy.meta

@@ -1,8 +0,0 @@
-fileFormatVersion: 2
-guid: d1063c49a6ac5fc49a1764a1e21d0e2e
-folderAsset: yes
-DefaultImporter:
-  externalObjects: {}
-  userData: 
-  assetBundleName: 
-  assetBundleVariant: 

+ 0 - 41
GameClient/Assets/Game/HotUpdate/HttpProxy/Proxy/LoginProxy.cs

@@ -1,41 +0,0 @@
-using UnityEngine;
-using System;
-using LitJson;
-
-namespace GFGGame
-{
-    public class LoginProxy
-    {
-        
-        private static void Get(string methodName, Action<LoginResult> callback)
-        {
-            HttpTool.Instance.Get(GameGlobal.loginApiUrl, methodName, (string data) => {
-                ResultHandler(data, callback);
-            });
-        }
-
-        private static void Post(string methodName, string jsonString, Action<LoginResult> callback)
-        {
-            HttpTool.Instance.Post(GameGlobal.loginApiUrl, methodName, jsonString, (string data) => {
-                ResultHandler(data, callback);
-            });
-        }
-
-        private static void ResultHandler(string data, Action<LoginResult> callback)
-        {
-            LoginResult resultObj = null;
-            if(data != null)
-            {
-                resultObj = JsonMapper.ToObject<LoginResult>(data);
-            }
-            if(resultObj != null && resultObj.code != 0 && resultObj.message != null && resultObj.message.Length > 0)
-            {
-                PromptController.Instance.ShowFloatTextPrompt(resultObj.message);
-            }
-            if (callback != null)
-            {
-                callback(resultObj);
-            }
-        }
-    }
-}

+ 18 - 0
GameClient/Assets/Game/HotUpdate/ServerProxy/LogSProxy.cs

@@ -0,0 +1,18 @@
+using ET;
+
+namespace GFGGame
+{
+    public class LogSProxy
+    {
+
+        public static void SendLog(string message)
+        {
+            Session session = GameGlobal.zoneScene.GetComponent<SessionComponent>().Session;
+            if (session == null || session.IsDisposed)
+            {
+                return;
+            }
+            session.Send(new C2Log_AddLog() { Content = message});
+        }
+    }
+}

+ 1 - 1
GameClient/Assets/Game/HotUpdate/HttpProxy/Entity/LoginResult.cs.meta → GameClient/Assets/Game/HotUpdate/ServerProxy/LogSProxy.cs.meta

@@ -1,5 +1,5 @@
 fileFormatVersion: 2
-guid: 8484cad652e8b414c96ed96503a9c2f9
+guid: 62c639097c2ddf04186fbd33a32db6bd
 MonoImporter:
   externalObjects: {}
   serializedVersion: 2

+ 1 - 0
GameClient/Assets/Game/HotUpdate/Views/CreateRole/CreateRoleView.cs

@@ -32,6 +32,7 @@ namespace GFGGame
         {
             base.OnShown();
             RandomRoleName();
+            LogServerHelperHttp.SendNodeLog((int)LogNode.ShowCreateRole);
         }
 
         protected override void OnHide()

+ 2 - 0
GameClient/Assets/Game/HotUpdate/Views/Login/LoginView.cs

@@ -94,6 +94,8 @@ namespace GFGGame
             }
             _ui.m_btnChange.visible = serverInfosComponent.ServerInfoList.Count > 1;
             _ui.m_btnChange.title = string.Format("{0}区  {1}", NumberUtil.GetChiniseNumberText((int)info.Id), info.ServerName);
+
+            LogServerHelperHttp.SendNodeLog((int)LogNode.ShowSelectServer);
         }
         private void OnSeverChangeListener(EventContext context)
         {

+ 1 - 0
GameClient/Assets/Game/HotUpdate/Views/Login/RegisterView.cs

@@ -61,6 +61,7 @@ namespace GFGGame
         protected override void OnShown()
         {
             base.OnShown();
+            LogServerHelperHttp.SendNodeLog((int)LogNode.ShowRegister);
         }
 
         protected override void OnHide()

+ 36 - 0
GameClient/Assets/Game/HotUpdate/Views/ViewGlobal.cs

@@ -0,0 +1,36 @@
+using FairyGUI;
+using UI.Common;
+using UnityEngine;
+
+namespace GFGGame
+{
+    public class ViewGlobal : MonoBehaviour
+    {
+        private static UI_ComHolder comHolder;
+        private static GameObject _gameObj;
+        private static GoWrapper _wrapper;
+
+        public static void CreatClickEffect()
+        {
+            if (comHolder == null)
+            {
+                comHolder = UI_ComHolder.Create();
+                comHolder.target.touchable = false;
+                ViewManager.AddChildToTopLayer(comHolder.target);
+                comHolder.target.SetPosition(-100, -100, 0);
+
+                string resPath = ResPathUtil.GetViewEffectPath("ui_dj", "ui_dj");
+                SceneController.AddObjectToView(_gameObj, _wrapper, comHolder.m_holder, resPath, out _gameObj, out _wrapper);
+
+                GRoot.inst.onTouchBegin.Add(SetClickPos);
+            }
+        }
+        private static void SetClickPos()
+        {
+            Vector2 pos = GRoot.inst.GlobalToLocal(Stage.inst.touchPosition);
+            comHolder.m_holder.visible = false;
+            comHolder.m_holder.visible = true;
+            comHolder.target.SetPosition(pos.x, pos.y, 0);
+        }
+    }
+}

+ 1 - 1
GameClient/Assets/Game/HotUpdate/HttpProxy/Entity/HttpResult.cs.meta → GameClient/Assets/Game/HotUpdate/Views/ViewGlobal.cs.meta

@@ -1,5 +1,5 @@
 fileFormatVersion: 2
-guid: a17057addb895f04a978d18f63d8eb55
+guid: 9068b7632ea4afe46869cc60d2045c58
 MonoImporter:
   externalObjects: {}
   serializedVersion: 2

+ 2 - 3
GameClient/Assets/Game/Launcher/GameLauncher.cs

@@ -1,7 +1,5 @@
 using UnityEngine;
 using GFGGame;
-using FairyGUI;
-using System.Collections;
 using ET;
 using System.Threading;
 
@@ -32,12 +30,13 @@ public class GameLauncher : MonoBehaviour
     // Start is called before the first frame update
     void Start()
     {
+        LogServerHelperHttp.SendNodeLog((int)LogNode.OnStart);
         LauncherConfig.Init();
         Debug.LogFormat("Application.version {0}", Application.version);
         FGUILauncher.Init();
         LauncherView.Instance.Open();
         LauncherView.Instance.SetDesc("正在初始化...");
-        LauncherConfig.GetPlatformCfg();
+        LauncherConfig.GetLauncherCfg();
     }
 
 

+ 1 - 0
GameClient/Assets/Game/Launcher/HotUpdateProxy/HotUpdateCodeLoader.cs

@@ -23,6 +23,7 @@ namespace GFGGame
 
         IEnumerator StartLoadAssemblyHotfix()
         {
+            LogServerHelperHttp.SendNodeLog((int)LogNode.StartLoadGameDll);
             Debug.LogFormat("ILRuntimeLauncher StartLoadAssemblyHotfix");
             yield return new WaitForSeconds(0.1f);
             var dllPath = "Assets/Res/Code/Game.HotUpdate.dll.bytes";

+ 15 - 6
GameClient/Assets/Game/Launcher/LauncherConfig.cs

@@ -1,6 +1,5 @@
 using LitJson;
 using UnityEngine;
-using UnityEngine.Networking;
 
 namespace GFGGame
 {
@@ -18,6 +17,11 @@ namespace GFGGame
         public static string CDN_ROOT;
         public static string loginApiUrl;
         public static string gameApiUrl;
+        //平台id
+        public static string cfgUrl = "http://39.99.144.134/res/platform/{cfgName}.json";
+        public static int platformId = 1;
+        public static string logKey = "1";
+        public static string logApiUrl = "http://10.108.64.127:10004/report";
 
         //public static string CDN_ROOT = "http://10.108.64.58/";
         public static bool ILRuntimeMode;
@@ -41,11 +45,13 @@ namespace GFGGame
             //Debug.Log($"loginApiUrl {loginApiUrl} netType {netType}");
         }
 
-        public static void GetPlatformCfg()
+        /// <summary>
+        /// 获取启动器配置
+        /// </summary>
+        public static void GetLauncherCfg()
         {
-            string url = $"http://39.99.144.134/res/platform/{cfgName}.json";
-
-            HttpTool.Instance.Get(url, "", (string data) => {
+            var url = cfgUrl.Replace("{cfgName}", cfgName);
+            HttpTool.Instance.Get(url, (string data) => {
                 ResultHandler(data);
             });
         }
@@ -56,8 +62,9 @@ namespace GFGGame
             var result = JsonMapper.ToObject<Result>(data);
             CDN_ROOT = result.cdnRoot;
             loginApiUrl = result.loginApiUrl;
+            //logApiUrl = result.logApiUrl;
+            logKey = result.logKey;
             Debug.Log($"ptcfg \n{data}");
-
             LauncherView.Instance.SetDesc("获取版本信息...");
             VersionController.Instance.Init();
         }
@@ -66,6 +73,8 @@ namespace GFGGame
         {
             public string cdnRoot;
             public string loginApiUrl;
+            public string logApiUrl;
+            public string logKey;
         }
     }
 }

+ 1 - 1
GameClient/Assets/Game/HotUpdate/HttpProxy.meta → GameClient/Assets/Game/Launcher/Log.meta

@@ -1,5 +1,5 @@
 fileFormatVersion: 2
-guid: cbc482ca31dc6ee409cb222a280655c3
+guid: 3331b35c8c97ac248aad44ddb0086d4e
 folderAsset: yes
 DefaultImporter:
   externalObjects: {}

+ 28 - 0
GameClient/Assets/Game/Launcher/Log/LogServerHelperHttp.cs

@@ -0,0 +1,28 @@
+using System.Collections;
+using UnityEngine;
+
+namespace GFGGame
+{
+    public class LogServerHelperHttp
+    {
+        /// <summary>
+        /// 发送节点日志
+        /// </summary>
+        /// <param name="node"></param>
+        public static void SendNodeLog(int node, int serverId = 1)
+        {
+            //var zoneScene = GameGlobal.zoneScene;
+            //var logData = new EventTrackFlow2();
+            //logData.iEventId = GenerateIDUtil.GenerateId();
+            //logData.dtEventTime = DateTimeUtil.GetNowTime(DateTimeUtil.FormatE);
+            //logData.iOperatorId = LauncherConfig.platformId;
+            //logData.iServerId = zoneScene.GetComponent<ServerInfosComponent>().CurrentServerId;
+            //logData.sAccount = SystemInfo.deviceUniqueIdentifier;
+            //logData.iEvent = (int)node;
+            //var logStr = zoneScene.GetComponent<LogSplicingComponent>().LogObjectToStr(logData);
+            //LogSProxy.SendLog(logStr);
+            var body = $"{LauncherConfig.logKey}|{LauncherConfig.platformId}|{SystemInfo.deviceUniqueIdentifier}|{node}|{serverId}";
+            HttpTool.Instance.Post(LauncherConfig.logApiUrl, body);
+        }
+    }
+}

+ 11 - 0
GameClient/Assets/Game/Launcher/Log/LogServerHelperHttp.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 89eea5c412638af46ada2d9662483db8
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 34 - 0
GameClient/Assets/Game/Launcher/LogNode.cs

@@ -0,0 +1,34 @@
+using System.ComponentModel;
+
+namespace GFGGame
+{
+    public enum LogNode
+    {
+        [Description("游戏启动")]
+        OnStart = 1,
+
+        [Description("开始检查版本")]
+        StartCheckVersion = 2,
+
+        [Description("开始更新资源")]
+        StartDownload = 3,
+
+        [Description("开始加载游戏脚本")]
+        StartLoadGameDll = 4,
+
+        [Description("显示注册界面")]
+        ShowRegister = 5,
+
+        [Description("显示选服界面")]
+        ShowSelectServer = 6,
+
+        [Description("显示创角界面")]
+        ShowCreateRole = 7,
+
+        [Description("开始进入游戏")]
+        StartEnterGame = 8,
+
+        [Description("进入游戏成功")]
+        OnEnterGame = 9
+    }
+}

+ 11 - 0
GameClient/Assets/Game/Launcher/LogNode.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: ec8271b9029276f4a84c88bbabebe97f
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 38 - 24
GameClient/Assets/Game/Launcher/Net/Http/HttpTool.cs

@@ -4,6 +4,7 @@ using System;
 using UnityEngine.Networking;
 using System.Text;
 using GFGGame.Launcher;
+using System.Reflection;
 
 namespace GFGGame
 {
@@ -13,68 +14,81 @@ namespace GFGGame
     public class HttpTool : SingletonMonoBase<HttpTool>
     {
 
-        public void Get(string prefixUrl, string methodName, Action<string> callback)
+        public void Get(string url, Action<string> callback, bool showWrong = true)
         {
-            StartCoroutine(GetRequest(prefixUrl, methodName, callback));
+            StartCoroutine(GetRequest(url, callback, showWrong));
         }
 
-        public IEnumerator GetRequest(string prefixUrl, string methodName, Action<string> callback)
+        public void Get(string prefixUrl, string methodName, Action<string> callback, bool showWrong = true)
         {
             string url = prefixUrl + methodName;
-            Debug.Log("get url : " + url);
+            StartCoroutine(GetRequest(url, callback, showWrong));
+        }
+
+        public IEnumerator GetRequest(string url, Action<string> callback, bool showWrong)
+        {
+            ET.Log.Debug("get url : " + url);
             using (UnityWebRequest webRequest = UnityWebRequest.Get(url))
             {
                 webRequest.timeout = LauncherConfig.HTTP_GET_TIME_OUT;
                 yield return webRequest.SendWebRequest();
-                ResultHandler(webRequest, callback, prefixUrl, () =>
+                ResultHandler(webRequest, callback, url, () =>
                 {
-                    Get(prefixUrl, methodName, callback);
-                });
+                    Get(url, callback);
+                }, showWrong);
             }
         }
 
-        //jsonString 为json字符串,post提交的数据包为json
-        public void Post(string prefixUrl, string methodName, string jsonString, Action<string> callback)
+        public void Post(string url, string body, Action<string> callback = null, string contentType = "application/text", bool showWrong = false)
         {
-            StartCoroutine(PostRequest(prefixUrl, methodName, jsonString, callback));
+            StartCoroutine(PostRequest(url, body, callback, contentType, showWrong));
         }
 
-        public IEnumerator PostRequest(string prefixUrl, string methodName, string jsonString, Action<string> callback)
+        public void Post(string prefixUrl, string methodName, string body, Action<string> callback = null, string contentType = "application/text", bool showWrong = false)
         {
             string url = prefixUrl + methodName;
-             Debug.Log(string.Format("post url:{0} postData:{1}", url, jsonString));
+            Post(url, body, callback, contentType);
+        }
+
+        private IEnumerator PostRequest(string url, string body, Action<string> callback, string contentType, bool showWrong)
+        {
+            
+             ET.Log.Debug(string.Format("post url:{0} postData:{1}", url, body));
             using (UnityWebRequest webRequest = new UnityWebRequest(url, "POST"))
             {
-                byte[] bodyRaw = Encoding.UTF8.GetBytes(jsonString);
+                byte[] bodyRaw = Encoding.UTF8.GetBytes(body);
                 webRequest.uploadHandler = (UploadHandler)new UploadHandlerRaw(bodyRaw);
                 webRequest.downloadHandler = (DownloadHandler)new DownloadHandlerBuffer();
                 webRequest.timeout = LauncherConfig.HTTP_POST_TIME_OUT;
                 //http header 的内容
-                webRequest.SetRequestHeader("Content-Type", "application/json");
+                webRequest.SetRequestHeader("Content-Type", contentType);
                 // webRequest.timeout;
                 yield return webRequest.SendWebRequest();
-                ResultHandler(webRequest, callback, jsonString, () =>
+                ResultHandler(webRequest, callback, body, () =>
                 {
-                    Post(prefixUrl, methodName, jsonString, callback);
-                });
+                    Post(url, body, callback);
+                }, showWrong);
             }
         }
 
-        public void ResultHandler(UnityWebRequest webRequest, Action<string> callback, string tag, Action retryCall)
+        public void ResultHandler(UnityWebRequest webRequest, Action<string> callback, string tag, Action retryCall, bool showWrong)
         {
             string paramCallback = null;
             if (webRequest.result == UnityWebRequest.Result.ProtocolError || webRequest.result == UnityWebRequest.Result.ConnectionError)
             {
-                Debug.LogError(webRequest.error + "\n" + webRequest.downloadHandler.text);
-                Alert.Show("连接服务器失败:\n请检查网络和服务器状态")
-                .SetRightButton(true, "重试", (object data) =>
+                ET.Log.Error(webRequest.error + "\n" + webRequest.downloadHandler.text);
+                if(showWrong)
                 {
-                    retryCall();
-                });
+                    Alert.Show("连接服务器失败:\n请检查网络和服务器状态")
+                    .SetRightButton(true, "重试", (object data) =>
+                    {
+                        retryCall();
+                    });
+                }
             }
             else
             {
-                 Debug.Log("from server " + webRequest.downloadHandler.text + "\nby " + tag);
+                ET.Log.Debug("from server " + webRequest.downloadHandler.text + "\nby " + tag);
                 paramCallback = webRequest.downloadHandler.text;
                 //paramCallback = System.Text.Encoding.UTF8.GetString(webRequest.downloadHandler.data, 3, webRequest.downloadHandler.data.Length - 3);
                 callback?.Invoke(paramCallback);

+ 2 - 0
GameClient/Assets/Game/Launcher/Version/VersionController.cs

@@ -20,6 +20,7 @@ namespace GFGGame
 
         public IEnumerator InitVersion()
         {
+            LogServerHelperHttp.SendNodeLog((int)LogNode.StartCheckVersion);
             Versions.DownloadURL = LauncherConfig.CDN_ROOT;
             var operation = Versions.InitializeAsync(LauncherConfig.CDN_ROOT);
             yield return operation;
@@ -97,6 +98,7 @@ namespace GFGGame
 
         private IEnumerator GetDownloadSize()
         {
+            LogServerHelperHttp.SendNodeLog((int)LogNode.StartDownload);
             Debug.Log("VersionController GetDownloadSize");
             var getDownloadSize = Versions.GetDownloadSizeAsync(updateVersions);
             var totalCount = getDownloadSize.bundles.Count;