Beispiel #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);
            }
        }
Beispiel #2
0
        public static void _OnCommand(CommandEventArgs e)
        {
            var caller = e.Mobile;

            if (caller.HasGump(typeof(CompendiumPreviewPageGump)))
            {
                caller.CloseGump(typeof(CompendiumPreviewPageGump));
            }

            if (caller.HasGump(typeof(CompendiumPageEditor)))
            {
                caller.CloseGump(typeof(CompendiumPageEditor));
            }

            if (caller.HasGump(typeof(ElementListGump)))
            {
                caller.CloseGump(typeof(ElementListGump));
            }

            if (e.Arguments.Length <= 0)
            {
                return;
            }

            if (e.Arguments[0].IndexOfAny(Path.GetInvalidFileNameChars()) >= 0)
            {
                caller.SendMessage("That page name has illegal characters in it.");
                return;
            }

            var state = new CompendiumEditorState
            {
                PageName = e.Arguments[0],
                Caller   = (PlayerMobile)caller
            };

            if (Compendium.g_CompendiumRenderers.ContainsKey(state.PageName))
            {
                state.RendererToEdit = (CompendiumPageRenderer)Compendium.g_CompendiumRenderers[state.PageName].Clone();
            }
            else
            {
                state.RendererToEdit = new CompendiumPageRenderer
                {
                    Name = state.PageName
                };
            }

            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();
        }
Beispiel #3
0
		public SaveAsGump(CompendiumEditorState state)
			: base(state.Caller)
		{
			m_state = state;
			Disposable = false;
			Closable = false;
			Resizable = false;
		}
Beispiel #4
0
 public SaveAsGump(CompendiumEditorState state)
     : base(state.Caller)
 {
     m_state    = state;
     Disposable = false;
     Closable   = false;
     Resizable  = false;
 }
Beispiel #5
0
        public static void ShowSaveAs(object state)
        {
            CompendiumEditorState editorState = state as CompendiumEditorState;

            if (editorState != null)
            {
                editorState.Caller.SendGump(new SaveAsGump(editorState));
            }
        }
Beispiel #6
0
        public ElementListGump(CompendiumEditorState editorState)
            : base(editorState.Caller, null, 230, 0)
        {
            m_editorState = editorState;

            this.Closable = false;
            this.Disposable = false;
            this.Resizable = false;
            this.Dragable = true;
        }
Beispiel #7
0
        public ElementListGump(CompendiumEditorState editorState)
            : base(editorState.Caller, null, 230, 0)
        {
            m_editorState = editorState;

            this.Closable   = false;
            this.Disposable = false;
            this.Resizable  = false;
            this.Dragable   = true;
        }
Beispiel #8
0
        public CompendiumPageEditor(CompendiumEditorState state)
            : base(state.Caller, null)
        {
            state.EditorInstance = this;

            EditorState = state;

            Closable   = false;
            Disposable = false;
            Dragable   = true;
            Resizable  = false;
        }
Beispiel #9
0
        public CompendiumPageEditor(CompendiumEditorState state)
            : base(state.Caller, null)
        {
            if (state == null)
            {
                Console.WriteLine("Editor State was null");
                return;
            }
            else
            {
                state.EditorInstance = this;
            }

            EditorState = state;

            this.Closable   = false;
            this.Disposable = false;
            this.Dragable   = true;
            this.Resizable  = false;
        }
Beispiel #10
0
        public static void Update(object state)
        {
            CompendiumEditorState editorState = state as CompendiumEditorState;

            if (editorState != null)
            {
                if (editorState.EditorInstance != null)
                {
                    editorState.EditorInstance.Refresh(true);
                }

                if (editorState.ElementListGump != null)
                {
                    editorState.ElementListGump.Refresh(true);
                }

                if (editorState.PreviewGump != null)
                {
                    editorState.PreviewGump.Refresh(true);
                }
            }
        }
Beispiel #11
0
		public static void _OnCommand(CommandEventArgs e)
		{
			var caller = e.Mobile;

			if (caller.HasGump(typeof(CompendiumPreviewPageGump)))
			{
				caller.CloseGump(typeof(CompendiumPreviewPageGump));
			}

			if (caller.HasGump(typeof(CompendiumPageEditor)))
			{
				caller.CloseGump(typeof(CompendiumPageEditor));
			}

			if (caller.HasGump(typeof(ElementListGump)))
			{
				caller.CloseGump(typeof(ElementListGump));
			}

			if (e.Arguments.Length <= 0)
			{
				return;
			}

			if (e.Arguments[0].IndexOfAny(Path.GetInvalidFileNameChars()) >= 0)
			{
				caller.SendMessage("That page name has illegal characters in it.");
				return;
			}

			var state = new CompendiumEditorState
			{
				PageName = e.Arguments[0],
				Caller = (PlayerMobile)caller
			};

			if (Compendium.g_CompendiumRenderers.ContainsKey(state.PageName))
			{
				state.RendererToEdit = (CompendiumPageRenderer)Compendium.g_CompendiumRenderers[state.PageName].Clone();
			}
			else
			{
				state.RendererToEdit = new CompendiumPageRenderer
				{
					Name = state.PageName
				};
			}

			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();
		}
Beispiel #12
0
		public CompendiumPageEditor(CompendiumEditorState state)
			: base(state.Caller, null)
		{
			state.EditorInstance = this;

			EditorState = state;

			Closable = false;
			Disposable = false;
			Dragable = true;
			Resizable = false;
		}
        public CompendiumPageEditor(CompendiumEditorState state)
            : base(state.Caller, null)
        {

            if (state == null)
            {
                Console.WriteLine("Editor State was null");
                return;
            }
            else
            {
                state.EditorInstance = this;
            }

            EditorState = state;

            this.Closable = false;
            this.Disposable = false;
            this.Dragable = true;
            this.Resizable = false;
        }
Beispiel #14
0
		public virtual void onEditPageButtonClick(GumpButton button, object param)
		{
			if (m_caller.AccessLevel < AccessLevel.Administrator)
			{
				return;
			}

			try
			{
				var state = new CompendiumEditorState
				{
					PageName = Renderer.Name,
					Caller = (PlayerMobile)m_caller,
					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);
			}
		}