private void Save() { var data = MyMsgPacker.Pack(this.dataHash); File.WriteAllBytes(saveDataPath, data); Debug.Log("saved"); hasChanged = false; }
private IEnumerator SaveDataCo(System.Action callback) { var savedatahash = new Hashtable(); savedatahash.Add(KEY_PLAYER_DATA, PlayerManager.Instance.GetPlayerDataHash()); var databytes = MyMsgPacker.Pack(savedatahash); File.WriteAllBytes(SaveFilePath, databytes); Debug.Log("===save " + SaveFilePath); yield return(0); if (callback != null) { callback.Invoke(); } }
private void Test() { var ttt = new int[100]; for (int i = 0; i < 100; i++) { ttt[i] = i; } var ttt2 = MyMsgPacker.Pack(ttt); var ttt3 = MyMsgPacker.Unpack(ttt2); Debug.Log(ttt3.GetType() + " "); // var aa = new Hashtable(); // aa.Add("a1", 1); // aa.Add("b1", "bb"); // aa.Add("c1", 3); // var a = MyMsgPacker.Pack(aa); // var b = MyMsgPacker.Unpack(a); // Debug.Log(b + " " + b.GetType()); // var h = (Hashtable) b; // Debug.Log(h["a1"] + " " + h["b1"] + " " + h["c1"]); }
public void SaveMapData(string filepath) { Debug.Log("save map"); byte[] data = MyMsgPacker.Pack(GetMapSaveData()); File.WriteAllBytes(filepath, data); }