コード例 #1
0
 public static void RegisterElementType(Type elementType, CreateInstanceMethod method, string displayName)
 {
     if (!g_registeredElements.ContainsKey(elementType))
     {
         CompendiumElementRegistrationInfo info = new CompendiumElementRegistrationInfo {
             Index = g_registeredIndex, ElementType = elementType, Method = method, DisplayName = displayName
         };
         g_registeredElements.Add(elementType, info);
         g_registeredIndex++;
     }
     else
     {
         Console.WriteLine("That Compendium Page Element has already been registered! " + elementType.ToString());
     }
 }
コード例 #2
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();
        }
コード例 #3
0
ファイル: CompendiumPageEditor.cs プロジェクト: rokann/JustUO
		public static void RegisterElementType(Type elementType, CreateInstanceMethod method, string displayName)
		{
			if (!g_registeredElements.ContainsKey(elementType))
			{
				var info = new CompendiumElementRegistrationInfo
				{
					Index = g_registeredIndex,
					ElementType = elementType,
					Method = method,
					DisplayName = displayName
				};
				g_registeredElements.Add(elementType, info);
				g_registeredIndex++;
			}
			else
			{
				Console.WriteLine("That Compendium Page Element has already been registered! " + elementType);
			}
		}