Пример #1
0
        public void Languages()
        {
            EditorGUI.BeginChangeCheck();

            var languages_icon = EditorAssetDatabase.GetTextureAtPath(XCodeWindowSkin.IconsPath + "languages.png");

            using (new IMGUIWindowBlockWithIndent(new GUIContent("Languages", languages_icon)))
            {
                IMGUILayout.ReorderablList(XCodeProjectSettings.Instance.Languages,
                                           (SA_ISOLanguage lang) =>
                {
                    return(lang.Code.ToUpper() + "     (" + lang.Name + ")");
                }
                                           );

                EditorGUILayout.BeginHorizontal();
                s_newLangindex = EditorGUILayout.Popup(s_newLangindex, SA_LanguagesUtil.ISOLanguagesList.Names.ToArray());
                if (GUILayout.Button("Add Language", EditorStyles.miniButton, GUILayout.Width(100)))
                {
                    var lang = SA_LanguagesUtil.ISOLanguagesList.Languages[s_newLangindex];
                    XCodeProjectSettings.Instance.Languages.Add(lang);
                }

                EditorGUILayout.EndHorizontal();
            }

            if (EditorGUI.EndChangeCheck())
            {
                if (XCodeProjectSettings.Instance.Languages.Count == 0)
                {
                    XCodeProject.RemoveInfoPlistKey(XCodeProjectSettings.CfLocalizationsPlistKey);
                }
            }
        }
        public override void OnGUI()
        {
            IMGUILayout.Header("PLIST VALUES");

            foreach (var plistKey in XCodeProjectSettings.Instance.PlistVariables)
            {
                EditorGUILayout.BeginVertical(GUI.skin.box);
                DrawPlistVariable(plistKey, plistKey, XCodeProjectSettings.Instance.PlistVariables);
                EditorGUILayout.EndVertical();

                if (!XCodeProjectSettings.Instance.PlistVariables.Contains(plistKey))
                {
                    return;
                }
            }

            EditorGUILayout.Space();

            EditorGUILayout.BeginVertical(GUI.skin.box);
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.PrefixLabel("New Variable Name");
            s_NewPlistValueName = EditorGUILayout.TextField(s_NewPlistValueName);
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.Space();
            if (GUILayout.Button("Add", GUILayout.Width(100)))
            {
                if (s_NewPlistValueName.Length > 0)
                {
                    var v = new InfoPlistKey();
                    v.Name = s_NewPlistValueName;
                    XCodeProject.SetInfoPlistKey(v);
                }

                s_NewPlistValueName = string.Empty;
            }

            EditorGUILayout.EndHorizontal();
            EditorGUILayout.Space();
            EditorGUILayout.EndVertical();
        }
Пример #3
0
        static void RegisterAppLanguages()
        {
            //We have nothing to register, no point to add en empty CFBundleLocalizations key.
            if (XCodeProjectSettings.Instance.Languages.Count == 0)
            {
                return;
            }

            var cfBundleLocalizations = new InfoPlistKey();

            cfBundleLocalizations.Name = XCodeProjectSettings.CfLocalizationsPlistKey;
            cfBundleLocalizations.Type = InfoPlistKeyType.Array;

            foreach (var lang in XCodeProjectSettings.Instance.Languages)
            {
                var langItem = new InfoPlistKey();
                langItem.Type        = InfoPlistKeyType.String;
                langItem.StringValue = lang.Name;
                cfBundleLocalizations.AddChild(langItem);
            }

            XCodeProject.SetInfoPlistKey(cfBundleLocalizations);
        }
Пример #4
0
        public void Frameworks()
        {
            var framework_icon = EditorAssetDatabase.GetTextureAtPath(XCodeWindowSkin.IconsPath + "frameworks.png");

            using (new IMGUIWindowBlockWithIndent(new GUIContent("Frameworks", framework_icon)))
            {
                m_IsDefFrameworksOpen = EditorGUILayout.Foldout(m_IsDefFrameworksOpen,
                                                                "Show Default Unity Frameworks (" + FrameworkHandler.DefaultFrameworks.Count + "Enabled)");
                if (m_IsDefFrameworksOpen)
                {
                    var indentLevel = EditorGUI.indentLevel;
                    EditorGUI.indentLevel = 0;
                    using (new IMGUIBeginHorizontal())
                    {
                        GUILayout.Space(30);

                        using (new IMGUIBeginVertical(GUI.skin.box))
                        {
                            foreach (var framework in FrameworkHandler.DefaultFrameworks)
                            {
                                IMGUILayout.SelectableLabel(framework.FrameworkName.ToString() + ".framework", "");
                            }
                        }
                    }

                    EditorGUI.indentLevel = indentLevel;
                    EditorGUILayout.Space();
                }

                m_IsDefLibrariesOpen = EditorGUILayout.Foldout(m_IsDefLibrariesOpen, "Default Unity Libraries (2 Enabled)");
                if (m_IsDefLibrariesOpen)
                {
                    var indentLevel = EditorGUI.indentLevel;
                    EditorGUI.indentLevel = 0;
                    using (new IMGUIBeginHorizontal())
                    {
                        GUILayout.Space(30);

                        using (new IMGUIBeginVertical(GUI.skin.box))
                        {
                            IMGUILayout.SelectableLabel("libiPhone-lib.a", "");
                            IMGUILayout.SelectableLabel("libiconv.2.dylib", "");
                        }
                    }

                    EditorGUI.indentLevel = indentLevel;

                    EditorGUILayout.Space();
                }

                //Frameworks List
                IMGUILayout.ReorderablList(XCodeProjectSettings.Instance.Frameworks,
                                           (XCodeFramework framework) =>
                {
                    if (framework.IsOptional && framework.IsEmbeded)
                    {
                        return(framework.FullName + "       (Optional & Embeded)");
                    }
                    else if (framework.IsOptional)
                    {
                        return(framework.FullName + "        (Optional)");
                    }
                    else if (framework.IsEmbeded)
                    {
                        return(framework.FullName + "        (Embeded)");
                    }
                    else
                    {
                        return(framework.FullName);
                    }
                },
                                           (XCodeFramework framework) =>
                {
                    framework.IsOptional = IMGUILayout.ToggleFiled("Optional", framework.IsOptional, IMGUIToggleStyle.ToggleType.YesNo);
                    framework.IsEmbeded  = IMGUILayout.ToggleFiled("Embeded", framework.IsEmbeded, IMGUIToggleStyle.ToggleType.YesNo);
                }
                                           );

                //Libraries List
                IMGUILayout.ReorderablList(XCodeProjectSettings.Instance.Libraries,
                                           (XCodeLibrary lib) =>
                {
                    if (lib.IsOptional)
                    {
                        return(lib.FullName + "    (Optional)");
                    }
                    else
                    {
                        return(lib.FullName);
                    }
                },
                                           (XCodeLibrary lib) =>
                {
                    lib.IsOptional = IMGUILayout.ToggleFiled("Optional", lib.IsOptional, IMGUIToggleStyle.ToggleType.YesNo);
                }
                                           );

                //Add New Framework
                EditorGUILayout.BeginHorizontal();
                NewBaseFrameworkIndex = EditorGUILayout.Popup(NewBaseFrameworkIndex, FrameworkHandler.BaseFrameworksArray());

                if (GUILayout.Button("Add Framework", EditorStyles.miniButton, GUILayout.Width(100)))
                {
                    var type = FrameworkHandler.BaseFrameworksArray()[NewBaseFrameworkIndex];
                    NewBaseFrameworkIndex = 0;

                    var f = new XCodeFramework(type);
                    XCodeProject.AddFramework(f);
                }

                EditorGUILayout.EndHorizontal();

                //Add New Library
                EditorGUILayout.BeginHorizontal();
                NewLibraryIndex = EditorGUILayout.Popup(NewLibraryIndex, LibraryHandler.BaseLibrariesArray());

                if (GUILayout.Button("Add Library", EditorStyles.miniButton, GUILayout.Width(100)))
                {
                    var type = (XCodeLibraryName)LibraryHandler.EnumValueOf(LibraryHandler.BaseLibrariesArray()[NewLibraryIndex]);
                    NewLibraryIndex = 0;
                    XCodeProject.AddLibrary(type);
                }

                EditorGUILayout.EndHorizontal();
            }
        }