Пример #1
0
        public BattleMenu()
        {
            PostProcessing.Add((IRequireResource)this);

            punch = new Button();
            punch.Area = new Rectangle(19, 515, 125, 61);
            punch.OnMouseUp = delegate {

            };

            jump = new Button();
            jump.Area = new Rectangle(147, 515, 125, 61);
            jump.OnMouseUp = delegate {

            };

            arms = new Button();
            arms.Area = new Rectangle(274, 515, 125, 61);
            arms.OnMouseUp = delegate {
                currState = BMenuState.ARMS;
            };

            magick = new Button();
            magick.Area = new Rectangle(402, 515, 125, 61);
            magick.OnMouseUp = delegate {
                currState = BMenuState.SKILL;
            };

            items = new Button();
            items.Area = new Rectangle(529, 515, 125, 61);
            items.OnMouseUp = delegate {
                currState = BMenuState.ITEM;
            };

            run = new Button();
            run.Area = new Rectangle(657, 515, 125, 61);
            run.OnMouseUp = delegate {

            };

            menu = new Menu();
            menu.Add(punch);
            menu.Add(jump);
            menu.Add(arms);
            menu.Add(magick);
            menu.Add(items);
            menu.Add(run);
        }
Пример #2
0
            public ItemButton(int i, ADAMenu inst)
            {
                this.i = i;
                btn = new Button();
                btn.Area = new Rectangle(244 + (i > 9 ? 240 : 0), 90 + ((i % 10) * 31), 234, 24);

                btn.OnMouseDown = delegate {
                    if(inst.CDB == -1) {
                        inst.CDB = i;
                    }
                };

                btn.OnMouseUp = delegate {
                    if(inst.CDB != i) {
                        DarosGame.Inventory.Pocket pkt = inst.CurrPkt;
                        Item.Item temp = pkt[i];
                        pkt[i] = pkt[inst.CDB];
                        pkt[inst.CDB] = temp;
                        temp = null;
                    }
                    inst.CDB = -1;
                };
            }
Пример #3
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);
            }
        }
Пример #4
0
 public void Add(Button btn)
 {
     btns.Add(btn);
 }