public void Claim() { if (btnClaimImg.sprite == MenuController.instance.achievementAndDailyQuestPanel.btnClaim[0]) { return; } switch (DataController.allSaveDailyQuest[DataController.saveIndexQuest[index]].RewardsType) { case 1: DataUtils.AddCoinAndGame(0, DataController.allSaveDailyQuest[DataController.saveIndexQuest[index]].SoLuongRewards); break; case 2: DataUtils.AddCoinAndGame(DataController.allSaveDailyQuest[DataController.saveIndexQuest[index]].SoLuongRewards, 0); break; case 3: DataUtils.AddHPPack(DataController.allSaveDailyQuest[DataController.saveIndexQuest[index]].SoLuongRewards); break; } DataController.allSaveDailyQuest[DataController.saveIndexQuest[index]].isPass = false; DataController.allSaveDailyQuest[DataController.saveIndexQuest[index]].isDone = true; DisplayMe(); DataParam.countdonedailyquest++; MenuController.instance.warningDailyQuest.SetActive(false); if (DataParam.countdonedailyquest == DataController.saveIndexQuest.Count) { DataController.instance.DoAchievement(12, 1); return; } DataController.instance.CheckDoneAllDailyQuest(); }
void Reward(int index) { switch (freeReward[index].type) { case 0: DataUtils.AddCoinAndGame(0, freeReward[index].numberReward); break; case 1: DataUtils.AddCoinAndGame(freeReward[index].numberReward, 0); break; case 2: DataUtils.AddHPPack(freeReward[index].numberReward); break; } DataParam.indexRewardVideo = (index + 1); btnvideo[index].color = iconvideo[index].color = /*watchText[index].color = */ Color.gray; if (DataParam.indexRewardVideo <= btnvideo.Length - 1) { btnvideo[DataParam.indexRewardVideo].gameObject.SetActive(true); } else { MenuController.instance.warningvideoreward.SetActive(false); } }
public void Claim(bool gem) { if (gem) { DataUtils.AddCoinAndGame(0, 30); btnClaimGem.SetActive(false); DataController.primeAccout.takegem = true; } else { DataUtils.AddCoinAndGame(1000, 0); btnClaimCoin.SetActive(false); DataController.primeAccout.takecoin = true; } if (DataController.primeAccout.takecoin && DataController.primeAccout.takegem) { DataController.primeAccout.countDay--; timeText.text = "Ends after " + DataController.primeAccout.countDay + " days"; DataParam.timeBeginBuyPrimeAccount = System.DateTime.Now; if (DataController.primeAccout.countDay <= 0) { ResetPrimeAccount(); DisplayButtom(); } } SoundController.instance.PlaySound(soundGame.soundbtnclick); }
public void BtnReset() { if (DataParam.countResetBlackMarket == 0) { SoundController.instance.PlaySound(soundGame.soundbtnclick); #if UNITY_EDITOR Reward(); #else AdsManager.Instance.ShowRewardedVideo((b) => { if (b) { Reward(); MyAnalytics.LogRefreshByVideo(); } }); #endif } else { Debug.LogError(DataUtils.playerInfo.gems + ":" + DataParam.countResetBlackMarket * 5); if (DataUtils.playerInfo.gems >= DataParam.countResetBlackMarket * 5) { DataUtils.AddCoinAndGame(0, -DataParam.countResetBlackMarket * 5); Reward(); priceRefreshText.text = "" + DataParam.countResetBlackMarket * 5; MyAnalytics.LogClickRefresh(); } else { MainMenuController.Instance.shopManager.gameObject.SetActive(true); } } }
public void EvolveHero() { if (DataUtils.playerInfo.coins >= priceUpdate) { if (heroSelected.level < DataUtils.MAX_LEVEL_HERO) { if (DataUtils.dicAllHero[heroSelected.id].pices >= (int)pNext.SoManhYeuCau) { DataUtils.playerInfo.level += 1; DataUtils.dicAllHero[heroSelected.id].level += 1; DataUtils.dicAllHero[heroSelected.id].pices -= (int)pNext.SoManhYeuCau; DataUtils.AddCoinAndGame((int)-priceUpdate, 0); pEvolve.Play(); pEvolveP2.Play(); FillHeroData(_indexChoose); DataUtils.SavePlayerData(); DataUtils.ChooseHero(DataUtils.dicAllHero[heroSelected.id]); DataUtils.dicAllHero[heroSelected.id] = DataUtils.dicAllHero[heroSelected.id]; DataUtils.SaveAllHero(); } else { MainMenuController.Instance.ShowMapNotify("Not enough Character part."); } } else { MainMenuController.Instance.ShowMapNotify("Hero has reached the maximum level"); } } else { MainMenuController.Instance.ShowMapNotify("Not enough coins to level up."); } if (DataUtils.dicAllHero[heroSelected.id].level < DataUtils.MAX_LEVEL_HERO) { gMaxText.SetActive(false); gUpgradeText.SetActive(true); gPartHero.SetActive(true); } else { gMaxText.SetActive(true); if (pData != null) { txtHealth.text = pData.hp + ""; txtMoveSpeed.text = pData.MoveSpeed + ""; } gUpgradeText.SetActive(false); gPartHero.SetActive(false); } }
public void BtnReviveByGem() { SoundController.instance.PlaySound(soundGame.soundbtnclick); if (DataUtils.playerInfo.gems >= pricesGemRevive) { Reward(80); DataUtils.AddCoinAndGame(0, -pricesGemRevive); } }
public void WatchAds() { AdsManager.Instance.ShowRewardedVideo((b) => { if (b) { DataUtils.AddCoinAndGame(200, 0); } }); //ShowMapNotify("Watch Video Ads to get coin and crytal."); }
private void Start() { SoundController.instance.DisplaySetting(); if (!DataParam.first) { #if UNITY_EDITOR #else randomAds = Random.Range(0, 100); if (randomAds < 80) { AdsManager.Instance.ShowInterstitial((b) => { }); } #endif } else { if (DataParam.cantakegiftdaily) { BtnOpenGiftDaily(true); } } DataParam.first = false; DisplayWarning(); CheckDisplayWarningPrimeAccount(); if (DataParam.indexRewardVideo < freeRewardVideoPanel.btnvideo.Length) { warningvideoreward.SetActive(true); } else { warningvideoreward.SetActive(false); } if (DataController.instance.isHack) { DataUtils.AddCoinAndGame(100000, 1000); DataUtils.TakeHeroPice("P2", 100); DataUtils.TakeHeroPice("P1", 100); } // DataUtils.AddCoinAndGame(10000, 0); #region problem //DataUtils.FillPlayerDataInfo(); if (DataUtils.StageHasInit()) { DataUtils.FillAllStage(); } #endregion }
void Reward(bool x2) { numberAdd = x2 == false ? DataController.giftDaily[currentGiftDailyBouder.index].numberReward : DataController.giftDaily[currentGiftDailyBouder.index].numberReward * 2; nameAdd = DataController.giftDaily[currentGiftDailyBouder.index].nameReward; eLevel = DataController.giftDaily[currentGiftDailyBouder.index].eLevel; eType = DataController.giftDaily[currentGiftDailyBouder.index].eType; switch (currentGiftDailyBouder.index) { case 0: DataUtils.AddCoinAndGame(numberAdd, 0); break; case 1: DataUtils.TakeHeroPice(nameAdd, numberAdd); break; case 2: DataUtils.TakeItem(nameAdd, eType, eLevel, numberAdd, false); break; case 3: DataUtils.AddCoinAndGame(0, numberAdd); break; case 4: DataUtils.AddHPPack(numberAdd); break; case 5: DataUtils.TakeItem(nameAdd, eType, eLevel, numberAdd, false); break; } DataParam.cantakegiftdaily = false; DataParam.oldTimeGiftDaily = System.DateTime.Now; DataController.giftDaily[currentGiftDailyBouder.index].isDone = true; btnClaim.SetActive(false); btnClaimX2.gameObject.SetActive(false); selectBouder.SetActive(false); resetText.SetActive(true); if (x2) { MyAnalytics.LogEventClaimX2DailyGift(DataParam.currentGiftDaily, DataParam.oldTimeGiftDaily); } else { MyAnalytics.LogEventClaimDailyGift(DataParam.currentGiftDaily, DataParam.oldTimeGiftDaily); } CloseMe(); }
public void Claim() { if (btnClaimImg.sprite == MenuController.instance.achievementAndDailyQuestPanel.btnClaim[0]) { return; } switch (DataController.instance.allAchievement[index].typeReward[DataController.saveAllAchievement[index].currentLevel - 1]) { case 1: DataUtils.AddCoinAndGame(0, DataController.instance.allAchievement[index].maxNumberReward[DataController.saveAllAchievement[index].currentLevel - 1]); break; case 2: DataUtils.AddCoinAndGame(DataController.instance.allAchievement[index].maxNumberReward[DataController.saveAllAchievement[index].currentLevel - 1], 0); break; case 3: DataUtils.AddHPPack(DataController.instance.allAchievement[index].maxNumberReward[DataController.saveAllAchievement[index].currentLevel - 1]); break; } DataController.saveAllAchievement[index].isPass = false; if (DataController.saveAllAchievement[index].currentLevel >= DataController.instance.allAchievement[index].maxNumber.Count) { // DataController.saveAllAchievement[index].currentLevel = DataController.instance.allAchievement[index].maxNumber.Count - 1; DataController.saveAllAchievement[index].isDone = true; } else { DataController.saveAllAchievement[index].currentLevel++; DataController.saveAllAchievement[index].currentNumber = 0; _temp = DataController.instance.allAchievement[index].NoiDung; if (_temp.Contains("xx")) { // Debug.LogError("vao` dieu kien"); desTemp = _temp.Replace("xx", "" + DataController.instance.allAchievement[index].maxNumber[DataController.saveAllAchievement[index].currentLevel - 1]); } else { desTemp = DataController.instance.allAchievement[index].NoiDung; } desText.text = desTemp; } Debug.LogError("LEVEL ACHI:" + DataController.saveAllAchievement[index].currentLevel); DisplayMe(); MenuController.instance.warningAchievment.SetActive(false); }
public void BtnBuy() { if (index == 0) { if (DataUtils.playerInfo.coins >= prices[index]) { DataUtils.AddCoinAndGame(-prices[index], 0); Calculate(); MyAnalytics.LogOpenLuckyChest("class_chest"); } else { MainMenuController.Instance.shopManager.ChooseTab(0); } } else { if (DataUtils.playerInfo.gems >= prices[index]) { DataUtils.AddCoinAndGame(0, -prices[index]); Calculate(); switch (index) { case 1: MyAnalytics.LogOpenLuckyChest("rare_chest"); break; case 2: MyAnalytics.LogOpenLuckyChest("high_class_chest"); break; case 3: MyAnalytics.LogOpenLuckyChest("legend_chest"); break; default: break; } } else { MainMenuController.Instance.shopManager.ChooseTab(1); } } CloseInfoLuckyChest(); SoundController.instance.PlaySound(soundGame.soundbtnclick); }
public void DisplayDefeatNPCDIE() { btnReviveByAds.SetActive(false); btnReviveByGem.gameObject.SetActive(false); DataUtils.AddCoinAndGame((int)DataParam.totalCoin, 0); defeatPanel.SetActive(true); switch (GameController.instance.currentChar) { case 0: SoundController.instance.PlaySound(soundGame.soundlose); break; case 1: SoundController.instance.PlaySound(soundGame.soundlosenv2); break; } }
public void Buy() { if (DataUtils.playerInfo.gems >= 500) { DataUtils.AddCoinAndGame(0, -500); DataController.primeAccout.isVIP = true; DataParam.timeBeginBuyPrimeAccount = System.DateTime.Now; DataController.instance.AddNewQuest(); DisplayButtom(); MyAnalytics.LogPrimeAccount(); } else { MenuController.instance.BtnDisplayPrimeAccount(false); MainMenuController.Instance.shopManager.gameObject.SetActive(true); } SoundController.instance.PlaySound(soundGame.soundbtnclick); }
public void WatchVideo() { Debug.LogError("Watch Video to get 200 coins"); if (Application.platform == RuntimePlatform.Android) { AdsManager.Instance.ShowRewardedVideo((b) => { if (b) { DataUtils.AddCoinAndGame(200, 0); MyAnalytics.LogFreeReward(); } }); } else { Debug.LogError("1111"); DataUtils.AddCoinAndGame(200, 0); } }
public void DisplayDefeat() { if (defeatPanel.activeSelf) { return; } if (GameController.instance.reviveCount == 0) { myGemText.text = "Own: <color=green>" + DataUtils.playerInfo.gems + "</color>"; pricegemText.text = "" + pricesGemRevive; btnReviveByAds.SetActive(true); if (DataUtils.playerInfo.gems >= pricesGemRevive) { btnReviveByGem.image.color = Color.white; } else { btnReviveByGem.image.color = Color.gray; } btnReviveByGem.gameObject.SetActive(true); } else { btnReviveByAds.SetActive(false); btnReviveByGem.gameObject.SetActive(false); DataUtils.AddCoinAndGame((int)DataParam.totalCoin, 0); } defeatPanel.SetActive(true); switch (GameController.instance.currentChar) { case 0: SoundController.instance.PlaySound(soundGame.soundlose); break; case 1: SoundController.instance.PlaySound(soundGame.soundlosenv2); break; } }
public void DisassebleItem() { DataUtils.AddCoinAndGame((int)dbValue, 0); EquipmentManager.Instance.DoDisassemble(iDisassemble, keyItem); ClosePopup(); }
public PurchaseProcessingResult ProcessPurchase(PurchaseEventArgs e) { if (acBuyComplete != null) { acBuyComplete(); } switch (e.purchasedProduct.definition.id) { case DataUtils.P_DONATE: Debug.LogError("Process Donate"); DataUtils.RemoveAds(); MyAnalytics.LogEventBuyInapp("donate_pack"); break; case DataUtils.P_STARTER_PACK: Debug.LogError("P_STARTER_PACK"); DataUtils.AddCoinAndGame(7500, 0); DataUtils.AddHPPack(5); MyAnalytics.LogEventBuyInapp("starter_pack"); MyAnalytics.LogBuyStarterPack(); DataUtils.TakeItem("W7", DataUtils.eType.WEAPON, DataUtils.eLevel.Normal, 10, true); break; case DataUtils.P_CHEAP_PACK: DataUtils.AddCoinAndGame(7500, 25); DataUtils.AddHPPack(10); MyAnalytics.LogEventBuyInapp("cheap_pack"); break; case DataUtils.P_BEST_CHOICE: DataUtils.AddCoinAndGame(15000, 50); DataUtils.AddHPPack(25); DataUtils.TakeHeroPice("P1", 20); MyAnalytics.LogEventBuyInapp("best_choice_pack"); break; case DataUtils.P_PROFESSIONAL_PACK: DataUtils.AddCoinAndGame(85000, 100); DataUtils.AddHPPack(45); DataUtils.TakeHeroPice("P1", 50); DataUtils.RemoveAds(); MyAnalytics.LogEventBuyInapp("professional_pack"); break; case DataUtils.P_12500GEM_PACK: DataUtils.AddCoinAndGame(0, 12500); MyAnalytics.LogEventBuyInapp("pack_12500_gems"); break; case DataUtils.P_1750GEM_PACK: DataUtils.AddCoinAndGame(0, 1750); MyAnalytics.LogEventBuyInapp("pack_1750_gems"); break; case DataUtils.P_220GEM_PACK: DataUtils.AddCoinAndGame(0, 220); MyAnalytics.LogEventBuyInapp("pack_220_gems"); break; case DataUtils.P_25GEM_PACK: DataUtils.AddCoinAndGame(0, 25); MyAnalytics.LogEventBuyInapp("pack_25_gems"); break; case DataUtils.P_4000GEM_PACK: DataUtils.AddCoinAndGame(0, 4000); MyAnalytics.LogEventBuyInapp("pack_4000_gems"); break; case DataUtils.P_600GEM_PACK: DataUtils.AddCoinAndGame(0, 600); MyAnalytics.LogEventBuyInapp("pack_600_gems"); break; } return(PurchaseProcessingResult.Complete); }
public void Buy() { if (DataUtils.playerInfo.coins >= DataController.blackMarketSave[index].GiaBanCoin) { if (DataController.blackMarketSave[index].countnumber > 0) { //if (DataController.blackMarketSave[index].ID.Contains("W")) //{ // type = DataUtils.eType.WEAPON; //} //else if (DataController.blackMarketSave[index].ID.Contains("A")) //{ // type = DataUtils.eType.ARMOR; //} //else if (DataController.blackMarketSave[index].ID.Contains("H")) //{ // type = DataUtils.eType.HELMET; //} //else if (DataController.blackMarketSave[index].ID.Contains("S")) //{ // type = DataUtils.eType.SHOES; //} //else if (DataController.blackMarketSave[index].ID.Contains("G")) //{ // type = DataUtils.eType.GLOVES; //} //else if (DataController.blackMarketSave[index].ID.Contains("B")) //{ // type = DataUtils.eType.BAG; //} //switch(DataController.blackMarketSave[index].Level) //{ // case "Normal": // level = DataUtils.eLevel.Normal; // break; // case "Uncommon": // level = DataUtils.eLevel.Uncommon; // break; // case "Rare": // level = DataUtils.eLevel.Rare; // break; // case "Epic": // level = DataUtils.eLevel.Epic; // break; // case "Legendary": // level = DataUtils.eLevel.Legendary; // break; //} DataUtils.TakeItem(DataController.blackMarketSave[index].ID, type, level, 1, false); DataUtils.AddCoinAndGame(-(int)DataController.blackMarketSave[index].GiaBanCoin, 0); DataController.blackMarketSave[index].countnumber--; DisplayAgainWhenBuy(); MyAnalytics.LogBuyInBlackMarket(); MenuController.instance.blackMarketpanel.DisplayConfirm(bouderImg.sprite, iconItemImg.sprite, DataUtils.GetItemName(type, DataController.blackMarketSave[index].ID)); } } else { MainMenuController.Instance.shopManager.gameObject.SetActive(true); } }
public void WinGame() { gemAdd = 0; gameState = GameState.gameover; WinSound(); PlayerController.instance.playerState = PlayerController.PlayerState.Win; PlayerController.instance.AnimWin(); PlayerController.instance.rid.velocity = Vector2.zero; PlayerController.instance.box.enabled = false; PlayerController.instance.speedmove = 0; MissionController.Instance.DoMission(0, timePlay); MissionController.Instance.DoMission(3, (int)((PlayerController.instance.health / PlayerController.instance.maxHealth) * 100)); MissionController.Instance.DoMission(6, reviveCount); if (countStar == 0) { countStar = 1; } if (MissionController.Instance.listMissions[0].isDone) { countStar++; } if (MissionController.Instance.listMissions[1].isDone) { countStar++; } if (countStar >= 1) { if (DataUtils.modeSelected == 0) { if (DataUtils.First1Star(DataUtils.modeSelected, DataParam.indexStage, DataParam.indexMap) == false) { DataParam.AddCoin((float)DataController.instance.allMission[DataParam.indexStage].missionData[DataParam.indexMap].coin1star); Debug.LogError("star 1 normal lan dau"); } else { DataParam.AddCoin((float)DataController.instance.allMission[DataParam.indexStage].missionData[DataParam.indexMap].coin1star / 100 * 10); Debug.LogError("star 1 normal lan sau"); } } else { if (DataUtils.First1Star(DataUtils.modeSelected, DataParam.indexStage, DataParam.indexMap) == false) { DataParam.AddCoin((float)DataController.instance.allMission[DataParam.indexStage].missionData[DataParam.indexMap].coin1star * 1.5f); Debug.LogError("star 1 hard lan dau"); } else { DataParam.AddCoin((float)DataController.instance.allMission[DataParam.indexStage].missionData[DataParam.indexMap].coin1star * 1.5f / 100 * 10); Debug.LogError("star 1 hard lan dau"); } } } if (countStar >= 2) { if (DataUtils.modeSelected == 0) { if (DataUtils.First2Star(DataUtils.modeSelected, DataParam.indexStage, DataParam.indexMap) == false) { DataParam.AddCoin((float)DataController.instance.allMission[DataParam.indexStage].missionData[DataParam.indexMap].coin2star); Debug.LogError("star 2 normal lan dau"); } else { DataParam.AddCoin((float)DataController.instance.allMission[DataParam.indexStage].missionData[DataParam.indexMap].coin2star / 100 * 10); Debug.LogError("star 2 normal lan sau"); } } else { if (DataUtils.First2Star(DataUtils.modeSelected, DataParam.indexStage, DataParam.indexMap) == false) { DataParam.AddCoin((float)DataController.instance.allMission[DataParam.indexStage].missionData[DataParam.indexMap].coin2star * 1.5f); Debug.LogError("star 2 hard lan dau"); } else { DataParam.AddCoin((float)DataController.instance.allMission[DataParam.indexStage].missionData[DataParam.indexMap].coin2star * 1.5f / 100 * 10); Debug.LogError("star 2 hard lan dau"); } } } if (countStar == 3) { if (DataUtils.modeSelected == 0) { if (DataUtils.First3Star(DataUtils.modeSelected, DataParam.indexStage, DataParam.indexMap) == false) { DataParam.AddCoin((float)DataController.instance.allMission[DataParam.indexStage].missionData[DataParam.indexMap].coin3star); Debug.LogError("star 3 normal lan dau"); gemAdd = (int)DataController.instance.allMission[DataParam.indexStage].missionData[DataParam.indexMap].bonusgem; DataUtils.AddCoinAndGame(0, gemAdd); } else { DataParam.AddCoin((float)DataController.instance.allMission[DataParam.indexStage].missionData[DataParam.indexMap].coin3star / 100 * 10); Debug.LogError("star 3 normal lan sau"); } } else { if (DataUtils.First3Star(DataUtils.modeSelected, DataParam.indexStage, DataParam.indexMap) == false) { DataParam.AddCoin((float)DataController.instance.allMission[DataParam.indexStage].missionData[DataParam.indexMap].coin3star * 1.5f); Debug.LogError("star 3 hard lan dau"); gemAdd = Mathf.RoundToInt((float)DataController.instance.allMission[DataParam.indexStage].missionData[DataParam.indexMap].bonusgem * 1.5f); DataUtils.AddCoinAndGame(0, gemAdd); } else { DataParam.AddCoin((float)DataController.instance.allMission[DataParam.indexStage].missionData[DataParam.indexMap].coin3star * 1.5f / 100 * 10); Debug.LogError("star 3 hard lan dau"); } DataController.instance.DoDailyQuest(7, 1); } DataController.instance.DoDailyQuest(2, 1); } DataUtils.SaveLevel(DataParam.indexStage, DataParam.indexMap); MissionController.Instance.CheckMission(); MyAnalytics.LogEventLevelComplete(DataParam.indexMap, DataParam.indexStage); DataController.instance.DoAchievement(6, 1); if (reviveCount == 0) { DataController.instance.DoAchievement(7, 1); if (DataUtils.modeSelected == 1) { DataController.instance.DoDailyQuest(9, 1); } } if (DataParam.indexMap == 7) { if (DataParam.indexStage == 0) { DataController.instance.DoAchievement(8, 1); } if (DataParam.indexStage == 1) { DataController.instance.DoAchievement(9, 1); } } if (DataUtils.modeSelected == 1) { DataController.instance.DoDailyQuest(4, 1); } if (DataController.primeAccout.isVIP) { DataParam.AddCoin(DataParam.totalCoin / 100 * 20); } DataUtils.AddCoinAndGame((int)DataParam.totalCoin, 0); ThemManh(); StartCoroutine(delayDisplayFinish()); }