예제 #1
0
        public ToolbarEdit(ToolbarInfo info, bool expanded)
            : base(0, 28)
        {
            _Info = info;

            _Expanded    = expanded;
            _ExpandedInt = expanded ? 2 : 1;

            AddInit();
            AddControls();
            AddNavigation();
            AddResponses();
            AddEntries();
        }
예제 #2
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            case 0:
            {
                _ToolbarInfo = new ToolbarInfo(reader);
                break;
            }
            }
        }
예제 #3
0
        public ToolbarGump(ToolbarInfo info)
            : base(0, 28)
        {
            _Info = info;

            if (_Info.Lock)
            {
                Closable   = false;
                Disposable = false;
            }

            int offset = GumpIDs.Misc[(int)GumpIDs.MiscIDs.ButtonOffset].Content[_Info.Skin, 0];
            int bx = ((offset * 2) + (_Info.Rows * 110)), by = ((offset * 2) + (_Info.Collumns * 24)), byx = by, cy = 0;

            SetCoords(offset);

            if (_Info.Reverse)
            {
                cy = InitOptsH;
                by = 0;
            }

            AddPage(0);
            AddPage(1);

            if (_Info.Stealth)
            {
                AddMinimized(by, offset);
                AddPage(2);
            }

            AddInitOpts(by, offset);

            AddBackground(0, cy, bx, byx, GumpIDs.Misc[(int)GumpIDs.MiscIDs.Background].Content[_Info.Skin, 0]);

            string font = GumpIDs.Fonts[_Info.Font];

            if (_Info.Phantom)
            {
                font += "<BASEFONT COLOR=#FFFFFF>";
            }

            int temp = 0, x, y;

            for (int i = 0; i < _Info.Rows * _Info.Collumns; i++)
            {
                x = offset + ((i % _Info.Rows) * 110);
                y = offset + (int)(Math.Floor((double)(i / _Info.Rows)) * 24) + cy;

                AddButton(x + 1, y, 2445, 2445, temp + 10, GumpButtonType.Reply, 0);
                AddBackground(x, y, 110, 24, GumpIDs.Misc[(int)GumpIDs.MiscIDs.Buttonground].Content[_Info.Skin, 0]);

                if (_Info.Phantom)
                {
                    AddImageTiled(x + 2, y + 2, 106, 20, 2624);                // Alpha Area 1_1
                    AddAlphaRegion(x + 2, y + 2, 106, 20);                     // Alpha Area 1_2
                }

                AddHtml(x + 5, y + 3, 100, 20, String.Format("<center>{0}{1}", font, _Info.Entries[temp]), false, false);
                //AddLabelCropped(x + 5, y + 3, 100, 20, GumpIDs.Misc[(int)GumpIDs.MiscIDs.Color].Content[p_Skin,0], Commands[temp]);

                if (i % _Info.Rows == _Info.Rows - 1)
                {
                    temp += 9 - _Info.Rows;
                }

                ++temp;
            }

            /*TEST---
             * 0%5 == 0
             * 1%5 == 1
             * 2%5 == 2
             * 3%5 == 3
             * 4%5 == 4
             * 5%5 == 0
             * END TEST---*/

            if (_Info.Stealth)
            {
                return;
            }

            AddPage(2);
            AddMinimized(by, offset);
        }
예제 #4
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            Mobile m = sender.Mobile;

            _TextRelays = CreateList(info.TextEntries);

            switch (info.ButtonID)
            {
            case 0:
                break;

            case 1:
            {
                _Info.Skin++;
                m.SendGump(new ToolbarEdit(_Info, _Expanded));
                break;
            }

            case 2:
            {
                _Info.Skin--;
                m.SendGump(new ToolbarEdit(_Info, _Expanded));
                break;
            }

            case 3:
            {
                _Info.Rows++;
                m.SendGump(new ToolbarEdit(_Info, _Expanded));
                break;
            }

            case 4:
            {
                _Info.Rows--;
                m.SendGump(new ToolbarEdit(_Info, _Expanded));
                break;
            }

            case 5:
            {
                _Info.Collumns++;
                m.SendGump(new ToolbarEdit(_Info, _Expanded));
                break;
            }

            case 6:
            {
                _Info.Collumns--;
                m.SendGump(new ToolbarEdit(_Info, _Expanded));
                break;
            }

            case 9:                     // Default
            {
                var toolbarinfo = ToolbarInfo.DefaultEntries(m.AccessLevel);
                CombineEntries(toolbarinfo);
                toolbarinfo.AddRange(AnalyzeEntries(toolbarinfo.Count));
                _Info.Entries = toolbarinfo;
                m.SendGump(new ToolbarEdit(_Info, _Expanded));
                break;
            }

            case 10:                     // Okay
                goto case 12;

            case 11:                     // Cancel
                goto case 0;

            case 12:                     // Apply
            {
                ToolbarModule module = m.GetModule(typeof(ToolbarModule)) as ToolbarModule ?? new ToolbarModule(m);

                module.ToolbarInfo.Entries = AnalyzeEntries();

                module.ToolbarInfo.Phantom = info.IsSwitched(21);
                module.ToolbarInfo.Stealth = info.IsSwitched(23);
                module.ToolbarInfo.Reverse = info.IsSwitched(25);
                module.ToolbarInfo.Lock    = info.IsSwitched(27);

                if (info.ButtonID == 12)
                {
                    m.SendGump(new ToolbarEdit(_Info, _Expanded));
                }

                m.CloseGump(typeof(ToolbarGump));
                m.SendGump(new ToolbarGump(module.ToolbarInfo));

                break;
            }

            case 18:
            {
                _Info.Font++;
                m.SendGump(new ToolbarEdit(_Info, _Expanded));
                break;
            }

            case 19:
            {
                _Info.Font--;
                m.SendGump(new ToolbarEdit(_Info, _Expanded));
                break;
            }

            case 20:
            {
                m.SendGump(new ToolbarEdit(_Info, _Expanded));
                m.SendMessage(2101, "Phantom mode turns the toolbar semi-transparent.");
                break;
            }

            case 22:
            {
                m.SendGump(new ToolbarEdit(_Info, _Expanded));
                m.SendMessage(2101, "Stealth mode makes the toolbar automatically minimize when you click a button.");
                break;
            }

            case 24:
            {
                m.SendGump(new ToolbarEdit(_Info, _Expanded));
                m.SendMessage(2101, "Reverse mode puts the minimize bar above the toolbar instead of below.");
                break;
            }

            case 26:
            {
                m.SendGump(new ToolbarEdit(_Info, _Expanded));
                m.SendMessage(2101, "Lock mode disables closing the toolbar with right-click.");
                break;
            }

            case 28:                     // Expand
            {
                m.SendGump(new ToolbarEdit(_Info, !_Expanded));
                m.SendMessage(2101, "Expanded view {0}activated.", _Expanded ? "de" : "");
                break;
            }
            }
        }
예제 #5
0
 public ToolbarEdit(ToolbarInfo info)
     : this(info, false)
 {
 }
예제 #6
0
        public ToolbarGump(ToolbarInfo info, Mobile m)
            : base(0, 28)
        {
            _Info = info;

            if (_Info.Lock)
            {
                Closable   = false;
                Disposable = false;
            }

            int offset = GumpIDs.Misc[(int)GumpIDs.MiscIDs.ButtonOffset].Content[_Info.Skin, 0];
            int bx = ((offset * 2) + (_Info.Rows * 110)), by = ((offset * 2) + (_Info.Collumns * 24)), byx = by, cy = 0;

            SetCoords(offset);

            if (_Info.Reverse)
            {
                cy = InitOptsH;
                by = 0;
            }

            AddPage(0);
            AddPage(1);

            if (_Info.Stealth)
            {
                AddMinimized(by, offset);
                AddPage(2);
            }

            AddInitOpts(by, offset);

            AddBackground(0, cy, bx, byx, GumpIDs.Misc[(int)GumpIDs.MiscIDs.Background].Content[_Info.Skin, 0]);

            string font = GumpIDs.Fonts[_Info.Font];

            if (_Info.Phantom)
            {
                font += "<BASEFONT COLOR=#FFFFFF>";
            }

            int temp = 0, x, y;

            NetState ns = m.NetState;

            for (int i = 0; i < _Info.Rows * _Info.Collumns; i++)
            {
                x = offset + ((i % _Info.Rows) * 110);
                y = offset + (int)(Math.Floor((double)(i / _Info.Rows)) * 24) + cy;

                if (ns.IsEnhancedClient)
                {
                    AddButton(x + 1, y, 2435, 2436, temp + 10, GumpButtonType.Reply, 0);//4005, 4007
                }
                else
                {
                    AddButton(x + 1, y, 2445, 2445, temp + 10, GumpButtonType.Reply, 0);
                }

                AddBackground(x, y, 110, 24, GumpIDs.Misc[(int)GumpIDs.MiscIDs.Buttonground].Content[_Info.Skin, 0]);

                if (_Info.Phantom)
                {
                    AddImageTiled(x + 2, y + 2, 106, 20, 2624);                // Alpha Area 1_1
                    AddAlphaRegion(x + 2, y + 2, 106, 20);                     // Alpha Area 1_2
                }

                if (ns.IsEnhancedClient)
                {
                    AddHtml(x + 30, y + 3, 100, 20, String.Format("<center>{0}{1}", font, _Info.Entries[temp]), false, false);
                }
                else
                {
                    AddHtml(x + 5, y + 3, 100, 20, String.Format("<center>{0}{1}", font, _Info.Entries[temp]), false, false);
                }

                if (i % _Info.Rows == _Info.Rows - 1)
                {
                    temp += 9 - _Info.Rows;
                }

                ++temp;
            }

            if (_Info.Stealth)
            {
                return;
            }

            AddPage(2);
            AddMinimized(by, offset);
        }
예제 #7
0
 public ToolbarModule(Mobile from)
     : base(from)
 {
     _ToolbarInfo = ToolbarInfo.CreateNew(from);
 }