Ejemplo n.º 1
0
    /// <summary>
    /// 获取当前武器武器准星对象
    /// </summary>
    /// <returns></returns>
    public WeaponAndCrossSight GetCurrentWeaponAndCrossSight()
    {
        SpacecraftEntity mainPlayer = m_GameplayProxy.GetEntityById <SpacecraftEntity>(m_GameplayProxy.GetMainPlayerUID());

        if (mainPlayer == null)
        {
            return(null);
        }

        WeaponAndCrossSight result = null;

        if (UsingReformer())
        {
            //转化炉武器
            IReformer reformer = GetReformer();
            if (reformer != null && mainPlayer.HaveWeaponAndCrossSight(reformer.GetUID()))
            {
                result = mainPlayer.GetWeaponAndCrossSight(reformer.GetUID());
            }
        }
        else
        {
            //普通武器
            IWeapon weapon = GetCurrentWeapon();
            if (weapon != null && mainPlayer.HaveWeaponAndCrossSight(weapon.GetUID()))
            {
                result = mainPlayer.GetWeaponAndCrossSight(weapon.GetUID());
            }
        }

        return(result);
    }
Ejemplo n.º 2
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("船的信息为空");
        }
    }
Ejemplo n.º 3
0
    public PlayerSkillVO GetReformerSkill()
    {
        ShipProxy shipProxy = GameFacade.Instance.RetrieveProxy(ProxyName.ShipProxy) as ShipProxy;

        if (shipProxy.GetAppointWarShip() != null && shipProxy.GetAppointWarShip().GetReformerContainer() != null)
        {
            IReformer reformer = shipProxy.GetAppointWarShip().GetReformerContainer().GetReformer();
            if (reformer != null)
            {
                return(GetSkillByID((int)reformer.GetBaseConfig().SkillId));
            }
            else
            {
                return(null);
            }
        }

        return(null);
    }
Ejemplo n.º 4
0
    /// <summary>
    /// 主武器改变时
    /// </summary>
    private void OnMainWeaponChanged()
    {
        m_lastFireFail = false;

        m_CurrentTargetList.Clear();

        m_Crosshair = null;
        m_Point = null;
        m_Frame = null;
        m_FrameBox = null;
        m_TargetBox = null;

        for (int i = 0; i < m_Root.childCount; i++)
        {
            m_Root.GetChild(i).gameObject.SetActive(false);
        }

        PlayerSkillProxy skillProxy = Facade.RetrieveProxy(ProxyName.PlayerSkillProxy) as PlayerSkillProxy;

        IWeapon currentWeapon = skillProxy.GetCurrentWeapon();

        m_WeaponStyle = (int)WeaponAndCrossSight.WeaponAndCrossSightTypes.Null;
        m_AutoLockEnabled = currentWeapon != null && currentWeapon.GetConfig().AssistKey != 0;

        SpacecraftEntity main = GetMainEntity();
        if (main && IsBattling())
        {
            IReformer reformer = skillProxy.UsingReformer() ? skillProxy.GetReformer() : null;

            if (reformer != null)
                m_WeaponStyle = (WeaponAndCrossSight.WeaponAndCrossSightTypes)reformer.GetConfig().Reticle;
            else if (currentWeapon != null)
                m_WeaponStyle = (WeaponAndCrossSight.WeaponAndCrossSightTypes)currentWeapon.GetConfig().Reticle;
        }

        m_Crosshair = m_Root.GetChild((int)m_WeaponStyle).GetComponent<RectTransform>();
       // m_Crosshair.gameObject.SetActive(true);
        m_Point = m_Crosshair.Find("point") != null ? m_Crosshair.Find("point").GetComponent<RectTransform>() : null;
        m_Frame = m_Crosshair.Find("frame") != null ? m_Crosshair.Find("frame").GetComponent<RectTransform>() : null;
        m_FrameBox = m_Crosshair.Find("FrameBox") != null ? m_Crosshair.Find("FrameBox").GetComponent<RectTransform>() : null;
        m_TargetBox = m_Crosshair.Find("Targets") != null ? m_Crosshair.Find("Targets").GetComponent<RectTransform>() : null;
	}
    /// <summary>
    /// 转化炉切换
    /// </summary>
    /// <param name="entityEvent"></param>
    private void ReformerWeapons(IComponentEvent entityEvent)
    {
        if (m_IPerceptronTarget.GetCurrentState().IsHasSubState(EnumSubState.Peerless))
        {
            //转化炉模式
            if (!m_SkillProxy.UsingReformer())
            {
                return;
            }

            IReformer reformer = m_SkillProxy.GetReformer();
            if (reformer == null)
            {
                return;
            }
            ulong uid = reformer.GetUID();
            if (!m_IPerceptronTarget.HaveWeaponAndCrossSight(uid))
            {
                WeaponAndCrossSight weaponAndCross = WeaponAndCrossSightFactory.CreatTWeapon(uid,
                                                                                             reformer.GetConfig().Id, reformer.GetBaseConfig().SkillId,
                                                                                             (WeaponAndCrossSight.WeaponAndCrossSightTypes)reformer.GetConfig().Reticle);

                //Debug.LogError(string.Format("创建准星 uid = {0}, tid = {1} , type = {2}, null? {3}", uid, weapon.GetConfig().Id, weapon.GetConfig().Reticle , (weaponAndCross== null)));

                if (weaponAndCross == null)
                {
                    return;
                }
                m_IPerceptronTarget.AddWeaponAndCrossSight(uid, weaponAndCross);
            }
        }
        else
        {
            //非转化炉模式
            m_IPerceptronTarget.DeleReformerWeaponAndCrossSight();
        }
    }
Ejemplo n.º 6
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();
    }
Ejemplo n.º 7
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);
                    }
                }
            }
        }
    }