public ScenePin(Variant gc) { _id = gc.GetStringOrDefault("_id"); _autoPath = (gc.GetStringOrDefault("SubType") == "4"); Variant v = gc.GetVariantOrDefault("Value"); if (v != null) { _sceneA = v.GetStringOrDefault("SceneID"); _x = v.GetIntOrDefault("X"); _y = v.GetIntOrDefault("Y"); m_destination = new Destination( v.GetStringOrDefault("SceneB"), v.GetIntOrDefault("BX"), v.GetIntOrDefault("BY") ); const int s = 4; m_range = new Rectangle(_x - s, _y - s, 2 * s, 2 * s); } }
/// <summary> /// 回城 /// </summary> /// <param name="player"></param> /// <param name="tType">回城方式</param> public bool TownGate(PlayerBusiness player, TransmitType tType) { if (player.Scene != this) { return false; } Destination desc = null; if (tType == TransmitType.UseProp) { //不能使用道具回城 desc = PropDestination; if (desc == null) { return false; } } else if (tType == TransmitType.Dead) { desc = DeadDestination; if (desc != null) { player.SetActionState(ActionState.Standing); } } else if (tType == TransmitType.OverTime) { string sceneid = player.Ectype.Value.GetStringOrDefault("SceneID"); if (!string.IsNullOrEmpty(sceneid)) { int x = player.Ectype.Value.GetIntOrDefault("X"); int y = player.Ectype.Value.GetIntOrDefault("Y"); desc = new Destination(sceneid, x, y); } if (desc != null) { player.SetActionState(ActionState.Standing); } } if (desc == null) { return false; } SceneBusiness inScene; ScenesProxy.TryGetScene(desc.SceneID, out inScene); //场景转移检查,除了死亡和超时.其它情况进行场景检查 if (!(tType == TransmitType.Dead || tType == TransmitType.OverTime)) { if ((!TransferCheck(player, inScene, tType))) { return false; } } object[] point = new object[] { desc.X, desc.Y }; if (ExitScene(player)) { //执行进入 inScene.Execute(new UserNote(player, ClientCommand.IntoSceneSuccess, point)); } if (player.TeamJob == TeamJob.Captain) { PlayerTeam team = player.Team; if (team != null) { for (int i = 1; i < team.Members.Length; i++) { PlayerBusiness member = team.Members[i]; if (member != null && member.TeamJob == TeamJob.Member) { if (ExitScene(member)) { //执行进入 inScene.Execute(new UserNote(member, ClientCommand.IntoSceneSuccess, point)); } } } } } return true; }
public SceneBusiness(GameConfig scene) { m_players = new ConcurrentDictionary<string, PlayerBusiness>(); m_walk = new List<Point>(256); m_map = new Dictionary<Point, int>(256); m_id = scene.ID; m_name = scene.Name; Variant v = (scene.Value == null ? null : scene.Value.GetVariantOrDefault("Config")); if (v != null) { m_fightInterval = v.GetIntOrDefault("TimeLimit"); if (v.GetBooleanOrDefault("canFight")) { m_fightType = FightType.PK; } else { m_fightType = FightType.NotPK; } m_minLev = v.GetIntOrDefault("MinLevel"); m_maxLev = v.GetIntOrDefault("MaxLevel"); IntoLimit limit = new IntoLimit(m_id, m_name, v); if (!limit.IsEmpty) { m_intoLimit = limit; } //初始化降生点道具回城和死亡回城点 Variant bornPoint = v.GetVariantOrDefault("BornPoint"); if (bornPoint != null) { m_bornX = bornPoint.GetIntOrDefault("X"); m_bornY = bornPoint.GetIntOrDefault("Y"); } m_propDest = InitDestination(v.GetVariantOrDefault("BackPoint")); m_deadDest = InitDestination(v.GetVariantOrDefault("DeadPoint")); m_skin = v.GetStringOrDefault("ReUseSceneID"); } }
protected SceneBusiness(SceneBusiness scene) { m_players = new ConcurrentDictionary<string, PlayerBusiness>(); m_walk = scene.m_walk; m_map = scene.m_map; m_id = scene.m_id; m_name = scene.m_name; m_skin = scene.m_skin; m_fightInterval = scene.m_fightInterval; m_fightType = scene.m_fightType; m_intoLimit = scene.m_intoLimit; m_bornX = scene.m_bornX; m_bornY = scene.m_bornY; m_propDest = scene.m_propDest; m_deadDest = scene.m_deadDest; m_showAll = scene.m_showAll; m_fightType = scene.m_fightType; }