public void BuyButton() { AudioControl.DPlaySound("Click 1"); if (VariableSystem.diamond >= price && price != 0) { VariableSystem.AddDiamond(-price); GoogleAnalytics.instance.LogScreen("Buy ShopItem: " + vi_detail[IdItem - 1]); gridView.FindChild("" + IdItem).GetComponent <ItemShop>().Price = price; gridView.FindChild("" + IdItem).GetComponent <ItemShop>().SetBuy(); Transform diamond = Instantiate(SubDiamond) as Transform; diamond.parent = this.transform; diamond.position = btBuy.position; diamond.localScale = new Vector3(1, 1, 1); diamond.FindChild("Count").GetComponent <UILabel>().text = "-" + price; LeanTween.moveLocalY(diamond.gameObject, diamond.position.y - 300, 0.5f).setEase(LeanTweenType.easeOutSine).setOnComplete(delegate() { Destroy(diamond.gameObject); }); } else { Debug.Log("Thieu tien roi"); DialogInapp.ShowInapp(); } }
public void ButtonGet() { bool[] dataDailyGift = PlayerPrefsX.GetBoolArray(DialogDailyGift.key_data_daily_gift); dataDailyGift[id - 1] = true; //Luu lai PlayerPrefsX.SetBoolArray(DialogDailyGift.key_data_daily_gift, dataDailyGift); SetData(true); switch (id) { case 1: default: VariableSystem.AddDiamond(1); break; case 2: //super seed DialogShop.BoughtItem[0] = true; break; case 3: //amazing machine DialogShop.BoughtItem[2] = true; break; case 4: VariableSystem.AddDiamond(2); break; case 5: //radio DialogShop.BoughtItem[4] = true; break; case 6: //save money DialogShop.BoughtItem[5] = true; break; case 7: //super hand DialogShop.BoughtItem[3] = true; break; case 8: VariableSystem.AddDiamond(4); break; case 9: //fill rate meter MissionPowerUp.FillRateMeter = true; break; case 10: //price drop MissionPowerUp.PriceDrop = true; break; case 11: //More time MissionPowerUp.MoreTime = true; break; case 12: VariableSystem.AddDiamond(8); break; } }
public void BuyButton() { if (VariableSystem.diamond >= price && price != 0) { VariableSystem.AddDiamond(-price); GoogleAnalytics.instance.LogScreen("Buy PowerUpItem: " + IdItem); transform.FindChild("Table").FindChild("Item" + IdItem).GetComponent <ItemPowerUp>().Price = price; transform.FindChild("Table").FindChild("Item" + IdItem).GetComponent <ItemPowerUp>().SetBuy(); IdItem = 0; } else { DialogInapp.ShowInapp(); } }
private void purchaseSucceededEvent(Purchase purchase) { Debug.Log("purchaseSucceededEvent: " + purchase); _label = "PURCHASED:" + purchase.ToString(); int diamond = 10; switch (purchase.Sku) { case "package1": diamond = quatity[0]; break; case "package2": diamond = quatity[1]; break; case "package3": diamond = quatity[2]; break; case "package4": diamond = quatity[3]; break; case "package5": diamond = quatity[4]; break; case "package6": diamond = quatity[5]; break; default: break; } Debug.Log("------------------------purchase.Sku " + purchase.Sku + " diamond " + diamond); GoogleAnalytics.instance.LogScreen("Buy Inapp: " + diamond + " diamonds!"); VariableSystem.AddDiamond(diamond); //Consume purchase OpenIAB.consumeProduct(purchase); #if UNITY_ANDROID MobilePlugin.getInstance().ShowToast("Purchase success! You have got " + diamond); #endif }
public void ButtonRefill() { Debug.Log("Button refill"); Transform confirm = Instantiate(DialogConfirm) as Transform; confirm.parent = transform; HideDialog(); confirm.GetComponent <DialogConfirm>().ShowDialog(MissionControl.Language["Refill"], MissionControl.Language["refill_heart"], () => { if (VariableSystem.diamond >= 3) { VariableSystem.AddDiamond(-3); AudioControl.AddHeart(5 - VariableSystem.heart); } else { DialogInapp.ShowInapp(); } }); }
public void getGift() { if (timer.CompareTo(timer82) < 0) { VariableSystem.AddDiamond(50);//add kim cương } else { VariableSystem.AddDiamond(10); //add kim cương } if (timer.DayOfWeek.Equals(DayOfWeek.Saturday)) { PlayerPrefs.SetString("SpecicalGift_Weeken", (timer.Day + 2) + "-" + timer.Month + "-" + timer.Year); } else { PlayerPrefs.SetString("SpecicalGift_Weeken", (timer.Day + 1) + "-" + timer.Month + "-" + timer.Year); } showGift = true; HideDialog(); }
public void SetData(int count, bool add = true) { if (add) { transform.FindChild("Count").GetComponent <UILabel>().text = "+" + count; LeanTween.moveLocalY(this.gameObject, transform.position.y + 120, 1f).setEase(LeanTweenType.easeOutCirc).setOnComplete(delegate() { Debug.Log(this.gameObject.name); Destroy(this.gameObject); }); VariableSystem.AddDiamond(count); } else { transform.FindChild("Count").GetComponent <UILabel>().text = "-" + count; LeanTween.moveLocalY(this.gameObject, transform.position.y - 120, 1f).setEase(LeanTweenType.easeOutCirc).setOnComplete(delegate() { Destroy(this.gameObject); }); VariableSystem.AddDiamond(-count); } }
public void Update() { time += Time.deltaTime; if (time > 5) { time = 0; if (!GetComponent <UIButton>().enabled) { GetComponent <UIButton>().enabled = true; } } if (Input.GetKeyDown(KeyCode.Escape)) { if (CommonObjectScript.isViewPoppup) { dialogLogin.GetComponent <DialogLogin>().HideDialog(() => { }); CommonObjectScript.isViewPoppup = false; } else { #if UNITY_ANDROID //Application.Quit(); MobilePlugin.getInstance().ShowExitConfirm(MissionControl.Language["Quit"], MissionControl.Language["Quit_detail"], MissionControl.Language["Ok"], MissionControl.Language["Cancel"]); #endif } } if (Input.GetKeyDown(KeyCode.X)) { print("Reset all data saved by PlayerPrefs"); PlayerPrefs.DeleteAll(); VariableSystem.AddDiamond(-(VariableSystem.diamond - 8)); } }
public void AddDiamond(int diamon) { VariableSystem.AddDiamond(diamon); }
public void Show() { Time.timeScale = 1.0f; MissionControl.ResetAllItem(); LoadingScene.HideLoadingScene(); CommonObjectScript.isViewPoppup = true; //Debug.Log("Show result ----------------------------------"); missionFail.localScale = new Vector3(8, 8, 1); missionFail.gameObject.SetActive(false); TweenAlpha.Begin(missionFail.gameObject, 0, 0); star = 0; if (DialogTask.complete) { star = 1; reward = MissionData.starMission.reward[0]; if (CommonObjectScript.dollar >= MissionData.starMission.twoStar) { reward = MissionData.starMission.reward[1]; star = 2; } if (CommonObjectScript.dollar >= MissionData.starMission.threeStar) { reward = MissionData.starMission.reward[2]; star = 3; } particleWin.gameObject.SetActive(true); ///////////------------------------------------------ AudioControl.getMonoBehaviour().StartCoroutine(DHS.PostMeCurrentMission(VariableSystem.mission + 1)); //Cong tim khi thang AudioControl.AddHeart(1); //Nhac thang AudioControl.DPlaySound("Thang"); } else { //Nhac thua AudioControl.DPlaySound("Thua"); } //star = 3;////////////////////////////////////////////////////// //particleWin.gameObject.SetActive(true); if (Application.loadedLevelName.Equals("Farm")) { GameObject.Find("UI Root").transform.FindChild("PanelPlant").GetComponent <PlantControlScript>().BG_Click(); } lbReward.text = "0"; //Test //VariableSystem.dollar = 1000; //Thay doi ngon ngu bgMain.FindChild("Target").GetComponent <UILabel>().text = "" + MissionControl.Language["Require"]; bgMain.FindChild("Score").GetComponent <UILabel>().text = "" + MissionControl.Language["Your_Score"]; bgMain.FindChild("Reward").GetComponent <UILabel>().text = "" + MissionControl.Language["Reward"]; bgMain.FindChild("Ok").FindChild("Label").GetComponent <UILabel>().text = "" + MissionControl.Language["Ok"]; bgMain.FindChild("TryAgain").FindChild("Label").GetComponent <UILabel>().text = "" + MissionControl.Language["Try_Again"]; bgMain.FindChild("RewardCustomer").GetComponent <UILabel>().text = "" + MissionControl.Language["Bonus_customer_rate"]; bgMain.FindChild("LbStar1").GetComponent <UILabel>().text = "" + MissionControl.Language["All_target"]; lbTitle.text = MissionControl.Language["MISSION"] + " " + VariableSystem.mission; bgMain.FindChild("LbStar2").GetComponent <UILabel>().text = DString.ConvertString(MissionData.starMission.twoStar); bgMain.FindChild("LbStar3").GetComponent <UILabel>().text = DString.ConvertString(MissionData.starMission.threeStar); bgMain.FindChild("Score").FindChild("Label").GetComponent <UILabel>().text = DString.ConvertString(CommonObjectScript.dollar); bgBlack.gameObject.SetActive(true); LeanTween.delayedCall(1.0f, () => { Time.timeScale = 0; }).setUseEstimatedTime(true); bgMain.gameObject.SetActive(true); LeanTween.scale(bgMain.gameObject, new Vector3(1, 1, 1), 0.4f).setUseEstimatedTime(true).setEase(LeanTweenType.easeOutBack).setOnComplete(() => { star1.localScale = new Vector3(8, 8, 8); star2.localScale = new Vector3(8, 8, 8); star3.localScale = new Vector3(8, 8, 8); //Dieu kien xet sao if (star > 0) { star1.gameObject.SetActive(true); LeanTween.scale(star1.gameObject, new Vector3(1, 1, 1), 0.5f).setUseEstimatedTime(true).setEase(LeanTweenType.easeOutExpo).setOnComplete(() => { //Check dieu kien de co sao thu 2 if (star > 1) { star2.gameObject.SetActive(true); LeanTween.scale(star2.gameObject, new Vector3(1, 1, 1), 0.5f).setUseEstimatedTime(true).setEase(LeanTweenType.easeOutExpo).setOnComplete(() => { //Check dieu kien de co sao thu 3 if (star > 2) { star3.gameObject.SetActive(true); LeanTween.scale(star3.gameObject, new Vector3(1, 1, 1), 0.5f).setUseEstimatedTime(true).setEase(LeanTweenType.easeOutExpo); } }); } }); } else { missionFail.gameObject.SetActive(true); LeanTween.scale(missionFail.gameObject, new Vector3(1, 1, 1), 0.5f).setUseEstimatedTime(true).setEase(LeanTweenType.easeInOutQuart); TweenAlpha.Begin(missionFail.gameObject, 0.5f, 1); } }); //Them task nhiem vu //if (VariableSystem.mission == 1) //{ // AddItemResult("" + MissionControl.Language["Control_guide"], true, null, false); //} foreach (Transform tf in dialogTask.FindChild("Grid").GetComponent <UIGrid>().GetChildList()) { AddItemResult(tf.GetComponent <ItemTask>().lbContent.text, tf.GetComponent <ItemTask>().togComplete.value, tf.GetComponent <ItemTask>().item, tf.GetComponent <ItemTask>().typeShow1); } grid.Reposition(); transform.FindChild("SpriteBlack").gameObject.SetActive(true); //An bang task khi hien thi result GameObject task = GameObject.Find("DialogTask").gameObject; if (task != null) { task.GetComponent <DialogTask>().HideButton(); } GameObject inapp = GameObject.Find("DialogInapp").gameObject; if (inapp != null) { inapp.GetComponent <DialogInapp>().HideDialog(); } //Cap nhat lai phan thuong - Neu so sao moi <= so sao hien tai => thuong 1 kim cuong if (star > 0 && star <= DataCache.dataMissionCache[VariableSystem.mission - 1].Star) { reward = 1; } VariableSystem.AddDiamond(reward); VariableSystem.AddDiamond(CommonObjectScript.rewardCustomerRate); Debug.Log("CONG KIM CUONG -------------------- reward " + reward + " CommonObjectScript.rewardCustomerRate " + CommonObjectScript.rewardCustomerRate); DataCache.UpdateMissionScore(CommonObjectScript.dollar, star, VariableSystem.mission, 1); bool sendToServer = false; if (star > 0) { if (VariableSystem.mission < DataMissionControlNew.MAX_MISSION) { DataCache.SetMeCurrentMission(VariableSystem.mission + 1); } sendToServer = true; } DataCache.SaveMissionDataCache(sendToServer); lbReward.text = "" + reward; lbRewardCustomer.text = "" + CommonObjectScript.rewardCustomerRate; }