public void Execute(GameCmd.stNotifyUninterruptMagicUserCmd_S cmd) { if (cmd.actiontype == UninterruptActionType.UninterruptActionType_SkillCJ) { ISkillPart skillPart = SkillHelper.GetSkillPart(cmd.userid, EntityType.EntityType_Player); if (skillPart == null) { Engine.Utility.Log.Error("获取主角技能部件失败!"); return; } Engine.Utility.EventEngine.Instance().DispatchEvent((int)GameEventID.SKILLGUIDE_PROGRESSBREAK, new stGuildBreak() { action = GameCmd.UninterruptActionType.UninterruptActionType_SkillCJ, uid = cmd.userid, skillid = skillPart.GetCurSkillDataBase().wdID }); TimerAxis.Instance().KillTimer(m_uReadSliderTimerID, this); skillPart.OnInterruptSkill(cmd.userid, cmd.time, cmd.type, (uint)cmd.actiontype); } else if (cmd.actiontype == UninterruptActionType.UninterruptActionType_GOHOME) { long id = EntitySystem.EntityHelper.MakeUID(EntityType.EntityType_Player, cmd.userid); IEntitySystem pEntitySystem = ClientGlobal.Instance().GetEntitySystem(); if (pEntitySystem != null) { IPlayer pPlayer = pEntitySystem.FindPlayer((uint)id); if (pPlayer != null) { if (pPlayer.IsMainPlayer()) { Client.stUninterruptMagic param = new Client.stUninterruptMagic(); param.time = cmd.time; param.type = cmd.actiontype; param.uid = id; param.npcId = cmd.npcid; EventEngine.Instance().DispatchEvent((int)GameEventID.SKILLGUIDE_PROGRESSSTART, param); } else { } } } } else { long id = EntitySystem.EntityHelper.MakeUID(EntityType.EntityType_Player, cmd.userid); Client.stUninterruptMagic param = new Client.stUninterruptMagic(); param.time = cmd.time; param.type = cmd.actiontype; param.uid = id; param.npcId = cmd.npcid; EventEngine.Instance().DispatchEvent((int)GameEventID.SKILLGUIDE_PROGRESSSTART, param); } }
public void Execute(GameCmd.stRobotCollectMagicUserCmd_S cmd) { long id = EntitySystem.EntityHelper.MakeUID(EntityType.EntityTYpe_Robot, cmd.npc_id); Client.stUninterruptMagic param = new Client.stUninterruptMagic(); param.time = cmd.sec; param.type = GameCmd.UninterruptActionType.UninterruptActionType_CJ; param.uid = id; EventEngine.Instance().DispatchEvent((int)GameEventID.SKILLGUIDE_PROGRESSSTART, param); }
void VerifyPlayAni() { DataManager.Manager <SliderDataManager>().SetSliderDelagate(() => { DataManager.Instance.Sender.UseItem(MainPlayerHelper.GetPlayerID(), (uint)GameCmd.SceneEntryType.SceneEntry_Player, curTreasureMap.QWThisID, 1); }, null, 3f); Client.stUninterruptMagic stparam = new Client.stUninterruptMagic(); stparam.time = 2000; stparam.type = GameCmd.UninterruptActionType.UninterruptActionType_CangBaoTuCJ; stparam.uid = MainPlayerHelper.GetPlayerUID(); Engine.Utility.EventEngine.Instance().DispatchEvent((int)Client.GameEventID.SKILLGUIDE_PROGRESSSTART, stparam); }
// 进入状态 public override void Enter(object param) { IEntity target = skillPart.GetSkillTarget(); // 只有主角会进入战斗状态 if (skillPart.GetSkillPartType() == SkillPartType.SKILL_PLAYERPART && EntitySystem.EntityHelper.IsMainPlayer(skillPart.GetMaster())) { PlayerSkillPart playerSkill = skillPart as PlayerSkillPart; if (playerSkill != null) { playerSkill.SkillStartPlayTime = Time.realtimeSinceStartup; playerSkill.SetFighting(true); } } SkillDatabase skilltable = skillPart.GetCurSkillDataBase(); if (skilltable == null) { return; } // 朝向目标 if (target != null) { if (skilltable.targetType != (int)SkillTargetType.TargetForwardPoint) { skillPart.GetMaster().SendMessage(EntityMessage.EntityCommand_LookTarget, target.GetPos()); } } database = skilltable; //准备时间结束 发送结束消息 if (SkillSystem.GetClientGlobal().IsMainPlayer(skillPart.GetMaster()) && skilltable.dwReadTime > 0) // 非瞬发技能 { //读条技能 Client.stUninterruptMagic evenparam = new Client.stUninterruptMagic(); evenparam.time = database.dwReadTime; evenparam.type = GameCmd.UninterruptActionType.UninterruptActionType_SkillCJ; evenparam.uid = skillPart.GetMaster().GetUID(); EventEngine.Instance().DispatchEvent((int)GameEventID.SKILLGUIDE_PROGRESSSTART, evenparam); } preparetime = 0; }
//----------------------------------------------------------------------------------------------- private void OnStartCollectSlider(ref Client.stUninterruptMagic uninterrupt) { if (ShowCollectTip(uninterrupt.type)) { Client.IEntitySystem es = Client.ClientGlobal.Instance().GetEntitySystem(); if (es == null) { return; } Client.IEntity entity = es.FindEntity(uninterrupt.uid); if (entity != null && Client.ClientGlobal.Instance().IsMainPlayer(entity.GetUID()) == false) { RoleStateBar bar = GetRoleBarByUID(uninterrupt.uid); if (bar != null) { HeadTipData data = new HeadTipData(entity, HeadTipType.Collect, true); data.SetCollectType(uninterrupt.type); bar.UpdateWidget(data); } } } }
void SkillEvent(int eventID, object param) { if (eventID == (int)GameEventID.SKILLGUIDE_PROGRESSSTART) { Client.stUninterruptMagic evenparam = (Client.stUninterruptMagic)param; if (ClientGlobal.Instance().IsMainPlayer(evenparam.uid)) { if (DataManager.Manager <UIPanelManager>().IsShowPanel(PanelID.SliderPanel) == false) { DataManager.Manager <UIPanelManager>().ShowPanel(PanelID.SliderPanel, panelShowAction: (panel) => { DispatchValueUpdateEvent(new ValueUpdateEventArgs() { key = SliderDataEnum.Begin.ToString() }); }); } float dur = (float)(evenparam.time * 1f / 1000); if (dur > 0) { DataManager.Manager <SliderDataManager>().StartSliderByEvent(dur, evenparam.type); } else { Log.Error("进度条时间小于 0"); } } if (evenparam.type == GameCmd.UninterruptActionType.UninterruptActionType_CJ || evenparam.type == GameCmd.UninterruptActionType.UninterruptActionType_CampCJ || evenparam.type == GameCmd.UninterruptActionType.UninterruptActionType_SYDJ) { Client.IEntitySystem es = Client.ClientGlobal.Instance().GetEntitySystem(); if (es == null) { return; } Client.IEntity player = es.FindEntity(evenparam.uid); if (player == null) { return; } bool moving = (bool)player.SendMessage(Client.EntityMessage.EntityCommand_IsMove, null); if (moving) { player.SendMessage(EntityMessage.EntityCommand_StopMove); } Client.INPC npc = es.FindNPC(evenparam.npcId); if (npc != null) { player.SendMessage(EntityMessage.EntityCommand_LookTarget, npc.GetPos()); } PlayAni(player, EntityAction.Collect); } else if (evenparam.type == GameCmd.UninterruptActionType.UninterruptActionType_CangBaoTuCJ) { //采集 Log.Info("开始挖宝..."); Client.IEntitySystem es = Client.ClientGlobal.Instance().GetEntitySystem(); if (es == null) { return; } Client.IEntity player = es.FindEntity(evenparam.uid); if (player == null) { return; } bool moving = (bool)player.SendMessage(Client.EntityMessage.EntityCommand_IsMove, null); if (moving) { player.SendMessage(EntityMessage.EntityCommand_StopMove); } Client.INPC npc = es.FindNPC(evenparam.npcId); if (npc != null) { player.SendMessage(EntityMessage.EntityCommand_LookTarget, npc.GetPos()); } // PlayAni(player, EntityAction.Collect); //播放挖宝动作 PlayAni(player, EntityAction.Mining); //更换武器模型 DataManager.Manager <SuitDataManager>().OnMiningTreasureMapToChangeWeapon(player); } } else if (eventID == (int)GameEventID.SKILLGUIDE_PROGRESSBREAK) { if (param != null) { stGuildBreak guildBreak = (stGuildBreak)param; if (ClientGlobal.Instance().IsMainPlayer(guildBreak.uid)) { DataManager.Manager <SliderDataManager>().HideSlider(guildBreak.action); DataManager.Manager <SliderDataManager>().IsBreak = true; DataManager.Manager <SliderDataManager>().IsReadingSlider = false; //DataManager.Manager<TaskDataManager>().IsShowSlider = false; } if (guildBreak.action == GameCmd.UninterruptActionType.UninterruptActionType_CJ || guildBreak.action == GameCmd.UninterruptActionType.UninterruptActionType_CampCJ) { //打断采集 Client.IEntitySystem es = Client.ClientGlobal.Instance().GetEntitySystem(); if (es == null) { return; } Client.IEntity entity = es.FindPlayer(guildBreak.uid); if (entity != null) { bool moving = (bool)entity.SendMessage(EntityMessage.EntityCommand_IsMove, null); if (!moving) { PlayAni(guildBreak.uid, EntityAction.Stand); } } } } } else if (eventID == (int)GameEventID.SKILLGUIDE_PROGRESSEND) { DataManager.Manager <SliderDataManager>().IsReadingSlider = false; //DataManager.Manager<TaskDataManager>().IsShowSlider = false; stGuildEnd guildEnd = (stGuildEnd)param; if (ClientGlobal.Instance().IsMainPlayer(guildEnd.uid)) { //坐骑读条完毕后上马 if (guildEnd.action == GameCmd.UninterruptActionType.UninterruptActionType_DEMON) { DataManager.Instance.Sender.RideUsingRide(); } else { if (guildEnd.action != GameCmd.UninterruptActionType.UninterruptActionType_SkillCJ) { PlayStand(); } } } else { //播站立动作 PlayAni(guildEnd.uid, EntityAction.Stand); } } else if (eventID == (int)GameEventID.ENTITYSYSTEM_ENTITYDEAD) { stEntityDead ed = (stEntityDead)param; if (ClientGlobal.Instance().IsMainPlayer(ed.uid)) { // HideSprite(); DispatchValueUpdateEvent(new ValueUpdateEventArgs() { key = SliderDataEnum.End.ToString(), oldValue = m_UninterruptActionType }); DataManager.Manager <SliderDataManager>().IsBreak = true; DataManager.Manager <SliderDataManager>().IsReadingSlider = false; } } }
void OnCombotEvent(int nEventId, object param) { if (nEventId == (int)Client.GameEventID.ROBOTCOMBAT_SEARCHPATH) { Client.IControllerSystem cs = Client.ClientGlobal.Instance().GetControllerSystem(); if (cs.GetCombatRobot().Status != Client.CombatRobotStatus.STOP) { return; } if (param != null) { bool bsearch = (bool)param; if (DataManager.Manager <SliderDataManager>().IsReadingSlider == false) { ShowTipsUIByState(TipsUIState.Path, bsearch); } } } else if (nEventId == (int)Client.GameEventID.ROBOTCOMBAT_START) { //自动战斗特效 ShowTipsUIByState(TipsUIState.Robot, true); } else if (nEventId == (int)Client.GameEventID.ROBOTCOMBAT_STOP) { ShowTipsUIByState(TipsUIState.Robot, false); } else if (nEventId == (int)Client.GameEventID.ROBOTCOMBAT_VISITNPC) { Client.stVisitNpc visit = (Client.stVisitNpc)param; if (visit.state == false) { ShowTipsUIByState(TipsUIState.None); } } else if (nEventId == (int)GameEventID.SKILLGUIDE_PROGRESSSTART) { Client.stUninterruptMagic uninterrupt = (Client.stUninterruptMagic)param; if (Client.ClientGlobal.Instance().IsMainPlayer(uninterrupt.uid) == false)//非本人 { return; } if (ShowCollectTip(uninterrupt.type)) { if (uninterrupt.type == GameCmd.UninterruptActionType.UninterruptActionType_SYDJ) { ShowTipsUIByState(TipsUIState.UseItem, true); } else if (uninterrupt.type == GameCmd.UninterruptActionType.UninterruptActionType_CangBaoTuCJ) { ShowTipsUIByState(TipsUIState.WaBao, true); } else if (uninterrupt.type == GameCmd.UninterruptActionType.UninterruptActionType_GOHOME) { ShowTipsUIByState(TipsUIState.ChuanSong, true); } else { ShowTipsUIByState(TipsUIState.Collect, true); } } } else if (nEventId == (int)GameEventID.SKILLGUIDE_PROGRESSBREAK) { if (param != null) { stGuildBreak guildbreak = (stGuildBreak)param; if (ShowCollectTip(guildbreak.action)) { ShowTipsUIByState(TipsUIState.None); } } } else if (nEventId == (int)GameEventID.SKILLGUIDE_PROGRESSEND) { if (param != null) { stGuildEnd guildEnd = (stGuildEnd)param; if (ShowCollectTip(guildEnd.action)) { ShowTipsUIByState(TipsUIState.None); } } } }
/// <summary> /// 请求读条上马 /// </summary> public bool TryUsingRide(Action <object> callback, object param) { Client.IMapSystem ms = Client.ClientGlobal.Instance().GetMapSystem(); if (ms == null) { return(false); } table.MapDataBase mapdata = GameTableManager.Instance.GetTableItem <table.MapDataBase>(ms.GetMapID()); if (mapdata == null) { return(false); } if (mapdata.canUsingRide != 1) { TipsManager.Instance.ShowTips("该地图不能上马"); if (callback != null) { callback(param); } return(false); } Client.IPlayer mainPlayer = Client.ClientGlobal.Instance().MainPlayer; if (mainPlayer != null) { Client.ISkillPart skillpart = mainPlayer.GetPart(Client.EntityPart.Skill) as Client.ISkillPart; if (skillpart != null) { if (skillpart.GetCurSkillState() != (int)Client.SkillState.None) { TipsManager.Instance.ShowTips(LocalTextType.Ride_Commond_shifangjinengzhongwufashangma); if (callback != null) { callback(param); } return(false); } } bool isChangeBody = (bool)mainPlayer.SendMessage(Client.EntityMessage.EntityCommand_IsChange, null); if (isChangeBody) { if (callback != null) { callback(param); } return(false); } bool bRide = DataManager.Manager <RideManager>().IsRide; if (bRide) { if (callback != null) { callback(param); } return(false); } else if (Auto_Ride == 0) { if (callback != null) { callback(param); } return(false); } } UsingRideCallback = callback; UsingRideCallbackParam = param; if (Auto_Ride != 0) { //先发送读条 读条 结束在上马 Client.stUninterruptMagic stparam = new Client.stUninterruptMagic(); if (GetRideDataById(Auto_Ride) != null) { stparam.time = GetRideDataById(Auto_Ride).spellTime; } stparam.type = GameCmd.UninterruptActionType.UninterruptActionType_DEMON; stparam.uid = MainPlayerHelper.GetPlayerUID(); Engine.Utility.EventEngine.Instance().DispatchEvent((int)Client.GameEventID.SKILLGUIDE_PROGRESSSTART, stparam); //NetService.Instance.Send(new stUsingRideUserCmd_C()); } return(true); }
// 进入状态 public override void Enter(object param) { Engine.Utility.EventEngine.Instance().AddEventListener((int)Client.GameEventID.ENTITYSYSTEM_ENTITYSTOPMOVE, OnEvent); Engine.Utility.EventEngine.Instance().AddEventListener((int)Client.GameEventID.ENTITYSYSTEM_ENTITYBEGINMOVE, OnEvent); m_skillDoubleDb = null; m_fTotalTime = 0; skillPart = m_SkillPart; // m_skillDatabase = skillPart.GetCurSkillDataBase(); if (skillPart.GetSkillPartType() == SkillPartType.SKILL_PLAYERPART) { PlayerSkillPart playerSkill = skillPart as PlayerSkillPart; //m_nDoubleHitSkillId = (uint)playerSkill.NextSkillID; if (playerSkill.IsMainPlayer()) { Log.LogGroup("ZDY", "mainpalyer enter skillattackstate================"); } m_skillDatabase = GameTableManager.Instance.GetTableItem <SkillDatabase>(playerSkill.CurSkillID, 1); if (m_skillDatabase == null) { m_Statemachine.ChangeState((int)SkillState.None, null); return; } m_uDbJiangzhiTime = m_skillDatabase.wdStiffTime; playerSkill.SkillStiffTime = 0; m_skillDoubleDb = GameTableManager.Instance.GetTableItem <SkillDoubleHitDataBase>(playerSkill.CurSkillID); if (IsMainPlayer()) { Engine.Utility.EventEngine.Instance().DispatchEvent((int)GameEventID.SKILLSYSTEM_USESKILL, playerSkill.CurSkillID); } if (m_skillDatabase.dwMoveType == (uint)SkillMoveType.FastMove) { //处理位移技能 Move move = new Move(); Vector3 targePos = playerSkill.Master.GetPos(); if (playerSkill.GetSkillTarget() != null) { targePos = playerSkill.GetSkillTarget().GetPos(); Vector3 dir = targePos - playerSkill.Master.GetPos(); targePos = targePos - dir.normalized * 1f; move.m_target = targePos; // Vector3 lookat = playerSkill.GetSkillTarget().GetNode().GetTransForm().forward; } else { m_Statemachine.ChangeState((int)SkillState.None, playerSkill); Log.LogGroup("ZDY", "skilltarget is null"); return; } move.m_ignoreStand = true; if (Engine.Utility.Log.MaxLogLevel >= Engine.Utility.LogLevel.LogLevel_Group) { Log.LogGroup("ZDY", "冲锋 目标位置 " + targePos); } AnimationState ani = playerSkill.AttackAnimState; if (ani == null) { m_Statemachine.ChangeState((int)SkillState.None, playerSkill); Log.LogGroup("ZDY", "ani is null"); return; } move.strRunAct = ani.name; int curSpeed = playerSkill.Master.GetProp((int)WorldObjProp.MoveSpeed); uint flySpeed = m_skillDatabase.flyspeed; float speedFact = 1; if (flySpeed != 0) { speedFact = flySpeed * 1.0f / curSpeed; } Log.LogGroup("ZDY", "冲锋倍数 " + speedFact); playerSkill.Master.SendMessage(EntityMessage.EntityCommond_IgnoreMoveAction, true); playerSkill.Master.SendMessage(EntityMessage.EntityCommand_ChangeMoveSpeedFact, (object)speedFact); float dis = Vector3.Distance(targePos, playerSkill.Master.GetPos()); if (dis > 1) { Log.LogGroup("ZDY", " send moveto "); playerSkill.Master.SendMessage(EntityMessage.EntityCommand_MoveTo, (object)move); } playerSkill.gotoPos = targePos; } else { playerSkill.Master.SendMessage(EntityMessage.EntityCommand_ChangeMoveSpeedFact, (object)1f); } if (m_skillDatabase.useSkillType == (int)UseSkillType.GuideNoSlider) { if (m_skillDatabase.dwMoveType == (int)SkillMoveType.SkillOverMove) { playerSkill.Master.SendMessage(EntityMessage.EntityCommand_SetVisible, false); } if (m_skillDatabase.wdStiffTime == 0) {//狂扫八方的技能 playerSkill.Master.SendMessage(EntityMessage.EntityCommond_IgnoreMoveAction, true); } } else if (m_skillDatabase.useSkillType == (int)UseSkillType.GuideSlider) { if (playerSkill.IsMainPlayer()) { Client.stUninterruptMagic evenparam = new Client.stUninterruptMagic(); evenparam.time = m_skillDatabase.dwGuideTime; evenparam.type = GameCmd.UninterruptActionType.UninterruptActionType_SkillCJ; evenparam.uid = SkillSystem.GetClientGlobal().MainPlayer.GetUID(); EventEngine.Instance().DispatchEvent((int)GameEventID.SKILLGUIDE_PROGRESSSTART, evenparam); } playerSkill.Master.SendMessage(EntityMessage.EntityCommond_IgnoreMoveAction, true); } // if (m_skillDatabase.dwUseMethod == (int)UseMethod.ContinueLock) { playerSkill.Master.SendMessage(EntityMessage.EntityCommand_SetVisible, false); } INPC npc = playerSkill.Master as INPC; if (npc != null) { int masterID = npc.GetProp((int)NPCProp.Masterid); if (masterID == PlayerSkillPart.m_ClientGlobal.MainPlayer.GetID()) { /* Engine.Utility.EventEngine.Instance().DispatchEvent((int)GameEventID.SKILLCD_BEGIN, playerSkill.CurSkillID);*/ } } } }
/// <summary> /// 事件处理 /// </summary> /// <param name="nEventID"></param> /// <param name="param"></param> public void GlobalEventHandler(int eventID, object param) { if (eventID == (int)Client.GameEventID.ENTITYSYSTEM_NPCHEADSTATUSCHANGED) { if (null != param && param is Client.INPC) { UpdateNpcHeadMask((Client.INPC)param); } } else if (eventID == (int)Client.GameEventID.ENTITYSYSTEM_CREATEENTITY) { Client.stCreateEntity ce = (Client.stCreateEntity)param; OnCretateEntity(ref ce); } else if (eventID == (int)Client.GameEventID.ENTITYSYSTEM_REMOVEENTITY) { Client.stRemoveEntity removeEntiy = (Client.stRemoveEntity)param; RemoveBar(removeEntiy); } else if (eventID == (int)Client.GameEventID.ENTITYSYSTEM_PROPUPDATE) { stPropUpdate prop = (stPropUpdate)param; OnPropUpdate(ref prop); } else if (eventID == (int)Client.GameEventID.ENTITYSYSTEM_HPUPDATE) { stPropUpdate prop = (stPropUpdate)param; OnPropUpdate(ref prop); } else if (eventID == (int)Client.GameEventID.ENTITYSYSTEM_CHANGENAME) { stEntityChangename e = (stEntityChangename)param; OnChangeName(e.uid); } else if (eventID == (int)(int)Client.GameEventID.ENTITYSYSTEM_SETHIDE) { stEntityHide st = (stEntityHide)param; OnSetEntityHide(ref st); return; } else if (eventID == (int)(int)Client.GameEventID.TITLE_WEAR)//佩戴称号 { Client.stTitleWear data = (Client.stTitleWear)param; OnTitleWear(data.uid); } else if (eventID == (int)GameEventID.SKILLGUIDE_PROGRESSSTART) { Client.stUninterruptMagic uninterrupt = (Client.stUninterruptMagic)param; OnStartCollectSlider(ref uninterrupt); } else if (eventID == (int)GameEventID.SKILLGUIDE_PROGRESSBREAK) { if (param != null) { stGuildBreak guildbreak = (stGuildBreak)param; if (ShowCollectTip(guildbreak.action)) { long uid = EntitySystem.EntityHelper.MakeUID(EntityType.EntityType_Player, guildbreak.uid); RoleStateBar bar = GetRoleBarByUID(uid); if (bar != null) { bar.SetWidgetState(HeadTipType.Collect, false); } } } } else if (eventID == (int)GameEventID.SKILLGUIDE_PROGRESSEND) { if (param != null) { stGuildEnd guildEnd = (stGuildEnd)param; if (ShowCollectTip(guildEnd.action)) { long uid = EntitySystem.EntityHelper.MakeUID(EntityType.EntityType_Player, guildEnd.uid); RoleStateBar bar = GetRoleBarByUID(uid); if (bar != null) { bar.SetWidgetState(HeadTipType.Collect, false); } } } } else if (eventID == (int)Client.GameEventID.CLANQUIT || eventID == (int)Client.GameEventID.CLANJOIN || eventID == (int)Client.GameEventID.CLANREFRESHID || eventID == (int)Client.GameEventID.CITYWARWINERCLANID || eventID == (int)Client.GameEventID.CLANDeclareInfoAdd || eventID == (int)Client.GameEventID.CLANDeclareInfoRemove) { OnRefreshAllClanTitile(); } else if (eventID == (int)Client.GameEventID.CITYWARTOTEMCLANNAMECHANGE) { long uid = EntitySystem.EntityHelper.MakeUID(EntityType.EntityType_NPC, (uint)param); RoleStateBar bar = GetRoleBarByUID(uid); if (bar != null) { Client.IEntitySystem es = Client.ClientGlobal.Instance().GetEntitySystem(); if (es == null) { return; } RefreshClanName(es.FindEntity(uid), bar); } } else if (eventID == (int)Client.GameEventID.SYSTEM_GAME_READY) { OnRefreshAllHpSlider(); } }