Пример #1
0
        public bool Execute()
        {
            if (OnOption.IsPresent)
            {
                TimelineView.Show();
            }

            if (OffOption.IsPresent)
            {
                TimelineView.Hide();
            }

            if (StartPlayback.IsPresent)
            {
                if (!TimelineView.Timeline.IsBusy)
                {
                    if (DoCommandWaitOnPlay)
                    {
                        DevCommandManager.Instance.StartWait();

                        TimelineView.PlayStopped += HandleTimelineViewPlayStopped;
                    }

                    TimelineView.Play();
                }
                else
                {
                    Debug.Log("Error:  Choreography already in progress");
                    return(false);
                }
            }

            // Currently this option would only work if you started choreography with the UI button (which works fine),
            // because if you start it with the dev command we set the 'wait gate' on dev commands (above)
            if (StopPlayback.IsPresent)
            {
                TimelineView.Stop();
            }

            if (InfoOption.IsPresent)
            {
                // NOTE: time does not accomodate for the eval
                var stepCount = TimelineView.Timeline.RecursiveStepCount;
                var duration  = TimelineView.Timeline.RecursiveDuration;
                var estimated = TimelineView.Timeline.RecursiveDurationIsEstimated;

                Debug.Log("Total steps: " + stepCount + "; total time: " + duration + " seconds; estimated:" + estimated);
            }

            return(true);
        }
Пример #2
0
        private void HandleIsBusyChanged(bool isBusy)
        {
            if (Stage == ValidationStage.Choreography)   // Doing this because choreography itself can [optionally] do an eval at the start of playback
            {
                return;
            }

            if (isBusy)
            {
                DevCommandManager.Instance.StartWait();
                return;
            }

            if (!DoingJustCurrentHPValidation || Stage != ValidationStage.Load)
            {
                DevCommandManager.Instance.EndWait();
            }

            var readyForNextFile = false;

            switch (Stage)
            {
            case ValidationStage.Load:
                if (ErrorInLastStage)
                {
                    Debug.Log("Validation:  Error occurred in LOAD of " + CurrentFileName);
                    readyForNextFile = true;
                    Packages[CurrentFileIndex].Result = ResultCode.FailedLoad;
                }
                else
                {
                    TotalSuccessfulLoads++;

                    if (!DoingJustCurrentHPValidation)
                    {
                        Debug.Log("Successful LOAD of " + CurrentFileName);
                    }

                    if (SaveFileUpdateOption.IsPresent)
                    {
                        Stage            = ValidationStage.Save;
                        ErrorInLastStage = false;

                        ChainView.SavePackage(new ChainView.PackageRequest(ChainView.LoadedPackagePath, null));
                        break;
                    }

                    if (ChainView.Chain.HasError)
                    {
                        if (DoingJustCurrentHPValidation)
                        {
                            Debug.Log("Validation:  The current package has chain errors and thus cannot be evaluated");
                        }
                        else
                        {
                            Debug.Log("Validation:  The package " + CurrentFileName + " has chain errors and thus cannot be evaluated");
                            if (!DoingJustCurrentHPValidation)
                            {
                                Packages[CurrentFileIndex].Result = ResultCode.HasChainErrors;
                            }
                        }

                        readyForNextFile = true;
                    }
                    else
                    {
                        TotalSuccessfulChains++;

                        Debug.Log("No errors found in node chain for " + CurrentFileName);
                        ErrorInLastStage = false;

                        if (LoadOnlyOption.IsPresent)
                        {
                            ReadyForNextFile();
                        }
                        else
                        {
                            Stage = ValidationStage.Eval;

                            ChainView.EvaluateChain();
                        }
                    }
                }
                break;

            case ValidationStage.Eval:
                if (ErrorInLastStage)
                {
                    Debug.Log("Validation:  Error occurred during EVALUATION of " + CurrentFileName);
                    readyForNextFile = true;
                    if (!DoingJustCurrentHPValidation)
                    {
                        Packages[CurrentFileIndex].Result = ResultCode.FailedEval;
                    }
                }
                else
                {
                    TotalSuccessfulEvals++;

                    Debug.Log("Successful EVALUATION of " + CurrentFileName);
                    ErrorInLastStage = false;

                    if (IncludeChoreographyOption.IsPresent)
                    {
                        Stage = ValidationStage.Choreography;

                        TimelineView.Play();
                    }
                    else
                    {
                        ReadyForNextFile();
                    }
                }
                break;

            case ValidationStage.Choreography:     // This stage is handled in HandleTimelineViewPlayStopped
                break;

            case ValidationStage.Save:
                readyForNextFile = true;
                if (ErrorInLastStage)
                {
                    Debug.Log("Validation:  Error occurred in SAVE of " + CurrentFileName);
                    Packages[CurrentFileIndex].Result = ResultCode.FailedSave;
                }
                else
                {
                    Debug.Log("Successful SAVE of " + CurrentFileName);
                    TotalSuccessfulSaves++;
                }
                break;
            }

            if (readyForNextFile)
            {
                ReadyForNextFile();
            }
        }