Example #1
0
        public void SetLanguage(SystemLanguage systemLanguage, bool selected)
        {
            LocaleLanguageEditor language = _mLanguages.Find(x => x._mLanguage == systemLanguage);

            if (language == null)
            {
                language = new LocaleLanguageEditor(systemLanguage);
                _mLanguages.Add(language);
            }

            language.SetSelected(selected);
        }
Example #2
0
        private void Scroll(Rect rect)
        {
            // Draw scroll header
            GUILayout.BeginVertical();
            {
                GUIStyle styleBoxMarginless = GUI.skin.box;
                styleBoxMarginless.margin  = new RectOffset(0, 0, 0, 5);
                styleBoxMarginless.padding = new RectOffset(0, 0, 0, 0);

                GUILayout.BeginHorizontal(styleBoxMarginless);
                {
                    GUILayout.BeginHorizontal();
                    {
                        GUILayout.BeginHorizontal();
                        GUILayout.FlexibleSpace();
                        GUILayout.Label("Name");
                        GUILayout.FlexibleSpace();
                        GUILayout.EndHorizontal();

                        GUILayout.BeginHorizontal();
                        GUILayout.Label("|");
                        GUILayout.EndHorizontal();

                        GUILayout.BeginHorizontal();
                        GUILayout.FlexibleSpace();
                        GUILayout.Label("Code");
                        GUILayout.FlexibleSpace();
                        GUILayout.EndHorizontal();
                    }
                    GUILayout.EndHorizontal();
                }
                GUILayout.EndHorizontal();

                GUILayout.BeginVertical(styleBoxMarginless);

                // Draw scroll content
                _mScrollviewPosition = GUILayout.BeginScrollView(_mScrollviewPosition, false, false);
                List <LocaleLanguageEditor> languages = _mInformations.GetLanguagesMatching(_mInformations.SearchBarText);

                for (int i = 0; i < languages.Count; i++)
                {
                    LocaleLanguageEditor language = languages[i];

                    GUIStyle styleSelected    = new GUIStyle();
                    GUIStyle styleHorizontal  = new GUIStyle();
                    GUIStyle styleHorizontal2 = new GUIStyle();

                    if (EditorGUIUtility.isProSkin)
                    {
                        styleHorizontal.normal.background  = MakeTex(new Color(0.2f, 0.2f, 0.2f));
                        styleHorizontal2.normal.background = MakeTex(new Color(0.3f, 0.3f, 0.3f));
                    }
                    else
                    {
                        styleHorizontal.normal.background  = MakeTex(new Color(0.8f, 0.8f, 0.8f));
                        styleHorizontal2.normal.background = MakeTex(new Color(0.9f, 0.9f, 0.9f));
                    }


                    GUIStyle styleHorizontal3 = new GUIStyle();
                    styleHorizontal3.normal.background = MakeTex(Color.blue);
                    GUIStyle styleHorizontal4 = new GUIStyle();
                    styleHorizontal4.normal.background = MakeTex(Color.red);
                    styleSelected = (i % 2 == 0) ? (styleHorizontal) : (styleHorizontal2);

                    GUILayout.BeginHorizontal(styleSelected);

                    GUILayout.BeginHorizontal(GUILayout.Width((rect.width / 2)));
                    language._mSelected = GUILayout.Toggle(language._mSelected, language._mName);
                    GUILayout.EndHorizontal();

                    GUILayout.BeginHorizontal();
                    GUILayout.Label(language._mCode);
                    GUILayout.EndHorizontal();

                    GUILayout.EndHorizontal();
                }

                GUILayout.EndScrollView();
                GUILayout.EndVertical();
            }
            GUILayout.EndVertical();
        }