public static void DrawArrayValues(InfoPlistKey plistKey)
        {
            plistKey.IsListOpen = EditorGUILayout.Foldout(plistKey.IsListOpen, "Array Values (" + plistKey.ChildrenIds.Count + ")");

            if (plistKey.IsListOpen)
            {
                EditorGUI.indentLevel++;
                {
                    foreach (var uniqueKey in plistKey.ChildrenIds)
                    {
                        var v = XCodeProjectSettings.Instance.GetVariableById(uniqueKey);
                        DrawPlistVariable(v, uniqueKey, plistKey.ChildrenIds);

                        if (!plistKey.ChildrenIds.Contains(uniqueKey))
                        {
                            return;
                        }
                    }

                    EditorGUILayout.BeginHorizontal();
                    EditorGUILayout.Space();
                    if (GUILayout.Button("Add Value", GUILayout.Width(100)))
                    {
                        var newVar = new InfoPlistKey();

                        plistKey.AddChild(newVar);
                    }

                    EditorGUILayout.EndHorizontal();
                    EditorGUILayout.Space();
                }
                EditorGUI.indentLevel--;
            }
        }
        public static void DrawDictionaryValues(InfoPlistKey plistKey)
        {
            plistKey.IsListOpen = EditorGUILayout.Foldout(plistKey.IsListOpen, "Dictionary Values");

            if (plistKey.IsListOpen)
            {
                EditorGUI.indentLevel++;
                {
                    foreach (var uniqueKey in plistKey.ChildrenIds)
                    {
                        var v = XCodeProjectSettings.Instance.GetVariableById(uniqueKey);
                        DrawPlistVariable(v, uniqueKey, plistKey.ChildrenIds);

                        if (!plistKey.ChildrenIds.Contains(uniqueKey))
                        {
                            return;
                        }
                    }

                    EditorGUILayout.BeginHorizontal();
                    EditorGUILayout.PrefixLabel("New Key");
                    s_NewValueName = EditorGUILayout.TextField(s_NewValueName);

                    if (GUILayout.Button("Add", GUILayout.Width(50)))
                    {
                        if (s_NewValueName.Length > 0)
                        {
                            var v = new InfoPlistKey();
                            v.Name = s_NewValueName;
                            plistKey.AddChild(v);
                        }
                    }

                    EditorGUILayout.EndHorizontal();
                }
                EditorGUI.indentLevel--;
            }
        }
Exemplo n.º 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);
        }