Example #1
0
 public void MoreDiamond_Click()
 {
     print("Diamond click !");
     audioControl.PlaySound("Click 1");
     //AddDiamond(10);
     DialogInapp.ShowInapp();
 }
Example #2
0
    public void UseDiamond()
    {
        //audioControl.PlaySoundInstance("Click 1", false, false, 0.5f);

        if (Application.loadedLevelName.Equals("Town"))
        {
            audioControl.PlaySound("Click 1");
            if (!isEfect)
            {
                if (VariableSystem.diamond >= 1)
                {
                    Diamond_EfectClone = (GameObject)Instantiate(Diamond_EfectPrefabs, transform.position, transform.rotation);
                    Diamond_EfectClone.transform.parent        = transform;
                    Diamond_EfectClone.transform.localPosition = new Vector3(50, -50, 0);
                    Diamond_EfectClone.transform.localScale    = new Vector3(-1, 1, 1);
                    isEfect = true;
                    AddCommonObject(0, -1);
                }
                else
                {
                    DialogInapp.ShowInapp();
                }
            }
        }
    }
Example #3
0
    public void OK_Click()
    {
        Cancel_Click();
        if (VariableSystem.diamond >= price)
        {
            common.AddDiamond(-price);
            plantScript.farmCenter.isOpenCells[index] = true;

            plantScript.farmCenter.idNeedUpdate = index;
            plantScript.CreateAnimationDiamond(-price);

            int temp = index < 12 ? 1 : (index < 18 ? 2 : 3);
            for (int i = 0; i < MissionData.farmDataMission.fieldFarms.Count; i++)
            {
                if (MissionData.farmDataMission.fieldFarms[i].idField == temp)
                {
                    MissionData.farmDataMission.fieldFarms[i].currentNumber++;
                    break;
                }
            }
            if (VariableSystem.mission == 8 && CommonObjectScript.isGuide)
            {
                plantScript.guidefarmScript.NextGuideText();
                GetComponent <Animator>().Play("ClosePopup");
            }
        }
        else
        {
            DialogInapp.ShowInapp();
        }
    }
Example #4
0
    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();
        }
    }
Example #5
0
 public void SpinWheelLuck() // button Spin Click Event
 {
     this.gameObject.GetComponent <Animator>().enabled = false;
     if (isAgain)
     {
         if (!isSpinning)
         {
             audioControl.PlaySound("Quay xo so");
             isSpinning = true;
             isLight    = true;
             float zChange = Random.Range(-4150, -2000);
             LeanTween.rotateZ(wheelLuck, zChange, 5).setEase(LeanTweenType.easeInOutQuad).setOnComplete(delegate()
             {
                 isCompleteSpin = true;
                 isLight        = false;
             });
             SetStatusButtonSpin(false);
             DialogAchievement.AddDataAchievement(6, 1);
             MissionData.townDataMission.currentNumber += 1;
         }
         isAgain = false;
     }
     else
     {
         if (!isSpinning)
         {
             if (VariableSystem.diamond >= countSpin)
             {
                 audioControl.PlaySound("Quay xo so");
                 isSpinning = true;
                 isLight    = true;
                 float zChange = Random.Range(-4150, -2000);
                 LeanTween.rotateZ(wheelLuck, zChange, 5).setEase(LeanTweenType.easeInOutQuad).setOnComplete(delegate()
                 {
                     isCompleteSpin = true;
                     isLight        = false;
                 });
                 AddCommonObject(0, -countSpin);
                 countSpin++;
                 SetStatusButtonSpin(false);
                 DialogAchievement.AddDataAchievement(6, 1);
                 MissionData.townDataMission.currentNumber += 1;
             }
             else
             {
                 audioControl.PlaySound("Click 1");
                 DialogInapp.ShowInapp();
             }
         }
     }
     // SaveCountSpin();
 }
Example #6
0
 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();
     }
 }
Example #7
0
 public void OKButton_Click()
 {
     audioControl.PlaySound("Click 1");
     if (VariableSystem.diamond >= diamondChange)
     {
         //print("hieu ưng kim cuong va tien");
         AddCommonObject(coinAdd, -diamondChange);
     }
     else
     {
         // DialogInapp.ShowDialogInapp();
         DialogInapp.ShowInapp();
     }
     CancelButton_Click();
 }
 void ControlOKClick()
 {
     if (VariableSystem.diamond >= 1)
     {
         tempClick.GetComponent <ClickBackGround>().isUnLock = true;
         tempClick.GetComponent <ClickBackGround>().CreatLock();
         FactoryScenesController.listUnlockByPlayer.Add((6 - tempClick.GetComponent <ClickBackGround>().buttonBGID) % 6);
         AddCommonObject(0, -1);
         Instantiate(dinamondPrefabs, new Vector3(tempClick.transform.position.x + 0.7f, tempClick.transform.position.y + 0.9f, tempClick.transform.position.z), tempClick.transform.rotation);
         MissionData.factoryDataMission.positionUnlock.currentNumber += 1;
     }
     else
     {
         DialogInapp.ShowInapp();
     }
     gameObject.GetComponent <Animator>().Play("Invisible");
 }
Example #9
0
 public void BtnFaster_Click()
 {
     if (VariableSystem.diamond >= 1)
     {
         Diamond_EfectClone = (GameObject)Instantiate(Diamond_EfectPrefabs, transform.position, transform.rotation);
         Diamond_EfectClone.transform.parent        = transform;
         Diamond_EfectClone.transform.localPosition = new Vector3(50, -185, 0);
         Diamond_EfectClone.transform.localScale    = Vector3.one;
         shopcenter.countTimeTraining = 0;
         Diamond_EfectClone.GetComponent <DiamondEffectScript>().setValueDiamond(-1);
         shopcenter.Upgrade();
         frameTimer.SetActive(false);
         showTimer = false;
     }
     else
     {
         DialogInapp.ShowInapp();
     }
 }
Example #10
0
 void OnMouseUp()
 {
     if (!isClick)
     {
         if (VariableSystem.diamond >= 1)
         {
             if (machineSelected != null)
             {
                 Instantiate(dinamondPrefabs, new Vector3(machineSelected.transform.position.x - 0.1f, machineSelected.transform.position.y + 0.5f, machineSelected.transform.position.z), machineSelected.transform.rotation);
                 iconButon.transform.localScale = new Vector3(1.0f, 1.0f, 1.0f);
                 isClick = true;
                 AddCommonObject(0, -1);
             }
         }
         else
         {
             DialogInapp.ShowInapp();
         }
     }
 }
Example #11
0
    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();
            }
        });
    }
Example #12
0
 public void OKComfirm_ClickComfirm()
 {
     audioControl.PlaySound("Click 1");
     iDButtonComfirmApply = 1;
     panelCofirmApply.GetComponent <Animator>().Play("InVisible");
     if (!isApply)
     {
         if (idButton == 0 || idButton == 1)
         {
             if (CommonObjectScript.dollar >= TownScenesController.ListMaketResearchItem[idButtonItem].costCoin && VariableSystem.diamond >= TownScenesController.ListMaketResearchItem[idButtonItem].costDiamond)
             {
                 TownScenesController.townsBusy[3] = true;
                 if (idButtonItem > 4)
                 {
                     CreateTimer(TownScenesController.ListMaketResearchItem[idButtonItem].time);
                     DialogAchievement.AddDataAchievement(13, 1);
                 }
                 else
                 {
                     CreateTimer(0);
                     DialogAchievement.AddDataAchievement(14, 1);
                 }
                 AddCommonObject(-TownScenesController.ListMaketResearchItem[idButtonItem].costCoin, -TownScenesController.ListMaketResearchItem[idButtonItem].costDiamond);
                 VilageResearchController.ResetVilage();
             }
             else
             {
                 // print(TownScenesController.ListMaketResearchItem[idButtonItem].costCoin + "aaaaaaaaaaaaaa");
                 if (TownScenesController.ListMaketResearchItem[idButtonItem].costCoin != 0)
                 {
                     GameObject.Find("CommonObject").GetComponent <CommonObjectScript>().ChangeDolar(TownScenesController.ListMaketResearchItem[idButtonItem].costCoin - CommonObjectScript.dollar);
                 }
                 else
                 {
                     DialogInapp.ShowInapp();
                 }
             }
         }
         isApply = true;
     }
 }
Example #13
0
 public void AddDiamondButton()
 {
     AudioControl.DPlaySound("Click 1");
     //VariableSystem.diamond += 10;
     DialogInapp.ShowInapp();
 }
Example #14
0
    void EndEvenAnimation()
    {
        CommonObjectScript.isViewPoppup = false;
        if (!isCloseClick)
        {
            if (commonObject.transform.FindChild("Btn_Result").gameObject.activeInHierarchy)
            {
                panelCofirmApply.gameObject.SetActive(true);
                panelCofirmApply.GetComponent <Animator>().Play("Visible");
            }
            else
            {
                // print("tiennnnnnnnnnnnnnnnnnnn  " + TownScenesController.ListMaketResearchItem[idButtonItem].costCoin);
                //if (!isApply)
                {
                    if (idButton == 2)
                    {
                        commonObject.GetComponent <CommonObjectScript>().ResultButtonVisible();
                        commonObject.GetComponent <CommonObjectScript>().typeReasearch = 1;

                        //Application.LoadLevel("VilageResearch");
                        VilageResearchController.ResetVilage();
                        LoadingScene.ShowLoadingScene("VilageResearch", true);
                        DialogAchievement.AddDataAchievement(12, 1);
                    }
                    else if (idButton == 3)
                    {
                        maketPopup.gameObject.SetActive(true);
                    }
                    else
                    {
                        if (CommonObjectScript.dollar >= TownScenesController.ListMaketResearchItem[idButtonItem].costCoin && VariableSystem.diamond >= TownScenesController.ListMaketResearchItem[idButtonItem].costDiamond)
                        {
                            TownScenesController.townsBusy[3] = true;
                            if (idButtonItem > 4)
                            {
                                CreateTimer(TownScenesController.ListMaketResearchItem[idButtonItem].time);
                                DialogAchievement.AddDataAchievement(13, 1);
                            }
                            else
                            {
                                CreateTimer(0);
                                DialogAchievement.AddDataAchievement(14, 1);
                            }
                            AddCommonObject(-TownScenesController.ListMaketResearchItem[idButtonItem].costCoin, -TownScenesController.ListMaketResearchItem[idButtonItem].costDiamond);
                            VilageResearchController.ResetVilage();
                        }
                        else
                        {
                            if (TownScenesController.ListMaketResearchItem[idButtonItem].costCoin != 0)
                            {
                                GameObject.Find("CommonObject").GetComponent <CommonObjectScript>().ChangeDolar(TownScenesController.ListMaketResearchItem[idButtonItem].costCoin - CommonObjectScript.dollar);
                            }
                            else
                            {
                                DialogInapp.ShowInapp();
                            }
                        }
                        CreatTownScenesController.isDenyContinue = false;
                    }
                    //isApply = true;
                }
                this.gameObject.SetActive(false);
            }
        }
        else
        {
            this.gameObject.SetActive(false);
            CreatTownScenesController.isDenyContinue = false;
        }
    }