public void Init() { // 初始化副本 var dInfo = new DirectoryInfo(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "MapData")); foreach (var filePath in dInfo.GetFiles()) { var dungeon = new CDungeon(int.Parse(filePath.Name)); DicDungeon.Add(int.Parse(filePath.Name), dungeon); foreach (var pos in dungeon.MapData.monsterPos) { SDungeon.Instance.EnterDungeon(new EMonster { Id = EEntity.GenerateEntityId(EEntityType.MONSTER), AIState = AI.EAIState.PATROL, Dungeon = dungeon, EntityType = EEntityType.MONSTER, Position = new CPosition <double> { x = pos[0], y = pos[1], z = 0D }, BirthPosition = new CPosition <double> { x = pos[0], y = pos[1], z = 0D }, Movement = new CMovement { Speed = 5 } }, dungeon); } } }
public void LoginIn(Guid guid, C2SLogin pack) { var role = new ERole(); role.Id = EEntity.GenerateEntityId(EEntityType.ROLE); Program.Server.DicEventArgs.TryGetValue(guid, out role.exSocket); GameServer.DicRole.Add(guid, role); SDungeon.Instance.EnterDungeon(role); role.Update(); TServer.Program.Server.StartSend(role.exSocket.SocketEventArgs, new S2CLogin { Res = 1, RoleInfo = new RoleInfo { Id = role.Id, X = role.Position.x, Y = role.Position.y } }); log.Debug($"Guid:{guid} --- {pack.Name} login in, password is {pack.Password}."); }