void OnGUI() { MadGUI.Info("There's more than one Panel on the scene. Please set the one that you want to create the bar on."); panel = EditorGUILayout.ObjectField("Panel", panel, typeof(MadPanel), true) as MadPanel; barType = (EnergyBar3DBase.BarType) EditorGUILayout.EnumPopup("Bar Type", barType); GUI.enabled = panel != null; if (MadGUI.Button("Create", Color.green)) { EnergyBarUtils.Create3DBar(barType, panel); Close(); } GUI.enabled = true; }
void OnGUI() { MadGUI.Info("There's more than one Panel on the scene. Please set the one that you want to create the bar on."); panel = EditorGUILayout.ObjectField("Panel", panel, typeof(MadPanel), true) as MadPanel; barType = (EnergyBar3DBase.BarType)EditorGUILayout.EnumPopup("Bar Type", barType); GUI.enabled = panel != null; if (MadGUI.Button("Create", Color.green)) { EnergyBarUtils.Create3DBar(barType, panel); Close(); } GUI.enabled = true; }
public static EnergyBar3DBase Create3DBar(EnergyBar3DBase.BarType type, MadPanel panel) { switch (type) { case EnergyBar3DBase.BarType.Filled: return FilledRenderer3DBuilder.Create(panel); case EnergyBar3DBase.BarType.Repeated: return RepeatRenderer3DBuilder.Create(panel); case EnergyBar3DBase.BarType.Sequence: return SequenceRenderer3DBuilder.Create(panel); case EnergyBar3DBase.BarType.Transform: return TransformRenderer3DBuilder.Create(panel); default: Debug.LogError("Unknown bar type: " + type); return null; } }
// =========================================================== // Constants // =========================================================== // =========================================================== // Methods // =========================================================== public static EnergyBar3DBase Create3DBar(EnergyBar3DBase.BarType type) { var panel = MadPanel.UniqueOrNull(); if (panel == null) { EditorUtility.DisplayDialog("Not Initialized", "You have to initialize EBT first", "OK"); MadInitTool.ShowWindow(); return null; } else { switch (type) { case EnergyBar3DBase.BarType.Filled: return FillRenderer3DBuilder.Create(); case EnergyBar3DBase.BarType.Repeated: return RepeatRenderer3DBuilder.Create(); default: Debug.LogError("Unknown bar type: " + type); return null; } } }
public static void ShowWindow(EnergyBar3DBase.BarType barType) { var tool = EditorWindow.GetWindow <CreateMeshBarTool>(false, "Create Bar", true); tool.barType = barType; }