Эх сурвалжийг харах

1.优化服务器文件名;2.屏蔽2个战斗服协议

johnclot69 8 сар өмнө
parent
commit
9ddd1e039e

+ 6 - 2
DotNet/Hotfix/Helper/MapHelper.cs

@@ -99,6 +99,10 @@ namespace ET.Server
             {
                 map = player.DomainScene().GetComponent<GameMapComponent>().Get(player.Map.Id);
             }
+            else
+            {
+                map = player.DomainScene().GetComponent<GameMapComponent>().GetByMapId(10099);
+            }
 
             // 老场景
             if (map != null)
@@ -159,14 +163,14 @@ namespace ET.Server
 
             Log.Info($"createArea instanceId:{instanceId}, templateId:{prop.TemplateID}, bs:{player.GetZoneManager()}");
 
-            int resCode = player.GetZoneManager().createZoneRequest(player.GetId().ToString(), "bs-" + ConstGame.GameServerId,
+            int resCode = player.GetZoneManager().createZoneRequest(player.GetId().ToString(), "bs-" + GameConst.GameServerId,
                 prop.TemplateID, instanceId.ToString(), forceCreate, enterData);
 
             if (resCode == 0)
             {
                 jsonObject.Add("instanceId", instanceId);
                 jsonObject.Add("areaId", mapId);
-                return CreatLocalMap(player, prop, jsonObject, instanceId, mapId, "bs-" + ConstGame.GameServerId);
+                return CreatLocalMap(player, prop, jsonObject, instanceId, mapId, "bs-" + GameConst.GameServerId);
             }
 
             Log.Warning($"createZoneRequest resCode={resCode}, mapID={prop.Id}, playerId={player.GetId()}");

+ 2 - 2
DotNet/Hotfix/Helper/SceneFactory.cs

@@ -33,8 +33,8 @@ namespace ET.Server
                     scene.AddComponent<UserSessionComponent>();
                     break;
                 case SceneType.Game:
-                    ConstGame.GameServerId = startSceneConfig.Id;
-                    ConstGame.GameServerUUID = System.Guid.NewGuid().ToString();
+                    GameConst.GameServerId = startSceneConfig.Id;
+                    GameConst.GameServerUUID = System.Guid.NewGuid().ToString();
 
                     scene.AddComponent<NetServerComponent, IPEndPoint, NetworkProtocol>(startSceneConfig.InnerIPOutPort, NetworkProtocol.KCP);
                     scene.AddComponent<GameTokenInfoComponent>();

+ 2 - 2
DotNet/Hotfix/Helper/SkillHelper.cs

@@ -15,9 +15,9 @@
         /// </summary>
         /// <param name="baseSkill"></param>
         /// <returns></returns>
-        public static Struct.SkillInfo NewSkillInfo(Struct.PlayerSkillBaseData baseSkill)
+        public static GameStruct.SkillInfo NewSkillInfo(GameStruct.PlayerSkillBaseData baseSkill)
         {
-            Struct.SkillInfo data = new ();
+            GameStruct.SkillInfo data = new ();
 
             SkillConfig prop = SkillConfigCategory.Instance.Get(baseSkill.id);
             data.type = prop.SkillType;

+ 1 - 1
DotNet/Hotfix/Module/FastStream/FastStreamComponentSystem.cs

@@ -54,7 +54,7 @@ namespace ET.Server
         private static void OnSessionConnected(object sender, EventArgs e)
         {
             Log.Debug("fast stream session connected");
-            FastStreamComponent.Instance.SendData("connetorId", ("bs-" + ConstGame.GameServerId.ToString()).ToUtf8());
+            FastStreamComponent.Instance.SendData("connetorId", ("bs-" + GameConst.GameServerId.ToString()).ToUtf8());
         }
 
         private static void OnSessionDataReceived(FastStreamBuffer pack)

+ 3 - 3
DotNet/Hotfix/Module/IceBattle/BattleIceAgentComponentSystem.cs

@@ -53,14 +53,14 @@ namespace ET.Server
                     ZoneIce.ice_invocationTimeout(15000);
 
                     ObjectAdapter adapter = communicator().createObjectAdapter("");
-                    ObjectPrx prx = adapter.add(new ZoneManagerCallback(), communicator().stringToIdentity("bs-" + ConstGame.GameServerId));
+                    ObjectPrx prx = adapter.add(new ZoneManagerCallback(), communicator().stringToIdentity("bs-" + GameConst.GameServerId));
                     ZoneIce.ice_getCachedConnection().setAdapter(adapter);
                     //-3: 未知异常
                     //-2: 异常参数;
                     //-1: 已有在线的,拒绝;
                     //0	: 加入成功
                     //1 : 加入成功,重连
-                    int code = ZoneIce.setCallback(prx.ice_getIdentity(), ConstGame.GameServerUUID);
+                    int code = ZoneIce.setCallback(prx.ice_getIdentity(), GameConst.GameServerUUID);
                     if (code < 0)
                     {
                         Log.Error($"战斗服连接异常: {code}");
@@ -68,7 +68,7 @@ namespace ET.Server
                     }
 
                     //向战斗服注册本GameServer
-                    string res = ZoneIce.registerGameServer(ConstGame.GameServerId, ConstGame.GameServerId);
+                    string res = ZoneIce.registerGameServer(GameConst.GameServerId, GameConst.GameServerId);
                     BattleIceAgentComponent.Instance.StrBattleServerVersion = res;
                     Log.Info($"Battle Server version:  {res}");
                 }

+ 5 - 0
DotNet/Hotfix/Scenes/Game/GameMapComponentSystem.cs

@@ -40,6 +40,11 @@ namespace ET.Server
             return map;
         }
 
+        public static Map GetByMapId(this GameMapComponent self, long mapId)
+        {
+            return self.allMaps.Values.FirstOrDefault(map => map != null && map.Id == mapId);
+        }
+
         public static void Remove(this GameMapComponent self, long instanceId)
         {
             self.allMaps.Remove(instanceId);

+ 1 - 1
DotNet/Hotfix/Scenes/Game/Handler/C2G_BattleNotifyHandler.cs

@@ -32,7 +32,7 @@ namespace ET.Server
             }
 
             // 通知战斗服
-            player.GetXmdsManager().notifyBattleServer(player.Map.Id.ToString(), NotifyBSName.TriggerEvent, JsonSerializer.Serialize(new Struct.TriggerEventNotify() { message = request.Message }));
+            player.GetXmdsManager().notifyBattleServer(player.Map.Id.ToString(), NotifyBSName.TriggerEvent, JsonSerializer.Serialize(new GameStruct.TriggerEventNotify() { message = request.Message }));
 
             reply();
             await ETTask.CompletedTask;

+ 1 - 1
DotNet/Hotfix/Scenes/Game/Handler/C2G_EnterMapHandler.cs

@@ -53,7 +53,7 @@ namespace ET.Server
 
             map.PlayerEnterRequest(player);
             map.OnPlayerEntered(player);
-            player.OnEndEnterScene();
+            // player.OnEndEnterScene();
 
             response.MapInstanceId = player.Map.Id;
             reply();

+ 6 - 6
DotNet/Hotfix/Scenes/Game/Map/MapSystem.cs

@@ -23,7 +23,7 @@ namespace ET.Server
                 self.Prop = MapConfigCategory.Instance.Get(self.MapId);
                 self.Type = self.Prop.Type;
                 self.HasPlayerEntered = false;
-                self.Actors = new Dictionary<long, Struct.Actor>();
+                self.Actors = new Dictionary<long, GameStruct.Actor>();
                 self.DeadUnits = new List<int>();
                 self.DeadUnitPlayer = new List<int>();
                 self.IsLeaveKeepObject = false;
@@ -104,7 +104,7 @@ namespace ET.Server
             if (!self.Actors.ContainsKey(player.GetId()))
             {
                 self.HasPlayerEntered = true;
-                self.Actors.Add(player.GetId(), new Struct.Actor());
+                self.Actors.Add(player.GetId(), new GameStruct.Actor());
             }
         }
 
@@ -190,7 +190,7 @@ namespace ET.Server
         /// <param name="data"></param>
         /// <param name="needReturn"></param>
         /// <returns></returns>
-        private static async ETTask<int> AddUnits(this Map self, List<Struct.MonsterUnit> data, bool needReturn)
+        private static async ETTask<int> AddUnits(this Map self, List<GameStruct.MonsterUnit> data, bool needReturn)
         {
             if (data.Count <= 0)
             {
@@ -212,9 +212,9 @@ namespace ET.Server
             return addUnitsResult;
         }
 
-        private static async ETTask<int> AddUnits(this Map self, Struct.MonsterUnit data, bool needReturn)
+        private static async ETTask<int> AddUnits(this Map self, GameStruct.MonsterUnit data, bool needReturn)
         {
-            List<Struct.MonsterUnit> listData = new List<Struct.MonsterUnit>();
+            List<GameStruct.MonsterUnit> listData = new List<GameStruct.MonsterUnit>();
             listData.Add(data);
             return await self.AddUnits(listData, needReturn);
         }
@@ -237,7 +237,7 @@ namespace ET.Server
         /// <param name="player"></param>
         public static void PlayerEnterRequest(this Map self, WNPlayer player)
         {
-            self.Actors.TryGetValue(player.GetId(), out Struct.Actor actor);
+            self.Actors.TryGetValue(player.GetId(), out GameStruct.Actor actor);
             if (actor.Ready)
             {
                 Log.Info($"PlayerEnterRequest: playerId={player.GetId()}, ready={actor.Ready}");

+ 9 - 9
DotNet/Hotfix/Scenes/Game/Player/PlayerSkillComponentSystem.cs

@@ -14,14 +14,14 @@ namespace ET.Server
                 WNPlayer player = self.GetParent<WNPlayer>();
 
                 self.Data = new PlayerSkillInfo();
-                self.Data.Skills = new List<Struct.PlayerSkillBaseData>();
+                self.Data.Skills = new List<GameStruct.PlayerSkillBaseData>();
                 // 初始化技能数据
                 CharacterConfig config = CharacterConfigCategory.Instance.Get(player.GetPro());
                 if (config != null && config.InitSkillList.Count > 0)
                 {
-                    foreach (Struct.IntIntData intIntData in config.InitSkillList.Where(intIntData => intIntData != null))
+                    foreach (GameStruct.IntIntData intIntData in config.InitSkillList.Where(intIntData => intIntData != null))
                     {
-                        self.Data.Skills.Add(new Struct.PlayerSkillBaseData(intIntData.value1, intIntData.value2, true, 0L));
+                        self.Data.Skills.Add(new GameStruct.PlayerSkillBaseData(intIntData.value1, intIntData.value2, true, 0L));
                     }
                 }
                 // 初始化战斗服缓存数据
@@ -41,9 +41,9 @@ namespace ET.Server
         /// </summary>
         /// <param name="self"></param>
         /// <returns></returns>
-        private static IEnumerable<Struct.SkillInfo> GetPassiveSkillInfoBS(this PlayerSkillComponent self)
+        private static IEnumerable<GameStruct.SkillInfo> GetPassiveSkillInfoBS(this PlayerSkillComponent self)
         {
-            List<Struct.SkillInfo> list = new List<Struct.SkillInfo>();
+            List<GameStruct.SkillInfo> list = new List<GameStruct.SkillInfo>();
 
             foreach (SkillConfig prop in SkillConfigCategory.Instance.GetAll().Values.Where(prop => prop != null))
             {
@@ -52,7 +52,7 @@ namespace ET.Server
                     continue;
                 }
 
-                Struct.SkillInfo info = new ();
+                GameStruct.SkillInfo info = new ();
                 info.type = prop.SkillType;
                 info.id = prop.Id;
                 info.level = 1;
@@ -72,10 +72,10 @@ namespace ET.Server
         /// </summary>
         /// <param name="self"></param>
         /// <returns></returns>
-        public static List<Struct.SkillInfo> GetBattleServerSkills(this PlayerSkillComponent self)
+        public static List<GameStruct.SkillInfo> GetBattleServerSkills(this PlayerSkillComponent self)
         {
-            List<Struct.SkillInfo> skills = new List<Struct.SkillInfo>();
-            foreach (Struct.PlayerSkillBaseData skill in self.Data.Skills.Where(skill => skill != null))
+            List<GameStruct.SkillInfo> skills = new List<GameStruct.SkillInfo>();
+            foreach (GameStruct.PlayerSkillBaseData skill in self.Data.Skills.Where(skill => skill != null))
             {
                 if (!skill.unlock)
                 {

+ 7 - 7
DotNet/Hotfix/Scenes/Game/Player/PlayerSystem.cs

@@ -176,7 +176,7 @@ namespace ET.Server
         /** 客户端资源加载完成通知 给客户端推送的数据要在这里 **/
         public static void OnReady(this WNPlayer self)
         {
-            // self.OnEndEnterScene();
+            self.OnEndEnterScene();
 
             // 登录第一次进场景处理,此次登陆登出期间只处理一次
             if (self.ReadyFirst)
@@ -206,7 +206,7 @@ namespace ET.Server
         {
             self.GetXmdsManager().playerReady(self.GetId().ToString());
 
-            self.Map.Actors.TryGetValue(self.GetId(), out Struct.Actor actor);
+            self.Map.Actors.TryGetValue(self.GetId(), out GameStruct.Actor actor);
             if (actor != null)
             {
                 if (actor.Ready)
@@ -221,9 +221,9 @@ namespace ET.Server
             // todo 弹幕游戏的设置, 后面会调整
 
             //PKMode设置为All
-            self.GetXmdsManager().refreshPlayerPKMode(self.GetId().ToString(), false, (int)PkModel.All);
+            // self.GetXmdsManager().refreshPlayerPKMode(self.GetId().ToString(), false, (int)PkModel.All);
             //设置为自动战斗
-            self.GetXmdsManager().autoBattle(self.Id.ToString(), self.GetId().ToString(), true);
+            // self.GetXmdsManager().autoBattle(self.Id.ToString(), self.GetId().ToString(), true);
 
             Log.Info($"OnEndEnterScene : mapId={self.Map.MapId}, map={self.Map.Prop.Name}");
         }
@@ -240,14 +240,14 @@ namespace ET.Server
             data.Add("alliesForce", 0);
             data.Add("force", 1);
             data.Add("pro", self.GetPro());
-            data.Add("serverId", ConstGame.GameServerId);
+            data.Add("serverId", GameConst.GameServerId);
             data.Add("titleId", 0);
             data.Add("level", self.GetLevel());
             data.Add("vip", 0);
             data.Add("upLevel", 1);
             // 无悬赏
             data.Add("beReward", 0);
-            data.Add("logicServerId", ConstGame.GameServerId);
+            data.Add("logicServerId", GameConst.GameServerId);
             data.Add("sex", self.GetSex());
             data.Add("uuid", self.GetId().ToString());
             data.Add("potionAddition", 0);
@@ -272,7 +272,7 @@ namespace ET.Server
                 playerEntered = map.HasPlayerEntered,
                 avatars = new { },
                 basic = self.GetBattlerServerBasic(),
-                connectServerId = "bs-" + ConstGame.GameServerId,
+                connectServerId = "bs-" + GameConst.GameServerId,
                 uid = self.GetId().ToString(),
                 unitTemplateID = self.BasicProp.TemplateId,
                 robot = false,

+ 1 - 1
DotNet/Hotfix/Scenes/Game/Session/SessionPlayerComponentSystem.cs

@@ -37,7 +37,7 @@ namespace ET.Server
                     try
                     {
                         // 玩家离开
-                        if (map.Actors.TryGetValue(player.GetId(), out Struct.Actor actor))
+                        if (map.Actors.TryGetValue(player.GetId(), out GameStruct.Actor actor))
                         {
                             actor.Ready = false;
                         }

+ 2 - 2
DotNet/Model/Generate/ConfigPartial/CharacterConfig.cs

@@ -8,7 +8,7 @@ namespace ET
     public partial class CharacterConfig
     {
         /** 初始化技能列表 **/
-        public List<Struct.IntIntData> InitSkillList = new List<Struct.IntIntData>();
+        public List<GameStruct.IntIntData> InitSkillList = new List<GameStruct.IntIntData>();
         /** 初始移速 **/
         public float _InitSpeed = 5F;
 
@@ -38,7 +38,7 @@ namespace ET
                 string[] strs = sss.Split(":");
                 if (strs.Length == 2)
                 {
-                    this.InitSkillList.Add(new Struct.IntIntData(int.Parse(strs[0]), int.Parse(strs[1])));
+                    this.InitSkillList.Add(new GameStruct.IntIntData(int.Parse(strs[0]), int.Parse(strs[1])));
                 }
             }
 

+ 1 - 1
DotNet/Model/Scenes/Game/DBEntity/PlayerSkillInfo.cs

@@ -8,6 +8,6 @@ namespace ET.Server
     public class PlayerSkillInfo: Entity, IAwake
     {
         /** 技能数据 key:skillId, value:数据结构 **/
-        public List<Struct.PlayerSkillBaseData> Skills { get; set; }
+        public List<GameStruct.PlayerSkillBaseData> Skills { get; set; }
     }
 }

+ 1 - 1
DotNet/Model/Scenes/Game/Map/Map.cs

@@ -25,7 +25,7 @@ namespace ET.Server
         /** 地图场景创建时间 **/
         public long CreateTime { get; set; }
         /** 场景里的单位玩家 [key:openId, value:单位玩家数据] **/
-        public Dictionary<long, Struct.Actor> Actors { get; set; }
+        public Dictionary<long, GameStruct.Actor> Actors { get; set; }
         /** 死亡的单位 **/
         public List<int> DeadUnits { get; set; }
         /** 死亡的单位玩家 **/

+ 1 - 1
DotNet/Model/Scenes/Game/Player/PlayerSkillComponent.cs

@@ -9,6 +9,6 @@ namespace ET.Server
         public PlayerSkillInfo Data { get; set; }
 
         /** 战斗服技能数据 **/
-        public List<Struct.SkillInfo> ToJson4BattleServerSkills { get; set; }
+        public List<GameStruct.SkillInfo> ToJson4BattleServerSkills { get; set; }
     }
 }

+ 0 - 15
DotNet/Model/Share/ConstGame.cs

@@ -1,15 +0,0 @@
-using System;
-using System.Reflection;
-
-namespace ET.Server
-{
-    public static class ConstGame
-    {
-        [StaticField]
-        public static int GameServerId;
-
-        [StaticField]
-        public static string GameServerUUID = System.Guid.NewGuid().ToString();
-    }
-
-}

+ 12 - 0
DotNet/Model/Const/ConstGame.cs → DotNet/Model/Share/GameConst.cs

@@ -4,6 +4,18 @@ using System.ComponentModel.DataAnnotations;
 
 namespace ET.Server
 {
+    /// <summary>
+    /// 游戏服静态常量
+    /// </summary>
+    public static class GameConst
+    {
+        [StaticField]
+        public static int GameServerId;
+
+        [StaticField]
+        public static string GameServerUUID = System.Guid.NewGuid().ToString();
+    }
+
     public static class PLAYER
     {
         public const int initLevel = 1;

+ 1 - 1
DotNet/Model/Const/Struct.cs → DotNet/Model/Share/GameStruct.cs

@@ -3,7 +3,7 @@
     /// <summary>
     /// 游戏服数据结构
     /// </summary>
-    public class Struct
+    public static class GameStruct
     {
         /// <summary>
         /// 数据结构 int_int