void SetPanel(TutorialScriptableObjects tut) { panelBGTransform.anchoredPosition = tut.panelPosition; panelBGTransform.sizeDelta = tut.panelWidthAndHeight; panelBGTransform.anchorMin = tut.panelAnchorMin; panelBGTransform.anchorMax = tut.panelAnchorMax; panelBGTransform.pivot = tut.panelPivot; }
void SetAltMapPanel(TutorialScriptableObjects tut) { mapPanelBGTransform.anchoredPosition = tut.panelAltPosition; mapPanelBGTransform.sizeDelta = tut.panelAltWidthAndHeight; mapPanelBGTransform.anchorMin = tut.panelAltAnchorMin; mapPanelBGTransform.anchorMax = tut.panelAltAnchorMax; mapPanelBGTransform.pivot = tut.panelAltPivot; }
void SetMapMask(TutorialScriptableObjects tut) { mapMaskTransform.anchoredPosition = tut.maskPosition; mapMaskTransform.sizeDelta = tut.maskWidthAndHeight; mapMaskTransform.anchorMin = tut.maskAnchorMin; mapMaskTransform.anchorMax = tut.maskAnchorMax; mapMaskTransform.pivot = tut.maskPivot; }
void SetAltMapArrow(TutorialScriptableObjects tut) { mapArrowTransform.anchoredPosition = tut.triangleAltPosition; mapArrowTransform.sizeDelta = tut.triangleAltWidthAndHeight; mapArrowTransform.anchorMin = tut.triangleAltAnchorMin; mapArrowTransform.anchorMax = tut.triangleAltAnchorMax; mapArrowTransform.pivot = tut.triangleAltPivot; mapArrowTransform.localEulerAngles = tut.triangleAltRotation; }
void SetSecondaryMapMask(TutorialScriptableObjects tut) { mapSecondaryMaskTransform.gameObject.SetActive(true); mapSecondaryMaskTransform.anchoredPosition = tut.secondaryMaskPosition; mapSecondaryMaskTransform.sizeDelta = tut.secondaryMaskWidthAndHeight; mapSecondaryMaskTransform.anchorMin = tut.secondaryMaskAnchorMin; mapSecondaryMaskTransform.anchorMax = tut.secondaryMaskAnchorMax; mapSecondaryMaskTransform.pivot = tut.secondaryMaskPivot; }
void SetArrow(TutorialScriptableObjects tut) { arrowTransform.anchoredPosition = tut.trianglePosition; arrowTransform.sizeDelta = tut.triangleWidthAndHeight; arrowTransform.anchorMin = tut.triangleAnchorMin; arrowTransform.anchorMax = tut.triangleAnchorMax; arrowTransform.pivot = tut.trianglePivot; arrowTransform.localEulerAngles = tut.triangleRotation; }
void SetMapInformation(TutorialScriptableObjects tut) { mapInformationText.rectTransform.anchoredPosition = tut.informationTextPosition; mapInformationText.rectTransform.sizeDelta = tut.informationTextWidthAndHeight; mapInformationText.rectTransform.anchorMin = tut.informationTextAnchorMin; mapInformationText.rectTransform.anchorMax = tut.informationTextAnchorMax; mapInformationText.rectTransform.pivot = tut.informationTextPivot; mapInformationText.text = tut.informationText; mapInformationText.fontSize = tut.informationFontSize; }
void SetTitle(TutorialScriptableObjects tut) { titleText.rectTransform.anchoredPosition = tut.titleTextPosition; titleText.rectTransform.sizeDelta = tut.titleTextWidthAndHeight; titleText.rectTransform.anchorMin = tut.titleTextAnchorMin; titleText.rectTransform.anchorMax = tut.titleTextAnchorMax; titleText.rectTransform.pivot = tut.titleTextPivot; titleText.text = tut.titleText; titleText.fontSize = tut.titleFontSize; }
void SetTutorial(TutorialScriptableObjects tut) { secondaryMaskTransform.gameObject.SetActive(false); currentTutorial = tut; SetMask(tut); if (currentTutorial.usesSecondaryMask == true) { SetSecondaryMask(tut); } SetPanel(tut); SetArrow(tut); SetTitle(tut); SetInformation(tut); }
//show the activated map tutorial public void SetMapTutorial(TutorialScriptableObjects tut) { currentTutorial = tut; SetMapMask(tut); if (tut.usesSecondaryMask == true) { SetSecondaryMapMask(tut); } SetMapPanel(tut); SetMapArrow(tut); SetMapTitle(tut); SetMapInformation(tut); mapTutorialPanelAnimator.SetBool("Active", true); mapButtonSelected(); StartCoroutine(SetMapButtonLayoutActivity(false)); }
//Create All GUI elements private void OnGUI() { //check if a tutorial controller already exists if (GameObject.FindObjectOfType <TutorialController>()) { //localize the tutorialController tutorialController = GameObject.FindObjectOfType <TutorialController>(); //name for the window GUILayout.Label("Save Tutorial Preset", EditorStyles.boldLabel); //input field for the scriptable object to be saved to and limit to TutorialMapScriptableObject type tutorialObject = EditorGUILayout.ObjectField("Tutorial Scriptable Object", tutorialObject, typeof(TutorialScriptableObjects), false) as TutorialScriptableObjects; //create mask transform inputs GUILayout.Label("", EditorStyles.boldLabel); GUILayout.Label("Save Mask Transform", EditorStyles.boldLabel); maskTransform = EditorGUILayout.ObjectField("Mask Rect Transform", tutorialController.maskTransform, typeof(RectTransform), true) as RectTransform; //buttons for saving transforms of normal mask or alternate mask //alternate mask is used for changing size in certain interactions if (GUILayout.Button("Save Mask Transform")) { SaveMaskTransform(); } if (GUILayout.Button("Save Alternate Mask Transform")) { SaveAltMaskTransform(); } //create secondary mask transform inputs GUILayout.Label("", EditorStyles.boldLabel); GUILayout.Label("Save Secondary Mask Transform", EditorStyles.boldLabel); secondaryMaskTransform = EditorGUILayout.ObjectField("Mask Rect Transform", tutorialController.secondaryMaskTransform, typeof(RectTransform), true) as RectTransform; //button for saving transforms of secondary mask if (GUILayout.Button("Save Secondary Mask Transform")) { SaveSecondaryMask(); } //create secondary panel transform inputs GUILayout.Label("", EditorStyles.boldLabel); GUILayout.Label("Save Panel Transform", EditorStyles.boldLabel); panelTransform = EditorGUILayout.ObjectField("Panel Rect Transform", tutorialController.panelBGTransform, typeof(RectTransform), true) as RectTransform; triangleTransform = EditorGUILayout.ObjectField("Triangle Rect Transform", tutorialController.arrowTransform, typeof(RectTransform), true) as RectTransform; //buttons for saving transforms of normal panel or alternate panel //alternate panel is used for changing size in certain interactions if (GUILayout.Button("Save Panel Transform")) { SavePanelTransforms(); } if (GUILayout.Button("Save Alternate Panel Transform")) { SaveAltPanelTransforms(); } //create inputs for tutorial text GUILayout.Label("", EditorStyles.boldLabel); GUILayout.Label("Save Panel Text", EditorStyles.boldLabel); titleString = EditorGUILayout.TextField("Title", titleString); titleText = EditorGUILayout.ObjectField("Title Text", tutorialController.titleText, typeof(TMP_Text), true) as TMP_Text; informationString = EditorGUILayout.TextField("Information", informationString); informationText = EditorGUILayout.ObjectField("Information Text", tutorialController.informationText, typeof(TMP_Text), true) as TMP_Text; //save input text to scriptable object if (GUILayout.Button("Save Text")) { SaveText(); } //update any changes made in the ui window if (GUI.changed) { informationText.text = informationString; EditorUtility.SetDirty(informationText); titleText.text = titleString; EditorUtility.SetDirty(titleText); EditorUtility.SetDirty(tutorialObject); EditorUtility.SetDirty(maskTransform); EditorUtility.SetDirty(panelTransform); EditorUtility.SetDirty(triangleTransform); } //button for saving all tutorial aspects GUILayout.Label("", EditorStyles.boldLabel); if (GUILayout.Button("Save All")) { SaveTutorial(); } } //if a tutorial controller does not exist Add button for user to create one else { GUILayout.Label("There is currently no tutorial system in the scene", EditorStyles.boldLabel); if (GUILayout.Button("Add Tutorial System to Scene")) { GameObject tutPrefab = PrefabUtility.LoadPrefabContents("Packages/com.vmlab.tutorialslibrary/Runtime/Prefabs/TitleAndTutorialCanvas.prefab") as GameObject; Instantiate(tutPrefab); } } }