public void JsonReadFrom(JSON.ANode node, string outerName = "") { JSON.Class userParArr = node[STR_User_params].AsClass; var paramsNodes = userParArr.GetNamesOfAllChildren(); foreach (string item in paramsNodes) { Localization.Add(item, userParArr[item]); } JSON.Array picArr = node[STR_Pictures].AsArray; int counter = 0; foreach (JSON.ANode item in picArr) { Picture newPic = new Picture(item, counter++); AllProducts.Add(newPic.Id, newPic); } }
public void JsonReadFrom(JSON.ANode node, string outerName = "") { Id = node[STR_Id].AsInt; SizeX = node[STR_Size_x].AsFloat; SizeY = node[STR_Size_y].AsFloat; JSON.TryReadString(node, ref Description, STR_Description); JSON.TryReadString(node, ref MainPictureStr, STR_Main_Name); JSON.TryReadString(node, ref PreviewPictureStr, STR_Preview_Name); JSON.TryReadBool(node, ref IsNew, STR_Is_new); JSON.Class userParNode = node[STR_User_params].AsClass; var properties = userParNode.GetNamesOfAllChildren(); foreach (string item in properties) { UserParams.Add(Config.Localization[item], userParNode[item]); } MainPicture = Resources.Load <Sprite>(MainPictureStr); if (MainPicture == null) { Debug.Log("No main image " + MainPictureStr); } PreviewPicture = Resources.Load <Sprite>(PreviewPictureStr); }