Exemple #1
0
 public override void Initialize()
 {
     m_boss = (EnemyList[0] as EnemyObj_LastBoss);
     foreach (var current in GameObjList)
     {
         if (current.Name == "fountain")
         {
             m_fountain = (current as ObjContainer);
         }
         if (current.Name == "stainglass")
         {
             current.Opacity = 0.5f;
         }
         if (current.Name == "door")
         {
             m_bossDoorSprite = (current as SpriteObj);
         }
     }
     foreach (var current2 in DoorList)
     {
         if (current2.Name == "FinalBossDoor")
         {
             m_bossDoor        = current2;
             m_bossDoor.Locked = true;
             break;
         }
     }
     base.Initialize();
 }
Exemple #2
0
 public override void Dispose()
 {
     if (!IsDisposed)
     {
         m_tutorialText.Dispose();
         m_tutorialText = null;
         m_waypointList.Clear();
         m_waypointList = null;
         m_creditsText.Dispose();
         m_creditsText = null;
         m_creditsTitleText.Dispose();
         m_creditsTitleText = null;
         Array.Clear(m_tutorialTextList, 0, m_tutorialTextList.Length);
         Array.Clear(m_tutorialControllerTextList, 0, m_tutorialControllerTextList.Length);
         Array.Clear(m_creditsTextTitleList, 0, m_creditsTextTitleList.Length);
         Array.Clear(m_creditsTextList, 0, m_creditsTextList.Length);
         m_tutorialTextList           = null;
         m_creditsTextTitleList       = null;
         m_creditsTextList            = null;
         m_tutorialControllerTextList = null;
         m_door         = null;
         m_doorSprite   = null;
         m_diary        = null;
         m_speechBubble = null;
         base.Dispose();
     }
 }
Exemple #3
0
 public override void Dispose()
 {
     if (!IsDisposed)
     {
         m_castleGate     = null;
         m_teleporter     = null;
         m_bossDoor       = null;
         m_bossDoorSprite = null;
         m_diary          = null;
         m_speechBubble   = null;
         m_mapText        = null;
         m_mapIcon        = null;
         base.Dispose();
     }
 }
Exemple #4
0
 public override void Initialize()
 {
     foreach (var current in GameObjList)
     {
         if (current.Name == "diary")
         {
             m_diary = (current as SpriteObj);
         }
         if (current.Name == "doorsprite")
         {
             m_doorSprite = (current as SpriteObj);
         }
     }
     m_door               = DoorList[0];
     m_speechBubble       = new SpriteObj("ExclamationSquare_Sprite");
     m_speechBubble.Flip  = SpriteEffects.FlipHorizontally;
     m_speechBubble.Scale = new Vector2(1.2f, 1.2f);
     GameObjList.Add(m_speechBubble);
     m_diary.OutlineWidth    = 2;
     m_speechBubble.Position = new Vector2(m_diary.X, m_diary.Y - m_speechBubble.Height - 20f);
     m_tutorialTextList      = new[]
     {
         "Tap [Input:" + 11 + "] to Jump",
         "Hold [Input:" + 11 + "] to Jump Higher",
         "Tap [Input:" + 12 + "] to Attack",
         string.Concat("Hold [Input:", 19, "] and Tap [Input:", 11, "] to Drop Ledges"),
         string.Concat("(Air) Hold [Input:", 19, "] and Tap [Input:", 12, "] to Attack Down")
     };
     m_tutorialControllerTextList = new[]
     {
         "Tap [Input:" + 10 + "] to Jump",
         "Hold [Input:" + 10 + "] to Jump Higher",
         "Tap [Input:" + 12 + "] to Attack",
         string.Concat("Hold [Input:", 18, "] and Tap [Input:", 10, "] to Drop Ledges"),
         string.Concat("(Air) Hold [Input:", 18, "] and Tap [Input:", 12, "] to Attack Down")
     };
     m_creditsTextTitleList = new[]
     {
         "Developed by",
         "Design",
         "Programming",
         "Art",
         "Sound Design & Music",
         "Music",
         ""
     };
     m_creditsTextList = new[]
     {
         "Cellar Door Games",
         "Teddy Lee",
         "Kenny Lee",
         "Glauber Kotaki",
         "Gordon McGladdery",
         "Judson Cowan",
         "Rogue Legacy"
     };
     m_creditsPosition = new Vector2(50f, 580f);
     foreach (var current2 in GameObjList)
     {
         if (current2.Name == "waypoint1")
         {
             m_waypointList.Add(current2);
         }
         if (current2.Name == "waypoint2")
         {
             m_waypointList.Add(current2);
         }
         if (current2.Name == "waypoint3")
         {
             m_waypointList.Add(current2);
         }
         if (current2.Name == "waypoint4")
         {
             m_waypointList.Add(current2);
         }
         if (current2.Name == "waypoint5")
         {
             m_waypointList.Add(current2);
         }
     }
     base.Initialize();
 }
Exemple #5
0
        public static void ParseRooms(string filePath, ContentManager contentManager = null, bool isDLCMap = false)
        {
            var cultureInfo = (CultureInfo)CultureInfo.CurrentCulture.Clone();

            cultureInfo.NumberFormat.CurrencyDecimalSeparator = ".";
            var 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();
                        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");
                        var     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");
                                var enemyType = byte.Parse(xmlReader.Value, NumberStyles.Any, cultureInfo);
                                xmlReader.MoveToAttribute("Difficulty");
                                var difficulty =
                                    (GameTypes.EnemyDifficulty)
                                    Enum.Parse(typeof(GameTypes.EnemyDifficulty), xmlReader.Value, true);
                                gameObj = EnemyBuilder.BuildEnemy(enemyType, null, null, null, difficulty);
                                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");
                                var value2 = xmlReader.Value;
                                gameObj = new EnemyTagObj();
                                (gameObj as EnemyTagObj).EnemyType = value2;
                            }
                            break;

                        case "EnemyOrbObj":
                        {
                            xmlReader.MoveToAttribute("OrbType");
                            var orbType = int.Parse(xmlReader.Value, NumberStyles.Any, cultureInfo);
                            var 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);
                            var physicsObj = gameObj as PhysicsObj;
                            physicsObj.CollisionTypeTag = 5;
                            physicsObj.CollidesBottom   = false;
                            physicsObj.CollidesLeft     = false;
                            physicsObj.CollidesRight    = false;
                            break;
                        }

                        case "PhysicsObjContainer":
                        {
                            var 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);
                            }
                            break;
                        }

                        case "ObjContainer":
                            xmlReader.MoveToAttribute("SpriteName");
                            gameObj = new ObjContainer(xmlReader.Value);
                            break;

                        case "PlayerStartObj":
                            gameObj = new PlayerStartObj();
                            break;
                        }
                        ParseGenericXML(xmlReader, gameObj);
                        var levelType = GameTypes.LevelType.NONE;
                        if (xmlReader.MoveToAttribute("LevelType"))
                        {
                            levelType = (GameTypes.LevelType) int.Parse(xmlReader.Value, NumberStyles.Any, cultureInfo);
                        }
                        if (levelType == GameTypes.LevelType.CASTLE)
                        {
                            StoreObj(gameObj, roomObj2);
                            StoreSwappedObj(gameObj, GameTypes.LevelType.DUNGEON, roomObj3);
                            StoreSwappedObj(gameObj, GameTypes.LevelType.TOWER, roomObj5);
                            StoreSwappedObj(gameObj, GameTypes.LevelType.GARDEN, roomObj4);
                            var 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)
                        {
                            StoreObj(gameObj, roomObj3);
                        }
                        else if (levelType == GameTypes.LevelType.TOWER)
                        {
                            StoreObj(gameObj, roomObj5);
                        }
                        else if (levelType == GameTypes.LevelType.GARDEN)
                        {
                            StoreObj(gameObj, roomObj4);
                        }
                        else
                        {
                            StoreObj(gameObj, roomObj2);
                            StoreObj(gameObj, roomObj3);
                            StoreObj(gameObj, roomObj5);
                            StoreObj(gameObj, roomObj4);
                            StoreObj(gameObj, roomObj);
                        }
                        if (LevelEV.RUN_TESTROOM &&
                            (levelType == LevelEV.TESTROOM_LEVELTYPE || levelType == GameTypes.LevelType.CASTLE))
                        {
                            if (levelType == LevelEV.TESTROOM_LEVELTYPE)
                            {
                                StoreObj(gameObj, roomObj);
                            }
                            else if (levelType == GameTypes.LevelType.CASTLE)
                            {
                                StoreSwappedObj(gameObj, LevelEV.TESTROOM_LEVELTYPE, roomObj);
                            }
                        }
                        if (gameObj is PlayerStartObj)
                        {
                            var 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);
                            }
                            if (roomObj.AddToDungeonPool)
                            {
                                LevelBuilder2.StoreRoom(roomObj3, GameTypes.LevelType.DUNGEON);
                                LevelBuilder2.StoreSpecialRoom(roomObj3, GameTypes.LevelType.DUNGEON);
                            }
                            if (roomObj.AddToGardenPool)
                            {
                                LevelBuilder2.StoreRoom(roomObj4, GameTypes.LevelType.GARDEN);
                                LevelBuilder2.StoreSpecialRoom(roomObj4, GameTypes.LevelType.GARDEN);
                            }
                            if (roomObj.AddToTowerPool)
                            {
                                LevelBuilder2.StoreRoom(roomObj5, GameTypes.LevelType.TOWER);
                                LevelBuilder2.StoreSpecialRoom(roomObj5, GameTypes.LevelType.TOWER);
                            }
                        }
                        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);
                    }
                }
            }
        }
Exemple #6
0
        public override void Initialize()
        {
            m_speechBubble       = new SpriteObj("ExclamationSquare_Sprite");
            m_speechBubble.Flip  = SpriteEffects.FlipHorizontally;
            m_speechBubble.Scale = new Vector2(1.2f, 1.2f);
            GameObjList.Add(m_speechBubble);
            m_mapText              = new KeyIconTextObj(Game.JunicodeFont);
            m_mapText.Text         = "view map any time";
            m_mapText.Align        = Types.TextAlign.Centre;
            m_mapText.FontSize     = 12f;
            m_mapText.OutlineWidth = 2;
            GameObjList.Add(m_mapText);
            m_mapIcon       = new KeyIconObj();
            m_mapIcon.Scale = new Vector2(0.5f, 0.5f);
            GameObjList.Add(m_mapIcon);
            foreach (var current in GameObjList)
            {
                if (current.Name == "diary")
                {
                    m_diary = (current as SpriteObj);
                }
                if (current.Name == "map")
                {
                    (current as SpriteObj).OutlineWidth = 2;
                    m_mapText.Position = new Vector2(current.X, current.Bounds.Top - 50);
                    m_mapIcon.Position = new Vector2(m_mapText.X, m_mapText.Y - 20f);
                }
            }
            m_diary.OutlineWidth    = 2;
            m_speechBubble.Position = new Vector2(m_diary.X, m_diary.Y - m_speechBubble.Height - 20f);
            DoorObj doorObj = null;

            foreach (var current2 in GameObjList)
            {
                if (current2.Name == "LastDoor")
                {
                    m_bossDoorSprite = (current2 as ObjContainer);
                    break;
                }
            }
            foreach (var current3 in DoorList)
            {
                if (current3.DoorPosition == "Left")
                {
                    doorObj = current3;
                }
                if (current3.IsBossDoor)
                {
                    m_bossDoor        = current3;
                    m_bossDoor.Locked = true;
                }
            }
            for (var i = 1; i < m_bossDoorSprite.NumChildren; i++)
            {
                m_bossDoorSprite.GetChildAt(i).Opacity = 0f;
            }
            m_bossDoorSprite.AnimationDelay = 0.1f;
            m_castleGate.Position           = new Vector2(doorObj.Bounds.Right - m_castleGate.Width,
                                                          doorObj.Y - m_castleGate.Height);
            m_teleporter.Position = new Vector2(X + Width / 2f - 600f, Y + 720f - 120f);
            base.Initialize();
        }