Browse Source

日志工具

guodong 1 year ago
parent
commit
c945b1ebd8

+ 1 - 1
GameClient/Assets/Game/HotUpdate/Data/ActivityGlobalDataManager.cs

@@ -52,7 +52,7 @@ namespace GFGGame
                 activityInfosByType.Add(activityInfo.Type, new List<int>());
             }
             activityInfosByType[activityInfo.Type].Add(activityInfo.ActivityId);
-            LogHelper.LogEditor($"AddActivityInfo {activityInfo.Type}");
+            LogUtil.LogEditor($"AddActivityInfo {activityInfo.Type}");
             //ACTIVITY_ADD
             EventAgent.DispatchEvent(ConstMessage.ACTIVITY_ADD, activityInfo.ActivityId);
             var remainTime = activityInfo.EndTime - TimeHelper.ServerNow();

+ 1 - 1
GameClient/Assets/Game/HotUpdate/Data/SkillDataManager.cs

@@ -72,7 +72,7 @@ namespace GFGGame
                         LeagueSkillCfg skillCfg = LeagueSkillCfgArray.Instance.GetCfg(skillIds[i]);
                         if (skillIds[i] == 105)
                         {
-                            LogHelper.LogEditor("");
+                            LogUtil.LogEditor("");
                         }
                         if (!LeagueSkillDatas.ContainsKey(skillCfg.type))
                         {

+ 1 - 1
GameClient/Assets/Game/HotUpdate/DressUp/DressUpLayerOperation.cs

@@ -304,7 +304,7 @@ namespace GFGGame
 
         private void UpdateHead()
         {
-            LogHelper.LogEditor("update UpdateHead");
+            LogUtil.LogEditor("update UpdateHead");
             var spritObjName = DressUpUtil.HEAD_SPRITE_NAME; 
             int sortingOrder = 1;
             Transform transform_t = parentObj.transform.Find(spritObjName);

+ 1 - 1
GameClient/Assets/Game/HotUpdate/FairyGUI/GFGGLoader.cs

@@ -11,7 +11,7 @@ namespace GFGGame
 
         protected override void LoadExternal()
         {
-            Debug.Log($"GFGGLoader this.url {this.url}");
+            //LogHelper.LogEditor($"GFGGLoader this.url {this.url}");
             if (!YooAssets.CheckResExist(this.url))
             {
                 return;

+ 2 - 2
GameClient/Assets/Game/HotUpdate/Utils/CommonUtil.cs

@@ -14,8 +14,8 @@ namespace GFGGame
         {
             if (!obj.visible) return false;
             Vector2 p = obj.LocalToGlobal(new Vector2(0, 0));
-            LogHelper.LogEditor("p:" + p);
-            LogHelper.LogEditor("point:" + point);
+            LogUtil.LogEditor("p:" + p);
+            LogUtil.LogEditor("point:" + point);
 
             float w = obj.width;
             float h = obj.height;

+ 71 - 0
GameClient/Assets/Game/HotUpdate/Utils/LogUtil.cs

@@ -0,0 +1,71 @@
+using UnityEngine;
+
+namespace GFGGame
+{
+    public static class LogUtil
+    {
+        public static void LogEditor(string content)
+        {
+#if UNITY_EDITOR
+            Debug.Log($"editor log : {content}");
+#endif
+        }
+
+        public static void LogFormatEditor(string content, params object[] args)
+        {
+#if UNITY_EDITOR
+            Debug.LogFormat($"editor log : {content}", args);
+#endif
+        }
+
+        public static void LogWarningEditor(string content)
+        {
+#if UNITY_EDITOR
+            Debug.LogWarning($"editor log : {content}");
+#endif
+        }
+
+        public static void LogWarningFormatEditor(string content, params object[] args)
+        {
+#if UNITY_EDITOR
+            Debug.LogWarningFormat($"editor log : {content}", args);
+#endif
+        }
+
+        public static void LogDev(string content)
+        {
+            if(LauncherConfig.ChannelId == (int)ChannelID.Test)
+            {
+                Debug.Log($"dev log : {content}");
+            }
+
+        }
+
+        public static void LogFormatDev(string content, params object[] args)
+        {
+            if (LauncherConfig.ChannelId == (int)ChannelID.Test)
+            {
+                Debug.LogFormat($"dev log : {content}", args);
+            }
+
+        }
+
+        public static void LogWarningDev(string content)
+        {
+            if (LauncherConfig.ChannelId == (int)ChannelID.Test)
+            {
+                Debug.LogWarning($"dev warning {content}");
+            }
+        }
+
+        public static void LogWarningFormatDev(string content, params object[] args)
+        {
+            if (LauncherConfig.ChannelId == (int)ChannelID.Test)
+            {
+                Debug.LogWarningFormat($"dev warning {content}", args);
+            }
+        }
+        
+    }
+}
+

+ 11 - 0
GameClient/Assets/Game/HotUpdate/Utils/LogUtil.cs.meta

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

+ 2 - 2
GameClient/Assets/Game/HotUpdate/Views/ClothingFoster/ClothingView.cs

@@ -294,7 +294,7 @@ namespace GFGGame
             SuitFosterCfg cfg = SuitFosterCfgArray.Instance.GetCfgsBysuitId(_suitId)[(int)(context.data) - 1];
             BonusController.TryShowBonusList(ItemUtil.CreateItemDataList(cfg.rewardsArr));
             UpdateFosterReward();
-            LogHelper.LogEditor("养护奖励:" + ItemDataManager.GetItemNum(100169));
+            LogUtil.LogEditor("养护奖励:" + ItemDataManager.GetItemNum(100169));
 
         }
         /*************************************************换新************************************************/
@@ -418,7 +418,7 @@ namespace GFGGame
         {
             ViewManager.Show<ClothingRenewFinishView>(_suitId);
             UpdateRenew();
-            LogHelper.LogEditor("换新奖励:" + ItemDataManager.GetItemNum(10370));
+            LogUtil.LogEditor("换新奖励:" + ItemDataManager.GetItemNum(10370));
 
         }
         private void UpdateRedDot()

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

@@ -859,7 +859,7 @@ namespace GFGGame
 
         private void OnRedDotChanged()
         {
-            LogHelper.LogEditor($"MainUIView OnRedDotChanged GameGlobal.AfterDataInited {GameGlobal.AfterDataInited} AutoShowCompleted {AutoShowCompleted}");
+            LogUtil.LogEditor($"MainUIView OnRedDotChanged GameGlobal.AfterDataInited {GameGlobal.AfterDataInited} AutoShowCompleted {AutoShowCompleted}");
             //暂时用这种方法优化下,红点的实现要重构!!!
             //LogHelper.LogEditor("MainUIView UpdateRedDot OnRedDotChanged");
             redPointUpdateFrame = 0;
@@ -872,7 +872,7 @@ namespace GFGGame
             if (!GameGlobal.AfterDataInited) return;
             if (!AutoShowCompleted) return;
             if (!ViewManager.CheckIsTopView(this.viewCom)) return;
-            LogHelper.LogEditor($"MainUIView UpdateRedDot redPointUpdateFrame {redPointUpdateFrame}");
+            LogUtil.LogEditor($"MainUIView UpdateRedDot redPointUpdateFrame {redPointUpdateFrame}");
             if (redPointUpdateFrame == 0)
                 _valueBarController.UpdateRedPoint();
             if (redPointUpdateFrame == 1)

+ 3 - 3
GameClient/Assets/Game/HotUpdate/Views/ViewManager.cs

@@ -155,7 +155,7 @@ namespace GFGGame
                 {
                     view.Refresh();
                 }
-                Debug.Log("当前打开:" + name);
+                LogUtil.LogDev("当前打开:" + name);
             }
 
             if (name == "MainUIView")
@@ -244,7 +244,7 @@ namespace GFGGame
             {
                 IUIView view = (IUIView)obj;
                 view.Hide();
-                Debug.Log("当前关闭:" + name);
+                LogUtil.LogDev("当前关闭:" + name);
             }
         }
 
@@ -344,7 +344,7 @@ namespace GFGGame
         }
         private static object CreateViewInstance(string name)
         {
-            // Debug.LogFormat("CreateViewInstance {0}", name);
+            //LogHelper.LogFormatDev("CreateViewInstance {0}", name);
             Type type = Type.GetType(name);
             if (type != null)
             {