Пример #1
0
    private void SetItemInformation(UnityEngine.GameObject go, int id, int propertyid)
    {
        ArkCrossEngine.ItemConfig itemconfig = ArkCrossEngine.LogicSystem.GetItemDataById(id);
        if (itemconfig == null)
        {
            return;
        }

        if (go != null)
        {
            DFMItemIconUtils.Instance.SetItemInfo(ItemIconType.Equip_List, go, id);
            UnityEngine.Transform tf;
            RoleInfo       roleInfo = LobbyClient.Instance.CurrentRole;
            ItemDataInfo[] equips   = null;
            if (roleInfo != null)
            {
                equips = roleInfo.Equips;
            }
            int _fightScore     = (int)GetItemFightScore(itemconfig, propertyid, 1);
            int _equipFingScore = 0;
            if (equips != null)
            {
                foreach (ItemDataInfo info in equips)
                {
                    ItemConfig equipConfig = LogicSystem.GetItemDataById(info.ItemId);
                    if (equipConfig != null)
                    {
                        if (equipConfig.m_WearParts == itemconfig.m_WearParts)
                        {
                            _equipFingScore = (int)GetItemFightScore(equipConfig, info.RandomProperty, info.Level);
                            _fightScore     = (int)GetItemFightScore(itemconfig, propertyid, info.Level);
                        }
                    }
                }
            }
            tf = go.transform.Find("Up");
            if (tf != null)
            {
                UISprite sp = tf.GetComponent <UISprite>();
                if (sp != null)
                {
                    sp.spriteName = _fightScore >= _equipFingScore ? "Up" : "down";
                }
            }
            tf = go.transform.Find("Up/value");
            if (tf != null)
            {
                UILabel label = tf.GetComponent <UILabel>();
                if (label != null)
                {
                    label.text  = Math.Abs(_fightScore - _equipFingScore).ToString();
                    label.color = _fightScore >= _equipFingScore ? new UnityEngine.Color(0, 251 / 255f, 75 / 255f) : new UnityEngine.Color(1, 0, 0);
                }
            }

            ItemClick script = go.GetComponent <ItemClick>();
            if (script != null)
            {
                script.fightScoreChange = _fightScore - _equipFingScore;
            }

            tf = go.transform.Find("LabelOccupation");
            if (tf != null)
            {
                UILabel ul = tf.gameObject.GetComponent <UILabel>();
                if (ul != null)
                {
                    ul.text = itemconfig.m_ItemType;
                }
            }
        }
    }