Exemplo n.º 1
0
        public void Update(CombatGameCenter.Quest quest, Int32 runTime)
        {
            txtQuestName.text = quest.name;
            txtTotalTime.text = String.Format("{0}秒", quest.processSecond);
            txtRunTime.text   = String.Format("{0}秒", runTime);

            Int32 matCount = quest.materials.Count;

            if (m_BlkMats.Count < matCount)
            {
                Int32 size = matCount - m_BlkMats.Count;
                for (int i = 0; i < size; i++)
                {
                    var go = Instantiate(pfbQuestMat, materialRoot);
                    m_BlkMats.Add(go);
                }
            }

            for (int i = 0; i < m_BlkMats.Count; i++)
            {
                m_BlkMats[i].SetActive(i < matCount);
            }

            for (int i = 0; i < matCount; i++)
            {
                var  questMat = quest.materials[i];
                var  root     = m_BlkMats[i].transform;
                Text txtName  = root.Find("TxtName").GetComponent <Text>();
                Text txtCount = root.Find("TxtCount").GetComponent <Text>();

                txtName.text  = questMat.name;
                txtCount.text = String.Format("{0} / {1}", 0, questMat.count);
            }
        }
Exemplo n.º 2
0
 private void ResetQuestInformationView(CombatGameCenter.Quest quest)
 {
     m_ViewInformation.SetName(quest.name);
     m_ViewInformation.SetMaterials(quest.materials);
     m_ViewInformation.SetProcessTime(quest.processSecond);
     m_ViewInformation.SetReward(quest.reward);
 }
Exemplo n.º 3
0
 private void HandOutQuest(Int32 questIdx, CombatGameCenter.Quest quest)
 {
     if (questIdx >= 0 && questIdx < m_QuestButtons.Count)
     {
         var btn = m_QuestButtons[questIdx];
         btn.botton.interactable = false;
     }
 }
Exemplo n.º 4
0
 // --- callback --- //
 private void AddPlayerQuest(CombatGameCenter.Quest quest)
 {
     foreach (var txt in m_TxtPlayerQuests)
     {
         if (txt.text == "")
         {
             txt.text = quest.name;
             break;
         }
     }
 }
Exemplo n.º 5
0
    public void ResetQuest(CombatGameCenter.Quest quest)
    {
        if (quest.IsEmpty())
        {
            m_TxtQuestName.text = "空闲";
            m_TxtTotalTime.text = "";
            m_TxtRunTime.text   = "";
            foreach (var panel in m_BlkMats)
            {
                panel.SetActive(false);
            }
            m_MaterialCount = 0;
        }
        else
        {
            m_TxtQuestName.text = quest.name;
            m_TxtTotalTime.text = String.Format("{0} 秒", quest.processSecond);
            m_TxtRunTime.text   = "0 秒";

            Int32 matCount = quest.materials.Count;
            // 补充缺少的材料块
            if (m_BlkMats.Count < matCount)
            {
                Int32 size = matCount - m_BlkMats.Count;
                for (int i = 0; i < size; i++)
                {
                    var go = Instantiate(m_PrefabProcessMaterialBlock, m_PnlMatRoot);
                    m_BlkMats.Add(go);
                }
            }
            // 隐藏多余的材料块
            for (int i = 0; i < m_BlkMats.Count; i++)
            {
                m_BlkMats[i].SetActive(i < matCount);
            }
            // 设置材料块信息
            for (int i = 0; i < matCount; i++)
            {
                var  questMat    = quest.materials[i];
                var  root        = m_BlkMats[i].transform;
                Text txtName     = root.Find("TxtName").GetComponent <Text>();
                Text txtCount    = root.Find("TxtCount").GetComponent <Text>();
                Text txtMaxCount = root.Find("TxtMaxCount").GetComponent <Text>();

                txtName.text     = questMat.name;
                txtMaxCount.text = String.Format("/ {0}", questMat.count);
                txtCount.text    = "0";
            }
            m_MaterialCount = matCount;
        }
    }
Exemplo n.º 6
0
 private void OnAddUpdate(CombatGameCenter.Quest quest)
 {
     UpdateQuestPanel();
 }