/// <summary> /// Create a sample /// </summary> protected BattleMap() : base() { MapSize = new Point(10, 10); TileSize = new Point(32, 32); ShowLayerIndex = -1; IsFrozen = false; OnlinePlayers = new OnlineConfiguration(); GameTurn = 0; MapOverlay = new DayNightCycleColorOnly(); ListTileSet = new List <Texture2D>(); ListBackground = new List <AnimationBackground>(); ListBackgroundsPath = new List <string>(); ListForeground = new List <AnimationBackground>(); ListForegroundsPath = new List <string>(); ListMAPAttackTarget = new Stack <Tuple <int, int> >(); Description = ""; VictoryCondition = ""; LossCondition = ""; SkillPoint = ""; sndBattleThemeName = ""; DicMapVariables = new Dictionary <string, double>(); MovementAnimation = new MovementAnimations(); ListMapScript = new List <MapScript>(); ListMapEvent = new List <MapEvent>(); DicCutsceneScript = new Dictionary <string, CutsceneScript>(); DicInteractiveProp = new Dictionary <string, InteractiveProp>(); DicRequirement = new Dictionary <string, BaseSkillRequirement>(); DicEffect = new Dictionary <string, BaseEffect>(); DicAutomaticSkillTarget = new Dictionary <string, AutomaticSkillTargetType>(); DicManualSkillTarget = new Dictionary <string, ManualSkillTarget>(); ListSubMap = new List <BattleMap>(); DicSpawnSquadByPlayer = new Dictionary <string, List <Squad> >(); ListMultiplayerColor = new List <Color>(); GlobalBattleContext = new BattleContext(); GlobalQuickLoadContext = new UnitQuickLoadEffectContext(); #region Screen shaking ShakeCounter = 0; ShakeRadiusMax = 3; ShakeOffsetX = 0; ShakeOffsetY = 0; ShakeAngle = RandomHelper.Next(360); ShakeAngleVariation = new Vector2(1, 0); #endregion }
/// <summary> /// Create a sample /// </summary> protected BattleMap() : base() { RequireFocus = true; MapSize = new Point(10, 10); TileSize = new Point(32, 32); ActiveLayerIndex = 0; ShowAllLayers = true; IsFrozen = false; OnlinePlayers = new OnlineConfiguration(); GameTurn = 0; ListTileSet = new List <Texture2D>(); ListBackgrounds = new List <AnimationBackground>(); ListBackgroundsPath = new List <string>(); ListForegrounds = new List <AnimationBackground>(); ListForegroundsPath = new List <string>(); ListActionMenuChoice = new ActionPanelHolder(); ListMAPAttackTarget = new Stack <Tuple <int, int> >(); VictoryCondition = ""; LossCondition = ""; SkillPoint = ""; sndBattleThemeName = ""; DicMapVariables = new Dictionary <string, double>(); MovementAnimation = new MovementAnimations(); AttackPicker = new AttacksMenu(); ListMapScript = new List <MapScript>(); ListMapEvent = new List <MapEvent>(); DicCutsceneScript = new Dictionary <string, CutsceneScript>(); DicRequirement = new Dictionary <string, BaseSkillRequirement>(); DicEffect = new Dictionary <string, BaseEffect>(); ListSubMap = new List <BattleMap>(); GlobalBattleContext = new BattleContext(); #region Screen shaking ShakeCounter = 0; ShakeRadiusMax = 3; ShakeOffsetX = 0; ShakeOffsetY = 0; ShakeAngle = RandomHelper.Next(360); ShakeAngleVariation = new Vector2(1, 0); #endregion }
public override void Load() { NewMap = new DeathmatchMap(null, "Classic", null); DirectoryInfo MapDirectory = new DirectoryInfo(Content.RootDirectory + "\\Maps\\Deathmatch"); fntArial8 = Content.Load <SpriteFont>("Fonts/Arial8"); fntArial12 = Content.Load <SpriteFont>("Fonts/Arial12"); MaxItemToDraw = (Constants.Height - 100) / fntArial12.LineSpacing - 1; CursorColor = Color.FromNonPremultiplied(255, 255, 255, 128); //Load directory info, abort if none if (!MapDirectory.Exists) { throw new DirectoryNotFoundException(); } ListMap = new List <MapAttributes>(); List <string> ListPlayerTag = new List <string>(); IPInputBox = new PopUpInputBox("Enter an IP"); OnlinePlayers = new OnlineConfiguration(); //OnlinePlayers.StartListening(); KeyValuePair <string, List <OnlineScript> > NewScripts = new DeathmatchLobyScriptHolder().GetNameAndContent(this); foreach (OnlineScript ActiveListScript in NewScripts.Value) { OnlinePlayers.DicOnlineScripts.Add(ActiveListScript.Name, ActiveListScript); } #region Load Map Info FileInfo[] ArrayMapFile = MapDirectory.GetFiles("*.pem"); foreach (FileInfo ActiveFile in ArrayMapFile) { FileStream FS = new FileStream(ActiveFile.FullName, FileMode.Open, FileAccess.Read); BinaryReader BR = new BinaryReader(FS, Encoding.UTF8); Point NewMapSize = Point.Zero; BR.BaseStream.Seek(0, SeekOrigin.Begin); string MapName = ActiveFile.FullName.Substring(0, ActiveFile.FullName.Length - 4).Substring(ActiveFile.FullName.LastIndexOf("Maps") + 16); NewMapSize.X = BR.ReadInt32(); NewMapSize.Y = BR.ReadInt32(); int TileSizeX = BR.ReadInt32(); int TileSizeY = BR.ReadInt32(); int CameraPositionX = BR.ReadInt32(); int CameraPositionY = BR.ReadInt32(); byte PlayersMin = BR.ReadByte(); byte PlayersMax = BR.ReadByte(); string Description = BR.ReadString(); int ListBackgroundsPathCount = BR.ReadInt32(); for (int B = 0; B < ListBackgroundsPathCount; B++) { string BackgroundsPath = BR.ReadString(); } int ListForegroundsPathCount = BR.ReadInt32(); for (int F = 0; F < ListForegroundsPathCount; F++) { string ForegroundsPath = BR.ReadString(); } Color[] ArrayColor = new Color[16]; //Deathmatch colors for (int D = 0; D < 16; D++) { ArrayColor[D].R = BR.ReadByte(); ArrayColor[D].G = BR.ReadByte(); ArrayColor[D].B = BR.ReadByte(); } int ListSingleplayerSpawnsCount = BR.ReadInt32(); for (int S = 0; S < ListSingleplayerSpawnsCount; S++) { EventPoint NewPoint = new EventPoint(BR); } int ListSpawnsCount = BR.ReadInt32(); List <EventPoint> ListSpawns = new List <EventPoint>(ListSpawnsCount); for (int S = 0; S < ListSpawnsCount; S++) { EventPoint NewPoint = new EventPoint(BR); int ColorIndex = 0; if (!string.IsNullOrWhiteSpace(NewPoint.Tag)) { ColorIndex = Convert.ToInt32(NewPoint.Tag) - 1; } NewPoint.ColorRed = ArrayColor[ColorIndex].R; NewPoint.ColorGreen = ArrayColor[ColorIndex].G; NewPoint.ColorBlue = ArrayColor[ColorIndex].B; ListSpawns.Add(NewPoint); } ListPlayerTag.Clear(); for (int S = 0; S < ListSpawns.Count; S++) { if (!ListPlayerTag.Contains(ListSpawns[S].Tag)) { ListPlayerTag.Add(ListSpawns[S].Tag); } } ListMap.Add(new MapAttributes(MapName, ActiveFile.FullName, new Point(NewMapSize.X, NewMapSize.Y), ListPlayerTag.Count, ListSpawns, ArrayColor)); FS.Close(); BR.Close(); } #endregion #region Load Units MapDirectory = new DirectoryInfo(Content.RootDirectory + "\\Units\\Normal"); FileInfo[] ArrayUnitFile = MapDirectory.GetFiles("*.peu", SearchOption.AllDirectories); ArrayUnit = new Tuple <string, string> [ArrayUnitFile.Length]; for (int i = ArrayUnitFile.Length - 1; i >= 0; --i) { string Name = ArrayUnitFile[i].FullName.Substring(0, ArrayUnitFile[i].FullName.Length - 4).Substring(ArrayUnitFile[i].FullName.LastIndexOf("Units") + 6); string[] UnitInfo = Name.Split(new[] { "\\" }, StringSplitOptions.None); string UnitType = UnitInfo[0]; string UnitName = Name.Remove(0, UnitInfo[0].Length + 1); ArrayUnit[i] = new Tuple <string, string>(UnitType, UnitName); } #endregion #region Load Pilots MapDirectory = new DirectoryInfo(Content.RootDirectory + "\\Characters"); FileInfo[] ArrayCharactetFile = MapDirectory.GetFiles("*.pec", SearchOption.AllDirectories); ListPilot = new List <string>(); for (int i = ArrayCharactetFile.Length - 1; i >= 0; --i) { if (ArrayCharactetFile[i].Extension.Length > 4)//Because the retarded search system return files that ends with .pecs, ignore them. { continue; } ListPilot.Add(ArrayCharactetFile[i].FullName.Substring(0, ArrayCharactetFile[i].FullName.Length - 4).Substring(ArrayCharactetFile[i].FullName.LastIndexOf("Characters") + 11)); } #endregion }