Exemplo n.º 1
0
    private void OnUpdateUIGrid(UIGridBase grid, int index)
    {
        if (null != m_list_taskInfos && m_list_taskInfos.Count > index)
        {
            uint           id           = m_list_taskInfos[index];
            UIClanTaskGrid clanTaskGrid = grid as UIClanTaskGrid;
            if (clanTaskGrid != null)
            {
                ClanManger.ClanQuestInfo info = DataManager.Manager <ClanManger>().GetClanQuestInfo(id);

                clanTaskGrid.SetGridData(DataManager.Manager <ClanManger>().GetClanQuestInfo(id));
            }
        }
        else
        {
            Engine.Utility.Log.Error("ClanTask OnUpdateUIGrid error");
        }
    }
Exemplo n.º 2
0
    public override void SetGridData(object data)
    {
        base.SetGridData(data);
        if (null == data || !(data is ClanManger.ClanQuestInfo))
        {
            Engine.Utility.Log.Error("UIClanTaskGrid->SetGridData null");
            return;
        }
        this.questInfo = data as ClanManger.ClanQuestInfo;
        if (null != m_lab_des)
        {
            //             m_lab_des.Clear();
            //             m_lab_des.fontSize = 24;
            //             m_lab_des.AddXml(RichXmlHelper.RichXmlAdapt(questInfo.Des));
            //            Debug.Log(questInfo.Des);
        }
        if (null != m_typeLabel)
        {
            m_typeLabel.text = this.questInfo.TaskName;
            //if (questInfo.taskChildType == GameCmd.TaskChildType.TaskChildType_Collection)
            //{
            //    m_typeLabel.text = "采集物品";
            //}
            //else if (questInfo.taskChildType == GameCmd.TaskChildType.TaskChildType_SubmitItem)
            //{
            //    m_typeLabel.text = "上交物品";
            //}
            //else if (questInfo.taskChildType == GameCmd.TaskChildType.TaskChildType_KillMaster)
            //{
            //    m_typeLabel.text = "击杀怪物";
            //}
        }
        bool cansee = false;

        cansee = (questInfo.TaskStatus == GameCmd.TaskProcess.TaskProcess_None);

        /*if (null != m_lab_times)
         * {
         *  if (m_lab_times.gameObject.activeSelf != cansee)
         *  {
         *      m_lab_times.gameObject.SetActive(cansee);
         *  }
         *  if (cansee)
         *  {
         *      ColorType c = ColorType.Green;
         *      if (questInfo.LeftTimes == 0)
         *      {
         *          c = ColorType.Red;
         *      }
         *      m_lab_times.text = DataManager.Manager<TextManager>().GetLocalFormatText(
         *          LocalTextType.Local_TXT_TodayCompleteLimit, ColorManager.GetColorString(c, questInfo.LeftTimes.ToString()));
         *  }
         *  if (m_sprite_star != null)
         *  {
         *      CreateEffect();
         *      m_sprite_star.fillAmount = (5 - questInfo.LeftTimes) * 1f / 5;
         *  }
         *
         * }*/

        if (null != m_obj_accept)
        {
            cansee = (questInfo.TaskStatus == GameCmd.TaskProcess.TaskProcess_None);
            m_obj_accept.SetActive(cansee);
            if (cansee)
            {
                m_obj_accept.GetComponent <UIButton>().isEnabled = (questInfo.LeftTimes > 0);
            }
        }
        if (null != m_obj_inProgress)
        {
            cansee = (questInfo.TaskStatus == GameCmd.TaskProcess.TaskProcess_Doing);
            m_obj_inProgress.SetActive(cansee);
        }
        if (null != m_obj_submit)
        {
            cansee = (questInfo.TaskStatus == GameCmd.TaskProcess.TaskProcess_CanDone);
            m_obj_submit.SetActive(cansee);
        }
        if (null != m_lab_reward)
        {
            string        rewardformat = "{0}:+{1}";
            uint          num          = 0;
            string        rewardName   = "";
            StringBuilder builder      = new StringBuilder();
            //文钱
            if (questInfo.AwardMoney > 0)
            {
                rewardName = "绑元";
                num        = questInfo.AwardMoney;
                builder.Append(string.Format(rewardformat, rewardName, num * this.questInfo.RewardMultiple));
            }
            //金币
            if (questInfo.AwardGold > 0)
            {
                if (!string.IsNullOrEmpty(builder.ToString()))
                {
                    builder.Append("   ");
                }
                rewardName = "金币";
                num        = questInfo.AwardGold;
                builder.Append(string.Format(rewardformat, rewardName, num * this.questInfo.RewardMultiple));
            }
            //声望
            if (questInfo.AwardRep > 0)
            {
                if (!string.IsNullOrEmpty(builder.ToString()))
                {
                    builder.Append("   ");
                }
                rewardName = "声望";
                num        = questInfo.AwardRep;
                builder.Append(string.Format(rewardformat, rewardName, num * this.questInfo.RewardMultiple));
            }
            //族贡
            if (questInfo.AwardZG > 0)
            {
                if (!string.IsNullOrEmpty(builder.ToString()))
                {
                    builder.Append("   ");
                }
                rewardName = "建设度";
                num        = questInfo.AwardZG;
                builder.Append(string.Format(rewardformat, rewardName, num * this.questInfo.RewardMultiple));
            }
            //资金
            if (questInfo.AwardZJ > 0)
            {
                if (!string.IsNullOrEmpty(builder.ToString()))
                {
                    builder.Append("   ");
                }
                rewardName = "资金";
                num        = questInfo.AwardZJ;
                builder.Append(string.Format(rewardformat, rewardName, num * this.questInfo.RewardMultiple));
            }

            //经验
            if (questInfo.AwardExp > 0)
            {
                if (!string.IsNullOrEmpty(builder.ToString()))
                {
                    builder.Append("   ");
                }
                rewardName = "经验";
                num        = questInfo.AwardExp;
                builder.Append(string.Format(rewardformat, rewardName, num * this.questInfo.RewardMultiple));
            }

            //神魔经验
            if (questInfo.AwardDevExp > 0)
            {
                if (!string.IsNullOrEmpty(builder.ToString()))
                {
                    builder.Append("   ");
                }
                rewardName = "神魔经验";
                num        = questInfo.AwardDevExp;
                builder.Append(string.Format(rewardformat, rewardName, num * this.questInfo.RewardMultiple));
            }

            //物品
            if (null != questInfo && null != questInfo.AwardItems &&
                questInfo.AwardItems.Count > 0)
            {
                BaseItem baseItem = null;
                for (int i = 0; i < questInfo.AwardItems.Count; i++)
                {
                    if (!string.IsNullOrEmpty(builder.ToString()))
                    {
                        builder.Append("   ");
                    }
                    baseItem   = DataManager.Manager <ItemManager>().GetTempBaseItemByBaseID <BaseItem>(questInfo.AwardItems[i]);
                    num        = (null != questInfo.AwardNums && questInfo.AwardNums.Count > i) ? questInfo.AwardNums[i] : 0;
                    rewardName = baseItem.LocalName;
                    builder.Append(string.Format(rewardformat, rewardName, num * this.questInfo.RewardMultiple));
                }
            }
            m_lab_reward.text = builder.ToString();
        }

        string countStr = string.Format("{0}/{1}", this.questInfo.FinishNum, this.questInfo.ClanTaskStepNum);  //this.questInfo

        SetCount(countStr);

        float slider = this.questInfo.FinishNum / (float)this.questInfo.ClanTaskStepNum;

        SetSlider(slider);

        SetRewardMultiple(this.questInfo.RewardMultiple);

        m_sprite_star.fillAmount = questInfo.Star * 1f / 5;    //改为难度

        SetBtn();
    }