static public void AddScrollView(MenuCommand menuCommand) { GameObject go; using (new FactorySwapToEditor()) go = DefaultControls.CreateScrollView(GetStandardResources()); PlaceUIElementRoot(go, menuCommand); }
public static void AddInputField(MenuCommand menuCommand) { GameObject go = DefaultControls.CreateInputField(GetStandardResources()); PlaceUIElementRoot(go, menuCommand); SetDefaultTxt(go); }
static public void AddDropdown(MenuCommand menuCommand) { GameObject go = DefaultControls.CreateDropdown(GetStandardResources()); PlaceUIElementRoot(go, menuCommand); SetDefaultTxt(go); }
public static void AddPanel(MenuCommand menuCommand) { GameObject panel = DefaultControls.CreatePanel(MenuOptions.GetStandardResources()); MenuOptions.PlaceUIElementRoot(panel, menuCommand); RectTransform component = panel.GetComponent <RectTransform>(); component.anchoredPosition = Vector2.zero; component.sizeDelta = Vector2.zero; }
static public void AddPanel(MenuCommand menuCommand) { GameObject go = DefaultControls.CreatePanel(GetStandardResources()); PlaceUIElementRoot(go, menuCommand); // Panel is special, we need to ensure there's no padding after repositioning. RectTransform rect = go.GetComponent <RectTransform>(); rect.anchoredPosition = Vector2.zero; rect.sizeDelta = Vector2.zero; }
public static void AddButton() { GameObject rSelectGo = Selection.activeGameObject; var rResultType = AppDomain.CurrentDomain.GetAssemblies() .SingleOrDefault(rAssembly => rAssembly.GetName().Name.Equals("UnityEditor.UI"))?.GetTypes()? .SingleOrDefault(rType => rType.FullName.Equals("UnityEditor.UI.MenuOptions")); if (rResultType == null) { return; } var rStandradResources = (DefaultControls.Resources)rResultType.InvokeMember( "GetStandardResources", System.Reflection.BindingFlags.InvokeMethod | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static, null, null, new object[0] ); var rGo = DefaultControls.CreateButton(rStandradResources); var rButtonGo = rResultType.InvokeMember( "PlaceUIElementRoot", System.Reflection.BindingFlags.InvokeMethod | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static, null, null, new object[] { rGo, new MenuCommand(rSelectGo) }); var rButtonAssist = rGo.ReceiveComponent <ButtonAssist>(); rButtonAssist.Button = rGo.GetComponent <Button>(); rButtonAssist.AudioClipName = "click"; rButtonAssist.AudioDisableClipName = "click_invalid"; var rButtonAnim = AssetDatabase.LoadAssetAtPath <RuntimeAnimatorController>("Assets/Game/GameAsset/GUI/Animations/Button.controller"); var rAnimator = rGo.ReceiveComponent <Animator>(); rAnimator.runtimeAnimatorController = rButtonAnim; Selection.activeGameObject = rGo; }
public static void AddText(MenuCommand menuCommand) { MenuOptions.PlaceUIElementRoot(DefaultControls.CreateText(MenuOptions.GetStandardResources()), menuCommand); }
public static void AddSlider(MenuCommand menuCommand) { PlaceUIElementRoot(DefaultControls.CreateSlider(GetStandardResources()), menuCommand); }
public static void AddInputField(MenuCommand menuCommand) { PlaceUIElementRoot(DefaultControls.CreateInputField(GetStandardResources()), menuCommand); }
static public void AddLImageForTP(MenuCommand menuCommand) { GameObject go = DefaultControls.CreateLImageForTP(); MenuOptions.PlaceUIElementRoot(go, menuCommand); }
static public void AddScrollbar(MenuCommand menuCommand) { GameObject go = DefaultControls.CreateScrollbar(GetStandardResources()); PlaceUIElementRoot(go, menuCommand); }
public static void AddScrollView(MenuCommand menuCommand) { GameObject element = DefaultControls.CreateScrollView(MenuOptions.GetStandardResources()); MenuOptions.PlaceUIElementRoot(element, menuCommand); }