void GUIBuildSettigns() { using (new GUILayout.HorizontalScope()) { GUILayout.Label("Version Name".Localization(), GUILayout.ExpandWidth(false)); string versionName = UserBuildSettings.AvalibleVersionName; if (!UserBuildSettings.IsDebug) { if (string.IsNullOrEmpty(versionName)) { versionName = "Release"; } else { versionName = "Release," + versionName; } } GUILayout.Label("[" + versionName + "]", GUILayout.ExpandWidth(false)); GUILayout.Label("Version".Localization(), GUILayout.ExpandWidth(false)); using (var checker = new EditorGUI.ChangeCheckScope()) { if (versionFile == null) { versionFile = string.Empty; } //string[] parts = versionFile.Split('.'); //for (int i = 0; i < parts.Length; i++) //{ // string label = null; // switch (i) // { // case 0: // label = "Major"; // break; // case 1: // label = "Minor"; // break; // case 2: // label = "Build"; // break; // case 3: // label = "Revision"; // break; // } // if (i > 0) // GUILayout.Label(".", GUILayout.Width(10)); // //if (label != null) // // GUILayout.Label(label.Localization(), GUILayout.ExpandWidth(false)); // parts[i] = EditorGUILayoutx.DelayedEditableLabel(parts[i], GUILayout.Width(20)); //} versionFile = EditorGUILayoutx.DelayedEditableLabel(versionFile, GUILayout.ExpandWidth(false)); if (checker.changed) { //versionFile = string.Join(".", parts); EditorOneBuild.SaveVersionFile(versionFile); } } } }
void GUILangKeys() { using (new GUILayout.VerticalScope(GUILayout.Width(EditorGUIUtility.labelWidth))) { GUIBase(); bool oldChanged; foreach (var key in keys) { bool baseMissingKey = !baseData.values.ContainsKey(key); using (new GUILayout.HorizontalScope(GUILayout.Width(EditorGUIUtility.labelWidth), GUILayout.Height(itemHeight + 2))) { oldChanged = GUI.changed; if (GUILayout.Button("◤", "label", GUILayout.ExpandWidth(false))) { GenericMenu menu = new GenericMenu(); if (baseData.values.ContainsKey(key)) { menu.AddItem(new GUIContent("Delete".Localization()), false, (o) => { string key1 = (string)o; baseData.values.Remove(key1); DiryBaseData(); }, key); } else { menu.AddDisabledItem(new GUIContent("Delete".Localization()), false); } menu.ShowAsContext(); GUIUtility.keyboardControl = 0; GUI.changed = oldChanged; } GUIStyle style; /* * if (inheritValue) * { * style = new GUIStyle("label"); * style.normal.textColor = Color.grey; * style.hover.textColor = style.normal.textColor; * style.active.textColor = style.normal.textColor; * } * else*/ if (baseMissingKey) { style = new GUIStyle("label"); style.normal.textColor = Color.red; style.hover.textColor = style.normal.textColor; style.active.textColor = style.normal.textColor; } else { style = "label"; } oldChanged = GUI.changed; // using (new GUILayout.HorizontalScope()) { // if (isBaseEditing) //{ string newKey = EditorGUILayoutx.DelayedEditableLabel(key, labelStyle: style); if (newKey != key && !string.IsNullOrEmpty(newKey)) { /* if (!values.ContainsKey(newKey)) * { * if (values.ContainsKey(key)) * { * values[newKey] = values[key]; * values.Remove(key); * } * else * { * if (baseData.values.ContainsKey(key)) * { * values[newKey] = baseData.values[key]; * } * } * }*/ if (baseData.values.ContainsKey(key) && !baseData.values.ContainsKey(newKey)) { baseData.values[newKey] = baseData.values[key]; baseData.values.Remove(key); DiryBaseData(); GUIUtility.keyboardControl = 0; } //if (isBaseEditing) //{ // ReloadBaseData(); //} GUI.changed = true; continue; } //} //else //{ // GUILayout.Label(key, style); //} } if (GUILayout.Button("T", TranslateButtonStyle, GUILayout.ExpandWidth(false))) { List <TranslateItem> list = new List <TranslateItem>(); foreach (var itemData in itemDatas) { if (itemData.lang != baseData.lang) { list.Add(new TranslateItem() { itemData = itemData, key = key }); } } Translate(baseData, list); } Rect labelRect = GUILayoutUtility.GetLastRect(); if (labelRect.Contains(Event.current.mousePosition)) { if (Event.current.type == EventType.MouseDown) { EditorGUIUtility.systemCopyBuffer = key; } } GUI.changed = oldChanged; } } } }