Пример #1
0
    private void MsgHandle(KeyValuesUpdate kv)
    {
        List <object> entities = (List <object>)kv.Values;

        for (int i = 0; i < entities.Count; i++)
        {
            object o = entities[i];
            pickItemPics[i].gameObject.SetActive(true);
            if (o is PropEntity)
            {
                PropEntity entity = (PropEntity)o;
                pickItemPics[i].sprite = entity.propIcon;
                pickItemPics[i].GetComponent <IHoverable>().content  = entity;
                pickItemPics[i].GetComponent <IHoverable>().strClass = typeof(PropIntroPanel).ToString();
            }
            else if (o is EquipEntity)
            {
                EquipEntity entity = (EquipEntity)o;
                pickItemPics[i].sprite = entity.equipIcon;
                pickItemPics[i].GetComponent <IHoverable>().content  = entity;
                pickItemPics[i].GetComponent <IHoverable>().strClass = typeof(EquipIntroPanel).ToString();
            }
        }
        for (int i = entities.Count; i < 6; i++)
        {
            pickItemPics[i].gameObject.SetActive(false);
        }
    }
Пример #2
0
    private void MsgHandle(KeyValuesUpdate kv)
    {
        PropEntity propEntity = (PropEntity)kv.Values;

        propName.text  = propEntity.propName;
        propType.text  = propEntity.typeName;
        propIntro.text = propEntity.description;
    }
Пример #3
0
    private void SetProps(PlayerEntity player)
    {
        props = player.propsPack;

        for (int i = 0; i < propsItemsObj.Length; i++)
        {
            Destroy(propsItemsObj[i]);
        }
        int index = 0;

        foreach (MyKeyValuePair <int> kv in props)
        {
            GameObject prefab = Resources.Load <GameObject>("UI/PopupWindow/PropItem_Pic");
            propsItemsObj[index]     = Instantiate(prefab, scrollContent.GetChild(index).Find("Prop_Frame"));
            propsItemsObj[index].tag = MyTag.PROP_ICON_TAG;
            propsItemsObj[index].AddComponent <IDragable>();
            propsItemsObj[index].GetComponent <IDragable>().itemName = kv.key;
            PropEntity propEntity = AssetsDB.instance.propsData.FindProp(kv.key);
            if (propEntity != null)
            {
                propsItemsObj[index].GetComponent <Image>().sprite = propEntity.propIcon;
                propsItemsObj[index].transform.Find("PropItem_Pic_Mask").GetComponent <Image>().sprite = propEntity.propIcon;
                propsItemsObj[index].AddComponent <IHoverable>();
                propsItemsObj[index].GetComponent <IHoverable>().strClass = typeof(PropIntroPanel).ToString();
                propsItemsObj[index].GetComponent <IHoverable>().content  = propEntity;
                propsItemsObj[index].transform.Find("PropItem_Count_Text").GetComponent <Text>().text = kv.value.ToString();
                propsItemsObj[index].GetComponent <IDragable>().itemType = FastItemType.Prop;
            }
            else
            {
                EquipEntity equipEntity = AssetsDB.instance.equipsData.FindEquip(kv.key);
                propsItemsObj[index].GetComponent <Image>().sprite = equipEntity.equipIcon;
                propsItemsObj[index].transform.Find("PropItem_Pic_Mask").GetComponent <Image>().sprite = equipEntity.equipIcon;
                propsItemsObj[index].AddComponent <IHoverable>();
                propsItemsObj[index].GetComponent <IHoverable>().strClass = typeof(EquipIntroPanel).ToString();
                propsItemsObj[index].GetComponent <IHoverable>().content  = equipEntity;
                propsItemsObj[index].transform.Find("PropItem_Count_Text").GetComponent <Text>().text = kv.value.ToString();
                propsItemsObj[index].GetComponent <IDragable>().itemType = FastItemType.Equip;
            }
            index++;
        }
    }