public void CallbackPreview(bool bo) { if (bo) { if (coin >= price)//check coin { PopupWaiting(); avatarPreview.SetActive(false); previewObj.SetActive(false); SaveSystem.A_MinusCoin(price); if (furnitureData != null) { SaveSystem.A_AddFurniture(furnitureData.id, furnitureData.type); //List<Furniture> furnitures = SaveSystem.A_LoadFurniture(); //var furCount = from f in furnitures // where f.id == furnitureData.id && f.type == furnitureData.type // select f; string ttt = furnitureData.transform.GetChild(2).GetComponent <Text>().text; if (ttt == "") { ttt = "0"; } int count = int.Parse(ttt); count += 1; furnitureData.transform.GetChild(2).GetComponent <Text>().text = count.ToString(); if (furnitureData.type == (int)FurnitureType.Wallpaper || furnitureData.type == (int)FurnitureType.Floor) { furnitureData.gameObject.GetComponentInChildren <Button>().interactable = false; } } else if (clothesData != null) { SaveSystem.A_AddClothes(clothesData.id, clothesData.type); clothesData.count++; clothesData.transform.GetChild(2).GetComponent <Text>().text = clothesData.count.ToString(); } else if (foodData != null) { SaveSystem.A_AddFood(foodData.id); foodData.count++; foodData.transform.GetChild(2).GetComponent <Text>().text = foodData.count.ToString(); } else { Debug.Log("Can not add the item"); } furnitureData = null; clothesData = null; } else { Popup.Ins.PopupOne("Not enough money", "OK", null); } } else { avatarPreview.SetActive(false); previewObj.SetActive(false); } }