示例#1
0
    /// <summary>
    /// 解锁条件字符
    /// </summary>
    /// <param name="id"></param>
    /// <returns></returns>
    public string GetUnLockLabel(uint id)
    {
        StringBuilder str = new StringBuilder();

        if (id <= 0)
        {
            str.Append("Not");
        }
        if (id > 0)
        {
            EffectElement?[] effectElements = m_CfgEternityProxy.GetEffectElementsByKey(id);
            for (int i = 0; i < effectElements.Length; i++)
            {
                OperationType fun = (OperationType)effectElements[i].Value.Function;
                switch (fun)
                {
                case OperationType.kGreaterAndEqual:
                    if (effectElements[i].Value.Attribute == (int)AttributeName.kDuanLevel)
                    {
                        str.Append(
                            TableUtil.GetLanguageString(AttributeName.kDuanLevel) +
                            TableUtil.GetLanguageString(OperationType.kGreaterAndEqual) +
                            effectElements[i].Value.Value.ToString() + "\n");
                    }
                    if (effectElements[i].Value.Attribute == (int)AttributeName.kRoleLevel)
                    {
                        str.Append(
                            TableUtil.GetLanguageString(AttributeName.kRoleLevel) +
                            TableUtil.GetLanguageString(OperationType.kGreaterAndEqual) +
                            effectElements[i].Value.Value.ToString() + "\n");
                    }
                    break;

                case OperationType.kGreater:
                    if (effectElements[i].Value.Attribute == (int)AttributeName.kDuanLevel)
                    {
                        str.Append(
                            TableUtil.GetLanguageString(AttributeName.kDuanLevel) +
                            TableUtil.GetLanguageString(OperationType.kGreaterAndEqual) +
                            effectElements[i].Value.Value.ToString() + "\n");
                    }
                    if (effectElements[i].Value.Attribute == (int)AttributeName.kRoleLevel)
                    {
                        str.Append(
                            TableUtil.GetLanguageString(AttributeName.kRoleLevel) +
                            TableUtil.GetLanguageString(OperationType.kGreater) +
                            effectElements[i].Value.Value.ToString() + "\n");
                    }
                    break;

                default:
                    break;
                }
            }
        }
        return(str.ToString());
    }
示例#2
0
    /// <summary>
    /// 布局蓝图的材料部分
    /// </summary>
    /// <param name="tid">蓝图的TID</param>
    /// <param name="materialNode">材料节点</param>

    private void LayoutBlueprintMaterial(uint tid, Transform materialNode)
    {
        CfgEternityProxy cfg  = GetConfig();
        PackageProxy     pack = GetPackage();

        Produce produce = cfg.GetProduceByKey(tid);

        Transform materialList      = FindComponent <Transform>(materialNode, "Resources");
        TMP_Text  materialTimeField = FindComponent <TMP_Text>(materialNode, "Label_Time");

        materialTimeField.text = TableUtil.GetLanguageString("production_text_1024") + TimeUtil.GetTimeStr(produce.Time);

        int index         = 0;
        int currencyIndex = 0;
        List <EffectElement?> sortedElements = new List <EffectElement?>();

        if (produce.Cost > 0)
        {
            EffectElement?[] elements = cfg.GetEffectElementsByKey((uint)produce.Cost);
            if (elements.Length > 0)
            {
                for (int i = 0; i < elements.Length; i++)
                {
                    EffectElement?element = elements[i];
                    Item          item    = cfg.GetItemByKey((uint)element.Value.ItemId);

                    if (ItemTypeUtil.GetItemType(item.Type).MainType == Category.Currency)
                    {
                        sortedElements.Insert(currencyIndex, element);
                        currencyIndex++;
                    }
                    else
                    {
                        sortedElements.Add(element);
                    }
                }
            }

            for (; index < sortedElements.Count; index++)
            {
                EffectElement?element = sortedElements[index];
                Item          item    = cfg.GetItemByKey((uint)element.Value.ItemId);

                Transform node    = index < materialList.childCount ? materialList.GetChild(index) : UnityEngine.Object.Instantiate(materialList.GetChild(0), materialList);
                Image     icon    = FindComponent <Image>(node, "Icon/Icon");
                Image     quality = FindComponent <Image>(node, "Icon/Quality");
                TMP_Text  name    = FindComponent <TMP_Text>(node, "Label_Name");
                TMP_Text  count   = FindComponent <TMP_Text>(node, "Label_Num");

                node.gameObject.SetActive(true);
                UIUtil.SetIconImageSquare(icon, item.Icon);

                long haveCount = pack.GetItemCountByTID((uint)element.Value.ItemId);
                long needCount = (long)element.Value.Value;

                quality.color = ColorUtil.GetColorByItemQuality(item.Quality);
                name.text     = TableUtil.GetItemName(element.Value.ItemId);
                if (haveCount < needCount)
                {
                    count.text = string.Format("<color=#ff0000>{0}</color>/{1}", haveCount, needCount);
                }
                else
                {
                    count.text = string.Format("<color=#00ff00>{0}</color>/{1}", haveCount, needCount);
                }
            }
        }
        for (; index < materialList.childCount; index++)
        {
            materialList.GetChild(index).gameObject.SetActive(false);
        }
    }
示例#3
0
 /// <summary>
 /// 获取消耗数据根据EffectTid
 /// </summary>
 /// <param name="tid">Effect Tid</param>
 /// <returns></returns>
 public EffectElement?[] GetEffectElementsByKey(int tid)
 {
     return(m_CfgEternityProxy.GetEffectElementsByKey((uint)tid));
 }