예제 #1
0
        //显示奖励信息
        private void OnShowAwardInfo()
        {
            //TODO 假如有物品, 则创icon
            bg_task.gameObject.SetActive(true);
            conOption.parent.gameObject.SetActive(false);
            //int selectId = tkModel.SelectTaskId;
            TaskData taskData = /*tkModel.*/ curTask;
            Dictionary <uint, int> dicValueReward;

            switch (taskData.taskT)
            {
            case TaskType.CLAN:
                dicValueReward = tkModel.GetClanRewardDic(taskData.taskCount);
                break;

            default:
                dicValueReward = tkModel.GetValueReward(taskData.taskId);
                break;
            }
            Dictionary <uint, int> dicItemReward   = tkModel.GetItemReward(taskData.taskId);
            List <a3_BagItemData>  listEquipReward = tkModel.GetEquipReward(taskData.taskId);

            if (taskData.guide)
            {
                btnNext.transform.FindChild("guide_task_info").gameObject.SetActive(true);
            }
            else
            {
                btnNext.transform.FindChild("guide_task_info").gameObject.SetActive(false);
            }

            if (dicValueReward != null)
            {
                if (conIcon.childCount > 0)
                {
                    for (int i = 0; i < conIcon.childCount; i++)
                    {
                        Destroy(conIcon.GetChild(i).gameObject);
                    }
                }
                foreach (var v in dicValueReward.Keys)
                {
                    a3_ItemData item = a3_BagModel.getInstance().getItemDataById(v);
                    switch (taskData.taskT)
                    {
                    default:
                        item.file = "icon_comm_0x" + v;
                        break;

                    case TaskType.CLAN:
                        item.file = "icon_comm_1x" + v;
                        break;
                    }
                    GameObject icon = IconImageMgr.getInstance().createA3ItemIcon(item, false, dicValueReward[v], 0.8f);
                    var        bd   = icon.transform.FindChild("iconbor");
                    if (bd != null)
                    {
                        bd.gameObject.SetActive(false);
                    }

                    GameObject rootClon = GameObject.Instantiate(iconTemp) as GameObject;

                    icon.transform.SetParent(rootClon.transform.FindChild("icon"), false);
                    rootClon.transform.SetParent(conIcon, false);

                    rootClon.name = item.tpid.ToString();
                    rootClon.SetActive(true);

                    var iimg = icon.GetComponent <Image>();
                    if (iimg != null)
                    {
                        iimg.enabled = false;
                    }
                }
            }

            if (listEquipReward != null)
            {
                foreach (a3_BagItemData v in listEquipReward)
                {
                    if (!v.isEquip)
                    {
                        continue;
                    }

                    GameObject icon = IconImageMgr.getInstance().createA3ItemIcon(v.id, false, -1, 0.8f);
                    var        bd   = icon.transform.FindChild("iconborder");
                    if (bd != null)
                    {
                        bd.gameObject.SetActive(false);
                    }
                    GameObject rootClon = GameObject.Instantiate(iconTemp) as GameObject;

                    icon.transform.SetParent(rootClon.transform.FindChild("icon"), false);
                    rootClon.transform.SetParent(conIcon, false);

                    rootClon.name = v.tpid.ToString();
                    rootClon.SetActive(true);

                    var iimg = icon.GetComponent <Image>();
                    if (iimg != null)
                    {
                        iimg.enabled = false;
                    }
                }
            }

            if (dicItemReward != null)
            {
                foreach (uint key in dicItemReward.Keys)
                {
                    int        num  = dicItemReward[key];
                    GameObject icon = IconImageMgr.getInstance().createA3ItemIcon(
                        key, true, num, 0.8F, false);
                    var bd = icon.transform.FindChild("iconborder");
                    if (bd != null)
                    {
                        bd.gameObject.SetActive(false);
                    }

                    GameObject rootClon = GameObject.Instantiate(iconTemp) as GameObject;

                    icon.transform.SetParent(rootClon.transform.FindChild("icon"), false);
                    rootClon.transform.SetParent(conIcon, false);

                    rootClon.name = key.ToString();
                    rootClon.SetActive(true);

                    var iimg = icon.GetComponent <Image>();
                    if (iimg != null)
                    {
                        iimg.enabled = false;
                    }
                }
            }
        }