예제 #1
0
    private void Awake()
    {
        DontDestroyOnLoad(CM_Dispatcher.instance);
        m_JobMng   = CM_JobManager.Make();
        m_JobQueue = CM_JobQueue.Make();

        (m_Table_Dino = CM_Singleton <Table_Dino> .instance).Load();
        m_Table_Dino.gameObject.transform.parent = transform;

        (m_Table_QRCode = CM_Singleton <Table_QRCode> .instance).Load();
        m_Table_QRCode.gameObject.transform.parent = transform;

        (m_Table_Card = CM_Singleton <Table_Card> .instance).Load();
        m_Table_Card.gameObject.transform.parent = transform;

        (m_Table_Stage = CM_Singleton <Table_Stage> .instance).Load();
        m_Table_Stage.gameObject.transform.parent = transform;

        (m_Table_Deck = CM_Singleton <Table_Deck> .instance).Load();
        m_Table_Deck.gameObject.transform.parent = transform;


        // stage table 의 갯수 만큼 체크
        //m_StageClear.Clear();
        //m_StageClear.Add("stage_1", GetLocalData("stage_1", 0) == 1);
        //m_StageClear.Add("stage_2", GetLocalData("stage_2", 0) == 1);
        //m_StageClear.Add("stage_3", GetLocalData("stage_3", 0) == 1);
    }
예제 #2
0
 /// <summary>
 /// Enqueues jobs to fade in the title, subtitle, and move the instruction text into place.
 /// </summary>
 void Start()
 {
     CM_JobQueue.Make()
     .Enqueue(FadeInText(titleText))
     .Enqueue(FadeInText(subtitleText))
     .Enqueue(MoveText(instructionsText))
     .Start();
 }
    /// <summary>
    /// Creates and starts a queue after a delay of two seconds.
    /// </summary>
    public IEnumerator LocalQueueDelayedStartTest()
    {
        CM_JobQueue.Make()
        .Enqueue(PrintStringAfterDelay("Delayed queue start, job 1"))
        .Enqueue(PrintStringAfterDelay("Delayed queue start, job 2"))
        .Start(2f);

        yield return(null);
    }
예제 #4
0
 /// <summary>
 /// Creates a repeatable queue of jobs that moves the character around the screen.
 /// </summary>
 void Start()
 {
     CM_JobQueue.Make()
     .Enqueue(MoveTo(new Vector2(13f, -10f)))
     .Enqueue(MoveTo(new Vector2(-13f, -10f)))
     .Enqueue(MoveTo(new Vector2(-13f, 10f)))
     .Enqueue(MoveTo(new Vector2(13f, 10f)))
     .Repeat()
     .Start();
 }
    void Start()
    {
        _jobsToQueue = new CM_Job[queueSize];

        for (int i = 0; i < queueSize; i++)
        {
            _jobsToQueue [i] = CM_Job.Make(SmallJobForLargeQueue(i + 1));
        }

        CM_JobQueue.Make().Enqueue(_jobsToQueue).Start();
    }
    /// <summary>
    /// Creates a local queue, starts queue, pauses queue after 1 seconds, and lastly resumes queue after 3 seconds.
    /// </summary>
    public IEnumerator LocalQueueDelayedPauseAndResumeTest()
    {
        CM_JobQueue.Make()
        .Enqueue(PrintStringAfterDelay("Delayed pause and resume test, job one"))
        .Enqueue(PrintStringAfterDelay("Delayed pause and resume test, job two"))
        .Enqueue(PrintStringAfterDelay("Delayed pause and resume test, job three"))
        .Enqueue(PrintStringAfterDelay("Delayed pause and resume test, job four"))
        .Start()
        .Pause(1f)
        .Resume(3f);

        yield return(null);
    }
    /// <summary>
    /// Adds a repeating job to a queue.
    /// Queue will not progress if a repeating job is added until that job is manually killed
    /// or has reached its set number of times to repeat.
    /// </summary>
    public IEnumerator AddRepeatingJobToQueueTest()
    {
        var jobsToQueue = new List <CM_Job> ()
        {
            CM_Job.Make(PrintStringAfterDelay("Repeating job added to queue test, job one")),
            CM_Job.Make(PrintStringAfterDelay("Repeating job added to queue test, job two")).Repeat(5),
            CM_Job.Make(PrintStringAfterDelay("Repeating job added to queue test, , job one"))
        };

        CM_JobQueue.Make()
        .Enqueue(jobsToQueue).Start();

        yield return(null);
    }
예제 #8
0
    // Start is called before the first frame update
    void Start()
    {
        if (CM_Dispatcher.IsDestroyed)
        {
            if (CM_Dispatcher.instance)
            {
                Debug.Log("Make");
            }
        }

        CM_JobQueue.Make()
        .Enqueue(Job())
        .Start();
    }
    /// <summary>
    /// Creates a list of jobs, adds them to a newly created local queue and starts the queue.
    /// </summary>
    public IEnumerator SimpleLocalQueueTest()
    {
        // Creates a list of jobs with three entries.
        var jobsToQueue = new List <CM_Job> ()
        {
            CM_Job.Make(PrintStringAfterDelay("Simple global queue test: job one"), "job_1"),
            CM_Job.Make(PrintStringAfterDelay("Simple global queue test: job two"), "job_2"),
            CM_Job.Make(PrintStringAfterDelay("Simple global queue test: job three"), "job_3")
        };

        CM_JobQueue.Make().Enqueue(jobsToQueue).Start();

        yield return(null);
    }
    /// <summary>
    /// Creates a new local queue, adds a number of test jobs and sets the queue to repeat two times.
    /// </summary>
    public IEnumerator SetNumberRepeatingQueueTest()
    {
        CM_JobQueue.Make()
        .Enqueue(PrintStringAfterDelay("Set number repeating test, job one"))
        .Enqueue(PrintStringAfterDelay("Set number repeating test, job two"))
        .Enqueue(PrintStringAfterDelay("Set number repeating test, job three"))
        .NotifyOnQueueComplete((object sender, CM_QueueEventArgs e) => {
            Debug.Log("Job repeating: " + e.jobQueue.repeating +
                      " num of times repeated: " + e.jobQueue.numOfTimesExecuted);
        })
        .Repeat(2)
        .Start();

        yield return(null);
    }
    /// <summary>
    /// Creates a local queue and then adds it to the glocal queue.
    /// The event subscriptions are also added to the global queue.
    /// </summary>
    public IEnumerator AddLocalQueueToGlobalQueueTest()
    {
        CM_JobQueue localQueue = CM_JobQueue.Make()
                                 .NotifyOnQueueStarted((object sender, CM_QueueEventArgs e) => {
            Debug.Log("Local queue (run in glocal queue) started");
        })
                                 .NotifyOnQueueComplete((object sender, CM_QueueEventArgs e) => {
            Debug.Log("Local queue (run in glocal queue) finished");
        }).Enqueue(PrintStringAfterDelay("Local to global queue test: job one"))
                                 .Enqueue(PrintStringAfterDelay("Local to global queue test: job two"))
                                 .Enqueue(PrintStringAfterDelay("Local to global queue test: job three"));

        CM_JobQueue.Global.Enqueue(localQueue).Start();

        yield return(null);
    }
예제 #12
0
 /// <summary>
 /// Adds each method to a queue to be run in sequene.
 /// </summary>
 void Start()
 {
     CM_JobQueue.Make()
     .Enqueue(SimpleJobTest())
     .Enqueue(JobTestWithDelayedStart())
     .Enqueue(JobTestWithDelayedPause())
     .Enqueue(JobTestWithDelayedResume())
     .Enqueue(JobTestWithDelayedKill())
     .Enqueue(JobTestWithStartAndEndEvents())
     .Enqueue(ChildJobTest())
     .Enqueue(SingleCloneJobTest())
     .Enqueue(MultipleCloneJobTest())
     .Enqueue(InfinitelyRepeatableJobTest())
     .Enqueue(MultipleRepeatableJobTest())
     .Enqueue(MutltipleRepeatableJobTestWithChild())
     .Start();
 }
 /// <summary>
 /// Adds each method to a queue to be run in sequene.
 /// </summary>
 void Start()
 {
     CM_JobQueue.Make()
     .Enqueue(SimpleGlobalQueueTest())
     .Enqueue(SimpleLocalQueueTest())
     .Enqueue(LocalQueueDelayedStartTest())
     .Enqueue(LocalQueueDelayedPauseAndResumeTest())
     .Enqueue(DelayedKillCurrentTest())
     .Enqueue(DelayedKillAllTest())
     .Enqueue(AddLocalQueueToGlobalQueueTest())
     .Enqueue(AddRepeatingJobToQueueTest())
     .Enqueue(SetNumberRepeatingQueueTest())
     .Enqueue(TimedRepeatingQueueTest())
     .Enqueue(ClonedRepeatingQueueTest())
     .Enqueue(MultipleClonedQueueTest())
     .Enqueue(QueueEventTest())
     .Start();
 }
    /// <summary>
    /// Creates a local queue and clones the queue twice.
    /// Both of the cloned queues are then started.
    /// </summary>
    public IEnumerator MultipleClonedQueueTest()
    {
        var origQueue = CM_JobQueue.Make()
                        .Enqueue(PrintStringAfterDelay("Multiple cloned test, job one"))
                        .Enqueue(PrintStringAfterDelay("Multiple cloned test, job two"))
                        .NotifyOnQueueStarted((object sender, CM_QueueEventArgs e) => {
            Debug.Log("Clone Started");
        })
                        .NotifyOnQueueComplete((object sender, CM_QueueEventArgs e) => {
            Debug.Log("Clone Complete");
        });

        var queueClones = origQueue.Clone(2);

        foreach (var clone in queueClones)
        {
            clone.Start();
        }

        yield return(null);
    }
    /// <summary>
    /// Creates a local queue and sets the current job in the queue to be killed after three seconds.
    /// This kills the currently running job but the queue still executes.
    /// </summary>
    public IEnumerator DelayedKillCurrentTest()
    {
        CM_JobQueue.Make()
        .Enqueue(PrintStringAfterDelay("Delayed kill current test, job one"))
        .Enqueue(PrintStringAfterDelay("Delayed kill current test, job two"))
        .Enqueue(PrintStringAfterDelay("Delayed kill current test, job three"))
        .Enqueue(PrintStringAfterDelay("Delayed kill current test, job four"))
        .Enqueue(InfiniteTest("Delayed kill current test"))
        .NotifyOnQueueComplete((object sender, CM_QueueEventArgs e) => {
            if (e.hasCompletedJobs)
            {
                int numOfJobsKilled = e.completedJobs.Where(i => i.jobKilled == true).Count();

                Debug.Log("Number of jobs completed successfully: " + (e.completedJobs.Length - numOfJobsKilled)
                          + ", number of jobs killed: " + numOfJobsKilled);
            }
        })
        .Start()
        .KillCurrent(3f);

        yield return(null);
    }
예제 #16
0
    IEnumerator Step_Duel()
    {
        m_JobQueue_Duel = CM_JobQueue.Make()
                          .Enqueue(Duel_Start())
                          .Enqueue(Duel_WaitInput())
                          .Enqueue(Duel_Fight())
                          .Enqueue(Duel_End())
                          .Repeat()
                          .Start();

        while (true)
        {
            DebugAdd("승패 체크");
            if (m_Turn == 10)
            {
                break;
            }

            yield return(null);
        }

        m_JobQueue_Duel.KillAll();
    }
예제 #17
0
 void Start()
 {
     _actionQueue = CM_JobQueue.Make().ContinousRunning().Start();
 }