// Update the prices when an item is bought with virtual currency in the store public void OnGoodBalanceChanged(VirtualGood vg, int balance, int amountAdded) { GameObject temp_1 = GameObject.Find("store_ui_gr"); if (temp_1 != null) { store_manager_script = temp_1.GetComponent <SOAPStoreManager>(); } string avatar_id = vg.ItemId; // To prevent erroring out when an item is bought with real money // (store manager will attempt to look up "soap_soap_" without this check and fail) if (avatar_id.Contains("soap_")) { avatar_id = avatar_id.Replace("soap_", ""); } // Unlock achievement for buying an avatar or tail with virtual currency #if UNITY_ANDROID if (avatar_id.Contains("avatar")) { store_manager_script.updatePrices(avatar_id); Achievements.massiveFacialReconstructionAchievement(); } else if (avatar_id.Contains("tail")) { store_manager_script.updatePrices(avatar_id); Achievements.sheddingSeasonAchievement(); } #endif }
// Change the currency balance text when the balance changed public void OnCurrencyBalanceChanged(VirtualCurrency vc, int balance, int amountAdded) { GameObject temp_1 = GameObject.Find("store_ui_gr"); if (temp_1 != null) { store_manager_script = temp_1.GetComponent <SOAPStoreManager>(); } store_manager_script.setStoreCoinText(); store_manager_script.setGameOverCoinText(); store_manager_script.setPauseCoinText(); // Unlock achievement for accumulating coins #if UNITY_ANDROID if (balance >= 20000 && balance < 100000) { Achievements.forARainyDayAchievement(); } if (balance > 100000) { Achievements.mustHaveThemAllAchievement(); } #endif }
void Start() { grid = GetComponent <GridLayoutGroup>(); rect = GetComponent <RectTransform>(); scrollRect = GetComponentInParent <ScrollRect>(); GameObject temp_1 = GameObject.Find("store_ui_gr"); if (temp_1 != null) { store_manager_script = temp_1.GetComponent <SOAPStoreManager>(); } GameObject temp_2 = GameObject.Find("avatar_swap_script"); if (temp_2 != null) { avatar_swap_script = temp_2.GetComponent <AvatarTailSwap>(); } // auto adjust the width of the grid to have space for all the childs //rect.sizeDelta = new Vector2((transform.childCount + 2f) * grid.cellSize.x + (transform.childCount - 1f) * grid.spacing.x, rect.sizeDelta.y); //rect.sizeDelta = new Vector2((transform.childCount + 5f) * grid.cellSize.x + (transform.childCount - 0f) * grid.spacing.x, rect.sizeDelta.y); rect.sizeDelta = new Vector2((transform.childCount - 7) * grid.cellSize.x, rect.sizeDelta.y); }
// Update the prices when an item is bought with real money in the store public void onItemPurchased(PurchasableVirtualItem pvi, string payload) { GameObject temp_1 = GameObject.Find("store_ui_gr"); if (temp_1 != null) { store_manager_script = temp_1.GetComponent<SOAPStoreManager>(); } string avatar_id = pvi.ItemId; // To prevent erroring out when an item is bought with real money // (store manager will attempt to look up "soap_soap_" without this check and fail) if (avatar_id.Contains("soap_")) { avatar_id = avatar_id.Replace("soap_", ""); } // Unlock achievement for buying an avatar or tail with real money #if UNITY_ANDROID unlockStoreAchievements(avatar_id) #endif // Give rocketman avatar and tail for removing ads if (avatar_id == "soap_no_ads") { RewardedAvatars.incrementAvatarBalance(RewardedAvatars.rocketman_avatar_rwd); RewardedAvatars.incrementAvatarBalance(RewardedAvatars.rocketman_tail_rwd); } }
// Use this for initialization void Start() { GameObject temp_1 = GameObject.Find("UI_canvas"); if (temp_1 != null) { ui_manager_script = temp_1.GetComponent <UIManager>(); } GameObject temp_2 = GameObject.Find("store_ui_gr"); if (temp_2 != null) { store_manager_script = temp_2.GetComponent <SOAPStoreManager>(); } GameObject temp_3 = GameObject.Find("audio_controller"); if (temp_3 != null) { sound_manager_script = temp_3.GetComponent <SoundManager>(); } game_cam_ref = Camera.main; challenge_room_camera = game_cam_ref.GetComponent <CameraController>(); player_death_particle_ref = GameObject.Find("player_death_particle"); player_death_particle = player_death_particle_ref.gameObject.GetComponent <ParticleSystem>(); player_death_mat = player_death_particle.GetComponent <ParticleSystemRenderer>().material; }
private bool from_sync; // Determines whether the toggle switch is from syncing toggle function // Get reference to store manager and don't destroy the UI gameobject void Start() { DontDestroyOnLoad(this.gameObject); store_manager_script = store_menu.GetComponentInParent <SOAPStoreManager>(); cbads_script = game_over_menu.GetComponentInParent <CBAds>(); point_manager_script = this.GetComponent <PointManager>(); game_screen_grow_counter_text = GameObject.Find("game_screen_grow_counter_txt"); setGrowCounterState(false); // Create control type key if it doesn't exist bool control_type_exists = PlayerPrefs.HasKey("ControlType"); if (!control_type_exists) { PlayerPrefs.SetString("ControlType", TouchInput.swipe_control); } // Toogle the control type in the option screen syncToggle(); }