Beispiel #1
0
    private void SetRewards(ChongWuRenWuPinZhi dataRWPZ, PetTaskInfo pti)
    {
        this.m_lblTaskReward.set_text(string.Empty);
        if (dataRWPZ.drop.get_Count() > 0)
        {
            int  templateId = 0;
            long dropNum    = DropUtil.GetDropNum(dataRWPZ.drop.get_Item(0), EntityWorld.Instance.EntSelf.Lv, ref templateId);
            this.m_lblTaskReward.set_text(string.Format("奖励: 人物经验+{0}", Utils.GetItemNum(templateId, dropNum)));
        }
        List <int>  itemIds  = new List <int>();
        List <long> itemNums = new List <long>();

        if (pti.rewards.get_Count() > 0)
        {
            this.m_itemId = pti.rewards.get_Item(0).cfgId;
            itemIds.Add(pti.rewards.get_Item(0).cfgId);
            itemNums.Add(pti.rewards.get_Item(0).count);
        }
        this.mItemListPool.Create(itemIds.get_Count(), delegate(int index)
        {
            if (index < this.mItemListPool.Items.get_Count() && index < itemIds.get_Count() && index < itemNums.get_Count())
            {
                ItemShow.SetItem(this.mItemListPool.Items.get_Item(index), itemIds.get_Item(index), itemNums.get_Item(index), false, UINodesManager.T2RootOfSpecial, 14000);
            }
        });
    }
    private int CalSuccessRate(PetTaskInfo pti)
    {
        ChongWuRenWuPinZhi chongWuRenWuPinZhi = DataReader <ChongWuRenWuPinZhi> .Get(pti.taskId);

        if (chongWuRenWuPinZhi == null)
        {
            Debug.LogError("GameData.ChongWuRenWuPeiZhi no exist, id = " + pti.taskId);
            return(0);
        }
        int num = 0;

        for (int i = 0; i < this.m_petIds.get_Count(); i++)
        {
            if (pti.petId.Contains(this.m_petIds.get_Item(i)))
            {
                PetInfo petInfoById = PetManager.Instance.GetPetInfoById(this.m_petIds.get_Item(i));
                int     num2        = this.rate_arg_base + (petInfoById.star - chongWuRenWuPinZhi.petquality) * this.rate_arg_quality;
                num += Mathf.Max(num2, this.rate_arg_basefit);
            }
            else
            {
                num += this.rate_arg_nofit;
            }
        }
        return(Mathf.Clamp(num, 0, this.rate_arg_limit));
    }
Beispiel #3
0
 public void RefreshTime(ChongWuRenWuPinZhi dataRWPZ)
 {
     if (this.m_pti == null)
     {
         return;
     }
     if (this.m_pti.Status == PetTaskInfo.PetTaskStatus.UnPickUp)
     {
         if (dataRWPZ != null)
         {
             this.m_lblTaskName.set_text(GameDataUtils.GetChineseContent(this.m_pti.taskName, false) + "(" + TimeConverter.GetTime(dataRWPZ.time, TimeFormat.HHMM_Chinese_MNoZero) + ")");
         }
         return;
     }
     if (this.m_pti.Status == PetTaskInfo.PetTaskStatus.undone)
     {
         int remainSecond = TimeManager.Instance.GetRemainSecond(this.m_pti.times);
         if (remainSecond > 0)
         {
             this.m_lblTaskName.set_text(GameDataUtils.GetChineseContent(this.m_pti.taskName, false) + "(剩余" + TimeConverter.GetTime(remainSecond, TimeFormat.HHMM_Chinese) + ")");
             return;
         }
     }
     this.m_lblTaskName.set_text(GameDataUtils.GetChineseContent(this.m_pti.taskName, false));
 }
Beispiel #4
0
    public void Refresh(PetTaskInfo pti)
    {
        this.m_pti     = pti;
        this.m_taskuid = pti.idx;
        if (EntityWorld.Instance.EntSelf == null)
        {
            return;
        }
        if (this.m_pti == null)
        {
            return;
        }
        ChongWuRenWuPinZhi chongWuRenWuPinZhi = DataReader <ChongWuRenWuPinZhi> .Get(pti.taskId);

        if (chongWuRenWuPinZhi == null)
        {
            Debug.LogError("GameData.ChongWuRenWuPinZhi no exist, id = " + pti.taskId);
            return;
        }
        base.get_transform().set_name(pti.taskId + "_quality" + chongWuRenWuPinZhi.petquality);
        if (this.m_goButtonOK != null)
        {
            this.m_goButtonOK.SetActive(pti.Status == PetTaskInfo.PetTaskStatus.UnPickUp);
        }
        if (this.m_goButtonReward != null)
        {
            this.m_goButtonReward.SetActive(pti.Status == PetTaskInfo.PetTaskStatus.achieve);
        }
        if (this.m_spStatusIcon != null)
        {
            if (pti.Status == PetTaskInfo.PetTaskStatus.undone)
            {
                this.m_spStatusIcon.get_gameObject().SetActive(true);
                ResourceManager.SetIconSprite(this.m_spStatusIcon, "yinzhang_2");
                this.m_spStatusIcon.get_transform().set_localScale(Vector3.get_one());
                this.m_spStatusIcon.SetNativeSize();
            }
            else if (pti.Status == PetTaskInfo.PetTaskStatus.receive)
            {
                this.m_spStatusIcon.get_gameObject().SetActive(true);
                ResourceManager.SetIconSprite(this.m_spStatusIcon, "font_yiwancheng");
                this.m_spStatusIcon.get_transform().set_localScale(Vector3.get_one() * 0.8f);
                this.m_spStatusIcon.SetNativeSize();
            }
            else
            {
                this.m_spStatusIcon.get_gameObject().SetActive(false);
            }
        }
        ResourceManager.SetIconSprite(this.m_spQualityIcon, chongWuRenWuPinZhi.art);
        this.RefreshTime(chongWuRenWuPinZhi);
        this.SetRewards(chongWuRenWuPinZhi, pti);
    }
    public void RefreshUI(long taskuid, int itemId)
    {
        this.m_taskuid = taskuid;
        if (this.m_goRewardItemCache == null)
        {
            ItemShow.ShowItem(this.m_goRewardItem.get_transform(), itemId, -1L, false, null, 2001);
        }
        else
        {
            ItemShow.SetItem(this.m_goRewardItemCache, itemId, -1L, false, null, 2001);
        }
        this.mFormationItemListPool.Create(3, delegate(int index)
        {
            if (index < this.mFormationItemListPool.Items.get_Count())
            {
                PetFormationPet component = this.mFormationItemListPool.Items.get_Item(index).GetComponent <PetFormationPet>();
                component.SetItem(null, null, false);
            }
        });
        PetTaskInfo pti = PetTaskManager.Instance.GetPetTaskInfo(taskuid);

        if (pti == null)
        {
            Debug.LogError("PetTaskInfo no exist, uid = " + taskuid);
            return;
        }
        ChongWuRenWuPinZhi chongWuRenWuPinZhi = DataReader <ChongWuRenWuPinZhi> .Get(pti.taskId);

        if (chongWuRenWuPinZhi == null)
        {
            Debug.LogError("GameData.ChongWuRenWuPeiZhi no exist, id = " + pti.taskId);
            return;
        }
        this.m_lblTaskTitle.set_text(GameDataUtils.GetChineseContent(pti.taskName, false) + "    任务时间: " + TimeConverter.GetTime(chongWuRenWuPinZhi.time, TimeFormat.HHMM_Chinese_MNoZero));
        this.m_task_quality = chongWuRenWuPinZhi.petquality;
        this.mInfoItemListPool.Create(6, delegate(int index)
        {
            if (index < this.mInfoItemListPool.Items.get_Count())
            {
                PTF_InfoItem component = this.mInfoItemListPool.Items.get_Item(index).GetComponent <PTF_InfoItem>();
                if (index < 3 && index < pti.monsterId.get_Count())
                {
                    component.SetItemToMonster(pti.monsterId.get_Item(index));
                }
                else if (index < 6 && index - 3 < pti.petId.get_Count())
                {
                    component.SetItemToPet(pti.petId.get_Item(index - 3), 1);
                }
            }
        });
    }