Example #1
0
    public override void OnHide(object msg)
    {
        m_SkillProxy    = null;
        m_GameplayProxy = null;

        base.OnHide(msg);
    }
    /// <summary>
    /// 在武器变化的时候, 更新当前实装的武器的准星信息
    /// </summary>
    private void UpdateBattleWeapons(IComponentEvent entityEvent)
    {
        PlayerSkillProxy m_SkillProxy = GameFacade.Instance.RetrieveProxy(ProxyName.PlayerSkillProxy) as PlayerSkillProxy;

        for (int iWeapon = 0; iWeapon < BATTLE_WEAPON_COUNT; iWeapon++)
        {
            IWeapon weapon = m_SkillProxy.GetWeaponByIndex(iWeapon);
            if (weapon == null)
            {
                continue;
            }

            ulong uid = weapon.GetUID();

            if (!m_IPerceptronTarget.HaveWeaponAndCrossSight(uid))
            {
                WeaponAndCrossSight weaponAndCross = WeaponAndCrossSightFactory.CreatTWeapon(uid,
                                                                                             weapon.GetConfig().Id, weapon.GetBaseConfig().SkillId,
                                                                                             (WeaponAndCrossSight.WeaponAndCrossSightTypes)weapon.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)
                {
                    continue;
                }
                m_IPerceptronTarget.AddWeaponAndCrossSight(uid, weaponAndCross);
            }
        }
    }
Example #3
0
    public override void OnInitialize(ISkillRefactorProperty property)
    {
        m_Property = property;

        m_State = SkillState.Idle;
        m_Property.SetCurrentSkillState(m_State);

        m_IDToSkill                = new Dictionary <int, SkillBase>();
        m_RemoveSkillList          = new List <int>();
        m_ReleasedSkillDuringPress = new Dictionary <int, bool>();

        m_CfgSkillProxy    = GameFacade.Instance.RetrieveProxy(ProxyName.CfgSkillSystemProxy) as CfgSkillSystemProxy;
        m_SkillProxy       = GameFacade.Instance.RetrieveProxy(ProxyName.PlayerSkillProxy) as PlayerSkillProxy;
        m_CfgLanguageProxy = GameFacade.Instance.RetrieveProxy(ProxyName.CfgLanguageProxy) as CfgLanguageProxy;
        m_GameplayProxy    = GameFacade.Instance.RetrieveProxy(ProxyName.GameplayProxy) as GameplayProxy;

        m_CfgEternityProxy     = GameFacade.Instance.RetrieveProxy(ProxyName.CfgEternityProxy) as CfgEternityProxy;
        m_WeakSoundCD          = m_CfgEternityProxy.GetGamingConfig(1).Value.Mine.Value.Sound.Value.WeaknessSoundCd;
        m_WeakSoundTmpCD       = m_WeakSoundCD;
        m_WeakSoundProbability = m_CfgEternityProxy.GetGamingConfig(1).Value.Mine.Value.Sound.Value.WeaknessSoundRate;

        SkillBase.s_CfgSkillProxy    = m_CfgSkillProxy;
        SkillBase.s_SkillProxy       = m_SkillProxy;
        SkillBase.s_CfgLanguageProxy = m_CfgLanguageProxy;
        SkillBase.s_GameplayProxy    = m_GameplayProxy;
        SkillBase.s_CfgEternityProxy = m_CfgEternityProxy;
        SetPreditionForAllSkillType();

        // UNDONE, 声音

        PreloadSkill();
    }
        /// <summary>
        /// 弹夹信息,只有主角才有
        /// </summary>
        /// <param name="result"></param>
        private static void DisposeSyncClipInfo(SyncClipInfo result)
        {
            //Leyoutech.Utility.DebugUtility.LogWarning("广播", string.Format("弹夹信息, 武器ID = {0}", result.CurWeaponUid));
            GameplayProxy    m_GameplayProxy = GameFacade.Instance.RetrieveProxy(ProxyName.GameplayProxy) as GameplayProxy;
            SpacecraftEntity entity          = m_GameplayProxy.GetEntityById <SpacecraftEntity>(m_GameplayProxy.GetMainPlayerUID());

            if (entity == null)
            {
                return;
            }

            PlayerSkillProxy m_PlayerSkillProxy = GameFacade.Instance.RetrieveProxy(ProxyName.PlayerSkillProxy) as PlayerSkillProxy;

            m_PlayerSkillProxy.ChangeCurrentWeaponByServer(result.CurWeaponUid);

            foreach (WeaponValue info in result.Infos)
            {
                ulong weaponUID = info.WeaponUid;

                WeaponPowerVO power = entity.GetWeaponPower(weaponUID);
                if (power == null)
                {
                    entity.SetWeaponPower(weaponUID, new WeaponPowerVO());
                    power = entity.GetWeaponPower(weaponUID);
                }

                power.WeaponUID    = info.WeaponUid;
                power.CurrentValue = info.CurValue;
                power.MaxValue     = info.MaxValue;
                power.SafeValue    = info.SaftyValue;

                IWeapon weapon = m_PlayerSkillProxy.GetWeaponByUID(power.WeaponUID);
                if (weapon != null && weapon.GetConfig().ClipType != (int)WeaponL1.Treasure)
                {
                    if (power.CurrentValue <= 0)
                    {
                        power.ForceCooldown = true;
                    }
                    else if (power.CurrentValue >= power.SafeValue)
                    {
                        power.ForceCooldown = false;
                    }
                }
                else
                {
                    if (power.CurrentValue >= power.MaxValue)
                    {
                        power.ForceCooldown = true;
                    }
                    else if (power.CurrentValue <= power.SafeValue)
                    {
                        power.ForceCooldown = false;
                    }
                }
            }

            GameFacade.Instance.SendNotification(NotificationName.MSG_CHARACTER_WEAPON_POWER_CHANGED);
            entity.SendEvent(ComponentEventName.WeaponPowerChanged, null);
        }
Example #5
0
 /// <summary>
 /// 获取PlayerSkillProxy
 /// </summary>
 /// <returns></returns>
 public PlayerSkillProxy GetPlayerSkillProxy()
 {
     if (m_PlayerSkillProxy == null)
     {
         m_PlayerSkillProxy = Facade.RetrieveProxy(ProxyName.PlayerSkillProxy) as PlayerSkillProxy;
     }
     return(m_PlayerSkillProxy);
 }
    public override void OnInitialize(IPerceptronTarget property)
    {
        m_SkillProxy = GameFacade.Instance.RetrieveProxy(ProxyName.PlayerSkillProxy) as PlayerSkillProxy;

        m_IPerceptronTarget = property;
        m_PerceptronTarget  = new PerceptronTarget(property.GetOwner(), GetCurrSkillId, GetSkillBttonIsDown, ToDoChangeGuideSkillTargetAction);
        m_IPerceptronTarget.SetPerceptronTarget(m_PerceptronTarget);
    }
Example #7
0
    public override void OnInitialize(IBattleWeaponProperty property)
    {
        m_Property = property;

        m_CfgSkillProxy    = GameFacade.Instance.RetrieveProxy(ProxyName.CfgSkillSystemProxy) as CfgSkillSystemProxy;
        m_SkillProxy       = GameFacade.Instance.RetrieveProxy(ProxyName.PlayerSkillProxy) as PlayerSkillProxy;
        m_CfgLanguageProxy = GameFacade.Instance.RetrieveProxy(ProxyName.CfgLanguageProxy) as CfgLanguageProxy;
        m_GameplayProxy    = GameFacade.Instance.RetrieveProxy(ProxyName.GameplayProxy) as GameplayProxy;
    }
Example #8
0
    public void OnInitialize(EntityManager entityManager)
    {
        m_EntityManager = entityManager;

        ListenGameServer();

        m_GameplayProxy    = GameFacade.Instance.RetrieveProxy(ProxyName.GameplayProxy) as GameplayProxy;
        m_PlayerSkillProxy = GameFacade.Instance.RetrieveProxy(ProxyName.PlayerSkillProxy) as PlayerSkillProxy;
    }
Example #9
0
    public WeaponAndCrossSight(ulong uId, uint tId, ulong skillId)
    {
        m_CfgEternityProxy = GameFacade.Instance.RetrieveProxy(ProxyName.CfgEternityProxy) as CfgEternityProxy;
        m_PlayerSkillProxy = GameFacade.Instance.RetrieveProxy(ProxyName.PlayerSkillProxy) as PlayerSkillProxy;
        m_GameplayProxy    = GameFacade.Instance.RetrieveProxy(ProxyName.GameplayProxy) as GameplayProxy;

        m_UId         = uId;
        m_SkillID     = skillId;
        m_WeaponTable = m_CfgEternityProxy.GetWeapon(tId);
    }
Example #10
0
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="entity">感知所属于的单位</param>
        public PerceptronTarget(BaseEntity entity, Func <int> GetCurrSkillId, Func <bool> GetSkillBttonIsDown, Action GetChangeGuideSkillTargetAction)
        {
            m_OwnerEntity                     = entity;
            m_GetCurrSkillId                  = GetCurrSkillId;
            m_GetSkillBttonIsDown             = GetSkillBttonIsDown;
            m_GetChangeGuideSkillTargetAction = GetChangeGuideSkillTargetAction;

            m_CfgEternityProxy = GameFacade.Instance.RetrieveProxy(ProxyName.CfgEternityProxy) as CfgEternityProxy;
            m_SkillProxy       = GameFacade.Instance.RetrieveProxy(ProxyName.PlayerSkillProxy) as PlayerSkillProxy;
            m_GameplayProxy    = GameFacade.Instance.RetrieveProxy(ProxyName.GameplayProxy) as GameplayProxy;
        }
Example #11
0
    public BattleWeaponBase(IWeapon weapon)
    {
        m_CfgEternityProxy = GameFacade.Instance.RetrieveProxy(ProxyName.CfgEternityProxy) as CfgEternityProxy;
        m_GameplayProxy    = GameFacade.Instance.RetrieveProxy(ProxyName.GameplayProxy) as GameplayProxy;
        m_PlayerSkillProxy = GameFacade.Instance.RetrieveProxy(ProxyName.PlayerSkillProxy) as PlayerSkillProxy;
        m_MainPlayer       = m_GameplayProxy.GetMainPlayer();
        m_WeaponItem       = weapon;
        m_Type             = GetBattleWeaponTypeByReticle(weapon.GetConfig().Reticle);

        m_WeaponConfig = GetWeaponConfig();
    }
 public override void Initialize()
 {
     m_RaycastProxy     = Facade.RetrieveProxy(ProxyName.RaycastProxy) as RaycastProxy;
     m_PlayerSkillProxy = Facade.RetrieveProxy(ProxyName.PlayerSkillProxy) as PlayerSkillProxy;
     m_GameplayProxy    = Facade.RetrieveProxy(ProxyName.GameplayProxy) as GameplayProxy;
     m_CfgEternityProxy = Facade.RetrieveProxy(ProxyName.CfgEternityProxy) as CfgEternityProxy;
     m_Root             = FindComponent <Animator>("Content");
     m_LineGridHorizontalLayoutGroup = FindComponent <HorizontalLayoutGroup>("Content/Slider/LineGrid");
     m_LineGridRect = FindComponent <RectTransform>("Content/Slider/Image_Bar/LineGrid");
     m_HpBarRect    = FindComponent <RectTransform>("Content/Slider/Image_Bar");
     m_LineGrid     = FindComponent <Transform>("Content/Slider/Image_Bar/LineGrid");
     m_HpBar        = FindComponent <Image>("Content/Slider/Image_Bar");
     m_HpBarLabel   = FindComponent <TMP_Text>("Content/Slider/Label_Value");
     m_HpBarState   = FindComponent <TMP_Text>("Content/Slider/Label_Message");
     m_TargetImage  = FindComponent <CanvasGroup>("Content/Bg/Model");
     m_TargetList   = new List <uint>();
 }
Example #13
0
    public override void OnShow(object msg)
    {
        base.OnShow(msg);

        m_SkillProxy    = GameFacade.Instance.RetrieveProxy(ProxyName.PlayerSkillProxy) as PlayerSkillProxy;
        m_GameplayProxy = GameFacade.Instance.RetrieveProxy(ProxyName.GameplayProxy) as GameplayProxy;

        AddHotKey(HotKeyMapID.SHIP, HotKeyID.ShipSkill1, OnSkill1, m_SkillHotkey1, "", HotkeyManager.HotkeyStyle.UI_SIMPLE);
        AddHotKey(HotKeyMapID.SHIP, HotKeyID.ShipSkill2, OnSkill2, m_SkillHotkey2, "", HotkeyManager.HotkeyStyle.UI_SIMPLE);
        AddHotKey(HotKeyMapID.SHIP, HotKeyID.ShipSkill3, OnSkill3, m_SkillHotkey3, "", HotkeyManager.HotkeyStyle.UI_SIMPLE);
        AddHotKey(HotKeyMapID.SHIP, HotKeyID.ShipSkill4, OnSkill4, m_SkillHotkey4, "", HotkeyManager.HotkeyStyle.UI_SIMPLE);

        UpdateSkillIcon();
        UpdateSkillCooldown();

        StartUpdate();
    }
Example #14
0
    public override void OnInitialize(ISpacecraftInputProperty property)
    {
        m_SpacecraftInputProperty = property;
        m_PlayerSkillProxy        = GameFacade.Instance.RetrieveProxy(ProxyName.PlayerSkillProxy) as PlayerSkillProxy;
        m_GamePlayProxy           = GameFacade.Instance.RetrieveProxy(ProxyName.GameplayProxy) as GameplayProxy;
        m_EternityProxy           = GameFacade.Instance.RetrieveProxy(ProxyName.CfgEternityProxy) as CfgEternityProxy;

        Vector3 rotation = property.GetRigidbody() ? property.GetRigidbody().rotation.eulerAngles : Vector3.zero;

        m_Rotation.x = rotation.x;
        m_Rotation.y = rotation.y;
        ClampRotation();
        Quaternion quaternion = Quaternion.Euler(m_Rotation);

        m_RotateAxis = (quaternion * Vector3.forward).normalized;

        m_SixDofCursorRange = m_EternityProxy.GetGamingConfig(1).Value.CmCharacter.Value.SixDofCursorRange;
    }
    /// <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;
	}
Example #16
0
        public override void Trigger()
        {
            IBaseActionProperty property = m_Context.GetObject <IBaseActionProperty>();

            if (!property.IsMain())
            {
                return;
            }

            AffectCDData cdData    = GetData <AffectCDData>();
            SkillData    skillData = m_Context.GetObject <SkillData>();

            PlayerSkillProxy skillProxy = GameFacade.Instance.RetrieveProxy(ProxyName.PlayerSkillProxy) as PlayerSkillProxy;

            for (int i = 0; i < cdData.CdDatasLength; ++i)
            {
                CdData data = cdData.CdDatas(i).Value;
                skillProxy.AddCD(skillData.Id, data.CdType, data.CdTime);
            }
        }
        public override void OnInitialize(ISpacecraftSkillProperty property)
        {
            m_ISpacecraftSkillProperty = property;
            m_CfgEternityProxy         = GameFacade.Instance.RetrieveProxy(ProxyName.CfgEternityProxy) as CfgEternityProxy;
            m_PlayerSkillProxy         = GameFacade.Instance.RetrieveProxy(ProxyName.PlayerSkillProxy) as PlayerSkillProxy;

            m_Context     = new DefaultContext();
            m_RunningData = new SkillRunningData();

            m_Context.AddObject(this, true);
            m_Context.AddObject(typeof(IActionFactory), TimelineActionFactory.Factory, true);
            m_Context.AddObject(m_RunningData, true);
            m_Context.AddObject(typeof(IBaseActionProperty), property, true);
            m_Context.AddObject(typeof(IBindNodeActionProperty), property, true);

            ContextAddOtherObject();

            m_StateMachine = new SkillStateMachine(m_Context);
            m_StateMachine.CompletedHandler += OnStateMachineComplete;
            m_StateMachine.ChangedHandler   += OnStateMachineChanged;
        }
Example #18
0
    /// <summary>
    /// 武器切换时
    /// </summary>
    /// <param name="hiddenRoot">是否隐藏根节点</param>
    private void OnWeaponToggleEnd(bool hiddenRoot)
    {
        m_Root.alpha = hiddenRoot ? 0 : 1;

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

        IWeapon currWeapon = skillProxy.GetCurrentWeapon();

        if (currWeapon != null)
        {
            IWeapon mainWeapon      = skillProxy.GetWeaponByIndex(0);
            IWeapon secondaryWeapon = skillProxy.GetWeaponByIndex(1);

            m_MainWeapon.gameObject.SetActive(true);
            m_SecondaryWeapon.gameObject.SetActive(true);

            m_MainWeapon.ResetTrigger("Big");
            m_MainWeapon.ResetTrigger("Small");

            m_SecondaryWeapon.ResetTrigger("Big");
            m_SecondaryWeapon.ResetTrigger("Small");

            m_RootAnimator.ResetTrigger("Show");
            m_RootAnimator.SetTrigger("Show");

            if (skillProxy.UsingReformer())
            {
                if (currWeapon.GetPos() == 0)
                {
                    m_MainWeapon.SetTrigger("Big");
                    m_SecondaryWeapon.SetTrigger("Small");
                    m_SecondaryWeapon.gameObject.SetActive(secondaryWeapon != null);
                }
                else if (currWeapon.GetPos() == 1)
                {
                    m_MainWeapon.SetTrigger("Small");
                    m_SecondaryWeapon.SetTrigger("Big");
                    m_MainWeapon.gameObject.SetActive(mainWeapon != null);
                }
            }
            else
            {
                if (currWeapon.GetPos() == 0)
                {
                    m_MainWeapon.SetTrigger("Big");
                    m_SecondaryWeapon.SetTrigger("Small");
                    m_SecondaryWeapon.gameObject.SetActive(secondaryWeapon != null);
                }
                else if (currWeapon.GetPos() == 1)
                {
                    m_MainWeapon.SetTrigger("Small");
                    m_SecondaryWeapon.SetTrigger("Big");
                    m_MainWeapon.gameObject.SetActive(mainWeapon != null);
                }
            }

            m_MainWeapon.gameObject.SetActive(mainWeapon != null);
            if (mainWeapon != null)
            {
                UIUtil.SetIconImage(m_MainWeaponIcon, mainWeapon.GetBaseConfig().Icon);
            }

            m_SecondaryWeaponIcon.gameObject.SetActive(secondaryWeapon != null);
            if (secondaryWeapon != null)
            {
                UIUtil.SetIconImage(m_SecondaryWeaponIcon, secondaryWeapon.GetBaseConfig().Icon);
            }
        }
        else
        {
            m_MainWeapon.gameObject.SetActive(false);
            m_SecondaryWeapon.gameObject.SetActive(false);
        }
    }
    /// <summary>
    /// 更新武器的子弹信息
    /// </summary>
    private void UpdateWeaponBullets()
    {
        if (m_Crosshair != null && m_WeaponStyle != WeaponAndCrossSight.WeaponAndCrossSightTypes.Null)
        {
            Transform powerSlider = FindComponent<Transform>(m_Crosshair, "Slider");
            Animator powerSliderAnimator = FindComponent<Animator>(m_Crosshair, "Slider");
            if (powerSlider == null)
                return;

            PlayerSkillProxy skillProxy = Facade.RetrieveProxy(ProxyName.PlayerSkillProxy) as PlayerSkillProxy;
            if (skillProxy.UsingReformer())
            {
                powerSlider.gameObject.SetActive(false);
                return;
            }

            IWeapon currentWeapon = skillProxy.GetCurrentWeapon();
            if (currentWeapon == null)
            {
                powerSlider.gameObject.SetActive(false);
                return;
            }

            WeaponPowerVO weaponVO1 = skillProxy.GetWeaponPowerOfMainPlayer(0);
            WeaponPowerVO weaponVO2 = skillProxy.GetWeaponPowerOfMainPlayer(1);

            WeaponPowerVO power = weaponVO1 != null && skillProxy.GetWeaponByUID(weaponVO1.WeaponUID) == currentWeapon ? weaponVO1 : weaponVO2;

            float curr = 0;
            float total = 0;

			if (power != null)
			{
				if (m_WeaponStyle == WeaponAndCrossSight.WeaponAndCrossSightTypes.MachineGun  )
				{
					curr = power.CurrentValue;
					total = power.MaxValue;
				}
				else if (m_WeaponStyle == WeaponAndCrossSight.WeaponAndCrossSightTypes.Missile)
				{
					foreach (var entity in m_CurrentTargetList.Values)
					{
						curr += entity.LockTimes;
					}
                    total = MaxMissileCount;// skillProxy.GetCurrentBattleWeapon().GetRelativeHeightOfReticle().MissileCountInOneShot;
				}
				else if ((int)m_WeaponStyle ==(int)WeaponAndCrossSight.WeaponAndCrossSightTypes.ShotGun)
				{
					curr = power.CurrentValue;
					total = power.MaxValue;
				}
			}

			float weaponPowerRatio = total != 0 ? curr / total : 0;

            if (powerSliderAnimator)
            {
                if (power.ForceCooldown)
                    powerSliderAnimator.SetInteger("State", 2);
                else if (weaponPowerRatio <= 0.7f)
                    powerSliderAnimator.SetInteger("State", 0);
                else if (weaponPowerRatio > 0.7f)
                    powerSliderAnimator.SetInteger("State", 1);

                if (m_lastFireFail)
                    powerSliderAnimator.SetTrigger("FireFail");
            }

            m_lastFireFail = false;

            RadialSlider radialSlider = powerSlider.GetComponent<RadialSlider>();
            if(radialSlider)
            {
                radialSlider.FillAmount = weaponPowerRatio;
                return;
            }

            BulletSlider bulletSlider = powerSlider.GetComponent<BulletSlider>();
            if(bulletSlider)
            {
                bulletSlider.BulletCount = (int)total;
                bulletSlider.FillAmount = weaponPowerRatio;
                return;
            }

            Slider commonSlider = powerSlider.GetComponent<Slider>();
            if(commonSlider)
            {
                commonSlider.minValue = 0;
                commonSlider.maxValue = 1;
                commonSlider.value = weaponPowerRatio;
                return;
            }
        }
    }
Example #20
0
    public override void Execute(INotification notification)
    {
        PlayerSkillProxy skillProxy = GameFacade.Instance.RetrieveProxy(ProxyName.PlayerSkillProxy) as PlayerSkillProxy;

        skillProxy.ToggleCurrentWeapon();
    }
    /// <summary>
    /// 更新目标列表
    /// </summary>
    private void UpdateTargetList()
    {
        if (m_TargetBox == null)
            return;

        int index = 0;

        if (m_CurrentTargetList != null)
        {
            if (m_CurrentTargetListClearTime > 0 && Time.time > m_CurrentTargetListClearTime)
            {
                m_CurrentTargetList.Clear();
                m_CurrentTargetListClearTime = -1;
            }
        }

        if (m_CurrentTargetList != null)
        {
            GameplayProxy gameplay = Facade.RetrieveProxy(ProxyName.GameplayProxy) as GameplayProxy;
            PlayerSkillProxy skillProxy = Facade.RetrieveProxy(ProxyName.PlayerSkillProxy) as PlayerSkillProxy;

            RectTransform template = m_TargetBox.GetChild(0).GetComponent<RectTransform>();

            //BattleWeapon_Missile_CenterLock missile = skillProxy.GetCurrentBattleWeapon() as BattleWeapon_Missile_CenterLock;
            //float time = 0;
            //if (missile != null)
            //{
            //    // 临时代码
            //    time = (skillProxy.GetCurrentBattleWeapon() as BattleWeapon_Missile_CenterLock).GetLockonTime();
            //}

            foreach (ulong entityId in m_CurrentTargetList.Keys)
            {
                BaseEntity entity = GameplayManager.Instance.GetEntityManager().GetEntityById<BaseEntity>((uint)entityId);
                if (!entity) continue;


                var targetInfo = m_CurrentTargetList[entityId];

                //屏幕外忽略
                Vector3 viewportPoint = Camera.main.WorldToViewportPoint(entity.GetRootTransform().position);
                if (!(viewportPoint.x >= 0 && viewportPoint.y >= 0 && viewportPoint.x <= 1 && viewportPoint.y <= 1 && viewportPoint.z > Camera.main.nearClipPlane))
                    continue;

                Vector2 viewPosition;
                Vector3 screenPosition = Camera.main.WorldToScreenPoint(entity.GetRootTransform().position);
                if (RectTransformUtility.ScreenPointToLocalPointInRectangle(m_TargetBox, screenPosition, m_Camera, out viewPosition))
                {
                    RectTransform view = index < m_TargetBox.childCount ? m_TargetBox.GetChild(index).GetComponent<RectTransform>() : Object.Instantiate(template, m_TargetBox);
                    view.gameObject.SetActive(true);
                    view.anchoredPosition = viewPosition;

                    RectTransform loadingBox = view.Find("Loading").GetComponent<RectTransform>();
                    loadingBox.gameObject.SetActive(targetInfo.LockState == WeaponAndCrossSight_Missile.TargetLockState.Locking);
                    if (loadingBox.gameObject.activeSelf)
                        loadingBox.Find("Image_loading").GetComponent<Image>().fillAmount = (MissileLockTime - targetInfo.LockTimeRemaining) / MissileLockTime;

                    RectTransform lockedBox = view.Find("Locked").GetComponent<RectTransform>();
                    lockedBox.gameObject.SetActive(targetInfo.LockTimes >= 1);

                    RectTransform countBox = view.Find("Count").GetComponent<RectTransform>();
                    countBox.gameObject.SetActive(targetInfo.LockTimes > 1);
                    if (countBox.gameObject.activeSelf)
                        countBox.Find("Label_Count").GetComponent<TMP_Text>().text = targetInfo.LockTimes.ToString();

                    index++;
                }
            }
        }

        for (int i = index; i < m_TargetBox.childCount; i++)
        {
            m_TargetBox.GetChild(i).gameObject.SetActive(false);
        }
    }
        /// <summary>
        /// 道具各种操作
        /// </summary>
        /// <param name="buf"></param>
        private void OnItemChange(KProtoBuf buf)
        {
            S2C_ITEM_OPERATE_LIST msg = buf as S2C_ITEM_OPERATE_LIST;

            if (msg.errcode == 0)
            {
                ItemOperateInfoTemp.OperateType weaponOperate = 0;
                Category     category = 0;
                int          pos      = 0;
                ulong        uid      = 0;
                List <ulong> ships    = new List <ulong>();
                for (int i = 0; i < msg.op_list.Count; i++)
                {
                    ItemOperate itemMsg = msg.op_list[i];
                    switch ((ItemProcessType)itemMsg.type)
                    {
                    case ItemProcessType.IPTAddItem:
                        //操作顺序不可修改
                        Category mainType = GetPackageProxy().AddItem(false, itemMsg.uid, itemMsg.tid, itemMsg.parent, itemMsg.pos, itemMsg.count, itemMsg.cur_capacity, itemMsg.reference, itemMsg.create_time);
                        GetPackageProxy().ChangeItemAttr(itemMsg.uid, itemMsg.lv, itemMsg.exp);
                        category = GetPackageProxy().CheckMarkItemAdd(msg.mark, itemMsg.uid);
                        if (category == Category.Weapon)
                        {
                            if (weaponOperate == ItemOperateInfoTemp.OperateType.Remove)
                            {
                                weaponOperate = ItemOperateInfoTemp.OperateType.Replace;
                                pos           = itemMsg.pos;
                                uid           = itemMsg.uid;
                            }
                            else
                            {
                                weaponOperate = ItemOperateInfoTemp.OperateType.Add;
                                pos           = itemMsg.pos;
                                uid           = itemMsg.uid;
                            }
                        }
                        if (mainType == Category.Warship)
                        {
                            ships.Add(itemMsg.uid);
                        }
                        //
                        break;

                    case ItemProcessType.IPTDeleteItem:
                        //操作顺序不可修改
                        category = GetPackageProxy().CheckMarkItemRemove(msg.mark, itemMsg.uid);
                        GetPackageProxy().RemoveItem(itemMsg.uid);
                        if (category == Category.Weapon)
                        {
                            weaponOperate = ItemOperateInfoTemp.OperateType.Remove;
                            pos           = itemMsg.pos;
                            uid           = itemMsg.uid;
                        }
                        //
                        break;

                    case ItemProcessType.IPTStackChange:
                        GetPackageProxy().ChangeStackCount(itemMsg.uid, itemMsg.count);
                        break;

                    case ItemProcessType.IPTPositionChange:
                        GetPackageProxy().ChangePosition(itemMsg.uid, itemMsg.parent, itemMsg.pos);
                        break;

                    case ItemProcessType.IPTCapacityChange:
                        GetPackageProxy().ChangeContainerSize(itemMsg.uid, itemMsg.cur_capacity);
                        break;
                    }
                }
                switch ((ItemOperateType)msg.op_type)
                {
                case ItemOperateType.IOTAddItem:
                    GameFacade.Instance.SendNotification(NotificationName.MSG_PACKAGE_ITEM_ADD);
                    break;

                case ItemOperateType.IOTDestoryItem:
                    GameFacade.Instance.SendNotification(NotificationName.MSG_PACKAGE_ITEM_DESTORY);
                    break;

                case ItemOperateType.IOTConsumeItem:
                    GameFacade.Instance.SendNotification(NotificationName.MSG_PACKAGE_ITEM_CONSUME);
                    break;

                case ItemOperateType.IOTMoveItem:
                    GameFacade.Instance.SendNotification(NotificationName.MSG_PACKAGE_ITEM_MOVE);
                    break;

                case ItemOperateType.IOTSkillChanged:
                {
                    PlayerSkillProxy skillProxy = GameFacade.Instance.RetrieveProxy(ProxyName.PlayerSkillProxy) as PlayerSkillProxy;
                    skillProxy.RefreshShipSkills();
                }
                break;
                }

                if (weaponOperate != 0)
                {
                    ItemOperateInfoTemp info = new ItemOperateInfoTemp();
                    info.Category = Category.Weapon;
                    info.Type     = weaponOperate;
                    info.Pos      = pos;
                    info.UID      = uid;
                    GameFacade.Instance.SendNotification(NotificationName.MSG_PACKAGE_ITEM_OPERATE, info);

                    ItemOperateEvent itemEvent = new ItemOperateEvent();
                    info.Category = Category.Weapon;
                    info.Type     = weaponOperate;
                    info.Pos      = pos;
                    info.UID      = uid;

                    GameplayProxy    gameplayProxy = GameFacade.Instance.RetrieveProxy(ProxyName.GameplayProxy) as GameplayProxy;
                    SpacecraftEntity entity        = gameplayProxy.GetMainPlayer();

                    entity?.SendEvent(ComponentEventName.ItemInPackageChanged, itemEvent);
                }
                if (ships.Count > 0)
                {
                    ShipProxy shipProxy = GameFacade.Instance.RetrieveProxy(ProxyName.ShipProxy) as ShipProxy;
                    foreach (ulong id in ships)
                    {
                        shipProxy.ChangeShipPackage(id);
                    }
                }
            }
        }