예제 #1
0
 public void StartStep()
 {
     if (!PMWrapper.IsCompilerRunning)
     {
         PMWrapper.StartCompiler();
     }
 }
예제 #2
0
 public void StartStep()
 {
     stepsLeft = p_steps;
     if (!PMWrapper.IsCompilerRunning)
     {
         PMWrapper.StartCompiler();
     }
 }
예제 #3
0
 public void RunProgram()
 {
     if (Main.Instance.LevelData.sandbox != null)
     {
         InitSandboxMode();
         PMWrapper.StartCompiler();
     }
     else
     {
         StartCorrection();
     }
 }
예제 #4
0
 public void RunAllCasesOrSandbox()
 {
     if (Main.instance.levelDefinition.sandbox != null)
     {
         InitSandboxMode();
         PMWrapper.StartCompiler();
     }
     else
     {
         StartCorrection();
     }
 }
 public void RunCase(int caseNumber)
 {
     CaseFlash.Instance.HideFlash();
     if (numberOfCases > 1)
     {
         CaseFlash.Instance.ShowNewCaseFlash(CurrentCase, true);
     }
     else
     {
         PMWrapper.StartCompiler();
     }
 }
예제 #6
0
        // UITooltip Tooltip;

        public void OnRunCodeButtonClick()
        {
            if (PMWrapper.isCompilerRunning)
            {
                UISingleton.instance.walker.SetWalkerUserPaused(!PMWrapper.isCompilerUserPaused);
            }
            else if (LevelModeController.instance)
            {
                LevelModeController.instance.RunAllCasesOrSandbox();
            }
            else
            {
                PMWrapper.StartCompiler();
            }
        }
예제 #7
0
    private IEnumerator ShowFlash(bool startCompilerWhenFinished)
    {
        foreach (Transform child in transform)
        {
            child.gameObject.SetActive(true);
        }
        yield return(new WaitForSeconds(Duration));

        HideFlash();

        if (startCompilerWhenFinished)
        {
            PMWrapper.StartCompiler();
        }
    }
예제 #8
0
        public bool IsStepDone()
        {
            if (!PMWrapper.IsCompilerRunning)
            {
                PMWrapper.StartCompiler();
            }

            if (CodeWalker.ManusPlayerSaysICanContinue == false && stepsLeft > 0)
            {
                stepsLeft--;
                CodeWalker.ManusPlayerSaysICanContinue = stepsLeft > 0;
            }

            // This step is ready when we no longer need the walker to continue
            return(CodeWalker.ManusPlayerSaysICanContinue == false && stepsLeft == 0);
        }
예제 #9
0
        /// <summary>
        /// Runs the code in the code window and asserts that the compiler does not take too long.
        /// <para>Note: Do not yield the direct return value of this method.
        /// Save it to a variable and iterate it manually and yield the current value <see cref="IEnumerator.Current"/>
        /// on the <see cref="IEnumerator"/></para>
        /// <example>
        /// IEnumerator coroutine = PlaygroundTestHelper.RunCaseAndAssert(data);
        ///	while (coroutine.MoveNext())
        /// {
        ///		yield return coroutine.Current;
        /// }
        /// </example>
        /// </summary>
        public static IEnumerator RunCompilerWithTimeout(int timeoutMilliseconds, string messageFormat = null, params object[] args)
        {
            PMWrapper.StartCompiler();

            var watch = Stopwatch.StartNew();

            while (PMWrapper.isCompilerRunning)
            {
                if (watch.ElapsedMilliseconds > timeoutMilliseconds)
                {
                    Assert.Fail(messageFormat != null
                                                ? "Compiler execution timeout! " + messageFormat
                                                : "Compiler execution timeout!", args);
                }

                yield return(null);
            }
        }