private void InternalStop(bool forceStop = false) { IsPlay = false; m_Status = Status.UnAction; if (EndDelegate != null) { EndDelegate(this); } if (PlayTaskQueue != null && PlayTaskQueue.Count > 0) { //remove this first task PlayTaskQueue.RemoveAt(0); } if (forceStop == false) { if (PlayTaskQueue != null && PlayTaskQueue.Count > 0) { PlayTask task = PlayTaskQueue[0]; PlayTaskQueue.RemoveAt(0); InternalPlay(task); } } else { //if true,clear all waitting task PlayTaskQueue.Clear(); } }
public void OnAnimatorPreBegin(GTAnimator animator, PlayTask task) { if (Callback != null) { Callback(MsgType.OnAnimatorPreBegin, animator); } }
static void Main(string[] args) { PlayAsyncAwait.Play(); PlayTask.Play(); PlayTaskPattern.Play(); PlayParallel.Play(); }
void Start() { game = new FourInRowGame(7, 6, 2, 4, this); aICore = new AICore(game, 1000); firstImg.sprite = GameManager.firstPlayerSkin.roundSprite; secondImg.sprite = GameManager.secondPlayerSkin.roundSprite; PrepareScoreSize(firstImg); PrepareScoreSize(secondImg); scoreText.text = game.GetScore(); InitiatePools(); pauseSlider.gameObject.SetActive(!(GameManager.CurrentPlayMode == PlayMode.TwoPlayers)); switch (GameManager.CurrentPlayMode) { case PlayMode.Multiplayer: break; case PlayMode.TwoAI: playTask = BothAIPlayTask; break; case PlayMode.TwoPlayers: playTask = TwoPlayersTask; break; case PlayMode.WithAI: playTask = PlayWithAITask; break; } }
public void Play() { PlayTask task = new PlayTask(); task.PlayAllClip = true; task.PlayMode = PlayMode.Waitting; Play(task); }
public void Play(PlayTask task) { if (task == null) { return; } if (IsPlay && task.PlayMode == PlayMode.DontPlayWhenBusying) { if (task.Handler != null) { task.Handler.OnAnimatorCannotPlay(this); } return; } else if (IsPlay && task.PlayMode == PlayMode.Waitting) { if (SupportQueued == false) { if (task.Handler != null) { task.Handler.OnAnimatorCannotPlay(this); } return; } else { if (PlayTaskQueue == null) { PlayTaskQueue = new List <PlayTask>(); } PlayTaskQueue.Add(task); } } else { PlayTaskQueue.Add(task); if (task.Handler != null) { task.Handler.Animator = this; } if (PreBeginDelegate != null) { PreBeginDelegate(this, task); } if (IsPlay && task.PlayMode == PlayMode.StopPrevious) { Stop(false); } CurrentTime = 0.0f; if (task.PlayAllClip) { WaittingProcessClips = new List <Clip>(Clips); } else { if (task.WannaPlayClips == null || task.WannaPlayClips.Length == 0) { if (task.Handler != null) { task.Handler.OnAnimatorCannotPlay(this); } return; } else { for (int i = 0; i < task.WannaPlayClips.Length; i++) { string clipName = task.WannaPlayClips[i]; if (string.IsNullOrEmpty(clipName)) { continue; } for (int j = 0; j < Clips.Count; j++) { Clip clip = Clips[j]; if (clip == null) { continue; } if (clip.Name == clipName) { if (i == 0) { if (task.PlayImmediately) { CurrentTime = clip.BeginTime; } } WaittingProcessClips.Add(clip); } } } } } m_Status = Status.Action; IsPlay = true; IsPause = false; if (BeginDelegate != null) { BeginDelegate(this); } } }
private void InternalPlay(PlayTask task) { Play(task); }
public PlayTests() { user = new FlyweightUser(); task = new PlayTask(CreateClient(), user); }