private static Task DefineDialogueSequence()
    {
        Task enterDialogue = new DelegateTask(() => { Logger.Warning("DefineDialogueSequence start"); }, () =>
        {
            return(Services.PlayerMovement.inPlaceForSequence);
        });

        ActionTask triggerCameraAndUI = new ActionTask(() =>
        {
            Logger.Warning("DefineDialogueSequence triggering camera to enter dialogue");
            Services.CameraManager.EnterDialogue();
            Services.UIManager.EnterDialogue();
        });

        Task fadeIn = new WaitTask(.5f);

        Task startConvo = new ActionTask(() =>
        {
            Logger.Warning("DefineDialogueSequence entering dialogue");
            Services.DialogueController.EnterDialogue();
            _enterDialogueFailsafe.Abort();
        });

        enterDialogue.Then(triggerCameraAndUI).Then(fadeIn).Then(startConvo);
        return(enterDialogue);
    }
Esempio n. 2
0
        public void Abort()
        {
#if NETFX_CORE
            _cancellationTokenSource.Cancel();
#else
            _thread.Abort();
#endif
        }
Esempio n. 3
0
 public void Abort()
 {
     Task.Abort();
     if (OnComplete != null)
     {
         OnComplete(this, EventArgs.Empty);
     }
     Done = true;
 }
Esempio n. 4
0
    //	private void HandleCompletion(Task task, int taskIndex) {
    //		// If the finished task has a "next" task
    //		// queue it up - but only if the original task was // successful
    //		if (task.NextTask != null && task.IsSuccessful)
    //		{
    //			AddTask(task.NextTask); }
    //		// clear the task from the manager and let it know // it's nodsa longer being managed _tasks.RemoveAt(taskIndex); task.SetStatus(Task.TaskStatus.Detached);
    //	}

    public void AbortAllTasks()
    {
        for (int i = _tasks.Count - 1; i >= 0; --i)
        {
            Task t = _tasks[i];
            t.Abort();
            _tasks.RemoveAt(i);
            t.SetStatus(Task.TaskStatus.Detached);
        }
    }
Esempio n. 5
0
    public void AbortAll <T>() where T : Task
    {
        Type type = typeof(T);

        for (int i = _tasks.Count - 1; i >= 0; i--)
        {
            Task task = _tasks[i];
            if (task.GetType() == type)
            {
                task.Abort();
            }
        }
    }
Esempio n. 6
0
        public void OnApplicationQuit()
        {
            _running   = false;
            _listening = false;
            send_MRSTE.Set();
            send_MRSTE.Reset();

            _sendTask.Join(500);
            _listenTask.Join(500);
            _heartbeatTask.Join(500);

            try {
                _sendTask.Abort();
            } catch (Exception) {
                Debug.Log("_sendTask.Abort failed");
                //throw;
            }
            try {
                _listenTask.Abort();
            } catch (Exception) {
                Debug.Log("_listenTask.Abort failed");
                //throw;
            }
            try {
                _heartbeatTask.Abort();
            } catch (Exception) {
                Debug.Log("_heartbeatTask.Abort failed");
                //throw;
            }
            try {
                udpClient.Close();
            } catch (Exception) {
                Debug.Log("udpClient.Close failed");
                //throw;
            }

            Debug.Log("exit of UDPMultiClientMiddleware");

#if !UNITY_EDITOR && UNITY_METRO
#else
            //_sendTask.Join(500);
            //_listenTask.Join(500);
            //_heartbeatTask.Join(500);
#endif
        }
Esempio n. 7
0
 //Прерывание расчета
 public void BreakCalc()
 {
     Task.Abort();
     if (CommandLog != null)
     {
         AddEvent("Выполнение прервано");
     }
     while (Command != null && Command.Behaviour != CommandBehaviour.SubLog)
     {
         Finish("Выполнение прервано", true);
     }
     if (Command != null)
     {
         Finish("Выполнение прервано", true);
     }
     using (StartAtom(Atom.BreakCalc))
     {
         State            = State.Stopped;
         CalcMode         = "Остановлен";
         IndicatorProcent = 0;
         IndicatorText    = "";
     }
 }
Esempio n. 8
0
        /// <summary>
        /// Shutdown any static connection components
        /// </summary>
        /// <param name="threadShutdownTimeoutMS"></param>
        internal static void Shutdown(int threadShutdownTimeoutMS = 1000)
        {
            try
            {
                StopListening();
            }
            catch (Exception ex)
            {
                LogTools.LogException(ex, "CommsShutdownError");
            }

            try
            {
                shutdownWorkerThreads = true;
#if NETFX_CORE
                if (connectionKeepAliveWorker != null && !connectionKeepAliveWorker.Wait(threadShutdownTimeoutMS))
                {
                    throw new CommsSetupShutdownException("Connection keep alive worker failed to shutdown");
                }
#else
                if (connectionKeepAliveWorker != null && !connectionKeepAliveWorker.Join(threadShutdownTimeoutMS))
                {
                    connectionKeepAliveWorker.Abort();
                }
#endif
            }
            catch (Exception ex)
            {
                LogTools.LogException(ex, "CommsShutdownError");
            }
            finally
            {
                shutdownWorkerThreads = false;
                workedThreadSignal.Reset();
            }
        }
Esempio n. 9
0
 //Прерываение расчета
 public void BreakCalc()
 {
     Task.Abort();
     //if (CommandLog != null)
     //    AddEvent("Выполнение прервано");
     //while (Command != null && Command.Behaviour != CommandBehaviour.SubLog)
     //    Finish("Выполнение прервано", true);
     //if (Command != null) Finish("Выполнение прервано", true);
     try
     {
         using (StartAtom(Atom.BreakCalc))
         {
             State            = State.Stopped;
             CalcMode         = "Остановлен";
             IndicatorProcent = 0;
             IndicatorText    = "";
         }
         if (Form != null)
         {
             Form.Invoke(new FormDelegate(HideForm));
         }
     }
     catch { }
 }