public override void Enter()
        {
            Pax4Sound._current.PlayRandomSong();

            Pax4ButtonLavaAndIceQuest.UpdateScore();

            base.Enter();
        }
        public Pax4UiStateLavaAndIceChooseQuest(String p_name, Pax4Ui p_ui)
            : base(p_name, p_ui)
        {
            Pax4UiLavaAndIceQuestScore score = new Pax4UiLavaAndIceQuestScore();

            float   duration = 0.5f;
            float   delay    = 0.0f;
            Vector2 position;
            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);

            duration = Pax4Ui._btnDuration;

            Pax4SpritePositionModifier positionModifierEnter = null;
            Pax4SpritePositionModifier positionModifierExit  = null;
            Pax4SpriteTextModifier     textModifier          = null;

            Vector2 position0 = Vector2.Zero;
            Vector2 position1 = Vector2.Zero;

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

            String questName = null;

            textureName = "Sprite/lavaandiceMainBg";
            texture     = Pax4Texture2D._current.Get(textureName);
            sprite      = new Pax4SpriteTexture("lavaandiceMainBg", null);
            ((Pax4SpriteTexture)sprite).SetTexture(texture);
            position.X = .5f;
            position.Y = .5f;
            sprite.SetPosition(position);
            AddChild(sprite);
            duration = 0.5f;
            colorModifierEnter.AddChild(sprite);
            colorModifierExit.AddChild(sprite);
            alphaModifierEnter.AddChild(sprite);
            alphaModifierExit.AddChild(sprite);



            delay      = 0.3f;
            position.X = 0.5f;
            position.Y = 0.5f;
            sprite     = new Pax4SpriteText("lavaandiceChooseQuestTitle", sprite);
            AddChild(sprite);
            ((Pax4SpriteText)sprite).SetSpriteFont("SpriteFont/Livingstone");
            ((Pax4SpriteText)sprite).SetPosition(position);
            textModifier = new Pax4SpriteTextModifier("", null);
            textModifier.AddChild(sprite);

            textModifier.Ini("Choose Quest", duration, delay);
            AddStateEnterModifier(textModifier);
            duration = 0.5f;
            colorModifierEnter.AddChild(sprite);
            colorModifierExit.AddChild(sprite);
            alphaModifierEnter.AddChild(sprite);
            alphaModifierExit.AddChild(sprite);

            //ENd of Moved Up


            //**************************************************
            //create
            //**************************************************
            textureName = "Sprite/lavaandiceQuestBtn";
            texture     = Pax4Texture2D._current.Get(textureName);
            textureName = "Sprite/lavaandiceQuestBtnOver";
            textureOver = Pax4Texture2D._current.Get(textureName);

            position.X = .5f;
            position.Y = .75f;
            Pax4Slider slider = new Pax4Slider("sldQuest", null);

            //slider.SetPosition(position, Pax4Camera._backBufferWidth, texture.Height);
            slider.SetRectangleWidthHeight(0, texture.Height);
            slider.SetViewingThreshold(0, Pax4Game._graphicsDeviceManager.PreferredBackBufferWidth, 0, Pax4Game._graphicsDeviceManager.PreferredBackBufferHeight);
            slider.SetPosition(position);//, 100f, texture.Height/Pax4Game._graphicsDeviceManager.PreferredBackBufferHeight);
            slider._verticalScroll    = false;
            slider._skipRectangleDraw = true;
            //slider._horizontalSpacing = 30.0f;
            //slider.SetSnapPosition(position);
            //slider._leftTouchThreshold = 0;

            AddChild(slider);

            //duration = 0.5f;
            //delay = 0.0f;
            //position0.X = 1091.0f;
            //position0.Y = position.Y;
            //position0 *= Pax4Camera._current._scale2;
            //position *= Pax4Camera._current._scale2;
            //positionModifierEnter = new Pax4SpritePositionModifier(slider);
            //positionModifierEnter.Ini(position0, position, duration, delay);
            //AddStateEnterModifier(positionModifierEnter);
            //positionModifierExit = new Pax4SpritePositionModifier(slider);
            //positionModifierExit.Ini(position, position0, duration, delay);
            //AddStateExitModifier(positionModifierExit);

            //colorModifier = new Pax4SpriteColorModifier(slider);
            //colorModifier.Ini(Color.Black, Color.White, duration/2.0f);
            //AddStateEnterModifier(colorModifier);
            //colorModifier = new Pax4SpriteColorModifier(slider);
            //colorModifier.Ini(Color.White, Color.Black, duration/2.0f);
            //AddStateExitModifier(colorModifier);

            #region quests
            questName = "Prologue";
            //position.X = (float)Pax4Camera._backBufferWidth / 2.0f - (float)texture.Width / 2.0f;
            //position.Y = 330.0f;
            sprite     = new Pax4ButtonLavaAndIceQuest("lavaandicePrologueBtn", slider, questName);
            position.X = -.17f; // 64.0f;//108.0f delta 44
            position.Y = -.1f;  // 200.0f;//255.0f delta 55
            ((Pax4Button)sprite).SetText(questName, position);
            ((Pax4Button)sprite).SetTexture(texture);
            sprite.SetRectangleWidthHeight(texture.Width, texture.Height);
            ((Pax4Button)sprite).SetTextureOver(textureOver);
            ((Pax4Button)sprite).SetOnClick(this.lavaandicePrologueBtn_Click);
            slider.AddChild(sprite);
            colorModifierEnter.AddChild(sprite);
            colorModifierExit.AddChild(sprite);
            alphaModifierEnter.AddChild(sprite);
            alphaModifierExit.AddChild(sprite);

            //alphaModifier = new Pax4SpriteAlphaModifier(sprite);
            //alphaModifier.Ini(0.0f, 1.0f, 3.0f);
            //AddStateEnterModifier(alphaModifier);
            //alphaModifier.SetOscillating();

            questName = "Equilibrium";
            sprite    = new Pax4ButtonLavaAndIceQuest("lavaandiceEquilibriumBtn", slider, questName);
            //position.X = 10f;//50.0f;
            //position.Y = 0f;// 200.0f;
            ((Pax4Button)sprite).SetText(questName, position);
            ((Pax4Button)sprite).SetTexture(texture);
            ((Pax4Button)sprite).SetTextureOver(textureOver);
            slider.AddChild(sprite);
            ((Pax4ButtonLavaAndIceQuest)sprite).SetComingSoon();
            if (!((Pax4ButtonLavaAndIceQuest)sprite)._comingSoon)
            {
                ((Pax4Button)sprite).SetOnClick(this.lavaandiceEquilibriumBtn_Click);
            }
            colorModifierEnter.AddChild(sprite);
            colorModifierExit.AddChild(sprite);
            alphaModifierEnter.AddChild(sprite);
            alphaModifierExit.AddChild(sprite);

            questName = "LavaGrail";
            sprite    = new Pax4ButtonLavaAndIceQuest("lavaandiceLavaGrailBtn", slider, questName);
            //position.X = 68.0f;
            //position.Y = 200.0f;
            ((Pax4Button)sprite).SetText("Lava Grail", position);
            ((Pax4Button)sprite).SetTexture(texture);
            ((Pax4Button)sprite).SetTextureOver(textureOver);
            slider.AddChild(sprite);
            ((Pax4ButtonLavaAndIceQuest)sprite).SetComingSoon();
            if (!((Pax4ButtonLavaAndIceQuest)sprite)._comingSoon)
            {
                ((Pax4Button)sprite).SetOnClick(this.lavaandiceLavaGrailBtn_Click);
            }
            colorModifierEnter.AddChild(sprite);
            colorModifierExit.AddChild(sprite);
            alphaModifierEnter.AddChild(sprite);
            alphaModifierExit.AddChild(sprite);

            //questName = "IceGrail";
            //sprite = new Pax4ButtonLavaAndIceQuest("lavaandiceIceGrailBtn", slider, questName);
            //position.X = 78.0f;
            //position.Y = 200.0f;
            //((Pax4Button)sprite).SetText("Ice Grail", position);
            //((Pax4Button)sprite).SetTexture(texture);
            //((Pax4Button)sprite).SetTextureOver(textureOver);
            //slider.AddChild(sprite);
            //((Pax4ButtonLavaAndIceQuest)sprite).SetComingSoon();
            //if (!((Pax4ButtonLavaAndIceQuest)sprite)._comingSoon)
            //    ((Pax4Button)sprite).SetOnClick(this.lavaandiceIceGrailBtn_Click);
            //colorModifierEnter.AddChild(sprite);
            //colorModifierExit.AddChild(sprite);
            //alphaModifierEnter.AddChild(sprite);
            //alphaModifierExit.AddChild(sprite);

            //questName = "Dragons";
            //sprite = new Pax4ButtonLavaAndIceQuest("lavaandiceDragonsBtn", slider, questName);
            //position.X = 70.0f;
            //position.Y = 200.0f;
            //((Pax4Button)sprite).SetText("Dragons", position);
            //((Pax4Button)sprite).SetTexture(texture);
            //((Pax4Button)sprite).SetTextureOver(textureOver);
            //slider.AddChild(sprite);
            //((Pax4ButtonLavaAndIceQuest)sprite).SetComingSoon();
            //if (!((Pax4ButtonLavaAndIceQuest)sprite)._comingSoon)
            //    ((Pax4Button)sprite).SetOnClick(this.lavaandiceDragonsBtn_Click);
            //colorModifierEnter.AddChild(sprite);
            //colorModifierExit.AddChild(sprite);
            //alphaModifierEnter.AddChild(sprite);
            //alphaModifierExit.AddChild(sprite);



            slider.AddChild(null);//no mas buttons, wrap shit up



            #endregion //quests

            //Moved Stuff up

            //misc
            //sprite = new Pax4Button("lavaandiceSettingsBtn", null);
            //AddSprite(sprite);
            //textureName = "Sprite/lavaandiceSettingsBtn";
            //texture = Pax4Texture2D._current.Get(textureName);
            //((Pax4Button)sprite).SetTexture(texture);
            //textureName = "Sprite/lavaandiceSettingsBtnOver";
            //texture = Pax4Texture2D._current.Get(textureName);
            //((Pax4Button)sprite).SetTextureOver(texture);
            ////position.X = 14.0f;
            ////position.Y = 20.0f;
            ////((Pax4Button)sprite).SetTextSpriteFont("SpriteFont/Livingstone", position, "Settings", 0.8f);
            //position.X = 28.0f;
            //position.Y = 7.0f;
            //((Pax4Button)sprite).SetTextSpriteFont("SpriteFont/Livingstone", position, "Instru\nctions", 0.7f);
            //((Pax4Button)sprite).SetOnClick(this.lavaandiceSettingsBtn_Click);

            //position.X = 160.0f;
            //position.Y = 820.0f;

            //duration = 0.5f;
            //delay = 0.0f;
            //position0.X = position.X;
            //position0.Y = 1920.0f;
            //sprite.SetPosition(position0);
            //position *= Pax4Camera._current._scale2;
            //position0 *= Pax4Camera._current._scale2;
            //positionModifierEnter = new Pax4SpritePositionModifier(sprite);
            //positionModifierEnter.Ini(position0, position, duration, delay);
            //AddStateEnterModifier(positionModifierEnter);

            //positionModifierExit = new Pax4SpritePositionModifier(sprite);
            //positionModifierExit.Ini(position, position0, duration);
            //AddStateExitModifier(positionModifierExit);

            //colorModifierEnter.AddChild(sprite);
            //colorModifierExit.AddChild(sprite);
            //alphaModifierEnter.AddChild(sprite);
            //alphaModifierExit.AddChild(sprite);
        }
        public static void UpdateScore()
        {
            int    maxMedalCount                  = 0;
            int    medalCount                     = 0;
            String questName                      = null;
            String questNameMissionIndexName      = null;
            Pax4ButtonLavaAndIceQuest questButton = null;
            String    textureName                 = null;
            Texture2D texture                     = null;

            for (int bi = 0; bi < _questButton.Count; bi++)
            {
                questButton = _questButton[bi];
                questName   = questButton._questName;

                if (questName.Equals("Prologue"))
                {
                    maxMedalCount = 19 * 4;//!*update this to the count of missions
                }
                else
                {
                    maxMedalCount = Pax4WorldLavaAndIce._maxMissions * 4;
                }

                for (int i = 0; i < Pax4WorldLavaAndIce._maxMissions; i++)
                {
                    questNameMissionIndexName = questName + "_" + (i + 1).ToString();

                    if (!Pax4UiLavaAndIceQuestScore._score.ContainsKey(questNameMissionIndexName + "_NightmareMedalCount"))
                    {
                        Pax4UiLavaAndIceQuestScore._score.Add(questNameMissionIndexName + "_NightmareMedalCount", 0);
                    }
                    if (Pax4UiLavaAndIceQuestScore._score[questNameMissionIndexName + "_NightmareMedalCount"] > 0)
                    {
                        medalCount++;
                    }

                    if (!Pax4UiLavaAndIceQuestScore._score.ContainsKey(questNameMissionIndexName + "_HardMedalCount"))
                    {
                        Pax4UiLavaAndIceQuestScore._score.Add(questNameMissionIndexName + "_HardMedalCount", 0);
                    }
                    if (Pax4UiLavaAndIceQuestScore._score[questNameMissionIndexName + "_HardMedalCount"] > 0)
                    {
                        medalCount++;
                    }

                    if (!Pax4UiLavaAndIceQuestScore._score.ContainsKey(questNameMissionIndexName + "_NormalMedalCount"))
                    {
                        Pax4UiLavaAndIceQuestScore._score.Add(questNameMissionIndexName + "_NormalMedalCount", 0);
                    }
                    if (Pax4UiLavaAndIceQuestScore._score[questNameMissionIndexName + "_NormalMedalCount"] > 0)
                    {
                        medalCount++;
                    }

                    if (!Pax4UiLavaAndIceQuestScore._score.ContainsKey(questNameMissionIndexName + "_EasyMedalCount"))
                    {
                        Pax4UiLavaAndIceQuestScore._score.Add(questNameMissionIndexName + "_EasyMedalCount", 0);
                    }
                    if (Pax4UiLavaAndIceQuestScore._score[questNameMissionIndexName + "_EasyMedalCount"] > 0)
                    {
                        medalCount++;
                    }
                }

                ((Pax4SpriteText)questButton._pctCompletedValue).SetText((100 * medalCount / maxMedalCount).ToString());

                ((Pax4SpriteText)questButton._totalScoreValue).SetText(Pax4Tools.NumberCommaFormat(Pax4UiLavaAndIceQuestScore._score[questName + "_TotalScore"]));
                ((Pax4SpriteText)questButton._lastScoreValue).SetText(Pax4Tools.NumberCommaFormat(Pax4UiLavaAndIceQuestScore._score[questName + "_LastScore"]));
                ((Pax4SpriteText)questButton._lavaKillsValue).SetText(Pax4Tools.NumberCommaFormat(Pax4UiLavaAndIceQuestScore._score[questName + "_LavaKills"]));
                ((Pax4SpriteText)questButton._iceKillsValue).SetText(Pax4Tools.NumberCommaFormat(Pax4UiLavaAndIceQuestScore._score[questName + "_IceKills"]));
                ((Pax4SpriteText)questButton._monsterKillsValue).SetText(Pax4Tools.NumberCommaFormat(Pax4UiLavaAndIceQuestScore._score[questName + "_MonsterKills"]));

                medalCount = Pax4UiLavaAndIceQuestScore._score[questName + "_NightmareMedalCount"];
                if (medalCount > 0)
                {
                    textureName = "Sprite/lavaandiceNightmareOn";
                    texture     = Pax4Texture2D._current.Get(textureName);
                    ((Pax4SpriteTexture)questButton._nightmareMedal).SetTexture(texture);
                    ((Pax4SpriteText)questButton._nightmareMedalCount).SetText(Pax4Tools.NumberCommaFormat(medalCount));
                }
                else
                {
                    textureName = "Sprite/lavaandiceNightmareOff";
                    texture     = Pax4Texture2D._current.Get(textureName);
                    ((Pax4SpriteTexture)questButton._nightmareMedal).SetTexture(texture);
                }

                medalCount = Pax4UiLavaAndIceQuestScore._score[questName + "_HardMedalCount"];
                if (medalCount > 0)
                {
                    textureName = "Sprite/lavaandiceHardOn";
                    texture     = Pax4Texture2D._current.Get(textureName);
                    ((Pax4SpriteTexture)questButton._hardMedal).SetTexture(texture);
                    ((Pax4SpriteText)questButton._hardMedalCount).SetText(Pax4Tools.NumberCommaFormat(medalCount));
                }
                else
                {
                    textureName = "Sprite/lavaandiceHardOff";
                    texture     = Pax4Texture2D._current.Get(textureName);
                    ((Pax4SpriteTexture)questButton._hardMedal).SetTexture(texture);
                }

                medalCount = Pax4UiLavaAndIceQuestScore._score[questName + "_NormalMedalCount"];
                if (medalCount > 0)
                {
                    textureName = "Sprite/lavaandiceNormalOn";
                    texture     = Pax4Texture2D._current.Get(textureName);
                    ((Pax4SpriteTexture)questButton._normalMedal).SetTexture(texture);
                    ((Pax4SpriteText)questButton._normalMedalCount).SetText(Pax4Tools.NumberCommaFormat(medalCount));
                }
                else
                {
                    textureName = "Sprite/lavaandiceNormalOff";
                    texture     = Pax4Texture2D._current.Get(textureName);
                    ((Pax4SpriteTexture)questButton._normalMedal).SetTexture(texture);
                }

                medalCount = Pax4UiLavaAndIceQuestScore._score[questName + "_EasyMedalCount"];
                if (medalCount > 0)
                {
                    textureName = "Sprite/lavaandiceEasyOn";
                    texture     = Pax4Texture2D._current.Get(textureName);
                    ((Pax4SpriteTexture)questButton._easyMedal).SetTexture(texture);
                    ((Pax4SpriteText)questButton._easyMedalCount).SetText(Pax4Tools.NumberCommaFormat(medalCount));
                }
                else
                {
                    textureName = "Sprite/lavaandiceEasyOff";
                    texture     = Pax4Texture2D._current.Get(textureName);
                    ((Pax4SpriteTexture)questButton._easyMedal).SetTexture(texture);
                }
            }
        }