public void userCenter() { GameDebug.LogError("userCenter"); }
public static void HandleServerData(ushort protocol, byte[] data) { switch (protocol) { case NetMsg.MSG_TASK_INFO: { S2CTaskInfo pack = S2CPackBase.DeserializePack <S2CTaskInfo>(data); // 首先所有任务的置顶取消 foreach (Task task in TaskManager.Instance.AllTasks) { task.IsOnTop = false; } IsFirstReceiveTaskInfo = !Game.Instance.AllSystemInited; List <Task> newTasks = new List <Task>(); newTasks.Clear(); List <Task> finishedTasks = new List <Task>(); finishedTasks.Clear(); List <Task> newAcceptTasks = new List <Task>(); newAcceptTasks.Clear(); List <Task> doneTasks = new List <Task>(); doneTasks.Clear(); List <Task> tasksToGuide = new List <Task>(); tasksToGuide.Clear(); bool isTitleTaskChanged = false; // 头衔任务是否改变 bool isEscortTaskChanged = false; // 护送任务是否改变 foreach (PkgTaskInfo taskInfo in pack.tasks) { bool isNewTask = false; if (TaskManager.Instance.HasTask(taskInfo.id)) { TaskManager.Instance.DeleteTask(taskInfo.id); } else { isNewTask = true; } var dbTask = TaskDefine.MakeDefine(taskInfo.id); if (dbTask == null) { GameDebug.LogError("Error!!! Can not find task data in db by id " + taskInfo.id); continue; } Task task = new Task(dbTask); uint index = 1; foreach (var step in dbTask.Steps) { Task.StepProgress stepProgress = new Task.StepProgress(); stepProgress.StepId = index; if (taskInfo.value.Count > 0) { stepProgress.CurrentValue = taskInfo.value[0]; } else { stepProgress.CurrentValue = 0; } task.StepProgresss.Add(stepProgress); ++index; } task.StepProgresss.Sort(); task.State = taskInfo.state; task.StartTime = taskInfo.start_time; if (taskInfo.step > 0) { task.CurrentStepIndex = taskInfo.step - 1; } else { task.CurrentStepIndex = 0; } // 提高任务显示优先级 if (IsFirstReceiveTaskInfo == false) { // 头衔任务不受动态排序规则影响 if (task.Define.Type != GameConst.QUEST_TITLE) { Task.IncreaseCurDynamicShowPriority(); task.DynamicShowPriority = Task.CurDynamicShowPriority; } } TaskManager.Instance.AddTask(task); if (task.State == GameConst.QUEST_STATE_DONE) { Task.StepProgress stepProgress = task.CurrentStepProgress; TaskDefine.TaskStep curStep = task.CurrentStep; if (stepProgress != null && curStep != null) { stepProgress.CurrentValue = curStep.ExpectResult; } } // 是否是新接取的任务 if (IsFirstReceiveTaskInfo == false && task.State == GameConst.QUEST_STATE_DOING) { if (task.CurrentStepProgress != null && task.CurrentStepProgress.CurrentValue == 0) { newAcceptTasks.Add(task); } } // 是否自动执行,进入游戏首次收到这个消息不执行副本状态下不执行,新任务不执行,不是在追踪状态的任务不执行 if (IsFirstReceiveTaskInfo == false && SceneHelp.Instance.IsInNormalWild() == true && task.Define.AutoRunType != TaskDefine.EAutoRunType.None) { // 不可接或者失效的任务不可自动执行 if (taskInfo.state != GameConst.QUEST_STATE_UNACCEPT && taskInfo.state != GameConst.QUEST_STATE_INVALID) { if ((task.Define.AutoRunType == TaskDefine.EAutoRunType.AutoRun && InstanceManager.Instance.IsOnHook == false) || task.Define.AutoRunType == TaskDefine.EAutoRunType.ForceAutoRun) { // 如果当前正在导航的任务的自动执行是ForceAutoRun2,则其他任务的自动执行不会打断它 Task navigatingTask = TaskManager.Instance.NavigatingTask; if (navigatingTask == null || navigatingTask.Define.AutoRunType != TaskDefine.EAutoRunType.ForceAutoRun2) { if (taskInfo.state == GameConst.QUEST_STATE_DOING || taskInfo.state == GameConst.QUEST_STATE_DONE) { tasksToGuide.Add(task); } } } else if (task.Define.AutoRunType == TaskDefine.EAutoRunType.ForceAutoRun2) { tasksToGuide.Add(task); } } } if (IsFirstReceiveTaskInfo == false) { if (taskInfo.state == GameConst.QUEST_STATE_FIN) { finishedTasks.Add(task); } } if (IsFirstReceiveTaskInfo == false) { if (taskInfo.state == GameConst.QUEST_STATE_DONE) { doneTasks.Add(task); } } // 任务进度飘字 if (isNewTask == false && taskInfo.state == GameConst.QUEST_STATE_DONE) { TaskHelper.ShowTaskProgressTips(task); } if (IsFirstReceiveTaskInfo == false && isNewTask == true) { newTasks.Add(task); } if (task.Define.Type == GameConst.QUEST_TITLE) { isTitleTaskChanged = true; } if (task.Define.Type == GameConst.QUEST_ESCORT) { isEscortTaskChanged = true; } } //TaskManager.Instance.SortTaskList(); //ClientEventMgr.Instance.FireEvent((int)ClientEvent.TASK_CHANGED, null); StartTaskChangedCoroutine(); if (isTitleTaskChanged == true) { ClientEventMgr.Instance.FireEvent((int)ClientEvent.TITLE_TASK_CHANGED, null); } if (isEscortTaskChanged == true) { ClientEventMgr.Instance.FireEvent((int)ClientEvent.ESCORT_TASK_CHANGED, null); } if (finishedTasks.Count > 0) { ClientEventMgr.Instance.FireEvent((int)ClientEvent.TASK_FINISHED, new CEventBaseArgs(finishedTasks[0].Define.Id)); if (finishedTasks[0].Define.SubmitedTimelineId > 0) { // 是否是婚宴剧情动画 if (finishedTasks[0].Define.SubmitedTimelineId == GameConstHelper.GetUint("GAME_WEDDING_DRAMA_TIMELINE_ID_1")) { TimelineManager.Instance.PlayWeddingChapelTimeline(); } else { TimelineManager.Instance.Play(finishedTasks[0].Define.SubmitedTimelineId); } } } if (newAcceptTasks.Count > 0) { ClientEventMgr.Instance.FireEvent((int)ClientEvent.TASK_NEW_ACCEPTED, new CEventBaseArgs(newAcceptTasks[0].Define.Id)); if (newAcceptTasks[0].Define.ReceivedTimelineId > 0) { // 是否是婚宴剧情动画 if (newAcceptTasks[0].Define.ReceivedTimelineId == GameConstHelper.GetUint("GAME_WEDDING_DRAMA_TIMELINE_ID_1")) { TimelineManager.Instance.PlayWeddingChapelTimeline(); } else { TimelineManager.Instance.Play(newAcceptTasks[0].Define.ReceivedTimelineId); } } // 如果在副本里面接受了AutoRun的赏金任务或者帮派任务,则Post一个TASK_GUIDE的event,等退出副本再次导航这个任务 if (SceneHelp.Instance.IsInInstance == true) { if ((newAcceptTasks[0].Define.AutoRunType == TaskDefine.EAutoRunType.AutoRun && InstanceManager.Instance.IsOnHook == false) || newAcceptTasks[0].Define.AutoRunType == TaskDefine.EAutoRunType.ForceAutoRun || newAcceptTasks[0].Define.AutoRunType == TaskDefine.EAutoRunType.ForceAutoRun2) { BountyTaskInfo bountyTaskInfo = TaskManager.Instance.BountyTaskInfo; GuildTaskInfo guildTaskInfo = TaskManager.Instance.GuildTaskInfo; // bountyTaskInfo.id == 0即首次接取赏金任务时不自动执行 if (newAcceptTasks[0].Define.Type == GameConst.QUEST_SG && !(bountyTaskInfo != null && bountyTaskInfo.id == 0)) { ClientEventMgr.GetInstance().PostEvent((int)ClientEvent.TASK_GUIDE, new CEventBaseArgs(newAcceptTasks[0].Define.Id)); } // guildTaskInfo.id == 0即首次接取帮派任务时不自动执行 else if (newAcceptTasks[0].Define.Type == GameConst.QUEST_GUILD && !(guildTaskInfo != null && guildTaskInfo.id == 0)) { ClientEventMgr.GetInstance().PostEvent((int)ClientEvent.TASK_GUIDE, new CEventBaseArgs(newAcceptTasks[0].Define.Id)); } } } } if (doneTasks.Count > 0) { ClientEventMgr.Instance.FireEvent((int)ClientEvent.TASK_CAN_SUBMIT, new CEventBaseArgs(doneTasks)); } if (SceneHelp.Instance.IsInNormalWild() == true) { if (tasksToGuide.Count > 0) { BountyTaskInfo bountyTaskInfo = TaskManager.Instance.BountyTaskInfo; GuildTaskInfo guildTaskInfo = TaskManager.Instance.GuildTaskInfo; // DoNotAutoRunBountyTaskNextTime为true不自动执行,bountyTaskInfo.id == 0即首次接取赏金任务时不自动执行 if (tasksToGuide[0].Define.Type == GameConst.QUEST_SG && (TaskManager.Instance.DoNotAutoRunBountyTaskNextTime == true || (bountyTaskInfo != null && bountyTaskInfo.id == 0))) { TaskManager.Instance.DoNotAutoRunBountyTaskNextTime = false; } // DoNotAutoRunGuildTaskNextTime为true不自动执行,guildTaskInfo.id == 0即首次接取帮派任务时不自动执行 else if (tasksToGuide[0].Define.Type == GameConst.QUEST_GUILD && (TaskManager.Instance.DoNotAutoRunGuildTaskNextTime == true || (guildTaskInfo != null && guildTaskInfo.id == 0))) { TaskManager.Instance.DoNotAutoRunGuildTaskNextTime = false; } else { // 正在主线任务导航的时候,则不能自动执行其他类型的任务 if ((TaskManager.Instance.IsNavigatingMainTask == false && TaskHelper.MainTaskIsInGuideCoroutine == false) || tasksToGuide[0].Define.Type == GameConst.QUEST_MAIN) { if (tasksToGuide[0].State != GameConst.QUEST_STATE_UNACCEPT && tasksToGuide[0].State != GameConst.QUEST_STATE_FIN && tasksToGuide[0].State != GameConst.QUEST_STATE_INVALID) { if ((TaskManager.Instance.NavigatingTaskType == GameConst.QUEST_NONE || TaskManager.Instance.NavigatingTaskType == tasksToGuide[0].Define.Type) && (TaskHelper.TaskTypeInGuideCoroutine == GameConst.QUEST_NONE || TaskHelper.TaskTypeInGuideCoroutine == tasksToGuide[0].Define.Type)) { // 如果需要自动寻路的任务是第三级别的自动执行,则需要先停止其他的任务寻路 if (tasksToGuide[0].Define.AutoRunType == TaskDefine.EAutoRunType.ForceAutoRun2) { TargetPathManager.Instance.StopPlayerAndReset(); } TaskHelper.TaskGuide(tasksToGuide[0]); } } } } } } if (newTasks.Count > 0) { ClientEventMgr.Instance.FireEvent((int)ClientEvent.TASK_ADDED, new CEventBaseArgs(newTasks[0].Define.Id)); } TaskNet.HaveReceivedTaskInfo = true; break; } case NetMsg.MSG_TASK_DELETE: { S2CTaskDelete pack = S2CPackBase.DeserializePack <S2CTaskDelete>(data); Task navigatingTask = TaskManager.Instance.NavigatingTask; if (navigatingTask != null && navigatingTask.Define.Id == pack.id) { TaskManager.Instance.NavigatingTask = null; TargetPathManager.Instance.StopPlayerAndReset(false); } TaskManager.Instance.DeleteTask(pack.id); //ClientEventMgr.Instance.FireEvent((int)ClientEvent.TASK_CHANGED, null); StartTaskChangedCoroutine(); break; } case NetMsg.MSG_TASK_VALUE: { S2CTaskValue pack = S2CPackBase.DeserializePack <S2CTaskValue>(data); // 其它所有任务的置顶取消 foreach (Task tempTask in TaskManager.Instance.AllTasks) { if (tempTask.Define.Id != pack.id) { tempTask.IsOnTop = false; } } bool isDone = false; uint value = 0; if (pack.value.Count > 0) { isDone = TaskManager.Instance.ChangeTaskCurStepValue(pack.id, pack.value[0]); value = pack.value[0]; } else { isDone = TaskManager.Instance.ChangeTaskCurStepValue(pack.id, 0); } Task task = TaskManager.Instance.GetTask(pack.id); // 提高任务显示优先级,头衔任务不受动态排序规则影响 if (task != null && task.Define.Type != GameConst.QUEST_TITLE) { Task.IncreaseCurDynamicShowPriority(); task.DynamicShowPriority = Task.CurDynamicShowPriority; } //TaskManager.Instance.SortTaskList(); if (SceneHelp.Instance.IsInNormalWild() == true) { if ((isDone == true || InstanceManager.Instance.IsAutoFighting == false) && task != null && task.Define.AutoRunType != TaskDefine.EAutoRunType.None) { if ((task.Define.AutoRunType == TaskDefine.EAutoRunType.AutoRun && InstanceManager.Instance.IsOnHook == false) || task.Define.AutoRunType == TaskDefine.EAutoRunType.ForceAutoRun || task.Define.AutoRunType == TaskDefine.EAutoRunType.ForceAutoRun2) { // 正在主线任务导航的时候,则不能自动执行其他类型的任务 if ((TaskManager.Instance.IsNavigatingMainTask == false && TaskHelper.MainTaskIsInGuideCoroutine == false) || task.Define.Type == GameConst.QUEST_MAIN) { // 进度大于0才自动执行 if (value > 0) { if ((TaskManager.Instance.NavigatingTaskType == GameConst.QUEST_NONE || TaskManager.Instance.NavigatingTaskType == task.Define.Type) && (TaskHelper.TaskTypeInGuideCoroutine == GameConst.QUEST_NONE || TaskHelper.TaskTypeInGuideCoroutine == task.Define.Type)) { TaskHelper.TaskGuide(task); } } } } } } ClientEventMgr.Instance.FireEvent((int)ClientEvent.TASK_PROGRESS_CHANGED, new CEventBaseArgs(pack.id)); break; } case NetMsg.MSG_TASK_SG_INFO: { S2CTaskSgInfo pack = S2CPackBase.DeserializePack <S2CTaskSgInfo>(data); TaskManager.Instance.BountyTaskInfo = new BountyTaskInfo(pack.id, pack.num, pack.is_reward); if (TaskManager.Instance.BountyTaskInfo.id > 0 || TaskManager.Instance.BountyTaskInfo.is_reward == 0) { TaskManager.Instance.BountyTaskCoinReward = 0; } ClientEventMgr.Instance.FireEvent((int)ClientEvent.BOUNTY_TASK_CHANGED, null); if (IsFirstReceiveBountyTaskInfo == false) { if (TaskManager.Instance.BountyTaskInfo.num >= TaskHelper.GetBountyTaskMaxTimes() && TaskManager.Instance.BountyTaskInfo.is_reward == 0) { if (SceneHelp.Instance.IsInWildInstance() == true) { xc.ui.ugui.UIManager.Instance.ShowSysWindow("UITaskWindow", xc.GameConst.QUEST_SG, null); } else { ClientEventMgr.GetInstance().PostEvent((int)ClientEvent.OPEN_TASK_WINDOW, new CEventBaseArgs(xc.GameConst.QUEST_SG)); } } } IsFirstReceiveBountyTaskInfo = false; xc.ui.ugui.UIManager.Instance.ShowWaitScreen(false); break; } case NetMsg.MSG_TASK_REWARD_SG: { S2CTaskRewardSg pack = S2CPackBase.DeserializePack <S2CTaskRewardSg>(data); TaskManager.Instance.BountyTaskCoinReward = pack.coin; ClientEventMgr.Instance.FireEvent((int)ClientEvent.BOUNTY_TASK_CHANGED, null); break; } case NetMsg.MSG_TASK_GUILD_INFO: { S2CTaskGuildInfo pack = S2CPackBase.DeserializePack <S2CTaskGuildInfo>(data); TaskManager.Instance.GuildTaskInfo = new GuildTaskInfo(pack.id, pack.num, pack.reward_state); //if (TaskManager.Instance.GuildTaskInfo.id > 0 || TaskManager.Instance.GuildTaskInfo.reward_state == 1) //{ // TaskManager.Instance.GuildTaskCtbReward = 0; //} ClientEventMgr.Instance.FireEvent((int)ClientEvent.GUILD_TASK_CHANGED, null); if (IsFirstReceiveGuildTaskInfo == false && TaskManager.Instance.GuildTaskInfo.reward_state == 1) { if (TaskManager.Instance.GuildTaskInfo.num >= GameConstHelper.GetInt("GAME_QUEST_GUILD_PRE_NUM")) { if (SceneHelp.Instance.IsInWildInstance() == true) { xc.ui.ugui.UIManager.Instance.ShowSysWindow("UITaskWindow", xc.GameConst.QUEST_GUILD, null); } else { ClientEventMgr.GetInstance().PostEvent((int)ClientEvent.OPEN_TASK_WINDOW, new CEventBaseArgs(xc.GameConst.QUEST_GUILD)); } } } IsFirstReceiveGuildTaskInfo = false; xc.ui.ugui.UIManager.Instance.ShowWaitScreen(false); break; } case NetMsg.MSG_TASK_REWARD_GUILD: { S2CTaskRewardGuild pack = S2CPackBase.DeserializePack <S2CTaskRewardGuild>(data); TaskManager.Instance.GuildTaskCtbReward = pack.ctb; ClientEventMgr.Instance.FireEvent((int)ClientEvent.GUILD_TASK_CHANGED, null); //UINotice.Instance.ShowMessage(string.Format(DBConstText.GetText("BAG_GET_GUILD_CTB"), pack.ctb)); break; } case NetMsg.MSG_TASK_TRANSFER_INFO: { S2CTaskTransferInfo pack = S2CPackBase.DeserializePack <S2CTaskTransferInfo>(data); TaskManager.Instance.TransferTaskInfo = pack; ClientEventMgr.Instance.FireEvent((int)ClientEvent.TRANSFER_TASK_CHANGED, null); break; } case NetMsg.MSG_TASK_REWARD_TRANSFER: { //暂时没有用到 break; } default: break; } }
/// <summary> /// 播放音乐 /// </summary> /// <param name="tempID">模板ID</param> /// <param name="emitter">声音源,现在第二个参数先不用</param> /// <returns>返回声音的实例id</returns> public int Play(int tempID, GameObject emitter = null, bool isLoop = false, float volumn = 1, float delayTime = 0) { var soundVo = DataManager.SoundTable[tempID] as SoundTableItem; if (soundVo == null) { GameDebug.LogError("sound 表没有id:" + tempID + "的资源"); return(-1); } if (mRecentAudios.ContainsKey(soundVo.path)) { return(-1); } AudioClip audioClip = (GetAudioClipByName(soundVo.path)); if (audioClip == null) { return(-1); } mRecentAudios.Add(soundVo.path, new AudioTime(30)); int soundInsId = CreateSoundID(); if (emitter == null) { emitter = SpawnPool.Instance().GetSpawn(); emitter.name = tempID.ToString(); mOwnedObjects.Add(soundInsId, emitter); if (isLoop == false) { mPlayingAudios.Add(soundInsId, new AudioTime(audioClip.length * 1000)); } } else if (emitter.name == "emiPos") { mOwnedObjects.Add(soundInsId, emitter); if (isLoop == false) { mPlayingAudios.Add(soundInsId, new AudioTime(audioClip.length * 1000)); } } else { if (emitter.GetComponent <AudioSource>() == null) { emitter.AddComponent <AudioSource>(); } } AudioSource audioSrc = emitter.GetComponent <AudioSource>(); audioSrc.clip = audioClip; audioSrc.rolloffMode = AudioRolloffMode.Custom; audioSrc.volume = soundVo.volumn != 1 ? soundVo.volumn : volumn; audioSrc.loop = isLoop; audioSrc.playOnAwake = false; audioSrc.mute = IsMute; if (!IsMute) { if (getIsBkSound(tempID)) { if (!mIsBkSound) { audioSrc.mute = true; } else { audioSrc.mute = false; } } else { if (!mIsSound) { audioSrc.mute = true; } else { audioSrc.mute = false; } } } audioSrc.spread = 180; audioSrc.PlayDelayed(delayTime); return(soundInsId); }
public string GetStepFixedDescription(int stepIndex) { var step = GetStep(stepIndex); if (step == null || step.Description == null) { return(string.Empty); } string result = DBConstText.GetText(step.Description); // 对目标名字进行替换 if (step.Goal == GameConst.GOAL_TALK) { result = string.Format(result, NpcHelper.GetNpcName(step.InstanceId, step.NpcId)); } else if (step.Goal == GameConst.GOAL_KILL_MON) { result = string.Format(result, RoleHelp.GetActorName(step.MonsterId)); } else if (step.Goal == GameConst.GOAL_INTERACT) { result = string.Format(result, RoleHelp.GetActorName(NpcHelper.MakeNpcDefine(step.NpcId).ActorId)); } else if (step.Goal == GameConst.GOAL_KILL_COLLECT) { result = string.Format(result, GoodsHelper.GetGoodsOriginalNameByTypeId(step.GoodsId)); } else if (step.Goal == GameConst.GOAL_COLLECT_GOODS) { if (step.MinWorldBossSpecialMonId > 0 && step.MaxWorldBossSpecialMonId > 0) { DBSpecialMon dbSpecialMon = DBManager.Instance.GetDB <DBSpecialMon>(); uint minLevel = dbSpecialMon.GetSpecialMonLevel(step.MinWorldBossSpecialMonId); uint maxLevel = dbSpecialMon.GetSpecialMonLevel(step.MaxWorldBossSpecialMonId); result = string.Format(result, minLevel, maxLevel, GoodsHelper.GetGoodsOriginalNameByTypeId(step.GoodsId)); } else { result = string.Format(result, GoodsHelper.GetGoodsOriginalNameByTypeId(step.GoodsId)); } } else if (step.Goal == GameConst.GOAL_WAR_WIN || step.Goal == GameConst.GOAL_WAR_ENTER || step.Goal == GameConst.GOAL_WAR_GRADE) { result = string.Format(result, InstanceHelper.GetInstanceName(step.InstanceId2)); } else if (step.Goal == GameConst.GOAL_EQUIP_SUBMIT) { result = string.Format(result, GoodsHelper.GetGoodsColorName(step.EquipColor) + xc.Equip.EquipHelper.GetEquipLvStepName(step.EquipLvStep)); } else if (step.Goal == GameConst.GOAL_SECRET_AREA) { result = string.Format(result, InstanceHelper.GetKungfuGodInstanceName(step.SecretAreaId)); } else if (step.Goal == GameConst.GOAL_TRIGRAM) { result = string.Format(result, TaskHelper.GetTrigramName(step.TrigramId)); } else if (step.Goal == GameConst.GOAL_EQUIP_WEAR) { result = string.Format(result, GoodsHelper.GetGoodsColorName(step.EquipColor) + xc.Equip.EquipHelper.GetEquipLvStepName(step.EquipLvStep)); } else if (step.Goal == GameConst.GOAL_EQUIP_STRENGTH) { result = string.Format(result, step.EquipStrenghtLv); } else if (step.Goal == GameConst.GOAL_EQUIP_GEM) { } else if (step.Goal == GameConst.GOAL_PET_LV) { result = string.Format(result, step.PetLv); } else if (step.Goal == GameConst.GOAL_GROW_LV) { } else if (step.Goal == GameConst.GOAL_STIGMA_LV) { DBStigma dbStigma = DBManager.Instance.GetDB <DBStigma>(); DBStigma.DBStigmaInfo stigmaInfo = dbStigma.GetOneDBStigmaInfo(step.StigmaId); if (stigmaInfo != null) { string name = stigmaInfo.Name; result = string.Format(result, name); } else { GameDebug.LogError("GetStepFixedDescription error, can not find stigma info by id " + step.StigmaId); } } else if (step.Goal == GameConst.GOAL_DRAGON_SOUL) { result = string.Format(result, step.ExpectResult); } else if (step.Goal == GameConst.GOAL_EQUIP_STRENGTH_TLV) { result = string.Format(result, step.EquipStrenghtLv); } else if (step.Goal == GameConst.GOAL_KILL_BOSS) { if (step.MonsterLevel > 0) { result = string.Format(result, step.ExpectResult, step.MonsterLevel); } else { result = string.Format(result, step.ExpectResult); } } else if (step.Goal == GameConst.GOAL_LIGHT_EQUIP) { List <string> names = DBManager.Instance.QuerySqliteField <string>(GlobalConfig.DBFile, "data_light_equip", "id", step.LightEquipLv.ToString(), "desc"); if (names != null && names.Count > 0) { result = string.Format(result, names[0]); } } else { result = TaskHelper.GetStepFixedDescriptionByLua(step); } return(result); }
public void OnGetServerStateFinished(string url, string error, string reply, System.Object userData) { #if UNITY_IPHONE reply = Utils.AES.Decode(reply, Const.CS_URL_KEY, Const.CS_URL_IV); #endif System.Object replyObject = MiniJSON.JsonDecode(reply); if (CheckReply(url, error, replyObject) == false) { if (mGetServerStateFinishedCallback != null) { mGetServerStateFinishedCallback(null, false); } return; } ServerInfo serverInfo = userData as ServerInfo; if (serverInfo == null) { GameDebug.LogError("Error in OnGetServerStateFinished, serverInfo is null!!!"); return; } Hashtable hashtable = (replyObject as Hashtable)["args"] as Hashtable; if (hashtable != null) { serverInfo.State = (EServerState)DBTextResource.ParseI(hashtable["status"].ToString()); } bool canEnter = CheckServerState(serverInfo); // 如果是不推荐进入的服务器,则读取recomm属性选中推荐的服务器 if (serverInfo.State == EServerState.NotRecomm) { if (hashtable != null) { Hashtable recommHashtable = hashtable["recomm"] as Hashtable; if (recommHashtable != null) { ServerInfo recommServerInfo = ParseServerInfo(recommHashtable); if (recommServerInfo != null) { xc.ui.UIWidgetHelp.GetInstance().ShowNoticeDlg(DBConstText.GetText("SERVER_NOT_RECOMM_TIPS"), (x) => { ClientEventMgr.Instance.FireEvent((int)ClientEvent.CE_SELECT_SERVER, new CEventBaseArgs(recommServerInfo)); }); canEnter = false; } } } } if (mGetServerStateFinishedCallback != null) { mGetServerStateFinishedCallback(serverInfo, canEnter); } if (canEnter == false || mEnterWhenGetServerStateFinished == false) { return; } GlobalConfig.GetInstance().LoginInfo.ServerInfo = serverInfo; string[] ips = serverInfo.Url.Split(':'); Game game = Game.GetInstance(); game.ServerIP = ips[0]; game.ServerPort = DBTextResource.ParseI(ips[1]); game.ServerID = (uint)serverInfo.SId; ControlServerLogHelper.GetInstance().PostAccountLoginLogS(serverInfo.ServerId, serverInfo.State); game.GameMode = (Game.EGameMode)((int)game.GameMode | (int)xc.Game.EGameMode.GM_Net); game.Login(); }
public int[] combo_time; //普攻连击限制 //-------------------------------------------------------------------------------------- public override void ParseJson(object jd) { Dictionary <string, object> item = (Dictionary <string, object>)jd; skill_id = item.TryGetLong("skillid"); name = item.TryGetString("name"); hero_id = item.TryGetLong("hero_id"); skill_name = item.TryGetString("skill_name"); des = item.TryGetString("des"); skill_atlas = item.TryGetString("icon_atlas"); skill_icon = item.TryGetString("skill_icon"); spell_motion = item.TryGetString("skill_motion"); sound = item.TryGetString("sound"); hit_sound = item.TryGetString("hit_sound"); target_ceiling = item.TryGetByte("target_ceiling"); attack_type = item.TryGetByte("attack_type"); types = item.TryGetByte("types"); dist = item.TryGetFloat("dist"); castBefore = item.TryGetFloat("end_motion"); if (item.ContainsKey("singular_aoe")) { isSingle = item["singular_aoe"] == null ? true : byte.Parse(item["singular_aoe"].ToString()) == 0; } if (item.ContainsKey("ignore_terrain")) { ignoreTerrain = item["ignore_terrain"] == null ? false : byte.Parse(item["ignore_terrain"].ToString()) == 0; } if (item.ContainsKey("pierce through")) { isPierce = item["pierce through"] == null ? false : byte.Parse(item["pierce through"].ToString()) == 0; } flight_speed = item.TryGetFloat("flight_speed"); if (item.ContainsKey("max_fly")) { max_fly = item["max_fly"] == null ? 0 : float.Parse(item["max_fly"].ToString()); } skill_type = item.ContainsKey("skill_type") && item["skill_type"] != null ? (SkillCastType)byte.Parse(item["skill_type"].ToString()) : (SkillCastType)0; if (item.ContainsKey("range_type")) { range_type = (rangeType)byte.Parse(item["range_type"].ToString()); } aoe_long = item.TryGetFloat("aoe_long"); aoe_wide = item.TryGetFloat("aoe_wide"); angle = item.TryGetFloat("angle"); site = item.TryGetInt("site"); seat = item.TryGetInt("seat"); alertedType = item.TryGetInt("alerted_type"); length_base = item.TryGetFloat("length_base"); energy = item.TryGetInt("energy"); if (item.ContainsKey("choose_target")) { choseTarget = (ChoseTarget)(int.Parse(item["choose_target"].ToString())); } if (item.ContainsKey("rangen_type")) { object[] rangens = item["rangen_type"] as object[]; if (rangens != null) { rangenValue.type = rangens.Length > 0 ? (RangenType)(int.Parse(rangens[0].ToString())) : RangenType.OuterCircle; switch (rangenValue.type) { case RangenType.OuterCircle: rangenValue.outerRadius = rangens.Length > 1 ? float.Parse(rangens[1].ToString()) : 0; break; case RangenType.OuterCircle_InnerCube: rangenValue.outerRadius = rangens.Length > 1 ? float.Parse(rangens[1].ToString()) : 0; rangenValue.length = rangens.Length > 2 ? float.Parse(rangens[2].ToString()) : 0; rangenValue.width = rangens.Length > 3 ? float.Parse(rangens[3].ToString()) : 0; break; case RangenType.OuterCircle_InnerSector: rangenValue.outerRadius = rangens.Length > 1 ? float.Parse(rangens[1].ToString()) : 0; rangenValue.angle = rangens.Length > 2 ? float.Parse(rangens[2].ToString()) : 0; break; case RangenType.OuterCircle_InnerCircle: rangenValue.outerRadius = rangens.Length > 1 ? float.Parse(rangens[1].ToString()) : 0; rangenValue.innerRadius = rangens.Length > 2 ? float.Parse(rangens[2].ToString()) : 0; break; case RangenType.InnerCube: rangenValue.length = rangens.Length > 1 ? float.Parse(rangens[1].ToString()) : 0; rangenValue.width = rangens.Length > 2 ? float.Parse(rangens[2].ToString()) : 0; break; default: break; } } } if (item.ContainsKey("interval_time")) { interval_time = FSDataNodeTable <SkillNode> .GetSingleton().ParseToFloatArray(item["interval_time"]); } if (item.ContainsKey("damage_ratio")) { damage_ratio = FSDataNodeTable <SkillNode> .GetSingleton().ParseToFloatArray(item["damage_ratio"]); } if (item.ContainsKey("nullity_type")) { int[] nodelist = item["nullity_type"] as int[]; if (nodelist != null) { nullity_type = new int[nodelist.Length]; for (int m = 0; m < nodelist.Length; m++) { nullity_type[m] = nodelist[m]; } } } if (item.ContainsKey("influence_type")) { int[] influenceList = item["influence_type"] as int[]; if (influenceList != null) { influence_type = influenceList; } } missable = item.TryGetByte("missable"); efficiency_time = item.TryGetFloat("efficiency_time"); effect_time = item.TryGetFloat("effect_time"); cooling = item.TryGetFloat("cooling"); if (item.ContainsKey("base_num1")) { base_num1 = FSDataNodeTable <SkillNode> .GetSingleton().ParseToFloatArray(item["base_num1"]); } if (item.ContainsKey("growth_ratio1")) { growth_ratio1 = FSDataNodeTable <SkillNode> .GetSingleton().ParseToFloatArray(item["growth_ratio1"]); } if (item.ContainsKey("skill_ratio")) { skill_ratio = FSDataNodeTable <SkillNode> .GetSingleton().ParseToFloatArray(item["skill_ratio"]); if (skill_ratio == null) { GameDebug.LogError("skill_ratio null"); } } if (item.ContainsKey("stats")) { stats = item["stats"] as int[]; } if (item.ContainsKey("buffs_target")) { buffs_target = item["buffs_target"] as int[]; } if (item.ContainsKey("special_buffs")) { specialBuffs = (object[])item["special_buffs"]; } if (item.ContainsKey("skill_parts")) { skill_parts = FSDataNodeTable <SkillNode> .GetSingleton().ParseToLongArray(item["skill_parts"]); } if (item.ContainsKey("add_state")) { add_state = item["add_state"] as object[]; } range = item.TryGetFloat("dist"); warn_time = item.TryGetFloat("warn_time"); // nullity_type = byte.Parse(item["nullity_type"].ToString()); animatorTime = item.TryGetFloat("actuation time"); if (item.ContainsKey("life_drain")) { life_drain = item["life_drain"] as object[]; } if (item.ContainsKey("alerted_position")) { alerted_position = item.TryGetInt("alerted_position"); } //-------------------------------------------------------------------------------------- //新加数据 energyvalue = item.TryGetInt("energy_value"); can_move = item.TryGetInt("can_move") == 2; is_turnround = item.TryGetInt("is_turnround") == 1; face_type = (FaceType)item.TryGetInt("face_type"); effect = item.TryGetStringIntArr("effect"); effect_position = item.TryGetIntArr("effect_position"); if (item.ContainsKey("effect_positionxyz") && item["effect_positionxyz"] != null) { object[] effect_positionxyz_temp = item["effect_positionxyz"] as object[]; GetVector3List(effect_positionxyz, effect_positionxyz_temp); } effect_start = item.TryGetDoubleArr("effect_start"); effect_end = item.TryGetDoubleArr("effect_end"); skill_usetype = (SkillUseType)item.TryGetInt("skill_usetype"); bullet_time = item.TryGetDoubleArr("bullet_time"); bullet_id = item.TryGetIntArr("bullet_id"); bul_target_type = item.TryGetIntArr("bul_target_type"); if (item.ContainsKey("bul_target_value") && item["bul_target_value"] != null) { bul_target_value = new List <int[]>(); object[] bul_target_value_temp = item["bul_target_value"] as object[]; for (int i = 0; i < bul_target_value_temp.Length; i++) { int[] objs = bul_target_value_temp[i] as int[]; bul_target_value.Add(objs); } } bul_target_size = item.TryGetIntArr("bul_target_size"); max_bul = item.TryGetIntArr("max_bul"); if (item.ContainsKey("bul_num_single") && item["bul_num_single"] != null) { bul_num_single = new List <int[]>(); object[] bul_num_single_temp = item["bul_num_single"] as object[]; for (int i = 0; i < bul_num_single_temp.Length; i++) { int[] objs = bul_num_single_temp[i] as int[]; bul_num_single.Add(objs); } } bul_start = item.TryGetIntArr("bul_start"); isFiringPoint = item.TryGetInt("firing"); if (item.ContainsKey("firing_xyz") && item["firing_xyz"] != null) { object[] firing_xyz_temp = item["firing_xyz"] as object[]; GetVector3List(firing_xyz, firing_xyz_temp); } bul_end = item.TryGetInt("bul_end"); if (item.ContainsKey("bul_end_xyz") && item["bul_end_xyz"] != null) { object[] bul_end_xyz_temp = item["bul_end_xyz"] as object[]; GetVector3List(bul_end_xyz, bul_end_xyz_temp); } bul_end_angle = item.TryGetIntArr("bul_end_angle"); bul_son_max = item.TryGetIntArr("bul_son_max"); combo_time = item.TryGetIntArr("combo_time"); //-------------------------------------------------------------------------------------- }
protected override void ParseData(SqliteDataReader reader) { if (reader == null || !reader.HasRows) { return; } SysConfig config = null; while (reader.Read()) { var id = DBTextResource.ParseUI(GetReaderString(reader, "sys_id")); config = new SysConfig(id); var sys_title = GetReaderString(reader, "sys_title"); var level = DBTextResource.ParseUS_s(GetReaderString(reader, "lv_open"), 0); string taskTypeStr = GetReaderString(reader, "task_limit"); if (string.IsNullOrEmpty(taskTypeStr)) { taskTypeStr = "0"; } var task_type = (ESysTaskType)Enum.Parse(typeof(ESysTaskType), taskTypeStr); var task_id = DBTextResource.ParseUI_s(GetReaderString(reader, "task_args"), 0); string positionStr = GetReaderString(reader, "position"); if (string.IsNullOrEmpty(positionStr)) { positionStr = "0"; } var pos = (ESysBtnPos)Enum.Parse(typeof(ESysBtnPos), positionStr); uint sub_pos = DBTextResource.ParseUI_s(GetReaderString(reader, "sub_pos"), 0); string fixedPosStr = GetReaderString(reader, "fixed_pos"); if (string.IsNullOrEmpty(fixedPosStr)) { fixedPosStr = "0"; } var is_fixed = (ESysBtnFixType)DBTextResource.ParseUI_s(fixedPosStr, 1); bool show_bg = DBTextResource.ParseUI_s(GetReaderString(reader, "show_bg"), 0) == 1; uint is_activity = DBTextResource.ParseUI_s(GetReaderString(reader, "is_activity"), 0); var desc = GetReaderString(reader, "desc"); var btn_sprite = GetReaderString(reader, "btn_spr"); var btn_text = GetReaderString(reader, "btn_text"); var sort_order = DBTextResource.ParseBT_s(GetReaderString(reader, "sort_order"), 0); var transfer_limit = DBTextResource.ParseUI_s(GetReaderString(reader, "transfer_limit"), 0); var not_open_tips = GetReaderString(reader, "not_open_tips"); var main_ui_btn_id = DBTextResource.ParseUI_s(GetReaderString(reader, "main_ui_btn_id"), 0); config.Init(level, task_type, task_id, pos, sub_pos, is_fixed, show_bg, is_activity == 1, desc, btn_sprite, btn_text, sort_order, transfer_limit, not_open_tips, sys_title, main_ui_btn_id); config.NeedAnim = DBTextResource.ParseUI_s(GetReaderString(reader, "is_need_anim"), 0) == 0 ? false : true; if (pos == ESysBtnPos.NONE) // 当在主ui上没有按钮图标的时候,也一定不需要播放开启的动画 { if (config.NeedAnim) { config.NeedAnim = false; GameDebug.LogError(string.Format("sys:{0} 在主ui上没有图标, 却配置了开启动画", id)); } } config.InitNeedShow = DBTextResource.ParseUI_s(GetReaderString(reader, "is_need_show"), 0) == 0 ? false : true; config.PatchId = DBTextResource.ParseI_s(GetReaderString(reader, "patch_id"), 0); config.HideBtnWhenActNotOpen = DBTextResource.ParseUI_s(GetReaderString(reader, "hide_btn_when_act_not_open"), 0) == 0 ? false : true; config.SysIdClosePresent = DBTextResource.ParseUI_s(GetReaderString(reader, "sys_id_close_present"), 0); // 如果有系统开放关联配置,需要将数据存在另外的字典中 if (config.SysIdClosePresent != 0) { List <uint> notifySysIdList = null; if (!mConfigRelation.TryGetValue(config.SysIdClosePresent, out notifySysIdList)) { notifySysIdList = new List <uint>(); mConfigRelation[config.SysIdClosePresent] = notifySysIdList; } if (!notifySysIdList.Contains(config.Id)) { notifySysIdList.Add(config.Id); } } config.TabOrder = DBTextResource.ParseUI_s(GetReaderString(reader, "tab_order"), 0); config.DropDown = DBTextResource.ParseArrayUint(GetReaderString(reader, "drop_down"), ","); config.DropDownType = DBTextResource.ParseUI(GetReaderString(reader, "drop_down_type")); config.UIBehavior = DBTextResource.ParseArrayString(GetReaderString(reader, "ui_behavior")); config.TimeLimitStr = GetReaderString(reader, "time_limit"); config.CustomCondition = DBTextResource.ParseUI_s(GetReaderString(reader, "custom_condition"), 0) == 0 ? false : true; mConfigList.Add(config); mConfigMap[config.Id] = config; } mConfigList.Sort(); }
/// <summary> /// Reload the font data. /// </summary> static public void Load(BMFont font, string name, byte[] bytes) { font.Clear(); if (bytes != null) { ByteReader reader = new ByteReader(bytes); char[] separator = new char[] { ' ' }; while (reader.canRead) { string line = reader.ReadLine(); if (string.IsNullOrEmpty(line)) { break; } string[] split = line.Split(separator, System.StringSplitOptions.RemoveEmptyEntries); int len = split.Length; if (split[0] == "char") { // Expected data style: // char id=13 x=506 y=62 width=3 height=3 xoffset=-1 yoffset=50 xadvance=0 page=0 chnl=15 int channel = (len > 10) ? GetInt(split[10]) : 15; if (len > 9 && GetInt(split[9]) > 0) { Debug.LogError("Your font was exported with more than one texture. Only one texture is supported by NGUI.\n" + "You need to re-export your font, enlarging the texture's dimensions until everything fits into just one texture."); break; } if (len > 8) { int id = GetInt(split[1]); BMGlyph glyph = font.GetGlyph(id, true); if (glyph != null) { glyph.x = GetInt(split[2]); glyph.y = GetInt(split[3]); glyph.width = GetInt(split[4]); glyph.height = GetInt(split[5]); glyph.offsetX = GetInt(split[6]); glyph.offsetY = GetInt(split[7]); glyph.advance = GetInt(split[8]); glyph.channel = channel; } else { GameDebug.Log("Char: " + split[1] + " (" + id + ") is NULL"); } } else { GameDebug.LogError("Unexpected number of entries for the 'char' field (" + name + ", " + split.Length + "):\n" + line); break; } } else if (split[0] == "kerning") { // Expected data style: // kerning first=84 second=244 amount=-5 if (len > 3) { int first = GetInt(split[1]); int second = GetInt(split[2]); int amount = GetInt(split[3]); BMGlyph glyph = font.GetGlyph(second, true); if (glyph != null) { glyph.SetKerning(first, amount); } } else { Debug.LogError("Unexpected number of entries for the 'kerning' field (" + name + ", " + split.Length + "):\n" + line); break; } } else if (split[0] == "common") { // Expected data style: // common lineHeight=64 base=51 scaleW=512 scaleH=512 pages=1 packed=0 alphaChnl=1 redChnl=4 greenChnl=4 blueChnl=4 if (len > 5) { font.charSize = GetInt(split[1]); font.baseOffset = GetInt(split[2]); font.texWidth = GetInt(split[3]); font.texHeight = GetInt(split[4]); int pages = GetInt(split[5]); if (pages != 1) { Debug.LogError("Font '" + name + "' must be created with only 1 texture, not " + pages); break; } } else { Debug.LogError("Unexpected number of entries for the 'common' field (" + name + ", " + split.Length + "):\n" + line); break; } } else if (split[0] == "page") { // Expected data style: // page id=0 file="textureName.png" if (len > 2) { font.spriteName = GetString(split[2]).Replace("\"", ""); font.spriteName = font.spriteName.Replace(".png", ""); font.spriteName = font.spriteName.Replace(".tga", ""); } } } } }
/// <summary> /// buff开始作用. 添加属性, 动态标记等. /// </summary> protected virtual void onEnabled(bool bEnabled, SkillEffectStopReason stopReason) { // 特效 if (bEnabled) { SkillClientBehaviour.AddEffect2Object(mOwner, mBuffRes._3DEffectID, mBuffRes._3DEffectBindpoint, 0f, mBuffRes.loop3DEffect, mClientBehaviourIdContainer); SkillClientBehaviour.PlayAnimation(mOwner, mBuffRes.animationName, mBuffRes.loopAnimation, mClientBehaviourIdContainer); } else { SkillClientBehaviour.RemoveAll(mOwner, mClientBehaviourIdContainer); } // 检查目标是否可以被控制, 并保存标记, 表示该buff是否对目标产生了控制. if ((bEnabled && mOwner.CanBeStuned()) || (!bEnabled && mStunEnabled)) { enableStun(bEnabled); mStunEnabled = bEnabled; } if (mBuffRes.stunImmunity) { mOwner.AddActiveFlag(ActiveFlagsDef.StunImmunity, bEnabled, true); } if (mBuffRes.damageImmunity) { mOwner.AddActiveFlag(ActiveFlagsDef.DamageImmunity, bEnabled, true); } if (mBuffRes.inviolability) { mOwner.AddActiveFlag(ActiveFlagsDef.Inviolability, bEnabled, true); } if (mBuffRes.magneticEffect) { mOwner.AddActiveFlag(ActiveFlagsDef.MagneticEffect, bEnabled, true); } if (mBuffRes.strokeEffect) { mOwner.AddActiveFlag(ActiveFlagsDef.StrokeEffect, bEnabled, true); } if (mBuffRes.randEvent != uint.MaxValue) { if (bEnabled) { mOwner.AddRandEvent(mBuffRes, mAttackerAttr); } else { mOwner.RemoveRandEvent(mBuffRes, stopReason); } } if (bEnabled) // mStackCount == 0. { AddStack(); if (mBuffRes.newModelID != uint.MaxValue) { mOwner.Transform((int)mBuffRes.newModelID); } if (mBuffRes.newWeaponID != uint.MaxValue) { mOwner.ChangeWeapon((int)mBuffRes.newWeaponID); mOwner.AddActiveFlag(ActiveFlagsDef.DisableChangeWeaponModel, true, false); } if (mBuffRes.superNewWeaponID != uint.MaxValue) { if (mOwner is Player) { if ((mOwner as Player).HasSuperWeapon()) { (mOwner as Player).UnEquipSuperWeapon(); } mLastUseWeapon = (uint)mOwner.GetMainWeaponID(); (mOwner as Player).SceneChangeWeapon((int)mBuffRes.superNewWeaponID); mOwner.AddActiveFlag(ActiveFlagsDef.DisableChangeWeapon, true, false); } else { GameDebug.LogError("只有玩家支持使用buff更换武器"); } } if (mSkillTransform != null) { mOwner.SkillTransform(mSkillTransform); } } else { removeAllStacks(); if (mBuffRes.newModelID != uint.MaxValue) { mOwner.UndoTransform(); } if (mBuffRes.newWeaponID != uint.MaxValue && mOwner is Player) { mOwner.AddActiveFlag(ActiveFlagsDef.DisableChangeWeaponModel, false, false); mOwner.ChangeWeapon(mOwner.GetMainWeaponID()); } if (mBuffRes.superNewWeaponID != uint.MaxValue) { if (mOwner is Player) { mOwner.AddActiveFlag(ActiveFlagsDef.DisableChangeWeapon, false, false); (mOwner as Player).SceneChangeWeapon((int)mLastUseWeapon); } else { GameDebug.LogError("只有玩家支持使用buff更换武器"); } } if (mSkillTransform != null) { mOwner.SkillTransform(null); } } }
private void OnCSLoginFinished(string url, string error, string reply, System.Object userData) { //GameDebug.LogError("OnCSLoginFinished url: " + url); if (String.IsNullOrEmpty(error) == false) { GameDebug.LogError("OnCSLoginFinished error: " + error); if (String.IsNullOrEmpty(error)) { error = xc.TextHelper.SDKLogingFail + "(" + error + ")"; } endLogin((int)SDK_STATU_CODE.LOGIN_FAIL, error); return; } GameDebug.Log("CS Login succeed, msg = " + reply); Hashtable hashtable = MiniJSON.JsonDecode(reply) as Hashtable; if (hashtable != null) { int errorCode = 0; Hashtable retArgs = hashtable["args"] as Hashtable; if (hashtable["result"] != null) { errorCode = DBTextResource.ParseI(hashtable["result"].ToString()); } if (errorCode != 1) { string msg = "CS login error"; if (retArgs["error_msg"] != null) { msg = retArgs["error_msg"] as string; } endLogin((int)SDK_STATU_CODE.LOGIN_FAIL, msg); return; } string passport = ""; if (retArgs["passport"] != null) { passport = "" + DBTextResource.ParseI(retArgs["passport"].ToString());//(hashtable["passport"] as int) + ""; //数据发送给 talking data //DBOSManager.getOSBridge().onTDLogin(passport); } string providerPassport = ""; if (retArgs["provider_passport"] != null) { providerPassport = retArgs["provider_passport"] as string; } string ticket = ""; if (retArgs["ticket"] != null) { ticket = retArgs["ticket"] as string; } string errorMsg = ""; if (retArgs["error_msg"] != null) { errorMsg = retArgs["error_msg"] as string; } GlobalConfig globalConfig = GlobalConfig.GetInstance(); if (retArgs["status"] != null) // 是否需要输入激活码 { globalConfig.LoginInfo.Status = retArgs["status"].ToString(); } if (retArgs["roll_server"] != null) // 滚服次数 { globalConfig.LoginInfo.RollServer = DBTextResource.ParseUI(retArgs["roll_server"].ToString()); } if (errorCode == 1 && passport != null && ticket != null) { GameDebug.Log("Get status success, sdkname:" + globalConfig.SDKName + ", passport:" + passport + ", ticket:" + ticket + ", errorMsg:" + errorMsg + ", errorCode:" + errorCode); globalConfig.LoginInfo.AccName = passport; globalConfig.LoginInfo.ProviderPassport = providerPassport; globalConfig.LoginInfo.Ticket = ticket; //添加初始化话绑定手机逻辑 int bindMobileState = -1; int bindMobileSwitch = 0; if (retArgs["bindMobileSwitch"] != null) { bindMobileSwitch = DBTextResource.ParseI(retArgs["bindMobileSwitch"].ToString()); if (bindMobileSwitch == 1) { bindMobileState = 0; int isBindMobile = 0; if (retArgs["isBindMobile"] != null) { isBindMobile = DBTextResource.ParseI(retArgs["isBindMobile"].ToString()); if (isBindMobile == 1) { bindMobileState = 1; } } } } GlobalConfig.Instance.BindMobileState = bindMobileState; OnSDKLoginSucceed(passport, ticket); // 首次登录_37wan渠道 var first37WanUjoy = PlayerPrefs.GetInt(BuriedPointConst.first37WanUjoy, 0); if (first37WanUjoy == 0) { PlayerPrefs.SetInt(BuriedPointConst.first37WanUjoy, 1); PlayerPrefs.Save(); BuriedPointHelper.ReportEsaAppsflyerEvnet("custom_loss", "finishlogin_new_37wan_ujoy_firsttime", 1); } } else { endLogin((int)SDK_STATU_CODE.LOGIN_FAIL, errorMsg); } } else { endLogin((int)SDK_STATU_CODE.LOGIN_FAIL, reply); } }
/// <summary> /// 注册动画触发事件 /// </summary> /// <param name="id"></param> /// <param name="ani"></param> /// <param name="kInfo"></param> void RegisterEvent(int id, string ani, CallBackInfo call_Info) { CallBackInfo info = GetCallBackInfos(id); if (info == null) { mEventMap.Add(id, call_Info); } else { GameDebug.LogError("[RegisterEvent]Has same id"); } if (m_AnimationClips == null) { GameDebug.LogError("[RegisterEvent]m_AnimationClips is null"); return; } // 注册AnimationEvent AnimationClip[] clips = m_AnimationClips; //int count = 0; bool is_find = false; for (int i = 0; i < clips.Length; ++i) { AnimationClip clip = clips[i]; if (clip.name == ani) { is_find = false; // 当前clip中是否已经注册过该事件 var clip_events = clip.events; if (clip_events != null) { for (int find_index = 0; find_index < clip_events.Length; ++find_index) { var clip_event = clip_events[find_index]; if (clip_event.functionName == "OnHit" && clip_event.intParameter == id) { is_find = true; break; } } } if (is_find) { break; } float hitTime = call_Info.mTime; AnimationEvent ent = new AnimationEvent(); ent.messageOptions = SendMessageOptions.DontRequireReceiver; ent.time = hitTime != 0 ? hitTime : 0.001f + hitTime; // 不能与OnPlayBegin同一时间,不然有可能OnHit不会被调用 ent.functionName = "OnHit"; ent.intParameter = id; clip.AddEvent(ent); // count++; // if(count > 1) // { // GameDebug.LogError("count = " + count + " clip.name = " + clip.name); // } } } }
/// <summary> /// HTTP下载文件,支持断点续传 /// </summary> /// <param name="url"></param> /// <returns></returns> IEnumerator HttpDownload(string url) { string strUpdatepositionName = "updateposition_" + AppVersion.VersionID; string curPosName = PlayerPrefs.GetString(GameConfig.appUpdateFlag); string filename = Path.GetFileName(url); string filepath = string.Format("{0}{1}", GameConfig.CachePath, filename); if (strUpdatepositionName != curPosName && PlayerPrefs.HasKey(curPosName)) { PlayerPrefs.DeleteKey(curPosName); if (File.Exists(filepath)) { File.Delete(filepath); } } int updateposition = PlayerPrefs.GetInt(strUpdatepositionName); if (updateposition > 0 && !File.Exists(filepath)) { updateposition = 0; } if (updateposition == 0 && File.Exists(filepath)) { File.Delete(filepath); } NotifyProgress(0, "开始更新客户端"); yield return(1); Uri appUri = new Uri(Uri.EscapeUriString(url)); HttpWebRequest request = WebRequest.Create(appUri) as HttpWebRequest; yield return(request); HttpWebResponse response = request.GetResponse() as HttpWebResponse; yield return(response); mTotalSize = (int)response.ContentLength; request.Abort(); response.Close(); CheckPoint(mTotalSize.ToString()); //总大小 if (mTotalSize == updateposition) { CheckPoint(request.ContentLength.ToString()); //已经更新完成了提示用户安装即可 //TODO:验证安装包的MD5 NotifyProgress(1, "客户端更新完毕"); ClientUpdateComplete(true, filepath); yield break; } //重新申请资源更新 request = WebRequest.Create(appUri) as HttpWebRequest; response = request.GetResponse() as HttpWebResponse; request.AddRange(updateposition); response = request.GetResponse() as HttpWebResponse; yield return(response); //mTotalSize = (int)response.ContentLength + updateposition; if (mTotalSize == 0) { GameDebug.LogError(string.Format("客户端版本{0}更新出现错误", AppVersion.VersionID)); ClientUpdateComplete(false, filepath); yield break; } NotifyProgress((float)updateposition / mTotalSize, string.Format("更新客户端{0}byte/{1}byte..", updateposition, mTotalSize)); yield return(1); byte[] bBuffer = new byte[65536]; //开始接收 Stream streambuff = response.GetResponseStream(); //读取buffer while (true) { int nRealReadCount = streambuff.Read(bBuffer, 0, 65536); if (nRealReadCount <= 0) { ///无读取内容时 if (updateposition == mTotalSize) { ClientUpdateComplete(true, filepath); break; } yield return(1); } string folder = Path.GetDirectoryName(filepath); if (!Directory.Exists(folder)) { Directory.CreateDirectory(folder); } FileStream fileStream = new FileStream(filepath, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.ReadWrite); try { fileStream.Position = updateposition; fileStream.Write(bBuffer, 0, nRealReadCount); fileStream.Flush(); fileStream.Close(); updateposition += nRealReadCount; //保存进度 PlayerPrefs.SetInt(strUpdatepositionName, updateposition); NotifyProgress((float)updateposition / mTotalSize, string.Format("更新客户端{0}byte/{1}byte..", updateposition, mTotalSize)); yield return(1); } finally { if (fileStream != null) { fileStream.Dispose(); } } } }
public void ProcessEntitySpawn(int servertick, int id, ushort typeId) { if (m_showInfo.IntValue > 0) { GameDebug.Log("ProcessEntitySpawns. Server tick:" + servertick + " id:" + id + " typeid:" + typeId); } // If this is a replicated entity from the scene it only needs to be registered (not instantiated) if (id < m_world.SceneEntities.Count) { var e = m_world.SceneEntities[id]; var gameObjectEntity = e.gameObject.GetComponent <GameObjectEntity>(); GameDebug.Assert(gameObjectEntity != null, "Replicated entity " + e.name + " has no GameObjectEntity component"); m_entityCollection.Register(m_world.GetEntityManager(), id, gameObjectEntity.Entity); return; } int index = typeId; // If factory present it should be used to create entity GameDebug.Assert(index < m_assetRegistry.entries.Count, "TypeId:" + typeId + " not in range. Array Length:" + m_assetRegistry.entries.Count); var entity = m_resourceSystem.CreateEntity(m_assetRegistry.entries[index].guid); if (entity == Entity.Null) { GameDebug.LogError("Failed to create entity for index:" + index + " guid:" + m_assetRegistry.entries[index].guid); return; } // // var factory = m_assetRegistry.entries[index].factory; // if (factory) // { // var entity = factory.Create(m_world.GetEntityManager(), m_resourceSystem, m_world); // // var replicatedDataEntity = m_world.GetEntityManager().GetComponentData<ReplicatedEntityData>(entity); // replicatedDataEntity.id = id; // m_world.GetEntityManager().SetComponentData(entity, replicatedDataEntity); // // m_entityCollection.Register(m_world.GetEntityManager(),id, entity); // // return; // } { Profiler.BeginSample("ReplicatedEntitySystemClient.ProcessEntitySpawns()"); // var prefabGuid = m_assetRegistry.entries[index].prefab.guid; // var prefab = (GameObject)m_resourceSystem.LoadSingleAssetResource(prefabGuid); // // Entity entity; // var gameObject = m_world.SpawnInternal(prefab, new Vector3(), Quaternion.identity, out entity); // gameObject.name = prefab.name + "_" + id; // // if(m_SystemRoot != null) // gameObject.transform.SetParent(m_SystemRoot.transform); var replicatedDataEntity = m_world.GetEntityManager().GetComponentData <ReplicatedEntityData>(entity); replicatedDataEntity.id = id; m_world.GetEntityManager().SetComponentData(entity, replicatedDataEntity); m_entityCollection.Register(m_world.GetEntityManager(), id, entity); Profiler.EndSample(); } }
static void OnPlayModeStateChanged(PlayModeStateChange mode) { if (mode == PlayModeStateChange.ExitingEditMode) { /* * // If we want to play in the editor as if we were launched as standalone, we unload whatever scene * // you may have open to prevent entity conversion workflow from generating double entitites * var startCommandCount = PlayerPrefs.GetInt("CustomStartupCommandCount", 0); * if (startCommandCount > 0) * { * var scenePaths = new List<string>(); * for(int i = 0; i < EditorSceneManager.sceneCount; ++i) * { * scenePaths.Add(EditorSceneManager.GetSceneAt(i).path); * } * PlayerPrefs.SetString("ScenesOpenBeforeLaunch", string.Join(";", scenePaths)); * * if (EditorSceneManager.SaveCurrentModifiedScenesIfUserWantsTo()) * { * // Load the bootstrapper and proceed to launch * var s = EditorBuildSettings.scenes[0]; * EditorSceneManager.OpenScene(s.path); * } * else * { * // Cancel action * PlayerPrefs.SetInt("CustomStartupCommandCount", 0); * EditorApplication.isPlaying = false; * } * } */ } else if (mode == PlayModeStateChange.EnteredEditMode) { /* * // Close bootstrapper if it is there. Have to postpone that as unloading last * // scene is not allowed * bool closeFirstScene = false; * if (EditorSceneManager.GetSceneAt(0).path == EditorBuildSettings.scenes[0].path) * closeFirstScene = true; * * // Load previously opened scenes * var scenes = PlayerPrefs.GetString("ScenesOpenBeforeLaunch"); * if (scenes.Length > 0) * { * foreach (var s in scenes.Split(';')) * { * EditorSceneManager.OpenScene(s, OpenSceneMode.Additive); * } * } * else * closeFirstScene = false; * * if(closeFirstScene) * EditorSceneManager.CloseScene(EditorSceneManager.GetSceneAt(0), true); * * PlayerPrefs.SetString("ScenesOpenBeforeLaunch", ""); */ } else if (mode == PlayModeStateChange.EnteredPlayMode) { // TODO (petera) remove this once open subscenes work with playmode bool editingAnySubscenes = false; foreach (var ss in SubScene.AllSubScenes) { if (ss.IsLoaded) { editingAnySubscenes = true; } } if (editingAnySubscenes) { GameDebug.LogError("Entering playmode with open subscenes does not currently work properly. Leaving playmode."); EditorApplication.isPlaying = false; return; } if (Game.game == null) { //SceneManager.LoadScene(0); var go = (GameObject)GameObject.Instantiate(Resources.Load("Prefabs/Game", typeof(GameObject))); GameDebug.Assert(Game.game != null, "Failed to load Game prefab"); } if (GameBootStrap.IsSingleLevelPlaymode) { return; } var startCommandCount = PlayerPrefs.GetInt("CustomStartupCommandCount", 0); if (startCommandCount > 0) { for (int i = 0; i < startCommandCount; i++) { var key = string.Format("CustomStartupCommand{0}", i); var args = PlayerPrefs.GetString(key, ""); Console.ProcessCommandLineArguments(args.Split(' ')); PlayerPrefs.DeleteKey(key); } PlayerPrefs.SetInt("CustomStartupCommandCount", 0); } else { // User pressed editor start button var scene = EditorSceneManager.GetSceneAt(0); var scenePath = scene.path; if (string.IsNullOrEmpty(scenePath)) { return; } var info = GetLevelInfoFor(scenePath); if (info != null) { switch (info.levelType) { case LevelInfo.LevelType.Generic: break; case LevelInfo.LevelType.Gameplay: //Console.EnqueueCommandNoHistory("preview"); var playType = ClientServerBootstrap.RequestedPlayType; if (playType != ClientServerBootstrap.PlayType.Client) { Game.game.RequestGameLoop(typeof(ServerGameLoop), new [] { scene.name }); } if (playType != ClientServerBootstrap.PlayType.Server) { Game.game.RequestGameLoop(typeof(ClientGameLoop), new [] { ClientServerBootstrap.RequestedAutoConnect }); } break; case LevelInfo.LevelType.Menu: Console.SetOpen(false); //Console.EnqueueCommandNoHistory("menu"); break; } } } } }
/// <summary> /// 通过内存池来创建物品图标 /// </summary> /// <param name="template"></param> /// <param name="wnd_name"></param> /// <param name="goodsID"></param> /// <param name="num"></param> /// <param name="isShowTips"></param> /// <param name="isScale"></param> /// <param name="isBind"></param> /// <returns></returns> public GameObject CreateGoodsItemCache(GameObject template, string wnd_name, Transform parent, uint goodsID, ulong num, bool isShowTips = true, bool isScale = false, uint isBind = uint.MaxValue) { if (template == null) { return(null); } var wnd = UIManager.instance.GetWindow(wnd_name); if (wnd == null) { return(null); } var gameObject = wnd.GetItemGameObj(parent); UIItemRef itemRef = template.GetComponent <UIItemRef>(); UIItemNewSlot newSlot = template.GetComponent <UIItemNewSlot>(); gameObject.transform.SetParent(template.transform.parent, false); gameObject.SetActive(true); UIItemNewSlot itemSlot; if (itemRef) { itemSlot = UIItemNewSlot.Bind(gameObject, itemRef.TargetPanel, itemRef.ClipPanel); } else if (newSlot) { itemSlot = UIItemNewSlot.Bind(gameObject, newSlot.TargetPanel, newSlot.ClipPanel); } else { itemSlot = UIItemNewSlot.Bind(gameObject); } Goods itemInfo = GoodsHelper.CreateGoodsByTypeId(goodsID); if (isShowTips == false && isScale == false) { var collider = gameObject.GetComponent <Collider>(); if (collider != null) { collider.enabled = false; } } if (itemInfo == null) { GameDebug.LogError("CreateGoodsItem error, can not find goods " + goodsID); return(gameObject); } itemInfo.num = num; if (isBind != uint.MaxValue) { itemInfo.bind = isBind; } UIItemNewSlot.TypeParse typeParse = UIItemNewSlot.CreateUIItemTypeParse(); if (isShowTips == true) { typeParse._mType = 2; } else { typeParse._mType = 0; } itemSlot.setItemInfo(itemInfo, typeParse, isScale); return(gameObject); }
/// <summary> /// 获取某个副本的信息 /// </summary> /// <returns>The instance info.</returns> /// <param name="id">Identifier.</param> public InstanceInfo GetInstanceInfo(uint id) { InstanceInfo info = null; if (mInstanceInfos.TryGetValue(id, out info)) { return(info); } string queryStr = string.Format("SELECT * FROM {0} WHERE {0}.{1}=\"{2}\"", mTableName, "id", id.ToString()); var table_reader = DBManager.Instance.ExecuteSqliteQueryToReader(GlobalConfig.DBFile, mTableName, queryStr); if (table_reader == null) { mInstanceInfos.Add(id, null); return(null); } if (!table_reader.HasRows) { mInstanceInfos.Add(id, null); table_reader.Close(); table_reader.Dispose(); return(null); } if (!table_reader.Read()) { mInstanceInfos.Add(id, null); table_reader.Close(); table_reader.Dispose(); return(null); } info = new InstanceInfo(); Type gameConstType = typeof(GameConst); info.mId = DBTextResource.ParseUI_s(GetReaderString(table_reader, "id"), 0); info.mMaxTime = DBTextResource.ParseI(GetReaderString(table_reader, "max_time")); info.mNeedGoods = DBTextResource.ParseDictionaryUintUint(GetReaderString(table_reader, "need_goods")); info.mDyNeedGoods = DBTextResource.ParseArrayUintUint(GetReaderString(table_reader, "dy_need_goods")); info.mNeedLv = DBTextResource.ParseUS_s(GetReaderString(table_reader, "need_lv"), 0); info.mLvUpLimit = DBTextResource.ParseUS_s(GetReaderString(table_reader, "lv_up_limit"), 0); info.mRecommendAttrs = ParseRecommendAttrs(GetReaderString(table_reader, "recommend_attrs")); info.mSingleEnter = DBTextResource.ParseI(GetReaderString(table_reader, "single_enter")) == 1 ? true : false; string mbCountStr = GetReaderString(table_reader, "mb_count"); ushort mbCount = 0; /* 进入人数四种要求: * 0:可单人,也可以任意组队(不用配) * 1:必须单人(可以没有队伍,也可以在只有他一个人的队伍中) * N(N>=2):必须N人以上组队 * {M,N}:大于等于M且小于等于N */ if (string.IsNullOrEmpty(mbCountStr) == true) { info.mMinMemberCount = 0; info.mMaxMemberCount = GameConstHelper.GetShort("GAME_TEAM_MEMBER_LIMIT"); } else if (ushort.TryParse(mbCountStr, out mbCount) == true) { info.mMinMemberCount = mbCount; if (info.mMinMemberCount == 0) { info.mMaxMemberCount = GameConstHelper.GetShort("GAME_TEAM_MEMBER_LIMIT"); } else if (info.mMinMemberCount == 1) { info.mMinMemberCount = 0; info.mMaxMemberCount = 1; } else { info.mMaxMemberCount = GameConstHelper.GetShort("GAME_TEAM_MEMBER_LIMIT"); } } else { List <uint> mbCountList = DBTextResource.ParseArrayUint(mbCountStr, ","); if (mbCountList.Count >= 2) { info.mMinMemberCount = (ushort)mbCountList[0]; info.mMaxMemberCount = (ushort)mbCountList[1]; } } info.mSweepCosts = DBTextResource.ParseDictionaryUintUint(GetReaderString(table_reader, "sweep_costs")); info.mSweepLimit = DBTextResource.ParseVector2(GetReaderString(table_reader, "sweep_limit")); info.mName = GetReaderString(table_reader, "name"); //System.Reflection.FieldInfo fieldInfo = null; //string warTypeStr = GetReaderString(table_reader, "war_type"); //if (mGameConstUintValueCache.ContainsKey(warTypeStr) == true) //{ // info.mWarType = mGameConstUintValueCache[warTypeStr]; //} //else //{ // fieldInfo = gameConstType.GetField(warTypeStr); // if (fieldInfo != null) // { // info.mWarType = Convert.ToUInt32(fieldInfo.GetValue(null)); // mGameConstUintValueCache[warTypeStr] = info.mWarType; // } // else // { // GameDebug.LogError("Can not find war type " + warTypeStr + " in db instance!!!"); // } //} //string warsubTypeStr = GetReaderString(table_reader, "war_subtype"); //if (string.IsNullOrEmpty(warsubTypeStr) == false) //{ // if (mGameConstUintValueCache.ContainsKey(warsubTypeStr) == true) // { // info.mWarSubType = mGameConstUintValueCache[warsubTypeStr]; // } // else // { // fieldInfo = gameConstType.GetField(warsubTypeStr); // if (fieldInfo != null) // { // info.mWarSubType = Convert.ToUInt32(fieldInfo.GetValue(null)); // mGameConstUintValueCache[warsubTypeStr] = info.mWarSubType; // } // else // { // GameDebug.LogError("Can not find sub war type " + warsubTypeStr + " in db instance!!!"); // } // } //} uint warType = 0; uint warSubType = 0; string warTypeStr = GetReaderString(table_reader, "war_type"); string warSubTypeStr = GetReaderString(table_reader, "war_subtype"); ConvertWarType(warTypeStr, warSubTypeStr, out warType, out warSubType); info.mWarType = warType; info.mWarSubType = warSubType; info.mDesc = GetReaderString(table_reader, "desc"); info.mStages.Clear(); string stagesStr = GetReaderString(table_reader, "stages"); List <string> stages = DBTextResource.ParseArrayString(stagesStr); for (int j = 0; j < stages.Count; j++) { if (!String.IsNullOrEmpty(stages[j])) { info.mStages.Add(DBTextResource.ParseUI(stages[j])); } } info.mPKType = DBTextResource.ParseI(GetReaderString(table_reader, "pk_type")); info.mReviveTimes = DBTextResource.ParseUS(GetReaderString(table_reader, "revive_times")); info.mReadyCountDown = DBTextResource.ParseUS(GetReaderString(table_reader, "ready_count_down")); info.mResultCountDown = DBTextResource.ParseUI(GetReaderString(table_reader, "result_count_down")); info.mIsReloadSceneWhenTheSame = DBTextResource.ParseI(GetReaderString(table_reader, "is_reload_scene_when_the_same")) == 0 ? false : true; info.mMinPos = DBTextResource.ParseVector2(GetReaderString(table_reader, "mini_map_pos_x")); info.mMaxPos = DBTextResource.ParseVector2(GetReaderString(table_reader, "mini_map_pos_y")); info.mMiniMapWidth = info.mMaxPos.x - info.mMinPos.x; info.mMiniMapHeight = info.mMaxPos.y - info.mMinPos.y; info.mMiniMapName = GetReaderString(table_reader, "mini_map"); info.mIsCanOpenMiniMap = DBTextResource.ParseI(GetReaderString(table_reader, "is_open_mini_map")) == 0 ? false : true; string isShowMarkStr = GetReaderString(table_reader, "is_show_mark"); if (isShowMarkStr == string.Empty || isShowMarkStr == "0") { info.mIsShowMark = false; } else { info.mIsShowMark = true; } string isAutoFightStr = GetReaderString(table_reader, "is_auto_fight"); if (isAutoFightStr == string.Empty || isAutoFightStr == "0") { info.mIsAutoFight = false; } else { info.mIsAutoFight = true; } string canNotRideStr = GetReaderString(table_reader, "can_not_ride"); if (canNotRideStr == string.Empty || canNotRideStr == "0") { info.mCanNotRide = false; } else { info.mCanNotRide = true; } info.mRewardIds = DBTextResource.ParseArrayUint(GetReaderString(table_reader, "reward_1"), ","); info.mShowRewardIds = DBTextResource.ParseArrayUint(GetReaderString(table_reader, "show_rewards"), ","); info.mNeedTaskId = DBTextResource.ParseUI_s(GetReaderString(table_reader, "need_task_id"), 0); info.mPlanesInstanceId = DBTextResource.ParseUI_s(GetReaderString(table_reader, "planes_dg_id"), 0); info.mStartTimeline = DBTextResource.ParseUI_s(GetReaderString(table_reader, "start_timeline"), 0); info.mGuardedNpcId = DBTextResource.ParseUI_s(GetReaderString(table_reader, "npc_id"), 0); string showBossAssStr = GetReaderString(table_reader, "show_boss_assistant"); if (showBossAssStr == string.Empty || showBossAssStr == "0") { info.mShowBossAssistant = false; } else { info.mShowBossAssistant = true; } info.mForbidJumpOutAnimationOut = DBTextResource.ParseUI_s(GetReaderString(table_reader, "forbid_jump_out_animation_out"), 0) == 1; info.mForbidWaterWaveEffect = DBTextResource.ParseUI_s(GetReaderString(table_reader, "forbid_water_wave_effect"), 0) == 1; info.mIsCanSendPosition = DBTextResource.ParseUI_s(GetReaderString(table_reader, "is_can_send_position"), 0) == 1; info.mMergeLevel = DBTextResource.ParseUI_s(GetReaderString(table_reader, "merge_level"), 0); info.mMergeConsume = DBTextResource.ParseDictionaryUintUint(GetReaderString(table_reader, "merge_consume")); #if UNITY_EDITOR if (mInstanceInfos.ContainsKey(info.mId)) { GameDebug.LogError(string.Format("[{0}]表重复添加的域id[{1}]", mTableName, info.mId)); table_reader.Close(); table_reader.Dispose(); return(info); } #endif mInstanceInfos.Add(info.mId, info); table_reader.Close(); table_reader.Dispose(); return(info); }
public bool FromJson(string json) { GameDebug.LogGreen("解析JSON:" + json); Hashtable jsonObj = MiniJSON.JsonDecode(json) as Hashtable; if (jsonObj == null || jsonObj["result"] == null) { result = -1; GameDebug.LogError("游戏公告解析失败" + json); return(false); } result = int.Parse(jsonObj["result"].ToString()); if (result != 1) { result = -1; GameDebug.LogError("游戏公告解析失败" + json); return(false); } Hashtable args = jsonObj["args"] as Hashtable; if (args == null) { result = -1; GameDebug.LogError("游戏公告参数解析失败" + json); return(false); } ArrayList notice_list = args["notice_list"] as ArrayList; if (notice_list == null) { GameDebug.LogError("游戏公告解析失败 notice_list " + json); return(false); } this.allNotice.Clear(); for (int i = 0; i < notice_list.Count; i++) { var tbl = notice_list[i] as Hashtable; int type = 0; if (tbl["tag"] != null) { type = int.Parse(tbl["tag"].ToString()); } if (type == 0) { type = 1;//活动 } else if (type == 1) { type = 2;//公告 } else { type = 0; } int openType = 0; if (tbl["type"] != null) { openType = int.Parse(tbl["type"].ToString()); } int status = 1; if (tbl["status"] != null) { status = int.Parse(tbl["status"].ToString()); } int noticeOrder = 0; if (tbl["notice_order"] != null) { noticeOrder = int.Parse(tbl["notice_order"].ToString()); } bool isNew = false; if (tbl["icon_status"] != null && tbl["icon_status"].ToString() != "null" && (int.Parse(tbl["icon_status"].ToString()) == 1)) { isNew = true; } string title = tbl["title"] == null ? "" : tbl["title"].ToString(); string content = tbl["content"] == null ? "" : tbl["content"].ToString(); List <string> titles = new List <string>(); List <string> contents = new List <string>(); titles.Add(title); contents.Add(content); if (tbl["sub_content"] != null && tbl["sub_content"] is ArrayList) { var subList = tbl["sub_content"] as ArrayList; for (int j = 0; j < subList.Count; j++) { var c = subList[j] as Hashtable; titles.Add(c["title"].ToString()); contents.Add(c["content"].ToString()); } } var item = GetItemInfo(type, isNew, titles, contents, openType, status, noticeOrder); //无效的不管 if (item.status != 1) { allNotice.Add(item); } } allNotice.Sort(CompareFunc); this.type = 0; foreach (var notice in allNotice) { if (notice.openType == 1) { this.type = 1; } else { this.type = 0; } } return(true); }
/// <summary> /// 处理actor创建成功 /// </summary> /// <param name="actor"></param> public override void HandleActorCreate(Actor actor) { base.HandleActorCreate(actor); mActorUID = actor.UID; if (Actor == null) { return; } // 设置玩家坐标 Actor.Stop(); if (AppearInfo == null) { GameDebug.LogError("HandleActorCreate AppearInfo == null, uuid = " + UUID); return; } var unit_scale = GlobalConst.UnitScale; var x = AppearInfo.pos.px * unit_scale; var z = AppearInfo.pos.py * unit_scale; var pos = new Vector3(x, RoleHelp.GetHeightInScene(Actor.ActorId, x, z), z); //pos = InstanceHelper.ClampInWalkableRange(pos); Actor.transform.position = pos; // 进入AOI视野增加buff if (BuffList != null) { uint server_time = Game.Instance.ServerTime; for (int i = 0; i < BuffList.Count; ++i) { uint end_time = (uint)(BuffList[i].v / 1000); uint second = 1; if (end_time > server_time) { second = end_time - server_time; } //GameDebug.LogError(string.Format("servertime = {0} BuffList[i].v = {1} second = {2}", server_time, end_time, second)); Actor.BuffCtrl.AddBuff(BuffList[i].k, second); } } if (FlagOperate.HasFlag(AppearBit, GameConst.APPEAR_BIT_IS_DEAD))// 初始就是死亡状态 { if (!Actor.IsDead()) { Actor.BeattackedCtrl.KillSelf(); } } else { if (Actor.IsDead()) { Actor.Relive(); } } if (AppearInfo.speed > 0) { Actor.MoveCtrl.ReceiveWalkBegin(AppearInfo); } if (Info == null) { GameDebug.LogError("HandleActorCreate Info == null, uuid = " + UUID); return; } if (Info.war != null) { foreach (PkgAttrElm attrElm in Info.war.attr_elm) { if (attrElm.attr == GameConst.AR_MAX_HP) { Actor.FullLife = attrElm.value; } else if (attrElm.attr == GameConst.AR_MAX_MP) { Actor.FullMp = attrElm.value; Actor.CurMp = Actor.FullMp; // 初始化时将蓝量加满 } } Actor.CurLife = Info.war.hp; // 进入AOI视野增加buff /*for(int i = 0; i < Info.war.buffs.Count; ++i) * { * Actor.AuraCtrl.AddAura(Info.war.buffs[i].k); * }*/ } Actor.SubscribeActorEvent(Actor.ActorEvent.DEAD, OnActorDead); Actor.UpdateNameColor(Info.name_color); if (Info.war != null) { //Actor.PKLvProtect = Info.war.pk_lv_protect; Actor.UpdateByBitState(Info.bit_states); } WaittingLookExtList.Add(UUID); }
public void StoneComb(DefenceUIParam uiparam) { PlayerDataModule module = ModuleManager.Instance.FindModule <PlayerDataModule>(); if (null == module) { return; } StoneTableItem stoneitem = null; if (uiparam.isequiped) { DefenceObj defencedata = module.GetItemByIDAndPos(uiparam.itemid, uiparam.packpos, uiparam.packtype) as DefenceObj; if (null == defencedata) { return; } stoneitem = DataManager.StoneTable[defencedata.GetStoneInfoByPos(uiparam.stonepos).stoneid] as StoneTableItem; } else { stoneitem = DataManager.StoneTable[uiparam.stoneid] as StoneTableItem; } if (null == stoneitem) { return; } if (-1 == stoneitem.combid) { //宝石已达最高等级 PopTipManager.Instance.AddNewTip(StringHelper.GetString("stonesmax")); return; } DefenceCombItem combItem = DataManager.DefenceCombTable[stoneitem.combid] as DefenceCombItem; if (null == combItem) { //弹窗:宝石无法合成 PopTipManager.Instance.AddNewTip(StringHelper.GetString("stone_comb_error")); return; } if (module.GetProceeds(ProceedsType.Money_Game) < combItem.moenyused) { //弹窗:玩家金币不足 PopTipManager.Instance.AddNewTip(StringHelper.GetString("money_game_shortage")); return; } uint playerhascitem = module.GetItemNumByID(combItem.item1, PackageType.Pack_Gem); if (uiparam.isequiped) { playerhascitem += 1; } if (playerhascitem < combItem.num1) { ////弹窗:道具【名称】【个数】不足 stoneitem = DataManager.StoneTable[combItem.item1] as StoneTableItem; if (null == stoneitem) { GameDebug.LogError("stone.txt中没有此宝石 id = " + combItem.item1); return; } PopTipManager.Instance.AddNewTip(StringHelper.GetString("item_need").Replace("?", stoneitem.name)); return; } StoneCombActionParam param = new StoneCombActionParam(); param.DefenceId = uiparam.itemid; param.stoneId = stoneitem.id; param.PackType = (int)uiparam.packtype; param.pos = uiparam.packpos; param.stonepos = uiparam.stonepos; param.isequiped = uiparam.isequiped; Net.Instance.DoAction((int)Message.MESSAGE_ID.ID_MSG_DEFENCE_STONE_COMB, param); }
protected override void OnUpdate() { var localPlayerArray = LocalPlayerGroup.GetComponentArray <LocalPlayer>(); if (localPlayerArray.Length == 0) { return; } var localPlayer = localPlayerArray[0]; if (localPlayer.playerState == null) { return; } var nameplateArray = Group.GetComponentArray <NamePlateOwner>(); var charPresentationArray = Group.GetComponentArray <CharacterPresentationSetup>(); for (int i = 0; i < nameplateArray.Length; i++) { var plateOwner = nameplateArray[i]; if (plateOwner.namePlate == null) { GameDebug.LogError("namePlateOwner.namePlate == null"); continue; } var root = plateOwner.namePlate.namePlateRoot.gameObject; if (IngameHUD.showHud.IntValue == 0) { SetActiveIfNeeded(root, false); continue; } if (!plateOwner.visible) { SetActiveIfNeeded(root, false); continue; } // Dont show our own var character = charPresentationArray[i].character; if (character == localPlayer.playerState.controlledEntity) { SetActiveIfNeeded(root, false); continue; } // Dont show nameplate behinds var camera = Game.game.TopCamera();// Camera.allCameras[0]; var platePosWorld = plateOwner.namePlateTransform.position; var screenPos = camera.WorldToScreenPoint(platePosWorld); if (screenPos.z < 0) { SetActiveIfNeeded(root, false); continue; } // Test occlusion var rayStart = camera.ScreenToWorldPoint(new Vector3(screenPos.x, screenPos.y, 0)); var v = platePosWorld - rayStart; var distance = v.magnitude; const int defaultLayerMask = 1 << 0; var occluded = Physics.Raycast(rayStart, v.normalized, distance, defaultLayerMask); var friendly = plateOwner.team == localPlayer.playerState.teamIndex; var color = friendly ? Game.game.gameColors[(int)Game.GameColor.Friend] : Game.game.gameColors[(int)Game.GameColor.Enemy]; var showPlate = friendly || !occluded; // Update plate if (!showPlate) { SetActiveIfNeeded(root, false); continue; } plateOwner.namePlate.namePlateRoot.transform.position = screenPos; // Update icon var showIcon = friendly; SetActiveIfNeeded(plateOwner.namePlate.icon.gameObject, showIcon); if (showIcon) { plateOwner.namePlate.icon.color = color; } // Update name text var inNameTextDist = distance <= plateOwner.namePlate.maxNameDistance; var showNameText = !occluded && inNameTextDist; SetActiveIfNeeded(plateOwner.namePlate.nameText.gameObject, showNameText); if (showNameText) { plateOwner.namePlate.nameText.text = plateOwner.text; plateOwner.namePlate.nameText.color = color; } SetActiveIfNeeded(root, true); } }
// Update is called once per frame void Update() { _ai.AutoMove(); _ai.AutoFight(Time.deltaTime); DelayAttrAction((short)(Time.deltaTime * 1000)); cameraMove(); DrawCritical(); if (target && target.isDead()) { //chgTraget(null); } if (Input.GetKeyUp(KeyCode.Alpha9)) { JFPackage.PAG_FIGHT fightMSG = new JFPackage.PAG_FIGHT(ID, -1, 999); fightMSG._target = target.ID; NetMgr.getSingleton().sendMsg(fightMSG); } // norma attack if (Input.GetKeyUp(KeyCode.Space) && target != null) { JFPackage.PAG_FIGHT fightMSG = new JFPackage.PAG_FIGHT(ID, -1, (short)ENUM_SKILL_TYPE.SKILL_NORMAL); fightMSG._target = target.ID; NetMgr.getSingleton().sendMsg(fightMSG); } // magic attack if (Input.GetKeyUp(KeyCode.Alpha1) && target != null) { if (mp >= 10) { JFPackage.PAG_FIGHT fightMSG = new JFPackage.PAG_FIGHT(ID, -1, (short)ENUM_SKILL_TYPE.SKILL_TRAIL); fightMSG._target = target.ID; NetMgr.getSingleton().sendMsg(fightMSG); } else { GameDebug.LogError("Use skill:NOT ENOUGH MP."); } } if (Input.GetKeyUp(KeyCode.Alpha2) && target != null) { if (mp >= 30) { JFPackage.PAG_FIGHT fightMSG = new JFPackage.PAG_FIGHT(ID, -1, (short)ENUM_SKILL_TYPE.SKILL_AREA_TARGET); fightMSG._target = target.ID; NetMgr.getSingleton().sendMsg(fightMSG); } else { GameDebug.LogError("Use skill:NOT ENOUGH MP."); } } if (Input.GetKeyUp(KeyCode.Alpha3)) { if (mp >= 30) { JFPackage.PAG_FIGHT fightMSG = new JFPackage.PAG_FIGHT(ID, -1, (short)ENUM_SKILL_TYPE.SKILL_AREA_SELF); NetMgr.getSingleton().sendMsg(fightMSG); } else { GameDebug.LogError("Use skill:NOT ENOUGH MP."); } } if (Input.GetKeyUp(KeyCode.Alpha4)) { if (mp >= 30 && _island != Map.invalidPos) { JFPackage.PAG_FIGHT fightMSG = new JFPackage.PAG_FIGHT(ID, -1, (short)ENUM_SKILL_TYPE.SKILL_AREA_ISLAND); fightMSG._param01 = (short)_island._x; fightMSG._param02 = (short)_island._z; NetMgr.getSingleton().sendMsg(fightMSG); } else { GameDebug.LogError("Use skill:NOT ENOUGH MP. not click island"); } } if (Input.GetKeyUp(KeyCode.Alpha5)) { if (mp >= 50) { JFPackage.PAG_FIGHT fightMSG = new JFPackage.PAG_FIGHT(ID, -1, (short)ENUM_SKILL_TYPE.SKILL_SHILED); fightMSG._target = ID; NetMgr.getSingleton().sendMsg(fightMSG); } else { GameDebug.LogError("Use skill: not enough mp"); } } if (Input.GetKeyUp(KeyCode.Alpha6)) { if (mp >= 50) { JFPackage.PAG_FIGHT fightMSG = new JFPackage.PAG_FIGHT(ID, -1, (short)ENUM_SKILL_TYPE.SKILL_DYNCBLOCK); fightMSG._target = ID; NetMgr.getSingleton().sendMsg(fightMSG); } else { GameDebug.LogError("Use skill: not enough mp"); } } // select target _island = MousePickUp.pickIsland(_island); Creature c = MousePickUp.pick(target); chgTraget(c); }
//-------------------------------------------------------- // 控件消息 //-------------------------------------------------------- /// <summary> /// 点击登录按钮 /// </summary> void OnClickLoginButton() { #if UNITY_ANDROID GameDebug.LogError("hasNotch: " + DBOSManager.getDBOSManager().getBridge().hasNotch().ToString()); GameDebug.LogError("getNotchSize: " + DBOSManager.getDBOSManager().getBridge().getNotchSize().ToString()); GameDebug.LogError("Screen.safeArea: " + Screen.safeArea.ToString()); GameDebug.LogError("StartTimeStamp: " + GlobalConfig.Instance.StartTimeStamp); #endif Game game = xc.Game.GetInstance(); GlobalConfig globalConfig = GlobalConfig.GetInstance(); //快捷登录界面增加超级ticket,可直接登录外网服务器 string superTicketStr = mSuperTicketInput.text; if (!string.IsNullOrEmpty(superTicketStr)) { globalConfig.LoginInfo.Ticket = superTicketStr; } if (!string.IsNullOrEmpty(mHostURLInput.text)) { GlobalConfig.DebugHostURL = mHostURLInput.text; globalConfig.ResetHostURL(); } if (!string.IsNullOrEmpty(mGameMarkInput.text)) { GlobalConfig.DebugGameMark = mGameMarkInput.text; } if (!string.IsNullOrEmpty(mServerTypeInput.text)) { GlobalConfig.DebugServerType = int.Parse(mServerTypeInput.text); } if (mDebugToggle.isOn) { globalConfig.IsDebugMode = true; game.GameMode = (Game.EGameMode)((int)game.GameMode | (int)Game.EGameMode.GM_Debug); // 关卡测试 SceneHelp.Instance.SwitchPreposeScene(GlobalConst.DefaultTestScene, true); game.GetFSM().React((uint)GameEvent.GE_SWITCH_PLAYING_TEST); } else { bool local_server = false; #if UNITY_ANDROID || UNITY_IPHONE local_server = false; #else string server_file = Application.streamingAssetsPath + "/server.txt"; if (File.Exists(server_file)) { string accountStr = mAccountInput.text; if (string.IsNullOrEmpty(accountStr)) { UINotice.Instance.ShowMessage("请先输入账号"); return; } string server_ip = File.ReadAllText(server_file); if (string.IsNullOrEmpty(server_ip) == false) { globalConfig.IsDebugMode = false; globalConfig.LoginInfo.AccName = accountStr; game.Account = accountStr; GlobalSettings.GetInstance().LastAccount = accountStr; GlobalSettings.GetInstance().LastServer = server_ip; xc.ServerInfo server_info = new xc.ServerInfo(); server_info.Url = server_ip; server_info.SId = 1; GlobalConfig.GetInstance().LoginInfo.ServerInfo = server_info; GlobalSettings.GetInstance().Save(); local_server = true; LoginServer(server_ip); } } #endif if (local_server == false) { OnClickServerListButton(); } } }
void OnMatchmakingError(string errorInfo) { GameDebug.LogError($"Matchmaking failed! Error is: {errorInfo}"); m_useMatchmaking = false; m_matchmaker = null; }
public override void Load() { #if UNITY_EDITOR string resName = DBManager.AssetsResPath + "/" + mStrPath; TextAsset textObj = EditorResourceLoader.LoadAssetAtPath(resName, typeof(TextAsset)) as TextAsset; if (textObj != null) { string strData = CommonTool.BytesToUtf8(textObj.bytes); if (strData != "") { ParseData(strData); } IsLoaded = true; } else { GameDebug.LogError("DB file load failed: " + mStrPath); } #else AssetBundle db_bundle = DBManager.GetInstance().DBBundle; if (db_bundle != null) { string fileName = Path.GetFileNameWithoutExtension(mStrPath); Object resObj = db_bundle.LoadAsset(fileName); TextAsset text = resObj as TextAsset; if (text != null) { string strData = CommonTool.BytesToUtf8(text.bytes); if (strData != "") { ParseData(strData); } IsLoaded = true; Resources.UnloadAsset(text); } else { GameDebug.LogError("DB file load failed: " + mStrPath); } } else { GameDebug.LogError("DB asset is null!!!"); } #endif /*AssetManager manager = Game.GetInstance().MainInterface.GetAssetManager(); * if (manager== null) * { * GameDebug.LogError("No AssetManager!"); * return; * }*/ /*if (xc.Game.GetInstance().IsUsePackage() || Application.platform != RuntimePlatform.WindowsPlayer) * { * string path = mStrPath; * //string ext = Path.GetExtension(mStrPath).ToLower(); * manager.LoadAsset(path, LoadData); * } * else * { * string path = ""; * string nameNoExtend = PathHelp.GetPathWithNoExtend(mStrPath); * * path = "Resources/" + mStrPath; * path = PathHelp.GetFullPaltformPath(path, false); * * System.IO.FileStream stream = new System.IO.FileStream(path, System.IO.FileMode.Open); * byte[] content = new byte[stream.Length]; * stream.Read(content, 0, (int)stream.Length); * * IsLoaded = true; * * string strData = AssetManager.BinToUtf8(content); * ParseData(strData); * stream.Close(); * }*/ }
public static bool ToProcessCommand(string main, List <string> paramArray, DebugUI debugUI) { if (main.ToLower() == "h" || main.ToLower() == "help") { string desc = "常用GM指令如下:"; debugUI.PushLog(desc); desc = "monster [type_id] [num] : 创建n个怪物"; debugUI.PushLog(desc); desc = "playerai : 开启/关闭玩家ai"; debugUI.PushLog(desc); return(true); } else if (main.ToLower() == "playerai") { LocalPlayer act = (LocalPlayer)Game.GetInstance().GetLocalPlayer(); if (act != null) { bool aiEnable = act.GetAIEnable(); act.ActiveAI(!aiEnable); } } else if (main.ToLower() == "aoinum") { debugUI.DrawActorCount = !debugUI.DrawActorCount; } else if (main.ToLower() == "fsm_trace") { // 输入UnitID,开启或关闭状态调试 // 第一个参数是UnitID的 if (paramArray.Count == 3) { UnitID uid = new UnitID(); uid.type = byte.Parse(paramArray[0]); uid.obj_idx = uint.Parse(paramArray[1]); Actor actor = ActorManager.Instance.GetActor(uid); if (actor != null) { actor.FSM.bIsDebug = !actor.FSM.bIsDebug; return(true); } } } else if (main.ToLower() == "fsm_getcurstate") { // 输入UnitID,开启或关闭状态调试 // 第一个参数是UnitID的type, 第二个是serial_idx, 第三个是obj_idx if (paramArray.Count == 3) { UnitID uid = new UnitID(); uid.type = byte.Parse(paramArray[0]); uid.obj_idx = uint.Parse(paramArray[1]); Actor actor = ActorManager.Instance.GetActor(uid); if (actor != null) { string name = actor.FSM.GetCurState().Name; debugUI.PushLog("CurState: " + name); return(true); } } } else if (main.ToLower() == "localplayerid") { debugUI.PushLog("type:" + Game.GetInstance().LocalPlayerID.type + ",obj_id:" + Game.GetInstance().LocalPlayerID.obj_idx); return(true); } else if (main.ToLower() == "attackspeed") { float fSpeed = 1.0f; if (paramArray.Count >= 1) { if (paramArray[0] != "") { fSpeed = float.Parse(paramArray[0]); } } Game.GetInstance().GetLocalPlayer().AttackSpeed = fSpeed; return(true); } else if (main.ToLower() == "movespeed") { float fSpeed = 1.0f; if (paramArray.Count >= 1) { if (paramArray[0] != "") { fSpeed = float.Parse(paramArray[0]); } } Game.GetInstance().GetLocalPlayer().SetMoveSpeedScale(fSpeed, 0); return(true); } else if (main.ToLower() == "clear") { debugUI.Clear(); return(true); } else if (main.ToLower() == "globalcfg") { if (paramArray.Count >= 2) { try { xc.GlobalSettings settings = xc.GlobalSettings.GetInstance(); System.Reflection.FieldInfo[] fields = settings.GetType().GetFields(); foreach (System.Reflection.FieldInfo field in fields) { if (field.Name.ToLower() == paramArray[0].ToLower()) { if (field.FieldType == typeof(bool)) { field.SetValue(settings, bool.Parse(paramArray[1])); return(true); } else if (field.FieldType == typeof(float)) { field.SetValue(settings, float.Parse(paramArray[1])); return(true); } else if (field.FieldType == typeof(int)) { field.SetValue(settings, int.Parse(paramArray[1])); return(true); } return(true); } } } catch (System.Exception e) { GameDebug.Log(e.Message); } } } else if (main.ToLower() == "test_voice") { AudioManager.Instance.PlayBattleSFX(GlobalConst.ResPath + "Sound/voice/Test4.ogg", SoundType.NPC); //AudioManager.Instance.PlayBattleSFX(GlobalConst.ResPath + "Sound/voice/Test2.ogg", SoundType.Voice); //AudioManager.Instance.PlayBattleSFX(GlobalConst.ResPath + "Sound/voice/Test3.ogg", SoundType.Voice); return(true); } else if (main.ToLower() == "test_fight") { //LocalPlayerManager.Instance.TryShowFightRankAnim(100); int num = 0; for (var i = 0; i < paramArray.Count; i++) { if (int.TryParse(paramArray[i], out num)) { LocalPlayerManager.Instance.TryShowFightRankAnim(num); ClientEventMgr.GetInstance().FireEvent((int)ClientEvent.CE_LOCALPLAYER_BATTLE_POWER_CHANGED, null); } } return(true); } else if (main.ToLower() == "ip") { if (paramArray.Count >= 1) { Game.GetInstance().ServerIP = paramArray[0]; } if (paramArray.Count >= 2) { Game.GetInstance().ServerPort = int.Parse(paramArray[1]); } return(true); } else if (main.ToLower() == "pos") { LocalPlayer player = Game.GetInstance().GetLocalPlayer() as LocalPlayer; if (player != null) { debugUI.PushLog("Player Pos:" + player.transform.position); } return(true); } else if (main.ToLower() == "gl") { if (paramArray.Count > 0) { int lv = 0; if (int.TryParse(paramArray[0], out lv)) { QualitySetting.GraphicLevel = lv; return(true); } } } else if (main.ToLower() == "test") { // **** 临时测试命令 int alpha = 0; if (paramArray.Count > 0) { int.TryParse(paramArray[0], out alpha); } Game.GetInstance().GetLocalPlayer().Alpha = Mathf.Clamp01((float)(alpha / 255.0f)); return(true); } else if (main.ToLower() == "openallsys") { debugUI.ProcessCommand("c:#set_open&1"); return(true); } else if (main.ToLower() == "sleep_guide") { GuideManager.GetInstance().ForceToSleepGuide(); return(true); } else if (main.ToLower() == "sg") { GuideManager.GetInstance().ForceToSleepGuide(); return(true); } else if (main.ToLower() == "sleep_auto") { TaskHelper.IsAutoMainTask = false; return(true); } else if (main.ToLower() == "sa") { TaskHelper.IsAutoMainTask = false; return(true); } else if (main.ToLower() == "reset_guide") { GuideManager.GetInstance().ResetAllSysGuide(); return(true); } else if (main.ToLower() == "diaobao") { // sleep guide GuideManager.GetInstance().ForceToSleepGuide(); /*xc.ui.UIMainmapSysOpenWindow.ShowSysOpenAnim = false;*/ // lv max debugUI.ProcessCommand("c:#lv&70"); // rich debugUI.ProcessCommand("c:#rich"); // gm equip debugUI.ProcessCommand("c:#e_new&1000905&8"); debugUI.ProcessCommand("c:#e_new&1000906&8"); } else if (main.ToLower() == "test_equip&1") { // string str = GameConstHelper.GetString("GAME_TEST_ADD_EQUIPS1"); // string[] strList = str.Split(','); // for (int i = 0; i < strList.Length; i++) // { // string str1 = strList[i].Replace(" ", ""); // str1 = str1.Substring(1, str1.Length - 2); // debugUI.ProcessCommand(str1); // } debugUI.ProcessCommand("c:#add_goods&100001&1"); debugUI.ProcessCommand("c:#add_goods&100002&1"); debugUI.ProcessCommand("c:#add_goods&100003&1"); debugUI.ProcessCommand("c:#add_goods&100004&1"); debugUI.ProcessCommand("c:#add_goods&100005&1"); debugUI.ProcessCommand("c:#add_goods&100006&1"); debugUI.ProcessCommand("c:#add_goods&100007&1"); debugUI.ProcessCommand("c:#add_goods&100008&1"); debugUI.ProcessCommand("c:#add_goods&100009&1"); } else if (main.ToLower() == "test_equip&2") { string str = GameConstHelper.GetString("GAME_TEST_ADD_EQUIPS2"); string[] strList = str.Split(','); for (int i = 0; i < strList.Length; i++) { string str1 = strList[i].Replace(" ", ""); str1 = str1.Substring(1, str1.Length - 2); debugUI.ProcessCommand(str1); } } else if (main.ToLower() == "test_equip&3") { string str = GameConstHelper.GetString("GAME_TEST_ADD_EQUIPS3"); string[] strList = str.Split(','); for (int i = 0; i < strList.Length; i++) { string str1 = strList[i].Replace(" ", ""); str1 = str1.Substring(1, str1.Length - 2); debugUI.ProcessCommand(str1); } } else if (main.ToLower() == "test_equip") { string str = GameConstHelper.GetString("GAME_TEST_ADD_EQUIPS"); string[] strList = str.Split(','); for (int i = 0; i < strList.Length; i++) { string str1 = strList[i].Replace(" ", ""); str1 = str1.Substring(1, str1.Length - 2); debugUI.ProcessCommand(str1); } return(true); } else if (main.ToLower() == "test_refining") { debugUI.ProcessCommand("c:#add_goods&30001&90"); debugUI.ProcessCommand("c:#add_goods&30002&45"); debugUI.ProcessCommand("c:#add_goods&30003&30"); debugUI.ProcessCommand("c:#add_goods&30004&60"); return(true); } else if (main.ToLower() == "start_guide") { GuideManager.Instance.StartGuide(DBTextResource.ParseUI(paramArray[0]), null); return(true); } else if (main.ToLower() == "open_sys") { foreach (var param in paramArray) { SysConfigManager.Instance.ForceOpenSys(uint.Parse(param)); } ClientEventMgr.GetInstance().FireEvent((int)ClientEvent.CE_NEW_WAITING_SYS, new CEventBaseArgs()); return(true); } else if (main.ToLower() == "close_sys") { foreach (var param in paramArray) { SysConfigManager.Instance.ForceCloseSys(uint.Parse(param)); } return(true); } else if (main.ToLower().StartsWith("start_inst")) { if (paramArray.Count > 0) { uint instanceId = DBTextResource.ParseUI_s(paramArray[0], 0); SceneHelp.JumpToScene(instanceId); } } else if (main.ToLower().StartsWith("jump")) { if (paramArray.Count > 0) { uint instanceId = DBTextResource.ParseUI_s(paramArray[0], 0); SceneHelp.JumpToScene(instanceId); } } else if (main.ToLower().StartsWith("dialog")) { if (paramArray.Count > 0) { uint dialogId = DBTextResource.ParseUI_s(paramArray[0], 0); DialogManager.GetInstance().TriggerDialog(dialogId); } } else if (main.ToLower().StartsWith("ride_all")) { mTestRide = true; foreach (var item in ActorManager.Instance.PlayerSet) { item.Value.mRideCtrl.RemotePlayerUsingRideId = 400001; item.Value.mRideCtrl.RemotePlayerServerStatusRiding = true; } return(true); } else if (main.ToLower().StartsWith("unride_all")) { mTestRide = false; foreach (var item in ActorManager.Instance.PlayerSet) { item.Value.mRideCtrl.RemotePlayerServerStatusRiding = false; } return(true); } else if (main.ToLower().StartsWith("exit")) { ClientEventMgr.GetInstance().FireEvent((int)ClientEvent.CE_EXITINSTANCE, null); return(true); } else if (main.ToLower() == "fast_sys_open") { // xc.ui.UIMainmapSysOpenWindow.ShowSysOpenAnim = false; return(true); } else if (main.ToLower().Equals("show_win")) { if (paramArray.Count > 2) { int param_int = 0; int param_int_2 = 0; if (int.TryParse(paramArray[1], out param_int) && int.TryParse(paramArray[2], out param_int_2)) { xc.ui.ugui.UIManager.Instance.ShowWindow(paramArray[0], param_int, param_int_2); } } else if (paramArray.Count > 1) { int param_int = 0; if (int.TryParse(paramArray[1], out param_int)) { xc.ui.ugui.UIManager.Instance.ShowWindow(paramArray[0], param_int); } } else if (paramArray.Count > 0) { //xc.ui.UIManager.Instance.UIMain.StartCoroutine(xc.ui.UIManager.GetInstance().ShowWindow(paramArray[0])); xc.ui.ugui.UIManager.Instance.ShowWindow(paramArray[0]); } return(true); } else if (main.ToLower().Equals("show_sys_win")) { if (paramArray.Count > 0) { xc.ui.ugui.UIManager.Instance.ShowSysWindow(paramArray[0]); } return(true); } else if (main.ToLower().Equals("close_win")) { if (paramArray.Count > 0) { //xc.ui.UIManager.Instance.UIMain.StartCoroutine(xc.ui.UIManager.GetInstance().ShowWindow(paramArray[0])); xc.ui.ugui.UIManager.Instance.CloseWindow(paramArray[0]); } return(true); } else if (main.ToLower().Equals("close_sys_win")) { if (paramArray.Count > 0) { xc.ui.ugui.UIManager.Instance.CloseSysWindow(paramArray[0]); } return(true); } else if (main.ToLower().StartsWith("crashu")) { //becarefull! Debug.Log("crash c#"); MainGame.HeartBehavior.StartCoroutine(CreateNewObject()); return(true); } else if (main.ToLower().StartsWith("hangup")) { //becarefull! System.Threading.Thread.Sleep(10000); return(true); } else if (main.ToLower() == "test_lua") { //xc.ui.UIManager.Instance.ShowWindow("LuaTestWindow"); var funcName = paramArray[0]; var method = typeof(LuaTestMgr).GetMethod(funcName); if (method != null) { method.Invoke(LuaTestMgr.Instance, null); } else { GameDebug.LogError("Can not find method " + funcName + " in LuaTestMgr"); } return(true); } else if (main.ToLower() == "save_call") { //LuaBugFixMgr.SaveCallFile(); return(true); } else if (main.ToLower().StartsWith("play_movie")) { #if UNITY_ANDROID || UNITY_IPHONE var path = paramArray[0]; Handheld.PlayFullScreenMovie(path, Color.black, FullScreenMovieControlMode.CancelOnInput, FullScreenMovieScalingMode.AspectFit); #endif return(true); } else if (main.ToLower() == "test_avatar") // 测试变身技能 { uint type_id = 0; // 角色id if (paramArray.Count > 0) { uint.TryParse(paramArray[0], out type_id); } var player = Game.Instance.GetLocalPlayer(); if (player != null) { //bool isShifted = player.mAvatarCtrl.IsShapeShift; //player.mAvatarCtrl.ShapeShift(!isShifted, type_id, 0); //player.mAvatarCtrl.ShapeShift(isShifted, type_id, 1); player.BuffCtrl.AddBuff(20018, 3.0f); player.BuffCtrl.AddBuff(23005, 5.0f);//test_avatar 19001 } return(true); } else if (main.ToLower() == "test_shift") // 测试变身技能 { uint type_id = 0; // 角色id if (paramArray.Count > 0) { uint.TryParse(paramArray[0], out type_id); } var player = Game.Instance.GetLocalPlayer(); if (player != null) { player.BuffCtrl.AddBuff(23005, 30.0f); player.Kill(); } return(true); } else if (main.ToLower() == "fightingtip") { var str = paramArray[0]; buffID = uint.Parse(str); new Utils.Timer((int)(20 * 1000f), true, 0.5f * 1000f, OnFightEffectTimer); return(true); } else if (main.ToLower() == "clearcd") { uint skill_id = 0;// 角色id if (paramArray.Count > 0) { uint.TryParse(paramArray[0], out skill_id); } Actor localplayer = Game.GetInstance().GetLocalPlayer(); if (localplayer != null) { localplayer.CDCtrl.RemoveCD(skill_id); } debugUI.ProcessCommand("c:#ignore_skill_cd"); return(true); } else if (main.ToLower() == "setskill") { uint skill_id = 0; // 技能id uint skill_pos = 0; // 技能pos if (paramArray.Count < 2) { return(false); } uint.TryParse(paramArray[0], out skill_id); uint.TryParse(paramArray[1], out skill_pos); SkillManager.Instance.SetOpeningSkill(DBCommandList.BtnToOPFlag(skill_pos), skill_id); return(true); } else if (main.ToLower().StartsWith("float_tips")) { UINotice.Instance.ShowMessage(paramArray[0]); return(true); } else if (main.ToLower().StartsWith("rolling_notice")) { UINotice.Instance.ShowRollingNotice(paramArray[0]); return(true); } else if (main.ToLower().StartsWith("warnning")) { UINotice.Instance.ShowWarnning(paramArray[0]); return(true); } else if (main.ToLower().StartsWith("danmu")) { UINotice.Instance.ShowDanmaku(paramArray[0]); return(true); } else if (main.ToLower().StartsWith("bottom_message")) { UINotice.Instance.ShowBottomMessage(paramArray[0]); return(true); } else if (main.ToLower().StartsWith("reloadui")) { string name = ""; if (paramArray.Count > 0) { name = paramArray[0]; xc.ui.ugui.UIManager.Instance.CloseWindow(name); xc.ui.ugui.UIManager.Instance.ShowWindow(name); return(true); } else { return(false); } } else if (main.ToLower().StartsWith("pet_attack_parent_target")) { if (paramArray.Count > 0) { int useParentTarget = DBTextResource.ParseI_s(paramArray[0], 0); LocalPlayer localPlayer = Game.Instance.GetLocalPlayer() as LocalPlayer; if (localPlayer != null) { Pet currentPet = localPlayer.GetPet(); if (currentPet != null) { BehaviourAI ai = currentPet.GetAI() as BehaviourAI; if (ai != null && ai.RunningProperty != null) { if (useParentTarget == 0) { ai.RunningProperty.IsAttackParentTarget = false; } else { ai.RunningProperty.IsAttackParentTarget = true; } } } } } } else if (main.ToLower().Equals("p")) { TestUnit.DisplayDebugDraw = !TestUnit.DisplayDebugDraw; return(true); } else if (main.ToLower() == "test_db") { System.Diagnostics.Stopwatch stopwatch = new System.Diagnostics.Stopwatch(); stopwatch.Start(); for (int i = 0; i < 1; ++i) { List <Dictionary <string, string> > ret = DBManager.Instance.QuerySqliteRow <string>(GlobalConfig.DBFile, "reward", "item_id", "100101"); } GameDebug.LogRed("Db query time: " + stopwatch.ElapsedMilliseconds); stopwatch.Stop(); stopwatch.Start(); for (int i = 0; i < 1; ++i) { string queryStr = string.Format("SELECT * FROM {0} WHERE {0}.{1} LIKE \"{2}__\"", "reward", "item_id", 1001); List <Dictionary <string, string> > ret = DBManager.Instance.QuerySqliteRow(GlobalConfig.DBFile, "reward", queryStr); } GameDebug.LogRed("Db query time: " + stopwatch.ElapsedMilliseconds); return(true); } else if (main.ToLower() == "notice_dlg") { if (paramArray.Count > 0) { string text = paramArray[0]; xc.ui.UIWidgetHelp.GetInstance().ShowNoticeDlg(xc.ui.ugui.UINoticeWindow.EWindowType.WT_OK_DisableCloseBtn, "", text, null, null); } else { xc.ui.UIWidgetHelp.GetInstance().ShowNoticeDlg(xc.ui.ugui.UINoticeWindow.EWindowType.WT_OK_DisableCloseBtn, "teset", null, null); } return(true); } else if (main.ToLower() == "toggle_notice_dlg") { xc.ui.UIWidgetHelp.GetInstance().ShowNoticeDlg(xc.ui.ugui.UINoticeWindow.EWindowType.WT_OK_Cancel_Toggle, "title", "content", null, null, null, null, "", "", "toggle_text", false); return(true); } else if (main.ToLower() == "reload") // 重载表格 { string table_name = ""; if (paramArray.Count > 0) { DBManager.Instance.ClearCache(); table_name = paramArray[0]; var table = DBManager.Instance.GetDB(table_name); if (table != null) { table.Unload(); table.Load(); } } return(true); } else if (main.ToLower() == "newskill")// 新技能的指令 { uint skill_id = 0; if (paramArray.Count > 0) { skill_id = uint.Parse(paramArray[0]); SkillHoleManager.Instance.ClearSkill(skill_id); SkillHoleManager.Instance.OpenNewSkill(skill_id); } return(true); } else if (main.ToLower().Equals("hide_debug_ui")) { MainGame.HideDebugUI(); return(true); } else if (main.ToLower().Equals("hide_ui")) { MainGame.HideDebugUI(); xc.ui.ugui.UIManager.Instance.ClearUI(); return(true); } else if (main.ToLower().Equals("hide_ui_and_hook")) { MainGame.HideDebugUI(); xc.ui.ugui.UIManager.Instance.ClearUI(); InstanceManager.Instance.SetOnHook(true); return(true); } else if (main.ToLower().Equals("play_timeline")) { if (paramArray.Count > 0) { uint id = uint.Parse(paramArray[0]); TimelineManager.Instance.Play(id, null); } return(true); } else if (main.ToLower().Equals("timeline_change_skin")) { if (paramArray.Count > 0) { uint param = uint.Parse(paramArray[0]); TimelineManager.Instance.changeSkin = param == 1; } return(true); } else if (main.ToLower().Equals("play_timeline_and_jump")) { if (paramArray.Count > 1) { uint id = uint.Parse(paramArray[0]); uint instanceId = uint.Parse(paramArray[1]); TimelineManager.Instance.Play(id, () => { xc.SceneHelp.JumpToScene(instanceId); }); } return(true); } else if (main.ToLower().Equals("preload_timeline")) { if (paramArray.Count > 0) { uint id = uint.Parse(paramArray[0]); TimelineManager.Instance.Preload(id); } return(true); } else if (main.ToLower().Equals("st")) { TimelineManager.Instance.Stop(); return(true); } else if (main.ToLower().Equals("npc_unload_model")) { if (paramArray.Count > 0) { uint id = uint.Parse(paramArray[0]); NpcPlayer npc = NpcManager.Instance.GetNpcByNpcId(id); if (npc != null) { npc.mAvatarCtrl.UnloadModel(); } } return(true); } else if (main.ToLower().Equals("npc_reload_model")) { if (paramArray.Count > 0) { uint id = uint.Parse(paramArray[0]); NpcPlayer npc = NpcManager.Instance.GetNpcByNpcId(id); if (npc != null) { npc.mAvatarCtrl.ReloadModel(); } } return(true); } else if (main.ToLower().Equals("ui_delay")) { if (paramArray.Count < 0) { return(false); } float delay; float.TryParse(paramArray[0], out delay); if (delay >= 0) { UIManager.Instance.MainCtrl.Delay = delay; } return(true); } else if (main.ToLower().Equals("skip_sys_open") || main.ToLower().Equals("sso")) { SysConfigManager.Instance.SkipSysOpen = true; return(true); } else if (main.ToLower() == "show_chip")// 显示碎片动画 { if (paramArray.Count >= 2) { uint goods_id = uint.Parse(paramArray[0]); uint goods_num = uint.Parse(paramArray[1]); xc.ui.ugui.UIManager.Instance.ShowWindow("UIBossFragmentsWindow", goods_id, goods_num); } return(true); } else if (main.ToLower() == "show_pet")// 显示获得守护 { if (paramArray.Count >= 1) { uint pet_id = uint.Parse(paramArray[0]); xc.ui.ugui.UIManager.Instance.ShowWindow("UIGetNewPetWindow", pet_id); } return(true); } else if (main.ToLower() == "play_xihun") { string sound_path = "Assets/" + ResPath.Sound_ui_xihun; xc.AudioManager.DynamicAudioParam param = new xc.AudioManager.DynamicAudioParam(); param.res_path = sound_path; param.is_loop = false; param.volume = 1; xihun_sound_id = xc.AudioManager.Instance.PlayAudio_dynamic_out(param); return(true); } else if (main.ToLower() == "stop_xihun") { xc.AudioManager.Instance.StopAudio_dynamic(xihun_sound_id); return(true); } else if (main.ToLower() == "show_mount")// 显示坐骑获得动画 { if (paramArray.Count >= 1) { uint mount_id = uint.Parse(paramArray[0]); xc.ui.ugui.UIManager.Instance.ShowWindow("UIGetNewMountWindow", mount_id); } } else if (main.ToLower() == "set_mount")// 设置主角坐骑ID { if (paramArray.Count >= 1) { uint mount_id = uint.Parse(paramArray[0]); Actor local_player = xc.Game.Instance.GetLocalPlayer(); if (local_player != null) { local_player.MountId = mount_id; } } } else if (main.ToLower() == "router") //跳转 { if (paramArray.Count == 1) { uint sys_id = uint.Parse(paramArray[0]); RouterManager.Instance.GenericGoToSysWindow(sys_id); } else if (paramArray.Count == 2) { uint sys_id = uint.Parse(paramArray[0]); uint param1 = uint.Parse(paramArray[1]); RouterManager.Instance.GenericGoToSysWindow(sys_id, param1); } } else if (main.ToLower() == "pause_instance")// 暂停副本 { InstanceHelper.PauseInstance(); } else if (main.ToLower() == "resume_instance")// 恢复副本 { InstanceHelper.ResumeInstance(); } else if (main.ToLower().Equals("task_changed"))// fire一个任务变化的事件 { ClientEventMgr.Instance.FireEvent((int)ClientEvent.TASK_CHANGED, null); return(true); } else if (main.ToLower().Equals("finish_task"))// fire一个完成任务的事件 { if (paramArray.Count > 0) { uint id = uint.Parse(paramArray[0]); ClientEventMgr.Instance.FireEvent((int)ClientEvent.TASK_FINISHED, new CEventBaseArgs(id)); } return(true); } else if (main.ToLower().Equals("cam_zoom"))// 拉近拉远摄像机 { if (paramArray.Count > 0) { float zoom = float.Parse(paramArray[0]); if (Game.Instance.CameraControl != null) { Game.Instance.CameraControl.Zoom = zoom; } } return(true); } else if (main.ToLower().Equals("cam_fov"))// 拉近拉远摄像机 { if (paramArray.Count > 0) { float fov = float.Parse(paramArray[0]); if (Game.Instance.CameraControl != null) { Game.Instance.CameraControl.FOV = fov; } } return(true); } else if (main.ToLower().Equals("cam_follow_dis"))// 拉近拉远摄像机 { if (paramArray.Count > 0) { float followDistance = float.Parse(paramArray[0]); if (Game.Instance.CameraControl != null) { Game.Instance.CameraControl.FollowDistance = followDistance; } } return(true); } else if (main.ToLower().Equals("stop_navigate"))// 停止寻路 { TargetPathManager.Instance.StopPlayerAndReset(); return(true); } else if (main.ToLower().Equals("large_num_float_tips"))// 大数字飘字 { if (paramArray.Count > 0) { ulong num = ulong.Parse(paramArray[0]); uint decimalPlaces = 1; if (paramArray.Count > 1) { decimalPlaces = uint.Parse(paramArray[1]); } UINotice.Instance.ShowMessage(xc.ui.UIWidgetHelp.GetLargeNumberString(num, decimalPlaces)); } return(true); } else if (main.ToLower().Equals("enter_guild_manor"))// 进入帮派领地 { InstanceHelper.EnterGuildManor(); return(true); } else if (main.ToLower().Equals("fly"))// 主角瞬移 { if (paramArray.Count > 1) { float x = float.Parse(paramArray[0]); float z = float.Parse(paramArray[1]); Actor localPlayer = Game.Instance.GetLocalPlayer(); if (localPlayer != null) { localPlayer.MoveCtrl.SendFly(new Vector3(x, 0f, z)); } } return(true); } else if (main.ToLower().Equals("-jumpscene"))// 跳场景动画测试 { var local_player = Game.Instance.GetLocalPlayer(); if (local_player != null) { local_player.BeginJumpScene("jumpout"); } return(true); } else if (main.ToLower().Equals("posteffect"))// 后处理效果测试 { WaterWaveEffect.Instance.Start(2.0f, null); return(true); } else if (main.ToLower().Equals("lowfps"))// fps较低 { ClientEventMgr.Instance.PostEvent((int)ClientEvent.CE_SETTING_LOW_FPS, null); return(true); } else if (main.ToLower().Equals("event"))// { int eventId = 0; if (paramArray.Count > 0) { eventId = int.Parse(paramArray[0]); } ClientEventMgr.GetInstance().FireEvent(eventId, null); } else if (main.ToLower().Equals("testdb")) { var buff_info = DBBuffSev.GetInstance().GetBuffInfo(25103); /*var db_stigmalv = DBManager.Instance.GetDB<DBStigmaLv>(); * var max_lv = db_stigmalv.GetMaxLevel(100001); * var info = db_stigmalv.GetOneInfo(100001, 1); * * var text = DBConstText.GetText("GUILD_FIRE_DRINK_WINE_ROLLING_NOTICE"); * var random_text = DBConstText.GetRandomText("GUILD_FIRE_GET_MEAT_SYS_MSG_",3); * var db_guildskill = DBManager.Instance.GetDB<DBGuildSkill>(); * var skill_info = db_guildskill.GetOneItem(1, 10); * * var dv_equip_attr = DBManager.Instance.GetDB<DBEquipAttr>(); * var a = dv_equip_attr.GetAttrData(993901); * var b = dv_equip_attr.GetAttrDataByGroupId(9939); * * var d = DBSuitRefine.Instance.GetRefineListByPos(EEquipPos.POS_ARMOUR, 5); * var s = DBSuitRefine.Instance.GetData("3_7_3");*/ return(true); } else if (main.ToLower().Equals("testdrop")) { //InstanceDropManager.Instance.DestroyAllDrops(); var drop = new S2CNwarDrop(); drop.em_id = 0; drop.drop_type = 1; for (int i = 0; i < 100; ++i) { var give = new PkgDropGive(); give.oid = (uint)i + 1; give.type = GameConst.GIVE_TYPE_GOODS; give.gid = 1085; give.num = 1; give.time = Game.Instance.ServerTime; give.name = System.Text.Encoding.UTF8.GetBytes("掉落归属者"); drop.drops.Add(give); } byte[] serialData = null; using (MemoryStream m = new MemoryStream()) { Serializer.Serialize <S2CNwarDrop>(m, drop); m.Position = 0; serialData = new byte[m.Length]; m.Read(serialData, 0, (int)m.Length); } Game.GetInstance().ProcessServerData(NetMsg.MSG_NWAR_DROP, serialData); } else if (main.ToLower().Equals("clear_drop")) { InstanceDropManager.Instance.DestroyAllDrops(); } else if (main.ToLower().Equals("copy")) { if (paramArray.Count > 0) { TextHelper.CopyTextToClipboard(paramArray[0]); } } else if (main.ToLower().Equals("test_download")) { if (paramArray.Count > 0) { xpatch.http.Request httpRequest = new xpatch.http.Request(); httpRequest.Url = paramArray[0]; httpRequest.SavePath = Application.dataPath + "/../download"; httpRequest.ResumeSize = 0; httpRequest.ExecuteDownload(); } } else if (main.ToLower().Equals("log_msg")) { xc.Game.Instance.PackRecorder.EnableLogFile = true; } LuaScriptMgr.Instance.CallLuaFunction(LuaScriptMgr.Instance.Lua.Global, "LuaProcessDebugCommand", main, paramArray); return(false); }
public static List <List <uint> > ParseArrayUintUint(string str) { var uintUintList = new List <List <uint> >(); if (!string.IsNullOrEmpty(str) && str.Length >= 2) { bool brace_start = false; List <uint> brace_content = null; StringBuilder char_content = null; bool start = false; for (int i = 0; i < str.Length; ++i) { char c = str[i]; if (c == '[') { start = true; continue; } else if (c == ']') { break; } else if (c == '{') { if (brace_start) { GameDebug.LogError("ParseArrayStringString error, duplication brace."); break; } else { brace_start = true; brace_content = new List <uint>(); char_content = new StringBuilder(5); uintUintList.Add(brace_content); } } else if (c == '}') { if (brace_start) { brace_start = false; if (brace_content != null) { if (char_content != null) { var content_str = char_content.ToString(); char_content = null; brace_content.Add(ParseUI_s(content_str, 0)); brace_content = null; } else { GameDebug.LogError("ParseArrayStringString error, char_content is null."); break; } } } else { GameDebug.LogError("ParseArrayStringString error, brace_start state is invalid."); break; } } else if (c == ',') { if (brace_content != null) { if (char_content != null) { var content_str = char_content.ToString(); brace_content.Add(ParseUI_s(content_str, 0)); char_content = new StringBuilder(10); } else { GameDebug.LogError("ParseArrayStringString error, char_content is null."); break; } } } else { if (start == false) { GameDebug.LogError("ParseArrayStringString error, has same char before start."); continue; } else if (brace_start) { if (char_content != null) { char_content.Append(c); } else { GameDebug.LogError("ParseArrayStringString error, char_content is null."); break; } } } } } return(uintUintList); }
// 生成掉落物 public static bool CreatePickInitParam(Pick.PickType picktype, int resid, int content, Vector3 pos, float dir, out List <PickInitParam> paramList, bool randomPos = false, Pick.FlyType flytype = Pick.FlyType.FLY_OUT, bool isDropBoxId = true) { paramList = new List <PickInitParam>(); if (content < 0) { return(false); } if (picktype <= Pick.PickType.INVALID || picktype >= Pick.PickType.TYPE_COUNT) { return(false); } if (isDropBoxId) { ArrayList buffList = new ArrayList(); if (DropManager.Instance.GenerateDropBox(content, out buffList)) { foreach (DropBoxItem item in buffList) { int pickres_id = item.itemid; if (picktype == Pick.PickType.ITEM) { ItemTableItem itemres = ItemManager.GetItemRes(item.itemid); if (itemres == null) { continue; } pickres_id = itemres.pickId; } for (int i = 0; i < item.itemnum; ++i) { PickInitParam initParam = new PickInitParam(); initParam.pick_type = picktype; initParam.pick_res_id = pickres_id; initParam.init_dir = dir; initParam.init_pos = pos; initParam.random_pos = randomPos; initParam.fly_type = flytype; paramList.Add(initParam); } } } } else { int pickres_id = resid; if (picktype == Pick.PickType.MONEY) { if (content < 1) { return(false); } } else if (picktype == Pick.PickType.SUPER_WEAPON) { if (!DataManager.SuperWeaponTable.ContainsKey(content)) { GameDebug.LogError("没找到超级武器 id = " + content.ToString()); return(false); } } else if (picktype == Pick.PickType.ITEM) { ItemTableItem itemres = ItemManager.GetItemRes(content); if (itemres == null) { return(false); } pickres_id = itemres.pickId; } PickInitParam initParam = new PickInitParam(); initParam.pick_type = picktype; initParam.pick_res_id = pickres_id; initParam.content = content; initParam.init_dir = dir; initParam.init_pos = pos; initParam.random_pos = randomPos; initParam.fly_type = flytype; paramList.Add(initParam); } return(true); }
protected override void OnUpdate() { // Camera.main may not be available when the system is created, so need this to set it for the first time if (MainCamera == null) { if (Camera.main != null) { MainCamera = Camera.main; } else { GameDebug.LogWarning("PartOwner update: No camera.main"); return; } } var camPos = (float3)MainCamera.transform.position; // TODO: Jobified ForEach blocked by PrefabAssetRegistry.CreateEntity Entities.ForEach((Entity partOwnerEntity, ref Translation translation, ref RegistryAsset registryAsset, ref InputState inputState, ref State state) => { var registry = PartRegistry.GetPartRegistry(World, registryAsset.Value); // Calc lod var charPos = translation.Value; var dist = math.distance(camPos, charPos); var newLod = -1; // TODO (mogensh) add threshold that needs to be passed before change (so it does not flicker) for (int lod = 0; lod < registry.Value.LODLevels.Length; lod++) { if (dist <= registry.Value.LODLevels[lod].EndDist) { newLod = lod; break; } } // TODO (mogensh) hack: force LOD 0 newLod = 0; // Handle out of lod distance specifically if (newLod == -1) { if (state.currentLOD != newLod) { state.currentLOD = newLod; GameDebug.Log(Part.ShowLifetime, "Out of LOD distance"); var partBuf = EntityManager.GetBuffer <PartElement>(partOwnerEntity) .ToNativeArray(Allocator.Temp); var partOutBuf = PostUpdateCommands.SetBuffer <PartElement>(partOwnerEntity); partOutBuf.ResizeUninitialized(partBuf.Length); for (int j = 0; j < partBuf.Length; j++) { var partElement = partBuf[j]; // Destroy old part if (partElement.PartId != 0) { if (partElement.PartEntity != Entity.Null) { GameDebug.Log(Part.ShowLifetime, "Destroying part. Category:{0} partId:{1}", j, partElement.PartId); PostUpdateCommands.DestroyEntity(partElement.PartEntity); } partElement.PartEntity = Entity.Null; partElement.PartId = 0; partElement.Asset = WeakAssetReference.Default; } partOutBuf[j] = partElement; } PostUpdateCommands.SetComponent(partOwnerEntity, state); } return; } var newRig = BlobAssetReference <RigDefinition> .Null; if (EntityManager.HasComponent <SharedRigDefinition>(partOwnerEntity)) { newRig = EntityManager.GetSharedComponentData <SharedRigDefinition>(partOwnerEntity).Value; } // Change bodypart if LOD or rig changed var packedPartIds = inputState.PackedPartIds; if (packedPartIds != state.CurrentPackedPartIds || newLod != state.currentLOD || (newRig != BlobAssetReference <RigDefinition> .Null && newRig != state.currentRig)) { var partBuf = EntityManager.GetBuffer <PartElement>(partOwnerEntity).ToNativeArray(Allocator.Temp); var partIds = new NativeArray <int>(partBuf.Length, Allocator.Temp); registry.Value.UnpackPartsList(inputState.PackedPartIds, partIds); GameDebug.Log(World, Part.ShowLifetime, "Property changed. Lod:{0}", newLod); var partOutBuf = PostUpdateCommands.SetBuffer <PartElement>(partOwnerEntity); partOutBuf.ResizeUninitialized(partBuf.Length); for (int j = 0; j < partBuf.Length; j++) { var partId = partIds[j]; var partElement = partBuf[j]; // Find new asset given the new properties var asset = new WeakAssetReference(); if (partId > 0) { var skeletonHash = newRig.IsCreated ? newRig.Value.GetHashCode() : 0; var found = registry.Value.FindAsset(j, partId, skeletonHash, newLod, ref asset); if (!found) { GameDebug.Log(World, Part.ShowLifetime, "Failed to find valid part. Category:{0} PartId:{1} skeletonHash: {2}", j, partId, skeletonHash); } else { GameDebug.Log(World, Part.ShowLifetime, "Find valid part. Category:{0} PartId:{1} skeletonHash: {2}", j, partId, skeletonHash); } } // No change if asset has not changed if (partElement.Asset == asset) { partOutBuf[j] = partElement; continue; } // Destroy old part if (partElement.PartId != 0) { if (partElement.PartEntity != Entity.Null) { GameDebug.Log(World, Part.ShowLifetime, "Destroying part. Category:{0} partId:", j, partElement.PartId); PostUpdateCommands.DestroyEntity(partElement.PartEntity); } partElement.PartEntity = Entity.Null; partElement.PartId = 0; partElement.Asset = WeakAssetReference.Default; } // Create new part if (partId != 0 && asset.IsSet()) { partElement.PartEntity = PrefabAssetManager.CreateEntity(EntityManager, asset); partElement.PartId = partId; partElement.Asset = asset; if (partElement.PartEntity != Entity.Null) { GameDebug.Log(World, Part.ShowLifetime, "Creating part. Owner:{0} Cat:{1} PartId:{2} Asset:{3} part:{4}", partOwnerEntity, j, partId, asset.ToGuidStr(), partElement.PartEntity); var part = Part.Owner.Default; part.Value = partOwnerEntity; PostUpdateCommands.SetComponent(partElement.PartEntity, part); // TODO (mogensh) add "static" property on owner (or get somehow). If static just set world transform PostUpdateCommands.AddComponent(partElement.PartEntity, new Parent { Value = partOwnerEntity }); PostUpdateCommands.AddComponent(partElement.PartEntity, new LocalToParent()); } else { GameDebug.LogError("Failed to create part. Asset:" + asset.ToGuidStr()); } } partOutBuf[j] = partElement; } state.CurrentPackedPartIds = packedPartIds; state.currentRig = newRig; state.currentLOD = newLod; PostUpdateCommands.SetComponent(partOwnerEntity, state); } }); }
TaskDefine ReadReader(SqliteDataReader reader) { ushort taskType = DBTextResource.ParseUS_s(GetReaderString(reader, "type"), 0); TaskDefine define = new TaskDefine(); define.Id = DBTextResource.ParseUI_s(GetReaderString(reader, "id"), 0); define.DescriptionBytes = GetReaderBytes(reader, "description"); define.NameBytes = GetReaderBytes(reader, "name"); define.Type = taskType; define.SubType = DBTextResource.ParseUI_s(GetReaderString(reader, "sub_type"), 0); define.RequestLevelMin = DBTextResource.ParseI_s(GetReaderString(reader, "lv_min"), 0); define.PreviousId = DBTextResource.ParseUI_s(GetReaderString(reader, "pre_id"), 0); define.NextId = DBTextResource.ParseUI_s(GetReaderString(reader, "next_id"), 0); define.NextId = DBTextResource.ParseUI_s(GetReaderString(reader, "next_id"), 0); string serverStepRawsString = GetReaderString(reader, "goals"); string clientStepRawsString = GetReaderString(reader, "steps"); string navigationPointsRawsString = GetReaderString(reader, "navigation_points"); define.Steps = TaskDefine.TaskStep.CreateStepsByRawString(serverStepRawsString, clientStepRawsString, navigationPointsRawsString); if (define.Steps == null || define.Steps.Count == 0) { GameDebug.LogError("Parse task " + define.Id + " error, step is empty!!!"); } define.RewardIds = DBTextResource.ParseArrayUint(GetReaderString(reader, "reward_ids"), ","); define.GetSkills = DBTextResource.ParseArrayUint(GetReaderString(reader, "get_skills"), ","); define.IsShowGetSkillProgress = DBTextResource.ParseI_s(GetReaderString(reader, "is_show_get_skill_progress"), 0) == 0 ? false : true; define.ReceiveDialogId = DBTextResource.ParseUI_s(GetReaderString(reader, "receive_dialog_id"), 0); define.SubmitDialogId = DBTextResource.ParseUI_s(GetReaderString(reader, "submit_dialog_id"), 0); define.ReceiveNpc = NpcScenePosition.Make(GetReaderString(reader, "receive_npc")); define.SubmitNpc = NpcScenePosition.Make(GetReaderString(reader, "submit_npc")); define.AutoRunType = (TaskDefine.EAutoRunType)DBTextResource.ParseBT_s(GetReaderString(reader, "auto_run"), 0); define.ShowPriority = DBManager.Instance.GetDB <DBTaskPriority>().GetTaskPriority((int)taskType); define.ShowPriority2 = DBManager.Instance.GetDB <DBTaskPriority>().GetTaskPriority2((int)taskType); string raw = GetReaderString(reader, "is_temporary_on_top"); if (string.IsNullOrEmpty(raw) == true || raw == "0") { define.IsTemporaryOnTop = false; } else { define.IsTemporaryOnTop = true; } string npcsRawString = GetReaderString(reader, "create_npcs_when_received"); define.CreateNpcsWhenReceived = TaskDefine.MakeNpcScenePositions(npcsRawString); npcsRawString = GetReaderString(reader, "delete_npcs_when_received"); define.DeleteNpcsWhenReceived = TaskDefine.MakeNpcScenePositions(npcsRawString); npcsRawString = GetReaderString(reader, "create_npcs_when_done"); define.CreateNpcsWhenDone = TaskDefine.MakeNpcScenePositions(npcsRawString); npcsRawString = GetReaderString(reader, "delete_npcs_when_done"); define.DeleteNpcsWhenDone = TaskDefine.MakeNpcScenePositions(npcsRawString); define.FollowNpcs = TaskDefine.MakeNpcScenePositions(GetReaderString(reader, "follow_npcs")); define.CanUseBoots = (DBTextResource.ParseI_s(GetReaderString(reader, "can_use_boots"), 0) > 0); define.ReceivedTimelineId = DBTextResource.ParseUI_s(GetReaderString(reader, "received_timeline_id"), 0); define.SubmitedTimelineId = DBTextResource.ParseUI_s(GetReaderString(reader, "submited_timeline_id"), 0); raw = GetReaderString(reader, "cost"); if (string.IsNullOrEmpty(raw) == false) { define.Costs = DBTextResource.ParseArrayStringString(raw); } raw = GetReaderString(reader, "show_reward_goods_id"); List <List <uint> > showRewardGoodsIdConfigs = DBTextResource.ParseArrayUintUint(raw); define.ShowRewardGoodsIds = new Dictionary <uint, uint>(); define.ShowRewardGoodsIds.Clear(); define.ShowRewardGoodsNums = new Dictionary <uint, uint>(); define.ShowRewardGoodsNums.Clear(); define.ShowRewardGoodsIsBinds = new Dictionary <uint, byte>(); define.ShowRewardGoodsIsBinds.Clear(); uint index = 1; foreach (List <uint> showRewardGoodsIdConfig in showRewardGoodsIdConfigs) { define.ShowRewardGoodsIds[index] = showRewardGoodsIdConfig[0]; define.ShowRewardGoodsNums[index] = showRewardGoodsIdConfig[1]; define.ShowRewardGoodsIsBinds[index] = (byte)showRewardGoodsIdConfig[2]; ++index; } mTasksData.Add(define.Id, define); if (mTasksDataByType.ContainsKey(define.Type) == true) { mTasksDataByType[define.Type].Add(define.Id, define); } else { Dictionary <uint, TaskDefine> taskDefines = new Dictionary <uint, TaskDefine>(); taskDefines.Clear(); taskDefines.Add(define.Id, define); mTasksDataByType.Add(define.Type, taskDefines); } return(define); }
public override bool Init(int aiId) { if (!base.Init(aiId)) { return(false); } for (int i = 1; i <= 5; i++) { int skillId = GetSkillId(i); if (skillId < 0) { continue; } mSkillList1.Add(skillId); } for (int i = 6; i <= 10; i++) { int skillId = GetSkillId(i); if (skillId < 0) { continue; } mSkillList2.Add(skillId); } try { mFrenzyMaxTime = System.Convert.ToUInt32(mRes.param1); mSkillId = System.Convert.ToInt32(mRes.param2); mBuffIdToPlayer = System.Convert.ToInt32(mRes.param3); mBuffIdToBoss = System.Convert.ToInt32(mRes.param4); mJieYaoPickId = System.Convert.ToInt32(mRes.param6); mDamageToMoney = System.Convert.ToDouble(mRes.param7); mDamageToAnger = System.Convert.ToDouble(mRes.param8); mTimerStandIntervalMin = System.Convert.ToUInt32(mRes.param9); mTimerStandIntervalMax = System.Convert.ToUInt32(mRes.param10); mStandTimeMin = System.Convert.ToUInt32(mRes.param11); mStandTimeMax = System.Convert.ToUInt32(mRes.param12); mTimerUseSkillIntervalMin = System.Convert.ToUInt32(mRes.param13); mTimerUseSkillIntervalMax = System.Convert.ToUInt32(mRes.param14); mMoveRadiusMin = System.Convert.ToSingle(mRes.param15); mMoveRadiusMax = System.Convert.ToSingle(mRes.param16); mMaxGoldCount = System.Convert.ToUInt32(mRes.param18); if (mRes.param5 != null) { string[] pos = mRes.param5.Split(new char[] { ',' }); if (pos.Length != 3) { GameDebug.LogError("猫AI 参数param5错误,正确格式为:1,2,3"); return(false); } mGoldPickId1 = System.Convert.ToInt32(pos[0]); mGoldPickId2 = System.Convert.ToInt32(pos[1]); mGoldPickId3 = System.Convert.ToInt32(pos[2]); } if (mRes.param17 != null) { string[] strPosition = mRes.param17.Split(new char[] { ';' }); for (int i = 0; i < strPosition.Length; i++) { string [] strVertexs = strPosition[i].Split(new char[] { ',' }); if (strVertexs.Length != 2) { GameDebug.LogError("猫AI 参数param17错误,正确格式为:0.0,1.0;2.0,3.0;4.0,5.0"); return(false); } mJieYaoPosition.Add(new Vector3f(System.Convert.ToSingle(strVertexs[0]), 0.0f, System.Convert.ToSingle(strVertexs[1]))); } } if (mRes.param19 != null) { string[] strPosition = mRes.param19.Split(new char[] { ';' }); for (int i = 0; i < strPosition.Length; i++) { string[] strVertexs = strPosition[i].Split(new char[] { ',' }); if (strVertexs.Length != 2) { GameDebug.LogError("猫AI 参数param19错误,正确格式为:0.0,1.0;2.0,3.0;4.0,5.0"); return(false); } mSceneGoldPosition.Add(new Vector3f(System.Convert.ToSingle(strVertexs[0]), 0.0f, System.Convert.ToSingle(strVertexs[1]))); } } } catch (Exception e) { GameDebug.LogError(e.Message); return(false); } return(true); }