private void SetInfo(FileObject fileObject) { playerGestureDatas.Clear(); string json = ASCIIEncoding.UTF8.GetString(fileObject.Buffet); if (JsonCheckTool.IsJson(json)) { playerGestureDatas = Newtonsoft.Json.JsonConvert.DeserializeObject <List <PlayerGestureData> >(json); } if (isOpenSetGesturePanel) { Canvas canvas = new GameObject("[SetCanvas]").AddComponent <Canvas>(); GameObject.DontDestroyOnLoad(canvas.gameObject); canvas.renderMode = RenderMode.ScreenSpaceOverlay; canvas.gameObject.AddComponent <CanvasScaler>(); canvas.gameObject.AddComponent <GraphicRaycaster>(); canvas.sortingOrder = 100; if (!FindObjectOfType <EventSystem>()) { EventSystem eventSystem = new GameObject("EventSystem").AddComponent <EventSystem>(); eventSystem.gameObject.AddComponent <StandaloneInputModule>(); } SourcesManager.LoadSources <SetGesturePanel>("SetGesturePanel", canvas.transform); } }
/// <summary> /// byte加密写入 /// </summary> /// <param name="path"></param> /// <param name="data"></param> protected override void ByteEncryption_Write(string path, byte[] data) { string str = Encoding.UTF8.GetString(data); if (!JsonCheckTool.IsJson(str)) { Debug.Log("写入失败400:数据不是json:" + str); return; } base.ByteEncryption_Write(path, data); }
/// <summary> /// 无加密读取 /// </summary> /// <param name="path"></param> /// <returns></returns> protected override byte[] None_Read(string path) { byte[] buff = base.None_Read(path); if (buff == null) { return(buff); } string str = Encoding.UTF8.GetString(buff); if (!JsonCheckTool.IsJson(str)) { Debug.Log("读取失败400:数据不是json:" + str); return(null); } return(buff); }