private void DisplayItem(Languaje idioma)
 {
     EditorGUILayout.BeginVertical("Box");
     EditorGUILayout.BeginHorizontal();
     GUILayout.Label("Name: ");
     idioma.Name = EditorGUILayout.TextField(idioma.Name, options);
     EditorGUILayout.EndHorizontal();
     if (database.LanguajesCount > 0 && firstLanguaje != string.Empty)
     {
         GUILayout.Label("Contents: ");
         EditorGUILayout.BeginHorizontal();
         GUILayout.Label(database.GetLanguaje(firstLanguaje).Name, h1);
         GUILayout.Label("New Idioma", h1);
         EditorGUILayout.EndHorizontal();
         for (int i = 0; i < database.LanguajeContentCount(firstLanguaje); i++)
         {
             EditorGUILayout.BeginHorizontal();
             GUILayout.Label(database.GetLanguaje(firstLanguaje).content[i].content, valueStyle);
             EditorGUILayout.BeginVertical();
             contents[i] = EditorGUILayout.TextField(contents[i], GUILayout.MinWidth(150.0f));
             EditorGUILayout.EndVertical();
             EditorGUILayout.EndHorizontal();
         }
         EditorGUILayout.EndVertical();
     }
 }
 public void OnGUI()
 {
     for (int i = 0; i < database.LanguajesCount; i++)
     {
         DisplayIdioma(i, database.GetLanguaje(i));
     }
     if (GUILayout.Button("Confirm"))
     {
         AddContents();
     }
 }
 public override void OnInspectorGUI()
 {
     base.DrawDefaultInspector();
     if (database)
     {
         EditorGUILayout.BeginVertical("Box");
         GUILayout.Label("Languajes in DataBase: " + database.LanguajesCount);
         if (database.LanguajesCount > 0)
         {
             EditorGUILayout.BeginHorizontal("Box");
             GUILayout.Label("Search: ");
             searchString = GUILayout.TextField(searchString);
             EditorGUILayout.EndHorizontal();
         }
         if (GUILayout.Button("Add new Idioma"))
         {
             AddLanguajeWindows.ShowWindow(database);
         }
         if (GUILayout.Button("Add new Content"))
         {
             AddContentWindows.ShowWindow(database);
         }
         EditorGUILayout.EndVertical();
         shouldSearch = !string.IsNullOrEmpty(searchString);
         foreach (var item in database.GetLanguajes())
         {
             if (shouldSearch)
             {
                 if (item == searchString || item.Contains(searchString))
                 {
                     DisplayIdioma(database.GetLanguaje(item));
                 }
             }
             else
             {
                 DisplayIdioma(database.GetLanguaje(item));
             }
         }
         //if(deleteItem != null)
         //    database.items.Remove(deleteItem);
     }
 }
 public static void ShowWindow(ScriptableLanguaje db)
 {
     database               = db;
     window                 = GetWindow <AddLanguajeWindows>();
     window.minSize         = new Vector2(300, 380);
     newItem                = new Languaje();
     textAreaStyle.wordWrap = true;
     valueStyle.wordWrap    = true;
     valueStyle.alignment   = TextAnchor.MiddleLeft;
     h1.fontSize            = 16;
     window.titleContent    = new GUIContent("Add new Idioma");
     if (db.LanguajesCount > 0)
     {
         contents      = new string[db.LanguajeContentCount(db.GetLanguaje(0).Name)];
         firstLanguaje = db.GetLanguaje(0).Name;
     }
     else
     {
         contents      = new string[0];
         firstLanguaje = string.Empty;
     }
 }
Exemple #5
0
    void Start()
    {
        languajeSelect.onValueChanged.AddListener((index) => {
            languajeSelected = dbLanguaje.GetLanguaje(index).Name;
            SetTextsLanguajes();
        });
        var langs = dbLanguaje.GetLanguajes();

        languajeSelect.AddOptions(langs);
        for (int i = 0; i < langs.Count; i++)
        {
            if (langs[i] == languajeSelected)
            {
                languajeSelect.value = i;
            }
        }
        SetTextsLanguajes();
    }