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); } }
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 }
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(); } }
public void OnBackgroundCheckboxUpdate(IGumpComponent gumpComponent, object param) { GumpCheck check = gumpComponent as GumpCheck; if (check != null) { try { Background = check.InitialState; } catch { } } }
public void OnGumpIdTextEntryUpdate(IGumpComponent gumpComponent, object param) { GumpTextEntry entry = gumpComponent as GumpTextEntry; if (entry != null) { try { GumpId = Convert.ToInt32(entry.InitialText); } catch { } } }
public void OnTextEntryUpdate(IGumpComponent gumpComponent, object param) { GumpTextEntry entry = gumpComponent as GumpTextEntry; if (entry != null) { try { Text = entry.InitialText; } catch { } } }
public void OnScrollbarCheckboxUpdate(IGumpComponent gumpComponent, object param) { GumpCheck check = gumpComponent as GumpCheck; if (check != null) { try { Scrollbar = check.InitialState; } catch { } } }
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(); }
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(); }
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(); } }
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(); } }
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(); }
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(); }
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)); } } }
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)); } }
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; } } }
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)); } } }
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); } }
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(); }
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; } }
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); }
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); } }
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(); }
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(); }
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(); } }
public void onCancelButtonClick(IGumpComponent gumpComponent, object param) { //m_state.Refresh(); }
public void onPropertyPrevPageButtonClick(IGumpComponent gumpComponent, object param) { EditorState.PropertiesCurrentPageNumber--; EditorState.Refresh(); }
public void onPrevPageButtonClick(IGumpComponent gumpComponent, object param) { m_editorState.ElementListGumpCurrentPageNumber--; m_editorState.Refresh(); }
public void OnTextIdTextEntryUpdate(IGumpComponent gumpComponent, object param) { GumpTextEntry entry = gumpComponent as GumpTextEntry; if (entry != null) { try { Text = entry.InitialText; } catch { } } }
public void Remove(IGumpComponent g) { _Entries.Remove(g); g.Container = null; Invalidate(); }
public void onApplyPropertiesButtonClick(IGumpComponent gumpComponent, object param) { EditorState.Refresh(); }
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(); }
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(); }
public void OnItemIdTextEntryUpdate(IGumpComponent gumpComponent, object param) { GumpTextEntry entry = gumpComponent as GumpTextEntry; if (entry != null) { try { ItemId = Convert.ToInt32(entry.InitialText); } catch { } } }
public void onElementZOrderChangeDownButtonClick(IGumpComponent gumpComponent, object param) { ChangeZOrder(gumpComponent, Z_ORDER_CHANGE_DOWN); }
public void onElementPrevPageButtonClick(IGumpComponent gumpComponent, object param) { EditorState.ElementToolbarPageNumber--; EditorState.Refresh(); }
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); } }
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(); } }
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(); } }
private void button_OnCancel(IGumpComponent sender, object param) { if (OnCancelPressed != null) OnCancelPressed(sender, param); }
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(); }
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(); }
public void onSaveAsButtonClick(IGumpComponent gumpComponent, object param) { EditorState.Refresh(); Timer.DelayCall(ShowSaveAs, EditorState); }