private void Update(OddJob oddJob) { var idx = OddJobs.FindIndex(o => o.id == oddJob.id); if (idx >= 0) { OddJobs[idx] = oddJob; } else { OddJobs.Add(oddJob); } }
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); }
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>(); } }