Browse Source

【优化】日志

meijun 3 years ago
parent
commit
e8dfbbf793

+ 3 - 3
Common/CommonAI/Zone/EventTrigger/EventAdapter.cs

@@ -156,7 +156,7 @@ namespace CommonAI.Zone.EventTrigger
 	public abstract class EventTriggerAdapter : IEditorValueAdapter, IDisposable
 	public abstract class EventTriggerAdapter : IEditorValueAdapter, IDisposable
 	{
 	{
 		public static int EXPECT_TEST_AND_DO_ACTION_TIME_MS = 10;
 		public static int EXPECT_TEST_AND_DO_ACTION_TIME_MS = 10;
-		private Logger log = LoggerFactory.GetLogger("EventTriggerAdapter");
+		private Logger log = LoggerFactory.GetLogger("ET");
 		private IEventDataNode mData;
 		private IEventDataNode mData;
 		private IEventTriggerCollection mGroup;
 		private IEventTriggerCollection mGroup;
 		private List<TimeTaskMS> mTimes = new List<TimeTaskMS>();
 		private List<TimeTaskMS> mTimes = new List<TimeTaskMS>();
@@ -334,11 +334,11 @@ namespace CommonAI.Zone.EventTrigger
 #endif
 #endif
 			if (GlobalData.GAME_BS_TEST)
 			if (GlobalData.GAME_BS_TEST)
 			{
 			{
-				log.Warn("--调试场景: " + this.ZoneAPI.UUID + ", " + this.ZoneAPI.GetSceneID() + ", 执行动作:" + this.Name);
+				log.Warn("--事件: " + this.ZoneAPI.UUID + ", " + this.ZoneAPI.GetSceneID() + ", act:" + this.Name);
 			}
 			}
             else
             else
             {
             {
-                log.Debug("--调试场景: " + this.ZoneAPI.UUID + ", " + this.ZoneAPI.GetSceneID() + ", 执行动作:" + this.Name);
+                log.Debug("--事件: " + this.ZoneAPI.UUID + ", " + this.ZoneAPI.GetSceneID() + ", act:" + this.Name);
             }
             }
 
 
             //if(this.Name.Equals("事件重置列表1") || this.Name.Equals("玉重置"))
             //if(this.Name.Equals("事件重置列表1") || this.Name.Equals("玉重置"))

+ 172 - 172
Common/CommonAI/Zone/Instance/InstanceZone.cs

@@ -126,13 +126,13 @@ namespace CommonAI.Zone.Instance
             //             this.path_terrain_area_gen = new ManhattanMapAreaGenerator(path_terrain_data.Data);
             //             this.path_terrain_area_gen = new ManhattanMapAreaGenerator(path_terrain_data.Data);
             this.InitTerrain(data, spaceDivSize, out this.path_terrain_data, out this.path_finder, out this.path_terrain_area_gen);
             this.InitTerrain(data, spaceDivSize, out this.path_terrain_data, out this.path_finder, out this.path_terrain_area_gen);
             this.mQuestAdapter = TemplateManager.Factory.CreateQuestAdapter(this);
             this.mQuestAdapter = TemplateManager.Factory.CreateQuestAdapter(this);
-			this.baseInit(data, gsData);			
-		}
+            this.baseInit(data, gsData);
+        }
 
 
-		protected virtual void baseInit(ZoneEditor.SceneData data, GSCreateAreaData gsData)
-		{
+        protected virtual void baseInit(ZoneEditor.SceneData data, GSCreateAreaData gsData)
+        {
 
 
-		}
+        }
 
 
 
 
         // -----------------------------------------------------------------------------------
         // -----------------------------------------------------------------------------------
@@ -251,19 +251,19 @@ namespace CommonAI.Zone.Instance
             mTasks.Enqueue(task);
             mTasks.Enqueue(task);
         }
         }
 
 
-		public string GetInfo()
-		{
-			if(this.mObjects == null)
-			{
-				return "对象:-1";
-			}
-			
-			return "对象:" + AllObjectsCount + ", 单位:" + AllUnitsCount + ", 法术:" + AllSpellsCount + ", 道具:" + AllItemsCount + ", 玩家:" + AllPlayersCount;
-		}
+        public string GetInfo()
+        {
+            if (this.mObjects == null)
+            {
+                return "对象:-1";
+            }
+
+            return "对象:" + AllObjectsCount + ", 单位:" + AllUnitsCount + ", 法术:" + AllSpellsCount + ", 道具:" + AllItemsCount + ", 玩家:" + AllPlayersCount;
+        }
 
 
-		/// <summary>
-		/// 【线程安全】增加时间任务
-		/// </summary>
+        /// <summary>
+        /// 【线程安全】增加时间任务
+        /// </summary>
         /// <param name="intervalMS"></param>
         /// <param name="intervalMS"></param>
         /// <param name="delayMS"></param>
         /// <param name="delayMS"></param>
         /// <param name="repeat"></param>
         /// <param name="repeat"></param>
@@ -288,11 +288,11 @@ namespace CommonAI.Zone.Instance
         /// <param name="handler"></param>
         /// <param name="handler"></param>
         public TimeTaskMS AddTimePeriodicMS(int intervalMS, TickHandler handler)
         public TimeTaskMS AddTimePeriodicMS(int intervalMS, TickHandler handler)
         {
         {
-			if(intervalMS <= 0)
-			{
-				log.Error("增加定时任务异常:" + intervalMS);
-				return null;
-			}
+            if (intervalMS <= 0)
+            {
+                log.Error("增加定时任务异常:" + intervalMS);
+                return null;
+            }
             return mTimeTasks.AddTimePeriodicMS(intervalMS, handler);
             return mTimeTasks.AddTimePeriodicMS(intervalMS, handler);
         }
         }
 
 
@@ -327,21 +327,21 @@ namespace CommonAI.Zone.Instance
         /// <param name="evt"></param>
         /// <param name="evt"></param>
         public void queueObjectEvent(InstanceZoneObject obj, ObjectEvent evt, bool force = false)
         public void queueObjectEvent(InstanceZoneObject obj, ObjectEvent evt, bool force = false)
         {
         {
-			if(mSendingEvents == null)
-			{
-				if(mObjects == null)
-				{
-					log.Warn("queueObjectEvent exception1: " + this.GetSceneID() + ", mObjects null, " + this.UUID + ", " + evt.GetType()
+            if (mSendingEvents == null)
+            {
+                if (mObjects == null)
+                {
+                    log.Warn("queueObjectEvent exception1: " + this.GetSceneID() + ", mObjects null, " + this.UUID + ", " + evt.GetType()
                         + ", " + new StackTrace().ToString());
                         + ", " + new StackTrace().ToString());
-				}
-				else
-				{
-					log.Warn("queueObjectEvent exception2: " + this.GetSceneID() + ", Players: " + this.AllPlayersCount + ", Items: "
-					+ this.AllItemsCount + ", Units: " + this.AllUnitsCount + ", " + this.UUID + ", " + evt.GetType() + ", " + new StackTrace().ToString());
-				}
-				
-				return;
-			}
+                }
+                else
+                {
+                    log.Warn("queueObjectEvent exception2: " + this.GetSceneID() + ", Players: " + this.AllPlayersCount + ", Items: "
+                    + this.AllItemsCount + ", Units: " + this.AllUnitsCount + ", " + this.UUID + ", " + evt.GetType() + ", " + new StackTrace().ToString());
+                }
+
+                return;
+            }
 
 
             if (obj.ID == 0)
             if (obj.ID == 0)
                 return;
                 return;
@@ -819,22 +819,22 @@ namespace CommonAI.Zone.Instance
 
 
         private long mAddUnitPrintTime = 0;
         private long mAddUnitPrintTime = 0;
 
 
-        public InstanceUnit AddUnit(UnitInfo info, string name, int force, int level, float x, float y, float direction, 
+        public InstanceUnit AddUnit(UnitInfo info, string name, int force, int level, float x, float y, float direction,
             out AddUnitEvent add, InstanceUnit summoner = null, String clientShowName = "", int gsFlag = 0, int alliesForce = 0, bool pointLv = false)
             out AddUnitEvent add, InstanceUnit summoner = null, String clientShowName = "", int gsFlag = 0, int alliesForce = 0, bool pointLv = false)
         {
         {
             add = null;
             add = null;
-			if (mObjects.UnitsCount >= mMaxUnitCount)
-			{
-                if(mAddUnitPrintTime < CommonLang.CUtils.localTimeMS)
+            if (mObjects.UnitsCount >= mMaxUnitCount)
+            {
+                if (mAddUnitPrintTime < CommonLang.CUtils.localTimeMS)
                 {
                 {
                     mAddUnitPrintTime = CommonLang.CUtils.localTimeMS + 3000;
                     mAddUnitPrintTime = CommonLang.CUtils.localTimeMS + 3000;
                     log.Warn(string.Format("--Zone AddUnit to max: {0}, UUID: {1}, ID: {2} 单位数量:{3}", this.GetSceneID(), this.UUID, info.TemplateID, GetZoneUnitInfo()));
                     log.Warn(string.Format("--Zone AddUnit to max: {0}, UUID: {1}, ID: {2} 单位数量:{3}", this.GetSceneID(), this.UUID, info.TemplateID, GetZoneUnitInfo()));
                 }
                 }
-				
-				return null;
-			}
 
 
-			if (mTryAddUnit != null && !mTryAddUnit.Invoke(info))
+                return null;
+            }
+
+            if (mTryAddUnit != null && !mTryAddUnit.Invoke(info))
             {
             {
                 //log.Info(string.Format("Zone Unit TryAdd max: {0}, {1}, 单位数量:{2}", this.TerrainSrc.ID, info.TemplateID, mObjects.UnitsCount));
                 //log.Info(string.Format("Zone Unit TryAdd max: {0}, {1}, 单位数量:{2}", this.TerrainSrc.ID, info.TemplateID, mObjects.UnitsCount));
                 return null;
                 return null;
@@ -856,8 +856,8 @@ namespace CommonAI.Zone.Instance
                     if (unit is ISummonedUnit)
                     if (unit is ISummonedUnit)
                     {
                     {
                         ((ISummonedUnit)unit).SummonerUnit = summoner;
                         ((ISummonedUnit)unit).SummonerUnit = summoner;
-                    }                   
-                   
+                    }
+
                     try
                     try
                     {
                     {
                         unit.onAdded(this, pointLv);
                         unit.onAdded(this, pointLv);
@@ -908,7 +908,7 @@ namespace CommonAI.Zone.Instance
             }
             }
 
 
             string finalStr = "";
             string finalStr = "";
-            foreach(int unitID in mInfo.Keys)
+            foreach (int unitID in mInfo.Keys)
             {
             {
                 int count = mInfo.Get(unitID);
                 int count = mInfo.Get(unitID);
                 if (count < nMinNums)
                 if (count < nMinNums)
@@ -923,16 +923,16 @@ namespace CommonAI.Zone.Instance
 
 
 
 
         public InstanceItem AddItem(ItemTemplate template, string name, float x, float y, float direction, int force, string disPlayName,
         public InstanceItem AddItem(ItemTemplate template, string name, float x, float y, float direction, int force, string disPlayName,
-			out AddItemEvent add, InstanceUnit creater,int from)
+            out AddItemEvent add, InstanceUnit creater, int from)
         {
         {
-			add = null;
-			if (mTryAddItem != null && !mTryAddItem.Invoke(template))
-			{
-				//log.Info(string.Format("Zone item TryAdd max: {0}, {1}", this.mSceneType, template.TemplateID));
-				return null;
-			}
+            add = null;
+            if (mTryAddItem != null && !mTryAddItem.Invoke(template))
+            {
+                //log.Info(string.Format("Zone item TryAdd max: {0}, {1}", this.mSceneType, template.TemplateID));
+                return null;
+            }
 
 
-			InstanceItem ret = TemplateManager.Factory.CreateItem(this, template, name, force, creater, disPlayName,from);
+            InstanceItem ret = TemplateManager.Factory.CreateItem(this, template, name, force, creater, disPlayName, from);
             ret.setPos(x, y);
             ret.setPos(x, y);
             if (ret.tryAdd(x, y, direction))
             if (ret.tryAdd(x, y, direction))
             {
             {
@@ -965,10 +965,10 @@ namespace CommonAI.Zone.Instance
             return null;
             return null;
         }
         }
 
 
-        public InstanceItem AddItem(ItemTemplate template, string name, float x, float y, float direction, int force, string disPlayName, InstanceUnit creater,int from=0)
+        public InstanceItem AddItem(ItemTemplate template, string name, float x, float y, float direction, int force, string disPlayName, InstanceUnit creater, int from = 0)
         {
         {
             AddItemEvent add;
             AddItemEvent add;
-            return AddItem(template, name, x, y, direction, force, disPlayName, out add, creater,from);
+            return AddItem(template, name, x, y, direction, force, disPlayName, out add, creater, from);
         }
         }
 
 
 
 
@@ -997,12 +997,12 @@ namespace CommonAI.Zone.Instance
             float startX,
             float startX,
             float startY,
             float startY,
             float direction,
             float direction,
-            SpellChainLevelInfo chain = null, 
+            SpellChainLevelInfo chain = null,
             int actionIndex = -1,
             int actionIndex = -1,
             int maxAffectUnit = 0,
             int maxAffectUnit = 0,
-			Dictionary<uint, InstanceUnit> damageList = null,
-			int spellIndex = 0,
-			JSGCreateSpellData createData = null)
+            Dictionary<uint, InstanceUnit> damageList = null,
+            int spellIndex = 0,
+            JSGCreateSpellData createData = null)
         {
         {
             if (template != null && sender != null)
             if (template != null && sender != null)
             {
             {
@@ -1053,23 +1053,23 @@ namespace CommonAI.Zone.Instance
                 // 创建实体单位
                 // 创建实体单位
                 //InstanceSpell ret = new InstanceSpell(this, template, launch, launcher, sender, chainLevel);
                 //InstanceSpell ret = new InstanceSpell(this, template, launch, launcher, sender, chainLevel);
                 InstanceSpell ret = TemplateManager.Factory.CreateSpell(this, template, launch, launcher, sender, fromSkillType, damageList, spellIndex, createData);
                 InstanceSpell ret = TemplateManager.Factory.CreateSpell(this, template, launch, launcher, sender, fromSkillType, damageList, spellIndex, createData);
-				//ret.Direction = direction;
-				ret.BindActionIndex = actionIndex;
+                //ret.Direction = direction;
+                ret.BindActionIndex = actionIndex;
                 ret.MaxAffectUnit = (maxAffectUnit == 0) ? ret.Info.MaxAffectUnit : maxAffectUnit;
                 ret.MaxAffectUnit = (maxAffectUnit == 0) ? ret.Info.MaxAffectUnit : maxAffectUnit;
                 ret.faceTo(direction);
                 ret.faceTo(direction);
                 ret.setChainInfo(chain);
                 ret.setChainInfo(chain);
                 ret.setTargetPos(targetPos);
                 ret.setTargetPos(targetPos);
-                ret.setTarget(target);				
+                ret.setTarget(target);
 
 
-				// 存入单位列表
-				float xChanage, yChange;
-				launch.GetXModify(launcher, out xChanage, out yChange);
-				if (ret.tryAdd(startX + xChanage, startY + yChange, direction))
+                // 存入单位列表
+                float xChanage, yChange;
+                launch.GetXModify(launcher, out xChanage, out yChange);
+                if (ret.tryAdd(startX + xChanage, startY + yChange, direction))
                 {
                 {
-					//System.Console.WriteLine("--AddSpell: " + ret.Info.ID + ", " + ret.ID);
-					launcher.Virtual.DispatchSendSpellOverEvent(launch, template, ret.X, ret.Y);
+                    //System.Console.WriteLine("--AddSpell: " + ret.Info.ID + ", " + ret.ID);
+                    launcher.Virtual.DispatchSendSpellOverEvent(launch, template, ret.X, ret.Y);
 
 
-					mObjects.AddObject(ret);
+                    mObjects.AddObject(ret);
                     this.LastLaunchSpell = ret.Info;
                     this.LastLaunchSpell = ret.Info;
                     ret.onAdded(this);
                     ret.onAdded(this);
 
 
@@ -1102,11 +1102,11 @@ namespace CommonAI.Zone.Instance
                     if (mOnUnitRemoved != null)
                     if (mOnUnitRemoved != null)
                         mOnUnitRemoved.Invoke(this, unit);
                         mOnUnitRemoved.Invoke(this, unit);
                 }
                 }
-				else if(obj is InstanceItem)
-				{
-					if (this.mOnItemRemoved != null)
-						this.mOnItemRemoved.Invoke(this, (InstanceItem)obj);
-				}
+                else if (obj is InstanceItem)
+                {
+                    if (this.mOnItemRemoved != null)
+                        this.mOnItemRemoved.Invoke(this, (InstanceItem)obj);
+                }
 
 
 
 
                 if (obj.ClientVisible)
                 if (obj.ClientVisible)
@@ -1144,7 +1144,7 @@ namespace CommonAI.Zone.Instance
         public InstanceZoneObject RemoveSpellByLaunchIDAndSpellID(int launchId, int spellId)
         public InstanceZoneObject RemoveSpellByLaunchIDAndSpellID(int launchId, int spellId)
         {
         {
             InstanceSpell spell = mObjects.GetSpllByLanuchAndSpellId(launchId, spellId);
             InstanceSpell spell = mObjects.GetSpllByLanuchAndSpellId(launchId, spellId);
-            if(spell != null && RemoveObject(spell))
+            if (spell != null && RemoveObject(spell))
             {
             {
                 return spell;
                 return spell;
             }
             }
@@ -1153,10 +1153,10 @@ namespace CommonAI.Zone.Instance
 
 
 
 
         public InstanceZoneObject RemoveItemByID(uint unitTemplateId)
         public InstanceZoneObject RemoveItemByID(uint unitTemplateId)
-		{
-			InstanceItem obj = mObjects.GetItem(unitTemplateId);
-			if (obj != null && RemoveObject(obj))
-			{
+        {
+            InstanceItem obj = mObjects.GetItem(unitTemplateId);
+            if (obj != null && RemoveObject(obj))
+            {
                 Console.WriteLine("成功移除单位:" + unitTemplateId);
                 Console.WriteLine("成功移除单位:" + unitTemplateId);
                 return obj;
                 return obj;
             }
             }
@@ -1443,9 +1443,9 @@ namespace CommonAI.Zone.Instance
                 if (obj.mProcessDeadCallbackTime > 0)
                 if (obj.mProcessDeadCallbackTime > 0)
                 {
                 {
                     log.Warn("单位多次回调死亡逻辑:" + this.GetSceneID() + ", " + this.UUID + ", " + obj.Info.ID + ", attackID:" +
                     log.Warn("单位多次回调死亡逻辑:" + this.GetSceneID() + ", " + this.UUID + ", " + obj.Info.ID + ", attackID:" +
-                        (attacker == null ? -1 : attacker.Info.ID) + ", UUID" + (attacker == null ? "null" : attacker.PlayerUUID) + ", " + CommonLang.TimeUtil.GetTimestampMS());
+                        (attacker == null ? -1 : attacker.Info.ID) + ", UUID" + (attacker == null ? "null" : attacker.PlayerUUID) + ", " + obj.mProcessDeadCallbackTime);
                 }
                 }
-                obj.mProcessDeadCallbackTime = CommonLang.CUtils.localTimeMS + 1000;
+                obj.mProcessDeadCallbackTime = CommonLang.CUtils.localTimeMS + 60000;
                 obj.mDeadTime = CommonLang.CUtils.localTimeMS;
                 obj.mDeadTime = CommonLang.CUtils.localTimeMS;
 
 
                 statisticForceDead(obj);
                 statisticForceDead(obj);
@@ -1471,11 +1471,11 @@ namespace CommonAI.Zone.Instance
                     mOnUnitDead.Invoke(this, obj, attacker);
                     mOnUnitDead.Invoke(this, obj, attacker);
                 }
                 }
             }
             }
-            catch(Exception e)
+            catch (Exception e)
             {
             {
                 log.Error("cb_unitDeadCallBackcatch: " + this.GetSceneID() + ", " + (obj == null ? -1 : obj.Info.ID) + ", " + (attacker == null ? -1 : attacker.Info.ID)
                 log.Error("cb_unitDeadCallBackcatch: " + this.GetSceneID() + ", " + (obj == null ? -1 : obj.Info.ID) + ", " + (attacker == null ? -1 : attacker.Info.ID)
                     + ",UUID: " + (obj == null ? "null" : obj.PlayerUUID) + ", " + (attacker == null ? "null" : attacker.PlayerUUID) + ", e: " + e);
                     + ",UUID: " + (obj == null ? "null" : obj.PlayerUUID) + ", " + (attacker == null ? "null" : attacker.PlayerUUID) + ", e: " + e);
-            }           
+            }
         }
         }
 
 
         internal void cb_unitActivatedCallBack(InstanceUnit obj)
         internal void cb_unitActivatedCallBack(InstanceUnit obj)
@@ -1685,10 +1685,10 @@ namespace CommonAI.Zone.Instance
         /// <returns></returns>
         /// <returns></returns>
         public virtual bool IsAttackable(InstanceUnit src, InstanceUnit target, SkillTemplate.CastTarget expectTarget, AttackReason reason, ITemplateData weapon)
         public virtual bool IsAttackable(InstanceUnit src, InstanceUnit target, SkillTemplate.CastTarget expectTarget, AttackReason reason, ITemplateData weapon)
         {
         {
-			if(src == null || target == null)
-			{
-				return false;
-			}
+            if (src == null || target == null)
+            {
+                return false;
+            }
 
 
             if (!IsVisibleAOI(src, target))
             if (!IsVisibleAOI(src, target))
             {
             {
@@ -1909,7 +1909,7 @@ namespace CommonAI.Zone.Instance
             uint targetUnitID = 0,
             uint targetUnitID = 0,
             Vector2 targetPos = null, int actionIndex = -1, int maxAffectUnit = 0, float pointDir = 0)
             Vector2 targetPos = null, int actionIndex = -1, int maxAffectUnit = 0, float pointDir = 0)
         {
         {
-            if(launch == null)
+            if (launch == null)
             {
             {
                 log.Error("单位释放技能异常: " + launcher.Info.ID + ", " + new StackTrace().ToString());
                 log.Error("单位释放技能异常: " + launcher.Info.ID + ", " + new StackTrace().ToString());
                 return;
                 return;
@@ -1924,13 +1924,13 @@ namespace CommonAI.Zone.Instance
                     targetPos = (Vector2)targetPos.Clone();
                     targetPos = (Vector2)targetPos.Clone();
                 }
                 }
                 SpellTemplate spell = Templates.getSpell(launch.SpellID);
                 SpellTemplate spell = Templates.getSpell(launch.SpellID);
-				if(spell == null)
-				{
-					log.Error("unitLaunchSpell找不到法术模板:" + launcher.PlayerUUID + ", " + launch.SpellID + ", SN: " + launch.SerialNumber);
-					return;
-				}
-				JSGCreateSpellData createData;
-				if (spell != null && launch.Count > 0 && mFormula.TryLaunchSpell(launcher, launch, ref spell, out createData, ref startX, ref startY))
+                if (spell == null)
+                {
+                    log.Error("unitLaunchSpell找不到法术模板:" + launcher.PlayerUUID + ", " + launch.SpellID + ", SN: " + launch.SerialNumber);
+                    return;
+                }
+                JSGCreateSpellData createData;
+                if (spell != null && launch.Count > 0 && mFormula.TryLaunchSpell(launcher, launch, ref spell, out createData, ref startX, ref startY))
                 {
                 {
                     SpellChainLevelInfo chain = null;
                     SpellChainLevelInfo chain = null;
                     if (launch.ChainLevel > 0)
                     if (launch.ChainLevel > 0)
@@ -2023,23 +2023,23 @@ namespace CommonAI.Zone.Instance
                             break;
                             break;
                         case LaunchSpell.PosType.POS_TYPE_X:
                         case LaunchSpell.PosType.POS_TYPE_X:
                             {
                             {
-								float startAngle = direction + launch.StartAngle;
-								float[] interAngle = { launch.Angle, CMath.PI_F - launch.Angle, CMath.PI_F + launch.Angle, CMath.PI_F * 2 - launch.Angle };
-								Dictionary<uint, InstanceUnit> damageList = (spell.HitIntervalMS <= 0 ? new Dictionary<uint, InstanceUnit>() : null);
-
-								for (int i = 0; i < 4; i++)
-								{
-									AddSpell(fromSkillType, spell, launch, launcher, launcher, targetUnitID, targetPos, 
-										startX, startY, startAngle + interAngle[i], chain, actionIndex, maxAffectUnit, damageList);
-								}
-							}
-							break;
-						case LaunchSpell.PosType.POS_TYPE_RANDOM_DIRECTION:
+                                float startAngle = direction + launch.StartAngle;
+                                float[] interAngle = { launch.Angle, CMath.PI_F - launch.Angle, CMath.PI_F + launch.Angle, CMath.PI_F * 2 - launch.Angle };
+                                Dictionary<uint, InstanceUnit> damageList = (spell.HitIntervalMS <= 0 ? new Dictionary<uint, InstanceUnit>() : null);
+
+                                for (int i = 0; i < 4; i++)
+                                {
+                                    AddSpell(fromSkillType, spell, launch, launcher, launcher, targetUnitID, targetPos,
+                                        startX, startY, startAngle + interAngle[i], chain, actionIndex, maxAffectUnit, damageList);
+                                }
+                            }
+                            break;
+                        case LaunchSpell.PosType.POS_TYPE_RANDOM_DIRECTION:
                             {
                             {
                                 for (int i = 0; i < launch.Count; i++)
                                 for (int i = 0; i < launch.Count; i++)
                                 {
                                 {
                                     float d = (float)(random.NextDouble() * CMath.PI_MUL_2);
                                     float d = (float)(random.NextDouble() * CMath.PI_MUL_2);
-                                    AddSpell(fromSkillType, spell, launch, launcher, 
+                                    AddSpell(fromSkillType, spell, launch, launcher,
                                         launcher, targetUnitID, targetPos, startX,
                                         launcher, targetUnitID, targetPos, startX,
                                         startY, d, chain, actionIndex, maxAffectUnit);
                                         startY, d, chain, actionIndex, maxAffectUnit);
                                 }
                                 }
@@ -2082,7 +2082,7 @@ namespace CommonAI.Zone.Instance
 
 
         // 单位释放法术
         // 单位释放法术
         public void spellLaunchSpell(
         public void spellLaunchSpell(
-            XmdsSkillType fromSkillType, 
+            XmdsSkillType fromSkillType,
             InstanceSpell sender,
             InstanceSpell sender,
             LaunchSpell launch,
             LaunchSpell launch,
             float startX,
             float startX,
@@ -2127,7 +2127,7 @@ namespace CommonAI.Zone.Instance
                                 for (int i = 0; i < launch.Count; i++)
                                 for (int i = 0; i < launch.Count; i++)
                                 {
                                 {
                                     AddSpell(fromSkillType, spell, launch, sender, sender.Launcher,
                                     AddSpell(fromSkillType, spell, launch, sender, sender.Launcher,
-                                        targetUnitID, targetPos, startX, startY, 
+                                        targetUnitID, targetPos, startX, startY,
                                         startAngle + interAngle * i, chain, actionIndex, maxAffectUnit);
                                         startAngle + interAngle * i, chain, actionIndex, maxAffectUnit);
                                 }
                                 }
                             }
                             }
@@ -2138,26 +2138,26 @@ namespace CommonAI.Zone.Instance
                                 float interAngle = CMath.PI_MUL_2 / launch.Count;
                                 float interAngle = CMath.PI_MUL_2 / launch.Count;
                                 for (int i = 0; i < launch.Count; i++)
                                 for (int i = 0; i < launch.Count; i++)
                                 {
                                 {
-                                    AddSpell(fromSkillType, spell, launch, sender, sender.Launcher, 
-                                        targetUnitID, targetPos, startX, startY, 
+                                    AddSpell(fromSkillType, spell, launch, sender, sender.Launcher,
+                                        targetUnitID, targetPos, startX, startY,
                                         startAngle + interAngle * i, chain, actionIndex, maxAffectUnit);
                                         startAngle + interAngle * i, chain, actionIndex, maxAffectUnit);
                                 }
                                 }
                             }
                             }
                             break;
                             break;
-						case LaunchSpell.PosType.POS_TYPE_X:
-							{
-								float startAngle = direction + launch.StartAngle;
-								float[] interAngle = { launch.Angle, CMath.PI_F - launch.Angle, CMath.PI_F + launch.Angle, CMath.PI_F * 2 - launch.Angle };
-								Dictionary<uint, InstanceUnit> damageList = (spell.HitIntervalMS <= 0 ? new Dictionary<uint, InstanceUnit>() : null);
-
-								for (int i = 0; i < launch.Count; i++)
-								{
-									AddSpell(fromSkillType, spell, launch, sender, sender.Launcher, targetUnitID, 
-										targetPos, startX, startY, startAngle + interAngle[i], chain, actionIndex, maxAffectUnit, damageList);
-								}
-							}
-							break;
-						case LaunchSpell.PosType.POS_TYPE_RANDOM_FOR_SPELL:
+                        case LaunchSpell.PosType.POS_TYPE_X:
+                            {
+                                float startAngle = direction + launch.StartAngle;
+                                float[] interAngle = { launch.Angle, CMath.PI_F - launch.Angle, CMath.PI_F + launch.Angle, CMath.PI_F * 2 - launch.Angle };
+                                Dictionary<uint, InstanceUnit> damageList = (spell.HitIntervalMS <= 0 ? new Dictionary<uint, InstanceUnit>() : null);
+
+                                for (int i = 0; i < launch.Count; i++)
+                                {
+                                    AddSpell(fromSkillType, spell, launch, sender, sender.Launcher, targetUnitID,
+                                        targetPos, startX, startY, startAngle + interAngle[i], chain, actionIndex, maxAffectUnit, damageList);
+                                }
+                            }
+                            break;
+                        case LaunchSpell.PosType.POS_TYPE_RANDOM_FOR_SPELL:
                             launch_randomTypeSpell(fromSkillType, spell, sender, launch, chain, sender.Launcher, actionIndex);
                             launch_randomTypeSpell(fromSkillType, spell, sender, launch, chain, sender.Launcher, actionIndex);
                             break;
                             break;
                         case LaunchSpell.PosType.POS_TYPE_MANY_CANNON:
                         case LaunchSpell.PosType.POS_TYPE_MANY_CANNON:
@@ -2166,12 +2166,12 @@ namespace CommonAI.Zone.Instance
                         case LaunchSpell.PosType.POS_TYPE_RANDOM_POS:
                         case LaunchSpell.PosType.POS_TYPE_RANDOM_POS:
                             launch_randomPosSpell(fromSkillType, spell, sender, launch, chain, sender.Launcher, actionIndex);
                             launch_randomPosSpell(fromSkillType, spell, sender, launch, chain, sender.Launcher, actionIndex);
                             break;
                             break;
-						case LaunchSpell.PosType.POS_TYPE_RANDOM_DIRECTION:
+                        case LaunchSpell.PosType.POS_TYPE_RANDOM_DIRECTION:
                             {
                             {
                                 for (int i = 0; i < launch.Count; i++)
                                 for (int i = 0; i < launch.Count; i++)
                                 {
                                 {
                                     float d = (float)(random.NextDouble() * CMath.PI_MUL_2);
                                     float d = (float)(random.NextDouble() * CMath.PI_MUL_2);
-                                    AddSpell(fromSkillType, spell, launch, sender, sender.Launcher, 
+                                    AddSpell(fromSkillType, spell, launch, sender, sender.Launcher,
                                         targetUnitID, targetPos, startX, startY, d, chain, actionIndex, maxAffectUnit);
                                         targetUnitID, targetPos, startX, startY, d, chain, actionIndex, maxAffectUnit);
                                 }
                                 }
                             }
                             }
@@ -2182,7 +2182,7 @@ namespace CommonAI.Zone.Instance
                                 SeekSpellAttackable(enemy_list, startX, startY, sender.Launcher, spell, launch, chain);
                                 SeekSpellAttackable(enemy_list, startX, startY, sender.Launcher, spell, launch, chain);
                                 for (int i = 0; i < launch.Count && i < enemy_list.Count; i++)
                                 for (int i = 0; i < launch.Count && i < enemy_list.Count; i++)
                                 {
                                 {
-                                    AddSpell(fromSkillType, spell, launch, sender, sender.Launcher, 
+                                    AddSpell(fromSkillType, spell, launch, sender, sender.Launcher,
                                         enemy_list[i].ID, targetPos, startX, startY, direction, chain, actionIndex, maxAffectUnit);
                                         enemy_list[i].ID, targetPos, startX, startY, direction, chain, actionIndex, maxAffectUnit);
                                 }
                                 }
                             }
                             }
@@ -2190,7 +2190,7 @@ namespace CommonAI.Zone.Instance
                         case LaunchSpell.PosType.POS_TYPE_DEFAULT_SINGLE:
                         case LaunchSpell.PosType.POS_TYPE_DEFAULT_SINGLE:
                         default:
                         default:
                             {
                             {
-                                AddSpell(fromSkillType, spell, launch, sender, sender.Launcher, 
+                                AddSpell(fromSkillType, spell, launch, sender, sender.Launcher,
                                     targetUnitID, targetPos, startX, startY, direction, chain, actionIndex, maxAffectUnit);
                                     targetUnitID, targetPos, startX, startY, direction, chain, actionIndex, maxAffectUnit);
                             }
                             }
                             break;
                             break;
@@ -2235,9 +2235,9 @@ namespace CommonAI.Zone.Instance
                 float startY = damage.Y;
                 float startY = damage.Y;
 
 
                 SpellTemplate spell = Templates.getSpell(launch.SpellID);
                 SpellTemplate spell = Templates.getSpell(launch.SpellID);
-				JSGCreateSpellData createData;
-				if (spell != null && launch.Count > 0 && mFormula.TryLaunchSpell(attacker, launch, ref spell, out createData, ref startX, ref startY))
-                {                    
+                JSGCreateSpellData createData;
+                if (spell != null && launch.Count > 0 && mFormula.TryLaunchSpell(attacker, launch, ref spell, out createData, ref startX, ref startY))
+                {
                     SpellChainLevelInfo chain = null;
                     SpellChainLevelInfo chain = null;
                     if (source.FromSpellUnit != null && source.FromSpellUnit.ChainInfo != null)
                     if (source.FromSpellUnit != null && source.FromSpellUnit.ChainInfo != null)
                     {
                     {
@@ -2329,7 +2329,7 @@ namespace CommonAI.Zone.Instance
 
 
 
 
         private void launch_randomTypeSpell(XmdsSkillType fromSkillType, SpellTemplate spell, InstanceZoneObject sender,
         private void launch_randomTypeSpell(XmdsSkillType fromSkillType, SpellTemplate spell, InstanceZoneObject sender,
-            LaunchSpell launch, SpellChainLevelInfo chain, InstanceUnit attacker,  int serverExt = 0)
+            LaunchSpell launch, SpellChainLevelInfo chain, InstanceUnit attacker, int serverExt = 0)
         {
         {
             using (var list = ListObjectPool<InstanceUnit>.AllocAutoRelease())
             using (var list = ListObjectPool<InstanceUnit>.AllocAutoRelease())
             {
             {
@@ -2350,7 +2350,7 @@ namespace CommonAI.Zone.Instance
                     attacker.Y,
                     attacker.Y,
                     launch.SeekingTargetRange,
                     launch.SeekingTargetRange,
                     list, attacker.AoiStatus);
                     list, attacker.AoiStatus);
-                
+
                 int maxCount = launch.Count == 0 ? list.Count : Math.Min(launch.Count, list.Count);
                 int maxCount = launch.Count == 0 ? list.Count : Math.Min(launch.Count, list.Count);
                 for (int i = 0; i < maxCount; i++)
                 for (int i = 0; i < maxCount; i++)
                 {
                 {
@@ -2368,36 +2368,36 @@ namespace CommonAI.Zone.Instance
         private void launch_randomPosSpell(XmdsSkillType fromSkillType, SpellTemplate spell, InstanceZoneObject sender,
         private void launch_randomPosSpell(XmdsSkillType fromSkillType, SpellTemplate spell, InstanceZoneObject sender,
             LaunchSpell launch, SpellChainLevelInfo chain, InstanceUnit attacker, int serverExt = 0)
             LaunchSpell launch, SpellChainLevelInfo chain, InstanceUnit attacker, int serverExt = 0)
         {
         {
-			for (int i = 0; i < launch.Count; i++)
-			{
-				float x = (float)(random.NextDouble() * launch.SpellRange/2);
-				float y = (float)(random.NextDouble() * launch.SpellRange/2);
-				float d = (float)(random.NextDouble() * CMath.PI_MUL_2);
-				int randX = random.Next() % 2 == 0 ? 1 : -1;
-				int randY = random.Next() % 2 == 0 ? 1 : -1;
-				AddSpell(fromSkillType, spell, launch, sender, attacker, 0, null,
-					sender.X + x * randX, sender.Y + y * randY, d, chain, serverExt);
-			}
-		}
-
-		public InstanceSpell launch_ManyCannon(XmdsSkillType fromSkillType, SpellTemplate spell, InstanceZoneObject sender,
-			LaunchSpell launch, SpellChainLevelInfo chain, InstanceUnit attacker, uint targetUnitID, int serverExt, JSGCreateSpellData createData)
-		{
-			//float angleOffset = targetUnitID == 0 ? launch.StartAngle / 3 : launch.StartAngle;
-			float angleOffset = JSGModule.GetCurveStartAngleOffect(attacker, getUnit(targetUnitID), launch.StartAngle, spell.SeekingRange);
-			float startAngle = CMath.OpitimizeRadians(attacker.Direction) + angleOffset;
-			float launchX = attacker.X - (float)(1.0f * Math.Cos(attacker.Direction)); 
-			float launchY = attacker.Y - (float)(1.0f * Math.Sin(attacker.Direction));
-
-			Vector2 targetPos = JSGModule.GetCurveDefaultTargetPos(attacker, spell.SeekingRange);
-			//System.Console.WriteLine("targetPos: " + targetPos.X + ", " + targetPos.Y);
-
-			int totalCount = createData == null ? launch.Count : createData.mMaxSpellCount;
-			return AddSpell(fromSkillType, spell, launch, sender, attacker, targetUnitID, targetPos,
-					launchX, launchY, startAngle, chain, serverExt, 0, null, totalCount-1, createData);
-		}
-
-		public void spellSummonUnit(InstanceSpell summoner, SummonUnit summon)
+            for (int i = 0; i < launch.Count; i++)
+            {
+                float x = (float)(random.NextDouble() * launch.SpellRange / 2);
+                float y = (float)(random.NextDouble() * launch.SpellRange / 2);
+                float d = (float)(random.NextDouble() * CMath.PI_MUL_2);
+                int randX = random.Next() % 2 == 0 ? 1 : -1;
+                int randY = random.Next() % 2 == 0 ? 1 : -1;
+                AddSpell(fromSkillType, spell, launch, sender, attacker, 0, null,
+                    sender.X + x * randX, sender.Y + y * randY, d, chain, serverExt);
+            }
+        }
+
+        public InstanceSpell launch_ManyCannon(XmdsSkillType fromSkillType, SpellTemplate spell, InstanceZoneObject sender,
+            LaunchSpell launch, SpellChainLevelInfo chain, InstanceUnit attacker, uint targetUnitID, int serverExt, JSGCreateSpellData createData)
+        {
+            //float angleOffset = targetUnitID == 0 ? launch.StartAngle / 3 : launch.StartAngle;
+            float angleOffset = JSGModule.GetCurveStartAngleOffect(attacker, getUnit(targetUnitID), launch.StartAngle, spell.SeekingRange);
+            float startAngle = CMath.OpitimizeRadians(attacker.Direction) + angleOffset;
+            float launchX = attacker.X - (float)(1.0f * Math.Cos(attacker.Direction));
+            float launchY = attacker.Y - (float)(1.0f * Math.Sin(attacker.Direction));
+
+            Vector2 targetPos = JSGModule.GetCurveDefaultTargetPos(attacker, spell.SeekingRange);
+            //System.Console.WriteLine("targetPos: " + targetPos.X + ", " + targetPos.Y);
+
+            int totalCount = createData == null ? launch.Count : createData.mMaxSpellCount;
+            return AddSpell(fromSkillType, spell, launch, sender, attacker, targetUnitID, targetPos,
+                    launchX, launchY, startAngle, chain, serverExt, 0, null, totalCount - 1, createData);
+        }
+
+        public void spellSummonUnit(InstanceSpell summoner, SummonUnit summon)
         {
         {
             float x = summoner.X;
             float x = summoner.X;
             float y = summoner.Y;
             float y = summoner.Y;
@@ -2447,7 +2447,7 @@ namespace CommonAI.Zone.Instance
                     {
                     {
                         unit = AddUnit(info, name, summoner.Launcher.Force, summon.UnitLevel, dx, dy, dr, summoner.Launcher);
                         unit = AddUnit(info, name, summoner.Launcher.Force, summon.UnitLevel, dx, dy, dr, summoner.Launcher);
                     }
                     }
-                    
+
                     if (unit != null)
                     if (unit != null)
                     {
                     {
                         if (info.LifeTimeMS > 0)
                         if (info.LifeTimeMS > 0)
@@ -2696,10 +2696,10 @@ namespace CommonAI.Zone.Instance
 
 
         public InstanceFlag getFlag(string name)
         public InstanceFlag getFlag(string name)
         {
         {
-			if(string.IsNullOrEmpty(name))
-			{
-				return null;
-			}
+            if (string.IsNullOrEmpty(name))
+            {
+                return null;
+            }
             return mFlags.Get(name);
             return mFlags.Get(name);
         }
         }
 
 

+ 6 - 8
Common/CommonAI/ZoneServer/JSGModule/JSGServerProfile.cs

@@ -172,15 +172,13 @@ namespace CommonAI.ZoneServer.JSGModule
 			foreach (JSGTriggerProfile info in mZoneTriggers.Values)
 			foreach (JSGTriggerProfile info in mZoneTriggers.Values)
 			{
 			{
 				JSGPrintLog("##场景触发器总揽:" + info.areaId + ", 检测次数:" + info.total.checkTimes + ", 触发次数: " + info.total.triggerTimes + ", 耗时:" + info.total.timeUse);
 				JSGPrintLog("##场景触发器总揽:" + info.areaId + ", 检测次数:" + info.total.checkTimes + ", 触发次数: " + info.total.triggerTimes + ", 耗时:" + info.total.timeUse);
-				if (info.total.checkTimes < 5000 || info.total.timeUse < 1000)
+				if (info.total.checkTimes > 50000 || info.total.timeUse > 500)
 				{
 				{
-					continue;
-				}
-
-				foreach (KeyValuePair<string, TriggerData> kv in info.profileData)
-				{
-					JSGPrintLog("------场景触发器总揽:" + kv.Key + ", 检测次数:" + kv.Value.checkTimes + ", 触发次数: " + kv.Value.triggerTimes + ", 耗时:" + kv.Value.timeUse);
-				}
+					foreach (KeyValuePair<string, TriggerData> kv in info.profileData)
+					{
+						JSGPrintLog("------场景触发器总揽:" + kv.Key + ", 检测次数:" + kv.Value.checkTimes + ", 触发次数: " + kv.Value.triggerTimes + ", 耗时:" + kv.Value.timeUse);
+					}
+				}			
 			}
 			}
 
 
 			JSGPrintLog(" ---------------------------------------------------- ");
 			JSGPrintLog(" ---------------------------------------------------- ");

+ 2 - 2
Common/Pomelo/PomeloShare/ZoneManagerI.cs

@@ -67,7 +67,7 @@ namespace Pomelo
                    {
                    {
                        cb__.ice_response();
                        cb__.ice_response();
                    }
                    }
-                   log.Debug("destroyZone end:" + System.Threading.Thread.CurrentThread.ManagedThreadId);
+                   //log.Debug("destroyZone end:" + System.Threading.Thread.CurrentThread.ManagedThreadId);
 
 
                });
                });
             } catch (System.Exception e)
             } catch (System.Exception e)
@@ -118,7 +118,7 @@ namespace Pomelo
                     {
                     {
                         cb__.ice_response();
                         cb__.ice_response();
                     }
                     }
-                    log.Debug("playerLeave end:" + System.Threading.Thread.CurrentThread.ManagedThreadId);
+                    //log.Debug("playerLeave end:" + System.Threading.Thread.CurrentThread.ManagedThreadId);
                 });
                 });
             } catch (System.Exception e)
             } catch (System.Exception e)
             {
             {

+ 1 - 1
XmdsCommonServer/Plugin/XmdsVirtual/XmdsVirtual.cs

@@ -39,7 +39,7 @@ namespace XmdsCommonServer.Plugin
         public static int AllocCount { get { return s_alloc_object_count.Value; } }
         public static int AllocCount { get { return s_alloc_object_count.Value; } }
         #region Log.
         #region Log.
 
 
-        public static Logger log = LoggerFactory.GetDefLogger();
+        public static Logger log = LoggerFactory.GetLogger("XVirtual");
         public static void FormatLog(string txt, params object[] args)
         public static void FormatLog(string txt, params object[] args)
         {
         {
             //if (args != null) { log.Debug(string.Format(txt, args)); }
             //if (args != null) { log.Debug(string.Format(txt, args)); }

+ 2 - 2
XmdsCommonServer/Plugin/XmdsVirtual/XmdsVirtual_Monster.cs

@@ -823,8 +823,8 @@ namespace XmdsCommonServer.Plugin
 			}
 			}
 			else if(this.IsBoss() || ret.MaxHP > 500000 || ret.MaxAttack > 10000)
 			else if(this.IsBoss() || ret.MaxHP > 500000 || ret.MaxAttack > 10000)
 			{
 			{
-				log.Debug("怪属性打印-场景:" + this.mUnit.Parent.GetSceneID() + ", ID: " + templateID + ", " + this.mUnit.Parent.UUID + ", UID: " + this.mUnit.ID + ", 等级: " + lvl_monster 
-					+ ", 战斗规模:" + ma.Fight_Type + ",(攻-" +	ret.BaseAttack + ", 防-" + ret.BaseDefence + ", 血-" + ret.BaseMaxHP + ", 爆-" + ret.CritRate
+				log.Debug("怪属性:" + this.mUnit.Parent.GetSceneID() + ", ID: " + templateID + ", " + this.mUnit.Parent.UUID + ", UID: " + this.mUnit.ID + ", 等级: " + lvl_monster 
+					+ ", FT:" + ma.Fight_Type + ",(攻-" +	ret.BaseAttack + ", 防-" + ret.BaseDefence + ", 血-" + ret.BaseMaxHP + ", 爆-" + ret.CritRate
 					+ ", 爆伤-" + ret.CritDamage + ", 穿透-" + ret.IgnoreDefensePer + ")");
 					+ ", 爆伤-" + ret.CritDamage + ", 穿透-" + ret.IgnoreDefensePer + ")");
 			}
 			}
         }
         }