コード例 #1
0
ファイル: Pax4Button.cs プロジェクト: pax7/LavaAndIce
        public void SetText(String p_text, Vector2 p_position)
        {
            if (_textSprite == null)
            {
                return;
            }

            _textSprite.SetText(p_text);
            _textSprite.SetPosition(p_position);
        }
コード例 #2
0
        public Pax4UiLavaAndIceMissionTimer(String p_name, Pax4Sprite p_parent)
            : base(p_name, p_parent)
        {
            String     textureName = null;
            Texture2D  texture     = null;
            Pax4Sprite sprite      = null;

            float scale = 1.0f;

            textureName = "Sprite/lavaandiceInGameFgTimer";
            texture     = Pax4Texture2D._current.Get(textureName);
            sprite      = new Pax4SpriteTexture("normalTimer", this);
            ((Pax4SpriteTexture)sprite).SetTexture(texture);
            _normalSprite = (Pax4SpriteTexture)sprite;

            textureName = "Sprite/lavaandiceInGameFgTimerYellow";
            texture     = Pax4Texture2D._current.Get(textureName);
            sprite      = new Pax4SpriteTexture("alarmTimer", this);
            ((Pax4SpriteTexture)sprite).SetTexture(texture);
            _alarmSpriteYellow = (Pax4SpriteTexture)sprite;

            textureName = "Sprite/lavaandiceInGameFgTimerRed";
            texture     = Pax4Texture2D._current.Get(textureName);
            sprite      = new Pax4SpriteTexture("alarmTimer", this);
            ((Pax4SpriteTexture)sprite).SetTexture(texture);
            _alarmSpriteRed = (Pax4SpriteTexture)sprite;

            //timer value
            Vector2 position = new Vector2(11.0f, 9.0f);

            sprite = new Pax4SpriteText("timerValue", this);
            scale  = 0.76f;
            sprite.SetPosition(position);
            sprite.SetColor(Color.GreenYellow);
            ((Pax4SpriteText)sprite).SetSpriteFont("SpriteFont/ArialBold");
            ((Pax4SpriteText)sprite).SetScale(scale);
            _timerValue = sprite;
        }
コード例 #3
0
        public Pax4ButtonLavaAndIceQuest(String p_name, Pax4Sprite p_parent, String p_questName)
            : base(p_name, p_parent)
        {
            _questButton.Add(this);

            _questName = p_questName;

            _sprite = new List <Pax4Sprite>();

            Pax4Sprite sprite = null;
            Vector2    position;
            float      scale;

            float xpos  = 0.0f;
            float xstep = 0.0f;
            float xoff  = 0.0f;

            float ypos  = 0.0f;
            float ystep = 0.0f;
            float yoff  = 0.0f;

            #region scores

            //title
            sprite     = new Pax4SpriteText(p_name + "_Text", this);
            position.X = 0f; //120.0f;
            position.Y = 0f; //250.0f;
            scale      = 1.0f;
            sprite.SetPosition(position);
            sprite.SetColor(Color.White);
            ((Pax4SpriteText)sprite).SetSpriteFont("SpriteFont/Livingstone");
            ((Pax4SpriteText)sprite).SetScale(scale);
            _textSprite = (Pax4SpriteText)sprite;

            //pct completed
            sprite = new Pax4SpriteText("pctCompleted", this);
            //position.X = 140.0f;//50
            //position.Y = 82.0f;//20
            scale = 0.45f;
            sprite.SetPosition(position);
            sprite.SetColor(Color.White);
            ((Pax4SpriteText)sprite).SetSpriteFont("SpriteFont/ArialBold");
            ((Pax4SpriteText)sprite).SetScale(scale);
            ((Pax4SpriteText)sprite).SetText("% completed");
            _sprite.Add(sprite);

            //pct completed value
            sprite = new Pax4SpriteText("pctCompletedValue", this);
            //position.X = 176.0f;
            //position.Y = 40.0f;
            scale = 1.0f;
            sprite.SetPosition(position);
            sprite.SetColor(Color.GreenYellow);
            ((Pax4SpriteText)sprite).SetSpriteFont("SpriteFont/ArialBold");
            ((Pax4SpriteText)sprite).SetScale(scale);
            _sprite.Add(sprite);
            _pctCompletedValue = sprite;

            //Total Score
            xpos   = 30.0f;
            ypos   = 260.0f;
            ystep  = 20.0f;
            sprite = new Pax4SpriteText("totalScore", this);
            //position.X = xpos;
            //position.Y = ypos; ypos += ystep;
            scale = 0.41f;
            sprite.SetPosition(position);
            sprite.SetColor(Color.White);
            ((Pax4SpriteText)sprite).SetSpriteFont("SpriteFont/ArialBold");
            ((Pax4SpriteText)sprite).SetScale(scale);
            ((Pax4SpriteText)sprite).SetText("Total Score");
            _sprite.Add(sprite);

            //Total Score value
            sprite = new Pax4SpriteText("totalScoreValue", this);
            //position.X = xpos;
            //position.Y = ypos; ypos += ystep;
            scale = 0.41f;
            sprite.SetPosition(position);
            sprite.SetColor(Color.GreenYellow);
            ((Pax4SpriteText)sprite).SetSpriteFont("SpriteFont/ArialBold");
            ((Pax4SpriteText)sprite).SetScale(scale);
            _sprite.Add(sprite);
            _totalScoreValue = sprite;

            //Last Score
            sprite = new Pax4SpriteText("lastScore", this);
            //position.X = xpos;
            //position.Y = ypos; ypos += ystep;
            scale = 0.41f;
            sprite.SetPosition(position);
            sprite.SetColor(Color.White);
            ((Pax4SpriteText)sprite).SetSpriteFont("SpriteFont/ArialBold");
            ((Pax4SpriteText)sprite).SetScale(scale);
            ((Pax4SpriteText)sprite).SetText("Last Score");
            _sprite.Add(sprite);

            //Last Score value
            sprite = new Pax4SpriteText("lastScoreValue", this);
            //position.X = xpos;
            //position.Y = ypos; ypos += ystep;
            scale = 0.41f;
            sprite.SetPosition(position);
            sprite.SetColor(Color.GreenYellow);
            ((Pax4SpriteText)sprite).SetSpriteFont("SpriteFont/ArialBold");
            ((Pax4SpriteText)sprite).SetScale(scale);
            _sprite.Add(sprite);
            _lastScoreValue = sprite;

            ////Kills
            //sprite = new Pax4SpriteText("kills", this);
            //position.X = 160.0f;
            //position.Y = 370.0f;
            //scale = 0.3f;
            //sprite.SetPosition(position);
            //sprite.SetColor(Color.White);
            //((Pax4SpriteText)sprite).SetSpriteFont("SpriteFont/ArialBold");
            //((Pax4SpriteText)sprite).SetScale(scale);
            //((Pax4SpriteText)sprite).SetText(_kills);
            //_sprite.Add(sprite);

            xpos  = 160.0f;
            ypos  = 247.0f;
            ystep = 18;
            //lava
            sprite = new Pax4SpriteText("lavaKills", this);
            //position.X = xpos;
            //position.Y = ypos; ypos += ystep;
            scale = 0.39f;
            sprite.SetPosition(position);
            sprite.SetColor(Color.Red);
            ((Pax4SpriteText)sprite).SetSpriteFont("SpriteFont/ArialBold");
            ((Pax4SpriteText)sprite).SetScale(scale);
            ((Pax4SpriteText)sprite).SetText("lava kills");
            _sprite.Add(sprite);

            //lava value
            sprite = new Pax4SpriteText("lavaKillsValue", this);
            //position.X = xpos + 20.0f;
            //position.Y = ypos; ypos += ystep;
            scale = 0.39f;
            sprite.SetPosition(position);
            sprite.SetColor(Color.GreenYellow);
            ((Pax4SpriteText)sprite).SetSpriteFont("SpriteFont/ArialBold");
            ((Pax4SpriteText)sprite).SetScale(scale);
            _sprite.Add(sprite);
            _lavaKillsValue = sprite;

            //ice
            sprite = new Pax4SpriteText("iceKills", this);
            //position.X = xpos;
            //position.Y = ypos; ypos += ystep;
            scale = 0.39f;
            sprite.SetPosition(position);
            sprite.SetColor(Color.Cyan);
            ((Pax4SpriteText)sprite).SetSpriteFont("SpriteFont/ArialBold");
            ((Pax4SpriteText)sprite).SetScale(scale);
            ((Pax4SpriteText)sprite).SetText("ice kills");
            _sprite.Add(sprite);

            //ice value
            sprite = new Pax4SpriteText("iceKillsValue", this);
            //position.X = xpos + 20.0f;
            //position.Y = ypos; ypos += ystep;
            scale = 0.39f;
            sprite.SetPosition(position);
            sprite.SetColor(Color.GreenYellow);
            ((Pax4SpriteText)sprite).SetSpriteFont("SpriteFont/ArialBold");
            ((Pax4SpriteText)sprite).SetScale(scale);
            _sprite.Add(sprite);
            _iceKillsValue = sprite;

            //monsters
            sprite = new Pax4SpriteText("monsterKills", this);
            //position.X = xpos;
            //position.Y = ypos; ypos += ystep;
            scale = 0.39f;
            sprite.SetPosition(position);
            sprite.SetColor(Color.OrangeRed);
            ((Pax4SpriteText)sprite).SetSpriteFont("SpriteFont/ArialBold");
            ((Pax4SpriteText)sprite).SetScale(scale);
            ((Pax4SpriteText)sprite).SetText("monster kills");
            _sprite.Add(sprite);

            //monsters value
            sprite = new Pax4SpriteText("monsterKillsValue", this);
            //position.X = xpos + 20.0f;
            //position.Y = ypos; ypos += ystep;
            scale = 0.39f;
            sprite.SetPosition(position);
            sprite.SetColor(Color.GreenYellow);
            ((Pax4SpriteText)sprite).SetSpriteFont("SpriteFont/ArialBold");
            ((Pax4SpriteText)sprite).SetScale(scale);
            _sprite.Add(sprite);
            _monsterKillsValue = sprite;

            #endregion //scores

            #region medals

            //String textureName = null;
            //Texture2D texture = null;

            xpos  = 58.0f;
            xoff  = 24.0f;
            xstep = 48.0f;
            ypos  = 152.0f;
            yoff  = 26.0f;

            sprite = new Pax4SpriteTexture("nightmare", this);
            sprite.SetPosition(new Vector2(xpos, ypos));
            _sprite.Add(sprite);
            _nightmareMedal = sprite;

            sprite     = new Pax4SpriteText("nightmareCount", this);
            position.X = xpos + xoff;
            position.Y = ypos + yoff;
            scale      = 0.4f;
            sprite.SetPosition(position);
            sprite.SetColor(Color.White);
            ((Pax4SpriteText)sprite).SetSpriteFont("SpriteFont/ArialBold");
            ((Pax4SpriteText)sprite).SetScale(scale);
            _sprite.Add(sprite);
            _nightmareMedalCount = sprite;

            xpos += xstep;

            sprite = new Pax4SpriteTexture("hard", this);
            sprite.SetPosition(new Vector2(xpos, ypos));
            _sprite.Add(sprite);
            _hardMedal = sprite;

            sprite     = new Pax4SpriteText("hardCount", this);
            position.X = xpos + xoff;
            position.Y = ypos + yoff;
            scale      = 0.4f;
            sprite.SetPosition(position);
            sprite.SetColor(Color.White);
            ((Pax4SpriteText)sprite).SetSpriteFont("SpriteFont/ArialBold");
            ((Pax4SpriteText)sprite).SetScale(scale);
            _sprite.Add(sprite);
            _hardMedalCount = sprite;

            xpos += xstep;

            sprite = new Pax4SpriteTexture("normal", this);
            sprite.SetPosition(new Vector2(xpos, ypos));
            _sprite.Add(sprite);
            _normalMedal = sprite;

            sprite     = new Pax4SpriteText("normalCount", this);
            position.X = xpos + xoff;
            position.Y = ypos + yoff;
            scale      = 0.4f;
            sprite.SetPosition(position);
            sprite.SetColor(Color.White);
            ((Pax4SpriteText)sprite).SetSpriteFont("SpriteFont/ArialBold");
            ((Pax4SpriteText)sprite).SetScale(scale);
            _sprite.Add(sprite);
            _normalMedalCount = sprite;

            xpos += xstep;

            sprite = new Pax4SpriteTexture("easy", this);
            sprite.SetPosition(new Vector2(xpos, ypos));
            _sprite.Add(sprite);
            _easyMedal = sprite;

            sprite     = new Pax4SpriteText("easyCount", this);
            position.X = xpos + xoff;
            position.Y = ypos + yoff;
            scale      = 0.4f;
            sprite.SetPosition(position);
            sprite.SetColor(Color.White);
            ((Pax4SpriteText)sprite).SetSpriteFont("SpriteFont/ArialBold");
            ((Pax4SpriteText)sprite).SetScale(scale);
            _sprite.Add(sprite);
            _easyMedalCount = sprite;

            #endregion //medals
        }
コード例 #4
0
        public Pax4UiStateLavaAndIceMission(String p_name, Pax4Ui p_ui, Pax4WorldLavaAndIce.ELavaAndIceMissionType p_missionType = Pax4WorldLavaAndIce.ELavaAndIceMissionType._LAVA_AND_ICE)
            : base(p_name, p_ui)
        {
            //_blendState = BlendState.AlphaBlend;

            String     textureName = null;
            Texture2D  texture     = null;
            Pax4Sprite sprite      = null;
            Pax4Sprite scoreSprite = null;
            Vector2    position;

            float duration = 0.3f;
            //float delay = 0.0f;
            Pax4SpriteColorModifier colorModifierEnter = new Pax4SpriteColorModifier("", null);

            colorModifierEnter.Ini(Color.Black, Color.White, duration);
            AddStateEnterModifier(colorModifierEnter);
            Pax4SpriteColorModifier colorModifierExit = new Pax4SpriteColorModifier("", null);

            colorModifierExit.Ini(Color.White, Color.Black, duration);
            AddStateExitModifier(colorModifierExit);

            Pax4SpriteAlphaModifier alphaModifierEnter = new Pax4SpriteAlphaModifier("", null);

            alphaModifierEnter.Ini(0.0f, 1.0f, duration);
            AddStateEnterModifier(alphaModifierEnter);
            Pax4SpriteAlphaModifier alphaModifierExit = new Pax4SpriteAlphaModifier("", null);

            alphaModifierExit.Ini(1.0f, 0.0f, duration);
            AddStateExitModifier(alphaModifierExit);

            //Pax4SpriteColorModifier colorModifier = null;
            //Pax4SpriteAlphaModifier alphaModifier = null;
            Pax4SpritePositionModifier positionModifier = null;
            //Pax4SpriteTextModifier textModifier = null;
            Pax4SpriteTextNumberModifier textNumberModifier = null;

            position.X  = 0.1f;
            position.Y  = 0.1f;
            textureName = "Sprite/lavaandiceInGameFgScore";
            texture     = Pax4Texture2D._current.Get(textureName);
            sprite      = new Pax4SpriteTexture("top", null);
            ((Pax4SpriteTexture)sprite).SetTexture(texture);
            sprite.SetPosition(position);
            AddChild(sprite);
            scoreSprite = sprite;
            colorModifierEnter.AddChild(sprite);
            colorModifierExit.AddChild(sprite);
            alphaModifierEnter.AddChild(sprite);
            alphaModifierExit.AddChild(sprite);

            textureName = "Sprite/lavaandiceInGameFgBottom";
            texture     = Pax4Texture2D._current.Get(textureName);
            sprite      = new Pax4SpriteTexture("bottom", null);
            ((Pax4SpriteTexture)sprite).SetTexture(texture);
            position.X = 0.1f;
            position.Y = 0.2f;
            sprite.SetPosition(position);
            AddChild(sprite);
            colorModifierEnter.AddChild(sprite);
            colorModifierExit.AddChild(sprite);
            alphaModifierEnter.AddChild(sprite);
            alphaModifierExit.AddChild(sprite);

            position.Y = 0.3f;
            position.X = 0.4f;

            if (p_missionType == Pax4WorldLavaAndIce.ELavaAndIceMissionType._LAVA || p_missionType == Pax4WorldLavaAndIce.ELavaAndIceMissionType._LAVA_AND_ICE)
            {
                textureName = "Sprite/lavaandiceInGameFgLavaLauncher";
                texture     = Pax4Texture2D._current.Get(textureName);
                sprite      = new Pax4ToggleButton("lavaLauncher", null);
                ((Pax4SpriteTexture)sprite).SetTexture(texture);

                textureName = "Sprite/lavaandiceInGameFgLavaLauncherOver";
                texture     = Pax4Texture2D._current.Get(textureName);
                ((Pax4ToggleButton)sprite).SetTextureOver(texture);

                ((Pax4ToggleButton)sprite).SetOnClick(lavaandiceLavaLauncher_Click);
                ((Pax4ToggleButton)sprite).ToggleEnabled(false);

                _lavaLauncher = (Pax4ToggleButton)sprite;

                //if (Pax4Camera._backBufferWidth > 480)
                //{
                //    if (p_missionType == Pax4WorldLavaAndIce.ELavaAndIceMissionType._LAVA_AND_ICE)
                //        position.X = 127.0f;
                //}
                //else if (Pax4Camera._backBufferWidth == 480)
                //{
                //    if (p_missionType == Pax4WorldLavaAndIce.ELavaAndIceMissionType._LAVA_AND_ICE)
                //        position.X = 130.0f;
                //}
                //else if (Pax4Camera._backBufferWidth <= 320)
                //{
                //    if (p_missionType == Pax4WorldLavaAndIce.ELavaAndIceMissionType._LAVA_AND_ICE)
                //        position.X = 137.0f;
                //}
                sprite.SetPosition(position);
                AddChild(sprite);
                colorModifierEnter.AddChild(sprite);
                colorModifierExit.AddChild(sprite);
                alphaModifierEnter.AddChild(sprite);
                alphaModifierExit.AddChild(sprite);
            }

            if (p_missionType == Pax4WorldLavaAndIce.ELavaAndIceMissionType._ICE || p_missionType == Pax4WorldLavaAndIce.ELavaAndIceMissionType._LAVA_AND_ICE)
            {
                textureName = "Sprite/lavaandiceInGameFgIceLauncher";
                texture     = Pax4Texture2D._current.Get(textureName);
                sprite      = new Pax4ToggleButton("iceLauncher", null);
                ((Pax4SpriteTexture)sprite).SetTexture(texture);

                textureName = "Sprite/lavaandiceInGameFgIceLauncherOver";
                texture     = Pax4Texture2D._current.Get(textureName);
                ((Pax4ToggleButton)sprite).SetTextureOver(texture);

                ((Pax4ToggleButton)sprite).SetOnClick(lavaandiceIceLauncher_Click);
                ((Pax4ToggleButton)sprite).ToggleEnabled(false);

                _iceLauncher = (Pax4ToggleButton)sprite;

                //position.X = 0.4;

                //if (Pax4Camera._backBufferWidth > 480)
                //{
                //    if (p_missionType == Pax4WorldLavaAndIce.ELavaAndIceMissionType._LAVA_AND_ICE)
                //        position.X = 263.0f;
                //}
                //else if (Pax4Camera._backBufferWidth == 480)
                //{
                //    if (p_missionType == Pax4WorldLavaAndIce.ELavaAndIceMissionType._LAVA_AND_ICE)
                //        position.X = 260.0f;
                //}
                //else if (Pax4Camera._backBufferWidth <= 320)
                //{
                //    if (p_missionType == Pax4WorldLavaAndIce.ELavaAndIceMissionType._LAVA_AND_ICE)
                //        position.X = 253.0f;
                //}
                sprite.SetPosition(position);
                AddChild(sprite);
                colorModifierEnter.AddChild(sprite);
                colorModifierExit.AddChild(sprite);
                alphaModifierEnter.AddChild(sprite);
                alphaModifierExit.AddChild(sprite);
            }

            textureName = "Sprite/lavaandiceInGameMenuBtn";
            texture     = Pax4Texture2D._current.Get(textureName);
            sprite      = new Pax4Button("menu", null);
            ((Pax4Button)sprite).SetTexture(texture);
            position.X = 0.7f;
            position.Y = 0.1f;
            sprite.SetPosition(position);
            textureName = "Sprite/lavaandiceInGameMenuBtnOver";
            texture     = Pax4Texture2D._current.Get(textureName);
            ((Pax4Button)sprite).SetTextureOver(texture);
            ((Pax4Button)sprite).SetOnClick(this.lavaandiceMenuBtn_Click);
            AddChild(sprite);
            colorModifierEnter.AddChild(sprite);
            colorModifierExit.AddChild(sprite);
            alphaModifierEnter.AddChild(sprite);
            alphaModifierExit.AddChild(sprite);

            textureName = "Sprite/lavaandiceInGamePauseBtn";
            texture     = Pax4Texture2D._current.Get(textureName);
            sprite      = new Pax4ToggleButton("pause", null);
            ((Pax4Button)sprite).SetTexture(texture);
            position.X = 0.3f;
            position.Y = 0.3f;
            sprite.SetPosition(position);
            textureName = "Sprite/lavaandiceInGamePauseBtnOver";
            texture     = Pax4Texture2D._current.Get(textureName);
            ((Pax4Button)sprite).SetTextureOver(texture);
            ((Pax4Button)sprite).SetOnClick(this.lavaandicePauseBtn_Click);
            AddChild(sprite);
            colorModifierEnter.AddChild(sprite);
            colorModifierExit.AddChild(sprite);
            alphaModifierEnter.AddChild(sprite);
            alphaModifierExit.AddChild(sprite);

            //position.X = -20.0f;
            //position.Y = 45.0f;
            position.X = 64.0f;
            position.Y = 47.0f;
            sprite     = new Pax4UiLavaAndIceMissionThermometer("thermometer", null);
            sprite.SetPosition(position);
            AddChild(sprite);

            position.X = 0.0f;
            position.Y = 0.0f;
            sprite     = new Pax4UiLavaAndIceMissionHealth("health", null);
            sprite.SetPosition(position);
            AddChild(sprite);

            position.X = 8.0f;
            position.Y = 52.0f;
            sprite     = new Pax4UiLavaAndIceMissionTimer("timer", null);
            sprite.SetPosition(position);
            AddChild(sprite);
            _missionTimer = (Pax4UiLavaAndIceMissionTimer)sprite;

            Vector2 position1 = new Vector2(-150, 52);

            position1 *= Pax4Camera._current._scale2;

            position        *= Pax4Camera._current._scale2;
            positionModifier = new Pax4SpritePositionModifier("", null);
            positionModifier.Ini(position1, position, 0.2f);
            positionModifier.AddChild(sprite);
            AddStateEnterModifier(positionModifier);

            position        *= Pax4Camera._current._scale2;
            positionModifier = new Pax4SpritePositionModifier("", null);
            positionModifier.AddChild(sprite);
            positionModifier.Ini(position, position1, 0.2f);
            AddStateExitModifier(positionModifier);

            //**************************************************
            //create text sprites
            //**************************************************
            float xpos = 0.0f;
            //float xstep = 0.0f;
            //float xoff = 0.0f;

            float ypos  = 0.0f;
            float ystep = 0.0f;
            //float yoff = 0.0f;

            float scale;

            //Score
            xpos       = 91.0f;
            ypos       = 4.0f;
            ystep      = 22.0f;
            sprite     = new Pax4SpriteText("score", scoreSprite);
            position.X = xpos;
            position.Y = ypos; ypos += ystep;
            scale      = 0.40f;
            sprite.SetPosition(position);
            sprite.SetColor(Color.White);
            ((Pax4SpriteText)sprite).SetSpriteFont("SpriteFont/ArialBold");
            ((Pax4SpriteText)sprite).SetScale(scale);
            ((Pax4SpriteText)sprite).SetText("Score:");
            AddChild(sprite);
            colorModifierEnter.AddChild(sprite);
            colorModifierExit.AddChild(sprite);
            alphaModifierEnter.AddChild(sprite);
            alphaModifierExit.AddChild(sprite);

            //Score value
            xpos       = 145.0f;
            ypos       = 4.0f;
            sprite     = new Pax4SpriteText("scoreValue", scoreSprite);
            position.X = xpos;
            position.Y = ypos; ypos += ystep;
            scale      = 0.45f;
            sprite.SetPosition(position);
            sprite.SetColor(Color.GreenYellow);
            ((Pax4SpriteText)sprite).SetSpriteFont("SpriteFont/ArialBold");
            ((Pax4SpriteText)sprite).SetScale(scale);
            ((Pax4SpriteText)sprite).SetText("0");
            AddChild(sprite);
            _scoreSprite = sprite;
            colorModifierEnter.AddChild(sprite);
            colorModifierExit.AddChild(sprite);
            alphaModifierEnter.AddChild(sprite);
            alphaModifierExit.AddChild(sprite);

            textNumberModifier = new Pax4SpriteTextNumberModifier("", null);
            textNumberModifier.AddChild(sprite);
            AddStateEnterModifier(textNumberModifier);
            _scoreSpriteModifier = textNumberModifier;

            //High Score
            xpos       = 81.0f;
            sprite     = new Pax4SpriteText("highScore", scoreSprite);
            position.X = xpos;
            position.Y = ypos;
            scale      = 0.35f;
            sprite.SetPosition(position);
            sprite.SetColor(Color.White);
            ((Pax4SpriteText)sprite).SetSpriteFont("SpriteFont/ArialBold");
            ((Pax4SpriteText)sprite).SetScale(scale);
            ((Pax4SpriteText)sprite).SetText("High Score:");
            AddChild(sprite);
            colorModifierEnter.AddChild(sprite);
            colorModifierExit.AddChild(sprite);
            alphaModifierEnter.AddChild(sprite);
            alphaModifierExit.AddChild(sprite);

            //High Score value
            xpos       = 161.0f;
            ypos       = ypos - 1.0f;
            sprite     = new Pax4SpriteText("highScoreValue", scoreSprite);
            position.X = xpos;
            position.Y = ypos;
            scale      = 0.40f;
            sprite.SetPosition(position);
            sprite.SetColor(Color.GreenYellow);
            ((Pax4SpriteText)sprite).SetSpriteFont("SpriteFont/ArialBold");
            ((Pax4SpriteText)sprite).SetScale(scale);
            ((Pax4SpriteText)sprite).SetText("0");
            AddChild(sprite);
            _highScoreSprite = sprite;
            colorModifierEnter.AddChild(sprite);
            colorModifierExit.AddChild(sprite);
            alphaModifierEnter.AddChild(sprite);
            alphaModifierExit.AddChild(sprite);

            //**************************************************
            //create medal sprites
            //**************************************************
            if (_medalSprite == null)
            {
                _medalSprite = new Dictionary <String, Pax4Sprite>();
            }
            else
            {
                return;
            }

            Dictionary <String, String> _medal = new Dictionary <String, String>();

            _medal.Add("nightmareOn", "Sprite/lavaandiceNightmareOn");
            //_medal.Add("nightmareOff", "Sprite/lavaandiceNightmareOff");
            _medal.Add("hardOn", "Sprite/lavaandiceHardOn");
            //_medal.Add("hardOff", "Sprite/lavaandiceHardOff");
            _medal.Add("normalOn", "Sprite/lavaandiceNormalOn");
            //_medal.Add("normalOff", "Sprite/lavaandiceNormalOff");
            _medal.Add("easyOn", "Sprite/lavaandiceEasyOn");
            //_medal.Add("easyOff", "Sprite/lavaandiceEasyOff");

            xpos = 251.0f;
            ypos = 2.0f;
            foreach (KeyValuePair <String, String> kvp in _medal)
            {
                textureName = kvp.Value;
                texture     = Pax4Texture2D._current.Get(textureName);
                sprite      = new Pax4SpriteTexture(kvp.Key, scoreSprite);
                ((Pax4SpriteTexture)sprite).SetTexture(texture);
                sprite.SetPosition(new Vector2(xpos, ypos));
                _medalSprite.Add(sprite._name, sprite);
                colorModifierEnter.AddChild(sprite);
                colorModifierExit.AddChild(sprite);
                alphaModifierEnter.AddChild(sprite);
                alphaModifierExit.AddChild(sprite);
            }

            _currentMedalSprite = sprite;
        }
コード例 #5
0
        public Pax4ButtonLavaAndIceMission(String p_name, Pax4Sprite p_parent, String p_questName, int p_missionIndex)
            : base(p_name, p_parent)
        {
            _questName    = p_questName;
            _missionIndex = p_missionIndex;

            _missionButton.Add(this);

            _questNameMissionIndex = p_questName + "_" + p_missionIndex;

            _sprite = new List <Pax4Sprite>();

            Pax4Sprite sprite = null;
            Vector2    position;
            float      scale;

            float xpos  = 0.0f;
            float xstep = 0.0f;
            float xoff  = 0.0f;

            float ypos  = 0.0f;
            float ystep = 0.0f;
            float yoff  = 0.0f;

            //title
            sprite = new Pax4SpriteText(p_name + "_Text", this);
            //position.X = 154.0f;
            //position.Y = 66.0f;
            scale = 0.9f;
            sprite.SetPosition(Vector2.Zero);
            sprite.SetColor(Color.Gold);
            ((Pax4SpriteText)sprite).SetSpriteFont("SpriteFont/Livingstone");
            ((Pax4SpriteText)sprite).SetScale(scale);
            _textSprite = (Pax4SpriteText)sprite;

            if (p_missionIndex <= 0)
            {
                return;
            }

            #region scores

            //High Score
            xpos       = 12.0f;
            ypos       = 12.0f;
            ystep      = 12.0f;
            sprite     = new Pax4SpriteText("highScore", this);
            position.X = xpos;
            position.Y = ypos; ypos += ystep;
            scale      = 0.30f;
            sprite.SetPosition(position);
            sprite.SetColor(Color.White);
            ((Pax4SpriteText)sprite).SetSpriteFont("SpriteFont/ArialBold");
            ((Pax4SpriteText)sprite).SetScale(scale);
            ((Pax4SpriteText)sprite).SetText("High Score");
            _sprite.Add(sprite);

            //High Score value
            sprite     = new Pax4SpriteText("highScoreValue", this);
            position.X = xpos;
            position.Y = ypos; ypos += ystep;
            scale      = 0.35f;
            sprite.SetPosition(position);
            sprite.SetColor(Color.GreenYellow);
            ((Pax4SpriteText)sprite).SetSpriteFont("SpriteFont/ArialBold");
            ((Pax4SpriteText)sprite).SetScale(scale);
            _sprite.Add(sprite);
            _highScoreValue = sprite;

            //xpos = xpos;
            ypos  = ypos + 5.0f;
            ystep = 12.0f;
            //Last Score
            sprite     = new Pax4SpriteText("lastScore", this);
            position.X = xpos;
            position.Y = ypos; ypos += ystep;
            scale      = 0.30f;
            sprite.SetPosition(position);
            sprite.SetColor(Color.White);
            ((Pax4SpriteText)sprite).SetSpriteFont("SpriteFont/ArialBold");
            ((Pax4SpriteText)sprite).SetScale(scale);
            ((Pax4SpriteText)sprite).SetText("Last Score");
            _sprite.Add(sprite);

            //Last Score value
            sprite     = new Pax4SpriteText("lastScoreValue", this);
            position.X = xpos;
            position.Y = ypos; ypos += ystep;
            scale      = 0.35f;
            sprite.SetPosition(position);
            sprite.SetColor(Color.GreenYellow);
            ((Pax4SpriteText)sprite).SetSpriteFont("SpriteFont/ArialBold");
            ((Pax4SpriteText)sprite).SetScale(scale);
            _sprite.Add(sprite);
            _lastScoreValue = sprite;

            #endregion

            #region medals

            //String textureName = null;
            //Texture2D texture = null;

            xpos  = 142.0f;
            xoff  = 24.0f;
            xstep = 48.0f;
            ypos  = 14.0f;
            yoff  = 26.0f;

            //int medalCount = 0;
            //int medal = 0;

            sprite = new Pax4SpriteTexture("nightmare", this);
            sprite.SetPosition(new Vector2(xpos, ypos));
            _sprite.Add(sprite);
            _nightmareMedal = sprite;

            sprite     = new Pax4SpriteText("nightmareCount", this);
            position.X = xpos + xoff;
            position.Y = ypos + yoff;
            scale      = 0.4f;
            sprite.SetPosition(position);
            sprite.SetColor(Color.White);
            ((Pax4SpriteText)sprite).SetSpriteFont("SpriteFont/ArialBold");
            ((Pax4SpriteText)sprite).SetScale(scale);
            _sprite.Add(sprite);
            _nightmareMedalCount = sprite;

            xpos += xstep;

            sprite = new Pax4SpriteTexture("hard", this);
            sprite.SetPosition(new Vector2(xpos, ypos));
            _sprite.Add(sprite);
            _hardMedal = sprite;

            sprite     = new Pax4SpriteText("hardCount", this);
            position.X = xpos + xoff;
            position.Y = ypos + yoff;
            scale      = 0.4f;
            sprite.SetPosition(position);
            sprite.SetColor(Color.White);
            ((Pax4SpriteText)sprite).SetSpriteFont("SpriteFont/ArialBold");
            ((Pax4SpriteText)sprite).SetScale(scale);
            _sprite.Add(sprite);
            _hardMedalCount = sprite;

            xpos += xstep;

            sprite = new Pax4SpriteTexture("normal", this);
            sprite.SetPosition(new Vector2(xpos, ypos));
            _sprite.Add(sprite);
            _normalMedal = sprite;

            sprite     = new Pax4SpriteText("normalCount", this);
            position.X = xpos + xoff;
            position.Y = ypos + yoff;
            scale      = 0.4f;
            sprite.SetPosition(position);
            sprite.SetColor(Color.White);
            ((Pax4SpriteText)sprite).SetSpriteFont("SpriteFont/ArialBold");
            ((Pax4SpriteText)sprite).SetScale(scale);
            _sprite.Add(sprite);
            _normalMedalCount = sprite;

            xpos += xstep;

            sprite = new Pax4SpriteTexture("easy", this);
            sprite.SetPosition(new Vector2(xpos, ypos));
            _sprite.Add(sprite);
            _easyMedal = sprite;

            sprite = new Pax4SpriteText("easyCount", this);
            //position.X = xpos + xoff;
            //position.Y = ypos + yoff;
            scale = 0.4f;
            sprite.SetPosition(position);
            sprite.SetColor(Color.White);
            ((Pax4SpriteText)sprite).SetSpriteFont("SpriteFont/ArialBold");
            ((Pax4SpriteText)sprite).SetScale(scale);
            _sprite.Add(sprite);
            _easyMedalCount = sprite;

            #endregion //medals

            //pct completed value
            sprite = new Pax4SpriteText("pctCompletedValue", this);
            //position.X = 86.0f;
            //position.Y = 50.0f;
            scale = 0.4f;
            sprite.SetPosition(position);
            sprite.SetColor(Color.OrangeRed);
            ((Pax4SpriteText)sprite).SetSpriteFont("SpriteFont/ArialBold");
            ((Pax4SpriteText)sprite).SetScale(scale);
            _sprite.Add(sprite);
            _pctCompletedValue = sprite;

            if (Pax4UiLavaAndIceQuestScore._score[_questNameMissionIndex + "_Locked"] > 0)
            {
                SetLocked();
            }
        }
コード例 #6
0
        public Pax4UiStateLavaAndIceVictory(String p_name, Pax4Ui p_ui)
            : base(p_name, p_ui)
        {
            Vector2 position;
            float   duration = 0.5f;

            Pax4SpriteColorModifier colorModifierEnter = new Pax4SpriteColorModifier("", null);

            colorModifierEnter.Ini(Color.Black, Color.White, duration);
            AddStateEnterModifier(colorModifierEnter);
            Pax4SpriteColorModifier colorModifierExit = new Pax4SpriteColorModifier("", null);

            colorModifierExit.Ini(Color.White, Color.Black, duration);
            AddStateExitModifier(colorModifierExit);

            Pax4SpriteAlphaModifier alphaModifierEnter = new Pax4SpriteAlphaModifier("", null);

            alphaModifierEnter.Ini(0.0f, 1.0f, duration);
            AddStateEnterModifier(alphaModifierEnter);
            Pax4SpriteAlphaModifier alphaModifierExit = new Pax4SpriteAlphaModifier("", null);

            alphaModifierExit.Ini(1.0f, 0.0f, duration);
            AddStateExitModifier(alphaModifierExit);
            //Pax4SpritePositionModifier positionModifierEnter = null;
            //Pax4SpritePositionModifier positionModifierExit = null;
            //Pax4SpriteTextModifier textModifier = null;
            Pax4SpriteTextNumberModifier textNumberModifier = null;

            //float delay = 0.0f;
            Vector2 position0 = Vector2.Zero;
            Vector2 position1 = Vector2.Zero;

            String    textureName = null;
            Texture2D texture     = null;
            //SpriteFont spriteFont = null;
            Pax4Sprite sprite = null;

            //**************************************************
            //bg
            //**************************************************
            position.X = 63.0f;
            position.Y = 145.0f;
            //misc
            sprite = new Pax4SpriteTexture("lavaandiceMenuBg", null);
            AddChild(sprite);
            textureName = "Sprite/lavaandiceInGameVictoryBg";
            texture     = Pax4Texture2D._current.Get(textureName);
            ((Pax4SpriteTexture)sprite).SetTexture(texture);
            sprite.SetPosition(position);
            colorModifierEnter.AddChild(sprite);
            colorModifierExit.AddChild(sprite);
            alphaModifierEnter.AddChild(sprite);
            alphaModifierExit.AddChild(sprite);

            //**************************************************
            //buttons
            //**************************************************

            sprite = new Pax4Button("lavaandiceMenuExit", null);
            AddChild(sprite);
            textureName = "Sprite/lavaandiceExitBtn";
            texture     = Pax4Texture2D._current.Get(textureName);
            ((Pax4Button)sprite).SetTexture(texture);
            textureName = "Sprite/lavaandiceExitBtnOver";
            texture     = Pax4Texture2D._current.Get(textureName);
            ((Pax4Button)sprite).SetTextureOver(texture);
            ((Pax4Button)sprite).SetOnClick(this.lavaandiceExitBtn_Click);
            position.X = 126.0f;
            position.Y = 368.0f;
            sprite.SetPosition(position);
            colorModifierEnter.AddChild(sprite);
            colorModifierExit.AddChild(sprite);
            alphaModifierEnter.AddChild(sprite);
            alphaModifierExit.AddChild(sprite);

            sprite = new Pax4Button("lavaandiceMenuRetry", null);
            AddChild(sprite);
            textureName = "Sprite/lavaandiceRetryBtn";
            texture     = Pax4Texture2D._current.Get(textureName);
            ((Pax4Button)sprite).SetTexture(texture);
            textureName = "Sprite/lavaandiceRetryBtnOver";
            texture     = Pax4Texture2D._current.Get(textureName);
            ((Pax4Button)sprite).SetTextureOver(texture);
            ((Pax4Button)sprite).SetOnClick(this.lavaandiceRetryBtn_Click);
            position.X = 126.0f;
            position.Y = 496.0f;
            sprite.SetPosition(position);
            colorModifierEnter.AddChild(sprite);
            colorModifierExit.AddChild(sprite);
            alphaModifierEnter.AddChild(sprite);
            alphaModifierExit.AddChild(sprite);

            sprite = new Pax4Button("lavaandiceMenuContinue", null);
            AddChild(sprite);
            textureName = "Sprite/lavaandiceContinueBtn";
            texture     = Pax4Texture2D._current.Get(textureName);
            ((Pax4Button)sprite).SetTexture(texture);
            textureName = "Sprite/lavaandiceContinueBtnOver";
            texture     = Pax4Texture2D._current.Get(textureName);
            ((Pax4Button)sprite).SetTextureOver(texture);
            ((Pax4Button)sprite).SetOnClick(this.lavaandiceContinueBtn_Click);
            position.X = 126.0f;
            position.Y = 624.0f;
            sprite.SetPosition(position);
            colorModifierEnter.AddChild(sprite);
            colorModifierExit.AddChild(sprite);
            alphaModifierEnter.AddChild(sprite);
            alphaModifierExit.AddChild(sprite);

            //**************************************************
            //create
            //**************************************************
            float xpos = 0.0f;
            //float xstep = 0.0f;
            //float xoff = 0.0f;

            float ypos  = 0.0f;
            float ystep = 0.0f;
            //float yoff = 0.0f;

            float scale;

            //Difficulty
            xpos       = 105.0f;
            ypos       = 246.0f;
            sprite     = new Pax4SpriteText("difficulty", null);
            position.X = xpos;
            position.Y = ypos;
            scale      = 0.55f;
            sprite.SetPosition(position);
            sprite.SetColor(Color.White);
            ((Pax4SpriteText)sprite).SetSpriteFont("SpriteFont/ArialBold");
            ((Pax4SpriteText)sprite).SetScale(scale);
            ((Pax4SpriteText)sprite).SetText("Difficulty:");
            AddChild(sprite);
            colorModifierEnter.AddChild(sprite);
            colorModifierExit.AddChild(sprite);
            alphaModifierEnter.AddChild(sprite);
            alphaModifierExit.AddChild(sprite);

            //Difficulty Value
            xpos       = 210.0f;
            ypos       = 246.0f;
            ystep      = 30.0f;
            sprite     = new Pax4SpriteText("difficultyValue", null);
            position.X = xpos;
            position.Y = ypos; ypos += ystep;
            scale      = 0.60f;
            sprite.SetPosition(position);
            sprite.SetColor(Color.OrangeRed);
            ((Pax4SpriteText)sprite).SetSpriteFont("SpriteFont/ArialBold");
            ((Pax4SpriteText)sprite).SetScale(scale);
            ((Pax4SpriteText)sprite).SetText("Hard");
            AddChild(sprite);
            _difficultySprite = sprite;
            colorModifierEnter.AddChild(sprite);
            colorModifierExit.AddChild(sprite);
            alphaModifierEnter.AddChild(sprite);
            alphaModifierExit.AddChild(sprite);

            //Score
            xpos       = 105.0f;
            sprite     = new Pax4SpriteText("score", null);
            position.X = xpos;
            position.Y = ypos;
            scale      = 0.65f;
            sprite.SetPosition(position);
            sprite.SetColor(Color.White);
            ((Pax4SpriteText)sprite).SetSpriteFont("SpriteFont/ArialBold");
            ((Pax4SpriteText)sprite).SetScale(scale);
            ((Pax4SpriteText)sprite).SetText("Score:");
            AddChild(sprite);
            colorModifierEnter.AddChild(sprite);
            colorModifierExit.AddChild(sprite);
            alphaModifierEnter.AddChild(sprite);
            alphaModifierExit.AddChild(sprite);

            //Score value
            xpos       = 188.0f;
            sprite     = new Pax4SpriteText("scoreValue", null);
            position.X = xpos;
            position.Y = ypos - 1.0f; ypos += ystep;
            scale      = 0.75f;
            sprite.SetPosition(position);
            sprite.SetColor(Color.GreenYellow);
            ((Pax4SpriteText)sprite).SetSpriteFont("SpriteFont/ArialBold");
            ((Pax4SpriteText)sprite).SetScale(scale);
            ((Pax4SpriteText)sprite).SetText("100,000,000");
            AddChild(sprite);
            _scoreSprite = sprite;
            colorModifierEnter.AddChild(sprite);
            colorModifierExit.AddChild(sprite);
            alphaModifierEnter.AddChild(sprite);
            alphaModifierExit.AddChild(sprite);

            textNumberModifier = new Pax4SpriteTextNumberModifier("", null);
            textNumberModifier.AddChild(sprite);
            //textNumberModifier.Ini(1000000.0f, 0.0f, true, 10.0f);
            AddStateEnterModifier(textNumberModifier);
            _currentScoreModifier = textNumberModifier;

            //Total Score
            xpos       = 105.0f;
            sprite     = new Pax4SpriteText("totalScore", null);
            position.X = xpos;
            position.Y = ypos + 5.0f;
            scale      = 0.50f;
            sprite.SetPosition(position);
            sprite.SetColor(Color.White);
            ((Pax4SpriteText)sprite).SetSpriteFont("SpriteFont/ArialBold");
            ((Pax4SpriteText)sprite).SetScale(scale);
            ((Pax4SpriteText)sprite).SetText("Total Score:");
            AddChild(sprite);
            colorModifierEnter.AddChild(sprite);
            colorModifierExit.AddChild(sprite);
            alphaModifierEnter.AddChild(sprite);
            alphaModifierExit.AddChild(sprite);

            //Total Score value
            xpos       = 222.0f;
            ypos       = ypos + 4.0f;
            sprite     = new Pax4SpriteText("totalScoreValue", null);
            position.X = xpos;
            position.Y = ypos;
            scale      = 0.55f;
            sprite.SetPosition(position);
            sprite.SetColor(Color.GreenYellow);
            ((Pax4SpriteText)sprite).SetSpriteFont("SpriteFont/ArialBold");
            ((Pax4SpriteText)sprite).SetScale(scale);
            ((Pax4SpriteText)sprite).SetText("100,000,000");
            AddChild(sprite);
            _totalScoreSprite = sprite;
            colorModifierEnter.AddChild(sprite);
            colorModifierExit.AddChild(sprite);
            alphaModifierEnter.AddChild(sprite);
            alphaModifierExit.AddChild(sprite);

            textNumberModifier = new Pax4SpriteTextNumberModifier("", null);
            textNumberModifier.AddChild(sprite);
            //textNumberModifier.Ini(0.0f, 10000000.0f, true, 10.0f);
            AddStateEnterModifier(textNumberModifier);
            _totalScoreModifier = textNumberModifier;

            //**************************************************
            //create medal sprites
            //**************************************************
            if (_medalSprite == null)
            {
                _medalSprite = new Dictionary <String, Pax4Sprite>();
            }
            else
            {
                return;
            }

            duration            = 0.2f;
            _medalColorModifier = new Pax4SpriteColorModifier("", null);
            _medalColorModifier.Ini(Color.White, Color.Black, duration);
            _medalColorModifier.SetOscillating();
            AddStateEnterModifier(_medalColorModifier);

            _medalAlphaModifier = new Pax4SpriteAlphaModifier("", null);
            _medalAlphaModifier.Ini(1.0f, 0.0f, duration);
            _medalAlphaModifier.SetOscillating();
            AddStateEnterModifier(_medalAlphaModifier);

            Dictionary <String, String> _medal = new Dictionary <String, String>();

            _medal.Add("nightmareOn", "Sprite/lavaandiceNightmareOn");
            _medal.Add("hardOn", "Sprite/lavaandiceHardOn");
            _medal.Add("normalOn", "Sprite/lavaandiceNormalOn");
            _medal.Add("easyOn", "Sprite/lavaandiceEasyOn");

            xpos = 335.0f;
            ypos = 250.0f;
            foreach (KeyValuePair <String, String> kvp in _medal)
            {
                textureName = kvp.Value;
                texture     = Pax4Texture2D._current.Get(textureName);
                sprite      = new Pax4SpriteTexture(kvp.Key, null);
                ((Pax4SpriteTexture)sprite).SetTexture(texture);
                sprite.SetPosition(new Vector2(xpos, ypos));
                sprite.SetScale(1.6f);
                _medalSprite.Add(sprite._name, sprite);

                _medalColorModifier.AddChild(sprite);
                _medalAlphaModifier.AddChild(sprite);

                colorModifierExit.AddChild(sprite);
                alphaModifierExit.AddChild(sprite);
            }

            _currentMedalSprite = sprite;
        }