コード例 #1
0
        private XmlEditDialogGump Refresh(NetState state)
        {
            XmlEditDialogGump g = new XmlEditDialogGump(this.m_From, false, this.m_Dialog, this.Selected,
                                                        this.DisplayFrom, this.SaveFilename, this.SelectAll, this.m_SelectionList, this.X, this.Y);

            state.Mobile.SendGump(g);
            return(g);
        }
コード例 #2
0
ファイル: XmlEdit.cs プロジェクト: Evad-lab/ServUOX
        private XmlEditDialogGump Refresh(NetState state)
        {
            XmlEditDialogGump g = new XmlEditDialogGump(m_From, false, m_Dialog, Selected,
                                                        DisplayFrom, SaveFilename, SelectAll, m_SelectionList, X, Y);

            state.Mobile.SendGump(g);
            return(g);
        }
コード例 #3
0
            public XmlConfirmDeleteGump(Mobile from, XmlEditDialogGump gump, ArrayList searchlist, bool[] selectedlist, int displayfrom, bool selectall, int allcount)
                : base(0, 0)
            {
                this.SearchList   = searchlist;
                this.SelectedList = selectedlist;
                this.DisplayFrom  = displayfrom;
                this.selectAll    = selectall;
                this.m_Gump       = gump;
                this.From         = from;
                this.Closable     = false;
                this.Dragable     = true;
                this.AddPage(0);
                this.AddBackground(10, 200, 200, 130, 5054);
                int count = 0;

                if (selectall)
                {
                    count = allcount;
                }
                else
                {
                    for (int i = 0; i < this.SelectedList.Length; i++)
                    {
                        if (this.SelectedList[i])
                        {
                            count++;
                        }
                    }
                }

                this.AddLabel(20, 225, 33, String.Format("Delete {0} entries?", count));
                this.AddRadio(35, 255, 9721, 9724, false, 1);                            // accept/yes radio
                this.AddRadio(135, 255, 9721, 9724, true, 2);                            // decline/no radio
                this.AddHtmlLocalized(72, 255, 200, 30, 1049016, 0x7fff, false, false);  // Yes
                this.AddHtmlLocalized(172, 255, 200, 30, 1049017, 0x7fff, false, false); // No
                this.AddButton(80, 289, 2130, 2129, 3, GumpButtonType.Reply, 0);         // Okay button
            }
コード例 #4
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            if (info == null || state == null || state.Mobile == null || m_Dialog == null)
            {
                return;
            }

            int radiostate = -1;

            if (info.Switches.Length > 0)
            {
                radiostate = info.Switches[0];
            }



            TextRelay tr = info.GetTextEntry(400);                      // displayfrom info

            try
            {
                DisplayFrom = int.Parse(tr.Text);
            }
            catch {}


            tr = info.GetTextEntry(300);                      // savefilename info
            if (tr != null)
            {
                SaveFilename = tr.Text;
            }

            if (m_Dialog != null)
            {
                tr = info.GetTextEntry(140);                          // proximity range
                if (tr != null)
                {
                    try
                    {
                        m_Dialog.ProximityRange = int.Parse(tr.Text);
                    }
                    catch {}
                }
                tr = info.GetTextEntry(141);                          // reset time
                if (tr != null)
                {
                    try
                    {
                        m_Dialog.ResetTime = TimeSpan.Parse(tr.Text);
                    }
                    catch {}
                }
                tr = info.GetTextEntry(142);                          // speech pace
                if (tr != null)
                {
                    try
                    {
                        m_Dialog.SpeechPace = int.Parse(tr.Text);
                    }
                    catch {}
                }

                tr = info.GetTextEntry(150);                          // trig on carried
                if (tr != null && (m_Dialog.TriggerOnCarried == null || m_Dialog.TriggerOnCarried.Length < 230))
                {
                    if (tr.Text != null && tr.Text.Trim().Length > 0)
                    {
                        m_Dialog.TriggerOnCarried = tr.Text;
                    }
                    else
                    {
                        m_Dialog.TriggerOnCarried = null;
                    }
                }

                tr = info.GetTextEntry(151);                          // notrig on carried
                if (tr != null && (m_Dialog.NoTriggerOnCarried == null || m_Dialog.NoTriggerOnCarried.Length < 230))
                {
                    if (tr.Text != null && tr.Text.Trim().Length > 0)
                    {
                        m_Dialog.NoTriggerOnCarried = tr.Text;
                    }
                    else
                    {
                        m_Dialog.NoTriggerOnCarried = null;
                    }
                }

                m_Dialog.AllowGhostTrig = info.IsSwitched(260);                 // allow ghost triggering
            }

            if (m_SearchList != null && Selected >= 0 && Selected + DisplayFrom >= 0 && Selected + DisplayFrom < m_SearchList.Count)
            {
                // entry information
                XmlDialog.SpeechEntry entry = (XmlDialog.SpeechEntry)m_SearchList[Selected + DisplayFrom];

                tr = info.GetTextEntry(200);                          // entry number
                if (tr != null)
                {
                    try
                    {
                        entry.EntryNumber = int.Parse(tr.Text);
                    }
                    catch {}
                }

                tr = info.GetTextEntry(201);                          // entry id
                if (tr != null)
                {
                    try
                    {
                        entry.ID = int.Parse(tr.Text);
                    }
                    catch {}
                }

                tr = info.GetTextEntry(202);                          // depends on
                if (tr != null)
                {
                    try
                    {
                        entry.DependsOn = tr.Text;
                    }
                    catch {}
                }

                tr = info.GetTextEntry(203);                          // prepause
                if (tr != null)
                {
                    try
                    {
                        entry.PrePause = int.Parse(tr.Text);
                    }
                    catch {}
                }

                tr = info.GetTextEntry(204);                          // pause
                if (tr != null)
                {
                    try
                    {
                        entry.Pause = int.Parse(tr.Text);
                    }
                    catch {}
                }

                tr = info.GetTextEntry(205);                          // hue
                if (tr != null)
                {
                    try
                    {
                        entry.SpeechHue = int.Parse(tr.Text);
                    }
                    catch {}
                }

                tr = info.GetTextEntry(101);                          // keywords
                if (tr != null && (entry.Keywords == null || entry.Keywords.Length < 230))
                {
                    if (tr.Text != null && tr.Text.Trim().Length > 0)
                    {
                        entry.Keywords = tr.Text;
                    }
                    else
                    {
                        entry.Keywords = null;
                    }
                }

                tr = info.GetTextEntry(100);                          // text
                if (tr != null && (entry.Text == null || entry.Text.Length < 230))
                {
                    if (tr.Text != null && tr.Text.Trim().Length > 0)
                    {
                        entry.Text = tr.Text;
                    }
                    else
                    {
                        entry.Text = null;
                    }
                }

                tr = info.GetTextEntry(102);                          // condition
                if (tr != null && (entry.Condition == null || entry.Condition.Length < 230))
                {
                    if (tr.Text != null && tr.Text.Trim().Length > 0)
                    {
                        entry.Condition = tr.Text;
                    }
                    else
                    {
                        entry.Condition = null;
                    }
                }

                tr = info.GetTextEntry(103);                          // action
                if (tr != null && (entry.Action == null || entry.Action.Length < 230))
                {
                    if (tr.Text != null && tr.Text.Trim().Length > 0)
                    {
                        entry.Action = tr.Text;
                    }
                    else
                    {
                        entry.Action = null;
                    }
                }

                tr = info.GetTextEntry(104);                          // gump
                if (tr != null && (entry.Gump == null || entry.Gump.Length < 230))
                {
                    if (tr.Text != null && tr.Text.Trim().Length > 0)
                    {
                        entry.Gump = tr.Text;
                    }
                    else
                    {
                        entry.Gump = null;
                    }
                }

                entry.LockConversation = info.IsSwitched(250);                  // lock conversation
                entry.AllowNPCTrigger  = info.IsSwitched(251);                  // allow npc
                entry.IgnoreCarried    = info.IsSwitched(252);                  // ignorecarried
            }



            switch (info.ButtonID)
            {
            case 0:                     // Close
            {
                m_Dialog.DeleteTextEntryBook();

                return;
            }

            case 100:                     // toggle running status
            {
                m_Dialog.Running = !m_Dialog.Running;

                break;
            }

            case 155:                     // add new entry
            {
                if (m_SearchList != null)
                {
                    // find the last entry
                    int lastentry = 0;
                    foreach (XmlDialog.SpeechEntry e in m_SearchList)
                    {
                        if (e.EntryNumber > lastentry)
                        {
                            lastentry = e.EntryNumber;
                        }
                    }
                    lastentry += 10;
                    XmlDialog.SpeechEntry se = new XmlDialog.SpeechEntry();
                    se.EntryNumber = lastentry;
                    se.ID          = lastentry;
                    m_SearchList.Add(se);
                    Selected = m_SearchList.Count - 1;
                }
                break;
            }

            case 156:                     // Delete selected entries
            {
                XmlEditDialogGump g = Refresh(state);
                int allcount        = 0;
                if (m_SearchList != null)
                {
                    allcount = m_SearchList.Count;
                }
                state.Mobile.SendGump(new XmlConfirmDeleteGump(state.Mobile, g, m_SearchList, m_SelectionList, DisplayFrom, SelectAll, allcount));
                return;
            }

            case 159:                     // save to a .npc file
            {
                // Create a new gump
                Refresh(state);
                // try to save
                m_Dialog.DoSaveNPC(state.Mobile, SaveFilename, true);

                return;
            }

            case 201:                     // forward block
            {
                // clear the selections
                if (m_SelectionList != null && !SelectAll)
                {
                    Array.Clear(m_SelectionList, 0, m_SelectionList.Length);
                }
                if (m_SearchList != null && DisplayFrom + MaxEntries < m_SearchList.Count)
                {
                    DisplayFrom += MaxEntries;
                    // clear any selection
                    Selected = -1;
                }
                break;
            }

            case 202:                     // backward block
            {
                // clear the selections
                if (m_SelectionList != null && !SelectAll)
                {
                    Array.Clear(m_SelectionList, 0, m_SelectionList.Length);
                }
                DisplayFrom -= MaxEntries;
                if (DisplayFrom < 0)
                {
                    DisplayFrom = 0;
                }
                // clear any selection
                Selected = -1;
                break;
            }

            case 700:                     // Sort
            {
                // clear any selection
                Selected = -1;
                // clear the selections
                if (m_SelectionList != null && !SelectAll)
                {
                    Array.Clear(m_SelectionList, 0, m_SelectionList.Length);
                }

                SortFindList();
                break;
            }

            case 9998:                      // refresh the gump
            {
                // clear any selection
                Selected = -1;
                break;
            }

            default:
            {
                if (info.ButtonID >= 1000 && info.ButtonID < 1000 + MaxEntries)
                {
                    // flag the entry selected
                    Selected = info.ButtonID - 1000;
                }
                else
                if (info.ButtonID == 3998)
                {
                    SelectAll = !SelectAll;

                    // dont allow individual selection with the selectall button selected
                    if (m_SelectionList != null)
                    {
                        for (int i = 0; i < MaxEntries; i++)
                        {
                            if (i < m_SelectionList.Length)
                            {
                                // only toggle the selection list entries for things that actually have entries
                                m_SelectionList[i] = SelectAll;
                            }
                            else
                            {
                                break;
                            }
                        }
                    }
                }
                else
                if (info.ButtonID == 3999)
                {
                    // dont allow individual selection with the selectall button selected
                    if (m_SelectionList != null && m_SearchList != null && !SelectAll)
                    {
                        for (int i = 0; i < MaxEntries; i++)
                        {
                            if (i < m_SelectionList.Length)
                            {
                                // only toggle the selection list entries for things that actually have entries
                                if ((m_SearchList.Count - DisplayFrom > i))
                                {
                                    m_SelectionList[i] = !m_SelectionList[i];
                                }
                            }
                            else
                            {
                                break;
                            }
                        }
                    }
                }
                else
                if (info.ButtonID >= 4000 && info.ButtonID < 4000 + MaxEntries)
                {
                    int i = info.ButtonID - 4000;
                    // dont allow individual selection with the selectall button selected
                    if (m_SelectionList != null && i >= 0 && i < m_SelectionList.Length && !SelectAll)
                    {
                        // only toggle the selection list entries for things that actually have entries
                        if (m_SearchList != null && (m_SearchList.Count - DisplayFrom > i))
                        {
                            m_SelectionList[i] = !m_SelectionList[i];
                        }
                    }
                }
                else
                if (info.ButtonID >= 5000 && info.ButtonID < 5100)
                {
                    // text entry book buttons
                    int textid = info.ButtonID - 5000;

                    // entry information
                    XmlDialog.SpeechEntry entry = null;

                    if (m_SearchList != null && Selected >= 0 && Selected + DisplayFrom >= 0 && Selected + DisplayFrom < m_SearchList.Count)
                    {
                        entry = (XmlDialog.SpeechEntry)m_SearchList[Selected + DisplayFrom];
                    }

                    string text  = String.Empty;
                    string title = String.Empty;
                    switch (textid)
                    {
                    case 0:                                     // text
                        if (entry != null)
                        {
                            text = entry.Text;
                        }
                        title = "Text";
                        break;

                    case 1:                                     // keywords
                        if (entry != null)
                        {
                            text = entry.Keywords;
                        }
                        title = "Keywords";
                        break;

                    case 2:                                     // condition
                        if (entry != null)
                        {
                            text = entry.Condition;
                        }
                        title = "Condition";
                        break;

                    case 3:                                     // action
                        if (entry != null)
                        {
                            text = entry.Action;
                        }
                        title = "Action";
                        break;

                    case 4:                                     // gump
                        if (entry != null)
                        {
                            text = entry.Gump;
                        }
                        title = "Gump";
                        break;

                    case 5:                                     // trigoncarried
                        text  = m_Dialog.TriggerOnCarried;
                        title = "TrigOnCarried";
                        break;

                    case 6:                                     // notrigoncarried
                        text  = m_Dialog.NoTriggerOnCarried;
                        title = "NoTrigOnCarried";
                        break;
                    }

                    object [] args = new object[6];

                    args[0] = m_Dialog;
                    args[1] = entry;
                    args[2] = textid;
                    args[3] = Selected;
                    args[4] = DisplayFrom;
                    args[5] = SaveFilename;

                    XmlTextEntryBook book = new XmlTextEntryBook(0, String.Empty, m_Dialog.Name, 20, true, new XmlTextEntryBookCallback(ProcessXmlEditBookEntry), args);

                    if (m_Dialog.m_TextEntryBook == null)
                    {
                        m_Dialog.m_TextEntryBook = new ArrayList();
                    }
                    m_Dialog.m_TextEntryBook.Add(book);

                    book.Title  = title;
                    book.Author = Name;

                    // fill the contents of the book with the current text entry data
                    book.FillTextEntryBook(text);

                    // put the book at the location of the player so that it can be opened, but drop it below visible range
                    book.Visible = false;
                    book.Movable = false;
                    book.MoveToWorld(new Point3D(state.Mobile.Location.X, state.Mobile.Location.Y, state.Mobile.Location.Z - 100), state.Mobile.Map);

                    // Create a new gump
                    Refresh(state);

                    // and open it
                    book.OnDoubleClick(state.Mobile);

                    return;
                }
                break;
            }
            }
            // Create a new gump
            Refresh(state);
        }
コード例 #5
0
ファイル: XmlEdit.cs プロジェクト: cynricthehun/UOLegends
            public XmlConfirmDeleteGump(Mobile from, XmlEditDialogGump gump, ArrayList searchlist, bool [] selectedlist, int displayfrom, bool selectall, int allcount)
                : base(0, 0)
            {
                SearchList = searchlist;
                SelectedList = selectedlist;
                DisplayFrom = displayfrom;
                selectAll = selectall;
                m_Gump = gump;
                From = from;
                Closable = false;
                Dragable = true;
                AddPage( 0 );
                AddBackground( 10, 200, 200, 130, 5054 );
                int count = 0;
                if(selectall)
                {
                    count = allcount;
                }
                else
                {
                    for(int i =0;i<SelectedList.Length;i++)
                    {
                        if(SelectedList[i]) count++;
                    }
                }

                AddLabel( 20, 225, 33, String.Format("Delete {0} entries?",count) );
                AddRadio( 35, 255, 9721, 9724, false, 1 ); // accept/yes radio
                AddRadio( 135, 255, 9721, 9724, true, 2 ); // decline/no radio
                AddHtmlLocalized(72, 255, 200, 30, 1049016, 0x7fff , false , false ); // Yes
                AddHtmlLocalized(172, 255, 200, 30, 1049017, 0x7fff , false , false ); // No
                AddButton( 80, 289, 2130, 2129, 3, GumpButtonType.Reply, 0 ); // Okay button
            }
コード例 #6
0
ファイル: XmlEdit.cs プロジェクト: cynricthehun/UOLegends
 private XmlEditDialogGump Refresh(NetState state)
 {
     XmlEditDialogGump g = new XmlEditDialogGump(this.m_From, false, this.m_Dialog, this.Selected,
         this.DisplayFrom, this.SaveFilename, this.SelectAll, this.m_SelectionList, this.X, this.Y);
     state.Mobile.SendGump(g);
     return g;
 }
コード例 #7
0
ファイル: XmlEdit.cs プロジェクト: FreeReign/imaginenation
		private XmlEditDialogGump Refresh(NetState state)
		{
			XmlEditDialogGump g = new XmlEditDialogGump(m_From, false, m_Dialog, Selected, 
				DisplayFrom, SaveFilename, SelectAll, m_SelectionList, X, Y);
			state.Mobile.SendGump(g);
			return g;
		}