public List <PItem2> CheckProto(PItem2[] Info)
    {
        List <PItem2> m_firstReward = new List <PItem2>();

        for (int i = 0; i < Info.Length; i++)
        {
            PropItemInfo prop = ConfigManager.Get <PropItemInfo>(Info[i].itemTypeId);
            if (!prop || !prop.IsValidVocation(modulePlayer.proto))
            {
                continue;
            }
            m_firstReward.Add(Info[i]);
        }
        return(m_firstReward);
    }
Beispiel #2
0
    public void GetNewProp(PItem item)
    {
        PropItemInfo p = item?.GetPropItem();

        if (p == null || !p.IsValidVocation(modulePlayer.proto))
        {
            return;
        }

        var have = newProp.Find(a => a.itemId == item.itemId);

        if (have != null)
        {
            return;
        }
        newProp.Add(item);

        SetLocalNew(item.itemId);
    }
Beispiel #3
0
    private List <PItem> RuneShow(RuneType type)
    {
        List <PItem> rune = new List <PItem>();

        for (int i = 0; i < newProp.Count; i++)
        {
            PropItemInfo p = newProp[i]?.GetPropItem();
            if (p == null || !p.IsValidVocation(modulePlayer.proto) || p.itemType != PropType.Rune)
            {
                continue;
            }
            var s = (RuneType)(p.subType);
            if (type == s)
            {
                rune.Add(newProp[i]);
            }
        }

        return(rune);
    }
    public void SetNormalInfo(RectTransform rt, PWeflareAward info)
    {
        if (info == null)
        {
            return;
        }
        GameObject get     = rt.Find("get").gameObject;
        GameObject light   = rt.Find("light").gameObject;
        Text       dateTxt = rt.Find("date_Txt").GetComponent <Text>();

        Util.SetText(dateTxt, info.rewardname);
        light.SafeSetActive(info.state == 1);
        get.SafeSetActive(info.state == 2);

        List <PItem2> twoThreeReward = new List <PItem2>();

        for (int i = 0; i < info.reward.Length; i++)
        {
            if (info.reward[i] == null)
            {
                continue;
            }
            PropItemInfo propItem = ConfigManager.Get <PropItemInfo>(info.reward[i].itemTypeId);
            if (!propItem || !propItem.IsValidVocation(modulePlayer.proto))
            {
                continue;
            }
            twoThreeReward.Add(info.reward[i]);
        }
        if (twoThreeReward.Count <= 0 || info.reward == null || info.reward?.Length <= 0)
        {
            return;
        }

        PropItemInfo prop = ConfigManager.Get <PropItemInfo>(twoThreeReward[0].itemTypeId);

        Util.SetItemInfo(rt, prop, info.reward[0].level, (int)info.reward[0].num, false, info.reward[0].star);
    }
Beispiel #5
0
    private List <PItem> FashionShow(FashionSubType type, List <PItem> newProp)
    {
        List <PItem> equip = new List <PItem>();

        for (int i = 0; i < newProp.Count; i++)
        {
            PropItemInfo p = newProp[i]?.GetPropItem();
            if (p == null || !p.IsValidVocation(modulePlayer.proto))
            {
                continue;
            }
            if (p.itemType != PropType.FashionCloth)
            {
                continue;
            }
            if ((int)type == p.subType)
            {
                equip.Add(newProp[i]);
            }
        }

        return(equip);
    }
Beispiel #6
0
    public List <string> FashionShow(FashionSubType type)
    {
        if (type == FashionSubType.TwoPieceSuit || type == FashionSubType.FourPieceSuit)
        {
            return(null);
        }
        List <string> nameList = new List <string>();

        for (int i = 0; i < m_allFashion.Count; i++)
        {
            PropItemInfo p = m_allFashion[i];
            if (p == null || !p.IsValidVocation(modulePlayer.proto) || p.mesh == null || p.mesh.Length <= 0)
            {
                continue;
            }
            if (p.itemType != PropType.FashionCloth || (int)type != p.subType)
            {
                continue;
            }
            nameList.Add(p.mesh[0]);
        }
        return(nameList);
    }
Beispiel #7
0
    public static void ShowRewards(TaskInfo taskInfo, List <GameObject> items, bool isDetail, bool canGoto = true)
    {
        //预览奖励
        var stageInfo = ConfigManager.Get <StageInfo>(taskInfo.stageId);

        if (stageInfo == null)
        {
            for (int i = 0; i < items.Count; i++)
            {
                items[i].SetActive(false);
            }
            Logger.LogError("refresh the chase task,stageId = {0} connot be finded!", taskInfo.stageId);
        }
        else
        {
            int index = 0;
            for (int i = 0; i < stageInfo.previewRewardItemId.Length; i++)
            {
                if (index >= items.Count)
                {
                    break;
                }

                if (stageInfo.previewRewardItemId[i] == -1)
                {
                    if (!isDetail)
                    {
                        break;
                    }
                    index = 0;
                    continue;
                }

                PropItemInfo propInfo = ConfigManager.Get <PropItemInfo>(stageInfo.previewRewardItemId[i]);
                if (propInfo == null)
                {
                    continue;
                }

                if (!propInfo.IsValidVocation(Module_Player.instance.proto))
                {
                    continue;
                }

                Util.SetItemInfoSimple(items[index], propInfo);

                if (isDetail)
                {
                    Button btn = items[index].GetComponentDefault <Button>();
                    btn.onClick.RemoveAllListeners();
                    btn.onClick.AddListener(() =>
                    {
                        Module_Global.instance.UpdateGlobalTip((ushort)propInfo.ID, true, canGoto);
                    });
                }

                items[index].SetActive(true);
                index++;
            }

            for (int i = index; i < items.Count; i++)
            {
                items[i].SetActive(false);
            }
        }
    }
    private void SetLevelReward(RectTransform rt, PWeflareAward info)
    {
        if (info == null)
        {
            return;
        }
        Text       upTitleTxt = rt.transform.Find("title_Txt").GetComponent <Text>();
        Text       upDesc     = rt.transform.Find("des_Txt").GetComponent <Text>();
        GameObject upContent  = rt.transform.Find("content").gameObject;
        GameObject upProp     = rt.transform.Find("content/0").gameObject;
        Button     getBtn     = rt.transform.Find("get_Btn").GetComponent <Button>();
        Text       getBtnTxt  = rt.transform.Find("get_Btn/get_Txt").GetComponent <Text>();

        upDesc.text = info.desc;
        upDesc.SafeSetActive(true);
        upTitleTxt.text = info.rewardname;
        getBtn.onClick.RemoveAllListeners();
        getBtn.onClick.AddListener(delegate { parentWindow.GetAward(info, info.index); });

        parentWindow.SetBtnState(info.state, getBtn, getBtnTxt);

        List <Transform> contList = new List <Transform>();

        contList.Clear();
        foreach (Transform item in upContent.transform)
        {
            item.SafeSetActive(false);
            contList.Add(item);
        }

        if (info.reward.Length <= 0)
        {
            return;
        }

        var index = 0;

        for (int i = 0; i < info.reward.Length; i++)
        {
            if (index >= contList.Count || info.reward[i] == null)
            {
                continue;
            }

            PItem2       award = info.reward[i];
            PropItemInfo prop  = ConfigManager.Get <PropItemInfo>(award.itemTypeId);

            if (!prop || !prop.IsValidVocation(modulePlayer.proto))
            {
                continue;
            }

            Util.SetItemInfo(contList[index], prop, award.level, (int)award.num, false, award.star);

            contList[index].SafeSetActive(true);

            if (moduleWelfare.chooseInfo?.type == (int)WelfareType.VictoryTimes)
            {
                PWeflareData dataProgress = null;
                if (info.reachnum != null && info.reachnum.Length > 0)
                {
                    dataProgress = moduleWelfare.GetProgress(moduleWelfare.chooseInfo, info.reachnum[0].type);
                }
                if (dataProgress == null || info.reachnum[0] == null)
                {
                    Util.SetText(upDesc, ConfigText.GetDefalutString(211, 21), "0");
                }
                else
                {
                    Util.SetText(upDesc, ConfigText.GetDefalutString(211, 21), moduleWelfare.ShowTxt(dataProgress, 3, info.reachnum[0].days));
                }
            }
            else if (moduleWelfare.chooseInfo?.type == (int)WelfareType.WaitTime)
            {
                if (info.time < 0 || info.state != 0)
                {
                    upDesc.SafeSetActive(false);
                }
                Util.SetText(upDesc, ConfigText.GetDefalutString(211, 22), Util.GetTimeMarkedFromSec(info.time));
            }

            Button upBtn = contList[index].transform.GetComponentDefault <Button>();
            upBtn.onClick.RemoveAllListeners();
            upBtn.onClick.AddListener(delegate
            {
                moduleGlobal.UpdateGlobalTip(award, true, false);
            });
            index++;
        }
        parentWindow.SetPostion(index, contList);
    }