Exemple #1
0
        static public void AddScrollView(MenuCommand menuCommand)
        {
            GameObject go;

            using (new FactorySwapToEditor())
                go = DefaultControls.CreateScrollView(GetStandardResources());
            PlaceUIElementRoot(go, menuCommand);
        }
Exemple #2
0
        public static void AddInputField(MenuCommand menuCommand)
        {
            GameObject go = DefaultControls.CreateInputField(GetStandardResources());

            PlaceUIElementRoot(go, menuCommand);

            SetDefaultTxt(go);
        }
Exemple #3
0
        static public void AddDropdown(MenuCommand menuCommand)
        {
            GameObject go = DefaultControls.CreateDropdown(GetStandardResources());

            PlaceUIElementRoot(go, menuCommand);

            SetDefaultTxt(go);
        }
Exemple #4
0
        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;
        }
Exemple #5
0
        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;
        }
Exemple #6
0
        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;
        }
Exemple #7
0
 public static void AddText(MenuCommand menuCommand)
 {
     MenuOptions.PlaceUIElementRoot(DefaultControls.CreateText(MenuOptions.GetStandardResources()), menuCommand);
 }
Exemple #8
0
 public static void AddSlider(MenuCommand menuCommand)
 {
     PlaceUIElementRoot(DefaultControls.CreateSlider(GetStandardResources()), menuCommand);
 }
Exemple #9
0
 public static void AddInputField(MenuCommand menuCommand)
 {
     PlaceUIElementRoot(DefaultControls.CreateInputField(GetStandardResources()), menuCommand);
 }
Exemple #10
0
        static public void AddLImageForTP(MenuCommand menuCommand)
        {
            GameObject go = DefaultControls.CreateLImageForTP();

            MenuOptions.PlaceUIElementRoot(go, menuCommand);
        }
Exemple #11
0
        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);
        }