Browse Source

【优化】游戏version & 事件日志

meijun 3 years ago
parent
commit
10acb717ea

+ 10 - 9
Common/CommonAI/Zone/EventTrigger/EventAdapter.cs

@@ -332,14 +332,6 @@ namespace CommonAI.Zone.EventTrigger
 #if JSGProfile
 			int startTick = System.Environment.TickCount;
 #endif
-			if (GlobalData.GAME_BS_TEST)
-			{
-				log.Warn("--事件: " + this.ZoneAPI.UUID + ", " + this.ZoneAPI.GetSceneID() + ", act:" + this.Name);
-			}
-            else
-            {
-                log.Debug("--事件: " + this.ZoneAPI.UUID + ", " + this.ZoneAPI.GetSceneID() + ", act:" + this.Name);
-            }
 
             //if(this.Name.Equals("事件重置列表1") || this.Name.Equals("玉重置"))
             //{
@@ -370,7 +362,16 @@ namespace CommonAI.Zone.EventTrigger
 				PrintStopwatch(stopwatch, "RunInternal");
 #if JSGProfile
 				int timeUse = System.Environment.TickCount - startTick + checkTimeUse;
-				JSGServerProfile.RecordTrigger(this.ZoneAPI, this.Name, timeUse, true);
+				bool needNotice = JSGServerProfile.RecordTrigger(this.ZoneAPI, this.Name, timeUse, true);
+
+				if (GlobalData.GAME_BS_TEST) //内部测试标记开放了
+				{
+					log.Warn("--事件: " + this.ZoneAPI.UUID + ", " + this.ZoneAPI.GetSceneID() + ", act:" + this.Name);
+				}
+				else if(needNotice)
+				{
+					log.Debug("--事件: " + this.ZoneAPI.UUID + ", " + this.ZoneAPI.GetSceneID() + ", act:" + this.Name);
+				}
 #endif
 			}
 		}

+ 4 - 0
Common/CommonAI/Zone/Instance/InstanceZone.cs

@@ -66,6 +66,10 @@ namespace CommonAI.Zone.Instance
 
         public string UUID { get; set; }
 
+        //记录触发器总览,避免日志过多
+        public long mTotalTimeUse;
+        public long mTotalTrigers;
+
         //------------------------------------------------------------------------
         readonly private ZoneInfo m_TerrainSrc;
         readonly private SpaceDivision mSpaceDiv;

+ 5 - 1
Common/CommonAI/ZoneServer/JSGModule/JSGServerProfile.cs

@@ -115,7 +115,7 @@ namespace CommonAI.ZoneServer.JSGModule
 		}
 
 		/** 记录场景触发器耗时 */
-		public static void RecordTrigger(InstanceZone zone, string triggerName, int timeUse, bool isTrigger)
+		public static bool RecordTrigger(InstanceZone zone, string triggerName, int timeUse, bool isTrigger)
 		{
 			int areaId = zone.GetSceneID();
 			JSGTriggerProfile trigger = mZoneTriggers.Get(areaId);
@@ -143,6 +143,10 @@ namespace CommonAI.ZoneServer.JSGModule
 				trigger.total.triggerTimes++;
 				triggerData.triggerTimes++;
 			}
+
+			zone.mTotalTimeUse += timeUse;
+			zone.mTotalTrigers++;
+			return zone.mTotalTimeUse > 1000 || zone.mTotalTrigers > 50000;
 		}
 
 		public static bool CheckPrintAllData()

+ 1 - 1
Common/Pomelo/PomeloShare/Interface/IZone.cs

@@ -56,7 +56,7 @@ namespace Pomelo
         void GetServerState(string serverID, Action<Exception, object> cb);
 
         //游戏服注册
-        void RegisterGameServer(int serverId, int crossId, Action<Exception, int> cb);
+        void RegisterGameServer(int serverId, int crossId, Action<Exception, string> cb);
 
 		//获取单位血量
 		void GetUnitHP(string instanceId, int objectId, Action<Exception, int> cb);

+ 14 - 14
Common/Pomelo/PomeloShare/generated/ZoneManager.cs

@@ -94,7 +94,7 @@ namespace Pomelo
     public delegate void Callback_ZoneManager_getServerState(string ret__);
 
     [_System.CodeDom.Compiler.GeneratedCodeAttribute("slice2cs", "3.6.4")]
-    public delegate void Callback_ZoneManager_registerGameServer(int ret__);
+    public delegate void Callback_ZoneManager_registerGameServer(string ret__);
 
     [_System.CodeDom.Compiler.GeneratedCodeAttribute("slice2cs", "3.6.4")]
     public delegate void Callback_ZoneManager_getUnitHP(int ret__);
@@ -354,9 +354,9 @@ namespace Pomelo
 
         string end_getServerState(Ice.AsyncResult r__);
 
-        int registerGameServer(int serverid, int crossid);
+        string registerGameServer(int serverid, int crossid);
 
-        int registerGameServer(int serverid, int crossid, _System.Collections.Generic.Dictionary<string, string> ctx__);
+        string registerGameServer(int serverid, int crossid, _System.Collections.Generic.Dictionary<string, string> ctx__);
 
         Ice.AsyncResult<Pomelo.Callback_ZoneManager_registerGameServer> begin_registerGameServer(int serverid, int crossid);
 
@@ -366,7 +366,7 @@ namespace Pomelo
 
         Ice.AsyncResult begin_registerGameServer(int serverid, int crossid, _System.Collections.Generic.Dictionary<string, string> ctx__, Ice.AsyncCallback cb__, object cookie__);
 
-        int end_registerGameServer(Ice.AsyncResult r__);
+        string end_registerGameServer(Ice.AsyncResult r__);
 
         int getUnitHP(string instanceId, int objectId);
 
@@ -851,17 +851,17 @@ namespace Pomelo
             end_playerNetStateChanged(begin_playerNetStateChanged(playerId, state, context__, explicitCtx__, true, null, null));
         }
 
-        public int registerGameServer(int serverid, int crossid)
+        public string registerGameServer(int serverid, int crossid)
         {
             return this.registerGameServer(serverid, crossid, null, false);
         }
 
-        public int registerGameServer(int serverid, int crossid, _System.Collections.Generic.Dictionary<string, string> ctx__)
+        public string registerGameServer(int serverid, int crossid, _System.Collections.Generic.Dictionary<string, string> ctx__)
         {
             return this.registerGameServer(serverid, crossid, ctx__, true);
         }
 
-        private int registerGameServer(int serverid, int crossid, _System.Collections.Generic.Dictionary<string, string> context__, bool explicitCtx__)
+        private string registerGameServer(int serverid, int crossid, _System.Collections.Generic.Dictionary<string, string> context__, bool explicitCtx__)
         {
             checkTwowayOnly__(__registerGameServer_name);
             return end_registerGameServer(begin_registerGameServer(serverid, crossid, context__, explicitCtx__, true, null, null));
@@ -1577,7 +1577,7 @@ namespace Pomelo
 
         private const string __registerGameServer_name = "registerGameServer";
 
-        public int end_registerGameServer(Ice.AsyncResult r__)
+        public string end_registerGameServer(Ice.AsyncResult r__)
         {
             IceInternal.OutgoingAsync outAsync__ = IceInternal.OutgoingAsync.check(r__, this, __registerGameServer_name);
             try
@@ -1593,9 +1593,9 @@ namespace Pomelo
                         throw new Ice.UnknownUserException(ex__.ice_name(), ex__);
                     }
                 }
-                int ret__;
+                string ret__;
                 IceInternal.BasicStream is__ = outAsync__.startReadParams();
-                ret__ = is__.readInt();
+                ret__ = is__.readString();
                 outAsync__.endReadParams();
                 return ret__;
             }
@@ -1631,7 +1631,7 @@ namespace Pomelo
 
         private void registerGameServer_completed__(Ice.AsyncResult r__, Pomelo.Callback_ZoneManager_registerGameServer cb__, Ice.ExceptionCallback excb__)
         {
-            int ret__;
+            string ret__;
             try
             {
                 ret__ = end_registerGameServer(r__);
@@ -2754,7 +2754,7 @@ namespace Pomelo
     [_System.CodeDom.Compiler.GeneratedCodeAttribute("slice2cs", "3.6.4")]
     public interface AMD_ZoneManager_registerGameServer : Ice.AMDCallback
     {
-        void ice_response(int ret__);
+        void ice_response(string ret__);
     }
 
     [_System.CodeDom.Compiler.GeneratedCodeAttribute("slice2cs", "3.6.4")]
@@ -2764,14 +2764,14 @@ namespace Pomelo
         {
         }
 
-        public void ice_response(int ret__)
+        public void ice_response(string ret__)
         {
             if(validateResponse__(true))
             {
                 try
                 {
                     IceInternal.BasicStream os__ = startWriteParams__(Ice.FormatType.DefaultFormat);
-                    os__.writeInt(ret__);
+                    os__.writeString(ret__);
                     endWriteParams__(true);
                 }
                 catch(Ice.LocalException ex__)

+ 5 - 5
XmdsServerCS/XmdsServerEdgeJS/Zone/ZoneService.cs

@@ -23,7 +23,7 @@ namespace XmdsServerEdgeJS.Zone
 	public abstract class ZoneService : IZone
 	{
 		//战斗服版本号
-		public static int s_bsVersion = 1;
+		private static readonly string S_BSVersion = "1.0.0";
 
 		public static ZoneService Instance { get; private set; }
 		protected ZoneService()
@@ -655,24 +655,24 @@ namespace XmdsServerEdgeJS.Zone
 			}
 		}
 
-		public void RegisterGameServer(int serverId, int crossId, Action<Exception, int> cb)
+		public void RegisterGameServer(int serverId, int crossId, Action<Exception, string> cb)
 		{
 			try
 			{
 				var str = ConfigurationManager.AppSettings["game.server.id"];
 				if (!string.IsNullOrEmpty(str) && int.Parse(str) != serverId && int.Parse(str) != crossId)
 				{
-					cb(null, -1);
+					cb(null, "1");
 					return;
 				}
 			}
 			catch (Exception e)
 			{
-				cb(e, -2);
+				cb(e, "2");
 				return;
 			}
 
-			cb(null, s_bsVersion);
+			cb(null, S_BSVersion);
 		}
 
 		//获取单位血量