protected virtual void FilePanel(GameObject parent) { if (filePanelInstance) { return; } FilePanelProfile fpProfile = Defaults.GetProfile(filePanelProfile); filePanelInstance = EmptyChild(parent, "FileOpenPanel"); Vector3 localPosition = filePanelInstance.transform.localPosition; localPosition.y = -fpProfile.scrollerHeight * 1.50f; filePanelInstance.transform.localPosition = localPosition; Rigidbody rigidbody = Undoable.AddComponent <Rigidbody>(filePanelInstance); rigidbody.useGravity = false; rigidbody.isKinematic = true; GameObject panel = Panel(filePanelInstance, "DrivesPanel"); GameObject column = Column(panel); PanelHeader(filePanel, column); DriveButtonRow(column); SpecialFoldersRow(column); panel.transform.localPosition = Vector3.zero; }
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 CreateKineticScroller(GameObject parent) { FilePanelProfile fpProfile = Defaults.GetProfile(filePanelProfile); kineticScrollerInstance = EmptyChild(parent, "KineticScroller"); kineticScroller = Undoable.AddComponent <KineticScroller>(kineticScrollerInstance); kineticScroller.space = fpProfile.kineticScrollerSpacing; filePanel.kineticScroller = kineticScroller; Rigidbody rigidbody = Undoable.AddComponent <Rigidbody>(kineticScrollerInstance); rigidbody.useGravity = false; ButtonProfile profile = Defaults.GetMomentaryButtonProfile(momentaryButtonProfile); Selectable selectable = Undoable.AddComponent <Selectable>(kineticScrollerInstance); selectable.highlightMaterial = profile.highlight; selectable.outlineMaterial = profile.outline; selectable.textColor = profile.fontColor; selectable.unselectedMaterials = new Material[] { profile.material }; selectable.recursive = true; ConfigurableJoint configurableJoint = Undoable.AddComponent <ConfigurableJoint>(kineticScrollerInstance); configurableJoint.connectedBody = filePanelContainerRigidbody; configurableJoint.anchor = Vector3.zero; configurableJoint.xMotion = ConfigurableJointMotion.Limited; configurableJoint.yMotion = ConfigurableJointMotion.Locked; configurableJoint.zMotion = ConfigurableJointMotion.Locked; configurableJoint.angularXMotion = ConfigurableJointMotion.Locked; configurableJoint.angularYMotion = ConfigurableJointMotion.Locked; configurableJoint.angularZMotion = ConfigurableJointMotion.Locked; configurableJoint.breakForce = float.PositiveInfinity; configurableJoint.breakTorque = float.PositiveInfinity; return(kineticScrollerInstance); }