예제 #1
0
    private void SetRewardInfo(PItem2[] itemlist, List <Transform> tranList, bool first = false)
    {
        for (int i = 0; i < tranList.Count; i++)
        {
            tranList[i].SafeSetActive(false);
        }
        var index = 0;

        for (int i = 0; i < itemlist.Length; i++)
        {
            var info = itemlist[i];
            if (info == null || index >= tranList.Count)
            {
                continue;
            }
            var prop = ConfigManager.Get <PropItemInfo>(info.itemTypeId);
            if (!prop || !prop.IsValidVocation(modulePlayer.proto))
            {
                continue;
            }

            if (first && prop.itemType == PropType.WallPaper && prop.subType == 1)
            {
                if (prop == null || prop.mesh == null || prop.mesh.Length < 1)
                {
                    continue;
                }
                m_saveBtn.onClick.RemoveAllListeners();
                m_saveBtn.onClick.AddListener(delegate { TakePhoto(prop.mesh[0]); });
                UIDynamicImage.LoadImage(m_photo.transform, prop.mesh[0]);
                for (int j = 0; j < m_lockObj.Count; j++)
                {
                    if (j + 1 >= prop.mesh.Length)
                    {
                        continue;
                    }
                    AtlasHelper.SetPuzzle(m_lockObj[j].gameObject, prop.mesh[j + 1], null, true);
                }
                continue;
            }
            tranList[index].SafeSetActive(true);
            Util.SetItemInfo(tranList[index], prop, info.level, (int)info.num, false, info.star);
            if (!(prop.itemType == PropType.WallPaper && prop.subType == 1))
            {
                var btn = tranList[index].GetComponentDefault <Button>();
                btn.onClick.RemoveAllListeners();
                btn.onClick.AddListener(delegate
                {
                    moduleGlobal.UpdateGlobalTip(info, true, false);
                });
            }
            index++;
        }
    }