// Start is called before the first frame update void Start() { textField = GetComponent <TextMeshProUGUI>(); string value = LocalizationSystem.GetLocalisedValue(key); textField.text = value; }
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { int posX = 15; EditorGUI.BeginProperty(position, label, property); position = EditorGUI.PrefixLabel(position, GUIUtility.GetControlID(FocusType.Passive), label); position.width -= 34; position.height = 18; Rect valueRect = new Rect(position); valueRect.x += 0;//posX valueRect.width -= posX; position.x -= posX;//- Rect foldButtonRect = new Rect(position); foldButtonRect.width = posX; dropdown = EditorGUI.Foldout(foldButtonRect, dropdown, ""); position.x += posX; position.width -= posX + 54; SerializedProperty key = property.FindPropertyRelative("key"); key.stringValue = EditorGUI.TextField(position, key.stringValue); position.x += position.width + 2; position.width = 50; position.height = 17; //Texture searchIcon = (Texture)Resources.Load("Icons\\search"); //GUIContent searchContent = new GUIContent(searchIcon,"Search"); if (GUI.Button(position, "Search"))//searchContent)) { TextLocalizerSearchWindow.Open(key.stringValue); } position.x += position.width + 2; //Texture storeIcon = (Texture)Resources.Load("Icons\\store"); //GUIContent storeContent = new GUIContent(storeIcon,"Store"); if (GUI.Button(position, "Store"))//storeContent)) { TextLocalizerEditorWindow.Open(key.stringValue); } if (dropdown) { var value = LocalizationSystem.GetLocalisedValue(key.stringValue); GUIStyle style = GUI.skin.box; height = style.CalcHeight(new GUIContent(value), valueRect.width); valueRect.height = height; valueRect.y += 21; EditorGUI.LabelField(valueRect, "Value: " + value, EditorStyles.wordWrappedLabel); } EditorGUI.EndProperty(); //base.OnGUI(position, property, label); }
// Start is called before the first frame update protected override void Start() { base.Start(); if (hud) { hud.ShowDialogUI(LocalizationSystem.GetLocalisedValue("text_commander1"), LocalizationSystem.GetLocalisedValue("text_tutstart")); } }
public void UpdateTankStats(TankController tank) { if (tankHitpointsText) { tankHitpointsText.text = LocalizationSystem.GetLocalisedValue("text_tankhitpoints") + ": " + tank.maxHitPoints.ToString(); } if (tankMaxDamageText) { tankMaxDamageText.text = LocalizationSystem.GetLocalisedValue("text_tankmaxdamage") + ": " + tank.shellMaxDamage.ToString(); } if (tankShotsBeforeReloadText) { tankShotsBeforeReloadText.text = LocalizationSystem.GetLocalisedValue("text_tankshotsreload") + ": " + tank.maxAmmo.ToString(); } if (tankReloadTimeText) { tankReloadTimeText.text = LocalizationSystem.GetLocalisedValue("text_tankreloadtime") + ": " + tank.reloadTime.ToString() + "s"; } }
public void OnGUI() { key = EditorGUILayout.TextField("Key: ", key); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Value: ", GUILayout.MaxWidth(50)); value = EditorGUILayout.TextArea(value, EditorStyles.textArea, GUILayout.Height(100), GUILayout.Width(400)); EditorGUILayout.EndHorizontal(); if (GUILayout.Button("Add")) { if (LocalizationSystem.GetLocalisedValue(key) != string.Empty) { LocalizationSystem.Replace(key, value); } else { LocalizationSystem.Add(key, value); } } minSize = new Vector2(460, 250); maxSize = minSize; }