示例#1
0
    void doXuLy(SpItemMonkey bt)
    {
        try
        {
            if (currentState == State.InGame1)
            {
                if (bt.Trangthai == true)
                {
                    bt.Trangthai = false;

                    ConKhi.SetSprite("khixet");
                    sprite       = bt.GetComponent <tk2dSprite>();
                    sprite.color = new Color(1, 1, 0.5f, 1);
                    currentState = State.Click1;
                    SoundManager.Instance.PlayAudioClick();
                    StartCoroutine(WaitTimeXuLyTT(1f, bt));
                }
            }
        }
        catch (System.Exception)
        {
            throw;
        }
    }
示例#2
0
    void CreateLevel(float positionX, PhepToan vio, int thutu)
    {
        SpItemMonkey levelCreate = spPrefab.Spawn <SpItemMonkey>
                                   (
            new Vector3(positionX, startY, 70f),
            spPrefab.transform.rotation
                                   );

        levelCreate.Giatri   = 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 = respawn.transform;
    }
示例#3
0
    void RemoveEvent(SpItemMonkey pSP)
    {
        int        tmg    = pSP.Vitri;
        tk2dUIItem uiitem = pSP.GetComponent <tk2dUIItem>();

        switch (tmg)
        {
        case 1:
            uiitem.OnClick -= onClick_sp1;
            break;

        case 2:
            uiitem.OnClick -= onClick_sp2;
            break;

        case 3:
            uiitem.OnClick -= onClick_sp3;
            break;

        case 4:
            uiitem.OnClick -= onClick_sp4;
            break;

        case 5:
            uiitem.OnClick -= onClick_sp5;
            break;

        case 6:
            uiitem.OnClick -= onClick_sp6;
            break;

        case 7:
            uiitem.OnClick -= onClick_sp7;
            break;

        case 8:
            uiitem.OnClick -= onClick_sp8;
            break;

        case 9:
            uiitem.OnClick -= onClick_sp9;
            break;

        case 10:
            uiitem.OnClick -= onClick_sp10;
            break;

        case 11:
            uiitem.OnClick -= onClick_sp11;
            break;

        case 12:
            uiitem.OnClick -= onClick_sp12;
            break;

        case 13:
            uiitem.OnClick -= onClick_sp13;
            break;

        case 14:
            uiitem.OnClick -= onClick_sp14;
            break;

        case 15:
            uiitem.OnClick -= onClick_sp15;
            break;

        case 16:
            uiitem.OnClick -= onClick_sp16;
            break;

        case 17:
            uiitem.OnClick -= onClick_sp17;
            break;

        case 18:
            uiitem.OnClick -= onClick_sp18;
            break;

        case 19:
            uiitem.OnClick -= onClick_sp19;
            break;

        case 20:
            uiitem.OnClick -= onClick_sp20;
            break;
        }
    }