Exemple #1
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            Mobile m = sender.Mobile;

            TextRelays = CreateList(info.TextEntries);


            bool[] switches = new bool[4]
            {
                info.IsSwitched(21),
                info.IsSwitched(23),
                info.IsSwitched(25),
                info.IsSwitched(27)
            };

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

            case 1: m.SendGump(new ToolbarEdit(p_Info, this.p_Expanded, AnalyzeEntries(), Skin + 1, Columns, Rows, Font, switches)); break;

            case 2: m.SendGump(new ToolbarEdit(p_Info, this.p_Expanded, AnalyzeEntries(), Skin - 1, Columns, Rows, Font, switches)); break;

            case 3: m.SendGump(new ToolbarEdit(p_Info, this.p_Expanded, AnalyzeEntries(), Skin, Columns, Rows + 1, Font, switches)); break;

            case 4: m.SendGump(new ToolbarEdit(p_Info, this.p_Expanded, AnalyzeEntries(), Skin, Columns, Rows - 1, Font, switches)); break;

            case 5: m.SendGump(new ToolbarEdit(p_Info, this.p_Expanded, AnalyzeEntries(), Skin, Columns + 1, Rows, Font, switches)); break;

            case 6: m.SendGump(new ToolbarEdit(p_Info, this.p_Expanded, AnalyzeEntries(), Skin, Columns - 1, Rows, Font, switches)); break;

            //case 7:
            //m.SendGump( new ToolbarEdit( p_Info, this.p_Expanded, AnalyzeEntries(), Skin, Columns, Rows, Font, switches ));
            //m.SendMessage( 32, "The Marker utility is not an active feature yet; please be patient." );
            //goto case 0;
            case 9:                             // Default
                List <string> toolbarinfo = ToolbarInfo.DefaultEntries((int)m.AccessLevel);
                CombineEntries(toolbarinfo);
                toolbarinfo.AddRange(AnalyzeEntries(toolbarinfo.Count));
                m.SendGump(new ToolbarEdit(p_Info, this.p_Expanded, toolbarinfo, Skin, Columns, Rows, Font, switches));
                break;

            case 10:                            // Okay
                goto case 12;

            case 11:                            // Cancel
                goto case 0;

            case 12:                            // Apply
                Account     acc   = m.Account as Account;
                ToolbarInfo infos = null;
                for (int i = 0; i < ToolbarHelper.Infos.Info.Count; i++)
                {
                    if (ToolbarHelper.Infos.Info[i].Account == acc.Username)
                    {
                        infos = ToolbarHelper.Infos.Info[i];
                    }
                }
                if (infos == null)
                {
                    infos = ToolbarInfo.CreateNew(m, acc);
                }
                List <int> dims = new List <int>();
                dims.Add(Columns);
                dims.Add(Rows);

                infos.SetAttributes(acc.Username, dims, AnalyzeEntries(), Skin, infos.Points, Font, switches);

                if (info.ButtonID == 12)
                {
                    m.SendGump(new ToolbarEdit(infos, this.p_Expanded));
                }
                m.CloseGump(typeof(Toolbar));
                m.SendGump(new Toolbar(infos));
                break;

            case 18: m.SendGump(new ToolbarEdit(p_Info, this.p_Expanded, AnalyzeEntries(), Skin, Columns, Rows, Font + 1, switches)); break;

            case 19: m.SendGump(new ToolbarEdit(p_Info, this.p_Expanded, AnalyzeEntries(), Skin, Columns, Rows, Font - 1, switches)); break;

            case 20:
                m.SendGump(new ToolbarEdit(p_Info, this.p_Expanded, AnalyzeEntries(), Skin, Columns, Rows, Font, switches));
                m.SendMessage(2101, "Phantom mode turns the toolbar semi-transparent.");
                break;

            case 22:
                m.SendGump(new ToolbarEdit(p_Info, this.p_Expanded, AnalyzeEntries(), Skin, Columns, Rows, Font, switches));
                m.SendMessage(2101, "Stealth mode makes the toolbar automatically minimize when you click a button.");
                break;

            case 24:
                m.SendGump(new ToolbarEdit(p_Info, this.p_Expanded, AnalyzeEntries(), Skin, Columns, Rows, Font, switches));
                m.SendMessage(2101, "Reverse mode puts the minimize bar above the toolbar instead of below.");
                break;

            case 26:
                m.SendGump(new ToolbarEdit(p_Info, this.p_Expanded, AnalyzeEntries(), Skin, Columns, Rows, Font, switches));
                m.SendMessage(2101, "Lock mode disables closing the toolbar with right-click.");
                break;

            case 28:                            // Expand
                m.SendGump(new ToolbarEdit(p_Info, !this.p_Expanded, AnalyzeEntries(), Skin, Columns, Rows, Font, switches));
                m.SendMessage(2101, "Expanded view {0}activated.", this.p_Expanded ? "de" : "");
                break;
            }
        }