示例#1
0
    /// <summary>
    /// 获取其他玩家的信息
    /// </summary>
    /// <param name="id"></param>
    private void GetShipData(ulong id)
    {
        //Debug.LogError("收到玩家信息"+id);
        ShipItemsProxy shipItemsProxy = GameFacade.Instance.RetrieveProxy(ProxyName.ShipItemsProxy) as ShipItemsProxy;
        // 飞船的
        IShip ship = shipItemsProxy.GetCurrentWarShip(id);

        if (ship != null)
        {
            IWeaponContainer weaponContainer = ship.GetWeaponContainer();
            if (weaponContainer != null)
            {
                IWeapon[] weapons = weaponContainer.GetWeapons();
                //Debug.LogError("weapons==="+weapons.Length);
                if (weapons != null)
                {
                    for (int i = 0; i < weapons.Length; i++)
                    {
                        IWeapon weapon = weapons[i];
                        m_Weapons[i].text = TableUtil.GetItemName((int)weapon.GetBaseConfig().Id);
                    }
                }
            }

            IEquipmentContainer equipmentContainer = ship.GetEquipmentContainer();
            if (equipmentContainer != null)
            {
                IEquipment[] equipments = ship.GetEquipmentContainer().GetEquipments();
                for (int i = 0; i < equipments.Length; i++)
                {
                    IEquipment equipment = equipments[i];
                    m_EquipMents[i].text = TableUtil.GetItemName((int)equipment.GetBaseConfig().Id);
                }
            }
            IReformer ireformer = ship.GetReformerContainer().GetReformer();
            if (ireformer != null)
            {
                m_Converter.text = TableUtil.GetItemName((int)ireformer.GetBaseConfig().Id);
            }
        }
        else
        {
            Debug.LogError("船的信息为空");
        }
    }
示例#2
0
 /// <summary>
 /// 设置单个装备数据
 /// </summary>
 /// <param name="data"></param>
 /// <param name="cell"></param>
 private void SetEquipmentData(IEquipment data, Transform cell)
 {
     TransformUtil.FindUIObject <Transform>(cell, "Content").gameObject.SetActive(data != null);
     TransformUtil.FindUIObject <Transform>(cell, "Empty").gameObject.SetActive(data == null);
     if (data != null)
     {
         //icon
         UIUtil.SetIconImage(TransformUtil.FindUIObject <Image>(cell, "Content/Image_Icon"), TableUtil.GetItemIconBundle(data.GetTID()), TableUtil.GetItemIconImage(data.GetTID()));
         //name
         TransformUtil.FindUIObject <TMP_Text>(cell, "Content/Label_Name").text = TableUtil.GetItemName((int)data.GetTID());
         //quality
         TransformUtil.FindUIObject <Image>(cell, "Content/Image_Quality").color = ColorUtil.GetColorByItemQuality(data.GetBaseConfig().Quality);
         //lv
         TransformUtil.FindUIObject <TMP_Text>(cell, "Content/Label_Lv").text = "Lv." + PadLeft(data.GetLv().ToString());
     }
 }