예제 #1
0
        private void Update(OddJob oddJob)
        {
            var idx = OddJobs.FindIndex(o => o.id == oddJob.id);

            if (idx >= 0)
            {
                OddJobs[idx] = oddJob;
            }
            else
            {
                OddJobs.Add(oddJob);
            }
        }
예제 #2
0
        public bool HasClaimableActivity()
        {
            if (OddJobs.Exists(o => o.jobAmountDone >= o.jobAmount))
            {
                return(true);
            }

            for (var i = 1; i <= DailyActivity.today; i++)
            {
                if (DailyActivity.Claimable(i))
                {
                    return(true);
                }
            }

            return(false);
        }
예제 #3
0
        private void Consume(PlayerActionResponse data)
        {
            var needSignal = false;

            if (data.oddJobs != null)
            {
                needSignal = true;
                if (OddJobs == null)
                {
                    OddJobs = data.oddJobs;
                }
                else
                {
                    foreach (var oddJob in data.oddJobs)
                    {
                        Update(oddJob);
                    }
                }
            }

            if (data.oddJobDone != null)
            {
                needSignal = true;
                var idx = OddJobs.FindIndex(o => o.id == data.oddJobDone);
                if (idx >= 0)
                {
                    OddJobs.RemoveAt(idx);
                }
            }

            if (data.dailyActivity != null)
            {
                needSignal    = true;
                DailyActivity = data.dailyActivity;
            }

            if (needSignal)
            {
                signalBus.Fire <ActivitySignal>();
            }
        }