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));
    }
Esempio n. 2
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);
            }
        });
    }
    public bool IsRecommend(int petId)
    {
        PetTaskInfo petTaskInfo = PetTaskManager.Instance.GetPetTaskInfo(this.m_taskuid);

        if (petTaskInfo == null)
        {
            Debug.LogError("PetTaskInfo no exist, uid = " + this.m_taskuid);
            return(false);
        }
        return(petTaskInfo.petId.Contains(petId));
    }
Esempio n. 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);
    }
Esempio n. 5
0
 public bool IsInFormation(int petId)
 {
     for (int i = 0; i < this.m_listPetTaskInfo.get_Count(); i++)
     {
         PetTaskInfo petTaskInfo = this.m_listPetTaskInfo.get_Item(i);
         if (petTaskInfo.Status == PetTaskInfo.PetTaskStatus.undone && petTaskInfo.choosePets.Contains(petId))
         {
             return(true);
         }
     }
     return(false);
 }
    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);
                }
            }
        });
    }
    public void SendPetFormation(List <long> listPets)
    {
        UIManagerControl.Instance.HideUI("PetSelectUI");
        this.m_petIds.Clear();
        for (int i = 0; i < listPets.get_Count(); i++)
        {
            PetInfo petInfo = PetManager.Instance.GetPetInfo(listPets.get_Item(i));
            if (petInfo != null)
            {
                this.m_petIds.Add(petInfo.petId);
            }
        }
        for (int j = 3; j < this.mInfoItemListPool.Items.get_Count(); j++)
        {
            PTF_InfoItem component = this.mInfoItemListPool.Items.get_Item(j).GetComponent <PTF_InfoItem>();
            component.SetMatch(this.m_petIds.Contains(component.m_petId));
        }
        PetTaskInfo petTaskInfo = PetTaskManager.Instance.GetPetTaskInfo(this.m_taskuid);

        if (petTaskInfo == null)
        {
            return;
        }
        int num = this.CalSuccessRate(petTaskInfo);

        this.m_lblSuccessRate.set_text(string.Format("成功率: {0}%", num));
        for (int k = 0; k < this.mFormationItemListPool.Items.get_Count(); k++)
        {
            if (k < this.m_petIds.get_Count())
            {
                Pet dataPet = DataReader <Pet> .Get(this.m_petIds.get_Item(k));

                PetInfo         petInfoById = PetManager.Instance.GetPetInfoById(this.m_petIds.get_Item(k));
                PetFormationPet component2  = this.mFormationItemListPool.Items.get_Item(k).GetComponent <PetFormationPet>();
                if (component2 != null)
                {
                    component2.SetItem(petInfoById, dataPet, false);
                }
            }
            else
            {
                PetFormationPet component3 = this.mFormationItemListPool.Items.get_Item(k).GetComponent <PetFormationPet>();
                if (component3 != null)
                {
                    component3.SetItem(null, null, false);
                }
            }
        }
    }
Esempio n. 8
0
 private void UpdatePetTaskInfo(PetTaskInfo pti)
 {
     for (int i = 0; i < this.m_listPetTaskInfo.get_Count(); i++)
     {
         if (this.m_listPetTaskInfo.get_Item(i).idx == pti.idx)
         {
             this.m_listPetTaskInfo.set_Item(i, pti);
             break;
         }
     }
     if (UIManagerControl.Instance.IsOpen("PetTaskUI"))
     {
         PetTaskUIView.Instance.RefreshUI();
     }
 }
Esempio n. 9
0
 private void AddPetTaskInfo(PetTaskInfo pti)
 {
     if (pti == null)
     {
         return;
     }
     for (int i = 0; i < this.m_listPetTaskInfo.get_Count(); i++)
     {
         PetTaskInfo petTaskInfo = this.m_listPetTaskInfo.get_Item(i);
         if (petTaskInfo.idx == pti.idx)
         {
             Debug.LogError("宠物任务重复下发, idx = " + pti.idx);
             this.m_listPetTaskInfo.RemoveAt(i);
             break;
         }
     }
     this.m_listPetTaskInfo.Add(pti);
 }
Esempio n. 10
0
 public void CheckTaskIsAchieve(bool isOpen)
 {
     if (isOpen)
     {
         this.IsCheckTaskIsAchieve = true;
     }
     if (!this.IsCheckTaskIsAchieve)
     {
         return;
     }
     for (int i = 0; i < this.m_listPetTaskInfo.get_Count(); i++)
     {
         PetTaskInfo petTaskInfo = this.m_listPetTaskInfo.get_Item(i);
         if (petTaskInfo.Status == PetTaskInfo.PetTaskStatus.achieve)
         {
             this.SendGetPetTaskReward(petTaskInfo.idx);
             return;
         }
     }
     this.IsCheckTaskIsAchieve = false;
 }