示例#1
0
        private void SetCriticalFailure(string message)
        {
            ExitChildControls();

            // Cleanup, just in case the critical failure effected task
            // management...
            mContext.AbortAllReqests("Critical failure.");

            mOverrideControl = new FailureControl(message);
            mOverrideControl.Enter(mContext, mDebugContext);
        }
示例#2
0
        private void ExitChildControls()
        {
            if (mOverrideControl != null)
            {
                mOverrideControl.Exit();
                mOverrideControl = null;
            }

            SetInputControl(false);
            SetConfigControl(false);
            SetBuildControl(false);

            mSelectedControl = 0;
        }
示例#3
0
        private bool SetBuildControl(bool enabled)
        {
            // Note: Can't be used to change tye type of the build control.

            if (enabled)
            {
                if (mBuildCon != null)
                {
                    return(true);
                }

                IBuildControl con;

                if (mContext.Build.BuildData.IsTiled)
                {
                    con = new MultiTileBuildControl();
                }
                else
                {
                    con = new SingleTileBuildControl();
                }

                if (con.Enter(mContext, mDebugContext))
                {
                    mBuildCon = con;
                    return(true);
                }

                return(false);
            }

            if (mBuildCon != null)
            {
                mBuildCon.Exit();
                mBuildCon = null;
            }

            return(true);
        }
示例#4
0
        private void SetCriticalFailure(string message)
        {
            ExitChildControls();

            // Cleanup, just in case the critical failure effected task 
            // management...
            mContext.AbortAllReqests("Critical failure.");

            mOverrideControl = new FailureControl(message);
            mOverrideControl.Enter(mContext, mDebugContext);
        }
示例#5
0
        private void ExitChildControls()
        {
            if (mOverrideControl != null)
            {
                mOverrideControl.Exit();
                mOverrideControl = null;
            }

            SetInputControl(false);
            SetConfigControl(false);
            SetBuildControl(false);

            mSelectedControl = 0;
        }
示例#6
0
        private bool SetBuildControl(bool enabled)
        {
            // Note: Can't be used to change tye type of the build control.

            if (enabled)
            {
                if (mBuildCon != null)
                    return true;

                IBuildControl con;

                if (mContext.Build.BuildData.IsTiled)
                    con = new MultiTileBuildControl();
                else
                    con = new SingleTileBuildControl();

                if (con.Enter(mContext, mDebugContext))
                {
                    mBuildCon = con;
                    return true;
                }

                return false;
            }

            if (mBuildCon != null)
            {
                mBuildCon.Exit();
                mBuildCon = null;
            }

            return true;
        }
示例#7
0
        private void PerformStateTransition()
        {
            mContext.Selection.ClearSelection();

            mSelectedControl = 0;  // Will always change during a transition.

            if (mOverrideControl != null)
            {
                // Always get rid of the override control. A new one
                // will be created as needed.
                mOverrideControl.Exit();
                mOverrideControl = null;
            }

            NavmeshBuild build = mContext.Build;  // Note: Caller already checked for null.
            NavmeshBuildState buildState = build.BuildState;

            // No early exits after this point.

            // Debug.Log("Transition: " + buildState);

            switch (buildState)
            {
                case NavmeshBuildState.Inactive:

                    // Needs first time compile of input data.

                    ExitChildControls();

                    if (SetInputControl(true))
                        mSelectedControl = ControlType.Input;

                    break;

                case NavmeshBuildState.InputCompiled:

                    // Let user update config before preparing the build.

                    SetBuildControl(false);

                    if (SetConfigControl(true) && SetInputControl(true))
                        mSelectedControl = ControlType.Config;

                    break;

                case NavmeshBuildState.NeedsRecovery:

                    ExitChildControls();
                    SetCriticalFailure("Internal error: Unexpected loss of input data.");

                    break;

                case NavmeshBuildState.Buildable:

                    if (SetBuildControl(true)
                        && SetConfigControl(true)
                        && SetInputControl(true))
                    {
                        mSelectedControl = ControlType.Build;
                    }

                    break;

                case NavmeshBuildState.Invalid:

                    ExitChildControls();

                    mOverrideControl = new CoreFailureControl();
                    mOverrideControl.Enter(mContext, mDebugContext);

                    break;

                default:

                    SetCriticalFailure("Internal error. Unhandled build state: " + buildState);
                    break;
            }

            // Note: Don't requery the build.  This is the state that was
            // handled.
            mLastBuildState = buildState;

            mDebugContext.NeedsRepaint = true;
        }
示例#8
0
        private void PerformStateTransition()
        {
            mContext.Selection.ClearSelection();

            mSelectedControl = 0;  // Will always change during a transition.

            if (mOverrideControl != null)
            {
                // Always get rid of the override control. A new one
                // will be created as needed.
                mOverrideControl.Exit();
                mOverrideControl = null;
            }

            NavmeshBuild      build      = mContext.Build; // Note: Caller already checked for null.
            NavmeshBuildState buildState = build.BuildState;

            // No early exits after this point.

            // Debug.Log("Transition: " + buildState);

            switch (buildState)
            {
            case NavmeshBuildState.Inactive:

                // Needs first time compile of input data.

                ExitChildControls();

                if (SetInputControl(true))
                {
                    mSelectedControl = ControlType.Input;
                }

                break;

            case NavmeshBuildState.InputCompiled:

                // Let user update config before preparing the build.

                SetBuildControl(false);

                if (SetConfigControl(true) && SetInputControl(true))
                {
                    mSelectedControl = ControlType.Config;
                }

                break;

            case NavmeshBuildState.NeedsRecovery:

                ExitChildControls();
                SetCriticalFailure("Internal error: Unexpected loss of input data.");

                break;

            case NavmeshBuildState.Buildable:

                if (SetBuildControl(true) &&
                    SetConfigControl(true) &&
                    SetInputControl(true))
                {
                    mSelectedControl = ControlType.Build;
                }

                break;

            case NavmeshBuildState.Invalid:

                ExitChildControls();

                mOverrideControl = new CoreFailureControl();
                mOverrideControl.Enter(mContext, mDebugContext);

                break;

            default:

                SetCriticalFailure("Internal error. Unhandled build state: " + buildState);
                break;
            }

            // Note: Don't requery the build.  This is the state that was
            // handled.
            mLastBuildState = buildState;

            mDebugContext.NeedsRepaint = true;
        }