Пример #1
0
    private string GetUpgradeCondition(YuanSuShuXing yssxNextLv)
    {
        string text = string.Empty;

        if (yssxNextLv.preElementLmt.get_Count() == 0)
        {
            string text2 = GameDataUtils.GetChineseContent(505058, false);
            text2 = text2.Replace("xxx", yssxNextLv.lvLmt.ToString());
            text += text2;
        }
        else
        {
            for (int i = 0; i < yssxNextLv.preElementLmt.get_Count(); i++)
            {
                YuanSuShuXing yuanSuShuXing = DataReader <YuanSuShuXing> .Get(yssxNextLv.preElementLmt.get_Item(i));

                string text3 = GameDataUtils.GetChineseContent(505060, false);
                text3  = text3.Replace("xxx1", this.GetSubElementTypeTextFromID(yuanSuShuXing.subType));
                text3  = text3.Replace("xxx2", yuanSuShuXing.lv.ToString());
                text3 += "\n";
                text  += text3;
            }
            if (yssxNextLv.lvLmt != 0)
            {
                string text4 = GameDataUtils.GetChineseContent(505058, false);
                text4 = text4.Replace("xxx", yssxNextLv.lvLmt.ToString());
                text += text4;
            }
            else
            {
                text = text.Replace(",", "。");
            }
        }
        return(text);
    }
Пример #2
0
    public Dictionary <int, bool> CheckElementTypesCanUpdate()
    {
        Dictionary <int, bool> dictionary = new Dictionary <int, bool>();

        dictionary.Add(1, false);
        dictionary.Add(2, false);
        dictionary.Add(3, false);
        dictionary.Add(4, false);
        for (int i = 0; i < this.elementInfos.get_Count(); i++)
        {
            ElementInfo ei = this.elementInfos.get_Item(i);
            if (ei.upgradable)
            {
                KeyValuePair <int, int> kp = this.ParseElementID(ei.elemId);
                if (!dictionary.get_Item(kp.get_Key()))
                {
                    YuanSuShuXing yuanSuShuXing = DataReader <YuanSuShuXing> .DataList.Find((YuanSuShuXing e) => e.type == kp.get_Key() && e.subType == kp.get_Value() && e.lv == ei.elemLv + 1);

                    if (yuanSuShuXing != null)
                    {
                        if (BackpackManager.Instance.OnGetGoodCount(yuanSuShuXing.itemId.get_Item(0)) >= (long)yuanSuShuXing.itemNum.get_Item(0))
                        {
                            dictionary.set_Item(kp.get_Key(), true);
                        }
                    }
                }
            }
        }
        return(dictionary);
    }
Пример #3
0
    private bool CanUpdate(YuanSuShuXing yssxNextLv)
    {
        bool result = true;

        for (int i = 0; i < yssxNextLv.preElementLmt.get_Count(); i++)
        {
            YuanSuShuXing yuanSuShuXing = DataReader <YuanSuShuXing> .Get(yssxNextLv.preElementLmt.get_Item(i));

            int         eleID       = ElementManager.Instance.MakeElementID(yuanSuShuXing.type, yuanSuShuXing.subType);
            ElementInfo elementInfo = ElementManager.Instance.elementInfos.Find((ElementInfo e) => e.elemId == eleID);
            if (elementInfo.elemLv < yuanSuShuXing.lv)
            {
                result = false;
                break;
            }
        }
        return(result);
    }
Пример #4
0
    public bool CheckAllCanUpdate()
    {
        for (int i = 0; i < this.elementInfos.get_Count(); i++)
        {
            ElementInfo ei = this.elementInfos.get_Item(i);
            if (ei.upgradable)
            {
                KeyValuePair <int, int> kp            = this.ParseElementID(ei.elemId);
                YuanSuShuXing           yuanSuShuXing = DataReader <YuanSuShuXing> .DataList.Find((YuanSuShuXing e) => e.type == kp.get_Key() && e.subType == kp.get_Value() && e.lv == ei.elemLv + 1);

                if (yuanSuShuXing != null)
                {
                    if (BackpackManager.Instance.OnGetGoodCount(yuanSuShuXing.itemId.get_Item(0)) >= (long)yuanSuShuXing.itemNum.get_Item(0))
                    {
                        return(true);
                    }
                }
            }
        }
        return(false);
    }
Пример #5
0
    private void ResetSelectSubTypeUI(int subType)
    {
        switch (subType)
        {
        case 1:
            this.ManagerFxSelected(this.fxSelected1, this.Element1.get_transform().FindChild("FX"));
            break;

        case 2:
            this.ManagerFxSelected(this.fxSelected2, this.Element2.get_transform().FindChild("FX"));
            break;

        case 3:
            this.ManagerFxSelected(this.fxSelected3, this.Element3.get_transform().FindChild("FX"));
            break;

        case 4:
            this.ManagerFxSelected(this.fxSelected4, this.Element4.get_transform().FindChild("FX"));
            break;

        case 5:
            this.ManagerFxSelected(this.fxSelected5, this.Element5.get_transform().FindChild("FX"));
            break;

        case 6:
            this.ManagerFxSelected(this.fxSelected6, this.Element6.get_transform().FindChild("FX"));
            break;
        }
        this.lastSelectSubType = subType;
        int         eleID       = ElementManager.Instance.MakeElementID(this.lastType, subType);
        ElementInfo elementInfo = ElementManager.Instance.elementInfos.Find((ElementInfo e) => e.elemId == eleID);

        this.TextTitleName.set_text(this.GetSubElementTypeTextFromID(subType));
        this.TextTitleLV.set_text("Lv." + elementInfo.elemLv);
        if (elementInfo.elemLv == 0)
        {
            YuanSuShuXing yuanSuShuXing = DataReader <YuanSuShuXing> .DataList.Find((YuanSuShuXing e) => e.type == this.lastType && e.subType == this.lastSelectSubType && e.lv == elementInfo.elemLv + 1);

            ResourceManager.SetSprite(this.ImageCost, GameDataUtils.GetIcon(DataReader <Items> .Get(yuanSuShuXing.itemId.get_Item(0)).icon));
            this.TextNowEffect.set_text(GameDataUtils.GetChineseContent(yuanSuShuXing.desc3, false));
            Attrs nextAttrs = DataReader <Attrs> .Get(yuanSuShuXing.attributeTemplateID);

            this.TextUpgradeEffect.set_text(this.GetLvUpDes(yuanSuShuXing.desc2, null, nextAttrs));
            long   num  = BackpackManager.Instance.OnGetGoodCount(yuanSuShuXing.itemId.get_Item(0));
            int    num2 = yuanSuShuXing.itemNum.get_Item(0);
            string text;
            if (num < (long)num2)
            {
                text = string.Concat(new object[]
                {
                    "<color=red>",
                    num,
                    "</color>/",
                    yuanSuShuXing.itemNum.get_Item(0)
                });
            }
            else
            {
                text = string.Concat(new object[]
                {
                    " ",
                    num,
                    "/",
                    yuanSuShuXing.itemNum.get_Item(0)
                });
            }
            this.TextCostNum.set_text(text);
            if (!elementInfo.upgradable)
            {
                this.BtnUpdate.get_gameObject().SetActive(false);
                this.TextUpgradeConditionTitle.get_gameObject().SetActive(true);
                this.TextUpgradeCondition.get_gameObject().SetActive(true);
                this.TextUpgradeCondition.set_text(this.GetUpgradeCondition(yuanSuShuXing));
            }
            else if (elementInfo.upgradable)
            {
                this.TextUpgradeConditionTitle.get_gameObject().SetActive(false);
                this.TextUpgradeCondition.get_gameObject().SetActive(false);
                this.BtnUpdate.get_gameObject().SetActive(true);
            }
            else
            {
                this.TextUpgradeConditionTitle.get_gameObject().SetActive(true);
                this.TextUpgradeCondition.get_gameObject().SetActive(true);
                this.BtnUpdate.get_gameObject().SetActive(false);
                this.TextUpgradeCondition.set_text(this.GetUpgradeCondition(yuanSuShuXing));
            }
        }
        else if (elementInfo.elemLv < elementInfo.elemMaxLv)
        {
            YuanSuShuXing yuanSuShuXing2 = DataReader <YuanSuShuXing> .DataList.Find((YuanSuShuXing e) => e.type == this.lastType && e.subType == this.lastSelectSubType && e.lv == elementInfo.elemLv);

            Attrs attrs = DataReader <Attrs> .Get(yuanSuShuXing2.attributeTemplateID);

            ResourceManager.SetSprite(this.ImageCost, GameDataUtils.GetIcon(DataReader <Items> .Get(yuanSuShuXing2.itemId.get_Item(0)).icon));
            this.TextNowEffect.set_text(this.GetLvDes(yuanSuShuXing2.desc, attrs));
            YuanSuShuXing yuanSuShuXing3 = DataReader <YuanSuShuXing> .DataList.Find((YuanSuShuXing e) => e.type == this.lastType && e.subType == this.lastSelectSubType && e.lv == elementInfo.elemLv + 1);

            Attrs nextAttrs2 = DataReader <Attrs> .Get(yuanSuShuXing3.attributeTemplateID);

            long   num3 = BackpackManager.Instance.OnGetGoodCount(yuanSuShuXing3.itemId.get_Item(0));
            int    num4 = yuanSuShuXing3.itemNum.get_Item(0);
            string text2;
            if (num3 < (long)num4)
            {
                text2 = string.Concat(new object[]
                {
                    "<color=red>",
                    num3,
                    "</color>/",
                    yuanSuShuXing3.itemNum.get_Item(0)
                });
            }
            else
            {
                text2 = string.Concat(new object[]
                {
                    " ",
                    num3,
                    "/",
                    yuanSuShuXing3.itemNum.get_Item(0)
                });
            }
            this.TextCostNum.set_text(text2);
            this.TextUpgradeEffect.set_text(this.GetLvUpDes(yuanSuShuXing3.desc2, attrs, nextAttrs2));
            if (elementInfo.upgradable)
            {
                this.TextUpgradeConditionTitle.get_gameObject().SetActive(false);
                this.TextUpgradeCondition.get_gameObject().SetActive(false);
                this.BtnUpdate.get_gameObject().SetActive(true);
            }
            else
            {
                this.TextUpgradeConditionTitle.get_gameObject().SetActive(true);
                this.TextUpgradeCondition.get_gameObject().SetActive(true);
                this.BtnUpdate.get_gameObject().SetActive(false);
                this.TextUpgradeCondition.set_text(this.GetUpgradeCondition(yuanSuShuXing3));
            }
        }
        else
        {
            YuanSuShuXing yuanSuShuXing4 = DataReader <YuanSuShuXing> .DataList.Find((YuanSuShuXing e) => e.type == this.lastType && e.subType == this.lastSelectSubType && e.lv == elementInfo.elemLv);

            Attrs attrs2 = DataReader <Attrs> .Get(yuanSuShuXing4.attributeTemplateID);

            ResourceManager.SetSprite(this.ImageCost, GameDataUtils.GetIcon(DataReader <Items> .Get(yuanSuShuXing4.itemId.get_Item(0)).icon));
            this.TextNowEffect.set_text(this.GetLvDes(yuanSuShuXing4.desc, attrs2));
            this.TextUpgradeEffect.set_text(GameDataUtils.GetChineseContent(505062, false));
            this.TextCostNum.set_text("0/0");
            this.BtnUpdate.get_gameObject().SetActive(false);
            this.TextUpgradeConditionTitle.get_gameObject().SetActive(true);
            this.TextUpgradeCondition.get_gameObject().SetActive(true);
            string text3 = GameDataUtils.GetChineseContent(505062, false);
            text3 = text3.Replace("xxx", this.GetSubElementTypeTextFromID(subType));
            this.TextUpgradeCondition.set_text(text3);
        }
    }