예제 #1
0
    public void Ok()
    {
        BtnShoot.SetActive(true);
        isShowing = false;
        List <Gelembung> listOfBubbble = new List <Gelembung>();
        string           bubbleString  = "";

        for (int i = 0; i < bubblePreview.transform.childCount; i++)
        {
            ItemGelembungController controller = bubblePreview.transform.GetChild(i).gameObject.GetComponent <ItemGelembungController>();
            listOfBubbble.Add(new Gelembung(controller.PackageName, controller.Type));
            bubbleString += controller.Type.ToString();
        }
        string command = "{";

        command += "action:PlAY_LEVEL";
        command += ",place:" + dataLevel.Place;
        command += ",level:" + dataLevel.Level;
        command += ",bubbleUsed:" + bubbleString;
        command += ",status:CHOOSE_BUBBLE";
        command += "}";
        ServerStatistic.DoRequest(command);
        callback(listOfBubbble);
        GetComponent <Animator>().SetTrigger("Hide");
    }
예제 #2
0
 public void FailCallback(FailPopupController.ButtonName button)
 {
     if (button == FailPopupController.ButtonName.Menu)
     {
         BackToMenu();
         //Statistik
         string command = "{";
         command += "action:PlAY_LEVEL";
         command += ",place:" + dataStaticLevel.Place;
         command += ",level:" + dataStaticLevel.Level;
         command += ",status:5_FAILED_BACKTOMENU";
         command += "}";
         ServerStatistic.DoRequest(command);
     }
     else if (button == FailPopupController.ButtonName.Replay)
     {
         Replay();
         //Statistik
         string command = "{";
         command += "action:PlAY_LEVEL";
         command += ",place:" + dataStaticLevel.Place;
         command += ",level:" + dataStaticLevel.Level;
         command += ",status:5_FAILED_REPLAY";
         command += "}";
         ServerStatistic.DoRequest(command);
     }
     else if (button == FailPopupController.ButtonName.BackToEditor)
     {
         BackToMenu();
     }
 }
    public void CallbackReloadUsingAds()
    {
        ConfirmationRoload.SetActive(true);
        ReloadView.SetActive(true);
        ReloadPopUp.SetActive(false);

        //Statistik
        string command = "{";

        command += "action:PlAY_LEVEL";
        command += ",place:" + dataStaticLevel.Place;
        command += ",level:" + dataStaticLevel.Level;
        command += ",status:2_SUCCESS_COMFIRM_RELOAD_USING_COINS";
        command += "}";
        ServerStatistic.DoRequest(command);

        if (!PlayerPrefs.HasKey("hadwatch"))
        {
            tutorialPora.SetTrigger("define");
            closeForDefine.SetActive(true);
            tutorialAnimator.SetTrigger("Show");
            PlayerPrefs.SetString("hadwatch", "");
            PlayerPrefs.Save();
        }
    }
예제 #4
0
    private void YesToBuy()
    {
        UserStockData userStock = UserStockData.Load();

        if (userStock.PlusMinGem(-Price))
        {
            if (userStock.PlusMinGold(Gold))
            {
                messagePopup.Show("You have bought " + Name);
                string command = "{";
                command += "action:BUY_COIN";
                command += ",item:" + Name;
                command += "}";
                ServerStatistic.DoRequest(command);
            }
            else
            {
                userStock.PlusMinGem(Price);
            }
        }
        else
        {
            messagePopup.Show("You need " + (Price - userStock.Gems) + " more pearls!");
        }
    }
예제 #5
0
 public void PauseCallback(PausePopupController.ButtonName button)
 {
     if (button == PausePopupController.ButtonName.Resume)
     {
         UnPause();
     }
     else if (button == PausePopupController.ButtonName.Menu)
     {
         BackToMenu();
         //Statistik
         string command = "{";
         command += "action:PlAY_LEVEL";
         command += ",place:" + dataStaticLevel.Place;
         command += ",level:" + dataStaticLevel.Level;
         command += ",timePlaying:" + TimePlaying.ToString();
         command += ",status:4_PAUSE_BACKTOMENU";
         command += "}";
         ServerStatistic.DoRequest(command);
     }
     else if (button == PausePopupController.ButtonName.Replay)
     {
         Replay();
         //Statistik
         string command = "{";
         command += "action:PlAY_LEVEL";
         command += ",place:" + dataStaticLevel.Place;
         command += ",level:" + dataStaticLevel.Level;
         command += ",timePlaying:" + TimePlaying.ToString();
         command += ",status:4_PAUSE_REPLAY";
         command += "}";
         ServerStatistic.DoRequest(command);
     }
 }
예제 #6
0
    public void Fail()
    {
        if (Mode == GameplayMode.StaticLevel)
        {
            //Statistik
            string command = "{";
            command += "action:PlAY_LEVEL";
            command += ",place:" + dataStaticLevel.Place;
            command += ",level:" + dataStaticLevel.Level;
            command += ",timePlaying:" + TimePlaying.ToString();;
            command += ",status:4_FAILED";
            command += "}";
            ServerStatistic.DoRequest(command);


            failedPopupController.ShowForPlayingStaticLevel(FailCallback);
        }
        else if (Mode == GameplayMode.Edited)
        {
            failedPopupController.ShowForPlayingEditedLevel(FailCallback);
        }
        else if (Mode == GameplayMode.ValidateLevel)
        {
            failedPopupController.ShowForValidateLevel(FailCallback);
        }
        State = GameplayState.Failed;
    }
    public void ReloadUsingGold()
    {
        UserStockData data = UserStockData.Load();

        if (!data.PlusMinGold(-40))
        {
            messagePopup.Show("You dont have enough coin, let buy more!");
        }
        else
        {
            ReloadView.SetActive(true);
            ReloadPopUp.SetActive(false);
            //Statistik
            string command = "{";
            command += "action:PlAY_LEVEL";
            command += ",place:" + dataStaticLevel.Place;
            command += ",level:" + dataStaticLevel.Level;
            command += ",status:2_COMFIRM_RELOAD_USING_COINS";
            command += "}";
            ServerStatistic.DoRequest(command);
        }

        if (!PlayerPrefs.HasKey("hadwatch"))
        {
            tutorialPora.SetTrigger("define");
            closeForDefine.SetActive(true);
            tutorialAnimator.SetTrigger("Show");
            PlayerPrefs.SetString("hadwatch", "");
            PlayerPrefs.Save();
        }
    }
    private void YesToBuy()
    {
        UserStockData userStock = UserStockData.Load();

        if (Payment == PaymentType.Gold)
        {
            if (userStock.PlusMinGold(-Price))
            {
                if (userStock.PlusMinBubble(WhiteBubble, RedBubble, OrangeBubble))
                {
                    messagePopup.Show("You have bought " + Name);
                    string command = "{";
                    command += "action:BUY_BUBBLE";
                    command += ",item:" + Name;
                    command += "}";
                    ServerStatistic.DoRequest(command);
                    if (reloadPopup)
                    {
                        reloadPopup.NewBuy(WhiteBubble, RedBubble, OrangeBubble);
                    }
                }
                else
                {
                    userStock.PlusMinGold(Price);
                }
            }
            else
            {
                messagePopup.Show("You need " + (Price - userStock.Gold) + " more coins!");
            }
        }
        else if (Payment == PaymentType.Gem)
        {
            if (userStock.PlusMinGem(-Price))
            {
                if (userStock.PlusMinBubble(WhiteBubble, RedBubble, OrangeBubble))
                {
                    messagePopup.Show("You have bought " + Name);
                    string command = "{";
                    command += "action:BUY_BUBBLE";
                    command += ",item:" + Name;
                    command += "}";
                    ServerStatistic.DoRequest(command);
                    if (reloadPopup)
                    {
                        reloadPopup.NewBuy(WhiteBubble, RedBubble, OrangeBubble);
                    }
                }
                else
                {
                    userStock.PlusMinGem(Price);
                }
            }
            else
            {
                messagePopup.Show("You need " + (Price - userStock.Gems) + " more pearls!");
            }
        }
    }
예제 #9
0
    // Use this for initialization
    void Start()
    {
        string command = "{";

        command += "action:OPEN_MAIN";
        command += "}";
        ServerStatistic.DoRequest(command);
    }
    public void ReloadUsingWatchAds()
    {
        if (Advertisement.isReady("rewardedVideoZone"))
        {
            Advertisement.Show("rewardedVideoZone", new ShowOptions
            {
                pause          = true,
                resultCallback = result =>
                {
                    if (result.ToString() == "Finished")
                    {
                        CallbackReloadUsingAds();
                    }
                    else if (result.ToString() == "Skipped")
                    {
                        messagePopup.Show("You have skiped the ads!");
                        //Statistik
                        string command = "{";
                        command       += "action:PlAY_LEVEL";
                        command       += ",place:" + dataStaticLevel.Place;
                        command       += ",level:" + dataStaticLevel.Level;
                        command       += ",status:2_SKIP_COMFIRM_RELOAD_USING_ADS";
                        command       += "}";
                        ServerStatistic.DoRequest(command);
                    }
                    else
                    {
                        messagePopup.Show("Video is not available");
                        //Statistik
                        string command = "{";
                        command       += "action:PlAY_LEVEL";
                        command       += ",place:" + dataStaticLevel.Place;
                        command       += ",level:" + dataStaticLevel.Level;
                        command       += ",status:2_FAILED_COMFIRM_RELOAD_USING_ADS";
                        command       += "}";
                        ServerStatistic.DoRequest(command);
                    }
                }
            });
        }
        else
        {
            messagePopup.Show("Video is not available");

            //Statistik
            string command = "{";
            command += "action:PlAY_LEVEL";
            command += ",place:" + dataStaticLevel.Place;
            command += ",level:" + dataStaticLevel.Level;
            command += ",status:2_FAILED_COMFIRM_RELOAD_USING_ADS";
            command += "}";
            ServerStatistic.DoRequest(command);
        }
    }
예제 #11
0
    private void SuccessLogin()
    {
        FB.API("/me?fields=id,first_name", Facebook.HttpMethod.GET, RequestNameCallback);
        LoadUserFriends();

        string command = "{";

        command += "action:NEW_FACEBOOK_LOGIN";
        command += "}";
        ServerStatistic.DoRequest(command);
    }
예제 #12
0
 public void SuccessCallback(SuccessPopupController.ButtonName buttonName)
 {
     if (buttonName == SuccessPopupController.ButtonName.Next)
     {
         NextLevel();
         //Statistik
         string command = "{";
         command += "action:PlAY_LEVEL";
         command += ",place:" + dataStaticLevel.Place;
         command += ",level:" + dataStaticLevel.Level;
         command += ",status:5_SUCCESS_NEXT";
         command += "}";
         ServerStatistic.DoRequest(command);
     }
     else if (buttonName == SuccessPopupController.ButtonName.Menu)
     {
         BackToMenu();
         //Statistik
         string command = "{";
         command += "action:PlAY_LEVEL";
         command += ",place:" + dataStaticLevel.Place;
         command += ",level:" + dataStaticLevel.Level;
         command += ",status:5_SUCCESS_BACKTOMENU";
         command += "}";
         ServerStatistic.DoRequest(command);
     }
     else if (buttonName == SuccessPopupController.ButtonName.Replay)
     {
         Replay();
         //Statistik
         string command = "{";
         command += "action:PlAY_LEVEL";
         command += ",place:" + dataStaticLevel.Place;
         command += ",level:" + dataStaticLevel.Level;
         command += ",status:5_SUCCESS_REPLAY";
         command += "}";
         ServerStatistic.DoRequest(command);
     }
     else if (buttonName == SuccessPopupController.ButtonName.BackToEditor)
     {
         ValidationStatus = false;
         BackToMenu();
     }
     else if (buttonName == SuccessPopupController.ButtonName.Save)
     {
         ValidationStatus = true;
         SaveStatus       = true;
         BackToMenu();
     }
 }
예제 #13
0
    private void OnQueryInventorySucceeded(Inventory inventory)
    {
        SkuDetails skusDetail = inventory.GetSkuDetails(ItemPurchaseStore.AndroidStore);

        priceText.text = skusDetail.CurrencyCode + " " + skusDetail.PriceValue;

#if UNITY_ANDROID
        if (inventory.HasPurchase(ItemPurchaseStore.AndroidStore))
        {
            UserStockData userStock = UserStockData.Load();
            userStock.PlusMinGem(Gems);
            OpenIAB.consumeProduct(inventory.GetPurchase(ItemPurchaseStore.AndroidStore));
            MessagePopup.Show("You have bought " + Name);

            string command = "{";
            command += "action:BUY_PEARL";
            command += ",item:" + Name;
            command += "}";
            ServerStatistic.DoRequest(command);
        }
#elif UNITY_IOS
        if (inventory.HasPurchase(ItemPurchaseStore.IosStore))
        {
            UserStockData userStock = UserStockData.Load();
            userStock.PlusMinGem(Gems);
            OpenIAB.consumeProduct(inventory.GetPurchase(ItemPurchaseStore.IosStore));
            MessagePopup.Show("You have bought " + Name);

            string command = "{";
            command += "action:BUY_PEARL";
            command += ",item:" + Name;
            command += "}";
            ServerStatistic.DoRequest(command);
        }
#elif UNITY_WP8
        if (inventory.HasPurchase(ItemPurchaseStore.WpStore))
        {
            UserStockData userStock = UserStockData.Load();
            userStock.PlusMinGem(Gems);
            OpenIAB.consumeProduct(inventory.GetPurchase(ItemPurchaseStore.WpStore));
            MessagePopup.Show("You have bought " + Name);

            string command = "{";
            command += "action:BUY_PEARL";
            command += ",item:" + Name;
            command += "}";
            ServerStatistic.DoRequest(command);
        }
#endif
    }
예제 #14
0
    private void FinishWatching()
    {
        UserStockData userStock = UserStockData.Load();

        userStock.PlusMinGem(Gems);
        messagePopUp.Show("You have got 1 Pearl!");

        string command = "{";

        command += "action:BUY_PEARL";
        command += ",item:1_SUCCESS_PEARLD_ADS";
        command += "}";
        ServerStatistic.DoRequest(command);
    }
    public void No()
    {
        //Statistik
        string command = "{";

        command += "action:PlAY_LEVEL";
        command += ",place:" + dataStaticLevel.Place;
        command += ",level:" + dataStaticLevel.Level;
        command += ",status:1_COMFIRM_RELOAD_NO";
        command += "}";
        ServerStatistic.DoRequest(command);

        callbackNo();
        Hide();
    }
예제 #16
0
    // Use this for initialization
    void Start()
    {
        UserSoundConfig config = UserSoundConfig.Load();

        for (int i = 0; i < audioSourcesEffect.Length; i++)
        {
            audioSourcesEffect[i].volume = config.SoundVolume;
            audioSourcesEffect[i].mute   = !config.SoundStatus;
        }

        string command = "{";

        command += "action:OPEN_CHOOSEMODE";
        command += "}";
        ServerStatistic.DoRequest(command);
    }
예제 #17
0
    void Start()
    {
        string command = "{";

        command += "device_id:" + SystemInfo.deviceUniqueIdentifier;
        command += ",action:OPEN_APP";
        command += ",platform:" + Application.platform.ToString();
        command += ",language:" + Application.systemLanguage.ToString();
        command += ",operating_system:" + SystemInfo.operatingSystem;
        command += ",device_model:" + SystemInfo.deviceModel;
        command += ",country:" + "ID";
        command += ",IP:" + (Network.HavePublicAddress() ? Network.natFacilitatorIP:"-");
        command += ",screen_resolution:" + Screen.width + "x" + Screen.height;
        command += "}";
        ServerStatistic.DoRequest(command);
    }
예제 #18
0
    private void OnPurchaseSucceded(Purchase purchase) //to VerifyDeveloperPayload to our own server
    {
#if UNITY_ANDROID
        if (purchase.Sku == ItemPurchaseStore.AndroidStore)
        {
            UserStockData userStock = UserStockData.Load();
            userStock.PlusMinGem(Gems);
            OpenIAB.consumeProduct(purchase);
            MessagePopup.Show("You have bought " + Name);

            string command = "{";
            command += "action:BUY_PEARL";
            command += ",item:" + Name;
            command += "}";
            ServerStatistic.DoRequest(command);
        }
#elif UNITY_IOS
        if (purchase.Sku == ItemPurchaseStore.IosStore)
        {
            UserStockData userStock = UserStockData.Load();
            userStock.PlusMinGem(Gems);
            OpenIAB.consumeProduct(purchase);
            MessagePopup.Show("You have bought " + Name);

            string command = "{";
            command += "action:BUY_PEARL";
            command += ",item:" + Name;
            command += "}";
            ServerStatistic.DoRequest(command);
        }
#elif UNITY_WP8
        if (purchase.Sku == ItemPurchaseStore.WpStore)
        {
            UserStockData userStock = UserStockData.Load();
            userStock.PlusMinGem(Gems);
            OpenIAB.consumeProduct(purchase);
            MessagePopup.Show("You have bought " + Name);

            string command = "{";
            command += "action:BUY_PEARL";
            command += ",item:" + Name;
            command += "}";
            ServerStatistic.DoRequest(command);
        }
#endif
    }
    // Use this for initialization
    void Start()
    {
        UserSoundConfig config = UserSoundConfig.Load();

        for (int i = 0; i < audioSourcesEffect.Length; i++)
        {
            audioSourcesEffect[i].volume = config.SoundVolume;
            audioSourcesEffect[i].mute   = !config.SoundStatus;
        }

        for (int i = 0; i < audioSourcesMusic.Length; i++)
        {
            audioSourcesMusic[i].volume = config.MusicVolume;
            audioSourcesMusic[i].mute   = !config.MusicStatus;
        }

        SceneCommunication       com        = new SceneCommunication(CurrentScene);
        List <CommunicationData> listOfdata = com.RetrieveMessages();

        if (listOfdata.Count == 0)
        {
            data = "Parbaba";
        }
        else if (listOfdata.Count == 1 && (listOfdata[0].Sender == SceneName.PlayParbaba || listOfdata[0].Sender == SceneName.PlayBatuguru || listOfdata[0].Sender == SceneName.PlayParapat || listOfdata[0].Sender == SceneName.PlayTomok))
        {
            preplayPopUp.Show((StaticLevel)listOfdata[0].Data);
        }
        else
        {
            data = (string)listOfdata[0].Data;
            if (listOfdata[0].Sender == SceneName.PlayParbaba || listOfdata[0].Sender == SceneName.PlayBatuguru || listOfdata[0].Sender == SceneName.PlayParapat || listOfdata[0].Sender == SceneName.PlayTomok)
            {
                levelLastPlayed = (int)listOfdata[1].Data;
            }
        }

        SlideLevel.GetComponent <ScrollRect>().horizontalNormalizedPosition = levelLastPlayed <= 5 ? 0 : levelLastPlayed / 20f;

        string command = "{";

        command += "action:OPEN_CHOOSELEVEL";
        command += ",place:" + data;
        command += "}";
        ServerStatistic.DoRequest(command);
    }
예제 #20
0
 public void OnClick()
 {
     if (Advertisement.isReady("rewardedVideoZone"))
     {
         Advertisement.Show("rewardedVideoZone", new ShowOptions
         {
             pause          = true,
             resultCallback = result =>
             {
                 if (result.ToString() == "Finished")
                 {
                     FinishWatching();
                 }
                 else if (result.ToString() == "Skipped")
                 {
                     messagePopUp.Show("You have skipped the video!");
                     string command = "{";
                     command       += "action:BUY_PEARL";
                     command       += ",item:1_SKIP_PEARLD_ADS";
                     command       += "}";
                     ServerStatistic.DoRequest(command);
                 }
                 else
                 {
                     messagePopUp.Show("Failed to play video!");
                     string command = "{";
                     command       += "action:BUY_PEARL";
                     command       += ",item:1_FAILED_PEARLD_ADS";
                     command       += "}";
                     ServerStatistic.DoRequest(command);
                 }
             }
         });
     }
     else
     {
         messagePopUp.Show("Failed to play video!");
         string command = "{";
         command += "action:BUY_PEARL";
         command += ",item:1_FAILED_PEARLD_ADS";
         command += "}";
         ServerStatistic.DoRequest(command);
     }
 }
예제 #21
0
    void Start()
    {
        userScore = UserScoreData.Load();

        UserSoundConfig config = UserSoundConfig.Load();

        for (int i = 0; i < audioSourcesEffect.Length; i++)
        {
            audioSourcesEffect[i].volume = config.SoundVolume;
            audioSourcesEffect[i].mute   = !config.SoundStatus;
        }

        SceneCommunication       sceneCommunication = new SceneCommunication(SceneName.ChoosePlace);
        List <CommunicationData> dataRecieveds      = sceneCommunication.RetrieveMessages();

        if (dataRecieveds.Count > 0 && (dataRecieveds[0].Sender == SceneName.ChooseLevelParbaba || dataRecieveds[0].Sender == SceneName.ChooseLevelBatuguru || dataRecieveds[0].Sender == SceneName.ChooseLevelParapat || dataRecieveds[0].Sender == SceneName.ChooseLevelTomok))
        {
            FirstSelected = (string)dataRecieveds[0].Data;
        }

        if (FirstSelected == "Parbaba")
        {
            PanelItem.GetComponent <RectTransform>().localPosition = new Vector3(715, PanelItem.GetComponent <RectTransform>().localPosition.y, PanelItem.GetComponent <RectTransform>().localPosition.z);
        }
        else if (FirstSelected == "Batuguru")
        {
            PanelItem.GetComponent <RectTransform>().localPosition = new Vector3(276, PanelItem.GetComponent <RectTransform>().localPosition.y, PanelItem.GetComponent <RectTransform>().localPosition.z);
        }
        else if (FirstSelected == "Parapat")
        {
            PanelItem.GetComponent <RectTransform>().localPosition = new Vector3(-227, PanelItem.GetComponent <RectTransform>().localPosition.y, PanelItem.GetComponent <RectTransform>().localPosition.z);
        }
        else if (FirstSelected == "Tomok")
        {
            PanelItem.GetComponent <RectTransform>().localPosition = new Vector3(-673, PanelItem.GetComponent <RectTransform>().localPosition.y, PanelItem.GetComponent <RectTransform>().localPosition.z);
        }

        string command = "{";

        command += "action:OPEN_CHOOSEPLACE";
        command += "}";
        ServerStatistic.DoRequest(command);
    }
    private void UseBubble(List <Gelembung> daftarGelembung)
    {
        int WhiteBubble  = 0;
        int RedBubble    = 0;
        int OrangeBubble = 0;

        foreach (Gelembung gel in daftarGelembung)
        {
            if (gel.Type == BubbleType.White)
            {
                WhiteBubble++;
            }
            else if (gel.Type == BubbleType.Red)
            {
                RedBubble++;
            }
            else if (gel.Type == BubbleType.Orange)
            {
                OrangeBubble++;
            }
        }
        UserStockData data = UserStockData.Load();

        data.PlusMinBubble(-WhiteBubble, -RedBubble, -OrangeBubble);

        //Statistik
        string command = "{";

        command += "action:PlAY_LEVEL";
        command += ",place:" + dataStaticLevel.Place;
        command += ",level:" + dataStaticLevel.Level;
        command += ",status:3_RELOAD";
        command += ",WhiteBubble:" + WhiteBubble;
        command += ",RedBubble:" + RedBubble;
        command += ",OrangeBubble:" + OrangeBubble;
        command += "}";
        ServerStatistic.DoRequest(command);
    }
예제 #23
0
    public void Success()
    {
        if (State != GameplayState.Success)
        {
            PlayManager.ScoreTime = (int)(1200 - (float.Parse(TimePlaying.ToString("F1")) * 10));
            PlayManager.Score    += PlayManager.ScoreTime;


            if (Score < 0)
            {
                Score = 0;
            }

            State = GameplayState.Success;
            if (Mode == GameplayMode.StaticLevel)
            {
                UserScoreData userScore         = UserScoreData.Load();
                int           BintangSebelumnya = userScore.GetStar(dataStaticLevel.Place, dataStaticLevel.Level);
                dataStaticLevel.HighScore = Score;

                if (Score >= dataStaticLevel.ScoreFor3Star)
                {
                    Bintang = 3;
                }
                else if (Score >= dataStaticLevel.ScoreFor2Star)
                {
                    Bintang = 2;
                }
                else
                {
                    Bintang = 1;
                }

                UserStockData     userStockDagta = UserStockData.Load();
                List <BubbleType> bubblesGet     = new List <BubbleType>();
                int maksGold = 0;;
                int goldGet  = 0;

                if (Bintang == 3 && BintangSebelumnya == 3)
                {
                    maksGold = (int)(Score / 100f);
                    goldGet  = maksGold;
                }
                else if (Bintang == 3 && BintangSebelumnya == 2)
                {
                    maksGold = (int)((Score / 100f) * 10);
                    goldGet  = (int)(maksGold * ((11 / 11f) - (5 / 11f)));
                }
                else if (Bintang == 3 && BintangSebelumnya == 1)
                {
                    maksGold = (int)((Score / 100f) * 10);
                    goldGet  = (int)(maksGold * ((11 / 11f) - (2 / 11f)));
                }
                else if (Bintang == 3 && BintangSebelumnya == 0)
                {
                    maksGold = (int)((Score / 100f) * 10);
                    goldGet  = (int)(maksGold * (11 / 11f));
                }
                else if (Bintang == 2 && BintangSebelumnya >= 2)
                {
                    maksGold = (int)(Score / 100f);
                    goldGet  = maksGold;
                }
                else if (Bintang == 2 && BintangSebelumnya == 1)
                {
                    maksGold = (int)((Score / 100f) * 10);
                    goldGet  = (int)(maksGold * ((5 / 11f) - (2 / 11f)));
                }
                else if (Bintang == 2 && BintangSebelumnya == 0)
                {
                    maksGold = (int)((Score / 100f) * 10);
                    goldGet  = (int)(maksGold * (5 / 11f));
                }
                else if (Bintang == 1 && BintangSebelumnya >= 1)
                {
                    maksGold = (int)(Score / 100f);
                    goldGet  = maksGold;
                }
                else if (Bintang == 1 && BintangSebelumnya == 0)
                {
                    maksGold = (int)((Score / 100f) * 10);
                    goldGet  = (int)(maksGold * (2 / 11f));
                }

                if (Bintang == 3)
                {
                    int indicator = Random.Range(1, 282);
                    if (indicator >= 1 && indicator <= 94)
                    {
                        bubblesGet.Add(BubbleType.White);
                    }
                    else if (indicator >= 95 && indicator <= 188)
                    {
                        bubblesGet.Add(BubbleType.Red);
                    }
                    else if (indicator >= 189 && indicator <= 282)
                    {
                        bubblesGet.Add(BubbleType.Orange);
                    }

                    indicator = Random.Range(1, 282);
                    if (indicator >= 1 && indicator <= 94)
                    {
                        bubblesGet.Add(BubbleType.White);
                    }
                    else if (indicator >= 95 && indicator <= 188)
                    {
                        bubblesGet.Add(BubbleType.Red);
                    }
                    else if (indicator >= 189 && indicator <= 282)
                    {
                        bubblesGet.Add(BubbleType.Orange);
                    }
                }
                else if (Bintang == 2)
                {
                    int indicator = Random.Range(1, 282);
                    if (indicator >= 1 && indicator <= 94)
                    {
                        bubblesGet.Add(BubbleType.White);
                    }
                    else if (indicator >= 95 && indicator <= 188)
                    {
                        bubblesGet.Add(BubbleType.Red);
                    }
                    else if (indicator >= 189 && indicator <= 282)
                    {
                        bubblesGet.Add(BubbleType.Orange);
                    }
                }

                dataStaticLevel.Save();
                userStockDagta.PlusMinGold(goldGet);

                int bubbleWhiteGet  = 0;
                int bubbleRedGet    = 0;
                int bubbleOrangeGet = 0;
                foreach (BubbleType typeGet in bubblesGet)
                {
                    if (typeGet == BubbleType.White)
                    {
                        userStockDagta.PlusMinBubble(1, 0, 0);
                        bubbleWhiteGet++;
                    }
                    else if (typeGet == BubbleType.Red)
                    {
                        userStockDagta.PlusMinBubble(0, 1, 0);
                        bubbleRedGet++;
                    }
                    else if (typeGet == BubbleType.Orange)
                    {
                        userStockDagta.PlusMinBubble(0, 0, 1);
                        bubbleOrangeGet++;
                    }
                }

                //Statistik
                string command = "{";
                command += "action:PlAY_LEVEL";
                command += ",place:" + dataStaticLevel.Place;
                command += ",level:" + dataStaticLevel.Level;
                command += ",status:4_SUCCESS";
                command += ",timePlaying:" + TimePlaying.ToString();
                if (FB.IsLoggedIn)
                {
                    command += ",facebook_id:" + FB.UserId;
                }
                command += ",score:" + Score;
                command += ",goldGet:" + goldGet;
                command += ",bubbleGetWhite:" + bubbleWhiteGet;
                command += ",bubbleGetRed:" + bubbleRedGet;
                command += ",bubbleGetOrange:" + bubbleOrangeGet;
                command += "}";
                ServerStatistic.DoRequest(command);

                successPopupController.ShowForPlayingStaticLevel(Score, Bintang, goldGet, bubblesGet, SuccessCallback);
            }
            else if (Mode == GameplayMode.Edited)
            {
                if (Score > dataLevel.ScoreFor3Star)
                {
                    Bintang = 3;
                }
                else if (Score > dataLevel.ScoreFor2Star)
                {
                    Bintang = 2;
                }
                else
                {
                    Bintang = 1;
                }

                successPopupController.ShowForPlayingEditedLevel(Score, Bintang, SuccessCallback);
                Debug.Log("Edited");
            }
            else if (Mode == GameplayMode.ValidateLevel)
            {
                if (Score > dataLevel.ScoreFor3Star)
                {
                    Bintang = 3;
                }
                else if (Score > dataLevel.ScoreFor2Star)
                {
                    Bintang = 2;
                }
                else
                {
                    Bintang = 1;
                }
                successPopupController.ShowForValidateLevel(Score, Bintang, SuccessCallback);
                Debug.Log("ValidateLevel");
            }
        }
        Debug.Log("Score Time :" + PlayManager.ScoreTime);
        Debug.Log("Time Playing :" + TimePlaying);
        Debug.Log("Time Playing dengan 1 Decimal:" + float.Parse(TimePlaying.ToString("F1")) * 10);
    }
예제 #24
0
    private void YesToBuy()
    {
        UserStockData userStock = UserStockData.Load();

        UserItemStock userItems = new UserItemStock();

        userItems.Load();

        if (Payment == PaymentType.Gem)
        {
            if (userStock.PlusMinGem(-Price))
            {
                for (int i = 0; i < ItemAlias.Length; i++)
                {
                    userItems.Add(ItemAlias);
                }
                messagePopup.Show("You have bought " + Name);

                string command = "{";
                command += "action:BUY_ITEM";
                command += ",item:" + Name;
                command += "}";
                ServerStatistic.DoRequest(command);

                if (UserItemStock.Items.Contains(ItemAlias[0]))
                {
                    textPrice.text = "Bought";
                    EffectedItem.SetActive(true);
                }
            }
            else
            {
                messagePopup.Show("You need " + (Price - userStock.Gems) + " more pearls!");
            }
        }
        else if (Payment == PaymentType.Gold)
        {
            if (userStock.PlusMinGold(-Price))
            {
                for (int i = 0; i < ItemAlias.Length; i++)
                {
                    userItems.Add(ItemAlias[i]);
                }
                messagePopup.Show("You have bought " + Name);

                string command = "{";
                command += "action:BUY_ITEM";
                command += ",item:" + Name;
                command += "}";
                ServerStatistic.DoRequest(command);

                if (UserItemStock.Items.Contains(ItemAlias[0]))
                {
                    textPrice.text = "Bought";
                    EffectedItem.SetActive(true);
                }
                //gameObject.SetActive(!UserItemStock.Items.Contains(ItemAlias[0]));
            }
            else
            {
                messagePopup.Show("You need " + (Price - userStock.Gold) + " more coins!");
            }
        }
    }