示例#1
0
 private void showTask(ClubPenguin.Task.Task task)
 {
     CoinRewardText.text = CoinRewardableDefinition.Coins(task.Definition.Reward).ToString();
     enableCheckMarks();
     showTaskProgress();
     changeState(getStateForTask());
 }
示例#2
0
        private IEnumerator LoadDailyTaskItem(ClubPenguin.Task.Task taskData)
        {
            AssetRequest <GameObject> assetRequest = Content.LoadAsync(taskData.Definition.TaskLogItemContentKey);

            yield return(assetRequest);

            GameObject dailyTaskItemGameObject = Object.Instantiate(assetRequest.Asset);

            dailyTaskItemGameObject.transform.SetParent(ScrollContent, worldPositionStays: false);
            QuestLogDailyTasksItem dailyTaskItem = dailyTaskItemGameObject.GetComponent <QuestLogDailyTasksItem>();

            dailyTaskItem.LoadDailyTaskData(taskData);
        }
示例#3
0
 private void setupTaskCompletion()
 {
     task = getTaskCompletionTask();
     if (task != null)
     {
         showTask(task);
         showMemberStatus();
     }
     else
     {
         Object.Destroy(base.gameObject);
     }
 }
示例#4
0
 private ClubPenguin.Task.Task getTaskCompletionTask()
 {
     ClubPenguin.Task.Task result = null;
     foreach (ClubPenguin.Task.Task task in Service.Get <TaskService>().Tasks)
     {
         if (task.Definition.Category == TaskDefinition.TaskCategory.TaskCompletion)
         {
             result = task;
             break;
         }
     }
     return(result);
 }
示例#5
0
 private bool onCompleteTask(TaskEvents.TaskCompleted evt)
 {
     ClubPenguin.Task.Task task = evt.Task;
     if (task.Definition.Group == TaskDefinition.TaskGroup.Individual)
     {
         Service.Get <ICPSwrveService>().ActionSingular(task.Definition.name, "daily_task.individual." + task.Definition.name, "completion");
     }
     else
     {
         string currentWorldName = getCurrentWorldName();
         Service.Get <ICPSwrveService>().Action(task.Definition.name, "daily_task.community." + task.Definition.name, "completion", currentWorldName);
     }
     return(false);
 }
        private void showTaskData(ClubPenguin.Task.Task taskData)
        {
            XPText.text = "";
            List <MascotXPRewardDefinition> definitions = taskData.Definition.Reward.GetDefinitions <MascotXPRewardDefinition>();

            if (definitions.Count > 0)
            {
                XPText.text = definitions[0].XP.ToString();
            }
            CoinsText.text          = CoinRewardableDefinition.Coins(taskData.Definition.Reward).ToString();
            DescriptionText.text    = taskData.Definition.Description;
            InventoryText.text      = taskData.Counter + "/" + taskData.Definition.Threshold;
            CompletedImage.enabled  = taskData.IsComplete;
            MemberOnlyImage.enabled = false;
        }
示例#7
0
        private bool onUpdateTask(TaskEvents.TaskUpdated evt)
        {
            ClubPenguin.Task.Task task = evt.Task;
            string callID = $"{task.Definition.name}_{task.Counter}";

            if (task.Definition.Group != 0)
            {
                string currentWorldName = getCurrentWorldName();
                Service.Get <ICPSwrveService>().ActionSingular(callID, "daily_task.community." + task.Definition.name, $"{task.Counter}/{task.Definition.Threshold}", currentWorldName);
            }
            else if (task.Definition.Group == TaskDefinition.TaskGroup.Individual)
            {
                Service.Get <ICPSwrveService>().ActionSingular(callID, "daily_task.individual." + task.Definition.name, $"{task.Counter}/{task.Definition.Threshold}");
            }
            return(false);
        }
示例#8
0
        private IEnumerator showNotification(ClubPenguin.Task.Task task)
        {
            yield return(new WaitForSeconds(1.3f));

            if (!tasksAlreadyShown.Contains(task.Id))
            {
                tasksAlreadyShown.Add(task.Id);
                DNotification dNotification = new DNotification();
                dNotification.PopUpDelayTime = 3.7f;
                dNotification.DataPayload    = task;
                dNotification.PrefabLocation = TrayNotificationManager.CellPhoneDailyNotificationContentKey;
                dNotification.Message        = Service.Get <Localizer>().GetTokenTranslation(task.Definition.CompletionMessage);
                dNotification.Type           = DNotification.NotificationType.DailyComplete;
                trayNotificationManager.ShowNotification(dNotification);
            }
        }
示例#9
0
 public override void Show(DNotification data)
 {
     base.Show(data);
     ClubPenguin.Task.Task task = (ClubPenguin.Task.Task)data.DataPayload;
     if (task != null)
     {
         string subGroupByTaskName = Service.Get <TaskService>().GetSubGroupByTaskName(task.Id);
         Mascot mascot             = Service.Get <MascotService>().GetMascot(subGroupByTaskName);
         MascotImage.color = mascot.Definition.NavigationArrowColor;
         if (ParticlesToTint != null)
         {
             ParticlesToTint.SetStartColor(mascot.Definition.NavigationArrowColor);
         }
         messageWithoutButtons.color = mascot.Definition.NavigationArrowColor;
         if (data.Type == DNotification.NotificationType.DailyComplete)
         {
             DailyChallengesListItem.ClaimDailyTaskReward(task);
         }
     }
 }
        private IEnumerator loadNewDailyItem(ClubPenguin.Task.Task task, ScrollDirection addDirection, int aheadCount)
        {
            AssetRequest <GameObject> request;

            if (task.Definition.DailyChallengeItemContentKey != null && !string.IsNullOrEmpty(task.Definition.DailyChallengeItemContentKey.Key))
            {
                request = Content.LoadAsync(task.Definition.DailyChallengeItemContentKey);
            }
            else
            {
                string subGroupByTaskName = Service.Get <TaskService>().GetSubGroupByTaskName(task.Id);
                request = Content.LoadAsync(itemPrefabContentKey, subGroupByTaskName);
            }
            yield return(request);

            GameObject dailyObject = Object.Instantiate(request.Asset, ContentPanel, worldPositionStays: false);

            dailyObject.GetComponent <DailyChallengesListItem>().Init(task);
            yield return(new WaitForEndOfFrame());

            addItem(dailyObject, addDirection, aheadCount);
        }
 public void ClaimTaskReward(ClubPenguin.Task.Task task)
 {
     Service.Get <INetworkServicesManager>().TaskService.ClaimReward(task.Id);
     taskService.SetRewardClaimed(task);
 }
 public void LoadDailyTaskData(ClubPenguin.Task.Task taskData)
 {
     this.taskData = taskData;
     showTaskData(taskData);
     Service.Get <EventDispatcher>().AddListener <TaskEvents.TaskUpdated>(onTaskUpdated);
 }