public static void func() { Dictionary <string, BVT_DATA> dic = new Dictionary <string, BVT_DATA>(); BVT_DATA temp1 = new BVT_DATA(); temp1.ID = "id"; temp1.DataList = new List <OTHER_DATA>(); temp1.DataList.Add(new OTHER_DATA()); temp1.DataDic = new Dictionary <string, OTHER_DATA>(); temp1.DataDic.Add("key1", new OTHER_DATA()); dic.Add("key0", temp1); //step 1. string json = NWJson.ToJson(dic);//이렇게 사용하면 된다. Debug.LogError(json); //step 2. Dictionary <string, BVT_DATA> dic2 = NWJson.FromJsonToDictionary <string, BVT_DATA>(json);//이렇게 사용하면 된다. foreach (KeyValuePair <string, BVT_DATA> kv in dic2) { Debug.LogError("key : " + kv.Key + ", value : " + kv.Value.ID); } //step 3. string json2 = NWJson.ToJson(dic2); Debug.LogError(json2); }
public override bool SetContent(string json) { try { this._contDic = NWJson.FromJsonToDictionary <string, CharectorInfoForTest>(json); } catch { Debug.LogError(ERR_MSG[NW_UI_ERROR_TYPE.JSON_TO_DICTIONARY_PARSING_ERROR]); return(false); } return(this._contDic != null); }
private void process_EachFolder(string manifestFileName) { string assetPath = Path.Combine(userImportAssetPath, manifestFileName); Debug.Log("process_EachFolder path : " + manifestFileName); //step 1. 각각의 에셋 폴더 하위에는 해당 폴더이름과 동일한 매니패스트 파일이 있다. 이 파일을 읽는다. string json = File.ReadAllText(Path.Combine(assetPath, manifestFileName + ".json")); Debug.Log("User Import Asset Folder manifest loaded. " + json); Dictionary <string, Dictionary <string, string> > manifestDic = NWJson.FromJsonToDictionary <string, Dictionary <string, string> >(json); Dictionary <string, string> tempDic; //step 2. 해당 에셋의 매니페스트가 명시하고 있는 텍스쳐 에셋을 userImportTextureDic에 넣는다. try { tempDic = manifestDic["Texture"]; foreach (KeyValuePair <string, string> kv in tempDic) { if (!this.tempTextureDic.ContainsKey(kv.Key)) { this.tempTextureDic.Add(kv.Key, new List <UserImportAssetInfo>()); } this.tempTextureDic[kv.Key].Add(new UserImportAssetInfo(manifestFileName, WWWLoadUserImportAsset(kv.Key, Path.Combine(assetPath, kv.Value), UserImportAssetType.Texture2D) as Texture2D)); } } catch { Debug.LogWarning("There is no Texture in this asset : " + manifestFileName); } //step 3. 해당 에셋의 매니페스트가 명시하고 있는 사운드 에셋을 userImportAudioClipDic에 넣는다. try { tempDic = manifestDic["AudioClip"]; foreach (KeyValuePair <string, string> kv in tempDic) { if (!this.tempAudioClipDic.ContainsKey(kv.Key)) { this.tempAudioClipDic.Add(kv.Key, new List <UserImportAssetInfo>()); } this.tempAudioClipDic[kv.Key].Add(new UserImportAssetInfo(manifestFileName, WWWLoadUserImportAsset(kv.Key, Path.Combine(assetPath, kv.Value), UserImportAssetType.AudioClip) as AudioClip)); } } catch { Debug.LogWarning("There is no AudioClip in this asset : " + manifestFileName); } }