Ejemplo n.º 1
0
    void OnGUI()
    {
        GUIStyle mgui = new GUIStyle ();
        mgui.fontSize = 30;
        if (state==0) {
            GUI.DrawTexture(getRect(0.2,0.1,0.6,0.8),mtexture);
            cardno = GUI.TextField (getRect(0.3,0.03,0.2,0.04), cardno);
            q = GUI.TextField (getRect(0.25,0.16,0.06,0.04), q);
            cost = GUI.TextField (getRect(0.68,0.16,0.06,0.04), cost);
            cardname = GUI.TextField (getRect(0.4,0.16,0.2,0.04), cardname);
            life = GUI.TextField (getRect(0.33,0.65,0.08,0.04), life);
            hp = GUI.TextField (getRect(0.48,0.65,0.08,0.04), hp);
            atk = GUI.TextField (getRect(0.63,0.65,0.08,0.04), atk);
            if (GUI.Button (getRect(0.7,0.92,0.2,0.04), "save!!")) {
                save=true;
            }
            if (GUI.Button (getRect(0.82,0.3,0.16,0.2), "make attack")) {
                state=2;
            }
            if (GUI.Button (getRect(0.82,0.6,0.16,0.2), "make skill")) {
                state=1;
            }
            if (GUI.Button (getRect(0.02,0.6,0.16,0.2), "return")) {
                Application.LoadLevel("mainscreen");
            }
            GUI.color=Color.red;
            for(int i=0;i<6;i++){
                if(mattack[0].getattackrange()[i]!=0)
                    GUI.DrawTexture(getRect(0.266+0.0775*i,0.714,0.074,0.072),rectt);
            }
            if(mattack[0].getattackrange()[0]>1){
                GUI.Label(getRect(0.266,0.805,0.7,0.1),"연속공격 X "+mattack[0].getattackrange()[0].ToString(),mgui);
            }

            GUI.color=Color.white;
        }
        if (state == 1) {
            if (GUI.Button (getRect(0.455,0.20,0.06,0.12), "")) {
                state=10;
            }
            if (GUI.Button (getRect(0.455,0.35,0.06,0.12), "")) {
                state=11;
            }
            if (GUI.Button (getRect(0.455,0.5,0.06,0.12), "")) {
                state=12;
            }
            if (GUI.Button (getRect(0.455,0.65,0.06,0.12), "")) {
                state=13;
            }
            GUI.DrawTexture(getRect(0.2,0.1,0.6,0.8),skill);
            for (int i=0; i<4; i++) {
                mskill[i].setLevel(int.Parse(GUI.TextField (getRect(0.6,0.24+(double)i*0.15,0.15,0.04), mskill[i].getLevel().ToString())));
                try{
                GUI.DrawTexture(getRect(0.455,0.20+(double)i*0.15,0.06,0.12),tmanager.getskilltexture(mskill[i].getName()));
                }
                catch{
                    tmanager=GameObject.Find("Tmanager").GetComponent<Texturemanager>();
                }
            }
            if (GUI.Button (getRect(0.7,0.92,0.2,0.04), "save!!")) {
                state=0;
            }
        }
        if (state == 2) {
            for(int i=0;i<4;i++){
                if(mattack[i].isOn()){
                    for(int j=0;j<4;j++){
                        if (GUI.Button (getRect(0.27+0.116*j,0.345+(double)i*0.16,0.04,0.04), "")) {
                            state=20+10*i+j;
                        }
                    }
                }
            }
            GUI.DrawTexture(getRect(0.2,0.1,0.6,0.8),mtexture2);
            GUI.Label(getRect(0.34,0.13,0.1,0.05),life,mgui);
            GUI.Label(getRect(0.5,0.13,0.1,0.05),hp,mgui);
            GUI.Label(getRect(0.66,0.13,0.1,0.05),atk,mgui);
            try{
                for (int i=0; i<4; i++) {
                    GUI.DrawTexture(getRect(0.27+0.116*i,0.195,0.04,0.04),tmanager.getskilltexture(mskill[i].getName()));
                    GUI.Label(getRect(0.34+0.116*i,0.19,0.04,0.04),mskill[i].getLevel().ToString(),mgui);
                }
            }
            catch{
                tmanager=GameObject.Find("Tmanager").GetComponent<Texturemanager>();
            }
            for(int i=0;i<4;i++){
                if(mattack[i].isOn()){
                    if (GUI.Button(getRect(0.6,0.24+(double)i*0.16,0.16,0.04), "on")) {
                        mattack[i].changeOnOff();
                    }
                    mattack[i].setAttackvalue(int.Parse(GUI.TextField (getRect(0.4,0.24+(double)i*0.16,0.1,0.04), mattack[i].getAttackvalue().ToString())));
                    mattack[i].setPower(int.Parse(GUI.TextField (getRect(0.32,0.285+(double)i*0.16,0.06,0.04), mattack[i].getPower().ToString())));
                    for(int j=0;j<6;j++){
                        mattack[i].setAttackrange(j,int.Parse(GUI.TextField (getRect(0.43+0.045*j,0.285+(double)i*0.16,0.04,0.04),
                                                                             mattack[i].getattackrange()[j].ToString())));
                    }
                    for(int j=0;j<4;j++){
                        mattack[i].getSkill()[j].setLevel(int.Parse(GUI.TextField (getRect(0.33+0.116*j,0.345+(double)i*0.16,0.04,0.04),
                                                                                   mattack[i].getSkill()[j].getLevel().ToString())));
                        try{
                            GUI.DrawTexture(getRect(0.27+0.116*j,0.345+(double)i*0.16,0.04,0.04),
                                            tmanager.getskilltexture(mattack[i].getSkill()[j].getName()));
                        }
                        catch{
                            tmanager=GameObject.Find("Tmanager").GetComponent<Texturemanager>();
                        }
                    }
                }
                else{
                    if (GUI.Button(getRect(0.6,0.24+(double)i*0.16,0.16,0.04), "off")) {
                        mattack[i].changeOnOff();
                    }
                }
            }
            if (GUI.Button (getRect(0.7,0.92,0.2,0.04), "save!!")) {
                if(mattack[0].getAttackvalue()+mattack[1].getAttackvalue()+mattack[2].getAttackvalue()+mattack[3].getAttackvalue()==100)
                    state=0;
                else{
                    Debug.Log ("not attack");
                }
            }

        }
        if (state >= 10 && state < 20) {
            for (int i=0;i<7;i++){
                for(int j=0;j<10;j++){
                    if (GUI.Button (getRect (0.2+0.06*j, 0.1+0.8/7.0*i, 0.06, 0.114), "")) {
                        if(10*i+j==19)
                            mskill [state - 10].setName ("null");
                        else
                            mskill [state - 10].setName (tmanager.getSkillname(10*i+j));
                        state = 1;
                    }
                }
            }
            GUI.DrawTexture (getRect (0.2, 0.1, 0.6, 0.8), skilllist);
        }
        if (state >= 20 && state < 60) {
            for (int i=0;i<7;i++){
                for(int j=0;j<10;j++){
                    if (GUI.Button (getRect (0.2+0.06*j, 0.1+0.8/7.0*i, 0.06, 0.114), "")) {
                        if(10*i+j==19)
                            mattack[(state-20)/10].getSkill()[state%10].setName ("null");
                        else
                            mattack[(state-20)/10].getSkill()[state%10].setName (tmanager.getSkillname(10*i+j));
                        state = 2;
                    }
                }
            }
            GUI.DrawTexture (getRect (0.2, 0.1, 0.6, 0.8), skilllist);
        }
    }
Ejemplo n.º 2
0
 // Use this for initialization
 void Start()
 {
     ai = new AI ();
     for (int i=0; i<6; i++) {
         pdeck[i]=new card();
             }
     tmanager=GameObject.Find("Tmanager").GetComponent<Texturemanager>();
     _camera = Camera.main;
     screenWidth = _camera.pixelWidth;
     screenHeight = _camera.pixelHeight;
     StreamReader sw= new StreamReader("battleinfo\\playerinfo.txt");
     money = int.Parse(sw.ReadLine ());
     nowdeck = int.Parse(sw.ReadLine ());
     sw.Close ();
     sw= new StreamReader("battleinfo\\battle.txt");
     while (ind<14) {
         try{tstr=sw.ReadLine();
             if (tstr=="e"){
                 ecard=true;
                 ind++;
                 tstr=sw.ReadLine();
             }
             if(ecard){
                 tobj=Instantiate (mcard,
                                   mcard.transform.position,
                                   this.gameObject.transform.localRotation);
                 tobj.name="tcard"+ind.ToString();
                 tcard = GameObject.Find("tcard"+ind.ToString()).GetComponent<card>();
                 tcard.assigncard(tstr);
                 tcard.isfrontcard=false;
                 tcard.ismycard=false;
                 tcard.position0=13-ind;
                 tcard.updateTexture(tmanager);
                 edeck[13-ind]=tcard;
             }
             ind++;
         }
         catch{break;}
         }
     edeckcnumber = 6;//TODO : 적의 덱 수를 알 수 있으면 지울것
     sw.Close ();
     StreamReader sw2 = new StreamReader ("battleinfo\\deck" + nowdeck.ToString () + ".txt");
     ind=0;
     pdeckcnumber=int.Parse(sw2.ReadLine());
     while (ind<pdeckcnumber) {
         try {
             tstr = sw2.ReadLine ();
             tobj = Instantiate (mcard,
                                 mcard.transform.position,
                                 this.gameObject.transform.localRotation);
             tobj.name = "tcard" + (ind).ToString ();
             tcard = GameObject.Find ("tcard" + (ind).ToString ()).GetComponent<card> ();
             tcard.assigncard (tstr);
             tcard.position0=ind;
             tcard.updateTexture (tmanager);
             pdeck [ind] = tcard;
             ind++;
         } catch {
             break;
         }
     }
     sw2.Close ();
 }
Ejemplo n.º 3
0
 // Update is called once per frame
 void Update()
 {
     if (!updated) {
                     tmanager = GameObject.Find ("Tmanager").GetComponent<Texturemanager> ();
                     tcard.updateTexture (tmanager);
         updated=true;
             }
     if (!automode) {
         switch (phase) {
         case("start"):
         {
             bool scheck = false;
             for (int index = 0; index < pdeckcnumber; index++) {
                 card c = pdeck [index];
                 if (c.state == "selected" || c.state == "sfield")
                     scheck = true;
                 else
                     if (c.state == "deck") {
                         c.state = "nselected";
                     }
                     else
                         if (c.state == "field") {
                             c.state = "nfield";
                         }
             }
             if (!scheck) {
                 for (int index = 0; index < pdeckcnumber; index++) {
                     card c = pdeck [index];
                     if (c.state == "nselected") {
                         c.state = "deck";
                     } else if (c.state == "nfield") {
                         c.state = "field";
                     }
                 }
             } else {
                 phase = "card";
             }
             break;
         }
         case("card"):
         {
             int scheck = 0;
             for (int index = 0; index < pdeckcnumber; index++) {
                 card c = pdeck [index];
                 if (c.state == "selected" || c.state == "sfield")
                     scheck++;
                 else if (c.state == "deck") {
                     c.state = "nselected";
                 } else if (c.state == "field") {
                     c.state = "nfield";
                 }
             }
             if (scheck != 1) {
                 for (int index = 0; index < pdeckcnumber; index++) {
                     card c = pdeck [index];
                     if (c.state == "nselected" || c.state == "selected") {
                         c.state = "deck";
                     } else if (c.state == "nfield" || c.state == "sfield") {
                         c.state = "field";
                     }
                 }
                 phase = "start";
             }
             break;
         }
         }
     } else {
         tick++;
     }
 }
Ejemplo n.º 4
0
Archivo: shop.cs Proyecto: hoki444/AOH
 // Use this for initialization
 void Start()
 {
     tmanager=GameObject.Find("Tmanager").GetComponent<Texturemanager>();
     _camera = Camera.main;
     screenWidth = _camera.pixelWidth;
     screenHeight = _camera.pixelHeight;
     StreamReader sw= new StreamReader("battleinfo\\box.txt");
     cardnumber=int.Parse(sw.ReadLine());
     while (ind<cardnumber) {
         try{tstr=sw.ReadLine();
             tobj=Instantiate (mcard,
                               mcard.transform.position,
                               this.gameObject.transform.localRotation);
             tobj.name="tcard"+ind.ToString();
             tcard = GameObject.Find("tcard"+ind.ToString()).GetComponent<card>();
             tcard.assigncard(tstr);
             tcard.updateTexture(tmanager);
             cardbox[ind]=tcard;
             ind++;
         }
         catch{break;}
     }
     sw.Close ();
     sw= new StreamReader("battleinfo\\playerinfo.txt");
     money = int.Parse(sw.ReadLine ());
     nowdeck = int.Parse(sw.ReadLine ());
     sw.Close ();
 }