示例#1
0
        static public void AddButton(MenuCommand menuCommand)
        {
            GameObject go;

            using (new FactorySwapToEditor())
                go = DefaultControls.CreateButton(GetStandardResources());
            PlaceUIElementRoot(go, menuCommand);
        }
示例#2
0
        static public void AddButton(MenuCommand menuCommand)
        {
            GameObject go = DefaultControls.CreateButton(GetStandardResources());

            PlaceUIElementRoot(go, menuCommand);

            SetDefaultTxt(go);
        }
示例#3
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;
        }
示例#4
0
 public static void AddButton(MenuCommand menuCommand)
 {
     MenuOptions.PlaceUIElementRoot(DefaultControls.CreateButton(MenuOptions.GetStandardResources()), menuCommand);
 }
示例#5
0
        public static void AddButton(MenuCommand menuCommand)
        {
            GameObject element = DefaultControls.CreateButton(MenuOptions.GetStandardResources());

            MenuOptions.PlaceUIElementRoot(element, menuCommand);
        }