public void PlayCreateAudio(uint audioID) { Engine.IAudio audio = Engine.RareEngine.Instance().GetAudio(); if (audio != null) { audio.StopEffect(m_uAudioID); } if (audioID == 0) { return; } table.ResourceDataBase resDB = GameTableManager.Instance.GetTableItem <table.ResourceDataBase>(audioID); if (audio != null && resDB != null) { if (MainPlayerHelper.GetMainPlayer() != null) { if (MainPlayerHelper.GetMainPlayer().GetNode() != null) { if (MainPlayerHelper.GetMainPlayer().GetTransForm() != null) { m_uAudioID = audio.PlayEffect(MainPlayerHelper.GetMainPlayer().GetNode().GetTransForm().gameObject, resDB.strPath, false, true); } } } } }
protected override void OnLoading() { base.OnLoading(); rs = Engine.RareEngine.Instance().GetRenderSystem(); if (rs != null) { rd = GameTableManager.Instance.GetTableItem <table.ResourceDataBase>(50003); path = rd.strPath; } m_widget = GetComponent <UIWidget>(); m_listDataType = new List <DailyDataType>() { DailyDataType.RiChangHuoDong, DailyDataType.XianShiHuoDong, DailyDataType.JiJiangKaiShi, DailyDataType.ZhouLi, }; m_lst_RewardList = GameTableManager.Instance.GetTableList <DailyAwardDataBase>(); for (int i = 0; i < m_lst_RewardList.Count; i++) { if (!m_lstRewardID.Contains(m_lst_RewardList[i].ID)) { m_lstRewardID.Add(m_lst_RewardList[i].ID); } } UIEventListener.Get(m__Model.gameObject).onDrag = DragModel; }
void PlayCreateAudio(int profession) { Engine.IAudio audio = Engine.RareEngine.Instance().GetAudio(); if (audio == null) { return; } audio.StopEffect(m_uAudioID); float originVol = 1; SelectRoleDataBase sdb = SelectRoleDataBase.Where((enumProfession)profession, (enmCharSex)1); if (sdb != null) { uint audioID = sdb.createAudioID; table.ResourceDataBase resDB = GameTableManager.Instance.GetTableItem <table.ResourceDataBase>(audioID); if (audio != null && resDB != null) { if (m_audioSource != null) { m_audioSource.volume = 0.2f; } if (m_Avater != null) { if (m_Avater.RenderObj != null) { if (m_Avater.RenderObj.GetNode() != null) { if (m_Avater.RenderObj.GetNode().GetTransForm() != null) { m_uAudioID = audio.PlayEffect(m_Avater.RenderObj.GetNode().GetTransForm().gameObject, resDB.strPath, endCallback: () => { if (m_audioSource != null) { m_audioSource.volume = originVol; } }); } } } } } } }
//------------------------------------------------------------------------------------------------------- /** * @brief 播放背景音乐 * @param */ private void PlayBGMusic() { table.MapDataBase mapDB = GameTableManager.Instance.GetTableItem <table.MapDataBase>(mapID); if (mapDB == null) { Engine.Utility.Log.Error("MapSystem:找不到地图配置数据{0}", mapID); return; } table.ResourceDataBase resDB = GameTableManager.Instance.GetTableItem <table.ResourceDataBase>(mapDB.dwbgm); if (resDB == null) { Engine.Utility.Log.Error("MapSystem:找不到地图资源路径配置{0}", mapDB.dwResPath); return; } Engine.IAudio audio = Engine.RareEngine.Instance().GetAudio(); if (audio != null) { audio.PlayMusic(resDB.strPath); } }
//------------------------------------------------------------------------------------------------------- /** * @brief 进入地图 * @param nMapID 地图ID */ public void EnterMap(uint nMapID, Vector3 pos) { // 读取地图配置表 Engine.IRenderSystem rs = Engine.RareEngine.Instance().GetRenderSystem(); Engine.Utility.Log.Info("EnterMapStart"); if (rs != null) { if (nMapID == mapID) { return; } Engine.Utility.Log.Info("EnterMapStart mapID"); // 停止背景音乐 Engine.IAudio audio = Engine.RareEngine.Instance().GetAudio(); if (audio != null) { audio.StopMusic(); } // 离开当前场景 Process = 0f; Engine.Utility.EventEngine.Instance().DispatchEvent((int)Client.GameEventID.ENTITYSYSTEM_LEAVEMAP, mapID); //进入下一个地图 Engine.Utility.Log.Info("EnterMapStart 离开当前场景"); table.MapDataBase mapDB = GameTableManager.Instance.GetTableItem <table.MapDataBase>(nMapID); if (mapDB == null) { Engine.Utility.Log.Error("MapSystem:找不到地图配置数据{0}", nMapID); return; } Engine.Utility.Log.Info("EnterMapStart 离开当前场景 table.MapDataBase mapDB "); table.ResourceDataBase resDB = GameTableManager.Instance.GetTableItem <table.ResourceDataBase>(mapDB.dwResPath); if (resDB == null) { Engine.Utility.Log.Error("MapSystem:找不到地图资源路径配置{0}", mapDB.dwResPath); return; } temptime = Time.realtimeSinceStartup; lastInfo = "none"; // 创建寻路模块 mapID = nMapID; // 预加载 mapName = mapDB.strName;// string.Format("{0}({1})", mapDB.strName, uCountryid); // 不是中转空场景 if (nMapID != GameTableManager.Instance.GetClientGlobalConst <int>("map", "emptyid")) { Engine.Utility.Log.Info("EnterMapStart 读取地图配置表 "); // 读取地图配置表 string strMapName = resDB.strPath.ToLower(); m_strMapTexturePath = strMapName.Replace(".map", "").Substring(strMapName.LastIndexOf('/') + 1); Engine.IScene scene = rs.EnterScene(ref strMapName, this); if (scene != null) { scene.StartLoad(pos); } Engine.Utility.Log.Info("EnterMapStart EnterScene name:{0} ", strMapName); // 场景npc配置 LoadClientMap(mapDB.miniMapInfo.ToLower()); //LoadClienMapArea(strMapName.ToLower().Replace(".map", ".ar")); //SpanUtil.Start(); //if (Application.platform == RuntimePlatform.WindowsEditor) //{ Profiler.BeginSample("LoadARFile"); MapAreaDisplay.Instance.LoadARFile(strMapName.ToLower().Replace(".map", ".ar")); Profiler.EndSample(); //} //SpanUtil.Stop(strMapName + " ar "); string strMPSName = strMapName.Replace(".map", ".mps").ToLower(); // 读取地表障碍信息 LoadObstacle(strMPSName); //SpanUtil.Stop(strMapName + " 地表障碍信息 "); } } else { Engine.Utility.Log.Error("MapSystem:IRenderSystem为空"); } Engine.Utility.EventEngine.Instance().DispatchEvent((int)(int)Client.GameEventID.ENTITYSYSTEM_ENTERMAP, mapID); }
void OnActionEvent(ref string strEventName, ref string strAnimationName, float time, object param) { if (strEventName == "addEffect_scene" && strAnimationName == Client.EntityAction.ShowLog) { uint nEffectID = (uint)param; table.FxResDataBase edb = GameTableManager.Instance.GetTableItem <table.FxResDataBase>(nEffectID); if (edb != null) { table.ResourceDataBase resDB = GameTableManager.Instance.GetTableItem <table.ResourceDataBase>(edb.resPath); if (resDB != null) { string strPath = resDB.strPath; string strAttachNode = edb.attachNode; List <float> rotate = edb.rotate; //m_Avater.RenderObj.AddLinkEffect(ref strPath, ref strAttachNode, // new Vector3(edb.offset[0], edb.offset[1], edb.offset[2]), // Quaternion.identity, // Vector3.one); Engine.IRenderSystem renderSys = Engine.RareEngine.Instance().GetRenderSystem(); Engine.IEffect effect = null; Vector3 vecRotate = new Vector3(rotate[0], rotate[1], rotate[2]); UnityEngine.Quaternion q = new Quaternion(); q.eulerAngles = vecRotate; renderSys.CreateEffect(ref strPath, ref effect, null, Engine.TaskPriority.TaskPriority_Normal, true); effect.GetNode().SetLocalRotate(q); Vector3 pos = new Vector3(edb.offset[0], edb.offset[1], edb.offset[2]); effect.GetNode().SetLocalPosition(pos); m_CurShowEffect.Add(effect); } } } else if (strEventName == "addEffect_body" && strAnimationName == Client.EntityAction.ShowLog) { AssetBundle m_AssetBundle; uint nEffectID = (uint)param; table.FxResDataBase edb = GameTableManager.Instance.GetTableItem <table.FxResDataBase>(nEffectID); if (edb != null) { table.ResourceDataBase resDB = GameTableManager.Instance.GetTableItem <table.ResourceDataBase>(edb.resPath); if (resDB != null) { string strPath = resDB.strPath; string strAttachNode = edb.attachNode; List <float> rotate = edb.rotate; Vector3 vecRotate = new Vector3(rotate[0], rotate[1], rotate[2]); UnityEngine.Quaternion q = new Quaternion(); q.eulerAngles = vecRotate; m_Avater.RenderObj.AddLinkEffect(ref strPath, ref strAttachNode, new Vector3(edb.offset[0], edb.offset[1], edb.offset[2]), q, Vector3.one); } } } if (strEventName == "standAni" && strAnimationName == Client.EntityAction.ShowLog) { m_bLockRotate = false; m_Avater.PlayAni(Client.EntityAction.Show, null, 0.3f, -1); } if (strEventName == "Dissolve" && strAnimationName == Client.EntityAction.ShowLog) { RenderObjHelper.BeginDissolveEffect(m_Avater.RenderObj); } //if(strEventName=="end" && strAnimationName == Client.EntityAction.ShowLog) //{ // m_bLockRotate = false; // if (null != m_cam_animator) // { // m_cam_animator.SetInteger(m_istateChangeParamHash, 0); // } //m_Avater.PlayAni(Client.EntityAction.Show, null, 0.3f, -1); //} }