// Use this for initialization void Awake() { mySettings = GetComponentInParent <CurvedUISettings>(); if (mySettings != null) { UpdateTransform(); } }
private void FindTMP() { if (base.GetComponent <TextMeshProUGUI>() != null) { this.tmp = base.gameObject.GetComponent <TextMeshProUGUI>(); this.crvdVE = base.gameObject.GetComponent <CurvedUIVertexEffect>(); this.mySettings = base.GetComponentInParent <CurvedUISettings>(); base.transform.hasChanged = false; this.FindSubmeshes(); } }
// Update is called once per frame void Update() { if (mySettings == null) { mySettings = GetComponentInParent <CurvedUISettings>(); } if (!IsStatic && mySettings != null) { UpdateTransform(); } }
void FindParentSettings() { if (mySettings == null) { mySettings = GetComponentInParent <CurvedUISettings>(); if (mySettings == null) { return; } myCanvas = mySettings.GetComponent <Canvas>(); angle = mySettings.Angle; } }
public CurvedUISettings FindParentSettings(bool forceNew = false) { if ((this.mySettings == null) || forceNew) { this.mySettings = base.GetComponentInParent <CurvedUISettings>(); if (this.mySettings == null) { return(null); } this.myCanvas = this.mySettings.GetComponent <Canvas>(); this.angle = this.mySettings.Angle; this.myImage = base.GetComponent <Image>(); } return(this.mySettings); }
protected override void Awake() { base.Awake(); myCanvas = GetComponent <Canvas>(); mySettings = GetComponent <CurvedUISettings>(); cyllinderMidPoint = new Vector3(0, 0, -mySettings.GetCyllinderRadiusInCanvasSpace()); //the canvas needs an event camera set up to process events correctly. Try to use main camera if no one is provided. if (myCanvas.worldCamera == null && Camera.main != null) { myCanvas.worldCamera = Camera.main; } handle = clientData.RootFind("[CameraRig]/Controller (right)"); //Add By Lcx }
// Update is called once per frame void Update() { CurvedUISettings set = this.GetComponent <CurvedUISettings>(); Text textie = this.GetComponentInChildren <Text>(); if (Time.time < 3.0f) { set.RingFill = Mathf.PerlinNoise(Time.time * 30.23234f, Time.time * 30.2313f) * 0.3f; textie.text = "Accesing Mainframe..."; } else if (Time.time < 5.0f) { set.RingFill = Mathf.Clamp(set.RingFill + Time.deltaTime * 3, 0, 1); textie.text = "Mainframe Active"; if (Time.time < 8.0f) { script.GetIndexAndLoadScene(1); } } }
/// <summary> /// Get the reference to the CurvedUI.CurvedUISettings script /// </summary> void Start() { curvedUI = GetComponent <CurvedUI.CurvedUISettings>(); }
public override void OnInspectorGUI() { CurvedUISettings myTarget = (CurvedUISettings)target; if (target == null) { return; } //initial settings GUI.changed = false; EditorGUIUtility.labelWidth = 150; //global setting - control methods DrawControlMethods(); //shape settings GUILayout.Label("Shape", EditorStyles.boldLabel); myTarget.Shape = (CurvedUISettings.CurvedUIShape)EditorGUILayout.EnumPopup("Canvas Shape", myTarget.Shape); switch (myTarget.Shape) { case CurvedUISettings.CurvedUIShape.CYLINDER: { myTarget.Angle = EditorGUILayout.IntSlider("Angle", myTarget.Angle, -360, 360); myTarget.PreserveAspect = EditorGUILayout.Toggle("Preserve Aspect", myTarget.PreserveAspect); break; } case CurvedUISettings.CurvedUIShape.CYLINDER_VERTICAL: { myTarget.Angle = EditorGUILayout.IntSlider("Angle", myTarget.Angle, -360, 360); myTarget.PreserveAspect = EditorGUILayout.Toggle("Preserve Aspect", myTarget.PreserveAspect); break; } case CurvedUISettings.CurvedUIShape.RING: { myTarget.RingExternalDiameter = Mathf.Clamp(EditorGUILayout.IntField("External Diameter", myTarget.RingExternalDiameter), 1, 100000); myTarget.Angle = EditorGUILayout.IntSlider("Angle", myTarget.Angle, 0, 360); myTarget.RingFill = EditorGUILayout.Slider("Fill", myTarget.RingFill, 0.0f, 1.0f); myTarget.RingFlipVertical = EditorGUILayout.Toggle("Flip Canvas Vertically", myTarget.RingFlipVertical); break; } case CurvedUISettings.CurvedUIShape.SPHERE: { GUILayout.BeginHorizontal(); GUILayout.Space(150); GUILayout.Label("Sphere shape is more expensive than a Cyllinder shape. Keep this in mind when working on mobile VR.", EditorStyles.helpBox); GUILayout.EndHorizontal(); GUILayout.Space(10); if (myTarget.PreserveAspect) { myTarget.Angle = EditorGUILayout.IntSlider("Angle", myTarget.Angle, -360, 360); } else { myTarget.Angle = EditorGUILayout.IntSlider("Horizontal Angle", myTarget.Angle, 0, 360); myTarget.VerticalAngle = EditorGUILayout.IntSlider("Vertical Angle", myTarget.VerticalAngle, 0, 180); } myTarget.PreserveAspect = EditorGUILayout.Toggle("Preserve Aspect", myTarget.PreserveAspect); break; } } //advanced settings GUILayout.Space(10); if (!ShowAdvaced) { //show advanced settings enable button if (GUILayout.Button("Show Advanced Settings")) { ShowAdvaced = true; loadingCustomDefine = false; } } else { // or just show advanced settings //hide advances settings button. if (GUILayout.Button("Hide Advanced Settings")) { ShowAdvaced = false; } GUILayout.Space(20); //common options GUILayout.Label("Other Options", EditorStyles.boldLabel); myTarget.Interactable = EditorGUILayout.Toggle("Interactable", myTarget.Interactable); myTarget.BlocksRaycasts = EditorGUILayout.Toggle("Blocks Raycasts", myTarget.BlocksRaycasts); myTarget.RaycastMyLayerOnly = EditorGUILayout.Toggle("Raycast My Layer Only", myTarget.RaycastMyLayerOnly); myTarget.Quality = EditorGUILayout.Slider("Quality", myTarget.Quality, 0.1f, 3.0f); GUILayout.BeginHorizontal(); GUILayout.Space(150); GUILayout.Label("Smoothness of the curve. Bigger values mean more subdivisions. Decrease for better performance. Default 1", EditorStyles.helpBox); GUILayout.EndHorizontal(); //add components button GUILayout.Space(20); GUILayout.BeginHorizontal(); GUILayout.Label("Components", GUILayout.Width(146)); if (GUILayout.Button("Add Effect To Children")) { AddCurvedUIComponents(); } GUILayout.EndHorizontal(); //remove components button GUILayout.BeginHorizontal(); GUILayout.Label("", GUILayout.Width(146)); if (!ShowRemoveCurvedUI) { if (GUILayout.Button("Remove CurvedUI from Canvas")) { ShowRemoveCurvedUI = true; } } else { if (GUILayout.Button("Remove CurvedUI")) { RemoveCurvedUIComponents(); } if (GUILayout.Button("Cancel")) { ShowRemoveCurvedUI = false; } } GUILayout.EndHorizontal(); } // end of advanced settings //final settings if (GUI.changed) { EditorUtility.SetDirty(myTarget); } }
// Use this for initialization void Awake() { mySettings = GetComponentInParent <CurvedUISettings>(); }
// Use this for initialization void Start() { mySettings = GetComponentInParent <CurvedUISettings>(); CurvedUIInputModule.Instance.WorldSpaceMouseInCanvasSpace -= (mySettings.transform as RectTransform).rect.size / 2.0f; }
public override void OnInspectorGUI() { CurvedUISettings myTarget = (CurvedUISettings)target; if (target == null) { return; } //initial settings GUI.changed = false; EditorGUIUtility.labelWidth = 150; DrawControlMethods(); //shape settings GUILayout.Label("Shape", EditorStyles.boldLabel); myTarget.Shape = (CurvedUISettings.CurvedUIShape)EditorGUILayout.EnumPopup("Canvas Shape", myTarget.Shape); switch (myTarget.Shape) { case CurvedUISettings.CurvedUIShape.CYLINDER: { myTarget.Angle = EditorGUILayout.IntSlider("Angle", myTarget.Angle, -360, 360); myTarget.PreserveAspect = EditorGUILayout.Toggle("Preserve Aspect", myTarget.PreserveAspect); break; } case CurvedUISettings.CurvedUIShape.CYLINDER_VERTICAL: { myTarget.Angle = EditorGUILayout.IntSlider("Angle", myTarget.Angle, -360, 360); myTarget.PreserveAspect = EditorGUILayout.Toggle("Preserve Aspect", myTarget.PreserveAspect); break; } case CurvedUISettings.CurvedUIShape.RING: { myTarget.RingExternalDiameter = Mathf.Clamp(EditorGUILayout.IntField("External Diameter", myTarget.RingExternalDiameter), 1, 100000); myTarget.Angle = EditorGUILayout.IntSlider("Angle", myTarget.Angle, 0, 360); myTarget.RingFill = EditorGUILayout.Slider("Fill", myTarget.RingFill, 0.0f, 1.0f); myTarget.RingFlipVertical = EditorGUILayout.Toggle("Flip Canvas Vertically", myTarget.RingFlipVertical); break; } case CurvedUISettings.CurvedUIShape.SPHERE: { GUILayout.BeginHorizontal(); GUILayout.Space(150); GUILayout.Label("Sphere shape is more expensive than a Cyllinder shape. Keep this in mind when working on mobile VR.", EditorStyles.helpBox); GUILayout.EndHorizontal(); GUILayout.Space(10); if (myTarget.PreserveAspect) { myTarget.Angle = EditorGUILayout.IntSlider("Angle", myTarget.Angle, -360, 360); } else { myTarget.Angle = EditorGUILayout.IntSlider("Horizontal Angle", myTarget.Angle, 0, 360); myTarget.VerticalAngle = EditorGUILayout.IntSlider("Vertical Angle", myTarget.VerticalAngle, 0, 180); } myTarget.PreserveAspect = EditorGUILayout.Toggle("Preserve Aspect", myTarget.PreserveAspect); break; } } //advanced settings GUILayout.Space(10); if (!ShowAdvaced) { if (GUILayout.Button("Show Advanced Settings")) { ShowAdvaced = true; if (enablingVive) { enablingVive = false; } } } else { if (GUILayout.Button("Hide Advanced Settings")) { ShowAdvaced = false; } GUILayout.Space(20); GUILayout.Label("Other Options", EditorStyles.boldLabel); myTarget.Interactable = EditorGUILayout.Toggle("Interactable", myTarget.Interactable); myTarget.BlocksRaycasts = EditorGUILayout.Toggle("Blocks Raycasts", myTarget.BlocksRaycasts); myTarget.RaycastMyLayerOnly = EditorGUILayout.Toggle("Raycast My Layer Only", myTarget.RaycastMyLayerOnly); myTarget.Quality = EditorGUILayout.Slider("Quality", myTarget.Quality, 0.1f, 3.0f); GUILayout.BeginHorizontal(); GUILayout.Space(150); GUILayout.Label("Smoothness of the curve. Bigger values mean more subdivisions. Decrease for better performance. Default 1", EditorStyles.helpBox); GUILayout.EndHorizontal(); GUILayout.Space(20); GUILayout.BeginHorizontal(); GUILayout.Label("Components", GUILayout.Width(146)); if (GUILayout.Button("Add Effect To Children")) { AddCurvedUIComponents(); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("", GUILayout.Width(146)); if (!ShowRemoveCurvedUI) { if (GUILayout.Button("Remove CurvedUI from Canvas")) { ShowRemoveCurvedUI = true; } } else { if (GUILayout.Button("Remove CurvedUI")) { RemoveCurvedUIComponents(); } if (GUILayout.Button("Cancel")) { ShowRemoveCurvedUI = false; } } GUILayout.EndHorizontal(); // Left for later, may come usefull // if (GUILayout.Button("Get Defines")) { // Debug.Log(PlayerSettings.GetScriptingDefineSymbolsForGroup(EditorUserBuildSettings.selectedBuildTargetGroup)); // // } // // if (GUILayout.Button("Enable VIVE support")) { // // string str = PlayerSettings.GetScriptingDefineSymbolsForGroup(EditorUserBuildSettings.selectedBuildTargetGroup); // if(!str.Contains("CURVEDUI_VIVE")){ // str += ";CURVEDUI_VIVE"; // PlayerSettings.SetScriptingDefineSymbolsForGroup(EditorUserBuildSettings.selectedBuildTargetGroup, str); // } // // } // // // if (GUILayout.Button("Enable TMP support")) { // // string str = PlayerSettings.GetScriptingDefineSymbolsForGroup(EditorUserBuildSettings.selectedBuildTargetGroup); // if(!str.Contains("CURVEDUI_TMP")){ // str += ";CURVEDUI_TMP"; // PlayerSettings.SetScriptingDefineSymbolsForGroup(EditorUserBuildSettings.selectedBuildTargetGroup, str); // } // // } // // //#if CURVEDUI_TMP || CURVEDUI_VIVE || CURVEDUI_TOUCH // GUILayout.BeginHorizontal(); // GUILayout.Label("", GUILayout.Width(146)); // if (GUILayout.Button("Remove CurvedUI Custom Defines")) // { // string str = PlayerSettings.GetScriptingDefineSymbolsForGroup(EditorUserBuildSettings.selectedBuildTargetGroup); // if (!str.Contains("CURVEDUI_TMP")) // { // str.Replace("CURVEDUI_TMP", ""); // } // if (!str.Contains("CURVEDUI_TOUCH")) // { // str.Replace("CURVEDUI_TOUCH", ""); // } // if (!str.Contains("CURVEDUI_VIVE")) // { // str.Replace("CURVEDUI_VIVE", ""); // } // PlayerSettings.SetScriptingDefineSymbolsForGroup(EditorUserBuildSettings.selectedBuildTargetGroup, str); // } // GUILayout.EndHorizontal(); //#endif } // end of advanced settings //final settings if (GUI.changed) { EditorUtility.SetDirty(myTarget); } }
public override void OnInspectorGUI() { CurvedUISettings myTarget = (CurvedUISettings)target; ////load up editor skin //if (editorSkin == null) { // editorSkin = (GUISkin)(AssetDatabase.LoadAssetAtPath("Assets/CurvedUI/Scripts/Editor/CurvedUIGUISkin.guiskin", typeof(GUISkin))); // GUIPhoto = editorSkin.FindStyle("DanielPhoto"); //} //GUI.skin = editorSkin; //initial settings GUI.changed = false; EditorGUIUtility.labelWidth = 150; //shape settings GUILayout.Label("Shape", EditorStyles.boldLabel); myTarget.Shape = (CurvedUISettings.CurvedUIShape)EditorGUILayout.EnumPopup("Canvas Shape", myTarget.Shape); switch (myTarget.Shape) { case CurvedUISettings.CurvedUIShape.CYLINDER: { myTarget.Angle = EditorGUILayout.IntSlider("Angle", myTarget.Angle, -360, 360); myTarget.PreserveAspect = EditorGUILayout.Toggle("Preserve Aspect", myTarget.PreserveAspect); break; } case CurvedUISettings.CurvedUIShape.CYLINDER_VERTICAL: { myTarget.Angle = EditorGUILayout.IntSlider("Angle", myTarget.Angle, -360, 360); myTarget.PreserveAspect = EditorGUILayout.Toggle("Preserve Aspect", myTarget.PreserveAspect); break; } case CurvedUISettings.CurvedUIShape.RING: { myTarget.RingExternalDiameter = Mathf.Clamp(EditorGUILayout.IntField("External Diameter", myTarget.RingExternalDiameter), 1, 100000); myTarget.Angle = EditorGUILayout.IntSlider("Angle", myTarget.Angle, 0, 360); myTarget.RingFill = EditorGUILayout.Slider("Fill", myTarget.RingFill, 0.0f, 1.0f); myTarget.RingFlipVertical = EditorGUILayout.Toggle("Flip Canvas Vertically", myTarget.RingFlipVertical); break; } case CurvedUISettings.CurvedUIShape.SPHERE: { GUILayout.BeginHorizontal(); GUILayout.Space(150); GUILayout.Label("Sphere shape is more expensive than a Cyllinder shape. Keep this in mind when working on mobile VR.", EditorStyles.helpBox); GUILayout.EndHorizontal(); GUILayout.Space(10); if (myTarget.PreserveAspect) { myTarget.Angle = EditorGUILayout.IntSlider("Angle", myTarget.Angle, -360, 360); } else { myTarget.Angle = EditorGUILayout.IntSlider("Horizontal Angle", myTarget.Angle, 0, 360); myTarget.VerticalAngle = EditorGUILayout.IntSlider("Vertical Angle", myTarget.VerticalAngle, 0, 180); } myTarget.PreserveAspect = EditorGUILayout.Toggle("Preserve Aspect", myTarget.PreserveAspect); break; } } //advanced settings GUILayout.Space(10); GUILayout.Label("Advanced Settings", EditorStyles.boldLabel); //controller myTarget.Controller = (CurvedUISettings.CurvedUIController)EditorGUILayout.EnumPopup("Control Method", myTarget.Controller); GUILayout.BeginHorizontal(); GUILayout.Space(150); switch (myTarget.Controller) { case CurvedUISettings.CurvedUIController.MOUSE: { GUILayout.Label("Basic Controller. Mouse in screen space.", EditorStyles.helpBox); break; } case CurvedUISettings.CurvedUIController.GAZE: { GUILayout.Label("Center of Canvas's World Camera acts as a pointer.", EditorStyles.helpBox); break; } case CurvedUISettings.CurvedUIController.WORLD_MOUSE: { GUILayout.Label("Mouse controller that is independent of the camera view. Use WorldSpaceMouseOnCanvas function to get its position.", EditorStyles.helpBox); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Space(150); myTarget.WorldSpaceMouseSensitivity = EditorGUILayout.FloatField("Mouse Sensitivity", myTarget.WorldSpaceMouseSensitivity); break; } case CurvedUISettings.CurvedUIController.CUSTOM_RAY: { GUILayout.Label("You can set a custom ray as a controller with CustomControllerRay function. Raycaster will use that ray to find selected objects.", EditorStyles.helpBox); break; } } GUILayout.EndHorizontal(); myTarget.Interactable = EditorGUILayout.Toggle("Interactable", myTarget.Interactable); myTarget.RaycastMyLayerOnly = EditorGUILayout.Toggle("Raycast My Layer Only", myTarget.RaycastMyLayerOnly); myTarget.Quality = EditorGUILayout.Slider("Quality", myTarget.Quality, 0.1f, 3.0f); GUILayout.BeginHorizontal(); GUILayout.Space(150); GUILayout.Label("Smoothness of the curve. Bigger values mean more subdivisions. Decrease for better performance. Default 1", EditorStyles.helpBox); GUILayout.EndHorizontal(); GUILayout.Space(10); GUILayout.BeginHorizontal(); GUILayout.Label("Components", GUILayout.Width(146)); if (GUILayout.Button("Add Effect To Children")) { AddCurvedUIComponents(); } GUILayout.EndHorizontal(); /* * //Feedback * GUILayout.Space(20); * if (GUILayout.Button(openFeedback ? "Cancel" : "Feedback & Questions")) { * openFeedback = !openFeedback; * if * * * } (openFeedback) { * GUILayout.BeginHorizontal(); * GUILayout.Box("", GUIPhoto, new GUILayoutOption[] { GUILayout.Width(50), GUILayout.Height(50) }); * GUILayout.Space(10); * GUILayout.BeginVertical(); * message = GUILayout.TextArea(message, EditorStyles.helpBox, new GUILayoutOption[] { GUILayout.MinHeight(100) }); * //if (GUILayout.Button("Email Me", GUILayout.Height(25))); * //{ * // SendEmail(); * //} * GUILayout.EndVertical(); * GUILayout.EndHorizontal(); * * }*/ //final settings if (GUI.changed) { EditorUtility.SetDirty(myTarget); } }
void Start() { set = this.GetComponent <CurvedUISettings>(); }