public override void OnInspectorGUI() { UGUIMenuVerticalScroll ScrollScript = target as UGUIMenuVerticalScroll; GUI.changed = false; Undo.RecordObject(ScrollScript, "Inspector"); DrawDefaultInspector(); EditorGUILayout.Space(); if (!EditorApplication.isPlayingOrWillChangePlaymode && !EditorApplication.isPlaying && !EditorApplication.isPaused) { InspectorDisabled = false; } else { InspectorDisabled = true; } EditorGUI.BeginChangeCheck(); EditorGUI.BeginDisabledGroup(InspectorDisabled); ScrollScript.UseVerticalScroll = EditorGUILayout.Toggle("Use VerticalScroll", ScrollScript.UseVerticalScroll); EditorGUI.EndDisabledGroup(); EditorGUI.BeginDisabledGroup(ScrollScript.UseVerticalScroll != true); ScrollScript.ScrollIntoRatio = EditorGUILayout.Slider("ScrollInto Ratio", ScrollScript.ScrollIntoRatio, 0, 1); ScrollScript.ScrollIntoInertia = EditorGUILayout.Slider("ScrollInto Inertia", ScrollScript.ScrollIntoInertia, 0, 1); EditorGUI.EndDisabledGroup(); if (GUI.changed) { EditorUtility.SetDirty(target); } EditorGUI.EndChangeCheck(); }
void Start() { if (SetScript == null) { SetScript = GetComponentInParent <jInputSettings>(); } if (SetScript == null) { Debug.LogError("[jInput] jInputSettings script is Not Found!!"); } MenuItemButtonGOsAry = new GameObject[SetScript.MenuItemHeadings.Length]; OperateItemsAry = new GameObject[4]; FirstSelectCheck = true; StartSelectNullCheck = true; FromMostOverCheck = false; FromMostUnderCheck = false; EndToEndCheck = false; IntoRectFalse(); if (MenuItemsGO != null) { for (int i = 0; i < MenuItemButtonGOsAry.Length; i++) { for (int j = 0; j < MenuItemsGO.transform.childCount; j++) { string TempFindName = null; GameObject TempItem = MenuItemsGO.transform.GetChild(j).gameObject; if (0 <= i && i <= 9) { TempFindName = "MapperMenuItem0" + i; } else if (i >= 10) { TempFindName = "MapperMenuItem" + i; } if (TempItem.name == TempFindName) { if (TempItem.transform.Find("Button")) { MenuItemButtonGOsAry[i] = TempItem.transform.Find("Button").gameObject; } } } } } else { Debug.LogError("[jInput] Error!! OperateItemsGO is Not Found!!"); } if (MenuItemButtonGOsAry[0] != null) { FirstSelectedMenuItem = MenuItemButtonGOsAry[0]; } else { FirstSelectedMenuItem = transform.parent.Find("InMapperMenuItems/MapperMenuItem00/Button").gameObject; } if (FirstSelectedMenuItem != null) { PrevSelectedMenuItem = FirstSelectedMenuItem; } else { Debug.LogError("[jInput] Error!! Button in MapperMenuItem00 is Not Found!!"); } if (OperateItemsGO != null) { for (int i = 0; i < 4; i++) { for (int j = 0; j < OperateItemsGO.transform.childCount; j++) { GameObject TempItem = OperateItemsGO.transform.GetChild(j).gameObject; if (TempItem.name == "MapperOperateItem0" + i) { OperateItemsAry[i] = TempItem; break; } } if (0 <= i && i < 3) { if (OperateItemsAry[i] == null) { Debug.LogError("[jInput] Error!! MapperOperateItem0" + i + " is Not Found!!"); } } } OperateItemsSetNonInteractable(); } else { Debug.LogError("[jInput] Error!! OperateItemsGO is Not Found!!"); } if (transform.GetComponentInParent <UGUIMenuVerticalScroll>()) { VerticalScrollScript = transform.GetComponentInParent <UGUIMenuVerticalScroll>(); VerticalScrollScript.GetComponent <ScrollRect>().verticalNormalizedPosition = 1; } }
void Start() { if (SetScript == null) { SetScript = GetComponentInParent <jInputSettings>(); } if (SetScript == null) { Debug.LogError("[jInput] jInputSettings script is Not Found!!"); } NameCheck = gameObject.name.IndexOf("MapperMenuItem"); if (NameCheck != 0 || gameObject.name.Length != 16) { Debug.LogError("[jInput] Error!! To be necessary MapperMenuItem Object naming 'MapperMenuItem'+ serial number of double figures 00 to 30."); } else { MenuNumString = gameObject.name.Substring(gameObject.name.Length - 2, 2); MenuNum = int.Parse(MenuNumString); } if (AlertMarkGO == null) { if (transform.Find("AlertMark")) { AlertMarkGO = transform.Find("AlertMark").gameObject; } } if (AlertMarkGO != null) { if (AlertMarkGO.GetComponent <Image>()) { ThisAlertMarkBaseColor = AlertMarkGO.GetComponent <Image>().color; } #if (UNITY_EDITOR) if (EditorApplication.isPlaying || EditorApplication.isPaused) #endif AlertMarkGO.SetActive(false); } else { Debug.LogError("[jInput] Error!! AlertMark gameObject in " + this.gameObject.name + " is Not Found!"); } if (ThisButtonGO == null) { ThisButtonGO = transform.Find("Button").gameObject; } if (ThisButtonGO == null) { Debug.LogError("[jInput] Error!! Button in " + this.gameObject.name + " is Not Found!"); } else { if (ThisButtonGO.transform.Find("Text")) { if (ThisButtonGO.transform.Find("Text").GetComponent <Text>()) { InputText = ThisButtonGO.transform.Find("Text").GetComponent <Text>(); } if (ThisButtonGO.transform.Find("Text").GetComponent <UGUIButtonTextColor>()) { ButtonTextColorScript = ThisButtonGO.transform.Find("Text").GetComponent <UGUIButtonTextColor>(); } } if (InputText == null) { Debug.LogError("[jInput] Error!! InputText in " + this.gameObject.name + " is Not Found!"); } if (ThisButtonGO.GetComponent <Image>()) { ThisButtonImageCpnt = ThisButtonGO.GetComponent <Image>(); } if (ThisButtonImageCpnt == null) { Debug.LogError("[jInput] Error!! Image Component with Button in " + this.gameObject.name + " is Not Found!"); } else { ThisButtonBaseColor = ThisButtonImageCpnt.color; } } if (transform.Find("HeadingText") != null && transform.Find("HeadingText").GetComponent <Text>() != null) { ThisHeadingTextCpnt = transform.Find("HeadingText").GetComponent <Text>(); ThisHeadingBaseColor = ThisHeadingTextCpnt.color; } if (ThisHeadingTextCpnt == null) { Debug.LogError("[jInput] Error!! ThisHeadingTextCpnt in " + this.gameObject.name + " is Not Found!"); } if (VerticalScrollScript == null && GetComponentInParent <UGUIMenuVerticalScroll>()) { VerticalScrollScript = GetComponentInParent <UGUIMenuVerticalScroll>(); } if (VerticalScrollScript != null && VerticalScrollScript.UseVerticalScroll) { UseScrollCheck = true; ScrollRangeRectTrns = VerticalScrollScript.GetComponent <RectTransform>(); } else { UseScrollCheck = false; } #if (UNITY_EDITOR) if (EditorApplication.isPlaying || EditorApplication.isPaused) { #endif HeadingTextPour(); //スクロール範囲外で透明~半透明のitemがキー設定窓に移行した瞬間一瞬表示されてしまうので透明にしておく if (UseScrollCheck) { if (ThisButtonImageCpnt != null) { ThisButtonImageCpnt.color = Color.clear; } if (ThisHeadingTextCpnt != null) { ThisHeadingTextCpnt.color = Color.clear; } if (InputText != null) { InputText.color = Color.clear; } } #if (UNITY_EDITOR) } #endif }