void SaveFile(bool showSaveTemp, string extension) { string path = ConfigUtility.persistentDataPath + "/" + editor.getTrackMap.header.Title + extension; editor.debugLog.Log("執行動作:在以下路徑儲存檔案:"); editor.debugLog.Log(path); if (File.Exists(path + TrackMap.extension)) { path += "_" + System.DateTime.Now.ToString("hh-mm-ss-yyyy-M-d"); } path += TrackMap.extension; string json = editor.getTrackMap.ToJson(); File.WriteAllText(path, json); //editor.debugLog.Log (json); manager.cacheFilePath = path; #if UNITY_STANDALONE_WIN || UNITY_EDITOR if (File.Exists(path) && showSaveTemp) { System.Diagnostics.Process.Start("explorer.exe", "/select," + path.Replace("/", "\\")); } #else //editor.debugLog.Log("此功能尚未在手機平台開放"); if (File.Exists(path) && showSaveTemp) { AndroidTool.MakeToast("儲存檔案成功 " + path); } #endif }
// Update is called once per frame void Update() { timeOutTimer -= Time.deltaTime; if (timeOutTimer < 0) { timeOutTimer = 0; } if (Input.GetKeyDown(KeyCode.Escape)) { if (timeOutTimer > 0) { SceneManager.LoadScene(scene_TouchStart_name); } else { timeOutTimer = timeOut; if (Application.platform == RuntimePlatform.Android) { AndroidTool.MakeToast("再按一次回到開始畫面"); } else { debugLog.Log("再按一次回到開始畫面"); } } } }
private static bool IsAndroidSupportedInternal() { try { AndroidTool.ValidateEnvironmentSettings(); return(!string.IsNullOrEmpty(SdkManager.ToolPath)); } catch { return(false); } }
// Update is called once per frame void Update() { timeOutTimer -= Time.deltaTime; if (timeOutTimer < 0) { timeOutTimer = 0; } if (Input.GetKeyDown(KeyCode.Escape)) { if (timeOutTimer > 0) { SceneManager.LoadScene(scene_TouchStart_name); } else { timeOutTimer = timeOut; if (Application.platform == RuntimePlatform.Android) { AndroidTool.MakeToast("再按一次回到開始畫面"); } else { Debug.Log("再按一次回到開始畫面"); } } } if (AudioClipPlayer.mode == AudioClipPlayer.PlayMode.none) { text_AudioProgress.text = string.Empty; } else { text_AudioProgress.text = string.Format("{0}:{1} / {2}:{3}", AudioClipPlayer.state.currectInstanceMinutes.ToString("00"), AudioClipPlayer.state.currectInstanceSeconds.ToString("00"), AudioClipPlayer.state.totalInstanceMinutes.ToString("00"), AudioClipPlayer.state.totalInstanceSeconds.ToString("00")); } }
void Clear() { DirectoryInfo directory = new DirectoryInfo(ConfigUtility.temporaryPath); //delete files: foreach (FileInfo file in directory.GetFiles()) { file.Delete(); } //delete directories in this directory: //print(directory.Name); foreach (DirectoryInfo subDirectory in directory.GetDirectories()) { //print(subDirectory.Name +" "+ directory.Name); subDirectory.Delete(true); } print("已清除所有暫存資料"); if (Application.platform == RuntimePlatform.Android) { AndroidTool.MakeToast("已清除所有暫存資料"); } }
public void callback(string result) { AndroidTool.MakeToast("路徑:" + result); }
//TODO:更新Log列表, MassageList , ExceptionList public void onExport() { SaveFile(false, "_export_save_"); string RctFilePath = manager.cacheFilePath; string BackgroundFilePath = editor.getTrackMap.header.BackgroundFileFullName; string AudioFilePath = editor.getTrackMap.header.AudioFileFullName; if (!editor.audioPlayer.hasAudioClip) { editor.debugLog.LogWarning("找不到音訊檔案 , 無法輸出"); return; } else if (string.IsNullOrEmpty(editor.getTrackMap.header.Title)) { editor.debugLog.LogWarning("沒有輸入檔案標題 , 無法輸出"); return; } else if (string.IsNullOrEmpty(editor.getTrackMap.header.Artist)) { editor.debugLog.LogWarning("沒有輸入創作者名稱 , 無法輸出"); return; } else if (editor.getTrackMap.Notes.Count <= 0) { editor.debugLog.LogWarning("找不到任何編輯的音符 , 無法輸出"); return; } else if (string.IsNullOrEmpty(AudioFilePath) || !File.Exists(AudioFilePath)) { editor.debugLog.LogWarning("音訊檔路徑遺失 : " + AudioFilePath + ",無法輸出"); return; } List <string> outputFiles = new List <string>(); if (string.IsNullOrEmpty(RctFilePath)) { this.onSaveFile(); } outputFiles.Add(RctFilePath); outputFiles.Add(AudioFilePath); if (!string.IsNullOrEmpty(BackgroundFilePath)) { if (!File.Exists(BackgroundFilePath)) { editor.debugLog.LogWarning("背景圖檔路徑遺失 : " + BackgroundFilePath); } else { outputFiles.Add(BackgroundFilePath); } } string outputPath = ConfigUtility.persistentDataPath + "/" + editor.getTrackMap.header.Title + "(" + editor.getTrackMap.header.Artist + ")"; if (File.Exists(Path.ChangeExtension(outputPath, GameMap.extension))) { outputPath += "_" + System.DateTime.Now.ToString("hh-mm-ss-yyyy-M-d"); } outputPath = Path.ChangeExtension(outputPath, GameMap.extension); try{ ZipUtil.Zip(outputPath, outputFiles.ToArray()); }catch (Exception e) { editor.debugLog.LogWarning("檔案:" + outputPath + ",輸出失敗" + "\n" + e.ToString()); return; } editor.debugLog.Log("檔案:" + outputPath + ",輸出成功"); #if UNITY_STANDALONE_WIN || UNITY_EDITOR if (File.Exists(outputPath)) { System.Diagnostics.Process.Start("explorer.exe", "/select," + outputPath.Replace("/", "\\")); } #else if (File.Exists(outputPath)) { AndroidTool.MakeToast("輸出檔案成功 " + outputPath); } #endif }
public void onSaveAsFile() { editor.debugLog.Log("此功能尚未開放"); AndroidTool.MakeToast("此功能尚未開放"); }
public void LocatesCliTool(string toolName) { var path = AndroidTool.LocateUtility(toolName); Assert.False(string.IsNullOrEmpty(path)); }