public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { float height = singleLine * 1.25f; float centerAmount = (height - singleLine) / 2; float titleWidth = EditorHelpers.GetStringLengthinPix(label.text); float widthVector = position.width - (height * 3) - titleWidth; EditorGUI.LabelField(new Rect(position.x, position.y, titleWidth, height), label); EditorGUI.PropertyField(new Rect(position.x + titleWidth, position.y + centerAmount, widthVector, height), property, GUIContent.none); var resetsContent = new GUIContent("R", "Resets the vector to " + Vector4.zero); if (GUI.Button(new Rect(position.x + titleWidth + widthVector, position.y, height, height), resetsContent)) { property.vector4Value = Vector4.zero; } var copyContent = new GUIContent("C", "Copies the vectors data."); if (GUI.Button(new Rect(position.x + titleWidth + widthVector + height, position.y, height, height), copyContent)) { CopyPaste.EditorCopy(property.vector4Value); } var pasteContent = new GUIContent("P", "Pastes the vectors data."); if (GUI.Button( new Rect(position.x + titleWidth + widthVector + height + height, position.y, height, height), pasteContent)) { property.vector4Value = CopyPaste.Paste <Vector4>(); } }
private void PasteButton_Click(object sender, EventArgs e) { var teraHandle = FindWindow(null, "TERA"); if (teraHandle == IntPtr.Zero) { MessageBox.Show("TERA is not running."); return; } SetForegroundWindow(teraHandle); CopyPaste.Paste(); }
private void hook_KeyPressed(object sender, KeyPressedEventArgs e) { if (e.Key == BasicTeraData.HotkeysData.Paste.Key && e.Modifier == BasicTeraData.HotkeysData.Paste.Value) { CopyPaste.Paste(); } else if (e.Key == BasicTeraData.HotkeysData.Reset.Key && e.Modifier == BasicTeraData.HotkeysData.Reset.Value) { Reset(); } foreach (var copy in BasicTeraData.HotkeysData.Copy.Where(copy => e.Key == copy.Key && e.Modifier == copy.Modifier)) { CopyPaste.Copy(PlayerData(), copy.Header, copy.Content, copy.Footer); } }
//[Obsolete("Use property drawer instead")] public static Vector3 DrawVector3(GUIContent label, Vector3 vec, Vector3 defualtValue, bool allowTransformDrop = false) { EditorGUILayout.BeginHorizontal(); vec = EditorGUILayout.Vector3Field(label, vec); if (allowTransformDrop) { var transformContent = new GUIContent("", "Asign the vectors value from a transform Position"); Transform transform = null; transform = (Transform)EditorGUILayout.ObjectField(transformContent, transform, typeof(Transform), true, GUILayout.Width(50)); if (transform != null) { EditorGUILayout.EndHorizontal(); return(transform.position); } } var resetContent = new GUIContent("R", "Resets the vector to " + defualtValue); if (GUILayout.Button(resetContent, GUILayout.Width(25))) { vec = defualtValue; } var copyContent = new GUIContent("C", "Copies the vectors data."); if (GUILayout.Button(copyContent, GUILayout.Width(25))) { CopyPaste.EditorCopy(vec); } var pasteContent = new GUIContent("P", "Pastes the vectors data."); if (GUILayout.Button(pasteContent, GUILayout.Width(25))) { vec = CopyPaste.Paste <Vector3>(); } EditorGUILayout.EndHorizontal(); return(vec); }
private void OnGUI() { GUILayout.Label("Language Editor", EditorStyles.boldLabel); if (localizationMaster) { GUILayout.Label("Localization Master Found In Resources Folder.", EditorStyles.boldLabel); EditorGUILayout.BeginHorizontal(); var saveContent = new GUIContent("Save active language", "Save active language"); var LoadContent = new GUIContent("Load active language", "Load active language"); if (GUILayout.Button(saveContent)) { localizationMaster.Save(); } if (GUILayout.Button(LoadContent)) { localizationMaster.Load(); } EditorGUILayout.EndHorizontal(); ShowAvailableLanguages = EditorGUILayout.Toggle("Show Available Languages", ShowAvailableLanguages); if (ShowAvailableLanguages) { EditAvailableLanguages = EditorGUILayout.BeginToggleGroup("Show Available Languages", EditAvailableLanguages); for (var i = 0; i < localizationMaster.AvailableLanguages.Count; i++) { if (localizationMaster.AvailableLanguages[i] == LocalizationMaster.englishID) { EditorGUILayout.BeginHorizontal(); GUILayout.Label(i.ToString(), EditorStyles.boldLabel, GUILayout.Width(20)); GUILayout.Label(localizationMaster.AvailableLanguages[i]); var setContent = new GUIContent("Set English to active language", "Set _en to Active Language"); if (localizationMaster.LangIndex != i) { if (GUILayout.Button(setContent)) { localizationMaster.SetLang(i); } } else { GUILayout.Label("Active", GUILayout.Width(100)); } } else { EditorGUILayout.BeginHorizontal(); GUILayout.Label(i.ToString(), EditorStyles.boldLabel, GUILayout.Width(20)); localizationMaster.AvailableLanguages[i] = EditorGUILayout.TextArea(localizationMaster.AvailableLanguages[i]); var setContent = new GUIContent("Set Active", string.Format("Set {0} to Active Language", localizationMaster.AvailableLanguages[i])); if (localizationMaster.LangIndex != i) { if (GUILayout.Button(setContent, GUILayout.Width(100))) { localizationMaster.SetLang(i); } } else { GUILayout.Label("Active", GUILayout.Width(100)); } var resetContent = new GUIContent("Reset Language", "Reset Entries to Key only"); if (GUILayout.Button(resetContent, GUILayout.Width(100))) { ResetLanguage(i); } var deleteContent = new GUIContent("X", "Delete Entry"); if (GUILayout.Button(deleteContent, GUILayout.Width(25))) { localizationMaster.AvailableLanguages.RemoveAt(i); } } EditorGUILayout.EndHorizontal(); } EditorGUILayout.BeginHorizontal(); NewLangString = EditorGUILayout.TextArea(NewLangString); if (GUILayout.Button("Add New Language")) { NewLanguage(); } EditorGUILayout.EndHorizontal(); EditorGUILayout.EndToggleGroup(); } ShowLanguageEntries = EditorGUILayout.Toggle("Entries in the language Database. Show?", ShowLanguageEntries); if (ShowLanguageEntries) { for (var i = 0; i < localizationMaster.DictionaryData.Data.Count; i++) { EditorGUILayout.BeginHorizontal(); GUILayout.Label(i.ToString(), EditorStyles.boldLabel, GUILayout.Width(20)); localizationMaster.DictionaryData.Data[i] = new LocalizationDictionaryEntry(EditorGUILayout.TextArea(localizationMaster.DictionaryData.Data[i].Key, GUILayout.Width(position.width * 0.2f)), EditorGUILayout.TextArea(localizationMaster.DictionaryData.Data[i].Data)); var copyContent = new GUIContent("C", "Copy Entry"); if (GUILayout.Button(copyContent, GUILayout.Width(25))) { CopyPaste.Copy(localizationMaster.DictionaryData.Data[i]); } var pasteContent = new GUIContent("P", "Paste Entry"); if (GUILayout.Button(pasteContent, GUILayout.Width(25))) { localizationMaster.DictionaryData.Data[i] = CopyPaste.Paste <LocalizationDictionaryEntry>(); } var deleteContent = new GUIContent("X", "Delete Entry"); if (GUILayout.Button(deleteContent, GUILayout.Width(25))) { localizationMaster.DictionaryData.Data.RemoveAt(i); } EditorGUILayout.EndHorizontal(); } if (GUILayout.Button("Add New Entry")) { localizationMaster.DictionaryData.Data.Add(new LocalizationDictionaryEntry("newKey", "newData")); } } } else { GUILayout.Label("WARNING \n Localization Master NOT Found In Resources Folder.", EditorStyles.boldLabel); localizationMaster = Resources.Load(LocalizationMaster.DefaultLocation) as LocalizationMaster; } //groupEnabled = EditorGUILayout.BeginToggleGroup("Optional Settings", groupEnabled); //myBool = EditorGUILayout.Toggle("Toggle", myBool); //myFloat = EditorGUILayout.Slider("Slider", myFloat, -3, 3); //EditorGUILayout.EndToggleGroup(); }