コード例 #1
0
        public static NativePlugin GetDefault(EditorWindow editorWindow)
        {
            NativePlugin plugin = CreateInstance <NativePlugin>();

            plugin.Name        = "MyPlugin";
            plugin.Version     = "1.0.0.0";
            plugin.BuildNumber = 1;

            plugin.includePluginAPI = true;

            plugin.buildOptions = new List <NativeBuildOptions> ();
            plugin.buildOptions.Add(NativeBuildOptions.GetDefault(editorWindow));

            plugin.Definitions = new CustomDefinitions();

            plugin.sectionAnimator = new AnimBool(false, editorWindow.Repaint);
            return(plugin);
        }
コード例 #2
0
        void OnGuiBuildOptions(List <NativeBuildOptions> buildOptions)
        {
            EditorGUI.indentLevel--;
            EditorGUILayout.LabelField(string.Format("Build Options ({0})", buildOptions.Count), EditorStyles.boldLabel);
            EditorGUI.indentLevel++;

            for (int i = 0; i < buildOptions.Count; i++)
            {
                buildOptions[i].foldoutAnimator.target = EditorGUILayout.Foldout(buildOptions[i].foldoutAnimator.target,
                                                                                 buildOptions[i].ShortName, true, buildOptions[i].isEnabled ? foldoutBold : foldoutBoldDisabled);

                if (EditorGUILayout.BeginFadeGroup(buildOptions[i].foldoutAnimator.faded))
                {
                    EditorGUI.indentLevel++;

                    buildOptions[i].isEnabled = EditorGUILayout.Toggle("Enabled", buildOptions[i].isEnabled);

                    //Platform
                    GUI.changed = false;

                    buildOptions[i].BuildPlatform = (BuildPlatform)EditorGUILayout.IntPopup("Platform",
                                                                                            (int)buildOptions[i].BuildPlatform, AvailablePlatformStrings, AvailablePlatformInts);

                    if (GUI.changed)
                    {
                        if (!GetBuilder(buildOptions[i].BuildPlatform).SupportedArchitectures.Contains(buildOptions[i].Architecture))
                        {
                            buildOptions[i].Architecture = GetBuilder(buildOptions[i].BuildPlatform).SupportedArchitectures[0];
                        }
                    }

                    //Arch
                    GUI.changed = false;
                    buildOptions[i].Architecture = (Architecture)EditorGUILayout.IntPopup("Architecture", (int)buildOptions[i].Architecture,
                                                                                          GetBuilder(buildOptions[i].BuildPlatform).SupportedArchitectureStrings,
                                                                                          GetBuilder(buildOptions[i].BuildPlatform).SupportedArchitectureInts);

                    buildOptions[i].BuildType = (BuildType)EditorGUILayout.EnumPopup("Build Type", buildOptions[i].BuildType);

                    EditorGUILayout.Space();
                    //Platform specific
                    EditorGUI.indentLevel--;

                    switch (buildOptions[i].BuildPlatform)
                    {
                    case BuildPlatform.Android:
                        if (GetBuilder(BuildPlatform.Android).IsAvailable)
                        {
                            EditorGUILayout.LabelField("Android options", EditorStyles.boldLabel);
                            buildOptions[i].AndroidSdkVersion = EditorGUILayout.IntField(new GUIContent("SDK version", "(0=default)"), buildOptions[i].AndroidSdkVersion);
                        }
                        break;

                    default:
                        break;
                    }
                    EditorGUI.indentLevel++;

                    EditorGUILayout.BeginHorizontal();
                    GUILayout.FlexibleSpace();
                    if (GUILayout.Button("Remove", EditorStyles.miniButton, GUILayout.Width(70)))
                    {
                        buildOptions.RemoveAt(i--);
                    }
                    GUILayout.Space(10);
                    EditorGUILayout.EndHorizontal();

                    EditorGUI.indentLevel--;
                }

                EditorGUILayout.EndFadeGroup();
                EditorGUILayout.Space();
            }
            EditorGUILayout.Space();
            EditorGUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            if (GUILayout.Button("Add Build Option", EditorStyles.miniButton, GUILayout.Width(100)))
            {
                buildOptions.Add(NativeBuildOptions.GetDefault(this));
            }
            GUILayout.Space(20);
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.Space();
        }