private void ResetJoystick() { m_widget_joystick.alpha = 0.5f; m_widget_joystick.gameObject.transform.localPosition = m_trans_joystickPos.localPosition; m_sprite_joystickThumb.transform.localPosition = Vector3.zero; m_sprite_joystickBg.transform.localPosition = Vector3.zero; m_sprite_joystickThumb.GetComponent <BoxCollider>().enabled = false; Client.IControllerSystem controllerSys = Client.ClientGlobal.Instance().GetControllerSystem(); if (controllerSys != null) { Client.IController ctrl = controllerSys.GetActiveCtrl(); if (ctrl != null) { ctrl.OnMessage(Engine.MessageCode.MessageCode_JoystickEnd); } } Engine.Utility.EventEngine.Instance().DispatchEvent((int)(int)Client.GameEventID.JOYSTICK_UNPRESS, null); if (MainPlayerHelper.GetMainPlayer() != null) { ISkillPart part = MainPlayerHelper.GetMainPlayer().GetPart(EntityPart.Skill) as ISkillPart; if (part != null) { int st = part.GetCurSkillState(); if (st == (int)SkillState.None || st == (int)SkillState.Prepare) { stForbiddenJoystick info = new stForbiddenJoystick(); info.playerID = MainPlayerHelper.GetPlayerUID(); info.bFobidden = false; EventEngine.Instance().DispatchEvent((int)GameEventID.SKILL_FORBIDDENJOYSTICK, info); } } } }
void StartAutoFight() { if (m_bIsEnterCopy) { CopyDataBase cdb = GameTableManager.Instance.GetTableItem <CopyDataBase>(m_uEnterCopyID); if (cdb != null) { //进入副本 如果还是组队跟随状态 跟随状态挂起,进入挂机状态 Client.IControllerSystem cs = Client.ClientGlobal.Instance().GetControllerSystem(); if (cs != null) { Client.ICombatRobot robot = cs.GetCombatRobot(); if (robot != null) //&& robot.Status != Client.CombatRobotStatus.STOP) { if (DataManager.Manager <TeamDataManager>().IsJoinTeam&& DataManager.Manager <TeamDataManager>().IsFollow) { robot.StartInCopy(m_uEnterCopyID, LaskSkillWave, LastTransmitWave); } if (cdb.IsAutoFight) { robot.StartInCopy(m_uEnterCopyID, LaskSkillWave, LastTransmitWave); } } } } } }
private void OnSkillPlayOver(ref Client.stSkillStateEnter sse, int nEventId) { if (!Client.ClientGlobal.Instance().IsMainPlayer(sse.uid)) { return; } m_bAddSkillNoneListener = false; Engine.Utility.EventEngine.Instance().RemoveEventListener(nEventId, OnEvent); QuestTraceInfo questInfo = QuestTranceManager.Instance.GetQuestTraceInfo(m_nDoingTaskID); if (questInfo == null) { return; } Engine.Utility.Log.Info("{0}技能播放完毕 执行任务{1} {2}", TAG, m_nDoingTaskID, Client.ClientGlobal.Instance().MainPlayer.GetCurState()); Client.IControllerSystem cs = Client.ClientGlobal.Instance().GetControllerSystem(); if (cs == null) { return; } m_nDoingTaskID = 0; ProcessTask(questInfo); }
void onClick_BtnAI_Btn(GameObject caster) { Client.IControllerSystem cs = Client.ClientGlobal.Instance().GetControllerSystem(); if (cs == null) { Engine.Utility.Log.Error("ExecuteCmd: ControllerSystem is null"); return; } Client.ICombatRobot robot = cs.GetCombatRobot(); if (robot.Status == Client.CombatRobotStatus.STOP) { ComBatCopyDataManager comBat = DataManager.Manager <ComBatCopyDataManager>(); if (comBat.IsEnterCopy && comBat.EnterCopyID != 0) { robot.StartInCopy(comBat.EnterCopyID, comBat.LaskSkillWave, comBat.LastTransmitWave); } else { robot.Start(); } } else { robot.Stop(); } }
public void OnTalkData(LangTalkData langtalkdata, string strStep) { if (langtalkdata == null) { return; } if (langtalkdata.npcType == LangTalkData.NpcType.MissionTalk) { DataManager.Manager <UIPanelManager>().ShowPanel(PanelID.NpcDialogPanel, data: langtalkdata); } //if (langtalkdata.npcType == LangTalkData.NpcType.CityWarOnly) //{ // DataManager.Manager<UIPanelManager>().ShowPanel(PanelID.NpcDialogPanel, data: langtalkdata); //} else if (langtalkdata.npcType == LangTalkData.NpcType.TalkOnly) { DataManager.Manager <UIPanelManager>().ShowPanel(PanelID.NpcDialogPanel, data: langtalkdata); } else if (langtalkdata.npcType == LangTalkData.NpcType.MissionNoTalk) { DataManager.Manager <UIPanelManager>().ShowPanel(PanelID.MissionMessagePanel, data: langtalkdata); } else if (langtalkdata.npcType == LangTalkData.NpcType.TransferNpc) { DataManager.Manager <UIPanelManager>().ShowPanel(PanelID.NpcDeliverPanel, data: langtalkdata); } else if (langtalkdata.npcType == LangTalkData.NpcType.Transmit) { NetService.Instance.Send(new GameCmd.stDialogSelectScriptUserCmd_C() { step = strStep, dwChose = 1, }); DataManager.Manager <UIPanelManager>().ShowLoading(); Client.IControllerSystem cs = Client.ClientGlobal.Instance().GetControllerSystem(); if (cs == null) { Engine.Utility.Log.Error("ExecuteCmd: ControllerSystem is null"); return; } if (cs.GetCombatRobot().Status != Client.CombatRobotStatus.STOP) { cs.GetCombatRobot().Stop(); } } else if (langtalkdata.npcType == LangTalkData.NpcType.MissionAutoReceive) { NetService.Instance.Send(new GameCmd.stDialogSelectScriptUserCmd_C() { step = strStep, dwChose = 1, }); } }
private void StopRobot() { Client.IControllerSystem cs = Client.ClientGlobal.Instance().GetControllerSystem(); if (cs == null) { return; } cs.GetCombatRobot().Stop(); }
IControllerHelper GetControllerHelper() { Client.IControllerSystem cs = ControllerSystem.m_ClientGlobal.GetControllerSystem(); if (cs == null) { Engine.Utility.Log.Error("ControllerSystem 为 null !!!"); } return(cs.GetControllerHelper()); }
/// <summary> /// 开启挂机 /// </summary> void StartRobot() { Client.IControllerSystem cs = Client.ClientGlobal.Instance().GetControllerSystem(); if (cs != null) { Client.ICombatRobot robot = cs.GetCombatRobot(); if (robot != null) //&& robot.Status != Client.CombatRobotStatus.STOP) { robot.Start(); } } }
//static uint nLastTaskID = 0; public void VisitNpc(bool bDirectly, uint nMapID, uint nNpcID, uint nTaskID) { //bool bProcess = true; //if (nLastTaskID == nTaskID && nProcessTaskID == nTaskID) //{ // bProcess = false; //} //else //{ // nLastTaskID = nTaskID; //} //if (bProcess == false) // return; Client.IControllerSystem cs = Client.ClientGlobal.Instance().GetControllerSystem(); if (cs == null) { return; } Client.IController controller = cs.GetActiveCtrl(); if (controller == null) { Engine.Utility.Log.Error("IController is null"); return; } //bDirectly = false; if (bDirectly)//是否直接跨地图去接取 { if (EqualsMapID(nMapID)) { controller.VisiteNPC(nMapID, nNpcID); } else { //下载地图检查 if (!KHttpDown.Instance().SceneFileExists(nMapID)) { //打开下载界面 DataManager.Manager <UIPanelManager>().ShowPanel(PanelID.DownloadPanel); return; } controller.VisiteNPCDirectly(nMapID, nNpcID, nTaskID, 100, 100); } } else { controller.VisiteNPC(nMapID, nNpcID, false); } }
CombatRobotStatus GetRobotState() { Client.IControllerSystem cs = Client.ClientGlobal.Instance().GetControllerSystem(); if (cs != null) { ICombatRobot cr = cs.GetCombatRobot(); if (cr != null) { return(cr.Status); } } return(CombatRobotStatus.STOP); }
public bool CanAutoPick() { if (EntitySystem.m_ClientGlobal.gameOption == null) { return(false); } int canPickUp = EntitySystem.m_ClientGlobal.gameOption.GetInt("Pick", "PickMedecal", 1); if (canPickUp != 1) { return(false); } int pickLevel = EntitySystem.m_ClientGlobal.gameOption.GetInt("Pick", "EquipLevel", 1); int nID = GetProp((int)EntityProp.BaseID); var table_data = GameTableManager.Instance.GetTableItem <table.ItemDataBase>((uint)nID); if (table_data == null) { return(false); } if (table_data.grade < pickLevel) { return(false); } Client.IControllerSystem cs = EntitySystem.m_ClientGlobal.GetControllerSystem(); if (cs != null) { Client.IControllerHelper controllerhelper = cs.GetControllerHelper(); if (controllerhelper != null) { int itemId = GetProp((int)EntityProp.BaseID); int itemNum = GetProp((int)BoxProp.Number); //1、捡到的item 不为金币(金币不进背包,不做背包检测) if (itemId != 60001) { //2、不可放入背包 if (false == cs.GetControllerHelper().CanPutInKanpsack((uint)itemId, (uint)itemNum)) { return(false); } } } } return(CanPick()); }
Client.IController GetController() { Client.IControllerSystem ctrlSys = ClientGlobal.Instance().GetControllerSystem(); if (ctrlSys == null) { return(null); } Client.IController ctrl = ctrlSys.GetActiveCtrl(); if (ctrl == null) { return(null); } return(ctrl); }
void UnRide() { if (m_Owner.GetEntityType() == EntityType.EntityType_Player) { Client.IControllerSystem cs = EntitySystem.m_ClientGlobal.GetControllerSystem(); if (cs != null) { //这里客户端只需要下马 不需要请求服务器下马 服务器死亡最后会广播下马状态 bool bRide = (bool)m_Owner.SendMessage(Client.EntityMessage.EntityCommond_IsRide, null); if (bRide) { m_Owner.SendMessage(Client.EntityMessage.EntityCommond_UnRide, null); } } } }
void GotoMap(int mapID) { if (mapID != 0) { IMapSystem mapSystem = Client.ClientGlobal.Instance().GetMapSystem(); if (mapSystem.GetMapID() == mapID) { //你就在这个场景 TipsManager.Instance.ShowTipsById(514); return; } Client.IControllerSystem cs = Client.ClientGlobal.Instance().GetControllerSystem(); if (cs != null) { cs.GetCombatRobot().Stop();// 停止挂机 } TransferDatabase tdb = GameTableManager.Instance.GetTableItem <TransferDatabase>((uint)mapID); if (tdb != null) { if (!MainPlayerHelper.IsHasEnoughMoney(tdb.costType, tdb.costValue, true)) { return; } } //DataManager.Manager<SliderDataManager>().SetSliderDelagate(() => //{ if (!KHttpDown.Instance().SceneFileExists((uint)mapID)) { //打开下载界面 DataManager.Manager <UIPanelManager>().ShowPanel(PanelID.DownloadPanel); HideSelf(); return; } IMapSystem ms = ClientGlobal.Instance().GetMapSystem(); if (ms != null) { ms.RequestEnterMap((uint)mapID, 1); } //}, null, 3f); HideSelf(); } m_ctor_bgContent.SetVisible(false); m_btn_ColliderMask.gameObject.SetActive(false); }
/// <summary> /// 切换目标 /// </summary> /// <param name="id"></param> void SelectTargetChange(uint id) { //切换目标 IEntitySystem es = Client.ClientGlobal.Instance().GetEntitySystem(); if (es != null) { IPlayer m_curTarget = es.FindPlayer(id); if (m_curTarget != null) { //检测视野(策划要求不做视野检测) //if (es.CheckEntityVisible(m_curTarget)) //检测搜索范围 if (es.CheckSearchRange(m_curTarget)) { Client.IControllerSystem cs = Client.ClientGlobal.Instance().GetControllerSystem(); if (cs != null) { //如果在挂机先停止(清任务目标),再开始,打指定目标 if (cs.GetCombatRobot().Status == CombatRobotStatus.RUNNING) { cs.GetCombatRobot().Stop(); cs.GetCombatRobot().Start(); } } Client.ClientGlobal.Instance().GetControllerSystem().GetActiveCtrl().UpdateTarget(m_curTarget); Client.stTargetChange targetChange = new Client.stTargetChange(); targetChange.target = m_curTarget; Engine.Utility.EventEngine.Instance().DispatchEvent((int)GameEventID.SKILLSYSYTEM_TAB, targetChange); // Engine.Utility.EventEngine.Instance().DispatchEvent((int)GameEventID.ENTITYSYSTEM_TARGETCHANGE, targetChange); } else { TipsManager.Instance.ShowTips("目标不在附近"); } } else { TipsManager.Instance.ShowTips("目标不在附近"); } } }
void AutoFindPath(Vector3 targetPos, uint npcID = 0, bool isNpc = false) { IController ctrl = ClientGlobal.Instance().GetControllerSystem().GetActiveCtrl(); IMapSystem mapSys = ClientGlobal.Instance().GetMapSystem(); if (mapSys == null) { return; } // 需要添加一个寻路的过程 if (isNpc) { int mapID = DataManager.Manager <MapDataManager>().GetCurMapID(); if (mapID > 0) { Client.ClientGlobal.Instance().GetControllerSystem().GetActiveCtrl().VisiteNPC((uint)mapID, npcID, false); HideSelf(); } else { Engine.Utility.Log.Error("mapid error "); } } else { if (ctrl != null) { Client.IControllerSystem cs = Client.ClientGlobal.Instance().GetControllerSystem(); if (cs != null) { Client.ICombatRobot robot = cs.GetCombatRobot(); if (robot != null && robot.Status != CombatRobotStatus.STOP) { robot.Stop(); } } m_vecTargetPos = new Vector2(targetPos.x, targetPos.z); mapSys.AddFindPathCallback(FindPathCallBack); ctrl.MoveToTarget(targetPos, null, true); mapSys.RemoveFindPathCallback(FindPathCallBack); } } }
void onClick_Btn_transmission_Btn(GameObject caster) { table.HuntingDataBase checkHunt = GameTableManager.Instance.GetTableItem <HuntingDataBase>(MonsterID); if (!KHttpDown.Instance().SceneFileExists(checkHunt.mapID)) { //打开下载界面 DataManager.Manager <UIPanelManager>().ShowPanel(PanelID.DownloadPanel); DataManager.Manager <UIPanelManager>().HidePanel(PanelID.HuntingGoPanel); return; } if (leftTransTime > 0) { Client.IControllerSystem cs = Client.ClientGlobal.Instance().GetControllerSystem(); if (cs != null) { cs.GetCombatRobot().Stop();// 停止挂机 } table.HuntingDataBase hunt = GameTableManager.Instance.GetTableItem <HuntingDataBase>(MonsterID); DataManager.Manager <RideManager>().TryUsingRide(delegate(object o) { NetService.Instance.Send(new stRequestTransScriptUserCmd_CS() { boss_index = MonsterID }); }, null); DataManager.Manager <UIPanelManager>().HidePanel(PanelID.HuntingGoPanel); IMapSystem mapsys = Client.ClientGlobal.Instance().GetMapSystem(); if (mapsys.GetMapID() == hunt.transmitMapID) { DataManager.Manager <HuntingManager>().StartLoading(); } } else { TipsManager.Instance.ShowTips(DataManager.Manager <TextManager>().GetLocalText(LocalTextType.Local_TXT_Notice_NoEnoughTransmitTime)); } }
public bool CanPick() { GameCmd.SceneItemOwnerType ownerType = (GameCmd.SceneItemOwnerType)GetProp((int)Client.BoxProp.OwnerType); //int owernId = (int)GetProp((int)Client.BoxProp.Owner); uint owernIdLow = (uint)GetProp((int)Client.BoxProp.OwnerLow); uint owernIdHigh = (uint)GetProp((int)Client.BoxProp.OwnerHigh); uint owernId = (owernIdHigh << 16) | owernIdLow; if (ownerType == GameCmd.SceneItemOwnerType.SceneItemOwnerType_Null) { return(true); } else if (ownerType == GameCmd.SceneItemOwnerType.SceneItemOwnerType_User) { return(owernId == (int)EntitySystem.m_ClientGlobal.MainPlayer.GetID()); } else if (ownerType == GameCmd.SceneItemOwnerType.SceneItemOwnerType_Clan) { Client.IControllerSystem cs = EntitySystem.m_ClientGlobal.GetControllerSystem(); if (cs != null) { Client.IControllerHelper controllerhelper = cs.GetControllerHelper(); if (controllerhelper != null) { return(owernId == controllerhelper.GetMainPlayerClanId()); } } } else if (ownerType == GameCmd.SceneItemOwnerType.SceneItemOwnerType_Team) { Client.IControllerSystem cs = EntitySystem.m_ClientGlobal.GetControllerSystem(); if (cs != null) { return(cs.GetControllerHelper().IsTeamerCanPick((uint)owernId)); } } return(false); }
private void OnPlayerStopMove(ref Client.stEntityStopMove stopEntity, int nEventId) { if (!Client.ClientGlobal.Instance().IsMainPlayer(stopEntity.uid)) { return; } if (m_nDoingTaskID == 0) { Engine.Utility.EventEngine.Instance().RemoveEventListener(nEventId, OnEvent); m_bAddStopMoveListener = false; return; } QuestTraceInfo questInfo = QuestTranceManager.Instance.GetQuestTraceInfo(m_nDoingTaskID); if (questInfo == null) { Engine.Utility.EventEngine.Instance().RemoveEventListener(nEventId, OnEvent); m_bAddStopMoveListener = false; return; } if (EqualsMapID(questInfo.QuestTable.destMapID)) { Engine.Utility.EventEngine.Instance().RemoveEventListener(nEventId, OnEvent); m_bAddStopMoveListener = false; uint npcid; Vector2 pos; if (questInfo.IsKillMonster(out npcid)) { Client.IMapSystem ms = Client.ClientGlobal.Instance().GetMapSystem(); if (ms.GetClienNpcPos((int)npcid, out pos)) { UnityEngine.Vector3 mainPos = Client.ClientGlobal.Instance().MainPlayer.GetPos(); if (mainPos.x == pos.x && mainPos.z == -pos.y) { Client.IControllerSystem cs = Client.ClientGlobal.Instance().GetControllerSystem(); if (cs != null) { cs.GetCombatRobot().StartWithTarget((int)npcid); Engine.Utility.Log.LogGroup("ZCX", "挂机杀怪物{0}", npcid); } } } } else if (questInfo.IsMoveToTargetPos(out pos)) { Engine.Utility.EventEngine.Instance().DispatchEvent((int)Client.GameEventID.ROBOTCOMBAT_SEARCHPATH, false); UnityEngine.Vector3 mainPos = Client.ClientGlobal.Instance().MainPlayer.GetPos(); if (mainPos.x == pos.x && mainPos.z == -pos.y) { if (DataManager.Manager <UIPanelManager>().IsShowPanel(PanelID.MainUsePanel)) { return; } MainUsePanelData mainUsePanelData = new MainUsePanelData(); mainUsePanelData.type = 2; // type = 2为item mainUsePanelData.Id = questInfo.QuestTable.usecommitItemID; mainUsePanelData.onClick = MainUsePanelItemOnClick; this.usecommitItemID = questInfo.QuestTable.usecommitItemID; DataManager.Manager <UIPanelManager>().ShowPanel(PanelID.MainUsePanel, data: mainUsePanelData); // DataManager.Manager<UIPanelManager>().ShowPanel(PanelID.MainUsePanel, data: questInfo.QuestTable.usecommitItemID); } } } }
// 添加buff表现特效效果 void AddBuffEffect(uint buffID, uint runID) { if (m_Master == null) { return; } if (m_Master.GetNode() == null) { if (!m_unCreateEffectList.Contains(runID)) { m_unCreateEffectList.Add(runID); } } else { CreateEffect(runID); } BuffDataBase db = GetBuffDataBase(runID); if (db == null) { //Log.Error("读取Buff配置数据出错:{0}", buffID); return; } for (int i = 0; i < db.buffEffect.Count; i++) { var item = db.buffEffect[i]; if (item == 0) { continue; } FxResDataBase edb = GameTableManager.Instance.GetTableItem <FxResDataBase>(item); if (edb == null) { // Log.Error("get FxResDataBase is null id is " + item.ToString()); return; } string aniName = edb.targetAniName; if (string.IsNullOrEmpty(aniName)) { return; } PlayAni anim_param = new PlayAni(); anim_param.strAcionName = aniName; anim_param.fSpeed = 1; anim_param.nStartFrame = 0; anim_param.nLoop = edb.playAniTime; //if(db.buffBigType == (int)BuffBigType.Control) //{ // anim_param.nLoop = -1; //} //else //{ // anim_param.nLoop = 1; //} anim_param.fBlendTime = 0.2f; bool bRide = (bool)m_Master.SendMessage(EntityMessage.EntityCommond_IsRide, null); if (bRide) { return; } if (m_Master.GetCurState() == CreatureState.Contrl) {//眩晕不播放其他动画 anim_param.aniCallback = OnHitCallback; anim_param.callbackParam = m_Master; if (SkillSystem.GetClientGlobal().IsMainPlayer(m_Master.GetID())) { Engine.Utility.Log.Info("buff 播放眩晕动作 {0}", anim_param.strAcionName); } m_Master.SendMessage(EntityMessage.EntityCommand_PlayAni, anim_param); } else { if (m_Master.GetCurState() != CreatureState.Move) {//移动中不播放受击动作 Client.IControllerSystem cs = m_ClientGlobal.GetControllerSystem(); if (cs != null) { Client.ICombatRobot robot = cs.GetCombatRobot(); if (robot.Status == CombatRobotStatus.RUNNING) { if (SkillSystem.GetClientGlobal().IsMainPlayer(m_Master.GetID())) {//自动挂机 不播受击 return; } } } m_Master.SendMessage(EntityMessage.EntityCommand_PlayAni, anim_param); } } } }
private void OnThumbDrag(GameObject obj, Vector2 delta) { if (m_bIgnore) { return; } if (MainPlayerHelper.GetMainPlayer().IsDead()) { return; } Vector2 touchPos = UICamera.currentTouch.pos; float fDis = Vector2.Distance(m_LastJoystickBgScreenPos, touchPos); if (m_bJoystickStable) { Vector2 touchDelta2 = touchPos - m_LastJoystickBgScreenPos; m_sprite_joystickThumb.transform.position = UICamera.currentCamera.ScreenToWorldPoint(new Vector3(touchPos.x, touchPos.y, 0)); if (fDis < m_fMaxDis) { Vector2 pos = m_LastJoystickBgScreenPos + touchDelta2; Vector3 pp = UICamera.currentCamera.ScreenToWorldPoint(new Vector3(pos.x, pos.y, 0)); m_sprite_joystickThumb.transform.position = new Vector3(pp.x, pp.y, 0); } else { Vector2 dt = touchDelta2.normalized; Vector2 pos = m_LastJoystickBgScreenPos + dt * m_fMaxDis; Vector3 pp = UICamera.currentCamera.ScreenToWorldPoint(new Vector3(pos.x, pos.y, 0)); m_sprite_joystickThumb.transform.position = new Vector3(pp.x, pp.y, 0); } } else { m_sprite_joystickThumb.transform.position = UICamera.currentCamera.ScreenToWorldPoint(new Vector3(touchPos.x, touchPos.y, 0)); if (fDis > m_fMaxDis) { Vector2 dir = (new Vector2(touchPos.x, touchPos.y) - m_LastJoystickBgScreenPos).normalized; Vector2 pos = dir * (fDis - m_fMaxDis); m_LastJoystickBgScreenPos += pos; m_sprite_joystickBg.transform.position = UICamera.currentCamera.ScreenToWorldPoint(new Vector3(m_LastJoystickBgScreenPos.x, m_LastJoystickBgScreenPos.y, 0)); } } m_LastTouchPos = touchPos; //if (m_bSkillLongPress) //{ // return; //} if (fDis < 10) { return; } Vector2 touchDelta = touchPos - m_LastJoystickBgScreenPos; // 根据 touchDelta 计算角度 垂直向上 float fAngle = Vector2.Angle(Vector2.up, touchDelta); if (touchDelta.x < 0) { fAngle = -fAngle; } fAngle += CameraFollow.Instance.YAngle; Client.IControllerSystem controllerSys = Client.ClientGlobal.Instance().GetControllerSystem(); if (controllerSys != null) { Client.IController ctrl = controllerSys.GetActiveCtrl(); if (ctrl != null) { ctrl.OnMessage(Engine.MessageCode.MessageCode_JoystickChanging, (object)fAngle); if (m_bSkillLongPress) { //点击摇杆 解除长按 Controller.CmdManager.Instance().Clear(); stSkillLongPress longPress = new stSkillLongPress(); longPress.bLongPress = false; EventEngine.Instance().DispatchEvent((int)GameEventID.SKLL_LONGPRESS, longPress); } } } }
private void OnDoingTask(QuestTraceInfo taskInfo) { DataManager.Manager <TaskDataManager>().DoingTaskID = taskInfo.taskId; Client.IController controller = Client.ClientGlobal.Instance().GetControllerSystem().GetActiveCtrl(); if (controller == null) { Engine.Utility.Log.Error("IController is null"); return; } table.QuestDataBase questDB = taskInfo.QuestTable; if (questDB == null) { Engine.Utility.Log.Error("QuestTable is null"); return; } UnityEngine.Vector2 pos; uint npcid = 0; PanelID pid; int copyID; int tab = 0; uint jumpId; //背包满了 无法执行任务 if (false == taskInfo.TaskItemCanPutInKanpsack()) { TipsManager.Instance.ShowTips(LocalTextType.Task_Commond_3); return; } if (MainPlayerIsChangeBody()) { return; } else if (taskInfo.taskSubType == TaskSubType.SubmitLimit) //断档任务 { if (taskInfo.IsOpenUI(out jumpId)) { ItemManager.DoJump(jumpId); } else { string des = string.Format("将等级提升到{0}级继续主线任务", taskInfo.finishLevel); TipsManager.Instance.ShowTips(des); } return; } else if (taskInfo.IsDynamicCommitItem) //动态道具递交(蚩尤乱世除外) { taskInfo.DoJump(); return; } else if (DataManager.Manager <ComBatCopyDataManager>().IsEnterCopy == false && taskInfo.IsOpenUI(out jumpId)) { ItemManager.DoJump(jumpId); return; } else if (taskInfo.IsMoveToTargetPos(out pos)) { //if (DataManager.Manager<TaskDataManager>().IsShowSlider) if (DataManager.Manager <SliderDataManager>().IsReadingSlider) { return; } Client.IControllerSystem cs = Client.ClientGlobal.Instance().GetControllerSystem(); if (cs == null) { return; } if (!m_bAddStopMoveListener) { m_bAddStopMoveListener = true; Engine.Utility.EventEngine.Instance().AddEventListener((int)Client.GameEventID.ENTITYSYSTEM_ENTITYSTOPMOVE, OnEvent); } if (EqualsMapID(questDB.destMapID)) { cs.GetCombatRobot().Stop(); DataManager.Manager <RideManager>().TryUsingRide(delegate(object o) { //if (!m_bAddStopMoveListener) //{ // m_bAddStopMoveListener = true; // Engine.Utility.EventEngine.Instance().AddEventListener((int)Client.GameEventID.ENTITYSYSTEM_ENTITYSTOPMOVE, OnEvent); //} m_nDoingTaskID = taskInfo.taskId; controller.GotoMap(questDB.destMapID, new Vector3(pos.x, 0, -pos.y)); }, null); return; } else { DataManager.Manager <RideManager>().TryUsingRide(delegate(object o) { if (questDB.dwHelpDoing) { m_nDoingTaskID = taskInfo.taskId; //下载地图检查 if (!KHttpDown.Instance().SceneFileExists(questDB.destMapID)) { //打开下载界面 DataManager.Manager <UIPanelManager>().ShowPanel(PanelID.DownloadPanel); return; } controller.GotoMapDirectly(questDB.destMapID, new Vector3(pos.x, 0, -pos.y), questDB.dwID); } }, null); } } else if (taskInfo.IsVisitCollectNpc(out npcid) || taskInfo.IsDeleverItem(out npcid)) { AddCollectNpcEffect(taskInfo); DataManager.Manager <RideManager>().TryUsingRide(delegate(object o) { VisitNpc(questDB.dwHelpDoing, questDB.destMapID, npcid, questDB.dwID); }, null); } else if (taskInfo.IsDirectlyVisitCopy(taskInfo.copyId) && false == EqualsMapID(questDB.destMapID)) { //直接跳副本 VisitCopy(taskInfo.copyId); } else if (taskInfo.IsKillMonster(out npcid)) { Client.ICombatRobot robot = Client.ClientGlobal.Instance().GetControllerSystem().GetCombatRobot(); if (robot == null) { Engine.Utility.Log.Error("robotis null"); return; } if (robot.Status == Client.CombatRobotStatus.RUNNING && robot.TargetId == npcid) { Engine.Utility.Log.Info("已经在挂机杀怪{0}", npcid); return; } //TODO 优化 bool getPos = false; if (EqualsMapID(questDB.destMapID)) { Client.IMapSystem ms = Client.ClientGlobal.Instance().GetMapSystem(); if (ms.GetClienNpcPos((int)npcid, out pos)) { getPos = true; Vector3 mainPos = Client.ClientGlobal.Instance().MainPlayer.GetPos(); if ((mainPos - new Vector3(pos.x, mainPos.y, -pos.y)).sqrMagnitude < 5) { Client.IControllerSystem cs = Client.ClientGlobal.Instance().GetControllerSystem(); if (cs != null) { cs.GetCombatRobot().StartWithTarget((int)npcid); Engine.Utility.Log.LogGroup("ZCX", "挂机杀怪物{0}", npcid); return; } } } } DataManager.Manager <RideManager>().TryUsingRide(delegate(object o) { if (!m_bAddStopMoveListener) { m_bAddStopMoveListener = true; Engine.Utility.EventEngine.Instance().AddEventListener((int)Client.GameEventID.ENTITYSYSTEM_ENTITYSTOPMOVE, OnEvent); } m_nDoingTaskID = taskInfo.taskId; if (getPos) { controller.MoveToTarget(new Vector3(pos.x, 0, -pos.y), null, true); } else if (EqualsMapID(questDB.destMapID)) { Client.IMapSystem ms = Client.ClientGlobal.Instance().GetMapSystem(); if (ms.GetClienNpcPos((int)npcid, out pos)) { controller.MoveToTarget(new Vector3(pos.x, 0, -pos.y), null, true); } } else { VisitNpc(questDB.dwHelpDoing, questDB.destMapID, npcid, questDB.dwID); } }, null); } }
// 同步技能消息 public void SyncSkill(uint uSkillID, Client.IEntity target, Vector3 targetPos) { if(uSkillID == 0) { Log.Error("SyncSkill skillid is 0"); return; } // 填充数据 Vector3 pos = m_Master.GetPos(); SkillDatabase database = GetSkillDataBase(uSkillID); Client.IControllerSystem ctrlSys = m_ClientGlobal.GetControllerSystem(); if (ctrlSys == null) { return; } Client.IController ctrl = ctrlSys.GetActiveCtrl(); if (ctrl == null) { return; } if (targetPos == Vector3.zero) { int skillerror = 0; bool bCanUse = ctrl.FindTargetBySkillID(CurSkillID, ref targetPos, ref target, out skillerror); if (!bCanUse) { Log.LogGroup("ZDY", "不符合规则 不能放技能"); return; } } var cmd = new GameCmd.stMultiAttackUpMagicUserCmd_C(); cmd.dwAttackerID = (uint)m_ClientGlobal.MainPlayer.GetID(); cmd.wdSkillID = uSkillID; cmd.byEntryType = SceneEntryType.SceneEntry_Player; cmd.srcx = (uint)(pos.x); cmd.srcy = (uint)(-pos.z); Vector3 rot = m_Master.GetRotate(); cmd.byDirect = (uint)rot.y; Vector3 sendTargetPos = GetSendTargetPos(database, targetPos); cmd.x = (uint)(sendTargetPos.x * 100); cmd.y = (uint)(-sendTargetPos.z * 100); if (target != null) { stMultiAttackUpMagicUserCmd_C.Item item = new stMultiAttackUpMagicUserCmd_C.Item(); if (target != null) { item.byEntryType = (target.GetEntityType() == EntityType.EntityType_Player ? SceneEntryType.SceneEntry_Player : SceneEntryType.SceneEntry_NPC); item.dwDefencerID = (uint)target.GetID(); } else { item.dwDefencerID = 0; } cmd.data.Add(item); } m_uDamageID++; cmd.tmpid = m_uDamageID; // 填充数据 m_ClientGlobal.netService.Send(cmd); }
public void ExecuteSkillFailed(GameCmd.stMultiAttackReturnMagicUserCmd_S cmd) { ISkillPart skillPart = SkillHelper.GetSkillPart(cmd.dwUserID, EntityType.EntityType_Player); if (skillPart == null) { Engine.Utility.Log.Error("获取主角技能部件失败!"); return; } else { Engine.Utility.EventEngine.Instance().DispatchEvent((int)GameEventID.SKILLGUIDE_PROGRESSBREAK, new stGuildBreak() { action = GameCmd.UninterruptActionType.UninterruptActionType_SkillCJ, uid = cmd.dwUserID, skillid = cmd.wdSkillID }); TimerAxis.Instance().KillTimer(m_uReadSliderTimerID, this); string str = "";// "skill error code = " + cmd.fail_code + " "; if (cmd.fail_code == (int)GameCmd.UseSkillFail.UseSkillFail_success) { //使用成功 } else if (cmd.fail_code == (int)GameCmd.UseSkillFail.UseSkillFail_break) { str = GetLocalText(LocalTextType.Skill_Commond_jinengbeidaduan); } else if (cmd.fail_code == (int)GameCmd.UseSkillFail.UseSkillFail_use) { str = GetLocalText(LocalTextType.Skill_Commond_jinengzhengzaishiyong); Log.Error("使用过程 error code {0}", cmd.fail_code); } else if (cmd.fail_code == (int)GameCmd.UseSkillFail.UseSkillFail_outRange) { Client.IControllerSystem cs = ClientGlobal.Instance().GetControllerSystem(); if (cs != null) { Client.ICombatRobot robot = cs.GetCombatRobot(); if (robot != null && robot.Status == CombatRobotStatus.RUNNING) { if (MainPlayerHelper.GetMainPlayer() == null) { return; } ISkillPart sp = MainPlayerHelper.GetMainPlayer().GetPart(EntityPart.Skill) as ISkillPart; if (sp == null) { return; } if (sp.GetSkillTarget() != null) { Move move = new Move(); Vector3 targePos = sp.GetSkillTarget().GetPos(); Vector3 dir = targePos - MainPlayerHelper.GetMainPlayer().GetPos(); targePos = targePos - dir.normalized * 1f; move.m_target = targePos; move.m_ignoreStand = true; Log.Error("自动挂机,打不到,朝向目标移动"); IController ctr = cs.GetActiveCtrl(); if (ctr != null) { ctr.MoveToTarget(targePos); } //MainPlayerHelper.GetMainPlayer().SendMessage(EntityMessage.EntityCommand_MoveTo, (object)move); // Vector3 lookat = playerSkill.GetSkillTarget().GetNode().GetTransForm().forward; return; } } } str = GetLocalText(LocalTextType.Skill_Commond_mubiaochaochugongjijuli); Log.Error("技能使用超超出范围 error code {0}", cmd.fail_code); } else if (cmd.fail_code == (int)GameCmd.UseSkillFail.UseSkillFail_shapeErr) { str = GetLocalText(LocalTextType.Skill_Commond_bianshenzhuangtaixiabunengshiyongjineng); Log.Error("变身不能使用技能 error code {0}", cmd.fail_code); } else if (cmd.fail_code == (int)GameCmd.UseSkillFail.UseSkillFail_petFight) { str = GetLocalText(LocalTextType.Skill_Commond_chongwuweichuzhanbunengshiyongjineng); Log.Error("宠物未出战不能使用技能 error code {0}", cmd.fail_code); } else if (cmd.fail_code == (int)GameCmd.UseSkillFail.UseSkillFail_notExist) { str = GetLocalText(LocalTextType.Skill_Commond_jinengbucunzai); Log.Error("技能不存在 error code {0}", cmd.fail_code); } else if (cmd.fail_code == (int)GameCmd.UseSkillFail.UseSkillFail_none) { str = GetLocalText(LocalTextType.Skill_Commond_jinengweizhicuowu); Log.Error("技能未知 error code {0}", cmd.fail_code); } else if (cmd.fail_code == (int)GameCmd.UseSkillFail.UseSkillFail_needAim) { str = GetLocalText(LocalTextType.Skill_Commond_shifanggaijinengxuyaoxuanzemubiao); Log.Error("技能需要目标error code {0}", cmd.fail_code); } else if (cmd.fail_code == (int)GameCmd.UseSkillFail.UseSkillFail_aimErr) { str = GetLocalText(LocalTextType.Skill_Commond_mubiaoxuanzecuowu); Log.Error("技能目标错误 error code {0}", cmd.fail_code); } else if (cmd.fail_code == (int)GameCmd.UseSkillFail.UseSkillFail_cantAtt) { str = GetLocalText(LocalTextType.Skill_Commond_dangqianmubiaowufagongji); Log.Error("目标无法攻击 error code {0}", cmd.fail_code); } else if (cmd.fail_code == (int)GameCmd.UseSkillFail.UseSkillFail_inCD) { str = GetLocalText(LocalTextType.Skill_Commond_jinenglengquezhong); Log.Error("技能冷却中 error code {0}", cmd.fail_code); } else if (cmd.fail_code == (int)GameCmd.UseSkillFail.UseSkillFail_lackSP) { str = GetLocalText(LocalTextType.Skill_Commond_fashuzhibuzu); Log.Error("缺蓝 error code {0}", cmd.fail_code); } else if (cmd.fail_code == (int)GameCmd.UseSkillFail.UseSkillFail_flagsErr) { str = GetLocalText(LocalTextType.Skill_Commond_dangqianjinengzhuangtaicuowu); Log.Error("flags error code {0}", cmd.fail_code); } else if (cmd.fail_code == (int)GameCmd.UseSkillFail.UseSkillFail_NeedItemNumNotEnough) { str = GetLocalText(LocalTextType.Skill_Commond_shiyongchongwujinnegsuoxudaojubuzu); Log.Error("使用宠物技能所需道具不足{0}", cmd.fail_code); } else if (cmd.fail_code == (int)GameCmd.UseSkillFail.UseSkillFail_rideCantUse) { NetService.Instance.Send(new GameCmd.stDownRideUserCmd_C() { }); return; //str = GetLocalText(LocalTextType.Skill_Commond_qichengzhuangtaiwufashiyongzhujuejineng); //Log.Error("骑乘无法使用技能{0}", cmd.fail_code); } else if (cmd.fail_code == 16) { //协议未更新 先写数字防止后期忘了 str = "眩晕状态,技能不能使用"; // GetLocalText(LocalTextType.Skill_Commond_qichengzhuangtaiwufashiyongzhujuejineng); Log.Error("瞬移技能不能使用{0}", cmd.fail_code); } else { str = GetLocalText(LocalTextType.Skill_Commond_jinengweizhicuowu); Log.Error("技能未知错误 "); } if (cmd.dwUserID == MainPlayerHelper.GetPlayerID()) { TipsManager.Instance.ShowTips(str); } } skillPart.OnUseSkillFailed(cmd.dwUserID, cmd.wdSkillID); }
private void SendPlayDefenerAniMessage(IEntity defender, string aniName) { CreatureState state = defender.GetCurState(); ShowFlashColor(defender); if (state != CreatureState.Dead) { bool bRide = (bool)defender.SendMessage(EntityMessage.EntityCommond_IsRide, null); if (bRide) { return; } SkillState skillState = GetTargetSkillState(defender); if (skillState != SkillState.Attack && skillState != SkillState.Prepare) { if (defender.GetCurState() == CreatureState.Contrl) { return; } if (state != CreatureState.Move) { Client.IControllerSystem cs = m_ClientGlobal.GetControllerSystem(); if (cs != null) { Client.ICombatRobot robot = cs.GetCombatRobot(); if (robot.Status == CombatRobotStatus.RUNNING) { if (SkillSystem.GetClientGlobal().IsMainPlayer(defender.GetID())) {//自动挂机 不播受击 return; } } } INPC npc = defender as INPC; if (npc != null) { int baseID = npc.GetProp((int)EntityProp.BaseID); NpcDataBase ndb = GameTableManager.Instance.GetTableItem <NpcDataBase>((uint)baseID); if (ndb != null) { if (ndb.dwMonsterType == 3) { return; } } } //defender.SendMessage( EntityMessage.EntityCommand_StopMove , defender.GetPos() ); //移动不播放受击动作 PlayAni anim_param = new PlayAni(); anim_param.strAcionName = aniName; anim_param.fSpeed = 1; anim_param.nStartFrame = 0; anim_param.nLoop = 1; anim_param.fBlendTime = 0.2f; anim_param.aniCallback = OnHitCallback; anim_param.callbackParam = defender; // if (SkillSystem.GetClientGlobal().IsMainPlayer(m_Master.GetID())) // { // Engine.Utility.Log.Info("技能 播放受击动作 {0} {1}", anim_param.strAcionName, state); // } defender.SendMessage(EntityMessage.EntityCommand_PlayAni, anim_param); } else { if (SkillSystem.GetClientGlobal().IsMainPlayer(m_Master.GetID())) { //Engine.Utility.Log.Info("移动不播放受击动作"); } } } else { // Engine.Utility.Log.Error(string.Format("{0}技能状态错误不能播放受击动作 状态:{1}", defender.GetName(), GetTargetSkillState(defender))); } } }
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); } } } }