Beispiel #1
0
    void doXuLy(SpItem bt)
    {
        if (currentState == State.InGame1)
        {
            sp1 = bt;
            if (sp1.Trangthai == true)
            {
                sp1.Trangthai = false;
                currentState  = State.Click1;
                khocCuoi.SetSprite("nguoihoi");
                sprite1       = bt.GetComponent <tk2dSprite>();
                sprite1.color = new Color(1, 1, 0.5f, 1);

                gt1 = bt.Giatri;
                SoundManager.Instance.PlayAudioClick();
            }
        }
        else if (currentState == State.Click1)
        {
            if (bt.Trangthai == true)
            {
                bt.Trangthai = false;
                currentState = State.Click2;

                sprite2       = bt.GetComponent <tk2dSprite>();
                sprite2.color = new Color(1, 1, 0.5f, 1);

                gt2 = bt.Giatri;
                SoundManager.Instance.PlayAudioClick();
                StartCoroutine(WaitTimeXuLyBN(1f, bt));
            }
        }
    }
Beispiel #2
0
 void doXuLy(SpItem bt)
 {
     if (currentState == State.InGame1)
     {
         if (bt.Trangthai == true)
         {
             //khi đã kích vào nút
             khocCuoi.SetSprite("nguoihoi");
             bt.Trangthai = false;
             sprite       = bt.GetComponent <tk2dSprite>();
             sprite.color = new Color(1, 1, 0.5f, 1);
             currentState = State.Click1;
             SoundManager.Instance.PlayAudioClick();
             StartCoroutine(WaitTimeXuLySX(1f, bt));
         }
     }
 }
Beispiel #3
0
    void CreateLevel(float positionX, float positionY, PhepToan vio, int thutu)
    {
        SpItem levelCreate = spPrefab.Spawn <SpItem>
                             (
            new Vector3(positionX, positionY, 71),
            spPrefab.transform.rotation
                             );

        levelCreate.gameObject.GetComponent <tk2dSprite>().scale = new Vector3(2.4f, 2.4f, 1);
        levelCreate.Giatri   = ClsThaoTac.doKetQua(vio.Ketqua);
        levelCreate.Pheptoan = "" + vio.Congthuc;
        levelCreate.setData(vio.Loai);
        levelCreate.Trangthai = true;
        //levelCreate.Vitri = thutu;



        sp = levelCreate.GetComponent <tk2dUIItem>();

        switch (thutu)
        {
        case 1:
            bt1         = levelCreate;
            sp.OnClick += onClick_sp1;
            break;

        case 2:
            bt2         = levelCreate;
            sp.OnClick += onClick_sp2;
            break;

        case 3:
            bt3         = levelCreate;
            sp.OnClick += onClick_sp3;
            break;

        case 4:
            bt4         = levelCreate;
            sp.OnClick += onClick_sp4;
            break;

        case 5:
            bt5         = levelCreate;
            sp.OnClick += onClick_sp5;
            break;

        case 6:
            bt6         = levelCreate;
            sp.OnClick += onClick_sp6;
            break;

        case 7:
            bt7         = levelCreate;
            sp.OnClick += onClick_sp7;
            break;

        case 8:
            bt8         = levelCreate;
            sp.OnClick += onClick_sp8;
            break;

        case 9:
            bt9         = levelCreate;
            sp.OnClick += onClick_sp9;
            break;

        case 10:
            bt10        = levelCreate;
            sp.OnClick += onClick_sp10;
            break;

        case 11:
            bt11        = levelCreate;
            sp.OnClick += onClick_sp11;
            break;

        case 12:
            bt12        = levelCreate;
            sp.OnClick += onClick_sp12;
            break;

        case 13:
            bt13        = levelCreate;
            sp.OnClick += onClick_sp13;
            break;

        case 14:
            bt14        = levelCreate;
            sp.OnClick += onClick_sp14;
            break;

        case 15:
            bt15        = levelCreate;
            sp.OnClick += onClick_sp15;
            break;

        case 16:
            bt16        = levelCreate;
            sp.OnClick += onClick_sp16;
            break;

        case 17:
            bt17        = levelCreate;
            sp.OnClick += onClick_sp17;
            break;

        case 18:
            bt18        = levelCreate;
            sp.OnClick += onClick_sp18;
            break;

        case 19:
            bt19        = levelCreate;
            sp.OnClick += onClick_sp19;
            break;

        case 20:
            bt20        = levelCreate;
            sp.OnClick += onClick_sp20;
            break;

        default:
            Debug.Log("Default case");
            break;
        }

        levelCreate.transform.parent = this.gameObject.transform;
    }