using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class NewBehaviourScript :
MonoBehaviour
{
Text mytxt;
Text mytxt1;
Text ctxt;
Text ctxt1;
Text ctxt2;
Text ctxt3;
Text ctxt4;
Text ctxt5;
Text ctxt6;
Text ctxt7;
Text ctxt8;
Text ctxt9;
Text c1txt;
Text c2txt;
Text c3txt;
Text c4txt;
Text c5txt;
Text c6txt;
Text c7txt;
Text c8txt;
Text c9txt;
Text c10txt;
int Mmoney = 0;
int cmoney1 = 0;
int cmoney2 = 0;
int cmoney3 = 0;
int cmoney4 = 0;
int cmoney5 = 0;
int cmoney6 = 0;
int cmoney7 = 0;
int cmoney8 = 0;
int cmoney9 = 0;
int cmoney10 = 0;
// Use this for initialization
void Start()
{
Mmoney = 138;
mytxt =
GameObject.Find("Canvas/Panel/Button/Text").GetComponent<Text>();
mytxt1 =
GameObject.Find("Canvas/Panel/Button1/Text").GetComponent<Text>();
ctxt = GameObject.Find("Canvas/Panel/Text").GetComponent<Text>();
ctxt1 =
GameObject.Find("Canvas/Panel/Text1").GetComponent<Text>();
ctxt2 =
GameObject.Find("Canvas/Panel/Text2").GetComponent<Text>();
ctxt3 =
GameObject.Find("Canvas/Panel/Text3").GetComponent<Text>();
ctxt4 = GameObject.Find("Canvas/Panel/Text4").GetComponent<Text>();
ctxt5 =
GameObject.Find("Canvas/Panel/Text5").GetComponent<Text>();
ctxt6 =
GameObject.Find("Canvas/Panel/Text6").GetComponent<Text>();
ctxt7 = GameObject.Find("Canvas/Panel/Text7").GetComponent<Text>();
ctxt8 =
GameObject.Find("Canvas/Panel/Text8").GetComponent<Text>();
ctxt9 =
GameObject.Find("Canvas/Panel/Text9").GetComponent<Text>();
c1txt =
GameObject.Find("Canvas/Panel/Button2/Text").GetComponent<Text>();
c2txt =
GameObject.Find("Canvas/Panel/Button3/Text").GetComponent<Text>();
c3txt =
GameObject.Find("Canvas/Panel/Button4/Text").GetComponent<Text>();
c4txt =
GameObject.Find("Canvas/Panel/Button5/Text").GetComponent<Text>();
c5txt =
GameObject.Find("Canvas/Panel/Button6/Text").GetComponent<Text>();
c6txt =
GameObject.Find("Canvas/Panel/Button7/Text").GetComponent<Text>();
c7txt =
GameObject.Find("Canvas/Panel/Button8/Text").GetComponent<Text>();
c8txt =
GameObject.Find("Canvas/Panel/Button9/Text").GetComponent<Text>();
c9txt =
GameObject.Find("Canvas/Panel/Button10/Text").GetComponent<Text>();
c10txt =
GameObject.Find("Canvas/Panel/Button11/Text").GetComponent<Text>();
Image img6 =
GameObject.Find("Image6").GetComponent<Image>();
Image img7 =
GameObject.Find("Image7").GetComponent<Image>();
Image img8 =
GameObject.Find("Image8").GetComponent<Image>();
Image img9 = GameObject.Find("Image9").GetComponent<Image>();
Image img10 =
GameObject.Find("Image10").GetComponent<Image>();
Image img11 =
GameObject.Find("Image11").GetComponent<Image>();
Image img12 =
GameObject.Find("Image12").GetComponent<Image>();
Image img13 = GameObject.Find("Image13").GetComponent<Image>();
Image img14 =
GameObject.Find("Image14").GetComponent<Image>();
Image img15 =
GameObject.Find("Image15").GetComponent<Image>();
Image img16 = GameObject.Find("Image16").GetComponent<Image>();
Image img17 =
GameObject.Find("Image17").GetComponent<Image>();
Image img18 =
GameObject.Find("Image18").GetComponent<Image>();
Image img19 =
GameObject.Find("Image19").GetComponent<Image>();
Image img20 = GameObject.Find("Image20").GetComponent<Image>();
Image img21 =
GameObject.Find("Image21").GetComponent<Image>();
Image img22 =
GameObject.Find("Image22").GetComponent<Image>();
Image img23 =
GameObject.Find("Image23").GetComponent<Image>();
Image img24 =
GameObject.Find("Image24").GetComponent<Image>();
Image img25 =
GameObject.Find("Image25").GetComponent<Image>();
Image img26 =
GameObject.Find("Image26").GetComponent<Image>();
Image img27 = GameObject.Find("Image27").GetComponent<Image>();
Image img28 =
GameObject.Find("Image28").GetComponent<Image>();
Image img29 =
GameObject.Find("Image29").GetComponent<Image>();
}
// Update is called once per frame
void Update()
{
mytxt.text = Mmoney.ToString();
c1txt.text = cmoney1.ToString();
c2txt.text = cmoney2.ToString();
c3txt.text = cmoney3.ToString();
c4txt.text = cmoney4.ToString();
c5txt.text = cmoney5.ToString();
c6txt.text = cmoney6.ToString();
c7txt.text = cmoney7.ToString();
c8txt.text = cmoney8.ToString();
c9txt.text = cmoney9.ToString();
c10txt.text = cmoney10.ToString();
}
public void myfun()
{
Mmoney = Mmoney + 1;
}
public void mygame()
{
int rnum;
rnum = Random.Range(0, 24);
mytxt1.text = rnum.ToString();
if (rnum == 0)
{
cmoney1 = 0;
cmoney2 = 0;
cmoney3 = 0;
cmoney4 = 0;
cmoney5 = 0;
cmoney6 = 0;
cmoney7 = 0;
cmoney8 = 0;
cmoney9 = 0;
cmoney10 = cmoney10 * 5;
Mmoney = Mmoney + cmoney10;
cmoney10 = cmoney10 - cmoney10;
Image img6 =
GameObject.Find("Image6").GetComponent<Image>();
img6.color = new Color(1.0F, 0.0F, 0.0F, 1.0F); // (紅red,綠green,藍blue,透明)
}
else if (rnum == 1)
{
cmoney1 = 0;
cmoney2 = 0;
cmoney3 = 0;
cmoney4 = 0;
cmoney5 = 0;
cmoney6 = 0;
cmoney7 = 0;
cmoney8 = 0;
cmoney9 = cmoney9 * 25;
cmoney10 = 0;
Mmoney = Mmoney + cmoney9;
cmoney9 = cmoney9 - cmoney9;
Image img7 =
GameObject.Find("Image7").GetComponent<Image>();
img7.color = new Color(1.0F, 0.0F, 0.0F, 1.0F); // (紅red,綠green,藍blue,透明)
}
else if (rnum == 2)
{
cmoney1 = 0;
cmoney2 = 0;
cmoney3 = 0;
cmoney4 = 0;
cmoney5 = 0;
cmoney6 = 0;
cmoney7 = 0;
cmoney8 = cmoney8 * 20;
cmoney9 = 0;
cmoney10 = 0;
Mmoney = Mmoney + cmoney8;
cmoney8 = cmoney8 - cmoney8;
Image img8 =
GameObject.Find("Image8").GetComponent<Image>();
img8.color = new Color(1.0F, 0.0F, 0.0F, 1.0F); // (紅red,綠green,藍blue,透明)
}
else if (rnum == 3)
{
cmoney1 = cmoney1 * 2;
cmoney2 = 0;
cmoney3 = 0;
cmoney4 = 0;
cmoney5 = 0;
cmoney6 = 0;
cmoney7 = 0;
cmoney8 = 0;
cmoney9 = 0;
cmoney10 = 0;
Mmoney = Mmoney + cmoney1;
cmoney1 = cmoney1 - cmoney1;
Image img9 =
GameObject.Find("Image9").GetComponent<Image>();
img9.color = new Color(1.0F, 0.0F, 0.0F, 1.0F); // (紅red,綠green,藍blue,透明)
}
else if (rnum == 4)
{
cmoney1 = 0;
cmoney2 = 0;
cmoney3 = 0;
cmoney4 = 0;
cmoney5 = 0;
cmoney6 = 0;
cmoney7 = 0;
cmoney8 = 0;
cmoney9 = 0;
cmoney10 = cmoney10 * 5;
Mmoney = Mmoney + cmoney10;
cmoney10 = cmoney10 - cmoney10;
Image img10 = GameObject.Find("Image10").GetComponent<Image>();
img10.color = new Color(1.0F, 0.0F, 0.0F, 1.0F); // (紅red,綠green,藍blue,透明)
}
else if (rnum == 5)
{
cmoney1 = cmoney1 * 2;
cmoney2 = 0;
cmoney3 = 0;
cmoney4 = 0;
cmoney5 = 0;
cmoney6 = 0;
cmoney7 = 0;
cmoney8 = 0;
cmoney9 = 0;
cmoney10 = 0;
Mmoney = Mmoney + cmoney1;
cmoney1 = cmoney1 - cmoney1;
Image img11 =
GameObject.Find("Image11").GetComponent<Image>();
img11.color = new Color(1.0F, 0.0F, 0.0F, 1.0F); // (紅red,綠green,藍blue,透明)
}
else if (rnum == 6)
{
cmoney1 = 0;
cmoney2 = 0;
cmoney3 = 0;
cmoney4 = cmoney4 * 20;
cmoney5 = 0;
cmoney6 = 0;
cmoney7 = 0;
cmoney8 = 0;
cmoney9 = 0;
cmoney10 = 0;
Mmoney = Mmoney + cmoney4;
cmoney4 = cmoney4 - cmoney4;
Image img12 =
GameObject.Find("Image12").GetComponent<Image>();
img12.color = new Color(1.0F, 0.0F, 0.0F, 1.0F); // (紅red,綠green,藍blue,透明)
}
else if (rnum == 7)
{
cmoney1 = 0;
cmoney2 = cmoney2 * 10;
cmoney3 = 0;
cmoney4 = 0;
cmoney5 = 0;
cmoney6 = 0;
cmoney7 = 0;
cmoney8 = 0;
cmoney9 = 0;
cmoney10 = 0;
Mmoney = Mmoney + cmoney2;
cmoney2 = cmoney2 - cmoney2;
Image img13 =
GameObject.Find("Image13").GetComponent<Image>();
img13.color = new Color(1.0F, 0.0F, 0.0F, 1.0F); // (紅red,綠green,藍blue,透明)
}
else if (rnum == 8)
{
cmoney1 = 0;
cmoney2 = 0;
cmoney3 = 0;
cmoney4 = 0;
cmoney5 = 0;
cmoney6 = cmoney6 * 100;
cmoney7 = 0;
cmoney8 = 0;
cmoney9 = 0;
cmoney10 = 0;
Mmoney = Mmoney + cmoney6;
cmoney6 = cmoney6 - cmoney6;
Image img14 =
GameObject.Find("Image14").GetComponent<Image>();
img14.color = new Color(1.0F, 0.0F, 0.0F, 1.0F); // (紅red,綠green,藍blue,透明)
}
else if (rnum == 9)
{
cmoney1 = 0;
cmoney2 = 0;
cmoney3 = cmoney3 * 15;
cmoney4 = 0;
cmoney5 = 0;
cmoney6 = 0;
cmoney7 = 0;
cmoney8 = 0;
cmoney9 = 0;
cmoney10 = 0;
Mmoney = Mmoney + cmoney3;
cmoney3 = cmoney3 - cmoney3;
Image img15 =
GameObject.Find("Image15").GetComponent<Image>();
img15.color = new Color(1.0F, 0.0F, 0.0F, 1.0F); // (紅red,綠green,藍blue,透明)
}
else if (rnum == 10)
{
cmoney1 = cmoney1 * 2;
cmoney2 = 0;
cmoney3 = 0;
cmoney4 = 0;
cmoney5 = 0;
cmoney6 = 0;
cmoney7 = 0;
cmoney8 = 0;
cmoney9 = 0;
cmoney10 = 0;
Mmoney = Mmoney + cmoney1;
cmoney1 = cmoney1 - cmoney1;
Image img16 = GameObject.Find("Image16").GetComponent<Image>();
img16.color = new Color(1.0F, 0.0F, 0.0F, 1.0F); // (紅red,綠green,藍blue,透明)
}
else if (rnum == 11)
{
cmoney1 = cmoney1 * 2;
cmoney2 = 0;
cmoney3 = 0;
cmoney4 = 0;
cmoney5 = 0;
cmoney6 = 0;
cmoney7 = 0;
cmoney8 = 0;
cmoney9 = 0;
cmoney10 = 0;
Mmoney = Mmoney + cmoney1;
cmoney1 = cmoney1 - cmoney1;
Image img17 =
GameObject.Find("Image17").GetComponent<Image>();
img17.color = new Color(1.0F, 0.0F, 0.0F, 1.0F); // (紅red,綠green,藍blue,透明)
}
else if (rnum == 12)
{
cmoney1 = 0;
cmoney2 = 0;
cmoney3 = 0;
cmoney4 = 0;
cmoney5 = 0;
cmoney6 = 0;
cmoney7 = 0;
cmoney8 = 0;
cmoney9 = 0;
cmoney10 = cmoney10 * 5;
Mmoney = Mmoney + cmoney10;
cmoney10 = cmoney10 - cmoney10;
Image img18 =
GameObject.Find("Image18").GetComponent<Image>();
img18.color = new Color(1.0F, 0.0F, 0.0F, 1.0F); // (紅red,綠green,藍blue,透明)
}
else if (rnum == 13)
{
cmoney1 = cmoney1 * 2;
cmoney2 = 0;
cmoney3 = 0;
cmoney4 = 0;
cmoney5 = 0;
cmoney6 = 0;
cmoney7 = 0;
cmoney8 = 0;
cmoney9 = 0;
cmoney10 = 0;
Mmoney = Mmoney + cmoney1;
cmoney1 = cmoney1 - cmoney1;
Image img19 =
GameObject.Find("Image19").GetComponent<Image>();
img19.color = new Color(1.0F, 0.0F, 0.0F, 1.0F); // (紅red,綠green,藍blue,透明)
}
else if (rnum == 14)
{
cmoney1 = 0;
cmoney2 = 0;
cmoney3 = 0;
cmoney4 = 0;
cmoney5 = 0;
cmoney6 = cmoney6 * 100;
cmoney7 = 0;
cmoney8 = 0;
cmoney9 = 0;
cmoney10 = 0;
Mmoney = Mmoney + cmoney6;
cmoney6 = cmoney6 - cmoney6;
Image img20 =
GameObject.Find("Image20").GetComponent<Image>();
img20.color = new Color(1.0F, 0.0F, 0.0F, 1.0F); // (紅red,綠green,藍blue,透明)
}
else if (rnum == 15)
{
cmoney1 = 0;
cmoney2 = cmoney2 * 10;
cmoney3 = 0;
cmoney4 = 0;
cmoney5 = 0;
cmoney6 = 0;
cmoney7 = 0;
cmoney8 = 0;
cmoney9 = 0;
cmoney10 = 0;
Mmoney = Mmoney + cmoney2;
cmoney2 = cmoney2 - cmoney2;
Image img21 = GameObject.Find("Image21").GetComponent<Image>();
img21.color = new Color(1.0F, 0.0F, 0.0F, 1.0F); // (紅red,綠green,藍blue,透明)
}
else if (rnum == 16)
{
cmoney1 = 0;
cmoney2 = 0;
cmoney3 = 0;
cmoney4 = cmoney4 * 20;
cmoney5 = 0;
cmoney6 = 0;
cmoney7 = 0;
cmoney8 = 0;
cmoney9 = 0;
cmoney10 = 0;
Mmoney = Mmoney + cmoney4;
cmoney4 = cmoney4 - cmoney4;
Image img22 =
GameObject.Find("Image22").GetComponent<Image>();
img22.color = new Color(1.0F, 0.0F, 0.0F, 1.0F); // (紅red,綠green,藍blue,透明)
}
else if (rnum == 17)
{
cmoney1 = cmoney1 * 2;
cmoney2 = 0;
cmoney3 = 0;
cmoney4 = 0;
cmoney5 = 0;
cmoney6 = 0;
cmoney7 = 0;
cmoney8 = 0;
cmoney9 = 0;
cmoney10 = 0;
Mmoney = Mmoney + cmoney1;
cmoney1 = cmoney1 - cmoney1;
Image img29 =
GameObject.Find("Image29").GetComponent<Image>();
img29.color = new Color(1.0F, 0.0F, 0.0F, 1.0F); // (紅red,綠green,藍blue,透明)
}
else if (rnum == 18)
{
cmoney1 = 0;
cmoney2 = cmoney2 * 10;
cmoney3 = 0;
cmoney4 = 0;
cmoney5 = 0;
cmoney6 = 0;
cmoney7 = 0;
cmoney8 = 0;
cmoney9 = 0;
cmoney10 = 0;
Mmoney = Mmoney + cmoney2;
cmoney2 = cmoney2 - cmoney2;
Image img28 =
GameObject.Find("Image28").GetComponent<Image>();
img28.color = new Color(1.0F, 0.0F, 0.0F, 1.0F); // (紅red,綠green,藍blue,透明)
}
else if (rnum == 19)
{
cmoney1 = 0;
cmoney2 = 0;
cmoney3 = 0;
cmoney4 = 0;
cmoney5 = 0;
cmoney6 = 0;
cmoney7 = 0;
cmoney8 = 0;
cmoney9 = 0;
cmoney10 = cmoney10 * 5;
Mmoney = Mmoney + cmoney10;
cmoney10 = cmoney10 - cmoney10;
Image img27 =
GameObject.Find("Image27").GetComponent<Image>();
img27.color = new Color(1.0F,
0.0F, 0.0F, 1.0F); // (紅red,綠green,藍blue,透明)
}
else if (rnum == 20)
{
cmoney1 = 0;
cmoney2 = 0;
cmoney3 = 0;
cmoney4 = 0;
cmoney5 = cmoney1 * 50;
cmoney6 = 0;
cmoney7 = 0;
cmoney8 = 0;
cmoney9 = 0;
cmoney10 = 0;
Mmoney = Mmoney + cmoney5;
cmoney5 = cmoney5 - cmoney5;
Image img26 = GameObject.Find("Image26").GetComponent<Image>();
img26.color = new Color(1.0F, 0.0F, 0.0F, 1.0F); // (紅red,綠green,藍blue,透明)
}
else if (rnum == 21)
{
cmoney1 = cmoney1 * 2;
cmoney2 = 0;
cmoney3 = 0;
cmoney4 = 0;
cmoney5 = 0;
cmoney6 = 0;
cmoney7 = 0;
cmoney8 = 0;
cmoney9 = 0;
cmoney10 =0;
Mmoney = Mmoney + cmoney1;
cmoney1 = cmoney1 - cmoney1;
Image img25 =
GameObject.Find("Image25").GetComponent<Image>();
img25.color = new Color(1.0F, 0.0F, 0.0F, 1.0F); // (紅red,綠green,藍blue,透明)
}
else if (rnum == 22)
{
cmoney1 = 0;
cmoney2 = 0;
cmoney3 = 0;
cmoney4 = 0;
cmoney5 = 0;
cmoney6 = 0;
cmoney7 = 0;
cmoney8 = 0;
cmoney9 = cmoney9 * 25;
cmoney10 = 0;
Mmoney = Mmoney + cmoney9;
cmoney9 = cmoney9 - cmoney9;
Image img24 =
GameObject.Find("Image24").GetComponent<Image>();
img24.color = new Color(1.0F, 0.0F, 0.0F, 1.0F); // (紅red,綠green,藍blue,透明)
}
else if (rnum == 23)
{
cmoney1 = 0;
cmoney2 = cmoney2 * 10;
cmoney3 = 0;
cmoney4 = 0;
cmoney5 = 0;
cmoney6 = 0;
cmoney7 = 0;
cmoney8 = 0;
cmoney9 = 0;
cmoney10 = 0;
Mmoney = Mmoney + cmoney2;
cmoney2 = cmoney2 - cmoney2;
Image img23 =
GameObject.Find("Image23").GetComponent<Image>();
img23.color = new Color(1.0F, 0.0F, 0.0F, 1.0F); // (紅red,綠green,藍blue,透明)
}
}
public void c1()
{
cmoney1 = cmoney1 + 1;
Mmoney = Mmoney - cmoney1;
}
public void c2()
{
cmoney2 = cmoney2 + 1;
Mmoney = Mmoney - cmoney2;
}
public
void c3()
{
cmoney3 = cmoney3 + 1;
Mmoney = Mmoney - cmoney3;
}
public void c4()
{
cmoney4 = cmoney4 + 1;
Mmoney = Mmoney - cmoney4;
}
public void c5()
{
cmoney5 = cmoney5 + 1;
Mmoney = Mmoney - cmoney5;
}
public void c6()
{
cmoney6 = cmoney6 + 1;
Mmoney = Mmoney - cmoney6;
}
public void c7()
{
cmoney7 = cmoney7 + 1;
Mmoney = Mmoney - cmoney7;
}
public void c8()
{
cmoney8 = cmoney8 + 1;
Mmoney = Mmoney - cmoney8;
}
public void c9()
{
cmoney9 = cmoney9 + 1;
Mmoney = Mmoney - cmoney9;
}
public void c10()
{
cmoney10 = cmoney10 + 1;
Mmoney = Mmoney - cmoney10;
}
}