//升级技能 public IEnumerator SendUpGradeSkillMassage(int skillid) { using (new BlockingLayerHelper(0)) { var msg = NetManager.Instance.UpgradeSkill(skillid); yield return(msg.SendAndWaitUntilDone()); if (msg.State == MessageState.Reply) { if (msg.ErrorCode == (int)ErrorCodes.OK) { PlayerDataManager.Instance.WeakNoticeData.SkillCanUpgrade = false; PlayerDataManager.Instance.WeakNoticeData.SkillTotal = false; PlatformHelper.Event("skill", "upgrade", skillid); PlatformHelper.UMEvent("skill", "upgrade", skillid); EventDispatcher.Instance.DispatchEvent(new UIEvent_SkillFrame_SkillLevelUpEffect(skillid)); ChangeSkillLevelFromDataModel(skillid); } else { if (msg.ErrorCode == (int)ErrorCodes.Error_SkillLevelMax) { var e = new ShowUIHintBoard(700); EventDispatcher.Instance.DispatchEvent(e); } else { UIManager.Instance.ShowNetError(msg.ErrorCode); } } } } }
public void OnBtnAnnouncementClick() { var e = new Event_ServerListButton(2); EventDispatcher.Instance.DispatchEvent(e); PlatformHelper.Event("Announcement"); }
public IEnumerator SendResetSkillTalentMsg(SkillBoxDataModel skillBoxData) { using (new BlockingLayerHelper(0)) { var msg = NetManager.Instance.ResetSkillTalent(skillBoxData.SkillId); yield return(msg.SendAndWaitUntilDone()); if (msg.State == MessageState.Reply) { if (msg.ErrorCode == (int)ErrorCodes.OK) { PlatformHelper.Event("skill", "ResetSkillTalent", skillBoxData.SkillId); PlatformHelper.UMEvent("skill", "ResetSkillTalent", skillBoxData.SkillId); RestSkillTalentData(skillBoxData); RefreshTalentBoardDesc(currentShowTalentId); var e = new ShowUIHintBoard(709); EventDispatcher.Instance.DispatchEvent(e); } else { if (msg.ErrorCode == (int)ErrorCodes.ItemNotEnough) { var e = new ShowUIHintBoard(703); EventDispatcher.Instance.DispatchEvent(e); } else { UIManager.Instance.ShowNetError(msg.ErrorCode); } } } } }
public IEnumerator ComposeItemCoroutine() { using (new BlockingLayerHelper(0)) { var composeCount = PlayerDataManager.Instance.GetExData((int)eExdataDefine.e415); var msg = NetManager.Instance.ComposeItem(DataModel.SelectIndex, 1); yield return(msg.SendAndWaitUntilDone()); if (msg.State == MessageState.Reply) { if (msg.ErrorCode == (int)ErrorCodes.OK) { if (msg.Response == -1) { EventDispatcher.Instance.DispatchEvent(new ShowUIHintBoard(454)); } else { PlatformHelper.Event("city", "compose", DataModel.SelectIndex); //合成前几次获得经验 // if (BuildingData != null) // { // var tbBuilding = Table.GetBuilding(BuildingData.TypeId); // var tbServer = Table.GetBuildingService(tbBuilding.ServiceId); // if (composeCount < tbServer.Param[3]) // { // EventDispatcher.Instance.DispatchEvent(new UIEvent_ComposeFlyAnim(tbServer.Param[2])); // } // } EventDispatcher.Instance.DispatchEvent(new ShowUIHintBoard(453)); } EventDispatcher.Instance.DispatchEvent(new ComposeItemEffectEvent(msg.Response != -1)); } else if (msg.ErrorCode == (int)ErrorCodes.Error_ItemNoInBag_All) { var e = new ShowUIHintBoard(300116); EventDispatcher.Instance.DispatchEvent(e); } else if (msg.ErrorCode == (int)ErrorCodes.Error_ItemComposeID || msg.ErrorCode == (int)ErrorCodes.ItemNotEnough || msg.ErrorCode == (int)ErrorCodes.MoneyNotEnough) { var e = new ShowUIHintBoard(msg.ErrorCode + 200000000); EventDispatcher.Instance.DispatchEvent(e); } else { var e = new ShowUIHintBoard(msg.ErrorCode + 200000000); EventDispatcher.Instance.DispatchEvent(e); Logger.Debug("ComposeItem..................." + msg.ErrorCode); } } else { Logger.Debug("ComposeItem..................." + msg.State); } } }
public IEnumerator SendTeleportRequestCoroutine(int typeId, bool Loop = false) { var msg = Instance.SendTeleportRequest(typeId); yield return(msg.SendAndWaitUntilDone()); if (ObjManager.Instance != null && ObjManager.Instance.MyPlayer != null) { ObjManager.Instance.MyPlayer.IsChangeScene = false; } if (msg.State != MessageState.Reply) { Logger.Debug("SendTeleportRequestCoroutine:MessageState.Timeout"); yield break; } if (msg.ErrorCode != (int)ErrorCodes.OK) { var errorCode = (ErrorCodes)msg.ErrorCode; switch (errorCode) { case ErrorCodes.Error_LevelNoEnough: { EventDispatcher.Instance.DispatchEvent(new ShowUIHintBoard(200000108)); } break; case ErrorCodes.Error_DistanceTooMuch: { if (Loop == false) { yield return(new WaitForSeconds(1f)); NetManager.Instance.StartCoroutine(SendTeleportRequestCoroutine(typeId, true)); } else { UIManager.Instance.ShowNetError(msg.ErrorCode); Logger.Debug("SendTeleportRequestCoroutine:MessageState[{0}]", errorCode); } break; } default: { UIManager.Instance.ShowNetError(msg.ErrorCode); Logger.Debug("SendTeleportRequestCoroutine:MessageState[{0}]", errorCode); } break; } } else { PlatformHelper.Event("TeleportPortal"); } }
public IEnumerator SendAddTalentPointMassage(int talentId) { using (new BlockingLayerHelper(0)) { var msg = NetManager.Instance.UpgradeInnate(talentId); yield return(msg.SendAndWaitUntilDone()); if (msg.State == MessageState.Reply) { if (msg.ErrorCode == (int)ErrorCodes.OK) { PlatformHelper.Event("skill", "addInnate"); PlatformHelper.UMEvent("skill", "addInnate"); ChangeTalentCountToDataModel(talentId); if (Table.GetTalent(talentId).ModifySkill == -1) { SkillDataModel.TalentResetButtonShow = true; PlayerAttr.Instance.SetAttrChange(PlayerAttr.PlayerAttrChange.Talant); } } else { if (msg.ErrorCode == (int)ErrorCodes.Error_InnateNoPoint) { var e = new ShowUIHintBoard(706); EventDispatcher.Instance.DispatchEvent(e); } else if (msg.ErrorCode == (int)ErrorCodes.Error_InnateNoBefore) { var e = new ShowUIHintBoard(705); EventDispatcher.Instance.DispatchEvent(e); } else if (msg.ErrorCode == (int)ErrorCodes.Error_ResNoEnough) { var ee = new ShowUIHintBoard(210108); EventDispatcher.Instance.DispatchEvent(ee); } else { UIManager.Instance.ShowNetError(msg.ErrorCode); } } } } }
private IEnumerator CompleteMissionCoroutine(int id) { using (new BlockingLayerHelper(0)) { var msg = NetManager.Instance.CompleteMission(id); yield return(msg.SendAndWaitUntilDone()); if (msg.State == MessageState.Reply) { UIManager.Instance.RemoveBlockLayer(); var errorCode = (ErrorCodes)msg.ErrorCode; if (ErrorCodes.OK != errorCode) { if (ErrorCodes.Error_NotHaveMission == errorCode) { PlayerDataManager.Instance.ApplyMissions(-1); } else { UIManager.Instance.ShowNetError(msg.ErrorCode); } Logger.Debug("CompleteMission..................." + msg.ErrorCode); //yield break; } // MissionBaseModel data = null; // if (!MissionData.Datas.TryGetValue(id, out data)) // { // Logger.Fatal("Don't have this mission[" + id.ToString() + "]"); // } //PlatformHelper.UMEvent("Mission", "Complete", id); } else { PlatformHelper.Event("mission", "id", id); Logger.Debug("CompleteMission..................." + msg.State); } } }
/// <summary> /// Call the listener function. /// </summary> protected virtual void OnClick() { if (current == null && isEnabled) { //播放声音 if (soundId != -1) { SoundManager.Instance.PlaySoundEffect(soundId); } //统计事件 if (eventId != -1) { PlatformHelper.Event("ButtonEvent", eventId.ToString()); } current = this; EventDelegate.Execute(onClick); current = null; } }
private IEnumerator OperatePetMissionCoroutine(int missionId, PetMissionOpt type, List <int> param) { using (new BlockingLayerHelper(0)) { var array = new Int32Array(); array.Items.AddRange(param); var msg = NetManager.Instance.OperatePetMission(missionId, (int)type, array); yield return(msg.SendAndWaitUntilDone()); if (msg.State == MessageState.Reply) { if (msg.ErrorCode == (int)ErrorCodes.OK) { if (PetMissionOpt.COMPLETE == type) { PlatformHelper.Event("city", "petMissionComplete"); var mission = Instance.GetPetMission(missionId); var tbMissionInfo = Table.GetGetMissionInfo(mission.Level); var count = mission.PetCount; if (count > 0 && count <= 3) { EventDispatcher.Instance.DispatchEvent( new UIEvent_PetFlyAnim(tbMissionInfo.HomeExp[count - 1])); } EventDispatcher.Instance.DispatchEvent(new ShowUIHintBoard(300207)); } //EventDispatcher.Instance.DispatchEvent(new ShowUIHintBoard(300114)); } else { UIManager.Instance.ShowNetError(msg.ErrorCode); Logger.Error(".....OperatePetMissionCoroutine.......{0}.", msg.ErrorCode); } } else { Logger.Error(".....OperatePetMissionCoroutine.......{0}.", msg.State); } } }
public IEnumerator SendTeleportRequestCoroutine(int typeId) { var msg = Instance.SendTeleportRequest(typeId); yield return(msg.SendAndWaitUntilDone()); if (msg.State != MessageState.Reply) { Logger.Debug("SendTeleportRequestCoroutine:MessageState.Timeout"); yield break; } if (msg.ErrorCode != (int)ErrorCodes.OK) { var errorCode = (ErrorCodes)msg.ErrorCode; switch (errorCode) { case ErrorCodes.Error_LevelNoEnough: { EventDispatcher.Instance.DispatchEvent(new ShowUIHintBoard(200000108)); } break; default: { UIManager.Instance.ShowNetError(msg.ErrorCode); Logger.Debug("SendTeleportRequestCoroutine:MessageState[{0}]", errorCode); } break; } } else { PlatformHelper.Event("TeleportPortal"); } }
/// <summary> /// 鏀诲嚮鎸夐挳 /// </summary> /// <param name="skillId">鎶€鑳絀d</param> /// <returns></returns> public bool OnAttackBtnClick(int skillId, bool selectTarget = true) { Logger.Info("OnAttackBtnClick SkillID = " + skillId); PlatformHelper.Event("Skill", "Manual", skillId); var myself = ObjManager.Instance.MyPlayer; //琛ㄦ牸鏁版嵁 var data = Table.GetSkill(skillId); if (data == null) { return(false); } if (selectTarget) { TargetObj = ObjManager.Instance.SelectTargetForSkill(myself, data); } //鐩爣绫诲瀷 var targetType = (SkillTargetType)ObjMyPlayer.GetSkillData_Data(data, eModifySkillType.TargetType); if (targetType == SkillTargetType.SELF || targetType == SkillTargetType.CIRCLE) { return(UseSkill(myself.GetObjId(), skillId)); } if (targetType == SkillTargetType.SECTOR) { var targetObj = TargetObj; if (targetObj != null) { myself.FaceTo(targetObj.Position); return(UseSkill(myself.GetObjId(), skillId, targetObj.GetObjId())); } return(UseSkill(myself.GetObjId(), skillId)); } if (targetType == SkillTargetType.RECT) { var targetObj = TargetObj; if (targetObj != null) { myself.FaceTo(targetObj.Position); return(UseSkill(myself.GetObjId(), skillId)); } return(UseSkill(myself.GetObjId(), skillId)); } if (targetType == SkillTargetType.SINGLE || targetType == SkillTargetType.TARGET_CIRCLE || targetType == SkillTargetType.TARGET_RECT || targetType == SkillTargetType.TARGET_SECTOR) { var targetObj = TargetObj; if (targetObj == null || targetObj.Dead) { targetObj = ObjManager.Instance.SelectNearestCharacter(ObjManager.Instance.MyPlayer.Position, character => !character.Dead && ObjManager.Instance.MyPlayer.IsMyEnemy(character)); } if (null == targetObj || targetObj.Dead) { EventDispatcher.Instance.DispatchEvent(new ShowUIHintBoard(713)); return(false); } return(SelectTarget(targetObj.gameObject, skillId)); } Logger.Info("Unknow target type[{0}]", targetType); return(false); }
private IEnumerator UseBuildServiceCoroutine(int areaId, int serviceId, List <int> param) { using (new BlockingLayerHelper(0)) { var array = new Int32Array(); if (null != param) { { var __list8 = param; var __listCount8 = __list8.Count; for (var __i8 = 0; __i8 < __listCount8; ++__i8) { var item = __list8[__i8]; { array.Items.Add(item); } } } } var msg = NetManager.Instance.UseBuildService(areaId, serviceId, array); yield return(msg.SendAndWaitUntilDone()); if (msg.State == MessageState.Reply) { if (msg.ErrorCode == (int)ErrorCodes.OK) { var building = GetBuildingByAreaId(areaId); var table = Table.GetBuilding(building.TypeId); var type = (BuildingType)table.Type; var count = msg.Response.Data32[0]; if (BuildingType.LogPlace == type) { PlatformHelper.Event("city", "LogPlace"); if (count <= 0) { EventDispatcher.Instance.DispatchEvent(new ShowUIHintBoard(300203)); } else { var tbserver = Table.GetBuildingService(table.ServiceId); var exp = tbserver.Param[4] * count / 10000; var str = string.Format(GameUtils.GetDictionaryText(300200), count); EventDispatcher.Instance.DispatchEvent(new ShowUIHintBoard(str)); EventDispatcher.Instance.DispatchEvent(new CityGetResAnim(areaId, 0, 8, count)); if (exp > 0) { EventDispatcher.Instance.DispatchEvent(new CityGetResAnim(areaId, 1, 8, exp)); } } EventDispatcher.Instance.DispatchEvent(new CityBulidingNoticeAdd(areaId)); PlayerDataManager.Instance.NoticeData.LogPlaceComplete4 = false; //刷新推送 NetManager.Instance.StartCoroutine(RefreshPush(11)); } else if (BuildingType.Mine == type) { PlatformHelper.Event("city", "Mine"); if (count <= 0) { EventDispatcher.Instance.DispatchEvent(new ShowUIHintBoard(300203)); } else { var tbserver = Table.GetBuildingService(table.ServiceId); var exp = tbserver.Param[4] * count / 10000; var str = string.Format(GameUtils.GetDictionaryText(300201), count); EventDispatcher.Instance.DispatchEvent(new ShowUIHintBoard(str)); EventDispatcher.Instance.DispatchEvent(new CityGetResAnim(areaId, 0, 9, count)); if (exp > 0) { EventDispatcher.Instance.DispatchEvent(new CityGetResAnim(areaId, 1, 9, exp)); } } EventDispatcher.Instance.DispatchEvent(new CityBulidingNoticeAdd(areaId)); PlayerDataManager.Instance.NoticeData.MineComplete4 = false; //刷新推送 NetManager.Instance.StartCoroutine(RefreshPush(10)); } else if (BuildingType.MercenaryCamp == type) { if (0 == array.Items[0]) { EventDispatcher.Instance.DispatchEvent(new UIEvent_SelectHatchingCell(-1)); } else if (1 == array.Items[0]) { //完成孵化 PlatformHelper.Event("city", "HatchingComplete"); EventDispatcher.Instance.DispatchEvent(new UIEvent_HatchingRoomEvent("NewPet", count)); } } } else { EventDispatcher.Instance.DispatchEvent(new UIEvent_ErrorTip((ErrorCodes)msg.ErrorCode)); UIManager.Instance.ShowNetError(msg.ErrorCode); Logger.Error(".....UseBuildServiceCoroutine.......{0}.", msg.ErrorCode); } } else { Logger.Error(".....UseBuildServiceCoroutine.......{0}.", msg.State); } } }
private IEnumerator SendCityOptRequestCoroutine(CityOperationType opt, int buildingIdx, List <int> param) { using (new BlockingLayerHelper(0)) { var array = new Int32Array(); if (null != param) { { var __list7 = param; var __listCount7 = __list7.Count; for (var __i7 = 0; __i7 < __listCount7; ++__i7) { var value = __list7[__i7]; { array.Items.Add(value); } } } } var msg = NetManager.Instance.CityOperationRequest((int)opt, buildingIdx, array); yield return(msg.SendAndWaitUntilDone()); if (msg.State != MessageState.Reply) { Logger.Debug("SendBuildRequestCoroutine:MessageState.Timeout"); yield break; } if (msg.ErrorCode != (int)ErrorCodes.OK) { var errorCode = (ErrorCodes)msg.ErrorCode; switch (errorCode) { case ErrorCodes.Error_LevelNoEnough: { EventDispatcher.Instance.DispatchEvent(new ShowUIHintBoard(200000108)); } break; case ErrorCodes.Error_ResNoEnough: { EventDispatcher.Instance.DispatchEvent(new ShowUIHintBoard(200002002)); } break; case ErrorCodes.Error_BuildCountMax: { EventDispatcher.Instance.DispatchEvent(new ShowUIHintBoard(200002801)); } break; case ErrorCodes.Error_NeedCityLevelMore: { EventDispatcher.Instance.DispatchEvent(new ShowUIHintBoard(200002803)); } break; case ErrorCodes.Error_CityCanotBuildMore: { EventDispatcher.Instance.DispatchEvent(new ShowUIHintBoard(300113)); } break; default: UIManager.Instance.ShowNetError(msg.ErrorCode); break; } Logger.Debug("SendBuildRequestCoroutine error=[{0}]", msg.ErrorCode); EventDispatcher.Instance.DispatchEvent(new UIEvent_CityUpdateBuilding(buildingIdx)); yield break; } switch (opt) { case CityOperationType.BUILD: { PlatformHelper.Event("city", "Build"); //EventDispatcher.Instance.DispatchEvent(new ShowUIHintBoard(300108)); } break; case CityOperationType.UPGRADE: { PlatformHelper.Event("city", "Upgrade"); EventDispatcher.Instance.DispatchEvent(new UIEvent_OnCityBuildingOptEvent(buildingIdx, opt)); //EventDispatcher.Instance.DispatchEvent(new ShowUIHintBoard(300107)); } break; case CityOperationType.DESTROY: { //EventDispatcher.Instance.DispatchEvent(new ShowUIHintBoard("Destroy Ok")); var e = new CityBuildingLevelupEvent(buildingIdx); var tbBuilding = Table.GetBuilding(GetBuildingByAreaId(buildingIdx).TypeId); e.HomeExp = Table.GetBuilding(tbBuilding.RemovedBuildID).GetMainHouseExp; EventDispatcher.Instance.DispatchEvent(e); } break; case CityOperationType.ASSIGNPET: case CityOperationType.ASSIGNPETINDEX: { EventDispatcher.Instance.DispatchEvent(new UIEvent_CityAssignPetEvent(buildingIdx)); } break; } } }
public void RegisterPropertyChanged() { DataModel.PushList.PropertyChanged += (sender, args) => { int id; if (int.TryParse(args.PropertyName, out id)) { var key = string.Format("PushKey{0}", id); var value = DataModel.PushList[id] ? 1 : 0; PlayerPrefs.SetInt(key, value); RefreshPushById(id); } }; DataModel.SystemSetting.Other.PropertyChanged += (sender, args) => { if (args.PropertyName == "0") { PlayerDataManager.Instance.SetFlag(480, DataModel.SystemSetting.Other[0]); PlatformHelper.Event("setting", "other", 0); } else if (args.PropertyName == "1") { PlayerDataManager.Instance.SetFlag(481, DataModel.SystemSetting.Other[1]); PlatformHelper.Event("setting", "other", 1); } else if (args.PropertyName == "2") { OtherPlayerVisable(); PlayerDataManager.Instance.SetFlag(482, DataModel.SystemSetting.Other[2]); PlatformHelper.Event("setting", "other", 2); RefreshVisibleEye(); } else if (args.PropertyName == "3") { OtherPlayerEffectVisable(); PlayerDataManager.Instance.SetFlag(483, DataModel.SystemSetting.Other[3]); PlatformHelper.Event("setting", "other", 3); RefreshVisibleEye(); } else if (args.PropertyName == "4") { AutoAim(); PlayerDataManager.Instance.SetFlag(488, DataModel.SystemSetting.Other[4]); PlatformHelper.Event("setting", "other", 4); } else if (args.PropertyName == "5") { CameraShake(); PlayerDataManager.Instance.SetFlag(489, DataModel.SystemSetting.Other[5]); PlatformHelper.Event("setting", "other", 5); } else if (args.PropertyName == "6") { PowerSave(); PlayerDataManager.Instance.SetFlag(490, DataModel.SystemSetting.Other[6]); PlatformHelper.Event("setting", "other", 6); } else if (args.PropertyName == "7") { ChangeFps(); } }; DataModel.SystemSetting.Sound.PropertyChanged += (sender, args) => { if (args.PropertyName == "0") { SoundManager.Instance.EnableBGM = !DataModel.SystemSetting.Sound[0]; PlayerPrefs.SetInt(SoundManager.BGMPrefsKey, SoundManager.Instance.EnableBGM ? 1 : 0); PlatformHelper.Event("setting", "sound", 0); } else if (args.PropertyName == "1") { SoundManager.Instance.EnableSFX = !DataModel.SystemSetting.Sound[1]; PlayerPrefs.SetInt(SoundManager.SFXPrefsKey, SoundManager.Instance.EnableSFX ? 1 : 0); PlatformHelper.Event("setting", "sound", 1); } }; DataModel.AutoCombat.Pickups.PropertyChanged += (sender, args) => { EventDispatcher.Instance.DispatchEvent(new UIEvent_PickSettingChanged()); }; }
public IEnumerator UseBuildServiceCoroutine(Int32Array param, Action onOk) { using (new BlockingLayerHelper(0)) { var tbBuilding = Table.GetBuilding(BuildingData.TypeId); var msg = NetManager.Instance.UseBuildService(BuildingData.AreaId, tbBuilding.ServiceId, param); yield return(msg.SendAndWaitUntilDone()); if (msg.State == MessageState.Reply) { if (msg.ErrorCode == (int)ErrorCodes.OK) { if (param.Items[0] == (int)ForgeState.NoBegin) { DataModel.SmithyCastData.SelectedProduct.State = (int)ForgeState.During; if (FinishTimeCor == null) { FinishTimeCor = NetManager.Instance.StartCoroutine(RefleshFinishTime()); } EventDispatcher.Instance.DispatchEvent(new SmithyOnPlayTweenAnim(param.Items[1])); if (NeedItemShowCoroutine != null) { NetManager.Instance.StopCoroutine(NeedShowCoroutine()); NeedItemShowCoroutine = null; } NeedItemShowCoroutine = NetManager.Instance.StartCoroutine(NeedShowCoroutine()); } else if (param.Items[0] == (int)ForgeState.During) { DataModel.SmithyCastData.SelectedProduct.State = (int)ForgeState.Complete; AnalyseNotice(); } else if (param.Items[0] == (int)ForgeState.Complete) { PlatformHelper.Event("city", "FurnaceComplete"); DataModel.SmithyCastData.SelectedProduct.State = (int)ForgeState.CanAdd; var tbForged = Table.Getforged(BuildingData.Exdata[mCurFurnaceIndex]); var tbserver = Table.GetBuildingService(tbBuilding.ServiceId); if (tbForged != null) { var count = tbForged.NeedTime * tbserver.Param[4] / 10000; //var ee = new UIEvent_SmithyFlyAnim(0, count); //ee.Index = mCurFurnaceIndex; //EventDispatcher.Instance.DispatchEvent(ee); } AnalyseNotice(); } else if (param.Items[0] == 3) //装备进阶功能功能 { var list = DataModel.SmithyEvoData.EvolveItems; for (var i = 0; i < list.Count; i++) { if (list[i].ItemId != -1) { var equipLogic = Table.GetEquipBase(list[i].ItemId).EquipUpdateLogic; var count = Table.GetEquipUpdate(equipLogic).SuccessGetExp; EventDispatcher.Instance.DispatchEvent(new UIEvent_SmithyFlyAnim(1, count)); } } mRefreshEvoUiAction = ResetEvoUI; } if (onOk != null) { onOk(); } } else { UIManager.Instance.ShowNetError(msg.ErrorCode); mRefreshEvoUiAction = null; } } else { var e = new ShowUIHintBoard(220821); EventDispatcher.Instance.DispatchEvent(e); mRefreshEvoUiAction = null; } } }
public void NotifyUseSkill(CharacterUseSkillMsg msg) { if (ObjManager.Instance == null) { Logger.Log2Bugly(" ObjManager.Instance =null"); return; } if (msg == null || msg.Pos == null || msg.Pos.Pos == null) { Logger.Log2Bugly("NotifyUseSkill msg =null"); return; } var chararcter = ObjManager.Instance.FindCharacterById(msg.CharacterId); if (null == chararcter) { Logger.Warn("NotifyUseSkill Cannot find obj[{0}]", msg.CharacterId); return; } if (chararcter.Dead) { return; } //放技能时的坐标 var p = GameLogic.GetTerrainPosition(GameUtils.DividePrecision(msg.Pos.Pos.x), GameUtils.DividePrecision(msg.Pos.Pos.y)); //放技能时的朝向 var dir = new Vector3(GameUtils.DividePrecision(msg.Pos.Dir.x), 0, GameUtils.DividePrecision(msg.Pos.Dir.y)); //如果距离差距过大就直接拉过来 var diff = (chararcter.Position.xz() - p.xz()).magnitude; ObjCharacter mainTargetCharacter = null; if (chararcter.GetObjType() == OBJ.TYPE.MYPLAYER) { PlatformHelper.Event("Skill", "Auto", msg.SkillId); //调整位置 if (diff > GameSetting.Instance.MainPlayerSkillPosErrorDistance) { chararcter.Position = p; } //调整朝向 chararcter.TargetDirection = dir; { var __list1 = msg.TargetObjId; var __listCount1 = __list1.Count; for (var __i1 = 0; __i1 < __listCount1; ++__i1) { var id = __list1[__i1]; { var target = ObjManager.Instance.FindCharacterById(id); if (null != target) { mainTargetCharacter = target; break; } } } } } else { if (chararcter.GetObjType() == OBJ.TYPE.OTHERPLAYER) { if (diff > GameSetting.Instance.OtherPlayerSkillPosErrorDistance) { chararcter.Position = p; } } else { if (diff > GameSetting.Instance.NPCSkillPosErrorDistance) { chararcter.DelayedMove = p; } } var adjustDir = false; { var __list2 = msg.TargetObjId; var __listCount2 = __list2.Count; for (var __i2 = 0; __i2 < __listCount2; ++__i2) { var id = __list2[__i2]; { var target = ObjManager.Instance.FindCharacterById(id); if (null != target) { mainTargetCharacter = target; chararcter.Target = target; if (chararcter.GetObjType() == OBJ.TYPE.NPC) { if (((ObjNPC)chararcter).TowardPlayer) { chararcter.FaceTo(target.Position); } } else { chararcter.FaceTo(target.Position); } adjustDir = true; break; } } } } if (!adjustDir) { chararcter.TargetDirection = dir; } } var skillData = Table.GetSkill(msg.SkillId); if (null == skillData) { Logger.Fatal("Can't find skill[{0}]", msg.SkillId); return; } //放技能 chararcter.UseSkill(skillData, msg.TargetObjId); if (chararcter.GetObjType() == OBJ.TYPE.MYPLAYER) { var e = new SkillReleaseNetBack(skillData.Id, true); EventDispatcher.Instance.DispatchEvent(e); } if (ObjManager.Instance.MyPlayer == null) { Logger.Log2Bugly("ObjManager.Instance.MyPlayer == null"); return; } if (msg.CharacterId != ObjManager.Instance.MyPlayer.GetObjId() && msg.TargetObjId.Contains(ObjManager.Instance.MyPlayer.GetObjId())) { PlayerDataManager.Instance.SetSelectTargetData(chararcter, 1); } if (msg.CharacterId == ObjManager.Instance.MyPlayer.GetObjId() && ObjManager.Instance.MyPlayer != mainTargetCharacter && mainTargetCharacter != null && mainTargetCharacter.Dead == false) { PlayerDataManager.Instance.SetSelectTargetData(mainTargetCharacter, 2); } //Logger.Info("NotifyUseSkill Obj[{0}] skill[{1}]", msg.CharacterId, msg.SkillId); }