コード例 #1
0
        public static void SetAlpha(byte alpha, SuperText superText)
        {
            Color help = superText.Color;

            help.A          = alpha;
            superText.Color = help;
        }
コード例 #2
0
        // crashes sometimes when loading different levels relatively fast
        /// <summary>
        /// the loading calls in this function seem to crash in some case -> be sure to handle any exceptions thrown at you!
        /// </summary>
        private void InitializeStrings()
        {
            guiScoreNumber = new SuperText("", FontLoader.Instance.LoadFont("Assets/Fonts/fixedsys.ttf"), 0.1F);
            guiScore       = new SuperText("Steps", FontLoader.Instance.LoadFont("Assets/Fonts/fixedsys.ttf"), 0.5F);
            guiScoreBox    = new Sprite(AssetManager.GetTexture(AssetManager.TextureName.HUDSteps));

            guiLevelNumber = new SuperText("", FontLoader.Instance.LoadFont("Assets/Fonts/fixedsys.ttf"), 0.1F);
            guiLevel       = new SuperText("Level", FontLoader.Instance.LoadFont("Assets/Fonts/fixedsys.ttf"), 0.5F);
            guiLevelBox    = new Sprite(AssetManager.GetTexture(AssetManager.TextureName.HUDSteps));
        }
コード例 #3
0
ファイル: Tutorial.cs プロジェクト: wookiepeter/MemoryMaze
        public Tutorial(AnimatedSprite _animSprite, String _text, Vector2 _textPosition, Vector2 _position, float _duration, int _index, int _tutIndex)
        {
            animSprite          = _animSprite;
            position            = _position;
            animSprite.Position = position;
            textPosition        = _textPosition;
            duration            = _duration;
            currentTime         = 0;
            index                   = _index;
            tutorialIndex           = _tutIndex;
            iShouldKillMyself       = false;
            superText               = new SuperText(_text, font, 0.05f);
            superText.Position      = textPosition;
            superText.CharacterSize = 48;

            maxOpacity = 200;
        }
コード例 #4
0
        public void Initialize()
        {
            // ToDo: evtl BackGround usw bearbeiten
            blackback  = new Sprite(new Texture(new Image(1280, 720, new Color(0, 0, 0, 200))));
            background = new Sprite(AssetManager.GetTexture(AssetManager.TextureName.MapBackground7));

            namel = new List <SuperText>();

            fontforall             = FontLoader.Instance.LoadFont("Assets/Fonts/fixedsys.ttf");
            Programmierer          = new SuperText("Programming \n Christian Sandkämper\n Matthis Hagen \n\n", fontforall, 0.1f);
            Programmierer.Position = new Vector2f(250, 500);
            Programmierer.Color    = Color.White;
            Programmierer.Scale    = new Vector2f(2, 2);


            Grafiker          = new SuperText("Graphic Design\n Frieder Prinz\n Jan-Cord Gerken \n\n\n", fontforall, 0.1f);
            Grafiker.Position = new Vector2f(250, 750);
            Grafiker.Color    = Color.White;
            Grafiker.Scale    = new Vector2f(2, 2);

            Musiker          = new SuperText("Music\n Title Theme: Jan-Cord Gerken \n\n", fontforall, 0.1f);
            Musiker.Position = new Vector2f(250, 1000);
            Musiker.Color    = Color.White;
            Musiker.Scale    = new Vector2f(2, 2);

            Kreativ          = new SuperText("Level Design\n Christian Sandkämper \n Vanessa Wöhner \n\n", fontforall, 0.1f);
            Kreativ.Position = new Vector2f(250, 1200);
            Kreativ.Color    = Color.White;
            Kreativ.Scale    = new Vector2f(2, 2);

            AssetsText          = new SuperText("Assets \n https://creativecommons.org/licenses/by/3.0/ \n\n", fontforall, 0.1f);
            AssetsText.Position = new Vector2f(250, 1400);
            AssetsText.Color    = Color.White;
            AssetsText.Scale    = new Vector2f(2, 2);


            SuperText[] namelist = { Musiker, Programmierer, Grafiker, Kreativ };
            namel = namelist.ToList();
            foreach (SuperText sup in namel)
            {
                sup.minFrequency = 2;
                sup.maxFrequency = 6;
            }
        }
コード例 #5
0
        public void SetNewLevel(LevelSelectButton _button, ManageStars.Rating _rating)
        {
            button = _button;
            rating = _rating;

            levelName = new SuperText("Level " + (button.buttonLevel + 1), font, 0.2f);
            levelName.CharacterSize = 50;
            levelName.Position      = position + new Vector2(23, 205);

            screenShot.Texture = AssetManager.GetScreenShot(button.buttonLevel);

            lines = new List <RectangleShape>();
            foreach (Vector2 v in cornerPositions)
            {
                lines.Add(GenerateLine(v, button.position, 2));
            }

            SetAllAphas(highlighted? 100 : 50);
        }
コード例 #6
0
        public int Update(float deltaTime, ManageStars.Rating rating, int curIndex, List <Tutorial> tutorials)
        {
            if (finished)
            {
                endAnimation.UpdateFrame(deltaTime);
                endText.Update(deltaTime);
                if (KeyboardInputManager.Downward(Keyboard.Key.Space))
                {
                    mapStatus = 1;
                }
            }
            else
            {
                background          = new Sprite(AssetManager.backgroundTextures[0]);
                background.Position = new Vector2f(0, 0);
                getBackground(curIndex);
                mapStatus   = 0;
                playerScore = player.scoreCounter;
                map.Update(deltaTime, player.keyCounter);
                player.Update(deltaTime, map);
                itemList.Update(map, player, deltaTime);
                trapHandler.Update(map, player, deltaTime);
                levelution.Update(player, map, deltaTime);
                transporterHandler.Update(player, deltaTime);
                checkTutorialNeed(rating, curIndex, tutorials);
                if (currentTutorial != null)
                {
                    currentTutorial.Update(deltaTime);
                }
                if (KeyboardInputManager.Upward(Keyboard.Key.T))
                {
                    return(3);
                }
                if (KeyboardInputManager.IsPressed(Keyboard.Key.LShift) && KeyboardInputManager.IsPressed(Keyboard.Key.LControl) && KeyboardInputManager.Upward(Keyboard.Key.Y))
                {
                    mapStatus = 1;
                }
                if (map.CellIsGoal(player.mapPosition) && player.keyCounter >= keysToUnlock)
                {
                    endSprite          = new Sprite(AssetManager.GetTexture(AssetManager.TextureName.LevelInfo));
                    endSprite.Position = new Vector2f(450, 220);
                    GraphicHelper.SetAlpha(200, endSprite);
                    SetEndMedal();
                    endMedal.Position     = endSprite.Position + new Vector2f(150, 100);
                    endAnimation          = new AnimatedSprite(AssetManager.GetTexture(AssetManager.TextureName.SpaceBar), 0.2f, 3);
                    endAnimation.Position = (Vector2)endSprite.Position + new Vector2(125, 200);
                    endText = new SuperText("Congratulations", FontLoader.Instance.LoadFont("Assets/Fonts/fixedsys.ttf"), 0.1f);
                    MusicManager.PlaySound(AssetManager.SoundName.Winning);
                    endText.Position      = (Vector2)endSprite.Position + new Vector2(20, 25);
                    endText.CharacterSize = 40;

                    finished = true;
                    addScoreFromBots();
                    CheckLevel();
                    Logger.Instance.Write("\n" + "Rating: " + playerScore + "\n" + "Bronze: " + ratingNumbers[0] + "\n" + "Silber: " + ratingNumbers[1] + "\n" + "Gold: " + ratingNumbers[2] + "\n" + "Sie haben " + CheckLevel() + " erreicht", Logger.level.Info);
                }
                if (KeyboardInputManager.Upward(Keyboard.Key.Back))
                {
                    MusicManager.StopSound();
                    foreach (Tutorial tut in tutorials)
                    {
                        if (tut.index == curIndex)
                        {
                            tut.shown = false;
                        }
                    }
                    mapStatus = 2;
                }
                guiLevelNumber.DisplayedString = "" + (curIndex + 1);
            }
            return(mapStatus);
        }
コード例 #7
0
        public void Initialisation()
        {
            MusicManager.PlayMusic(AssetManager.MusicName.MainMenu);
            stopwatch = new Stopwatch();
            stopwatch.Start();
            stopwatch1 = new Stopwatch();
            stopwatch1.Start();
            funactivJoh      = false;
            funacitvBenni    = false;
            font             = FontLoader.Instance.LoadFont("Assets/Fonts/fixedsys.ttf");
            sexyFont         = FontLoader.Instance.LoadFont("Assets/Fonts/pixelhole.ttf");
            MainTitleColor   = new Color(0, 2, 42);
            ProfileNameColor = new Color(125, 253, 108);
            MenuTextColor    = new Color(114, 217, 100);

            buttonList = new List <Button>();
            buttonList.Add(new Button(new Vector2f(575, 275), new Vector2i(0, 0), AssetManager.GetTexture(AssetManager.TextureName.ProfileButton), AssetManager.GetTexture(AssetManager.TextureName.ProfileButtonGlow)));
            buttonList.Add(new Button(new Vector2f(575, 395), new Vector2i(0, 1), AssetManager.GetTexture(AssetManager.TextureName.ProfileButton), AssetManager.GetTexture(AssetManager.TextureName.ProfileButtonGlow)));
            buttonList.Add(new Button(new Vector2f(575, 515), new Vector2i(0, 2), AssetManager.GetTexture(AssetManager.TextureName.ProfileButton), AssetManager.GetTexture(AssetManager.TextureName.ProfileButtonGlow)));
            buttonList.Add(new Button(new Vector2f(1000, 275), new Vector2i(1, 0), AssetManager.GetTexture(AssetManager.TextureName.ProfileDeleteButton), AssetManager.GetTexture(AssetManager.TextureName.ProfileDeleteButtonGlow), AssetManager.GetTexture(AssetManager.TextureName.IconDelete)));
            buttonList.Add(new Button(new Vector2f(1000, 395), new Vector2i(1, 1), AssetManager.GetTexture(AssetManager.TextureName.ProfileDeleteButton), AssetManager.GetTexture(AssetManager.TextureName.ProfileDeleteButtonGlow), AssetManager.GetTexture(AssetManager.TextureName.IconDelete)));
            buttonList.Add(new Button(new Vector2f(1000, 515), new Vector2i(1, 2), AssetManager.GetTexture(AssetManager.TextureName.ProfileDeleteButton), AssetManager.GetTexture(AssetManager.TextureName.ProfileDeleteButtonGlow), AssetManager.GetTexture(AssetManager.TextureName.IconDelete)));
            buttonList.Add(new Button(new Vector2f(750, 645), new Vector2i(0, 3), AssetManager.GetTexture(AssetManager.TextureName.ProfileDeleteButton), AssetManager.GetTexture(AssetManager.TextureName.ProfileDeleteButtonGlow), AssetManager.GetTexture(AssetManager.TextureName.IconOptions)));
            buttonList.Add(new Button(new Vector2f(880, 645), new Vector2i(1, 3), AssetManager.GetTexture(AssetManager.TextureName.ProfileDeleteButton), AssetManager.GetTexture(AssetManager.TextureName.ProfileDeleteButtonGlow), AssetManager.GetTexture(AssetManager.TextureName.IconCredits)));
            buttonList.Add(new Button(new Vector2f(1000, 645), new Vector2i(2, 3), AssetManager.GetTexture(AssetManager.TextureName.ProfileDeleteButton), AssetManager.GetTexture(AssetManager.TextureName.ProfileDeleteButtonGlow), AssetManager.GetTexture(AssetManager.TextureName.IconExit)));

            gameTitle                = "RAMification!";
            currentTitleString       = "";
            currentlyAppendedLetters = "012";
            currentDeltaSum          = 0;

            // Witze hahahahhahaha witzig f****t....stfu das ist witzig..ne ist es nicht...ohh mr. Ernst! :/
            funBenni               = new Text("Benni heisst Online: KleinerHoden, hihi", font);
            funBenni.Position      = new Vector2f(800, 250);
            funBenni.CharacterSize = 30;
            funBenni.Color         = Color.Red;
            funBenni.Rotation      = 45;

            //Initializiere alle Texte
            gameName               = new SuperText("", sexyFont, 0.1f);
            gameName.Position      = new Vector2f(55, -65);
            gameName.CharacterSize = 240;
            gameName.Color         = MainTitleColor;

            profileOneText               = new SuperText(profiles.getProfileName(MemoryMaze.profiles.one), font, 0.15f);
            profileOneText.Position      = new Vector2f(240, 250);
            profileOneText.CharacterSize = 58;

            profileOnePercentage               = new SuperText("", font, 0.15f);
            profileOnePercentage.Position      = new Vector2f(775, 250);
            profileOnePercentage.CharacterSize = 58;

            profileTwoText               = new SuperText(profiles.getProfileName(MemoryMaze.profiles.two), font, 0.15f);
            profileTwoText.Position      = new Vector2f(240, 370);
            profileTwoText.CharacterSize = 58;

            profileTwoPercentage               = new SuperText("", font, 0.15f);
            profileTwoPercentage.Position      = new Vector2f(775, 370);
            profileTwoPercentage.CharacterSize = 58;

            profileThreeText               = new SuperText(profiles.getProfileName(MemoryMaze.profiles.three), font, 0.15f);
            profileThreeText.Position      = new Vector2f(240, 490);
            profileThreeText.CharacterSize = 58;

            ProfileThreePercentage               = new SuperText("", font, 0.15f);
            ProfileThreePercentage.Position      = new Vector2f(775, 490);
            ProfileThreePercentage.CharacterSize = 58;

            superTextList = new List <SuperText> {
                profileOneText, profileTwoText, profileThreeText, profileOnePercentage, profileTwoPercentage, ProfileThreePercentage
            };

            currentScreenPosition = new Vector2i(0, 0);

            UpdateProfilePercentage();
        }
コード例 #8
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();
        }