示例#1
0
        protected GameObject Panel(GameObject parent, string name)
        {
            PanelContainerProfile profile   = Defaults.GetProfile(panelContainerProfile);
            FilePanelProfile      fpProfile = Defaults.GetProfile(filePanelProfile);
            PanelContainerFactory factory   = Undoable.AddComponent <PanelContainerFactory>(disposable);

            factory.parent                = parent;
            factory.containerName         = name;
            factory.panelContainerProfile = profile;
            GameObject panel = factory.Generate();

            filePanel                         = AddFilePanel(panel);
            filePanel.grabTarget              = filePanelContainerInstance.transform;
            filePanel.folderPrefab            = fpProfile.folderPrefab;
            filePanel.kineticScrollItemPrefab = kineticScrollerItem;
            filePanel.height                  = fpProfile.scrollerHeight;
            filePanel.searchPattern           = fpProfile.searchPattern;
            filePanel.panelProfile            = panelProfile;

#if VRTK
            CreateThis_VRTK_Interactable interactable = Undoable.AddComponent <CreateThis_VRTK_Interactable>(panel);
            CreateThis_VRTK_GrabAttach   grabAttach   = Undoable.AddComponent <CreateThis_VRTK_GrabAttach>(panel);
            interactable.isGrabbable = true;
            interactable.grabAttachMechanicScript = grabAttach;
#endif

            drives = Undoable.AddComponent <Drives>(panel);

            Rigidbody rigidbody = Undoable.AddComponent <Rigidbody>(panel);
            rigidbody.useGravity  = false;
            rigidbody.isKinematic = true;

            return(panel);
        }
        protected GameObject Panel(GameObject parent, string name)
        {
            PanelContainerProfile profile = Defaults.GetProfile(panelContainerProfile);
            PanelContainerFactory factory = Undoable.AddComponent <PanelContainerFactory>(disposable);

            factory.parent                = parent;
            factory.containerName         = name;
            factory.panelContainerProfile = profile;
            GameObject panel = factory.Generate();

            PanelProfile  subPanelProfile = CreateSubPanelProfile(panel);
            StandardPanel standardPanel   = Undoable.AddComponent <StandardPanel>(panel);

            standardPanel.panelProfile = subPanelProfile;
            standardPanel.grabTarget   = keyboard.transform;

#if VRTK
            CreateThis_VRTK_Interactable interactable = Undoable.AddComponent <CreateThis_VRTK_Interactable>(panel);
            CreateThis_VRTK_GrabAttach   grabAttach   = Undoable.AddComponent <CreateThis_VRTK_GrabAttach>(panel);
            interactable.isGrabbable = true;
            interactable.grabAttachMechanicScript = grabAttach;
#endif

            Rigidbody rigidbody = Undoable.AddComponent <Rigidbody>(panel);
            rigidbody.useGravity  = false;
            rigidbody.isKinematic = true;

            return(panel);
        }
        public override GameObject Generate()
        {
            base.Generate();

#if UNITY_EDITOR
            Undo.SetCurrentGroupName("FileOpenFactory Generate");
            int group = Undo.GetCurrentGroup();

            Undo.RegisterCompleteObjectUndo(this, "FileOpenFactory state");
#endif
            kineticScrollerItemInstance = EmptyChild(parent, "kineticScrollerItem");

            KineticScrollerItem kineticScrollerItem = Undoable.AddComponent <KineticScrollerItem>(kineticScrollerItemInstance);
            kineticScrollerItem.kineticScroller = kineticScroller;

            Undoable.AddComponent <MeshFilter>(kineticScrollerItemInstance);
            Undoable.AddComponent <MeshRenderer>(kineticScrollerItemInstance);
            BoxCollider boxCollider = Undoable.AddComponent <BoxCollider>(kineticScrollerItemInstance);
            boxCollider.isTrigger = true;

            Selectable selectable = Undoable.AddComponent <Selectable>(kineticScrollerItemInstance);
            selectable.highlightMaterial   = highlight;
            selectable.outlineMaterial     = outline;
            selectable.textColor           = fontColor;
            selectable.unselectedMaterials = new Material[] { material };
            selectable.recursive           = true;

#if VRTK
            CreateThis_VRTK_Interactable interactable = Undoable.AddComponent <CreateThis_VRTK_Interactable>(kineticScrollerItemInstance);
            CreateThis_VRTK_GrabAttach   grabAttach   = Undoable.AddComponent <CreateThis_VRTK_GrabAttach>(kineticScrollerItemInstance);
            interactable.isGrabbable = true;
            interactable.grabAttachMechanicScript = grabAttach;
#endif

            Rigidbody rigidBody = Undoable.AddComponent <Rigidbody>(kineticScrollerItemInstance);
            rigidBody.useGravity  = false;
            rigidBody.isKinematic = true;

#if UNITY_EDITOR
            Undo.CollapseUndoOperations(group);
#endif
            return(kineticScrollerItemInstance);
        }