Ejemplo n.º 1
0
        private List <RewardWrapper> GetCompleteTaskDropItem()
        {
            rewardCash          = 0;
            rewardCoin          = 0;
            rewardExp           = 0;
            rewardVit           = 0;
            m_title_txt.Visible = false;
            List <RewardWrapper> task_rewards = new List <RewardWrapper>();

            for (int i = 0; i < m_taskInfo.RewardList.Count; ++i)
            {
                TaskRewardBase taskReward     = m_taskInfo.RewardList[i];
                TaskRewardMode taskRewardType = (taskReward.GetType().GetCustomAttributes(typeof(TaskRewardAttribute), true)[0] as TaskRewardAttribute).RewardMode;
                switch (taskRewardType)
                {
                case TaskRewardMode.ITEM:
                    TaskRewardItem rewardItem = taskReward as TaskRewardItem;
                    if (rewardItem.RewardData != null)
                    {
                        task_rewards.Add(GetRewardWrapperByTaskRewardData(rewardItem.RewardData));
                    }
                    break;

                case TaskRewardMode.TITLE:
                    TaskRewardTitle rewardTitle = taskReward as TaskRewardTitle;
                    m_titleGet.Visible = rewardTitle.RewardData > 0;
                    ShowTaskTitle(rewardTitle.RewardData);
                    break;
                }
            }
            return(task_rewards);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 交任务相应
        /// </summary>
        /// <param name="message"></param>
        private void OnCommitTask(object message)
        {
            SCTaskCommitResponse msg = message as SCTaskCommitResponse;

            if (!MsgStatusCodeUtil.OnError(msg.Result))
            {
                TaskBase commitTaskInfo = this.m_playerTaskSet.GetTaskById(msg.TaskId);
                if (commitTaskInfo == null)
                {
                    Debug.LogError($"commit task :{msg.TaskId} not found");
                }
                GameEvents.TaskEvents.OnReceiveTask.SafeInvoke(commitTaskInfo);

                GameEvents.PlayerEvents.OnExpChanged.SafeInvoke(null, msg.Exp);

                commitTaskInfo.TaskCurrentStatus = TaskStatus.REWARDED;
                commitTaskInfo.TaskSyncStatus    = TaskSyncStatus.SYNCED;

                if (this.m_currentTaskList.Contains(commitTaskInfo))
                {
                    this.m_currentTaskList.Remove(commitTaskInfo);
                }

                //同步玩家最新信息
                GameEvents.PlayerEvents.RequestLatestPlayerInfo.SafeInvoke();

                //同步背包
                //GlobalInfo.MY_PLAYER_INFO.SyncPlayerBag();
                NormalTask taskInfo = commitTaskInfo as NormalTask;
                for (int i = 0; i < taskInfo.RewardList.Count; ++i)
                {
                    TaskRewardBase taskReward     = taskInfo.RewardList[i];
                    TaskRewardMode taskRewardType = (taskReward.GetType().GetCustomAttributes(typeof(TaskRewardAttribute), true)[0] as TaskRewardAttribute).RewardMode;

                    if (TaskRewardMode.ITEM == taskRewardType)
                    {
                        TaskRewardItem     rewardItem     = taskReward as TaskRewardItem;
                        RewardItemDataWrap rewardItemData = rewardItem.RewardData;

                        if (RewardItemType.ITEM == rewardItemData.ItemType)
                        {
                            GlobalInfo.MY_PLAYER_INFO.AddSingleBagInfo(rewardItemData.ItemID, rewardItemData.ItemNum);
                        }
                    }
                }

                GameEvents.UIEvents.UI_GameEntry_Event.Listen_OnCombinePropCollected.SafeInvoke();
                //>

                BigWorldManager.Instance.EnterBigWorld();
                GameEvents.TaskEvents.OnCompletedTask.SafeInvoke(msg.Result, commitTaskInfo);

                HttpPingModule.Instance.SendPing();

                //TODO : 放在主界面onshow
                //if (C_FIRST_TASK_ID == commitTaskInfo.TaskConfID)
                //{
                //    SignInManager sm = new SignInManager();
                //}
            }
            else
            {
                GameEvents.TaskEvents.OnSyncedTaskList.SafeInvoke(1);
            }
        }