Exemple #1
0
 private void UpdateTasksTab()
 {
     tasks.ForEach(Destroy);
     tasks.Clear();
     foreach (TaskCategory taskCategory in Enum.GetValues(typeof(TaskCategory)))
     {
         var taskCategoryName = Instantiate(taskCategoryPrefab, tasksCanvas);
         taskCategoryName.SetCategory(taskCategory);
         tasks.Add(taskCategoryName.gameObject);
         foreach (var taskCluster in tasksService.TaskClusters.Where(t => t.category == taskCategory))
         {
             var task     = GetTask(taskCluster);
             var taskView = Instantiate(taskPrefab, tasksCanvas);
             taskView.SetTask(taskCluster, task, tasksService.AchievementAmount(task.taskType));
             taskView.OnClaim(() =>
             {
                 tasksService.ClaimTask(taskCluster, data =>
                 {
                     if (data.looted != null)
                     {
                         var lootedPopup = popupCanvasController.OpenPopup(lootedPrefab);
                         lootedPopup.SetLooted(data.looted);
                     }
                 });
             });
             tasks.Add(taskView.gameObject);
         }
     }
 }