Example #1
0
    /// <summary>
    /// Clone this instance.
    /// </summary>
    public CM_Job Clone()
    {
        var job = new CM_Job(_routineClone.Clone(), id);

        if (jobStarted != null)
        {
            job.jobStarted += jobStarted;
        }

        if (jobPaused != null)
        {
            job.jobPaused += jobPaused;
        }

        if (jobResumed != null)
        {
            job.jobResumed += jobResumed;
        }

        if (jobComplete != null)
        {
            job.jobComplete += jobComplete;
        }

        if (childJobsComplete != null)
        {
            job.childJobsComplete += childJobsComplete;
        }

        if (childJobsStarted != null)
        {
            job.childJobsStarted += childJobsStarted;
        }

        if (jobFinishedRunning != null)
        {
            job.jobFinishedRunning += jobFinishedRunning;
        }

        job.repeating           = repeating;
        job._numOfTimesToRepeat = _numOfTimesToRepeat;

        if (childJobs != null)
        {
            job._childJobs = new List <CM_Job> ();

            foreach (var cj in _childJobs)
            {
                job._childJobs.Add(new CM_Job(_childJobRoutineClones [cj].Clone(), cj.id));
            }
        }

        return(job);
    }
Example #2
0
            public override bool CheckEye(int index, int count, ref IEnumerable <WinFlag> winFlags)
            {
                if (count == 2 && __isCheck)
                {
                    IEnumerator enumerator = __enumerator == null ? null : __enumerator.Clone();
                    if (enumerator != null)
                    {
                        for (int i = 0; i <= index; ++i)
                        {
                            if (!enumerator.MoveNext())
                            {
                                return(false);
                            }
                        }

                        Mahjong.Tile tile = Mahjong.Tile.Get(enumerator.Current);
                        if (tile.number != 1 && tile.number != 4 && tile.number != 7)
                        {
                            return(false);
                        }
                    }

                    __isCheck = false;
                }

                return(base.CheckEye(index, count, ref winFlags));
            }
Example #3
0
            public override bool Check(IEnumerator enumerator, IEnumerable <WinFlag> winFlags, Func <bool, int, int, IEnumerable <WinFlag>, bool> handler)
            {
                __isCheck    = true;
                __enumerator = enumerator.Clone();
                bool result = base.Check(enumerator, winFlags, handler);

                __enumerator = null;

                return(result);
            }
Example #4
0
            public override bool Check(IEnumerator enumerator, ref IEnumerable <WinFlag> winFlags)
            {
                __isCheck    = true;
                __enumerator = enumerator.Clone();
                bool result = base.Check(enumerator, ref winFlags);

                __enumerator = null;

                return(result);
            }
Example #5
0
 private CM_Job(IEnumerator coroutine, string id)
 {
     this.coroutine = coroutine;
     this.id        = id;
     _routineClone  = coroutine.Clone();
 }