Example #1
0
    private void OnAddBuff(IComponentEvent componentEvent)
    {
        AddBuffEvent notification = (AddBuffEvent)componentEvent;

        m_Property.AddBuff(notification.buff);
        m_Property.GetBuff(notification.buff.ID)?.OnAddBuff();
    }
Example #2
0
    private void OnRemoveBuff(IComponentEvent componentEvent)
    {
        RemoveBuffEvent notification = (RemoveBuffEvent)componentEvent;

        m_Property.GetBuff(notification.buffID)?.OnRemoveBuff();
        m_Property.RemoveBuff(notification.buffID);
    }
Example #3
0
 // TODO BUFF. 想办法使用统一的通知. 或者直接把Buff的响应函数注册为消息回调
 private void OnSkillHit(IComponentEvent componentEvent)
 {
     foreach (KeyValuePair <uint, Buff> buffID2Value in m_Property.GetAllBuffs())
     {
         buffID2Value.Value.BuffEffect.OnEvent(ComponentEventName.MSG_SKILL_HIT, componentEvent);
     }
 }
Example #4
0
    /// <summary>
    /// 在武器变化的时候, 更新当前实装的武器的准星信息
    /// </summary>
    private void UpdateBattleWeapons(IComponentEvent entityEvent)
    {
        ItemOperateEvent itemEvent = entityEvent as ItemOperateEvent;

        Dictionary <ulong, BattleWeaponBase> newBattleWeapons = new Dictionary <ulong, BattleWeaponBase>();

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

            // 获取iWeapon对应武器的UID
            ulong uid = weapon.GetUID();
            // 查看当前是否有这把武器的准星信息
            if (m_Property.HaveBattleWeapon(uid))
            {
                newBattleWeapons.Add(uid, m_Property.GetBattleWeapon(uid));
            }
            else
            {
                BattleWeaponBase.BattleWeaponType weaponType = BattleWeaponBase.GetBattleWeaponTypeByReticle(weapon.GetConfig().Reticle);
                newBattleWeapons.Add(uid, CreateNewBattleWeapon(weaponType, weapon));
            }
        }

        m_Property.ResetBattleWeapons(newBattleWeapons);
    }
Example #5
0
    public void OnResetRotation(IComponentEvent componentEvent)
    {
        ResetRotation resetRotation = componentEvent as ResetRotation;

        if (resetRotation.Type == MotionType.Dof4)
        {
            m_IsTweening  = false;
            m_MouseStick  = Vector2.zero;
            m_MouseStick6 = Vector2.zero;
            m_RotateAxis  = Vector3.zero;
            CameraManager.GetInstance().GetMainCamereComponent().SetTrackedObjectOffset(MainCameraComponent.CMType.Jet, Vector2.zero);
        }
        else if (resetRotation.Type == MotionType.Dof6)
        {
            m_IsTweening = false;
            m_MouseStick = Vector2.zero;
            Vector3 rotation = m_SpacecraftInputProperty.GetSyncTarget().eulerAngles;
            m_Rotation.x = rotation.x;
            m_Rotation.y = rotation.y;
            ClampRotation();
            Quaternion quaternion = Quaternion.Euler(m_Rotation);
            m_RotateAxis = (quaternion * Vector3.forward).normalized;
            CameraManager.GetInstance().GetMainCamereComponent().SetTrackedObjectOffset(MainCameraComponent.CMType.JetSpeedUp, Vector2.zero);
        }
    }
        /// <summary>
        /// 随机发射点索引结果
        /// </summary>
        /// <param name="obj"></param>
        public void OnRandomEmitNodeResult(IComponentEvent obj)
        {
            RandomEmitNodeResult result = obj as RandomEmitNodeResult;

            if (result == null)
            {
                return;
            }

            EmitSelectionData emitSelectionData = m_Context.GetObject <SkillRunningData>().EmitSelectoin;//发射口选择数据

            EmitData[] emitDatas = new EmitData[result.emitNode.IndexList.Count];
            for (int i = 0; i < result.emitNode.IndexList.Count; ++i)
            {
                emitDatas[i] = new EmitData()
                {
                    NodeType  = (BindNodeType)result.emitNode.NodeType,
                    NodeIndex = result.emitNode.IndexList[i],
                };
            }
            emitSelectionData.AddOrUpdateEmit(result.emitNode.AssignIndex, emitDatas);

            //恢复时间轴
            DoResumeSkill();
        }
Example #7
0
    private void OnChangeMotionType(IComponentEvent componentEvent)
    {
        MotionType          motionType          = m_Property.GetMotionType();
        MainCameraComponent mainCameraComponent = CameraManager.GetInstance().GetMainCamereComponent();

        switch (motionType)
        {
        case MotionType.Mmo:
            if (mainCameraComponent.GetLastCMType() != MainCameraComponent.CMType.Spacecraft &&
                !mainCameraComponent.HasInChanngingCMs(MainCameraComponent.CMType.Spacecraft))
            {
                mainCameraComponent.RequestChangeCM(MainCameraComponent.CMType.Spacecraft);
            }
            break;

        case MotionType.Dof4:
            if (mainCameraComponent.GetLastCMType() != MainCameraComponent.CMType.Jet &&
                !mainCameraComponent.HasInChanngingCMs(MainCameraComponent.CMType.Jet))
            {
                mainCameraComponent.ForceChangeCM(MainCameraComponent.CMType.Jet);
            }
            break;

        case MotionType.Dof6:
            if (mainCameraComponent.GetLastCMType() != MainCameraComponent.CMType.JetSpeedUp &&
                !mainCameraComponent.HasInChanngingCMs(MainCameraComponent.CMType.JetSpeedUp))
            {
                mainCameraComponent.ForceChangeCM(MainCameraComponent.CMType.JetSpeedUp);
            }
            break;

        default:
            break;
        }
    }
Example #8
0
        /// <summary>
        /// 切换状态到 EndStage
        /// </summary>
        /// <param name="obj"></param>
        public void DoEnd(IComponentEvent obj)
        {
            FlyerTriggerToEnitity trigger = obj as FlyerTriggerToEnitity;

            Leyoutech.Utility.DebugUtility.LogWarning("子弹", string.Format("DoEnd --> 碰撞到单位了 who = {0}", trigger.targetEntity));
            StageType = FlyerStageType.End;
        }
Example #9
0
    private void OnShipJumpResponse(IComponentEvent obj)
    {
        ShipJumpResponseEvent @event = obj as ShipJumpResponseEvent;

        Assets.Scripts.Proto.S2C_SHIP_JUMP_RESPONSE data = @event.Data;

        switch (data.request_jump)
        {
        // 请求跃迁
        case 1:
            if (!m_LeapOwnPre)
            {
                m_LeapOwnPre = EffectManager.GetInstance()
                               .CreateEffect(Leyoutech.Core.Loader.Config.AssetAddressKey.FX_EFFECT_SKILL_YUEQIAN_OWN_PRE
                                             , EffectManager.GetEffectGroupNameInSpace(m_IsMain));
                m_LeapOwnPre.transform.SetParent(m_SpacecraftPlayerAnimatorProperty.GetOwner().GetSkinRootTransform(), false);
                m_LeapOwnPre.SetCreateForMainPlayer(m_IsMain);
                m_LeapOwnPre.SetAutoRecycleWhenNotExistLivingParticles(false);
            }
            m_LeapOwnPre.PlayFX();
            break;

        // 中止跃迁
        case 0:
            m_LeapOwnPre?.StopFX();
            break;

        default:
            Leyoutech.Utility.DebugUtility.Assert(false, string.Format("not handle request_jump({0})", data.request_jump));
            break;
        }
    }
Example #10
0
 /// <summary>
 /// 输入采样事件
 /// </summary>
 /// <param name="componentEvent"></param>
 private void OnInputSample(IComponentEvent componentEvent)
 {
     SendEvent(ComponentEventName.ChangeHumanInputState, new ChangeHumanInputStateEvent()
     {
         EngineAxis = m_EngineAxis
     });
 }
    /// <summary>
    /// 转化炉的聚气
    /// 这是一个纯客户端表现的事. 聚气0.5秒后再按某个键开启转化炉
    /// </summary>
    /// <param name="componentEvent"></param>
    private void OnBurstPressed(IComponentEvent componentEvent)
    {
        ActivateBurstPressedEvent burstReadyEvent = componentEvent as ActivateBurstPressedEvent;

        if (burstReadyEvent.Ready)
        {
            if (m_Presentation != null)
            {
                if (m_ReformerReadyFX == null && Leyoutech.Utility.EffectUtility.IsEffectNameValid(m_Presentation.ReformerChargingFXAddress))
                {
                    m_ReformerReadyFX = EffectManager.GetInstance().CreateEffect(m_Presentation.ReformerChargingFXAddress, EffectManager.GetEffectGroupNameInSpace(m_Property.IsMain()));
                    m_ReformerReadyFX.transform.SetParent(m_Property.GetSkinRootTransform(), false);
                    m_ReformerReadyFX.SetCreateForMainPlayer(m_Property.IsMain());
                    m_ReformerReadyFX.SetAutoRecycleWhenNotExistLivingParticles(false);
                }
                else
                {
                    m_ReformerReadyFX.PlayFX();
                }
            }
        }
        else
        {
            m_ReformerReadyFX?.StopFX();
        }
    }
    private void OnDead(IComponentEvent componentEvent)
    {
        if (m_ReformerReadyFX != null)
        {
            m_ReformerReadyFX.StopFX();
        }

        if (m_OverloadLoopFX != null)
        {
            m_OverloadLoopFX.StopFX();
        }

        if (m_ReformerLoopFX != null)
        {
            m_ReformerLoopFX.StopFX();
        }

        if (m_HideFxInstance != null)
        {
            m_HideFxInstance.StopFX();
        }

        /// 探测器死亡播连线收回
        if (m_LineFxInstance != null)
        {
            if (m_Property.GetHeroType() == KHeroType.htDisturbor)
            {
                RemoveLineEffect();
            }
            else
            {
                m_LineFxInstance.StopFX();
            }
        }

        if (m_EnergyBodyFxInstance != null)
        {
            m_EnergyBodyFxInstance.StopFX();
        }

        if (m_DeadCorpseFxInstance != null)
        {
            m_DeadCorpseFxInstance.StopFX();
        }

        if (m_DeadSlidingFxInstance != null)
        {
            m_DeadSlidingFxInstance.StopFX();
        }

        if (m_OutlineVFX != null)
        {
            m_OutlineVFX.StopFX();
        }

        if (m_Property.GetHeroType() == KHeroType.htMine && m_Property.GetOwner().m_EntityFatherOwnerID > 0)
        {
            m_GameplayProxy.RemoveEntityFromEntityGroup(m_Property.GetOwner().m_EntityFatherOwnerID, m_Property.GetOwner());
        }
    }
Example #13
0
    private void OnDead(IComponentEvent obj)
    {
        if (m_LeapOwnPre != null)
        {
            m_LeapOwnPre.StopFX();
        }

        if (m_LeapOwnPreBurst != null)
        {
            m_LeapOwnPreBurst.StopFX();
        }

        if (m_LeapOwnOutScreen != null)
        {
            m_LeapOwnOutScreen.StopFX();
        }

        if (m_LeapCamera != null)
        {
            m_LeapCamera.StopFX();
        }

        if (m_LeapTPSIn != null)
        {
            m_LeapTPSIn.StopFX();
        }
    }
Example #14
0
    /// <summary>
    /// 其他人开始吟唱技能
    /// </summary>
    /// <param name="buf"></param>
    private void OnSingSkill_ServerMessage(IComponentEvent componentEvent)
    {
        S2C_SING_SKILL_Event respond = componentEvent as S2C_SING_SKILL_Event;

        if (IsReleasingSkill((int)respond.msg.skillID))
        {
            SendEventToSkill((int)respond.msg.skillID, SkillControlEvent.ServerMsg_OnSing
                             , new SkillEventParam()
            {
                ServerMessage = respond.msg
            });
        }
        else
        {
            if (!m_Property.IsMain())
            {
                ReleaseSkillByServerMessage((int)respond.msg.skillID
                                            , respond.msg.target_id
                                            , new Vector3(respond.msg.x, respond.msg.y, respond.msg.z)
                                            , respond.msg.hanging_point_id);
            }
            else
            {
                // 只有其他玩家和怪物才可能因为服务器通知而被动释放技能.
                // 主角是出现这种情况原因:
                // 1. 客户端预言技能, 已经释放完了
                // 2. 服务器消息顺序错误
            }
        }
    }
    /// <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);
            }
        }
    }
 public void SendEvent(ComponentEventName eventName, IComponentEvent entityEvent)
 {
     if (m_ListenTable.ContainsKey(eventName))
     {
         m_RecursiveDepth++;
         if (m_RecursiveDepth > RECURSIVE_DEPTH_MAX)
         {
             throw new Exception("SendEvent Recursive Depth is Max");
         }
         if (m_ListenTable[eventName] == null)
         {
             throw new Exception("m_ListenTable[] is null " + eventName);
         }
         try
         {
             m_ListenTable[eventName]?.Invoke(entityEvent);
         }
         catch (Exception ex)
         {
             UnityEngine.Debug.LogException(ex);
             //throw ex;
         }
         finally
         {
             m_RecursiveDepth--;
         }
     }
 }
Example #17
0
    private void OnShowDeadExplosionFx(IComponentEvent obj)
    {
        Model model = m_Cgeternityproxy.GetItemModelByKey(m_SpacecraftSoundProperty.GetItemID());

        if (model.DieSound > 0)
        {
            PlaySound((int)model.DieSound, m_SpacecraftSoundProperty.GetRootTransform());
        }
        //else
        //{
        /// TODO 系统语音
        //	if (m_SpacecraftSoundProperty.GetHeroType() == KHeroType.htPlayer)
        //	{
        //		WwiseUtil.PlaySound(m_MusicComboID, WwiseMusicSpecialType.SpecialType_Die_End, m_WwiseMusicPalce, false, m_SpacecraftSoundProperty.GetRootTransform());
        //	}
        //	/// TODO.死亡爆炸音效先写死
        //	else if (m_SpacecraftSoundProperty.GetHeroType() == KHeroType.htMonster
        //		|| m_SpacecraftSoundProperty.GetHeroType() == KHeroType.htDisturbor
        //		|| m_SpacecraftSoundProperty.GetHeroType() == KHeroType.htNormalChestGuard
        //		|| m_SpacecraftSoundProperty.GetHeroType() == KHeroType.htRareChestGuard)
        //	{
        //		WwiseUtil.PlaySound((int)WwiseMusic.Music_Npc_Dead_End, false, m_SpacecraftSoundProperty.GetRootTransform());
        //	}
        //}

        //语音
        if (m_SpacecraftSoundProperty.IsMain())
        {
            WwiseUtil.PlaySound(WwiseManager.voiceComboID, WwiseMusicSpecialType.SpecialType_Voice_Ship_Destroyed, WwiseMusicPalce.Palce_1st, false, null);
        }
    }
Example #18
0
 private void OnCheckDeadDrop(IComponentEvent obj)
 {
     //if (m_DropInfoList != null && m_DropInfoList.Count > 0)
     //{
     //	DropItemManager.Instance.SetDropItemInfoByDeath(m_SpacecraftDeadProperty.UId(), m_DropInfoList);
     //}
 }
        /// <summary>
        /// 服务器蓄力索引结果
        /// </summary>
        /// <param name="obj"></param>
        public void OnAccumulationIndexResult(IComponentEvent obj)
        {
            AccumulationIndexResult result = obj as AccumulationIndexResult;

            if (result == null)
            {
                return;
            }

            if (result.skillId != SkillID)
            {
                return;
            }

            SkillData skillData = m_Context.GetObject <SkillData>();
            string    lpc       = string.Empty;

            if (skillData.ReleaseStageData.Value.IsDynamicLoopCount)
            {
                m_RunningData.ReleaseLoopCount = m_ISpacecraftSkillProperty.GetPerceptronTarget().GetCurrentTargetsCount();
                lpc = string.Format("动态loopcout = {0}", m_RunningData.ReleaseLoopCount);
            }

            Leyoutech.Utility.DebugUtility.Log("蓄力", " 蓄力结果  index = " + result.accumulationIndex + lpc);

            m_RunningData.ReleaseStageIndex = result.accumulationIndex;
            StageType = SkillStageType.Release;
        }
Example #20
0
 public PageNavigation(IDeclarationSource navigationSource, IDomain domain, IComponentEvent beforeEvent, string goToPageName, bool isExternal, IComponentEvent afterEvent)
 {
     NavigationSource = navigationSource;
     IsExternal       = isExternal;
     ConnectBefore(domain, beforeEvent);
     ConnectPage(domain, goToPageName);
     ConnectAfter(domain, afterEvent);
 }
Example #21
0
 public void OnPlayStateAnima(IComponentEvent obj)
 {
     if (m_StateAnimator != null)
     {
         PlayStateAnima state = obj as PlayStateAnima;
         m_StateAnimator.SetTrigger(state.Name);
     }
 }
Example #22
0
    /// <summary>
    /// 武器技能发射, 对武器造成影响. 计算新的弹道散布和后坐力
    /// </summary>
    private void PostWeaponFire(IComponentEvent entityEvent)
    {
        // 临时代码. 只有准星类型是1的武器, 才扩散弹道
        IWeapon          weapon = m_SkillProxy.GetCurrentWeapon();
        BattleWeaponBase currentBattleWeapon = m_SkillProxy.GetCurrentBattleWeapon();

        currentBattleWeapon?.PostWeaponFire();
    }
Example #23
0
 /// <summary>
 /// 向当前Entity下的所有Component发送事件
 /// </summary>
 protected void SendEvent(ComponentEventName eventName, IComponentEvent entityEvent)
 {
     if (m_ComponentEventDispatcher == null)
     {
         throw new Exception("m_ComponentEventDispatcher == null");
     }
     m_ComponentEventDispatcher.SendEvent(eventName, entityEvent);
 }
 private void OnRelive(IComponentEvent obj)
 {
     SendEvent(ComponentEventName.ShowReliveFx, null);
     if (m_SpacecraftReliveProperty.IsMain())
     {
         GameFacade.Instance.SendNotification(NotificationName.MainHeroRevive);
         m_SpacecraftReliveProperty.SetUnderAttackWarningToneCountdown(0);
     }
 }
Example #25
0
    /// <summary>
    /// 技能释放不成功, 客户端检查没过. 如果是武器技能, 清空武器状态
    /// </summary>
    private void OnUnsuccessfulReleaseOfSkill(IComponentEvent entityEvent)
    {
        UnsuccessfulReleaseOfSkillEvent skillEvent = entityEvent as UnsuccessfulReleaseOfSkillEvent;

        if (m_CfgSkillProxy.IsWeaponSkill(skillEvent.SkillID))
        {
            ResetRuntimeDataOfAllWeapons();
        }
    }
Example #26
0
    /// <summary>
    /// 武器技能结束
    /// </summary>
    private void WeaponSkillFinished(IComponentEvent entityEvent)
    {
        WeaponSkillFinishedEvent finishEvent = entityEvent as WeaponSkillFinishedEvent;

        IWeapon          weapon = m_SkillProxy.GetCurrentWeapon();
        BattleWeaponBase currentBattleWeapon = m_SkillProxy.GetCurrentBattleWeapon();

        currentBattleWeapon?.OnWeaponSkillFinished(finishEvent.Success);
    }
Example #27
0
    private void OnSkillHotkey(IComponentEvent componentEvent)
    {
        m_SkillCastEvent = componentEvent as SkillCastEvent;

        OnSkillHotkeyImplementation(m_SkillCastEvent);

        // 不是武器技能的持续释放才在这里模拟, 否则在武器模拟
        m_SkillKeyPressed = m_SkillCastEvent.KeyPressed && !m_SkillCastEvent.IsWeaponSkill;
    }
Example #28
0
    /// <summary>
    /// 向Entity发送事件
    /// </summary>
    /// <param name="entityId"></param>
    /// <param name="eventName"></param>
    /// <param name="entityEvent"></param>
    public void SendEventToEntity(uint entityId, ComponentEventName eventName, IComponentEvent entityEvent)
    {
        BaseEntity entity = GetEntityById <BaseEntity>(entityId);

        if (entity != null)
        {
            entity.SendEvent(eventName, entityEvent);
        }
    }
Example #29
0
    private void OnPlayDropSound(IComponentEvent componentEvent)
    {
        Model model = m_Cgeternityproxy.GetItemModelByKey(m_SpacecraftSoundProperty.GetItemID());

        if (model.DropSound > 0)
        {
            PlaySound((int)model.DropSound, m_SpacecraftSoundProperty.GetRootTransform());
        }
    }
        /// <summary>
        /// 强制技能按键抬起
        /// </summary>
        private void OnCoerceSkillButtonUp(IComponentEvent obj)
        {
            Leyoutech.Utility.DebugUtility.Log("技能", "强制技能按键抬起 ");

            if (m_ISpacecraftSkillProperty.IsMain()) //主角
            {
                C2S_ButtonUp();
            }
        }