Exemplo n.º 1
0
        public ADAMenu()
        {
            PostProcessing.Add((IRequireResource)this);

            item = new Button();
            item.Area = new Microsoft.Xna.Framework.Rectangle(14, 362, 158, 42);
            item.OnMouseUp = delegate {
                if(currState == AMenuState.INV) {
                    currState = AMenuState.NONE;
                } else {
                    currState = AMenuState.INV;
                }
            };

            stat = new Button();
            stat.Area = new Microsoft.Xna.Framework.Rectangle(14, 409, 158, 42);
            stat.OnMouseUp = delegate {
                if(currState == AMenuState.STAT) {
                    currState = AMenuState.NONE;
                } else {
                    currState = AMenuState.STAT;
                }
            };

            journal = new Button();
            journal.Area = new Microsoft.Xna.Framework.Rectangle(14, 456, 158, 42);
            journal.OnMouseUp = delegate {

            };

            skill = new Button();
            skill.Area = new Microsoft.Xna.Framework.Rectangle(14, 503, 158, 42);
            skill.OnMouseUp = delegate {
                if(currState == AMenuState.SKILL) {
                    currState = AMenuState.NONE;
                } else {
                    currState = AMenuState.SKILL;
                }
            };

            quit = new Button();
            quit.Area = new Rectangle(14, 552, 158, 42);
            quit.OnMouseUp = delegate {
                StaticVars.inst.Exit();
            };

            menu = new Menu();
            menu.Add(item);
            menu.Add(journal);
            menu.Add(skill);
            menu.Add(stat);
            menu.Add(quit);

            pktButtons = new Button[6];

            // Scroll Left button
            pktButtons[0] = new Button();
            pktButtons[0].Active = false;
            pktButtons[0].Visible = false;
            pktButtons[0].Area = new Rectangle(231, 55, 13, 19);
            pktButtons[0].OnMouseUp = delegate {
                if(pktCenter > 1) pktCenter--;
                if(pktCenter == 1) {
                    pktButtons[0].Active = false;
                    pktButtons[0].Visible = false;
                }
                pktButtons[5].Active = true;
                pktButtons[5].Visible = true;
            };

            // Actual Tabs
            for(int i = 0; i < 4; i++) {
                pktButtons[i + 1] = new Button();
                pktButtons[i + 1].Active = false;
                pktButtons[i + 1].Visible = false;
                pktButtons[i + 1].Area = new Rectangle(244 + (i * 121), 55, 121, 19);
            }
            pktButtons[1].OnMouseUp = delegate {
                if(currDragButton == -1) {
                    currPkt = pktCenter - 1;
                    StaticVars.player.Stats.Inv.Pockets[currPkt].Condense();
                } else {
                    if(StaticVars.player.Stats.Inv.Pockets[pktCenter - 1].Content.Contains<Item.Item>(null)) { // Contains empty space...
                        Item.Item alpha = StaticVars.player.Stats.Inv.Pockets[currPkt][currDragButton];
                        StaticVars.player.Stats.Inv.Pockets[pktCenter - 1].Add(alpha);
                        StaticVars.player.Stats.Inv.Pockets[currPkt][currDragButton] = null;
                    }
                }
                currDragButton = -1;
            };
            pktButtons[2].OnMouseUp = delegate {
                if(currDragButton == -1) {
                    currPkt = pktCenter;
                    StaticVars.player.Stats.Inv.Pockets[currPkt].Condense();
                } else {
                    if(StaticVars.player.Stats.Inv.Pockets[pktCenter].Content.Contains<Item.Item>(null)) { // Contains empty space...
                        Item.Item alpha = StaticVars.player.Stats.Inv.Pockets[currPkt][currDragButton];
                        StaticVars.player.Stats.Inv.Pockets[pktCenter].Add(alpha);
                        StaticVars.player.Stats.Inv.Pockets[currPkt][currDragButton] = null;
                    }
                }
                currDragButton = -1;
            };
            pktButtons[3].OnMouseUp = delegate {
                if(currDragButton == -1) {
                    currPkt = pktCenter + 1;
                    StaticVars.player.Stats.Inv.Pockets[currPkt].Condense();
                } else {
                    if(StaticVars.player.Stats.Inv.Pockets[pktCenter + 1].Content.Contains<Item.Item>(null)) { // Contains empty space...
                        Item.Item alpha = StaticVars.player.Stats.Inv.Pockets[currPkt][currDragButton];
                        StaticVars.player.Stats.Inv.Pockets[pktCenter + 1].Add(alpha);
                        StaticVars.player.Stats.Inv.Pockets[currPkt][currDragButton] = null;
                    }
                }
                currDragButton = -1;
            };
            pktButtons[4].OnMouseUp = delegate {
                if(currDragButton == -1) {
                    currPkt = pktCenter + 2;
                    StaticVars.player.Stats.Inv.Pockets[currPkt].Condense();
                } else {
                    if(StaticVars.player.Stats.Inv.Pockets[pktCenter + 2].Content.Contains<Item.Item>(null)) { // Contains empty space...
                        Item.Item alpha = StaticVars.player.Stats.Inv.Pockets[currPkt][currDragButton];
                        StaticVars.player.Stats.Inv.Pockets[pktCenter + 2].Add(alpha);
                        StaticVars.player.Stats.Inv.Pockets[currPkt][currDragButton] = null;
                    }
                }
                currDragButton = -1;
            };

            // Scroll Right button
            pktButtons[5] = new Button();
            pktButtons[5].Active = false;
            pktButtons[5].Visible = false;
            pktButtons[5].Area = new Rectangle(728, 55, 13, 19);
            pktButtons[5].OnMouseUp = delegate {
                if(pktCenter < StaticVars.player.Stats.Inv.Pockets.Count - 3) pktCenter++;
                if(pktCenter == StaticVars.player.Stats.Inv.Pockets.Count - 3) {
                    pktButtons[5].Active = false;
                    pktButtons[5].Visible = false;
                }
                pktButtons[0].Active = true;
                pktButtons[0].Visible = true;
            };

            itemButtons = new ItemButton[20];

            for(int i = 0; i < 20; i++) {
                itemButtons[i] = new ItemButton(i, this);
            }
        }
Exemplo n.º 2
0
        public ADAMenu()
        {
            PostProcessing.Add((IRequireResource)this);

            item           = new Button();
            item.Area      = new Microsoft.Xna.Framework.Rectangle(14, 362, 158, 42);
            item.OnMouseUp = delegate {
                if (currState == AMenuState.INV)
                {
                    currState = AMenuState.NONE;
                }
                else
                {
                    currState = AMenuState.INV;
                }
            };

            stat           = new Button();
            stat.Area      = new Microsoft.Xna.Framework.Rectangle(14, 409, 158, 42);
            stat.OnMouseUp = delegate {
                if (currState == AMenuState.STAT)
                {
                    currState = AMenuState.NONE;
                }
                else
                {
                    currState = AMenuState.STAT;
                }
            };

            journal           = new Button();
            journal.Area      = new Microsoft.Xna.Framework.Rectangle(14, 456, 158, 42);
            journal.OnMouseUp = delegate {
            };

            skill           = new Button();
            skill.Area      = new Microsoft.Xna.Framework.Rectangle(14, 503, 158, 42);
            skill.OnMouseUp = delegate {
                if (currState == AMenuState.SKILL)
                {
                    currState = AMenuState.NONE;
                }
                else
                {
                    currState = AMenuState.SKILL;
                }
            };

            quit           = new Button();
            quit.Area      = new Rectangle(14, 552, 158, 42);
            quit.OnMouseUp = delegate {
                StaticVars.inst.Exit();
            };

            menu = new Menu();
            menu.Add(item);
            menu.Add(journal);
            menu.Add(skill);
            menu.Add(stat);
            menu.Add(quit);

            pktButtons = new Button[6];

            // Scroll Left button
            pktButtons[0]           = new Button();
            pktButtons[0].Active    = false;
            pktButtons[0].Visible   = false;
            pktButtons[0].Area      = new Rectangle(231, 55, 13, 19);
            pktButtons[0].OnMouseUp = delegate {
                if (pktCenter > 1)
                {
                    pktCenter--;
                }
                if (pktCenter == 1)
                {
                    pktButtons[0].Active  = false;
                    pktButtons[0].Visible = false;
                }
                pktButtons[5].Active  = true;
                pktButtons[5].Visible = true;
            };

            // Actual Tabs
            for (int i = 0; i < 4; i++)
            {
                pktButtons[i + 1]         = new Button();
                pktButtons[i + 1].Active  = false;
                pktButtons[i + 1].Visible = false;
                pktButtons[i + 1].Area    = new Rectangle(244 + (i * 121), 55, 121, 19);
            }
            pktButtons[1].OnMouseUp = delegate {
                if (currDragButton == -1)
                {
                    currPkt = pktCenter - 1;
                    StaticVars.player.Stats.Inv.Pockets[currPkt].Condense();
                }
                else
                {
                    if (StaticVars.player.Stats.Inv.Pockets[pktCenter - 1].Content.Contains <Item.Item>(null)) // Contains empty space...
                    {
                        Item.Item alpha = StaticVars.player.Stats.Inv.Pockets[currPkt][currDragButton];
                        StaticVars.player.Stats.Inv.Pockets[pktCenter - 1].Add(alpha);
                        StaticVars.player.Stats.Inv.Pockets[currPkt][currDragButton] = null;
                    }
                }
                currDragButton = -1;
            };
            pktButtons[2].OnMouseUp = delegate {
                if (currDragButton == -1)
                {
                    currPkt = pktCenter;
                    StaticVars.player.Stats.Inv.Pockets[currPkt].Condense();
                }
                else
                {
                    if (StaticVars.player.Stats.Inv.Pockets[pktCenter].Content.Contains <Item.Item>(null)) // Contains empty space...
                    {
                        Item.Item alpha = StaticVars.player.Stats.Inv.Pockets[currPkt][currDragButton];
                        StaticVars.player.Stats.Inv.Pockets[pktCenter].Add(alpha);
                        StaticVars.player.Stats.Inv.Pockets[currPkt][currDragButton] = null;
                    }
                }
                currDragButton = -1;
            };
            pktButtons[3].OnMouseUp = delegate {
                if (currDragButton == -1)
                {
                    currPkt = pktCenter + 1;
                    StaticVars.player.Stats.Inv.Pockets[currPkt].Condense();
                }
                else
                {
                    if (StaticVars.player.Stats.Inv.Pockets[pktCenter + 1].Content.Contains <Item.Item>(null)) // Contains empty space...
                    {
                        Item.Item alpha = StaticVars.player.Stats.Inv.Pockets[currPkt][currDragButton];
                        StaticVars.player.Stats.Inv.Pockets[pktCenter + 1].Add(alpha);
                        StaticVars.player.Stats.Inv.Pockets[currPkt][currDragButton] = null;
                    }
                }
                currDragButton = -1;
            };
            pktButtons[4].OnMouseUp = delegate {
                if (currDragButton == -1)
                {
                    currPkt = pktCenter + 2;
                    StaticVars.player.Stats.Inv.Pockets[currPkt].Condense();
                }
                else
                {
                    if (StaticVars.player.Stats.Inv.Pockets[pktCenter + 2].Content.Contains <Item.Item>(null)) // Contains empty space...
                    {
                        Item.Item alpha = StaticVars.player.Stats.Inv.Pockets[currPkt][currDragButton];
                        StaticVars.player.Stats.Inv.Pockets[pktCenter + 2].Add(alpha);
                        StaticVars.player.Stats.Inv.Pockets[currPkt][currDragButton] = null;
                    }
                }
                currDragButton = -1;
            };

            // Scroll Right button
            pktButtons[5]           = new Button();
            pktButtons[5].Active    = false;
            pktButtons[5].Visible   = false;
            pktButtons[5].Area      = new Rectangle(728, 55, 13, 19);
            pktButtons[5].OnMouseUp = delegate {
                if (pktCenter < StaticVars.player.Stats.Inv.Pockets.Count - 3)
                {
                    pktCenter++;
                }
                if (pktCenter == StaticVars.player.Stats.Inv.Pockets.Count - 3)
                {
                    pktButtons[5].Active  = false;
                    pktButtons[5].Visible = false;
                }
                pktButtons[0].Active  = true;
                pktButtons[0].Visible = true;
            };

            itemButtons = new ItemButton[20];

            for (int i = 0; i < 20; i++)
            {
                itemButtons[i] = new ItemButton(i, this);
            }
        }
Exemplo n.º 3
0
        public void Update(GameTime gt)
        {
            menu.Update(gt);
            StaticVars.player.Ctrls.Update(gt);

            MouseState ms = Mouse.GetState();
            foreach(Button alpha in pktButtons) {
                alpha.Update(ms, gt);
            }
            for(int i = 1; i < 5; i++) {
                pktButtons[i].IsHovering = pktCenter + i - 2 == currPkt;
            }
            foreach(ItemButton alpha in itemButtons) {
                alpha.Btn.Update(ms, gt);
            }

            if(StaticVars.player.Ctrls.LeavingADA) {
                currState = AMenuState.NONE;
                currSlide = 1f; statSlide = 0f; invSlide = 0f; skillSlide = 0f;
                StaticVars.currState = GameState.FROMADA;
            } else {
                float dCurr = -0.05f, dInv = -0.05f, dStat = -0.05f, dSkill = -0.05f;

                switch(currState) {
                    case AMenuState.NONE:
                        dCurr *= -1;
                        break;
                    case AMenuState.INV:
                        dInv *= -1;
                        break;
                    case AMenuState.SKILL:
                        dSkill *= -1;
                        break;
                    case AMenuState.STAT:
                        dStat *= -1;
                        break;
                }

                currSlide = Math.Max(Math.Min(currSlide + dCurr, 1f), 0f);

                invSlide = Math.Max(Math.Min(invSlide + dInv, 1f), 0f);
                if(invSlide == 1f) {
                    int numPkts = StaticVars.player.Stats.Inv.Pockets.Count;
                    if(numPkts > 4 && !(pktButtons[0].Visible || pktButtons[5].Visible)) {
                        pktButtons[5].Visible = true;
                        pktButtons[5].Active = true;
                    }
                    if(numPkts > 3 && !(pktButtons[4].Visible)) {
                        pktButtons[4].Visible = true;
                        pktButtons[4].Active = true;
                    }
                    if(numPkts > 2 && !(pktButtons[3].Visible)) {
                        pktButtons[3].Visible = true;
                        pktButtons[3].Active = true;
                    }
                    if(numPkts > 1 && !(pktButtons[2].Visible)) {
                        pktButtons[2].Visible = true;
                        pktButtons[2].Active = true;
                    }
                    if(numPkts > 0 && !(pktButtons[1].Visible)) {
                        pktButtons[1].Visible = true;
                        pktButtons[1].Active = true;
                    }

                    if(StaticVars.player.Stats.Inv.Pockets[currPkt] != null) {
                        for(int i = 0; i < 20; i++) {
                            itemButtons[i].Btn.Visible = true;
                            itemButtons[i].Btn.Active = true;
                        }
                    }
                } else {
                    foreach(Button alpha in pktButtons) {
                        alpha.Visible = false;
                        alpha.Active = false;
                    }
                    for(int i = 0; i < 20; i++) {
                        itemButtons[i].Btn.Visible = false;
                        itemButtons[i].Btn.Active = false;
                    }
                }

                skillSlide = Math.Max(Math.Min(skillSlide + dSkill, 1f), 0f);
                statSlide = Math.Max(Math.Min(statSlide + dStat, 1f), 0f);
            }
        }
Exemplo n.º 4
0
        public void Update(GameTime gt)
        {
            menu.Update(gt);
            StaticVars.player.Ctrls.Update(gt);

            MouseState ms = Mouse.GetState();

            foreach (Button alpha in pktButtons)
            {
                alpha.Update(ms, gt);
            }
            for (int i = 1; i < 5; i++)
            {
                pktButtons[i].IsHovering = pktCenter + i - 2 == currPkt;
            }
            foreach (ItemButton alpha in itemButtons)
            {
                alpha.Btn.Update(ms, gt);
            }

            if (StaticVars.player.Ctrls.LeavingADA)
            {
                currState            = AMenuState.NONE;
                currSlide            = 1f; statSlide = 0f; invSlide = 0f; skillSlide = 0f;
                StaticVars.currState = GameState.FROMADA;
            }
            else
            {
                float dCurr = -0.05f, dInv = -0.05f, dStat = -0.05f, dSkill = -0.05f;

                switch (currState)
                {
                case AMenuState.NONE:
                    dCurr *= -1;
                    break;

                case AMenuState.INV:
                    dInv *= -1;
                    break;

                case AMenuState.SKILL:
                    dSkill *= -1;
                    break;

                case AMenuState.STAT:
                    dStat *= -1;
                    break;
                }

                currSlide = Math.Max(Math.Min(currSlide + dCurr, 1f), 0f);

                invSlide = Math.Max(Math.Min(invSlide + dInv, 1f), 0f);
                if (invSlide == 1f)
                {
                    int numPkts = StaticVars.player.Stats.Inv.Pockets.Count;
                    if (numPkts > 4 && !(pktButtons[0].Visible || pktButtons[5].Visible))
                    {
                        pktButtons[5].Visible = true;
                        pktButtons[5].Active  = true;
                    }
                    if (numPkts > 3 && !(pktButtons[4].Visible))
                    {
                        pktButtons[4].Visible = true;
                        pktButtons[4].Active  = true;
                    }
                    if (numPkts > 2 && !(pktButtons[3].Visible))
                    {
                        pktButtons[3].Visible = true;
                        pktButtons[3].Active  = true;
                    }
                    if (numPkts > 1 && !(pktButtons[2].Visible))
                    {
                        pktButtons[2].Visible = true;
                        pktButtons[2].Active  = true;
                    }
                    if (numPkts > 0 && !(pktButtons[1].Visible))
                    {
                        pktButtons[1].Visible = true;
                        pktButtons[1].Active  = true;
                    }

                    if (StaticVars.player.Stats.Inv.Pockets[currPkt] != null)
                    {
                        for (int i = 0; i < 20; i++)
                        {
                            itemButtons[i].Btn.Visible = true;
                            itemButtons[i].Btn.Active  = true;
                        }
                    }
                }
                else
                {
                    foreach (Button alpha in pktButtons)
                    {
                        alpha.Visible = false;
                        alpha.Active  = false;
                    }
                    for (int i = 0; i < 20; i++)
                    {
                        itemButtons[i].Btn.Visible = false;
                        itemButtons[i].Btn.Active  = false;
                    }
                }

                skillSlide = Math.Max(Math.Min(skillSlide + dSkill, 1f), 0f);
                statSlide  = Math.Max(Math.Min(statSlide + dStat, 1f), 0f);
            }
        }