示例#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
    public override void OnShow(object msg)
    {
        base.OnShow(msg);

        LoadViewPart(ASSET_ADDRESS, OwnerView.ListBox);
        OwnerView.PageBox.gameObject.SetActive(false);
        m_WarshipDialogPanel             = OwnerView as WarshipDialogPanel;
        m_BeforeToggle                   = m_WarshipDialogPanel.BeforeToggle;
        m_CfgEternityProxy               = GameFacade.Instance.RetrieveProxy(ProxyName.CfgEternityProxy) as CfgEternityProxy;
        m_ShipProxy                      = GameFacade.Instance.RetrieveProxy(ProxyName.ShipProxy) as ShipProxy;
        m_PackageProxy                   = GameFacade.Instance.RetrieveProxy(ProxyName.PackageProxy) as PackageProxy;
        m_ServerListProxy                = GameFacade.Instance.RetrieveProxy(ProxyName.ServerListProxy) as ServerListProxy;
        m_SceneShipProxy                 = GameFacade.Instance.RetrieveProxy(ProxyName.SceneShipProxy) as SceneShipProxy;
        m_WarshipDialogPanel.AppointShip = m_ShipProxy.GetAppointWarShip();

        if (m_WarshipDialogPanel.LastShip != null)
        {
            if (m_ShipProxy.GetAppointWarShip().GetTID() != m_WarshipDialogPanel.LastShip.GetTID())
            {
                m_SceneShipProxy.HideShip();
                m_SceneShipProxy.ShowShip();
            }
        }
        m_WarshipDialogPanel.LastShip = m_ShipProxy.GetAppointWarShip();
        if (msg != null)
        {
            m_CurrentShip = msg as IShip;
        }
        else
        {
            m_CurrentShip = m_ShipProxy.GetAppointWarShip();
        }
        m_ShowAppiontIcon = true;
        if (m_WarshipDialogPanel.AppointShip.GetTID() != m_CurrentShip.GetTID())
        {
            m_ShowAppiontIcon = false;
        }
        if (m_CurrentShip == null)
        {
            return;
        }
        if (m_CurrentShip == null)
        {
            Debug.Log("没有战船");
            return;
        }

        m_Weapons = new IWeapon[m_CurrentShip.GetWeaponContainer().GetCurrentSizeMax()];
        IWeapon[] tempWeapons = m_CurrentShip.GetWeaponContainer().GetWeapons();
        if (tempWeapons != null)
        {
            for (int i = 0; i < tempWeapons.Length; i++)
            {
                m_Weapons[tempWeapons[i].GetPos()] = tempWeapons[i];
            }
            tempWeapons = null;
        }

        m_Equipment = new IEquipment[m_CurrentShip.GetEquipmentContainer().GetCurrentSizeMax()];
        IEquipment[] tempEquips = m_CurrentShip.GetEquipmentContainer().GetEquipments();
        if (tempEquips != null)
        {
            for (int i = 0; i < tempEquips.Length; i++)
            {
                m_Equipment[tempEquips[i].GetPos()] = tempEquips[i];
            }
            tempEquips = null;
        }

        m_Reformer = m_CurrentShip.GetReformerContainer().GetReformer();
    }
示例#3
0
    /// <summary>
    /// 查找可以比较的数据
    /// </summary>
    /// <param name="data">当前数据</param>
    /// <param name="compareableDatas">可参与比较的数据列表</param>
    protected override void FindCompareableData(object data, List <object> compareableDatas)
    {
        base.FindCompareableData(data, compareableDatas);

        if (data == null)
        {
            return;
        }
        if (!(data is ItemBase))
        {
            return;
        }

        ItemBase item = data as ItemBase;

        if (item.MainType != Category.Blueprint && item.MainType != Category.Warship && item.MainType != Category.Weapon && item.MainType != Category.Reformer && item.MainType != Category.Equipment)
        {
            return;
        }

        //当前角色的包
        ItemContainer container = GetPackage().GetHeroItem();

        if (container == null || container.Items == null || container.Items.Count == 0)
        {
            return;
        }

        //当前出战的飞船
        ItemWarShipVO ship = null;

        foreach (ItemBase heroItem in container.Items.Values)
        {
            if (heroItem is ItemWarShipVO)
            {
                ship = heroItem as ItemWarShipVO;
                break;
            }
        }

        //当前是飞船
        if (item.MainType == Category.Warship)
        {
            if (item != ship)
            {
                compareableDatas.Add(ship);
            }
        }
        //当前是飞船的蓝图
        else if (item.MainType == Category.Blueprint && (item as ItemDrawingVO).DrawingType == BlueprintL1.Warship)
        {
            compareableDatas.Add(ship);
        }
        else
        {
            IShip    iship         = (GameFacade.Instance.RetrieveProxy(ProxyName.ShipProxy) as ShipProxy).GetAppointWarShip();
            Category mainType      = item.MainType;
            Enum     secondaryType = null;

            if (item is ItemDrawingVO)
            {
                ItemDrawingVO blueprint = item as ItemDrawingVO;
                switch (blueprint.DrawingType)
                {
                case BlueprintL1.Weapon:
                    mainType = Category.Weapon;
                    break;

                case BlueprintL1.Reformer:
                    mainType = Category.Reformer;
                    break;

                case BlueprintL1.Equipment:
                    FoundryProxy foundryProxy = GameFacade.Instance.RetrieveProxy(ProxyName.FoundryProxy) as FoundryProxy;
                    Item         product      = foundryProxy.GetItemByProduceKey((int)blueprint.TID);
                    mainType      = Category.Equipment;
                    secondaryType = (Enum)ItemTypeUtil.GetItemType(product.Type).EnumList[2];
                    break;
                }
            }
            else if (item is ItemEquipmentVO)
            {
                ItemEquipmentVO equip = item as ItemEquipmentVO;
                mainType      = equip.MainType;
                secondaryType = equip.EquipmentType;
            }

            //武器
            if (mainType == Category.Weapon)
            {
                ItemBase[] list = new ItemBase[iship.GetWeaponContainer().GetCurrentSizeMax()];
                foreach (IWeapon weapon in iship.GetWeaponContainer().GetWeapons())
                {
                    list[weapon.GetPos()] = GetPackage().GetItem <ItemWeaponVO>(weapon.GetUID());
                }
                compareableDatas.AddRange(list);
            }
            //转化炉
            else if (mainType == Category.Reformer)
            {
                IReformer reformer = iship.GetReformerContainer().GetReformer();
                if (reformer != null)
                {
                    compareableDatas.Add(GetPackage().GetItem <ItemReformerVO>(reformer.GetUID()));
                }
                else
                {
                    compareableDatas.Add(null);
                }
            }
            //装备
            else if (mainType == Category.Equipment)
            {
                foreach (IEquipment equip in iship.GetEquipmentContainer().GetEquipments())
                {
                    ItemEquipmentVO equipVO = GetPackage().GetItem <ItemEquipmentVO>(equip.GetUID());
                    Enum            type    = equipVO.EquipmentType;
                    if (Enum.Equals(type, secondaryType))
                    {
                        compareableDatas.Add(equipVO);
                    }
                }
            }
        }
    }