void GlobalSpeedsGUI(PanelProfile profile) { if (profile.GetTransition(true) == null || profile.GetTransition(false) == null) { return; } bool openIsGlobal = !profile.GetTransition(true).useLocalSpeed; bool closeIsGlobal = !profile.GetTransition(false).useLocalSpeed; if (openIsGlobal || closeIsGlobal) { GUILayout.Space(10); Label("Global Transition Multipliers", true, TextAnchor.MiddleLeft); if (openIsGlobal) { profile.openTransitionSpeed = EditorGUILayout.Slider("Open Speed Modifier", profile.openTransitionSpeed, 0.5f, 3.0f); } if (closeIsGlobal) { profile.closeTransitionSpeed = EditorGUILayout.Slider("Close Speed Modifier", profile.closeTransitionSpeed, 0.5f, 3.0f); } } }
void SfxGUI(PanelProfile profile) { Label("Sound Effects", true, TextAnchor.MiddleLeft); profile.openSound = AudioClipField("Open Sound", profile.openSound); profile.closeSound = AudioClipField("Close Sound", profile.closeSound); }
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 void SetVisible(bool value) { bool oldValue = visible; visible = value; if (value) { PanelManager.HideAllPanels(this); } GameObject target = GetTarget(); target.SetActive(visible); if (visible) { PanelProfile profile = Defaults.GetProfile(panelProfile); if (oldValue != value) { ZeroNotSelectableCount(); } Vector3 noYOffset = profile.offset; noYOffset.y = 0; Vector3 positionWithoutYOffset = PanelUtils.Position(profile.sceneCamera, controller, noYOffset, profile.minDistance); target.transform.position = PanelUtils.Position(profile.sceneCamera, controller, profile.offset, profile.minDistance); target.transform.rotation = PanelUtils.Rotation(profile.sceneCamera, positionWithoutYOffset); } }
private void Reset() { if (profile == null) { var newProfile = Resources.Load <PanelProfile>("DataObjects/PanelProfiles/DefaultPanelProfile"); profile = newProfile; } }
private PanelProfile CreateSubPanelProfile(GameObject parent) { PanelProfile profile = Defaults.GetProfile(panelProfile); PanelProfile subPanelProfile = ScriptUtils.CopyComponent(profile, parent); subPanelProfile.hideOnAwake = false; return(subPanelProfile); }
public void OnDefaultsChanged() { PanelProfile profile = Defaults.GetProfile(panelProfile); if (profile.hideOnAwake) { visible = false; GameObject target = GetTarget(); target.SetActive(false); } }
public override void OnInspectorGUI() { PanelProfile profile = (PanelProfile)target; if (profile == null) { return; } TransitionGUI(ref profile.openTransitionType, profile.GetTransition(true), true); GUILayout.Space(10); TransitionGUI(ref profile.closeTransitionType, profile.GetTransition(false), false); GlobalSpeedsGUI(profile); GUILayout.Space(10); SfxGUI(profile); EditorUtility.SetDirty(profile); }