示例#1
0
        void DrawBundleConfig(GUILayoutOption[] guiOpts)
        {
            // build
            GUILayout.Space(1f);
            {
                var rect    = EditorGUILayout.GetControlRect();
                var rebuild = mTarget.ForceRebuild;
                var sn      = 5;
                var idx     = -1;
                if (GUI.Button(rect.Split(++idx, sn), "BuildWin"))
                {
                    BuildAB(BuildTarget.StandaloneWindows, rebuild);
                }

                if (GUI.Button(rect.Split(++idx, sn), "BuildAnd"))
                {
                    BuildAB(BuildTarget.Android, rebuild);
                }

                if (GUI.Button(rect.Split(++idx, sn), "BuildiOS"))
                {
                    BuildAB(BuildTarget.iOS, rebuild);
                }

                if (GUI.Button(rect.Split(++idx, sn), "BuildMac"))
                {
                    BuildAB(BuildTarget.StandaloneOSX, rebuild);
                }
            }

            // clean
            GUILayout.Space(1f);
            {
                var rect = EditorGUILayout.GetControlRect();
                var sn   = 5;
                var idx  = -1;
                if (GUI.Button(rect.Split(++idx, sn), "CleanWin"))
                {
                    Directory.Delete(BuildScript.BundleOutDir + (BuildTarget.StandaloneWindows), true);
                }

                if (GUI.Button(rect.Split(++idx, sn), "CleanAnd"))
                {
                    Directory.Delete(BuildScript.BundleOutDir + (BuildTarget.Android), true);
                }

                if (GUI.Button(rect.Split(++idx, sn), "CleaniOS"))
                {
                    Directory.Delete(BuildScript.BundleOutDir + (BuildTarget.iOS), true);
                }

                if (GUI.Button(rect.Split(++idx, sn), "CleanMac"))
                {
                    Directory.Delete(BuildScript.BundleOutDir + (BuildTarget.iOS), true);
                }
            }

            // update prefab lua path
            GUILayout.Space(1f);
            {
                var rect = EditorGUILayout.GetControlRect();
                var sn   = 4;
                var idx  = -1;
                if (GUI.Button(rect.Split(++idx, sn), "Refresh"))
                {
                    Refresh();
                }

                if (GUI.Button(rect.Split(++idx, sn), "FixPrefabLuaPath"))
                {
                    EditorCoroutine.Run(FixPrefabLuaPath());
                }
            }


            EditorGUILayout.LabelField("LastBuildTime",
                                       DateTime.FromFileTime(mTarget.LastBuildTime).ToString("yyyy/MM/dd HH:mm:ss"));
            mTarget.ForceRebuild = EditorGUILayout.Toggle("ForceRebuild", mTarget.ForceRebuild, guiOpts);
            mTarget.BuildScene   = EditorGUILayout.Toggle("BuildScene", mTarget.BuildScene, guiOpts);

            mTarget.BundleBuildOptions =
                (BuildConfig.BuildAssetBundleOptions)EditorGUILayout.EnumFlagsField("BundleBuildOptions",
                                                                                    mTarget.BundleBuildOptions);

            ++EditorGUI.indentLevel;
            foreach (var i in mTarget.Groups)
            {
                i.DrawGroup(0, guiOpts);
            }

            --EditorGUI.indentLevel;
        }
示例#2
0
        public override void OnInspectorGUI()
        {
            // Tabs.
            {
                // Select tabs.
                EditorGUI.BeginChangeCheck();
                var rect = EditorGUILayout.BeginVertical(Styles.kSettingsFramebox);

                // Draw General Settings Tab.
                GUIStyle buttonStyle = null;
                var      buttonRect  = GetTabSelection(rect, 0, out buttonStyle);
                if (GUI.Toggle(buttonRect, generalSettingsSelected, Content.kGeneralLabel, buttonStyle))
                {
                    generalSettingsSelected = true;
                }

                // Draw Collision Settings Tab.
                buttonRect = GetTabSelection(rect, 1, out buttonStyle);
                if (GUI.Toggle(buttonRect, !generalSettingsSelected, Content.kCollisionLabel, buttonStyle))
                {
                    generalSettingsSelected = false;
                }

                GUILayoutUtility.GetRect(10, EditorGUI.kTabButtonHeight);
                EditorGUI.EndChangeCheck();
            }

            // Draw tab selection.
            if (generalSettingsSelected)
            {
                // Update object.
                serializedObject.Update();

                // Draw standard property settings.
                EditorGUILayout.Space();
                EditorGUILayout.Space();
                DrawPropertiesExcluding(serializedObject, "m_JobOptions", "m_ReuseCollisionCallbacks", "m_AutoSyncTransforms", "m_GizmoOptions");

                // Reuse Collision Callbacks.
                EditorGUILayout.PropertyField(m_ReuseCollisionCallbacks);
                if (!m_ReuseCollisionCallbacks.boolValue)
                {
                    EditorGUILayout.HelpBox(Content.kReuseCollisionCallbacksLabel.ToString(), MessageType.Warning, false);
                    EditorGUILayout.Space();
                }

                // Auto Sync Transforms.
                EditorGUILayout.PropertyField(m_AutoSyncTransforms);
                if (m_AutoSyncTransforms.boolValue)
                {
                    EditorGUILayout.HelpBox(Content.kAutoSyncTransformsLabel.ToString(), MessageType.Warning, false);
                    EditorGUILayout.Space();
                }

                // Draw the Gizmo options.
                Physics2D.GizmoOptions gizmoOptions = (Physics2D.GizmoOptions)m_GizmoOptions.intValue;
                gizmoOptions            = (Physics2D.GizmoOptions)EditorGUILayout.EnumFlagsField(Content.kGizmosLabel, gizmoOptions);
                m_GizmoOptions.intValue = (int)gizmoOptions;

                // Multithreading.
                GUILayout.BeginHorizontal();
                GUILayout.Space(0);
                EditorGUILayout.PropertyField(m_Multithreading, Content.kMultithreadingLabel, true);
                GUILayout.EndHorizontal();

                // Padding.
                EditorGUILayout.Space();

                // Apply changes.
                serializedObject.ApplyModifiedProperties();
            }
            else
            {
                // Layer Collision Matrix.
                LayerCollisionMatrixGUI2D.Draw(
                    Content.kLayerCollisionMatrixLabel,
                    (int layerA, int layerB) => { return(!Physics2D.GetIgnoreLayerCollision(layerA, layerB)); },
                    (int layerA, int layerB, bool val) => { Physics2D.IgnoreLayerCollision(layerA, layerB, !val); }
                    );
            }

            EditorGUILayout.EndVertical();
        }