예제 #1
0
        public static string Serialize(object value, object context = null)
        {
            JsonSerializer.Clear();
            Hashtable hashtable = JsonSerializer.SerializeObject(value, context) as Hashtable;

            hashtable[STR_CLS_TABLE] = JsonSerializer.classTypeTable;
            return(MiniJson.JsonEncode(hashtable));
        }
예제 #2
0
        public void Save()
        {
            refIdHashtable.Clear();
            Hashtable dict = new Hashtable();

            dict["child_list"] = GetSave_ChildList(this.transform);
            string content  = MiniJson.JsonEncode(dict);
            string filePath = textAsset.GetAssetPath().WithRootPath(FilePathConst.ProjectPath);

            StdioUtil.WriteTextFile(filePath, content);
            AssetPathRefManager.instance.Save();
            AssetDatabase.Refresh();
            LogCat.log("保存完成");
        }
예제 #3
0
        private void SaveUser()
        {
            User      user        = Client.instance.user;
            Hashtable dictUser    = new Hashtable();
            Hashtable dictUserTmp = new Hashtable();

            user.DoSave(dictUser, dictUserTmp);
            string userId = user.GetId();


            Hashtable saveData = new Hashtable();

            saveData["dict_user"]     = dictUser;
            saveData["dict_user_tmp"] = dictUserTmp;
            saveData["user_id"]       = userId;

            var content      = MiniJson.JsonEncode(saveData);
            var contentBytes = Encoding.UTF8.GetBytes(content);

            //contentBytes = CompressUtil.GZipCompress(contentBytes);//ѹËõ
            StdioUtil.WriteFile(filePath, contentBytes);
        }
예제 #4
0
        public void Save()
        {
            Refresh();
            Hashtable jsonDict = new Hashtable();

            jsonDict["ref_id"] = refId;
            ArrayList assetPathRefList = new ArrayList();

            foreach (var keyValue in dict)
            {
                var       assetPathRef     = keyValue.Value;
                Hashtable assetPathRefDict = new Hashtable();
                assetPathRefDict["ref_id"]    = assetPathRef.refId;
                assetPathRefDict["assetPath"] = assetPathRef.assetPath;
                assetPathRefDict["guid"]      = assetPathRef.guid;
                assetPathRefList.Add(assetPathRefDict);
            }

            jsonDict["assetPathRef_list"] = assetPathRefList;
            string contentJson = MiniJson.JsonEncode(jsonDict);

            StdioUtil.WriteTextFile(AssetPathRefConst.SaveFilePath.WithRootPath(FilePathConst.ProjectPath), contentJson);
        }