コード例 #1
0
        public void onEditPageButtonClick(IGumpComponent gumpComponent, object param)
        {
            if (m_caller.AccessLevel < AccessLevel.Administrator)
            {
                return;
            }

            try
            {
                CompendiumEditorState state = new CompendiumEditorState();
                state.PageName = Renderer.Name;
                state.Caller = (PlayerMobile)m_caller;
                state.RendererToEdit = (CompendiumPageRenderer)Renderer.Clone();

                state.RendererToEdit.SelectedElement = null;
                state.EditorInstance = new CompendiumPageEditor(state);
                state.RendererToEdit.State = state;
                state.ElementListGump = new ElementListGump(state);

                state.PreviewGump = new CompendiumPreviewPageGump(state.Caller, state.RendererToEdit);

                state.EditorInstance.Send();
                state.ElementListGump.Send();
                state.PreviewGump.Send();
            }
            catch (Exception e)
            {
                Console.WriteLine("An exception was caught while trying to edit Compendium page.");
                Console.WriteLine(e);
            }
        }
コード例 #2
0
        public virtual void onHyperlinkClick(IGumpComponent gumpComponent, object param)
        {
            GumpButton button = gumpComponent as GumpButton;

            if (button != null)
            {
                try
                {
                  string linkName = m_hyperlinkRegistry.Where(element => element.Value == button.Param).First().Key;
                  
                  if (Compendium.g_CompendiumRenderers.ContainsKey(linkName))
                  {
                      CompendiumPageGump gump = new CompendiumPageGump(m_caller, Compendium.g_CompendiumRenderers[linkName]);
                      gump.Send();
                  }
                }
                catch (Exception e)
                {
                    Console.WriteLine("Bad CompendiumPageGump link");
                    Console.WriteLine(e);
                    this.Refresh();
                }
            }
            //lookup the hyperlink from the param and open the gump
        }
コード例 #3
0
ファイル: Gumpling.cs プロジェクト: havik/ForkUO
        public void Add(IGumpComponent g)
        {
            if (g.Parent == null)
                g.Parent = this;

            if (!this._Entries.Contains((IGumpComponent)g))
            {
                g.X += _X;
                g.Y += _Y;

                this._Entries.Add((IGumpComponent)g);
                this.Invalidate();
            }
        }
コード例 #4
0
        public void OnBackgroundCheckboxUpdate(IGumpComponent gumpComponent, object param)
        {
            GumpCheck check = gumpComponent as GumpCheck;

            if (check != null)
            {
                try
                {
                    Background = check.InitialState;
                }
                catch
                {
                }
            }
        }
コード例 #5
0
        public void OnGumpIdTextEntryUpdate(IGumpComponent gumpComponent, object param)
        {
            GumpTextEntry entry = gumpComponent as GumpTextEntry;

            if (entry != null)
            {
                try
                {
                    GumpId = Convert.ToInt32(entry.InitialText);
                }
                catch
                {
                }
            }
        }
コード例 #6
0
        public void OnTextEntryUpdate(IGumpComponent gumpComponent, object param)
        {
            GumpTextEntry entry = gumpComponent as GumpTextEntry;

            if (entry != null)
            {
                try
                {
                    Text = entry.InitialText;
                }
                catch
                {
                }
            }
        }
コード例 #7
0
        public void OnScrollbarCheckboxUpdate(IGumpComponent gumpComponent, object param)
        {
            GumpCheck check = gumpComponent as GumpCheck;

            if (check != null)
            {
                try
                {
                    Scrollbar = check.InitialState;
                }
                catch
                {
                }
            }
        }
コード例 #8
0
        public void onSavePageButtonClick(IGumpComponent gumpComponent, object param)
        {
            EditorState.RendererToEdit.Serialize();

            if (Compendium.g_CompendiumRenderers.ContainsKey(EditorState.RendererToEdit.Name))
            {
                Compendium.g_CompendiumRenderers[EditorState.RendererToEdit.Name] = EditorState.RendererToEdit;
            }
            else
            {
                Compendium.g_CompendiumRenderers.Add(EditorState.RendererToEdit.Name, EditorState.RendererToEdit);
            }

            EditorState.Refresh();
        }
コード例 #9
0
ファイル: ElementListGump.cs プロジェクト: LordEnigma/UO
        public void ChangeZOrder(IGumpComponent gumpComponent, int direction)
        {
            GumpButton button = gumpComponent as GumpButton;

            if (button != null)
            {
                var elements = m_editorState.RendererToEdit.Elements.OrderBy(element => element.Z);
                if (elements.Count() > 1)
                {
                    if (direction == Z_ORDER_CHANGE_UP)
                    {
                        if (button.Param > 0 && elements.Count() > button.Param)
                        {
                            BaseCompendiumPageElement upper = elements.ElementAt(button.Param - 1);
                            BaseCompendiumPageElement lower = elements.ElementAt(button.Param);

                            if (upper.Z == lower.Z)
                            {
                                lower.Z += 0.000001;
                            }

                            double temp = upper.Z;
                            upper.Z = lower.Z;
                            lower.Z = temp;
                        }
                    }
                    else if (direction == Z_ORDER_CHANGE_DOWN)
                    {
                        if (elements.Count() > button.Param + 1)
                        {
                            BaseCompendiumPageElement upper = elements.ElementAt(button.Param);
                            BaseCompendiumPageElement lower = elements.ElementAt(button.Param + 1);

                            if (upper.Z == lower.Z)
                            {
                                lower.Z += 0.000001;
                            }

                            double temp = upper.Z;
                            upper.Z = lower.Z;
                            lower.Z = temp;
                        }
                    }
                }
            }

            m_editorState.Refresh();
        }
コード例 #10
0
        public void Add(IGumpComponent g)
        {
            if (g.Container == null)
            {
                g.Container = this;
            }

            if (!_Entries.Contains(g))
            {
                g.X += _X;
                g.Y += _Y;

                _Entries.Add(g);
                Invalidate();
            }
        }
コード例 #11
0
ファイル: Gumpling.cs プロジェクト: blasterdude9/ForkUO-1
        public void Add(IGumpComponent g)
        {
            if (g.Parent == null)
            {
                g.Parent = this;
            }

            if (!this._Entries.Contains((IGumpComponent)g))
            {
                g.X += _X;
                g.Y += _Y;

                this._Entries.Add((IGumpComponent)g);
                this.Invalidate();
            }
        }
コード例 #12
0
        public void onGridButtonButtonClick(IGumpComponent gumpComponent, object param)
        {
            GumpButton button = gumpComponent as GumpButton;

            if (button != null && SelectedElement != null)
            {
                int x = (button.Param / NUMBER_OF_GRID_ROWS) * GRID_BUTTON_WIDTH;
                int y = (button.Param % NUMBER_OF_GRID_ROWS) * GRID_BUTTON_HEIGHT;

                SelectedElement.X = x;
                SelectedElement.Y = y;
                ShowEditorGrid    = false;
            }

            State.Refresh();
        }
コード例 #13
0
ファイル: Gumpling.cs プロジェクト: greeduomacro/RuneUO
		public void Add(IGumpComponent g)
		{
			if (g.Container == null)
			{
				g.Container = this;
			}

			if (!_Entries.Contains(g))
			{
				g.X += _X;
				g.Y += _Y;

				_Entries.Add(g);
				Invalidate();
			}
		}
コード例 #14
0
        public virtual void onAddElementButtonClick(IGumpComponent gumpComponent, object param)
        {
            GumpButton button = gumpComponent as GumpButton;

            if (button != null)
            {
                CompendiumElementRegistrationInfo instance = g_registeredElements.Values.Where(registeredKvp => registeredKvp.Index == button.Param).First();
                BaseCompendiumPageElement         element  = instance.Method();
                element.Z = EditorState.RendererToEdit.Elements.Count;
                EditorState.RendererToEdit.Elements.Add(element);
                EditorState.RendererToEdit.SelectedElement = element;
                EditorState.SelectedElement = element;
                EditorState.ElementListGump.setPageBySelectedElement(element);
            }

            EditorState.Refresh();
        }
コード例 #15
0
        private void RemoveDefinitionPressed(IGumpComponent sender, object param)
        {
            if (sender.Container is LabelAddRemoveGumpling)
            {
                Int32 index = ((LabelAddRemoveGumpling)sender.Container).Index;

                if (index < _TitleDefinitions.Count)
                {
                    _TitleDefinitions.RemoveAt(index);
                }

                if (Address != null)
                {
                    Address.SendGump(new SlayerTitleSetupGump(_CoreEnabled, _TitleDefinitions, _TitleIndex));
                }
            }
        }
コード例 #16
0
        public void onGumpCloseButtonClick(IGumpComponent gumpComponent, object param)
        {
            if (EditorState.Caller.HasGump(typeof(CompendiumPreviewPageGump)))
            {
                EditorState.Caller.CloseGump(typeof(CompendiumPreviewPageGump));
            }

            if (EditorState.Caller.HasGump(typeof(CompendiumPageEditor)))
            {
                EditorState.Caller.CloseGump(typeof(CompendiumPageEditor));
            }

            if (EditorState.Caller.HasGump(typeof(ElementListGump)))
            {
                EditorState.Caller.CloseGump(typeof(ElementListGump));
            }
        }
コード例 #17
0
ファイル: SaveAs.cs プロジェクト: greeduomacro/RuneUO
        public void onGumpNameEntryUpdate(IGumpComponent gumpComponent, object param)
        {
            GumpTextEntry entry = gumpComponent as GumpTextEntry;

            if (entry != null)
            {
                string gumpname = entry.InitialText;
                if (gumpname.IndexOfAny(System.IO.Path.GetInvalidFileNameChars()) >= 0)
                {
                    m_displayErrorMessage = true;
                }
                else
                {
                    m_gumpName = gumpname;
                    m_displayErrorMessage = false;
                }
            }
        }
コード例 #18
0
        private void RemoveEffectPressed(IGumpComponent sender, object param)
        {
            if (sender.Parent is LabelAddRemoveGumpling)
            {
                Int32 index = ((LabelAddRemoveGumpling)sender.Parent).Index;

                if (index < _FoodTypes.Count)
                {
                    _FoodTypes.RemoveAt(index);
                    _FoodEffects.RemoveAt(index);
                }

                if (Address != null)
                {
                    Address.SendGump(new FoodEffectsSetupGump(_CoreEnabled, _FoodTypes, _FoodEffects, _EffectIndex));
                }
            }
        }
コード例 #19
0
        private void SaveButtonPressed(IGumpComponent sender, object param)
        {
            SlayerTitleCore.Core.Enabled = _CoreEnabled;

            SlayerTitleCore.Core.TitleDefinitions.Clear();

            foreach (TitleDefinition def in _TitleDefinitions)
            {
                SlayerTitleCore.Core.TitleDefinitions.Add(def);
            }

            SlayerTitleCore.Core.CrossReferenceDefinitions();

            if (Address != null)
            {
                Address.SendMessage("Slayer Title System is {0}!  System contains {1} title definitions.", (SlayerTitleCore.Core.Enabled ? "enabled" : "disabled"), SlayerTitleCore.Core.TitleDefinitions.Count);
            }
        }
コード例 #20
0
        public void onGumpNameEntryUpdate(IGumpComponent gumpComponent, object param)
        {
            GumpTextEntry entry = gumpComponent as GumpTextEntry;

            if (entry != null)
            {
                string gumpname = entry.InitialText;
                if (gumpname.IndexOfAny(System.IO.Path.GetInvalidFileNameChars()) >= 0)
                {
                    m_displayErrorMessage = true;
                }
                else
                {
                    m_gumpName            = gumpname;
                    m_displayErrorMessage = false;
                }
            }
        }
コード例 #21
0
        public void onDeleteButtonClick(IGumpComponent gumpComponent, object param)
        {
            GumpButton button = gumpComponent as GumpButton;

            if (button != null)
            {
                try
                {
                    int idx      = button.Param;
                    var elements = m_editorState.RendererToEdit.Elements.OrderBy(element => element.Z);
                    BaseCompendiumPageElement elementToRemove = m_editorState.SelectedElement;
                    BaseCompendiumPageElement elementToSelect = null;

                    int count = elements.Count();

                    if (count > 1)
                    {
                        if (idx < count - 1)
                        {
                            elementToSelect = elements.ElementAt(idx + 1);
                        }
                        else if (idx == count - 1)
                        {
                            elementToSelect = elements.ElementAt(idx - 1);
                        }
                    }

                    m_editorState.SelectedElement = elementToSelect;
                    m_editorState.RendererToEdit.SelectedElement = elementToSelect;
                    m_editorState.RendererToEdit.Elements.Remove(elementToRemove);
                }
                catch (Exception e)
                {
                    if (Compendium.LOG_ERRORS)
                    {
                        Console.WriteLine("An exception was caught while trying to delete a compendium element");
                        Console.WriteLine(e);
                    }
                }
            }

            m_editorState.Refresh();
        }
コード例 #22
0
ファイル: HyperLink.cs プロジェクト: jasegiffin/JustUO
        public static void AddGumpEntryFirst(this Gump gump, IGumpComponent g)
        {
            if (g is GumpEntry)
            {
                if (!gump.Entries.Contains((GumpEntry)g))
                {
                    if (AssignIdMethodInfo != null)
                    {
                        AssignIdMethodInfo.Invoke((GumpEntry)g, new object[] { });
                    }
                    gump.Entries.Insert(0, (GumpEntry)g);
                    gump.Invalidate();
                }
            }

            if (g.Container == null)
            {
                g.Container = gump;
            }
        }
コード例 #23
0
        public static void AddGumpEntryFirst(this Gump gump, IGumpComponent g)
        {
            if (g is GumpEntry)
            {
                if (!gump.Entries.Contains((GumpEntry)g))
                {
                    if (AssignIdMethodInfo != null)
                    {
                        AssignIdMethodInfo.Invoke((GumpEntry)g, new object[] { });
                    }
                    gump.Entries.Insert(0, (GumpEntry)g);
                    gump.Invalidate();
                }
            }

            if (g.Container == null)
            {
                g.Container = gump;
            }
        }
コード例 #24
0
        private void SaveButtonPressed(IGumpComponent sender, object param)
        {
            FoodEffectsCore.Core.Enabled = _CoreEnabled;

            FoodEffectsCore.Core.FoodEffects.Clear();

            for (Int32 i = 0; i < _FoodTypes.Count; i++)
            {
                if (_FoodTypes[i] != null)
                {
                    FoodEffectsCore.Core.FoodEffects[_FoodTypes[i]] = _FoodEffects[i];
                }
            }

            if (Address != null)
            {
                Address.SendMessage("Food effect System is {0}!  System contains {1} foods defined.", (FoodEffectsCore.Core.Enabled ? "enabled" : "disabled"), FoodEffectsCore.Core.FoodEffects.Keys.Count);
            }

            FoodEffectsCore.InvokeOnFoodEffectSystemUpdate(FoodEffectsCore.Core);
        }
コード例 #25
0
ファイル: Gump.cs プロジェクト: davidthibodeau/JustUO
        public void Add(IGumpComponent g)
        {
            if (g.Container == null)
            {
                g.Container = this;
            }

            if (g is GumpEntry)
            {
                if (!_Entries.Contains((GumpEntry)g))
                {
                    ((GumpEntry)g).AssignID();
                    _Entries.Add((GumpEntry)g);
                    Invalidate();
                }
            }
            else if (g is Gumpling)
            {
                ((Gumpling)g).AddToGump(this);
            }
        }
コード例 #26
0
ファイル: ElementListGump.cs プロジェクト: LordEnigma/UO
        public void onBottomButtonClick(IGumpComponent gumpComponent, object param)
        {
            GumpButton button = gumpComponent as GumpButton;

            if (button != null)
            {
                int idx      = button.Param;
                var elements = m_editorState.RendererToEdit.Elements.OrderBy(element => element.Z);

                if (idx < elements.Count() - 1)
                {
                    BaseCompendiumPageElement lower = elements.ElementAt(elements.Count() - 1);
                    m_editorState.SelectedElement.Z = lower.Z + 1;

                    var changedElements = m_editorState.RendererToEdit.Elements.OrderBy(element => element.Z);
                    int newIdx          = changedElements.FindIndex(element => element == m_editorState.SelectedElement);
                    m_editorState.ElementListGumpCurrentPageNumber = newIdx / NUMBER_OF_ELEMENTS_PER_PAGE;
                }
            }

            m_editorState.Refresh();
        }
コード例 #27
0
        public void onBookEditTextButtonClick(IGumpComponent gumpComponent, object param)
        {
            GumpButton button = gumpComponent as GumpButton;

            if (button != null)
            {
                XmlTextEntryBook book = new XmlTextEntryBook(0, String.Empty, String.Empty, 20, true, XmlTextEntryBookCallback, new object[] { button.Param });

                List <ElementProperty> properties = EditorState.SelectedElement.GetElementPropertiesSnapshot();
                string bookText = properties[(int)button.Param].Text;
                // fill the contents of the book with the current text entry data
                book.FillTextEntryBook(bookText);

                // 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(EditorState.Caller.Location.X, EditorState.Caller.Location.Y, EditorState.Caller.Location.Z - 100), EditorState.Caller.Map);

                book.OnDoubleClick(EditorState.Caller);
            }

            EditorState.Refresh();
        }
コード例 #28
0
        public void onSaveButtonClick(IGumpComponent gumpComponent, object param)
        {
            if (!m_displayErrorMessage && !string.IsNullOrEmpty(m_gumpName) && !string.IsNullOrWhiteSpace(m_gumpName))
            {
                m_state.RendererToEdit.Name = m_gumpName;

                m_state.RendererToEdit.Serialize();

                if (Compendium.g_CompendiumRenderers.ContainsKey(m_state.RendererToEdit.Name))
                {
                    Compendium.g_CompendiumRenderers[m_state.RendererToEdit.Name] = m_state.RendererToEdit;
                }
                else
                {
                    Compendium.g_CompendiumRenderers.Add(m_state.RendererToEdit.Name, m_state.RendererToEdit);
                }

                m_state.Refresh();
            }
            else
            {
                this.Refresh();
            }
        }
コード例 #29
0
ファイル: SaveAs.cs プロジェクト: greeduomacro/RuneUO
        public void onSaveButtonClick(IGumpComponent gumpComponent, object param)
        {
            if (!m_displayErrorMessage && !string.IsNullOrEmpty(m_gumpName) && !string.IsNullOrWhiteSpace(m_gumpName))
            {
                m_state.RendererToEdit.Name = m_gumpName;

                m_state.RendererToEdit.Serialize();

                if (Compendium.g_CompendiumRenderers.ContainsKey(m_state.RendererToEdit.Name))
                {
                    Compendium.g_CompendiumRenderers[m_state.RendererToEdit.Name] = m_state.RendererToEdit;
                }
                else
                {
                    Compendium.g_CompendiumRenderers.Add(m_state.RendererToEdit.Name, m_state.RendererToEdit);
                }

                m_state.Refresh();
            }
            else
            {
                this.Refresh();
            }
        }
コード例 #30
0
 public void onCancelButtonClick(IGumpComponent gumpComponent, object param)
 {
     //m_state.Refresh();
 }
コード例 #31
0
 public void onPropertyPrevPageButtonClick(IGumpComponent gumpComponent, object param)
 {
     EditorState.PropertiesCurrentPageNumber--;
     EditorState.Refresh();
 }
コード例 #32
0
ファイル: ElementListGump.cs プロジェクト: LordEnigma/UO
 public void onPrevPageButtonClick(IGumpComponent gumpComponent, object param)
 {
     m_editorState.ElementListGumpCurrentPageNumber--;
     m_editorState.Refresh();
 }
コード例 #33
0
ファイル: LabelElement.cs プロジェクト: jasegiffin/JustUO
        public void OnTextIdTextEntryUpdate(IGumpComponent gumpComponent, object param)
        {
            GumpTextEntry entry = gumpComponent as GumpTextEntry;

            if (entry != null)
            {
                try
                {
                    Text = entry.InitialText;
                }
                catch
                {
                }
            }
        }
コード例 #34
0
ファイル: Gumpling.cs プロジェクト: greeduomacro/RuneUO
		public void Remove(IGumpComponent g)
		{
			_Entries.Remove(g);
			g.Container = null;
			Invalidate();
		}
コード例 #35
0
 public void Remove(IGumpComponent g)
 {
     _Entries.Remove(g);
     g.Container = null;
     Invalidate();
 }
コード例 #36
0
        public void onGumpCloseButtonClick(IGumpComponent gumpComponent, object param)
        {
            if (EditorState.Caller.HasGump(typeof(CompendiumPreviewPageGump)))
            {
                EditorState.Caller.CloseGump(typeof(CompendiumPreviewPageGump));
            }

            if (EditorState.Caller.HasGump(typeof(CompendiumPageEditor)))
            {
                EditorState.Caller.CloseGump(typeof(CompendiumPageEditor));
            }

            if (EditorState.Caller.HasGump(typeof(ElementListGump)))
            {
                EditorState.Caller.CloseGump(typeof(ElementListGump));
            }
        }
コード例 #37
0
ファイル: Gump.cs プロジェクト: mtPrimo/ServUO
		public void Add(IGumpComponent g)
		{
			if (g.Container == null)
			{
				g.Container = this;
			}

			if (g is GumpEntry)
			{
				if (!_Entries.Contains((GumpEntry)g))
				{
					((GumpEntry)g).AssignID();
					_Entries.Add((GumpEntry)g);
					Invalidate();
				}
			}
			else if (g is Gumpling)
			{
				((Gumpling)g).AddToGump(this);
			}
		}
コード例 #38
0
 public void onApplyPropertiesButtonClick(IGumpComponent gumpComponent, object param)
 {
     EditorState.Refresh();
 }
コード例 #39
0
        public void onNavigateButtonClick(IGumpComponent gumpComponent, object param)
        {
            GumpButton button = gumpComponent as GumpButton;
            if (button != null && EditorState != null && EditorState.SelectedElement != null)
            {
                switch (button.Param)
                {
                    case (int)NavButtonDirection.Up:
                    {
                        EditorState.SelectedElement.Y--;
                    }
                    break;

                    case (int)NavButtonDirection.UpUp:
                    {
                        EditorState.SelectedElement.Y -= 5;
                    }
                    break;

                    case (int)NavButtonDirection.Right:
                    {
                        EditorState.SelectedElement.X++;
                    }
                    break;

                    case (int)NavButtonDirection.RightRight:
                    {
                        EditorState.SelectedElement.X += 5;
                    }
                    break;

                    case (int)NavButtonDirection.Down:
                    {
                        EditorState.SelectedElement.Y++;
                    }
                    break;

                    case (int)NavButtonDirection.DownDown:
                    {
                        EditorState.SelectedElement.Y += 5;
                    }
                    break;

                    case (int)NavButtonDirection.Left:
                    {
                        EditorState.SelectedElement.X--;
                    }
                    break;

                    case (int)NavButtonDirection.LeftLeft:
                    {
                        EditorState.SelectedElement.X -= 5;
                    }
                    break;
                }
            }

            EditorState.Refresh();
        }
コード例 #40
0
        public void onSelectElementButtonClick(IGumpComponent gumpComponent, object param)
        {
            GumpButton button = gumpComponent as GumpButton;

            if (button != null)
            {
                int idx = button.Param;
                if (m_editorState.RendererToEdit.Elements.Count > idx)
                {
                    var elements = m_editorState.RendererToEdit.Elements.OrderBy(element => element.Z);

                    if (m_editorState.SelectedElement == elements.ElementAt(idx))
                    {
                        m_editorState.SelectedElement = null;
                        m_editorState.RendererToEdit.SelectedElement = null;
                    }
                    else
                    {
                        m_editorState.SelectedElement = elements.ElementAt(idx);
                        m_editorState.RendererToEdit.SelectedElement = elements.ElementAt(idx);
                    }
                }
            }

            m_editorState.Refresh();
        }
コード例 #41
0
        public void onBottomButtonClick(IGumpComponent gumpComponent, object param)
        {
            GumpButton button = gumpComponent as GumpButton;

            if (button != null)
            {
                int idx = button.Param;
                var elements = m_editorState.RendererToEdit.Elements.OrderBy(element => element.Z);

                if (idx < elements.Count() - 1)
                {
                    BaseCompendiumPageElement lower = elements.ElementAt(elements.Count() - 1);
                    m_editorState.SelectedElement.Z = lower.Z + 1;

                    var changedElements = m_editorState.RendererToEdit.Elements.OrderBy(element => element.Z);
                    int newIdx = changedElements.FindIndex(element => element == m_editorState.SelectedElement);
                    m_editorState.ElementListGumpCurrentPageNumber = newIdx / NUMBER_OF_ELEMENTS_PER_PAGE;
                }
            }

            m_editorState.Refresh();
        }
コード例 #42
0
        public void onDeleteButtonClick(IGumpComponent gumpComponent, object param)
        {
            GumpButton button = gumpComponent as GumpButton;

            if (button != null)
            {
                try
                {
                    int idx = button.Param;
                    var elements = m_editorState.RendererToEdit.Elements.OrderBy(element => element.Z);
                    BaseCompendiumPageElement elementToRemove = m_editorState.SelectedElement;
                    BaseCompendiumPageElement elementToSelect = null;

                    int count = elements.Count();

                    if (count > 1)
                    {
                        if (idx < count - 1)
                        {
                            elementToSelect = elements.ElementAt(idx + 1);
                        }
                        else if (idx == count - 1)
                        {
                            elementToSelect = elements.ElementAt(idx - 1);
                        }
                    }

                    m_editorState.SelectedElement = elementToSelect;
                    m_editorState.RendererToEdit.SelectedElement = elementToSelect;
                    m_editorState.RendererToEdit.Elements.Remove(elementToRemove);


                }
                catch (Exception e)
                {
                    if (Compendium.LOG_ERRORS)
                    {
                        Console.WriteLine("An exception was caught while trying to delete a compendium element");
                        Console.WriteLine(e);
                    }
                }
            }

            m_editorState.Refresh();
        }
コード例 #43
0
ファイル: ItemElement.cs プロジェクト: jasegiffin/JustUO
        public void OnItemIdTextEntryUpdate(IGumpComponent gumpComponent, object param)
        {
            GumpTextEntry entry = gumpComponent as GumpTextEntry;

            if (entry != null)
            {
                try
                {
                    ItemId = Convert.ToInt32(entry.InitialText);
                }
                catch
                {
                }
            }
        }
コード例 #44
0
ファイル: ElementListGump.cs プロジェクト: LordEnigma/UO
 public void onElementZOrderChangeDownButtonClick(IGumpComponent gumpComponent, object param)
 {
     ChangeZOrder(gumpComponent, Z_ORDER_CHANGE_DOWN);
 }
コード例 #45
0
 public void onElementPrevPageButtonClick(IGumpComponent gumpComponent, object param)
 {
     EditorState.ElementToolbarPageNumber--;
     EditorState.Refresh();
 }
コード例 #46
0
ファイル: Gump.cs プロジェクト: GaeaUO/ForkUO
        public void Add(IGumpComponent g)
        {
            if (g.Parent == null)
                g.Parent = this;

            if (g is GumpEntry)
            {
                if (!this._Entries.Contains((GumpEntry)g))
                {
                    ((GumpEntry)g).AssignID();
                    this._Entries.Add((GumpEntry)g);
                    this.Invalidate();
                }
            }
            else if (g is Gumpling)
            {
                ((Gumpling)g).AddToGump(this);
            }
        }
コード例 #47
0
ファイル: Gump.cs プロジェクト: mtPrimo/ServUO
		public void Remove(IGumpComponent g)
		{
			if (g is GumpEntry)
			{
				_Entries.Remove((GumpEntry)g);
				g.Container = null;
				Invalidate();
			}
			else if (g is Gumpling)
			{
				((Gumpling)g).RemoveFromGump(this);
				Invalidate();
			}
		}
コード例 #48
0
ファイル: Gump.cs プロジェクト: GaeaUO/ForkUO
 public void Remove(IGumpComponent g)
 {
     if (g is GumpEntry)
     {
         this._Entries.Remove((GumpEntry)g);
         g.Parent = null;
         this.Invalidate();
     }
     else if (g is Gumpling)
     {
         ((Gumpling)g).RemoveFromGump(this);
         this.Invalidate();
     }
 }
コード例 #49
0
 public void onApplyPropertiesButtonClick(IGumpComponent gumpComponent, object param)
 {
     EditorState.Refresh();
 }
コード例 #50
0
 public void onElementZOrderChangeDownButtonClick(IGumpComponent gumpComponent, object param)
 {
     ChangeZOrder(gumpComponent, Z_ORDER_CHANGE_DOWN);
 }
コード例 #51
0
 private void button_OnCancel(IGumpComponent sender, object param)
 {
     if (OnCancelPressed != null)
         OnCancelPressed(sender, param);
 }
コード例 #52
0
 public void onElementPrevPageButtonClick(IGumpComponent gumpComponent, object param)
 {
     EditorState.ElementToolbarPageNumber--;
     EditorState.Refresh();
 }
コード例 #53
0
 public void onPrevPageButtonClick(IGumpComponent gumpComponent, object param)
 {
     m_editorState.ElementListGumpCurrentPageNumber--;
     m_editorState.Refresh();
 }
コード例 #54
0
 public void onPropertyPrevPageButtonClick(IGumpComponent gumpComponent, object param)
 {
     EditorState.PropertiesCurrentPageNumber--;
     EditorState.Refresh();
 }
コード例 #55
0
        public void onTopButtonClick(IGumpComponent gumpComponent, object param)
        {
            GumpButton button = gumpComponent as GumpButton;

            if (button != null)
            {
                int idx = button.Param;
                var elements = m_editorState.RendererToEdit.Elements.OrderBy(element => element.Z);

                if (idx > 0)
                {
                    foreach (BaseCompendiumPageElement element in elements)
                    {
                        element.Z += 1;
                    }

                    BaseCompendiumPageElement topElement = elements.ElementAt(0);

                    m_editorState.SelectedElement.Z = topElement.Z - 1;

                    m_editorState.ElementListGumpCurrentPageNumber = 0;
                }
            }

            m_editorState.Refresh();
        }
コード例 #56
0
        public void onSavePageButtonClick(IGumpComponent gumpComponent, object param)
        {
            EditorState.RendererToEdit.Serialize();

            if (Compendium.g_CompendiumRenderers.ContainsKey(EditorState.RendererToEdit.Name))
            {
                Compendium.g_CompendiumRenderers[EditorState.RendererToEdit.Name] = EditorState.RendererToEdit;
            }
            else
            {
                Compendium.g_CompendiumRenderers.Add(EditorState.RendererToEdit.Name, EditorState.RendererToEdit);
            }

            EditorState.Refresh();
        }
コード例 #57
0
        public void onCloneButtonClick(IGumpComponent gumpComponent, object param)
        {
            GumpButton button = gumpComponent as GumpButton;

            if (button != null)
            {
                var elements = m_editorState.RendererToEdit.Elements.OrderBy(element => element.Z);
                if (button.Param >= 0 && elements.Count() > button.Param)
                {
                    BaseCompendiumPageElement newElement = elements.ElementAt(button.Param).Clone() as BaseCompendiumPageElement;

                    if (newElement != null)
                    {
                        m_editorState.RendererToEdit.Elements.Add(newElement);
                        m_editorState.ElementListGumpCurrentPageNumber = m_editorState.RendererToEdit.Elements.Count / NUMBER_OF_ELEMENTS_PER_PAGE;
                        m_editorState.SelectedElement = newElement;
                        m_editorState.RendererToEdit.SelectedElement = newElement;
                        BaseCompendiumPageElement lastElement = elements.ElementAt(elements.Count() - 1);
                        newElement.Z = lastElement.Z + 1.0;
                    }
                }
            }

            m_editorState.Refresh();
        }
コード例 #58
0
 public void onSaveAsButtonClick(IGumpComponent gumpComponent, object param)
 {
     EditorState.Refresh();
     Timer.DelayCall(ShowSaveAs, EditorState);
 }
コード例 #59
0
        public void ChangeZOrder(IGumpComponent gumpComponent, int direction)
        {
            GumpButton button = gumpComponent as GumpButton;

            if (button != null)
            {
                var elements = m_editorState.RendererToEdit.Elements.OrderBy(element => element.Z);
                if (elements.Count() > 1)
                {
                    if (direction == Z_ORDER_CHANGE_UP)
                    {
                        if (button.Param > 0 && elements.Count() > button.Param)
                        {
                            BaseCompendiumPageElement upper = elements.ElementAt(button.Param - 1);
                            BaseCompendiumPageElement lower = elements.ElementAt(button.Param);

                            if (upper.Z == lower.Z)
                            {
                                lower.Z += 0.000001;
                            }

                            double temp = upper.Z;
                            upper.Z = lower.Z;
                            lower.Z = temp;
                        }
                    }
                    else if (direction == Z_ORDER_CHANGE_DOWN)
                    {
                        if (elements.Count() > button.Param + 1)
                        {
                            BaseCompendiumPageElement upper = elements.ElementAt(button.Param);
                            BaseCompendiumPageElement lower = elements.ElementAt(button.Param + 1);

                            if (upper.Z == lower.Z)
                            {
                                lower.Z += 0.000001;
                            }

                            double temp = upper.Z;
                            upper.Z = lower.Z;
                            lower.Z = temp;
                        }
                    }
                }
            }

            m_editorState.Refresh();
        }
コード例 #60
0
 public void onSaveAsButtonClick(IGumpComponent gumpComponent, object param)
 {
     EditorState.Refresh();
     Timer.DelayCall(ShowSaveAs, EditorState);
 }