public static void UserSave(string data) { if (liveViewerTools.SaveDatString(data, LiveViewerTools.PrefDataPath)) { } else { PopUI.ShowMessage(LogType.Error, "保存失败,可能是权限不足"); } }
IEnumerator Start() { buttonList[0].onClick.AddListener(OnOpenPlayer); buttonList[1].onClick.AddListener(OnOpenModel); PopUI.ShowMessage(LogType.Log, "读取文件中"); yield return(new WaitForSeconds(0.1f)); liveViewerTools.CopyFiles(); }
private void OnSaveButton() { try { OnSave(input.text); Hide(); } catch (Exception e) { PopUI.ShowMessage(LogType.Exception, e.Message); } }
public static string UserLoad() { try { return(liveViewerTools.ReadDatString(LiveViewerTools.PrefDataPath)); } catch (Exception e) { Debug.LogException(e); PopUI.ShowMessage(LogType.Error, "读取失败,可能是权限不足"); return(null); } }
private bool CheckSaveModel(string text, string path) { try { var obj = JsonConvert.DeserializeObject(text); Program.liveViewerTools.SaveDatString(text, path); return(true); } catch (Exception e) { PopUI.ShowMessage(LogType.Exception, e.Message); } return(false); }
public void OnOpenModel() { if (FileBrowser.CheckPermission() == FileBrowser.Permission.Granted) { #if UNITY_EDITOR Directory.CreateDirectory(LiveViewerTools.EXT_PRESISTDATA_PATH); #endif FileBrowser.ShowLoadDialog(OnFileOpenSuccess, () => { }, false, LiveViewerTools.EXT_PRESISTDATA_PATH + "/save"); } else { PopUI.ShowMessage(LogType.Error, "请开启文件权限"); } }
public void OnOpenPlayer() { if (Program.UserCheck()) { PrefData player = Program.UserLoad(); if (player == null) { PopUI.ShowMessage(LogType.Error, "读取失败"); } string data = JsonConvert.SerializeObject(player); data = LiveViewerTools.ConvertJsonString(data); EditorUi.SetText(data); EditorUi.OnSave = OnUserSave; } else { PopUI.ShowMessage(LogType.Error, "没有Root权限或文件不存在"); } }
private bool OnUserSave(string arg) { PrefData player; try { player = JsonConvert.DeserializeObject <PrefData>(arg); } catch (Exception e) { PopUI.ShowMessage(LogType.Exception, e.Message); return(false); } if (player != null) { return(Program.UserSave(player)); } return(false); }
public void OnOpenPlayer() { //liveViewerTools.CopyFiles(); //if (UserCheck()) //{ string data = UserLoad(); if (data == null) { PopUI.ShowMessage(LogType.Error, "读取失败"); return; } //data = LiveViewerTools.PrittyJsonString(data); EditorUi.SetText(data); EditorUi.OnSave = UserSave; //} //else //{ // PopUI.ShowMessage(LogType.Error, "没有Root权限或文件不存在"); //} }