Exemplo n.º 1
0
    void CheckVechaleLockStats()
    {
        if (PlayerPrefs.GetInt("currentVehicle" + currentVehicle) == 1)
        {
            BuyWacthBtn.SetActive(false);
            BuyBtn.SetActive(false);
            LockBtn.SetActive(false);
            PlayBtn.SetActive(true);
        }
        else
        {
            BuyBtn.SetActive(true);
            LockBtn.SetActive(true);
            PlayBtn.SetActive(false);
            int[] price = { 0, 5000, 10000, 15000, 20000, 30000, 40000, 50000, 60000, 70000, 80000 };
            BuyPrice          = price[currentVehicle];
            BuyPrefab         = "currentVehicle" + currentVehicle.ToString();
            BuyPriceText.text = BuyPrice.ToString();
        }

        checkColorLockStats();
        checkDecalLockStats();
        checkRimsLockStats();
        StartVehicleStats();
    }
Exemplo n.º 2
0
 public void StartVehicleStats()
 {
     FristRimColor();//diffrent vehical set rim ui & value Inspactor,set color ui & value Inspactor
     if (PlayerPrefs.GetString("Vehicle Plate" + currentVehicle) != null)
     {
         VehiclePlateNo[currentVehicle].FrontPlate.text = PlayerPrefs.GetString("Vehicle Plate" + currentVehicle);
         VehiclePlateNo[currentVehicle].BackPlate.text  = PlayerPrefs.GetString("Vehicle Plate" + currentVehicle);
     }
     if (PlayerPrefs.GetInt("Vehicle" + currentVehicle + "Color" + PlayerPrefs.GetInt("ColorSelected")) == 1)
     {
         BodyMaterial[currentVehicle].color = BodyColors[PlayerPrefs.GetInt("ColorSelected")];
     }
     if (PlayerPrefs.GetInt("Vehicle" + currentVehicle + "Rim" + PlayerPrefs.GetInt("RimSelected")) == 1)
     {
         RimsMaterial[currentVehicle].mainTexture = RimsTextures[PlayerPrefs.GetInt("RimSelected")];
     }
     if (PlayerPrefs.GetInt("Vehicle" + currentVehicle + "Decal" + PlayerPrefs.GetInt("DecalSelected")) == 1 && PlayerPrefs.GetInt("DefultBodyTexture") != 1)
     {
         BodyMaterial[currentVehicle].color       = Color.white;
         BodyMaterial[currentVehicle].mainTexture = DacelsTexture[PlayerPrefs.GetInt("DecalSelected")];
     }
     else
     {
         BodyMaterial[currentVehicle].mainTexture = defultBodyTexture[currentVehicle];
     }
     if (PlayerPrefs.GetInt("currentVehicle" + currentVehicle) == 1)
     {
         BuyWacthBtn.SetActive(false);
         BuyBtn.SetActive(false);
         PlayBtn.SetActive(true);
     }
 }
Exemplo n.º 3
0
 void BuyBtnActive(int index)
 {
     if (index == 2 || index == 5 || index == 9)
     {
         BuyWacthBtn.SetActive(true);
         BuyBtn.SetActive(false);
     }
     else
     {
         BuyWacthBtn.SetActive(false);
         BuyBtn.SetActive(true);
     }
 }
Exemplo n.º 4
0
    public void SelectDecals(int index)
    {
        if (index == -1)
        {
            PlayerPrefs.SetInt("DefultBodyTexture", 1);
            StartVehicleStats();
            return;
        }

        BodyMaterial[currentVehicle].color = Color.white;
        BodyMaterial[currentVehicle].SetTexture("_MainTex", DacelsTexture[index]);
        if (PlayerPrefs.GetInt("Vehicle" + currentVehicle + "Decal" + index) == 1)
        {
            PlayerPrefs.SetInt("DefultBodyTexture", 0);
            PlayerPrefs.SetInt("DecalSelected", index);
            BuyWacthBtn.SetActive(false);
            BuyBtn.SetActive(false);
            PlayBtn.SetActive(true);
            for (int i = 0; i < DecalsTick.Length; i++)
            {
                if (i == index)
                {
                    DecalsTick[i].SetActive(true);
                }
                else
                {
                    DecalsTick[i].SetActive(false);
                }
            }
        }
        else
        {
            BuyBtnActive(index);
            PlayBtn.SetActive(false);
            BuyIndex          = index;
            BuyPrice          = 500;
            BuyPrefab         = "Vehicle" + currentVehicle + "Decal" + index.ToString();
            BuyPriceText.text = BuyPrice.ToString();
        }
        IAPdecal++;
        if (IAPdecal >= 3 && PlayerPrefs.GetInt("purchased_all_Decals") != 1)
        {
            IAPdecal = 0;
            PanalOpen(AllDecalsPanal);
        }
    }
Exemplo n.º 5
0
    public void CheckIAPAll()
    {
        if (PlayerPrefs.GetInt("purchased_all_paints") == 1)
        {
            for (int v = 0; v < playerVehicles.Length; v++)
            {
                for (int i = 0; i < ColorLock.Length; i++)
                {
                    ColorLock[i].SetActive(false);
                    PlayerPrefs.SetInt("Vehicle" + v + "Color" + i, 1);
                }
            }
            BuyBtn.SetActive(false);
            BuyWacthBtn.SetActive(false);
            PlayBtn.SetActive(true);
            LockBtn.SetActive(false);
        }

        if (PlayerPrefs.GetInt("purchased_all_rims") == 1)
        {
            for (int v = 0; v < playerVehicles.Length; v++)
            {
                for (int i = 0; i < RimLock.Length; i++)
                {
                    RimLock[i].SetActive(false);
                    PlayerPrefs.SetInt("Vehicle" + v + "Rim" + i, 1);
                }
            }
            BuyBtn.SetActive(false);
            BuyWacthBtn.SetActive(false);
            PlayBtn.SetActive(true);
            LockBtn.SetActive(false);
        }
        if (PlayerPrefs.GetInt("purchased_all_parado") == 1)
        {
            for (int i = 0; i < playerVehicles.Length; i++)
            {
                PlayerPrefs.SetInt("currentVehicle" + i, 1);
            }
            BuyWacthBtn.SetActive(false);
            BuyBtn.SetActive(false);
            PlayBtn.SetActive(true);
            LockBtn.SetActive(false);
        }
    }
Exemplo n.º 6
0
 public void SelectColor(int index)
 {
     if (BodyMaterial[currentVehicle].mainTexture != defultBodyTexture[currentVehicle])
     {
         PanalOpen(DecalRemovePanal);
         return;
     }
     BodyMaterial[currentVehicle].color = BodyColors[index];
     if (PlayerPrefs.GetInt("Vehicle" + currentVehicle + "Color" + index) == 1)
     {
         PlayerPrefs.SetInt("ColorSelected", index);
         BuyWacthBtn.SetActive(false);
         BuyBtn.SetActive(false);
         PlayBtn.SetActive(true);
         for (int i = 0; i < Colortick.Length; i++)
         {
             if (i == index)
             {
                 Colortick[i].SetActive(true);
             }
             else
             {
                 Colortick[i].SetActive(false);
             }
         }
     }
     else
     {
         BuyBtnActive(index);
         PlayBtn.SetActive(false);
         BuyIndex          = index;
         BuyPrice          = 500;
         BuyPrefab         = "Vehicle" + currentVehicle + "Color" + index.ToString();
         BuyPriceText.text = BuyPrice.ToString();
     }
     IApColor++;
     if (IApColor >= 3 && PlayerPrefs.GetInt("purchased_all_paints") != 1)
     {
         IApColor = 0;
         PanalOpen(AllColorPanal);
     }
 }
Exemplo n.º 7
0
 public void BuyBtnFun(string CallerName)
 {
     if (PlayerPrefs.GetInt("cash") >= BuyPrice || CallerName == "WacthVideo")
     {
         if (CallerName != "WacthVideo")
         {
             PlayerPrefs.SetInt("cash", PlayerPrefs.GetInt("cash") - BuyPrice);
             main_menu.instance.ShowCash();
         }
         PlayerPrefs.SetInt(BuyPrefab, 1);
         if (BuyPrefab == "Vehicle" + currentVehicle + "Rim" + BuyIndex)
         {
             checkRimsLockStats();
             SelectRims(BuyIndex);
         }
         else
         if (BuyPrefab == "Vehicle" + currentVehicle + "Color" + BuyIndex)
         {
             checkColorLockStats();
             SelectColor(BuyIndex);
         }
         else
         if (BuyPrefab == "Vehicle" + currentVehicle + "Decal" + BuyIndex)
         {
             checkDecalLockStats();
             SelectDecals(BuyIndex);
         }
         BuyBtn.SetActive(false);
         BuyWacthBtn.SetActive(false);
         PlayBtn.SetActive(true);
         LockBtn.SetActive(false);
     }
     else
     {
         PanalOpen(NotEnoughCoins);
     }
 }
Exemplo n.º 8
0
 public void SelectRims(int index)
 {
     RimsMaterial[currentVehicle].SetTexture("_MainTex", RimsTextures[index]);
     if (PlayerPrefs.GetInt("Vehicle" + currentVehicle + "Rim" + index) == 1)
     {
         PlayerPrefs.SetInt("RimSelected", index);
         BuyWacthBtn.SetActive(false);
         BuyBtn.SetActive(false);
         PlayBtn.SetActive(true);
         for (int i = 0; i < RimTick.Length; i++)
         {
             if (i == index)
             {
                 RimTick[i].SetActive(true);
             }
             else
             {
                 RimTick[i].SetActive(false);
             }
         }
     }
     else
     {
         BuyBtnActive(index);
         PlayBtn.SetActive(false);
         BuyIndex          = index;
         BuyPrice          = 500;
         BuyPrefab         = "Vehicle" + currentVehicle + "Rim" + index.ToString();
         BuyPriceText.text = BuyPrice.ToString();
     }
     IAPRim++;
     if (IAPRim >= 3 && PlayerPrefs.GetInt("purchased_all_rims") != 1)
     {
         IAPRim = 0;
         PanalOpen(AllRimPanal);
     }
 }