Esempio n. 1
0
        private bool CanSlide(bool right)
        {
            int help       = currentLevel;
            int currentMod = GetPositionOnCurrentLevelScreen();

            if (right)
            {
                help = help + mainButtonList.Count - currentMod;
                if (stars.levelIsUnlocked(help))
                {
                    currentLevel = help;
                    //currentScreenPosition.X = GetPositionOnCurrentLevelScreen();
                    InitiateSlide(true);
                    currentScreenPosition.X = 1;
                    return(true);
                }
                else
                {
                    if (stars.getIndexOfFirstUnsolvedLevel() == 0 && currentLevel != 0)
                    {
                        currentLevel = mainButtonList[mainButtonList.Count - 1].buttonLevel;
                    }
                    else
                    {
                        while (stars.getIndexOfFirstUnsolvedLevel() > currentLevel)
                        {
                            currentLevel++;
                        }
                    }
                    currentScreenPosition.X = GetPositionOnCurrentLevelScreen();
                    currentScreenPosition.Y = 0;
                }
            }
            else
            {
                help = help - currentMod - 1;
                if (help >= levelSelectList[0].posList.Count - 1)
                {
                    currentLevel = help;
                    //currentScreenPosition.X = GetPositionOnCurrentLevelScreen();
                    InitiateSlide(false);
                    currentScreenPosition.X = 0;
                    return(true);
                }
                else if (currentLevel <= levelSelectList[0].posList.Count)
                {
                    currentLevel            = 0;
                    currentScreenPosition.X = GetPositionOnCurrentLevelScreen();
                    currentScreenPosition.Y = 0;
                }
            }
            return(false);
        }
Esempio n. 2
0
        void Initialisation()
        {
            font = FontLoader.Instance.LoadFont("Assets/Fonts/pixelhole.ttf");

            screenButtons           = new RectangleShape();
            screenButtons.Texture   = AssetManager.GetTexture(AssetManager.TextureName.LevelButtonOptions);
            screenButtons.Size      = new Vector2f(screenButtons.Texture.Size.X, screenButtons.Texture.Size.Y);
            screenButtons.Rotation  = 90;
            screenButtons.FillColor = new Color(255, 255, 255, 200);
            screenButtons.Origin    = new Vector2f(0, screenButtons.TextureRect.Height);
            debugButtonRect         = new RectangleShape();
            mainMap          = new RectangleShape(new Vector2f(1280, 720));
            mainMap.Position = new Vector2f(0, 0);
            mainMap.Texture  = AssetManager.GetTexture(AssetManager.TextureName.MapBackground1);
            helpMap          = new RectangleShape(mainMap);
            helpMap.Position = new Vector2f(-1000, -1000);
            slideSpeed       = 10f;
            sliding          = false;

            lastScreen = new SuperText("<", font, 1);
            lastScreen.CharacterSize = 200;
            lastScreen.Position      = new Vector2f(275, 445);
            lastScreen.minFrequency  = 5;
            lastScreen.maxFrequency  = 10;
            nextScreen = new SuperText(">", font, 1);
            nextScreen.CharacterSize = 200;
            nextScreen.Position      = new Vector2f(865, 445);
            nextScreen.minFrequency  = 5;
            nextScreen.maxFrequency  = 10;

            worldName = new SuperText("1", font, 0.2f);
            worldName.CharacterSize = 145;
            worldName.Position      = new Vector2f(440, 500);
            worldNameFakePos        = new Vector2f(-1000, -1000);
            worldNameRealPos        = worldName.Position;

            // ProfileConstants.activeProfile;
            profiles = new ManageProfiles();
            profiles = profiles.loadManageProfiles();
            stars    = new ManageStars();
            stars    = stars.unsafelyLoadManageStars(profiles.getActiveProfileName());

            // currentlevel is positive -> player played a level in during this session -> should at at that level
            if (ProfileConstants.curLevel >= 0)
            {
                currentLevel = ProfileConstants.curLevel;
            }
            else
            {
                currentLevel = stars.EverythingUnlocked() ? stars.GetLastSelectedLevel() : stars.getIndexOfFirstUnsolvedLevel();
            }

            mainButtonList       = new List <LevelSelectButton>();
            mainButtonTargetList = new List <Vector2f>();
            helpButtonList       = new List <LevelSelectButton>();
            helpButtonTargetList = new List <Vector2f>();

            levelSelectList = new List <LevelSelectionScreen>();

            // this list is used to initialize the levelscreens
            List <List <Vector2f> > posList = new List <List <Vector2f> >()
            {
                new List <Vector2f>()
                {
                    new Vector2f(115, 380), new Vector2f(205, 385), new Vector2f(325, 355), new Vector2f(445, 305), new Vector2f(505, 375),
                    new Vector2f(675, 345), new Vector2f(785, 275), new Vector2f(865, 245), new Vector2f(965, 205), new Vector2f(1045, 225), new Vector2f(1105, 345), new Vector2f(1115, 515)
                },

                new List <Vector2f>()
                {
                    new Vector2f(225, 395), new Vector2f(435, 315), new Vector2f(535, 325), new Vector2f(555, 395), new Vector2f(715, 385), new Vector2f(735, 495),
                    new Vector2f(875, 435), new Vector2f(935, 245), new Vector2f(955, 175), new Vector2f(1055, 195), new Vector2f(1175, 215), new Vector2f(1235, 345)
                },

                new List <Vector2f>()
                {
                    new Vector2f(355, 455), new Vector2f(515, 425), new Vector2f(695, 295), new Vector2f(825, 285), new Vector2f(935, 245), new Vector2f(1035, 445),
                    new Vector2f(1155, 405),
                },                             //new Vector2f(1095, 535), new Vector2f(1145, 425) },

                new List <Vector2f>()
                {
                    new Vector2f(75, 425), new Vector2f(155, 545), new Vector2f(245, 455), new Vector2f(345, 355), new Vector2f(485, 265), new Vector2f(615, 245),
                    new Vector2f(685, 255), new Vector2f(715, 305), new Vector2f(775, 375), new Vector2f(835, 415), new Vector2f(995, 425), new Vector2f(1075, 465), new Vector2f(1155, 475), new Vector2f(1215, 405), new Vector2f(1240, 320)
                }
            };
            List <Texture> backgroundList = new List <Texture>()
            {
                AssetManager.GetTexture(AssetManager.TextureName.MapBackground1), AssetManager.GetTexture(AssetManager.TextureName.MapBackground2), AssetManager.GetTexture(AssetManager.TextureName.MapBackground3), AssetManager.GetTexture(AssetManager.TextureName.MapBackground4)
            };
            int curStartIndex = 0;

            for (int i = 0; i < posList.Count; i++)
            {
                levelSelectList.Add(new LevelSelectionScreen(backgroundList[i], posList[i], curStartIndex));
                curStartIndex += posList[i].Count;
            }

            mainButtonList = new List <LevelSelectButton>();
            helpButtonList = new List <LevelSelectButton>();

            leftButton  = new Button(new Vector2f(300, 600), new Vector2i(0, 1), AssetManager.GetTexture(AssetManager.TextureName.LevelButtonOptions), AssetManager.GetTexture(AssetManager.TextureName.LevelButtonOptionsGlow), 90);
            rightButton = new Button(new Vector2f(900, 600), new Vector2i(1, 1), AssetManager.GetTexture(AssetManager.TextureName.LevelButtonOptions), AssetManager.GetTexture(AssetManager.TextureName.LevelButtonOptionsGlow), 90);

            currentScreenPosition     = new Vector2i(GetPositionOnCurrentLevelScreen(), 0);
            worldName.DisplayedString = "World " + GetIndexOfCurrentLevelScreen();
            mainMap.Texture           = levelSelectList[GetIndexOfCurrentLevelScreen()].texture;
            SetButtonList(mainButtonList, stars);
            levelInfo = new LevelInfo(mainButtonList[GetPositionOnCurrentLevelScreen()], new Vector2f(25, 25), stars.GetScoreOfLevel(currentLevel));
            SetCurrentLevelInfo();
        }
Esempio n. 3
0
        void MainCampaign()
        {
            levelList.Add(new Level("Assets/MapFiles/1_Gelb/Gelb01.txt", 64, new Vector2i(2, 2), 1));
            levelList.Add(new Level("Assets/MapFiles/1_Gelb/Gelb02-EinfuehrungOrdner.txt", 64, new Vector2i(2, 3), 1));
            levelList.Add(new Level("Assets/MapFiles/1_Gelb/Gelb03.txt", 64, new Vector2i(4, 3), 1));
            levelList.Add(new Level("Assets/MapFiles/1_Gelb/Gelb04.txt", 64, new Vector2i(8, 1), 1));
            levelList.Add(new Level("Assets/MapFiles/1_Gelb/Gelb05-EinfuehrungSchalter.txt", 64, new Vector2i(6, 4), 1));
            levelList.Add(new Level("Assets/MapFiles/1_Gelb/Gelb06.txt", 64, new Vector2i(7, 3), 1));
            levelList.Add(new Level("Assets/MapFiles/1_Gelb/Gelb07.txt", 64, new Vector2i(10, 4), 1));
            levelList.Add(new Level("Assets/MapFiles/1_Gelb/Gelb08.txt", 64, new Vector2i(7, 2), 1));
            levelList.Add(new Level("Assets/MapFiles/1_Gelb/Gelb09.txt", 64, new Vector2i(3, 1), 1));
            levelList.Add(new Level("Assets/MapFiles/1_Gelb/Gelb10.txt", 64, new Vector2i(4, 3), 1));
            levelList.Add(new Level("Assets/MapFiles/1_Gelb/Gelb11.05.txt", 64, new Vector2i(6, 1), 1));
            levelList.Add(new Level("Assets/MapFiles/1_Gelb/Gelb11.txt", 64, new Vector2i(7, 7), 1));

            levelList.Add(new Level("Assets/MapFiles/2_Rot/Rot01-EinfuehrungRoterBot.txt", 64, new Vector2i(8, 3), 1));
            levelList.Add(new Level("Assets/MapFiles/2_Rot/Rot02.txt", 64, new Vector2i(1, 1), 1));
            levelList.Add(new Level("Assets/MapFiles/2_Rot/Rot03.txt", 64, new Vector2i(1, 4), 1));
            levelList.Add(new Level("Assets/MapFiles/2_Rot/Rot04.txt", 64, new Vector2i(7, 2), 1));
            levelList.Add(new Level("Assets/MapFiles/2_Rot/Rot05.txt", 64, new Vector2i(5, 7), 1));
            levelList.Add(new Level("Assets/MapFiles/2_Rot/Rot06.txt", 64, new Vector2i(5, 5), 1));

            levelList.Add(new Level("Assets/MapFiles/2_Rot/TRot01-EinfuehrungTeleporter.txt", 64, new Vector2i(4, 3), 1));
            levelList.Add(new Level("Assets/MapFiles/2_Rot/TRot02.txt", 64, new Vector2i(6, 2), 1));
            levelList.Add(new Level("Assets/MapFiles/2_Rot/TRot03.txt", 64, new Vector2i(1, 6), 1));
            levelList.Add(new Level("Assets/MapFiles/2_Rot/TRot04.txt", 64, new Vector2i(1, 5), 1));
            levelList.Add(new Level("Assets/MapFiles/2_Rot/TRot05.txt", 64, new Vector2i(7, 4), 1));
            levelList.Add(new Level("Assets/MapFiles/2_Rot/TRot06.txt", 64, new Vector2i(8, 1), 1));

            levelList.Add(new Level("Assets/MapFiles/3_Gruen/Gruen01.txt", 64, new Vector2i(8, 3), 1));
            levelList.Add(new Level("Assets/MapFiles/3_Gruen/Gruen02.txt", 64, new Vector2i(4, 3), 1));
            levelList.Add(new Level("Assets/MapFiles/3_Gruen/Gruen03.txt", 64, new Vector2i(6, 4), 1));
            levelList.Add(new Level("Assets/MapFiles/3_Gruen/Gruen05.txt", 64, new Vector2i(9, 9), 1));
            levelList.Add(new Level("Assets/MapFiles/3_Gruen/Gruen06.txt", 64, new Vector2i(8, 6), 1));
            levelList.Add(new Level("Assets/MapFiles/3_Gruen/Gruen07.txt", 64, new Vector2i(4, 10), 1));
            levelList.Add(new Level("Assets/MapFiles/3_Gruen/Gruen99Laby.txt", 64, new Vector2i(3, 3), 1));


            levelList.Add(new Level("Assets/MapFiles/4_Blau/Blau01.txt", 64, new Vector2i(5, 4), 1));
            levelList.Add(new Level("Assets/MapFiles/4_Blau/Blau02.txt", 64, new Vector2i(2, 5), 1));
            levelList.Add(new Level("Assets/MapFiles/4_Blau/Blau03.txt", 64, new Vector2i(5, 5), 1));
            levelList.Add(new Level("Assets/MapFiles/4_Blau/Blau04.txt", 64, new Vector2i(4, 1), 1));
            levelList.Add(new Level("Assets/MapFiles/4_Blau/Blau05.txt", 64, new Vector2i(5, 4), 1));
            levelList.Add(new Level("Assets/MapFiles/4_Blau/Blau06.txt", 64, new Vector2i(4, 5), 1));
            levelList.Add(new Level("Assets/MapFiles/4_Blau/Blau07.txt", 64, new Vector2i(5, 3), 1));
            levelList.Add(new Level("Assets/MapFiles/4_Blau/Blau071.txt", 64, new Vector2i(10, 7), 1));
            levelList.Add(new Level("Assets/MapFiles/4_Blau/Blau08.txt", 64, new Vector2i(11, 3), 1));
            levelList.Add(new Level("Assets/MapFiles/4_Blau/Blau09.txt", 64, new Vector2i(6, 4), 1));
            levelList.Add(new Level("Assets/MapFiles/4_Blau/Blau10.txt", 64, new Vector2i(2, 5), 1));
            levelList.Add(new Level("Assets/MapFiles/4_Blau/Blau11.txt", 64, new Vector2i(10, 3), 1));
            levelList.Add(new Level("Assets/MapFiles/4_Blau/Blau12.txt", 64, new Vector2i(10, 12), 1));
            levelList.Add(new Level("Assets/MapFiles/4_Blau/Blau13.txt", 64, new Vector2i(8, 10), 1));
            levelList.Add(new Level("Assets/MapFiles/4_Blau/thankyouforplaying.txt", 64, new Vector2i(2, 4), 1));


            nextGameState = GameState.InGame;

            // manageProfiles has to load all active profiles before it can be accessed
            manageProfiles = new ManageProfiles();
            manageProfiles = manageProfiles.loadManageProfiles();
            manageStars    = new ManageStars();
            manageStars    = manageStars.loadManageStars(manageProfiles.getActiveProfileName(), levelList.Count);
            curIndex       = manageStars.getIndexOfFirstUnsolvedLevel();
            SetTutorials();
        }