コード例 #1
0
    public void InputProyek()
    {
        if (RABProyekInput.text == "")
        {
            RABProyek = 0;
        }
        else
        {
            LanjutProyek.interactable = true;
            RABProyek = float.Parse(RABProyekInput.text);
        }



        if (RABProyek < 1000000000 && RABProyek != 0)
        {
            FloatingRAB.SetActive(true);
            FloatingRAB.GetComponent <Image>().color = Color.red;
            TextFloatingRAB.color     = Color.white;
            TextFloatingRAB.text      = "RAB : Rp. " + RABProyek.ToString("N0", new CultureInfo("id-ID")) + " \nMinimal: Rp. 1.000.000.000";
            LanjutProyek.interactable = false;
        }
        else if (RABProyekInput.interactable == true && RABProyek >= 1000000000)
        {
            FloatingRAB.SetActive(true);

            FloatingRAB.GetComponent <Image>().color = Color.white;
            TextFloatingRAB.color = Color.black;
            TextFloatingRAB.text  = "RAB: Rp. " + RABProyek.ToString("N0", new CultureInfo("id-ID"));
        }
        if (RABProyek >= 10000000000)
        {
            //nilai maks
            RABProyek           = 10000000000;
            RABProyekInput.text = "10000000000";
            FloatingRAB.SetActive(true);
            FloatingRAB.GetComponent <Image>().color = Color.black;
            TextFloatingRAB.color = Color.yellow;
            TextFloatingRAB.text  = "RAB : Rp. " + RABProyek.ToString("N0", new CultureInfo("id-ID")) + " \nMaksimal: Rp. 10.000.000.000";
        }

        KeuntunganProyek = (float)0.1d * RABProyek;
        RAPProyek        = (float)0.9d * RABProyek;

        if (RABProyek == 10000000000)
        {
            RAPProyekText.text = "9.000.000.000";
        }
        else
        {
            RAPProyekText.text = RAPProyek.ToString("N0", new CultureInfo("id-ID"));
        }
        KeuntunganProyekText.text = KeuntunganProyek.ToString("N0", new CultureInfo("id-ID"));
    }
コード例 #2
0
 public void CheckRABProyek()
 {
     if (PlayerPrefs.HasKey("danaAwal") && PlayerPrefs.GetFloat("danaAwal") > 0)
     { //Pernah mengisi sebelumnya
         KeuntunganProyek          = PlayerPrefs.GetFloat("danaAwal");
         KeuntunganProyekText.text = KeuntunganProyek.ToString("N0", new CultureInfo("id-ID"));
         LockInputProyek();
         RABProyek           = PlayerPrefs.GetFloat("DanaTotalProyek");
         RABProyekInput.text = RABProyek.ToString("N0");
         if (RABProyek == 10000000000)
         {
             RAPProyekText.text = "9.000.000.000";
         }
         else
         {
             RAPProyekText.text = RAPProyek.ToString("N0", new CultureInfo("id-ID"));
         }
         RAPProyek = 0.9f * RABProyek;
     }
     if (RABProyek < 1000000000)
     {
         LanjutProyek.interactable = false;
     }
     else
     {
         LanjutProyek.interactable = true;
     }
     if (RABPekerjaan < 100000000)
     {
         LanjutPekerjaan.interactable = false;
     }
     else
     {
         LanjutPekerjaan.interactable = true;
     }
     if (RABProyekInput.interactable == false)
     {
         FloatingRAB.SetActive(false);
     }
 }