private void OnPermissionDlgClose(object dialog)
        {
            AMM_AddPermissionDialog dlg = dialog as AMM_AddPermissionDialog;

            dlg.onClose    -= OnPermissionDlgClose;
            dlg.onAddClick -= OnAddPermissionClick;
        }
        private void Actions()
        {
            EditorGUILayout.BeginHorizontal();
            if (GUILayout.Button("Add Android Permission"))
            {
                GenericMenu permissionsMenu = new GenericMenu();
                foreach (string pStr in PermissionsStrings)
                {
                    permissionsMenu.AddItem(new GUIContent(pStr), false, SelectPermission, pStr);
                }
                permissionsMenu.ShowAsContext();
            }

            if (GUILayout.Button("Add Custom Permission"))
            {
                AMM_AddPermissionDialog dlg = EditorWindow.CreateInstance <AMM_AddPermissionDialog>();
                dlg.onClose    += OnPermissionDlgClose;
                dlg.onAddClick += OnAddPermissionClick;

                dlg.titleContent.text = "Add Permission";



                dlg.ShowAuxWindow();
            }
            EditorGUILayout.EndHorizontal();
        }
Пример #3
0
        private void Activities()
        {
            int launcherActivities = 0;

            foreach (int id in AMM_Manager.GetManifest().ApplicationTemplate.Activities.Keys)
            {
                AMM_ActivityTemplate activity = AMM_Manager.GetManifest().ApplicationTemplate.Activities[id];

                if (activity.IsLauncher)
                {
                    launcherActivities++;
                }

                EditorGUILayout.BeginVertical(GUI.skin.box);
                EditorGUILayout.BeginHorizontal();
                activity.IsOpen = EditorGUILayout.Foldout(activity.IsOpen, activity.Name);
                if (GUILayout.Button("X", EditorStyles.miniButton, GUILayout.Width(20.0f)))
                {
                    AMM_Manager.GetManifest().ApplicationTemplate.RemoveActivity(activity);
                    return;
                }
                EditorGUILayout.EndHorizontal();

                if (activity.IsOpen)
                {
                    EditorGUILayout.BeginVertical();

                    bool isLauncher = activity.IsLauncher;
                    EditorGUI.BeginChangeCheck();
                    isLauncher = EditorGUILayout.Toggle("Is Launcher", activity.IsLauncher);
                    if (EditorGUI.EndChangeCheck())
                    {
                        activity.SetAsLauncher(isLauncher);
                    }

                    foreach (string k in activity.Values.Keys)
                    {
                        EditorGUILayout.BeginHorizontal();

                        EditorGUILayout.LabelField(k);
                        EditorGUILayout.Space();

                        string input = activity.Values[k];
                        EditorGUI.BeginChangeCheck();

                        if (k.Equals("android:name"))
                        {
                            input = EditorGUILayout.TextField(activity.Values[k]);
                        }
                        else
                        {
                            input = EditorGUILayout.TextField(activity.Values[k]);
                        }

                        if (EditorGUI.EndChangeCheck())
                        {
                            activity.SetValue(k, input);
                            return;
                        }

                        if (!k.Equals("android:name"))
                        {
                            if (GUILayout.Button("X", EditorStyles.miniButton, GUILayout.Width(20.0f)))
                            {
                                activity.RemoveValue(k);
                                return;
                            }
                        }

                        EditorGUILayout.EndHorizontal();
                        EditorGUILayout.Space();
                    }

                    AMM_SettingsWindow.DrawProperties(activity);

                    EditorGUILayout.BeginHorizontal();
                    EditorGUILayout.Space();
                    if (GUILayout.Button("Add Value", GUILayout.Width(100.0f)))
                    {
                        AMM_SettingsWindow.AddValueDialog(activity);
                    }
                    if (GUILayout.Button("Add Property", GUILayout.Width(100.0f)))
                    {
                        AMM_SettingsWindow.AddPropertyDialog(activity);
                    }

                    EditorGUILayout.EndHorizontal();
                    EditorGUILayout.Space();

                    EditorGUILayout.EndVertical();
                }
                EditorGUILayout.EndVertical();
            }

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.Space();
            if (GUILayout.Button("Add Activity", GUILayout.Width(100.0f)))
            {
                AMM_AddPermissionDialog dlg = EditorWindow.CreateInstance <AMM_AddPermissionDialog>();
                dlg.onAddClick += OnAddActivityClick;

                dlg.titleContent.text = "Add Activity";
                dlg.ShowAuxWindow();
            }
            EditorGUILayout.EndHorizontal();

            if (launcherActivities > 1)
            {
                EditorGUILayout.HelpBox("There is MORE THAN ONE Launcher Activity in Manifest", MessageType.Warning);
            }
            else if (launcherActivities < 1)
            {
                EditorGUILayout.HelpBox("There is NO Launcher Activities in Manifest", MessageType.Warning);
            }
        }