예제 #1
0
    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);
            }
        }
    }
예제 #2
0
    private void OnEnable()
    {
        for (int i = 0; i < lstEquip.Count; i++)
        {
            if (!dicAllEquip.ContainsKey(lstEquip[i].itemData.type))
            {
                dicAllEquip.Add(lstEquip[i].itemData.type, lstEquip[i].itemData);
            }
        }
        if (heroSelected == null)
        {
            heroSelected = DataUtils.heroInfo;
        }

        ChangeAnim(DataUtils.HeroIndex() + 1);

        MyAnalytics.LogOpenHeroTab();
        ChooseTab(0);

        InitEquippedItem();


        HeroOnClick(/*0*/ DataUtils.HeroIndex());

        //FillHeroData(DataUtils.HeroIndex());
    }
예제 #3
0
    private void Start()
    {
        DataParam.totalCoin           = 0;
        currentMap                    = Instantiate(listMaps[DataParam.indexStage].listMap[DataParam.indexMap]);
        currentMap.transform.position = Vector2.zero;

        //   Debug.LogError(currentMap.pointBeginPlayer.transform.position.x + ":" + currentMap.pointBeginPlayer.transform.position.y);
        Camera.main.transform.position = new Vector3(currentMap.pointBeginPlayer.transform.position.x + 3, currentMap.pointBeginPlayer.transform.position.y, Camera.main.transform.position.z);

        //    Debug.LogError(Camera.main.transform.position);
        uiPanel.levelText.text = "Level " + (DataParam.indexMap + 1);
        timeCountPlay          = new WaitForSecondsRealtime(1);
        delaywinwait           = new WaitForSeconds(2f);
        StartCoroutine(CountTimePlay());
        countCombo = 0;
        AddProperties();
        auBG.clip = bgClip[DataParam.indexStage];
        auBG.Play();
        DisplaySetting();
        maybay.Begin(currentMap.pointBeginPlayer.transform.position, true, 5);
        uiPanel.gameObject.SetActive(false);
        uiDisplay.gameObject.SetActive(false);
        StartCoroutine(DelayLoadMap());

        CameraController.instance.BeginRedZone();

        MyAnalytics.LogEventLevelPlay(DataParam.indexMap, DataParam.indexStage);
    }
예제 #4
0
 private void Start()
 {
     DisplayButtom();
     Click(0);
     if (!DataController.primeAccout.isVIP)
     {
         MyAnalytics.LogNotYetUpgradePrime();
     }
 }
예제 #5
0
    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();
    }
예제 #6
0
 public void BtnDisplayBlackMarket(bool open)
 {
     if (open)
     {
         blackMarketpanel.gameObject.SetActive(true);
         MyAnalytics.LogOpenBlackMarket();
     }
     else
     {
         DataController.instance.LoadAgainQuestAndBlackMarket();
         blackMarketpanel.gameObject.SetActive(false);
     }
     SoundController.instance.PlaySound(soundGame.soundbtnclick);
 }
예제 #7
0
    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);
    }
예제 #8
0
    private void Awake()
    {
        if (Instance == null)
        {
            Instance = this;
            DontDestroyOnLoad(this);
            MyAnalytics.LogEventLogin();
            MyAnalytics.LogEventOpenByDay();
            MyAnalytics.LogEventTimeOpen();
            InitAds();


            GameObject g = new GameObject("-----");
            if (g.GetComponent <PushNotificationManager>() == null)
            {
                g.AddComponent <PushNotificationManager>();
            }
        }
    }
예제 #9
0
    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);
    }
예제 #10
0
 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);
     }
 }
예제 #11
0
    public void Click(int index)
    {
        if (btnvideo[index].color == Color.gray || !btnvideo[index].gameObject.activeSelf)
        {
            return;
        }

        SoundController.instance.PlaySound(soundGame.soundbtnclick);

#if UNITY_EDITOR
        Reward(index);
#else
        AdsManager.Instance.ShowRewardedVideo((b) =>
        {
            if (b)
            {
                Reward(index);
                MyAnalytics.LogFreeReward();
            }
        });
#endif
    }
예제 #12
0
 public void BtnBackToWorld()
 {
     OutPlay(1, false);
     MyAnalytics.LogEventLoseLevel(DataParam.indexMap, CameraController.instance.currentCheckPoint, DataParam.indexStage);
 }
예제 #13
0
 public void BtnLike()
 {
     Application.OpenURL("https://www.facebook.com/rambo.contra.brothersquad/");
     MyAnalytics.LogClickFanpage();
 }
예제 #14
0
 public void OpenMe()
 {
     DisplayBegin();
     gameObject.SetActive(true);
     MyAnalytics.LogEventOpenDailyGift(System.DateTime.Now);
 }
예제 #15
0
 private void OnEnable()
 {
     MyAnalytics.LogOpenShop();
     ChooseTab(2);
 }
예제 #16
0
 public void BtnOpenAchievementAndDailyQuest()
 {
     MenuController.instance.achievementAndDailyQuestPanel.DisPlayMe(0);
     MyAnalytics.LogOpenTabDailyQuest();
 }
예제 #17
0
    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);
    }
예제 #18
0
    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());
    }
예제 #19
0
 public void MoreGame()
 {
     MyAnalytics.LogMoreGame();
     Application.OpenURL(DataUtils.LINK_MORE_GAME);
 }
예제 #20
0
    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);
        }
    }