IEnumerator Purchase(FlatUpdateData updatedata, PurchasedLand Land) { CoroutineWithData cd = new CoroutineWithData(DownloadContent.Instance, DownloadContent.Instance.UpdateFlat(updatedata)); yield return(cd.coroutine); if (cd.result.ToString() == "True" || cd.result.ToString() == "true") { ScreenAndPopupCall.Instance.CloseScreen(); ScreenManager.Instance.ClosePopup(); CreateConstructionFlat(Land); GameManager.Instance.GetComponent <Tutorial> ().LandPurchasing(); // CheckForDuplicateBanners (); } }
public void PurchaseWhenClick(PurchasedLand Land) { RemoveMessage(); // if (RoomPurchaseManager.Instance.selectedBanner && RoomPurchaseManager.Instance.selectedBanner.isPurchased) { var updatedata = new FlatUpdateData(); updatedata.player_id = PlayerPrefs.GetInt("PlayerId"); updatedata.position = Land.x.ToString() + "-" + Land.y.ToString(); updatedata.wall_texture = "Default"; updatedata.ground_texture = "Default"; foreach (var item in DownloadContent.Instance.downloaded_items) { if (item.Category == "Expansion" && item.SubCategory == "Rooms") { updatedata.item_id = item.Item_id; } } StartCoroutine(Purchase(updatedata, Land)); // } }
public void CreateConstructionFlat(PurchasedLand Land) { PurchasedArea++; GameObject flateArea = (GameObject)Instantiate(ConstructionPrefeb, Land.transform.position, Quaternion.identity); // flateArea.name = "Room " + PurchasedArea; flateArea.transform.parent = FlatPurchasedAreaContainer.transform; flateArea.name = "" + Land.x + "-" + Land.y; flateArea.GetComponent <ConstructionTimer> ().StartCountDownTimer(30f, flateArea.name, Land.x, Land.y); //GameManager.Instance.flats.Add (FlatInfoData [flateNo]); PurchasedLands.Remove(Land); Destroy(Land.gameObject); if (PlayerPrefs.GetInt("Tutorial_Progress") >= 26) { AchievementsManager.Instance.CheckAchievementsToUpdate("flatsUpgrade"); } }
// public IEnumerator CreateConstructionFlatOnStart (string wall_texture, string ground_texture) // { // PurchasedArea++; // if (selectedBanner && selectedBanner.isPurchased) { // // GameObject flateArea = (GameObject)Instantiate (ConstructionPrefeb, selectedBanner.transform.position, Quaternion.identity); // flateArea.transform.parent = FlatPurchasedAreaContainer.transform; // flateArea.name = "" + selectedBanner.x + "-" + selectedBanner.y; // flateArea.GetComponent<ConstructionTimer> ().StartCountDownTimer (0f, flateArea.name); // // GameObject Go = Instantiate (purchaseLandPrefab, selectedBanner.transform.position, Quaternion.identity)as GameObject; // purchaseLands.Add (Go); //// flateArea.GetComponent<ConstructionTimer> ().StartCountDownTimer (0f, flateArea.name); // // yield return new WaitForSeconds (0.1f); // //GameManager.Instance.flats.Add (FlatInfoData [flateNo]); // // SaleBanners.Remove (selectedBanner); // Destroy (selectedBanner.gameObject); // yield return new WaitForSeconds (0.1f); // ApplyTextures (wall_texture, ground_texture); // } // } public IEnumerator CreateConstructionFlatOnStart(string wall_texture, string ground_texture, PurchasedLand Land) { PurchasedArea++; if (Land) { GameObject flateArea = (GameObject)Instantiate(ConstructionPrefeb, Land.transform.position, Quaternion.identity); flateArea.transform.parent = FlatPurchasedAreaContainer.transform; flateArea.name = "" + Land.x + "-" + Land.y; string flatName = flateArea.name; flateArea.GetComponent <ConstructionTimer> ().StartCountDownTimer(0f, flateArea.name, Land.x, Land.y); // GameObject Go = Instantiate (purchaseLandPrefab, Land.transform.position, Quaternion.identity)as GameObject; // purchaseLands.Add (Go); yield return(new WaitForSeconds(0.1f)); //GameManager.Instance.flats.Add (FlatInfoData [flateNo]); PurchasedLands.Remove(Land); Destroy(Land.gameObject); yield return(new WaitForSeconds(0.1f)); ApplyTextures(flatName, wall_texture, ground_texture); } }