コード例 #1
0
ファイル: KeyboardInput.cs プロジェクト: Stanimir-b/Youkai
 public void Update(GameTime gameTime, TextBox inpuTextBox)
 {
     this.currentKeyboardState = Keyboard.GetState();
     this.boxSelected = inpuTextBox.Selected;
     foreach (Keys key in this.keysToCheck)
     {
         if (this.CheckKey(key))
         {
             this.AddKeyToText(key);
             break;
         }
     }
     this.lastKeyboardState = this.currentKeyboardState;
 }
コード例 #2
0
ファイル: KeyboardInput.cs プロジェクト: Stanimir-b/Youkai
 public KeyboardInput(TextBox inputTextBox)
 {
     this.PrintedText = "";
     this.Subscriber = inputTextBox;
 }
コード例 #3
0
        protected override void LoadContent()
        {
            mBackground = new Background(1);
            var mainMenuBackground = MGame.Content.Load<Texture2D>("Sprites/Backgrounds/MainMenuBackground");
            mBackground.Load(MGame.GraphicsDevice, mainMenuBackground);

            offerSelectionTexture = MGame.Content.Load<Texture2D>("Sprites/UI/CC_hero_selection_texture");
            offerSelectionSprite = new StillSprite(offerSelectionTexture);
            offerSelectionSprite.Position = new
                Vector2(MGame.GraphicsDevice.Viewport.Width / 2 - offerSelectionTexture.Width / 2, 80);

            //font
            font = MGame.Content.Load<SpriteFont>("Fonts/YoukaiFont");

            forwardReg = MGame.Content.Load<Texture2D>("Sprites/UI/CC_ForwardButton");
            forwardHover = MGame.Content.Load<Texture2D>("Sprites/UI/CC_ForwardButton_hover");
            forwardButton = new Button(forwardReg, forwardHover);
            forwardButton.SetPosition(new Vector2(740, 420));
            confirmationSignTexture = MGame.Content.Load<Texture2D>("Sprites/UI/CC_ConfirmationTexture");
            confirmationSprite = new StillSprite(confirmationSignTexture) { Position = new Vector2(580, 420) };
            samButtonReg = MGame.Content.Load<Texture2D>("Sprites/UI/CC_sam_sel_reg");
            samButtonHover = MGame.Content.Load<Texture2D>("Sprites/UI/CC_sam_sel_hov");
            monButtonReg = MGame.Content.Load<Texture2D>("Sprites/UI/CC_mon_sel_reg");
            monButtonHover = MGame.Content.Load<Texture2D>("Sprites/UI/CC_mon_sel_hov");
            ninButtonReg = MGame.Content.Load<Texture2D>("Sprites/UI/CC_nin_sel_reg");
            ninButtonHover = MGame.Content.Load<Texture2D>("Sprites/UI/CC_nin_sel_hov");

            showSamurai = new Button(samButtonReg, samButtonHover);
            showSamurai.SetPosition(new
                Vector2(MGame.GraphicsDevice.Viewport.Width / 4 - samButtonReg.Width / 2, 150));
            showMonk = new Button(monButtonReg, monButtonHover);
            showMonk.SetPosition(new
                Vector2(MGame.GraphicsDevice.Viewport.Width / 2 - monButtonReg.Width / 2, 150));
            showNinja = new Button(ninButtonReg, ninButtonHover);
            showNinja.SetPosition(new
                Vector2(MGame.GraphicsDevice.Viewport.Width -
                    MGame.GraphicsDevice.Viewport.Width / 4 - ninButtonReg.Width / 2, 150));

            showSamurai.EnteringSelection += PlaySound;
            showMonk.EnteringSelection += PlaySound;
            showNinja.EnteringSelection += PlaySound;
            forwardButton.EnteringSelection += PlaySound;

            classTextVector = new Vector2(300, 350);
            samuraiRep = MGame.Content.Load<Texture2D>("Sprites/playerClasses/Male_Samurai_Representation");
            monkRep = MGame.Content.Load<Texture2D>("Sprites/playerClasses/Male_Monk_Representation");
            ninjaRep = MGame.Content.Load<Texture2D>("Sprites/playerClasses/Female_Ninja_Representation");

            representation = new StillSprite(samuraiRep)
            {
                Position = new Vector2(MGame.GraphicsDevice.Viewport.Width / 4 - 60, 200)
            };

            textBackgroundTexture = MGame.Content.Load<Texture2D>("Sprites/UI/CC_text_frame");
            textBackgroundSprite = new StillSprite(textBackgroundTexture)
            {
                Position = new
                    Vector2(MGame.GraphicsDevice.Viewport.Width / 4 + samuraiRep.Width / 2 + 40, 200)
            };

            classTextVector = new
                Vector2(MGame.GraphicsDevice.Viewport.Width / 4 + samuraiRep.Width / 2 + 50, 210);

            string desc = string.Concat(
                "INITIAL STATS\n",
                "Health: {0}\n",
                "Mana: {1}\n",
                "Attack: {2}\n",
                "Armor: {3}\n",
                "Starting weapon: {4}");

            this.descriptionSam = new StringBuilder();
            this.descriptionSam.AppendLine(
                string.Format(
                    desc,
                    Samurai.DefaultSamuraiHealth,
                    Samurai.DefaultSamuraiMana,
                    Samurai.DefaultSamuraiArmor,
                    Samurai.DefaultSamuraiDamage,
                    "One-handed sword"));

            this.descriptionMon = new StringBuilder();
            this.descriptionMon.AppendLine(
               string.Format(
                   desc,
                   Monk.DefaultMonkHealth,
                   Monk.DefaultMonkMana,
                   Monk.DefaultMonkArmor,
                   Monk.DefaultMonkDamage,
                   "Staff"));

            this.descriptionNin = new StringBuilder();
            this.descriptionNin.AppendLine(
               string.Format(
                   desc,
                   Ninja.DefaultNinjaHealth,
                   Ninja.DefaultNinjaMana,
                   Ninja.DefaultNinjaArmor,
                   Ninja.DefaultNinjaDamage,
                   "One-handed dagger"));

            currentClass = CharacterType.Samurai;
            showSamurai.IsSelected = true;

            nameLabelTexture = MGame.Content.Load<Texture2D>("Sprites/UI/CC_NameLabel");
            nameLabel = new StillSprite(nameLabelTexture) { Position = new Vector2(20, 405) };
            nameInputTexture = MGame.Content.Load<Texture2D>("Sprites/UI/CC_name_input");
            nameInputTextbox = new TextBox(nameInputTexture, font);
            nameInputTextbox.SetPosition(new Vector2(107, 400));
            typedText = "";
            input = new KeyboardInput(nameInputTextbox);
        }