public static void StartTaskRestoration(ITaskCard card, int days) { if (card.State == TaskCardStates.Executed) { DayTimer dt = DayTimeSystem.CreateDayTimer(days); dt.AddTimerFinishedListener(card.Restore); dt.StartTimer(); } }
public static void StartTaskExecuting(ITaskCard card, int days) { if (card.State == TaskCardStates.Standalone) { DayTimer dt = DayTimeSystem.CreateDayTimer(days); card.State = TaskCardStates.Executing; dt.AddTimerFinishedListener(card.Execute); dt.StartTimer(); } }
public void AddTaskCard(GameObject card, ICard cardData) { ITaskCard taskCard = cardData as ITaskCard; TaskCardFormatter cf = card.GetComponent <TaskCardFormatter>(); if (cf == null || taskCard == null) { return; } int price = ConverterController.Evaluation.GetTaskPrice(taskCard.Task.Data.BaseReward); cardsPrices[cardData] = price; cf.ActivateCardPricing(price); }
public void AddTask(ICard card) { ITaskCard taskCard = card as ITaskCard; if (taskCard == null) { return; } GameObject obj = cardPlace.AddCard(card); TaskCardFormatter cf = obj.GetComponent <TaskCardFormatter>(); if (cf != null) { int price = ConverterController.Evaluation.GetTaskPrice(taskCard.Task.Data.BaseReward); cardsPrices[card] = price; cf.ActivateCardPricing(price); } }
private void OnTaskCardAdded(MonitoredStorage storage, GameObject card, ICard cardData) { ITaskCard taskCard = cardData as ITaskCard; TaskCardFormatter cf = card.GetComponent <TaskCardFormatter>(); if (cf == null || taskCard == null) { return; } int time = storage.Days; cf.ActivateCardRemainTime(time); DayTimer dt = DayTimeSystem.CreateDayTimer(time); dt.AddNewDayListener(cf.UpdateCardRemainTime); dt.AddTimerFinishedListener(cf.DeactivateCardRemainTime); dt.AddTimerFinishedListener(() => storage.Storage.RemoveCard(cardData)); dt.AddTimerFinishedListener(() => storage.OnExpired.Invoke(taskCard)); storage.Timers[cardData] = dt; dt.StartTimer(); }
public void ActivateTaskProcessing(ITaskCard cardData, Department dep) { _processData = new TaskProcessData(); _processData.task = cardData; _processData.department = dep; _departmentParameter = dep.Designation; window.Reset(); window.OnCardSelection += UpdateSelectedSum; window.SetProcessData(dep.DepBaseData.fullName, dep.Designation.value, cardData.Task.Data.Name, cardData.Task.Data.Description, cardData.Task.GetNeed()); Dictionary <CardType, List <ICard> > winRes = new Dictionary <CardType, List <ICard> >(); foreach (CardType type in window.GetResourcesTypes()) { winRes[type] = dep.GetAvailableResourcesCardsByType(type); } window.SetResources(winRes); window.Active = true; ToShowWindow.RaiseEvent(window); }
public void ProcessTaskPenalty(ITaskCard task) { int penalty = ConverterController.Evaluation.GetTaskExpiringPenalty(task.Task.Data.BaseReward); _changePointsChannel.RaiseEvent(-1 * penalty); }