public override void Initialize() { foreach (GameObj current in base.GameObjList) { if (current.Name == "diary") { this.m_diary = (current as SpriteObj); } if (current.Name == "doorsprite") { this.m_doorSprite = (current as SpriteObj); } } this.m_door = base.DoorList[0]; this.m_speechBubble = new SpriteObj("ExclamationSquare_Sprite"); this.m_speechBubble.Flip = SpriteEffects.FlipHorizontally; this.m_speechBubble.Scale = new Vector2(1.2f, 1.2f); base.GameObjList.Add(this.m_speechBubble); this.m_diary.OutlineWidth = 2; this.m_speechBubble.Position = new Vector2(this.m_diary.X, this.m_diary.Y - (float)this.m_speechBubble.Height - 20f); this.m_tutorialTextList = new string[] { "Tap [Input:" + 11 + "] to Jump", "Hold [Input:" + 11 + "] to Jump Higher", "Tap [Input:" + 12 + "] to Attack", string.Concat(new object[] { "Hold [Input:", 19, "] and Tap [Input:", 11, "] to Drop Ledges" }), string.Concat(new object[] { "(Air) Hold [Input:", 19, "] and Tap [Input:", 12, "] to Attack Down" }) }; this.m_tutorialControllerTextList = new string[] { "Tap [Input:" + 10 + "] to Jump", "Hold [Input:" + 10 + "] to Jump Higher", "Tap [Input:" + 12 + "] to Attack", string.Concat(new object[] { "Hold [Input:", 18, "] and Tap [Input:", 10, "] to Drop Ledges" }), string.Concat(new object[] { "(Air) Hold [Input:", 18, "] and Tap [Input:", 12, "] to Attack Down" }) }; this.m_creditsTextTitleList = new string[] { "Developed by", "Design", "Programming", "Art", "Sound Design & Music", "Music", "" }; this.m_creditsTextList = new string[] { "Cellar Door Games", "Teddy Lee", "Kenny Lee", "Glauber Kotaki", "Gordon McGladdery", "Judson Cowan", "Rogue Legacy" }; this.m_creditsPosition = new Vector2(50f, 580f); foreach (GameObj current2 in base.GameObjList) { if (current2.Name == "waypoint1") { this.m_waypointList.Add(current2); } if (current2.Name == "waypoint2") { this.m_waypointList.Add(current2); } if (current2.Name == "waypoint3") { this.m_waypointList.Add(current2); } if (current2.Name == "waypoint4") { this.m_waypointList.Add(current2); } if (current2.Name == "waypoint5") { this.m_waypointList.Add(current2); } } base.Initialize(); }
public override void Dispose() { if (!base.IsDisposed) { this.m_tutorialText.Dispose(); this.m_tutorialText = null; this.m_waypointList.Clear(); this.m_waypointList = null; this.m_creditsText.Dispose(); this.m_creditsText = null; this.m_creditsTitleText.Dispose(); this.m_creditsTitleText = null; Array.Clear(this.m_tutorialTextList, 0, this.m_tutorialTextList.Length); Array.Clear(this.m_tutorialControllerTextList, 0, this.m_tutorialControllerTextList.Length); Array.Clear(this.m_creditsTextTitleList, 0, this.m_creditsTextTitleList.Length); Array.Clear(this.m_creditsTextList, 0, this.m_creditsTextList.Length); this.m_tutorialTextList = null; this.m_creditsTextTitleList = null; this.m_creditsTextList = null; this.m_tutorialControllerTextList = null; this.m_door = null; this.m_doorSprite = null; this.m_diary = null; this.m_speechBubble = null; base.Dispose(); } }
private void UpdateCompass() { if (this.m_compassDoor == null && this.CurrentRoom.Name != "Ending" && this.CurrentRoom.Name != "Boss" && this.CurrentRoom.Name != "Start" && this.CurrentRoom.Name != "Tutorial" && this.CurrentRoom.Name != " ChallengeBoss") { Console.WriteLine("Creating new bonus room for compass"); RoomObj roomObj = null; EnemyObj enemyObj = null; List<RoomObj> list = new List<RoomObj>(); foreach (RoomObj current in this.m_roomList) { bool flag = false; foreach (EnemyObj current2 in current.EnemyList) { if (current2.IsWeighted) { flag = true; break; } } if (current.Name != "Ending" && current.Name != "Tutorial" && current.Name != "Boss" && current.Name != "Secret" && current.Name != "Bonus" && flag && current.Name != "ChallengeBoss") { list.Add(current); } } if (list.Count > 0) { roomObj = list[CDGMath.RandomInt(0, list.Count - 1)]; int num = 0; while (enemyObj == null || !enemyObj.IsWeighted) { enemyObj = roomObj.EnemyList[num]; num++; } DoorObj doorObj = new DoorObj(roomObj, 120, 180, GameTypes.DoorType.OPEN); doorObj.Position = enemyObj.Position; doorObj.IsBossDoor = true; doorObj.DoorPosition = "None"; doorObj.AddCollisionBox(0, 0, doorObj.Width, doorObj.Height, 0); doorObj.AddCollisionBox(0, 0, doorObj.Width, doorObj.Height, 2); float num2 = 3.40282347E+38f; TerrainObj terrainObj = null; foreach (TerrainObj current3 in roomObj.TerrainObjList) { if (current3.Y >= doorObj.Y && current3.Y - doorObj.Y < num2 && CollisionMath.Intersects(current3.Bounds, new Rectangle((int)doorObj.X, (int)(doorObj.Y + (current3.Y - doorObj.Y) + 5f), doorObj.Width, doorObj.Height / 2))) { num2 = current3.Y - doorObj.Y; terrainObj = current3; } } if (terrainObj != null) { doorObj.UpdateCollisionBoxes(); if (terrainObj.Rotation == 0f) { doorObj.Y = terrainObj.Y - ((float)doorObj.TerrainBounds.Bottom - doorObj.Y); } else { this.HookEnemyToSlope(doorObj, terrainObj); } } roomObj.DoorList.Add(doorObj); roomObj.LinkedRoom = this.m_roomList[this.m_roomList.Count - 1]; roomObj.LinkedRoom.LinkedRoom = roomObj; roomObj.LinkedRoom.LevelType = roomObj.LevelType; string cornerTextureString = "CastleCorner_Sprite"; string cornerLTextureString = "CastleCornerL_Sprite"; string cornerTextureString2 = "TowerCorner_Sprite"; string cornerLTextureString2 = "TowerCornerL_Sprite"; string cornerTextureString3 = "DungeonCorner_Sprite"; string cornerLTextureString3 = "DungeonCornerL_Sprite"; string cornerTextureString4 = "GardenCorner_Sprite"; string cornerLTextureString4 = "GardenCornerL_Sprite"; if (Game.PlayerStats.Traits.X == 32f || Game.PlayerStats.Traits.Y == 32f) { string text = "NeoCorner_Sprite"; string text2 = "NeoCornerL_Sprite"; cornerLTextureString3 = (cornerLTextureString = (cornerLTextureString2 = (cornerLTextureString4 = text2))); cornerTextureString3 = (cornerTextureString = (cornerTextureString2 = (cornerTextureString4 = text))); } foreach (BorderObj current4 in roomObj.LinkedRoom.BorderList) { switch (roomObj.LinkedRoom.LevelType) { case GameTypes.LevelType.GARDEN: current4.SetBorderTextures(this.m_gardenBorderTexture, cornerTextureString4, cornerLTextureString4); current4.TextureOffset = new Vector2(0f, -18f); continue; case GameTypes.LevelType.DUNGEON: current4.SetBorderTextures(this.m_dungeonBorderTexture, cornerTextureString3, cornerLTextureString3); continue; case GameTypes.LevelType.TOWER: current4.SetBorderTextures(this.m_towerBorderTexture, cornerTextureString2, cornerLTextureString2); continue; } current4.SetBorderTextures(this.m_castleBorderTexture, cornerTextureString, cornerLTextureString); } this.m_compassDoor = doorObj; } } if (this.m_compassDoor != null) { this.m_compass.Rotation = CDGMath.AngleBetweenPts(this.m_player.Position, new Vector2((float)this.m_compassDoor.Bounds.Center.X, (float)this.m_compassDoor.Bounds.Center.Y)); } }
public override void Dispose() { if (!base.IsDisposed) { Console.WriteLine("Disposing Procedural Level Screen"); Tween.StopAll(false); this.m_currentRoom = null; this.DisposeRTs(); foreach (RoomObj current in this.m_roomList) { current.Dispose(); } this.m_roomList.Clear(); this.m_roomList = null; this.m_enemyStartPositions.Clear(); this.m_enemyStartPositions = null; this.m_tempEnemyStartPositions.Clear(); this.m_tempEnemyStartPositions = null; this.m_textManager.Dispose(); this.m_textManager = null; this.m_physicsManager = null; this.m_projectileManager.Dispose(); this.m_projectileManager = null; this.m_itemDropManager.Dispose(); this.m_itemDropManager = null; this.m_currentRoom = null; this.m_miniMapDisplay.Dispose(); this.m_miniMapDisplay = null; this.m_mapBG.Dispose(); this.m_mapBG = null; this.m_inputMap.Dispose(); this.m_inputMap = null; this.m_lastEnemyHit = null; this.m_playerHUD.Dispose(); this.m_playerHUD = null; this.m_player = null; this.m_enemyHUD.Dispose(); this.m_enemyHUD = null; this.m_impactEffectPool.Dispose(); this.m_impactEffectPool = null; this.m_blackBorder1.Dispose(); this.m_blackBorder1 = null; this.m_blackBorder2.Dispose(); this.m_blackBorder2 = null; this.m_chestList.Clear(); this.m_chestList = null; this.m_projectileIconPool.Dispose(); this.m_projectileIconPool = null; this.m_objKilledPlayer = null; this.m_dungeonLight.Dispose(); this.m_dungeonLight = null; this.m_traitAura.Dispose(); this.m_traitAura = null; this.m_killedEnemyObjList.Clear(); this.m_killedEnemyObjList = null; this.m_roomEnteringTitle.Dispose(); this.m_roomEnteringTitle = null; this.m_roomTitle.Dispose(); this.m_roomTitle = null; this.m_creditsText.Dispose(); this.m_creditsText = null; this.m_creditsTitleText.Dispose(); this.m_creditsTitleText = null; Array.Clear(this.m_creditsTextTitleList, 0, this.m_creditsTextTitleList.Length); Array.Clear(this.m_creditsTextList, 0, this.m_creditsTextList.Length); this.m_creditsTextTitleList = null; this.m_creditsTextList = null; this.m_filmGrain.Dispose(); this.m_filmGrain = null; this.m_objectivePlate.Dispose(); this.m_objectivePlate = null; this.m_objectivePlateTween = null; this.m_sky.Dispose(); this.m_sky = null; this.m_whiteBG.Dispose(); this.m_whiteBG = null; this.m_compassBG.Dispose(); this.m_compassBG = null; this.m_compass.Dispose(); this.m_compass = null; if (this.m_compassDoor != null) { this.m_compassDoor.Dispose(); } this.m_compassDoor = null; this.m_castleBorderTexture.Dispose(); this.m_gardenBorderTexture.Dispose(); this.m_towerBorderTexture.Dispose(); this.m_dungeonBorderTexture.Dispose(); this.m_neoBorderTexture.Dispose(); this.m_castleBorderTexture = null; this.m_gardenBorderTexture = null; this.m_towerBorderTexture = null; this.m_dungeonBorderTexture = null; this.DebugTextObj.Dispose(); this.DebugTextObj = null; base.Dispose(); } }
public void RemoveCompassDoor() { if (this.m_compassDoor != null) { this.m_compassDoor.Room.DoorList.Remove(this.m_compassDoor); this.m_compassDoor.Dispose(); this.m_compassDoor = null; } }
public override void Dispose() { if (!base.IsDisposed) { this.m_castleGate = null; this.m_teleporter = null; this.m_bossDoor = null; this.m_bossDoorSprite = null; this.m_diary = null; this.m_speechBubble = null; this.m_mapText = null; this.m_mapIcon = null; base.Dispose(); } }
public override void Initialize() { this.m_speechBubble = new SpriteObj("ExclamationSquare_Sprite"); this.m_speechBubble.Flip = SpriteEffects.FlipHorizontally; this.m_speechBubble.Scale = new Vector2(1.2f, 1.2f); base.GameObjList.Add(this.m_speechBubble); this.m_mapText = new KeyIconTextObj(Game.JunicodeFont); this.m_mapText.Text = "view map any time"; this.m_mapText.Align = Types.TextAlign.Centre; this.m_mapText.FontSize = 12f; this.m_mapText.OutlineWidth = 2; base.GameObjList.Add(this.m_mapText); this.m_mapIcon = new KeyIconObj(); this.m_mapIcon.Scale = new Vector2(0.5f, 0.5f); base.GameObjList.Add(this.m_mapIcon); foreach (GameObj current in base.GameObjList) { if (current.Name == "diary") { this.m_diary = (current as SpriteObj); } if (current.Name == "map") { (current as SpriteObj).OutlineWidth = 2; this.m_mapText.Position = new Vector2(current.X, (float)(current.Bounds.Top - 50)); this.m_mapIcon.Position = new Vector2(this.m_mapText.X, this.m_mapText.Y - 20f); } } this.m_diary.OutlineWidth = 2; this.m_speechBubble.Position = new Vector2(this.m_diary.X, this.m_diary.Y - (float)this.m_speechBubble.Height - 20f); DoorObj doorObj = null; foreach (GameObj current2 in base.GameObjList) { if (current2.Name == "LastDoor") { this.m_bossDoorSprite = (current2 as ObjContainer); break; } } foreach (DoorObj current3 in base.DoorList) { if (current3.DoorPosition == "Left") { doorObj = current3; } if (current3.IsBossDoor) { this.m_bossDoor = current3; this.m_bossDoor.Locked = true; } } for (int i = 1; i < this.m_bossDoorSprite.NumChildren; i++) { this.m_bossDoorSprite.GetChildAt(i).Opacity = 0f; } this.m_bossDoorSprite.AnimationDelay = 0.1f; this.m_castleGate.Position = new Vector2((float)(doorObj.Bounds.Right - this.m_castleGate.Width), doorObj.Y - (float)this.m_castleGate.Height); this.m_teleporter.Position = new Vector2(base.X + (float)this.Width / 2f - 600f, base.Y + 720f - 120f); base.Initialize(); }
public static void ParseRooms(string filePath, ContentManager contentManager = null, bool isDLCMap = false) { CultureInfo cultureInfo = (CultureInfo)CultureInfo.CurrentCulture.Clone(); cultureInfo.NumberFormat.CurrencyDecimalSeparator = "."; XmlReaderSettings xmlReaderSettings = new XmlReaderSettings(); xmlReaderSettings.IgnoreComments = true; xmlReaderSettings.IgnoreWhitespace = true; XmlReader xmlReader; if (contentManager == null) { xmlReader = XmlReader.Create(filePath, xmlReaderSettings); } else { xmlReader = XmlReader.Create(contentManager.RootDirectory + "\\Levels\\" + filePath + ".xml", xmlReaderSettings); } RoomObj roomObj = null; RoomObj roomObj2 = null; RoomObj roomObj3 = null; RoomObj roomObj4 = null; RoomObj roomObj5 = null; while (xmlReader.Read()) { if (xmlReader.NodeType == XmlNodeType.Element) { if (xmlReader.Name == "RoomObject") { roomObj = new RoomObj(); LevelParser.ParseGenericXML(xmlReader, roomObj); if (isDLCMap) { roomObj.IsDLCMap = true; } roomObj2 = (roomObj.Clone() as RoomObj); roomObj3 = (roomObj.Clone() as RoomObj); roomObj4 = (roomObj.Clone() as RoomObj); roomObj5 = (roomObj.Clone() as RoomObj); } if (xmlReader.Name == "GameObject") { xmlReader.MoveToAttribute("Type"); string value = xmlReader.Value; GameObj gameObj = null; string key; switch (key = value) { case "CollHullObj": gameObj = new TerrainObj(0, 0); break; case "DoorObj": gameObj = new DoorObj(roomObj, 0, 0, GameTypes.DoorType.OPEN); break; case "ChestObj": if (xmlReader.MoveToAttribute("Fairy")) { if (bool.Parse(xmlReader.Value)) { gameObj = new FairyChestObj(null); (gameObj as ChestObj).ChestType = 4; } else { gameObj = new ChestObj(null); } } else { gameObj = new ChestObj(null); } break; case "HazardObj": gameObj = new HazardObj(0, 0); break; case "BorderObj": gameObj = new BorderObj(); break; case "EnemyObj": xmlReader.MoveToAttribute("Procedural"); if (!bool.Parse(xmlReader.Value)) { xmlReader.MoveToAttribute("EnemyType"); byte enemyType = byte.Parse(xmlReader.Value, NumberStyles.Any, cultureInfo); xmlReader.MoveToAttribute("Difficulty"); GameTypes.EnemyDifficulty difficulty = (GameTypes.EnemyDifficulty)Enum.Parse(typeof(GameTypes.EnemyDifficulty), xmlReader.Value, true); gameObj = EnemyBuilder.BuildEnemy((int)enemyType, null, null, null, difficulty, false); if (xmlReader.MoveToAttribute("Flip") && bool.Parse(xmlReader.Value)) { gameObj.Flip = SpriteEffects.FlipHorizontally; } if (xmlReader.MoveToAttribute("InitialDelay")) { (gameObj as EnemyObj).InitialLogicDelay = float.Parse(xmlReader.Value, NumberStyles.Any, cultureInfo); } } else { xmlReader.MoveToAttribute("EnemyType"); string value2 = xmlReader.Value; gameObj = new EnemyTagObj(); (gameObj as EnemyTagObj).EnemyType = value2; } break; case "EnemyOrbObj": { xmlReader.MoveToAttribute("OrbType"); int orbType = int.Parse(xmlReader.Value, NumberStyles.Any, cultureInfo); bool flag = false; if (xmlReader.MoveToAttribute("IsWaypoint")) { flag = bool.Parse(xmlReader.Value); } if (flag) { gameObj = new WaypointObj(); (gameObj as WaypointObj).OrbType = orbType; } else { gameObj = new EnemyOrbObj(); (gameObj as EnemyOrbObj).OrbType = orbType; if (xmlReader.MoveToAttribute("ForceFlying")) { (gameObj as EnemyOrbObj).ForceFlying = bool.Parse(xmlReader.Value); } } break; } case "SpriteObj": xmlReader.MoveToAttribute("SpriteName"); if (xmlReader.Value == "LightSource_Sprite") { gameObj = new LightSourceObj(); } else { gameObj = new SpriteObj(xmlReader.Value); } break; case "PhysicsObj": { xmlReader.MoveToAttribute("SpriteName"); gameObj = new PhysicsObj(xmlReader.Value, null); PhysicsObj physicsObj = gameObj as PhysicsObj; physicsObj.CollisionTypeTag = 5; physicsObj.CollidesBottom = false; physicsObj.CollidesLeft = false; physicsObj.CollidesRight = false; break; } case "PhysicsObjContainer": { bool flag2 = false; if (xmlReader.MoveToAttribute("Breakable")) { flag2 = bool.Parse(xmlReader.Value); } xmlReader.MoveToAttribute("SpriteName"); if (flag2) { gameObj = new BreakableObj(xmlReader.Value); } else { gameObj = new PhysicsObjContainer(xmlReader.Value, null); } break; } case "ObjContainer": xmlReader.MoveToAttribute("SpriteName"); gameObj = new ObjContainer(xmlReader.Value); break; case "PlayerStartObj": gameObj = new PlayerStartObj(); break; } LevelParser.ParseGenericXML(xmlReader, gameObj); GameTypes.LevelType levelType = GameTypes.LevelType.NONE; if (xmlReader.MoveToAttribute("LevelType")) { levelType = (GameTypes.LevelType)int.Parse(xmlReader.Value, NumberStyles.Any, cultureInfo); } if (levelType == GameTypes.LevelType.CASTLE) { LevelParser.StoreObj(gameObj, roomObj2); LevelParser.StoreSwappedObj(gameObj, GameTypes.LevelType.DUNGEON, roomObj3); LevelParser.StoreSwappedObj(gameObj, GameTypes.LevelType.TOWER, roomObj5); LevelParser.StoreSwappedObj(gameObj, GameTypes.LevelType.GARDEN, roomObj4); SpriteObj spriteObj = gameObj as SpriteObj; if (spriteObj != null && spriteObj.SpriteName == "CastleAssetFrame_Sprite") { spriteObj.ChangeSprite("FramePicture" + CDGMath.RandomInt(1, 16) + "_Sprite"); } } else if (levelType == GameTypes.LevelType.DUNGEON) { LevelParser.StoreObj(gameObj, roomObj3); } else if (levelType == GameTypes.LevelType.TOWER) { LevelParser.StoreObj(gameObj, roomObj5); } else if (levelType == GameTypes.LevelType.GARDEN) { LevelParser.StoreObj(gameObj, roomObj4); } else { LevelParser.StoreObj(gameObj, roomObj2); LevelParser.StoreObj(gameObj, roomObj3); LevelParser.StoreObj(gameObj, roomObj5); LevelParser.StoreObj(gameObj, roomObj4); LevelParser.StoreObj(gameObj, roomObj); } if (LevelEV.RUN_TESTROOM && (levelType == LevelEV.TESTROOM_LEVELTYPE || levelType == GameTypes.LevelType.CASTLE)) { if (levelType == LevelEV.TESTROOM_LEVELTYPE) { LevelParser.StoreObj(gameObj, roomObj); } else if (levelType == GameTypes.LevelType.CASTLE) { LevelParser.StoreSwappedObj(gameObj, LevelEV.TESTROOM_LEVELTYPE, roomObj); } } if (gameObj is PlayerStartObj) { RoomObj expr_65E = roomObj; expr_65E.Name += "DEBUG_ROOM"; } } } else if (xmlReader.NodeType == XmlNodeType.EndElement && xmlReader.Name == "RoomObject") { if (roomObj.X < 10000f && roomObj.Name != "Boss" && roomObj.Name != "ChallengeBoss") { if (!roomObj.Name.Contains("DEBUG_ROOM")) { if (roomObj.AddToCastlePool) { LevelBuilder2.StoreRoom(roomObj2, GameTypes.LevelType.CASTLE); LevelBuilder2.StoreSpecialRoom(roomObj2, GameTypes.LevelType.CASTLE, false); } if (roomObj.AddToDungeonPool) { LevelBuilder2.StoreRoom(roomObj3, GameTypes.LevelType.DUNGEON); LevelBuilder2.StoreSpecialRoom(roomObj3, GameTypes.LevelType.DUNGEON, false); } if (roomObj.AddToGardenPool) { LevelBuilder2.StoreRoom(roomObj4, GameTypes.LevelType.GARDEN); LevelBuilder2.StoreSpecialRoom(roomObj4, GameTypes.LevelType.GARDEN, false); } if (roomObj.AddToTowerPool) { LevelBuilder2.StoreRoom(roomObj5, GameTypes.LevelType.TOWER); LevelBuilder2.StoreSpecialRoom(roomObj5, GameTypes.LevelType.TOWER, false); } } if (roomObj.Name.Contains("DEBUG_ROOM")) { roomObj.Name = roomObj.Name.Replace("DEBUG_ROOM", ""); if (LevelEV.TESTROOM_LEVELTYPE != GameTypes.LevelType.CASTLE) { LevelBuilder2.StoreSpecialRoom(roomObj, GameTypes.LevelType.CASTLE, true); } LevelBuilder2.StoreSpecialRoom(roomObj, LevelEV.TESTROOM_LEVELTYPE, true); } } if (roomObj.X < 10000f && (roomObj.Name == "Boss" || roomObj.Name == "ChallengeBoss")) { LevelBuilder2.StoreSpecialRoom(roomObj, GameTypes.LevelType.CASTLE, false); } } } }
public override void Initialize() { this.m_boss = (base.EnemyList[0] as EnemyObj_LastBoss); foreach (GameObj current in base.GameObjList) { if (current.Name == "fountain") { this.m_fountain = (current as ObjContainer); } if (current.Name == "stainglass") { current.Opacity = 0.5f; } if (current.Name == "door") { this.m_bossDoorSprite = (current as SpriteObj); } } foreach (DoorObj current2 in base.DoorList) { if (current2.Name == "FinalBossDoor") { this.m_bossDoor = current2; this.m_bossDoor.Locked = true; break; } } base.Initialize(); }