コード例 #1
0
 public static void UserSave(string data)
 {
     if (liveViewerTools.SaveDatString(data, LiveViewerTools.PrefDataPath))
     {
     }
     else
     {
         PopUI.ShowMessage(LogType.Error, "保存失败,可能是权限不足");
     }
 }
コード例 #2
0
    IEnumerator Start()
    {
        buttonList[0].onClick.AddListener(OnOpenPlayer);
        buttonList[1].onClick.AddListener(OnOpenModel);

        PopUI.ShowMessage(LogType.Log, "读取文件中");
        yield return(new WaitForSeconds(0.1f));

        liveViewerTools.CopyFiles();
    }
コード例 #3
0
 private void OnSaveButton()
 {
     try
     {
         OnSave(input.text);
         Hide();
     }
     catch (Exception e)
     {
         PopUI.ShowMessage(LogType.Exception, e.Message);
     }
 }
コード例 #4
0
 public static string UserLoad()
 {
     try
     {
         return(liveViewerTools.ReadDatString(LiveViewerTools.PrefDataPath));
     }
     catch (Exception e)
     {
         Debug.LogException(e);
         PopUI.ShowMessage(LogType.Error, "读取失败,可能是权限不足");
         return(null);
     }
 }
コード例 #5
0
 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);
 }
コード例 #6
0
    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, "请开启文件权限");
        }
    }
コード例 #7
0
 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权限或文件不存在");
     }
 }
コード例 #8
0
    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);
    }
コード例 #9
0
    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权限或文件不存在");
        //}
    }