/// <summary> /// 内部播放方法,编排好CachePlayList之后调用这里 /// </summary> private void DoPlay() { //当前是否有播放 if (mCur_PlayingClip != null) { MainAudioSource.Stop(); mCur_PlayingClip = null; if (mCurPlayerTimer != null) { mCurPlayerTimer.Dispose(); mCurPlayerTimer = null; } } if (mCachePlayList.Count <= 0) { XLog.PrintW("[TinaX] 音轨 " + mSoundTrackName + " 播放失败:音频缓存队列为空"); return; } mCur_PlayingClip = mCachePlayList[0]; MainAudioSource.clip = mCur_PlayingClip.OriginClip; var length = mCur_PlayingClip.OriginClip.length; //设置计时器 mCurPlayerTimer = Observable.Timer(TimeSpan.FromSeconds(length)).Subscribe(_ => { Timer_OnClipPlayEnd(); }); MainAudioSource.Play(); mCachePlayList.RemoveAt(0); }
static void OpenWindow() { if (m_curWindow != null) { return; } //检查选中物品 var path = AssetDatabase.GetAssetPath(Selection.activeInstanceID); if (path.IsNullOrEmpty()) { XLog.PrintW("选中的路径为空"); return; } //路径转为系统路径,判断是文件还是文件夹 var path_sys = System.IO.Path.GetFullPath(path); mCurPath = path; mCurPathSys = path_sys; if (System.IO.Directory.Exists(path_sys)) { mIsDir = true; } else { mIsDir = false; } m_curWindow = EditorWindow.GetWindow <ChangeLuaFileExtName>(); }
public void ShowUI(int ui_id) { if (IsAdvanced) { m_UIMgr_Adv.ShowUI(ui_id); } else { XLog.PrintW("[TinaX][UIKit]仅在高级模式下,可使用句柄ID操作UI"); return; } }
public void ShowUIByPath(string ui_path) { if (IsAdvanced) { XLog.PrintW("[TinaX][UIKit]当前UI系统为高级模式,不可使用UI路径操作UI, 请使用UI实例的句柄ID"); return; } else { m_UIMgr_Normal.ShowUIByPath(ui_path); } }
public void ShowUI(string ui_name) { if (IsAdvanced) { XLog.PrintW("[TinaX][UIKit]当前UI系统为高级模式,不可使用UI名称操作UI, 请使用UI实例的句柄ID"); return; } else { m_UIMgr_Normal.ShowUI(ui_name); } }
public void CloseUIWithLuaParam(int ui_id, XLua.LuaTable luaParam) { if (IsAdvanced) { m_UIMgr_Adv.CloseUI(ui_id, LuaParam: luaParam); } else { XLog.PrintW("[TinaX][UIKit]当前UI系统不是高级模式,但被尝试用高级模式的 ID 形式操作UI"); return; } }
public void CloseUI(int ui_id, System.Object Param = null) { if (IsAdvanced) { m_UIMgr_Adv.CloseUI(ui_id, close_param: Param); } else { XLog.PrintW("[TinaX][UIKit]当前UI系统不是高级模式,但被尝试用高级模式的 ID 形式关闭UI"); return; } }
public IUIEntity OpenUIChild(string ui_name, int parent_id, System.Object ui_param, bool use_mask, bool close_by_mask = false) { if (IsAdvanced) { return(m_UIMgr_Adv.OpenUI(ui_name, use_mask, close_by_mask, parent_id, ui_param)); } else { XLog.PrintW("[TinaX][UIKit]当前UI系统不是高级模式,但被尝试用高级模式父子级UI功能"); return(null); } }
public void CloseUIByPathWithLuaParam(string ui_path, XLua.LuaTable luaParam) { if (IsAdvanced) { //高级模式下,不可用UI名关闭UI XLog.PrintW("[TinaX][UIKit]当前UI系统为高级模式,不可使用UI名称操作UI, 请使用UI实例的句柄ID"); return; } else { m_UIMgr_Normal.CloseUIByPath(ui_path, LuaParam: luaParam); } }
public void CloseUIByPath(string ui_path, System.Object Param = null) { if (IsAdvanced) { //高级模式下,不可用UI名关闭UI XLog.PrintW("[TinaX][UIKit]当前UI系统为高级模式,不可使用UI路径关闭UI, 请使用UI实例的句柄ID"); return; } else { m_UIMgr_Normal.CloseUIByPath(ui_path, close_param: Param); } }
/// <summary> /// 播放对话 /// </summary> public void PlayDialogue(BP.DialogueBluePrint bluePrint) { if (bluePrint.DialogueName.IsNullOrEmpty()) { XLog.PrintW("[GameKit][Drama] 播放对话失败,指定的对话蓝图没有命名"); //return; } mCur_BluePrint = bluePrint; if (!mBluePrintList.Contains(bluePrint)) { mBluePrintList.Add(bluePrint); } mCur_BluePrint.ReInit(); //Debug.Log("开始节点"); mCur_BluePrint.StartNode(this); }
/// <summary> /// 添加音频片段 /// </summary> public ISoundTrack AddSoundClip(UnityEngine.AudioClip clip, string name) { if (clip == null) { XLog.PrintW("[TinaX] 音轨 " + mSoundTrackName + " 添加音频片段失败:传入的音频片段为空"); return(this); } if (!mClip_Pool.ContainsKey(name)) { mClip_Pool.Add(name, new SmartAudioClip() { Name = name, OriginClip = clip, }); } return(this); }
/// <summary> /// 播放指定音频片段 /// </summary> /// <param name="name"></param> /// <returns></returns> public ISoundTrack Play(string name) { //检查name是否存在 if (!mClip_Pool.ContainsKey(name)) { XLog.PrintW("[TinaX] 音轨 :" + mSoundTrackName + " ,播放指定音频片段 " + name + " 不存在"); return(this); } //当前是否有正在播放 if (mCur_PlayingClip != null) { //有正在播放内容,看看切换策略吧 if (mSwitchMode == E_SwitchMode.cover) { //结束当前播放并开始下一个 //Todo 切换特效(淡入淡出 等,以后再写) //修改Cache队列 mCachePlayList.Clear(); mCachePlayList.Add(mClip_Pool[name]); DoPlay(); } else if (mSwitchMode == E_SwitchMode.wait) { //等待当前播放结束并播放下一个 //编排进Cache队列之后不管了 mCachePlayList.Add(mClip_Pool[name]); } } else { //直接编排队列 mCachePlayList.Clear(); mCachePlayList.Add(mClip_Pool[name]); DoPlay(); } return(this); }
private TinaX.Lua.LuaFileExten mFiles_CurRefreshExt; //当前刷新出来的列表是这个后缀 /// <summary> /// /// </summary> private void Draw_Files() { GUILayout.BeginVertical(); GUILayout.Label("批量更改Lua文件后缀名 - 规则:"); GUILayout.BeginHorizontal(); GUILayout.Label("从后缀名:"); mFiles_FromExt = (TinaX.Lua.LuaFileExten)EditorGUILayout.EnumPopup(mFiles_FromExt); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("修改为:"); mFiles_ToExt = (TinaX.Lua.LuaFileExten)EditorGUILayout.EnumPopup(mFiles_ToExt); GUILayout.EndHorizontal(); GUILayout.Space(10); GUILayout.Label("从:example" + Enum2Str(mFiles_FromExt) + " 修改为:example" + Enum2Str(mFiles_ToExt)); GUILayout.Space(20); if (GUILayout.Button("刷新列表")) { if (mFiles_FromExt == mFiles_ToExt) { XLog.PrintW("我替换我自己?"); return; } var fromExt = Enum2Str(mFiles_FromExt); var files_guid = AssetDatabase.FindAssets("", new string[] { mCurPath }); foreach (var item in files_guid) { var fileName = AssetDatabase.GUIDToAssetPath(item); if (mFiles_FromExt == TinaX.Lua.LuaFileExten.txt) { //得分辨,仅仅获取.txt,不包含".lua.txt" if (fileName.ToLower().EndsWith(".txt") && !fileName.ToLower().EndsWith(".lua.txt")) { mFiles_ChangeList.Add(fileName); } } else if (mFiles_FromExt == TinaX.Lua.LuaFileExten.lua_txt) { if (fileName.ToLower().EndsWith(".lua.txt")) { mFiles_ChangeList.Add(fileName); } } else if (mFiles_FromExt == TinaX.Lua.LuaFileExten.lua) { if (fileName.ToLower().EndsWith(".lua")) { mFiles_ChangeList.Add(fileName); } } } mFiles_CurRefreshExt = mFiles_FromExt; } files_Scroll = GUILayout.BeginScrollView(files_Scroll); if (mFiles_ChangeList.Count <= 0) { GUILayout.Label("没有符合条件的文件,请尝试刷新"); } else { foreach (var item in mFiles_ChangeList) { GUILayout.BeginHorizontal(); GUILayout.Label(item); if (GUILayout.Button("[移除]", GUILayout.MaxWidth(80))) { mFiles_ChangeList.Remove(item); break; } GUILayout.EndHorizontal(); } } GUILayout.EndScrollView(); if (mFiles_ChangeList.Count > 0) { if (GUILayout.Button("开始替换")) { if (mFiles_CurRefreshExt != mFiles_FromExt) { EditorUtility.DisplayDialog("错误", "需要再刷新一次列表", "好"); return; } //开始替换 foreach (var item in mFiles_ChangeList) { Debug.Log("改名:" + item + " -> " + System.IO.Path.GetFileName(item).Replace(Enum2Str(mFiles_FromExt), Enum2Str(mFiles_ToExt))); AssetDatabase.RenameAsset(item, System.IO.Path.GetFileName(item).Replace(Enum2Str(mFiles_FromExt), Enum2Str(mFiles_ToExt))); } } } GUILayout.EndVertical(); }