Beispiel #1
0
    IEnumerator DestroyObject(GP_TrayItem trayItem)
    {
        yield return(new WaitForSeconds(1f));

        Object.Destroy(gm.board[x, y].piece.thisPiece);
        gm.board[x, y].piece          = null;
        gm.board[x, y].isBeingDelayed = false;
        gm.board[x, y].isFalling      = false;
        trayItem.AllButtonNormal();
    }
Beispiel #2
0
 void btnClose()
 {
     iTween.Defaults.easeType = iTween.EaseType.linear;
     iTween.PunchScale(btnCloseLayer.gameObject, scaleClick, 0.5f);
     gameObject.GetComponent <Animator>().Play("LayerShopHide");
     if (Application.loadedLevelName == "GamePlay")
     {
         GP_TrayItem trayitem = FindObjectOfType <GP_TrayItem>();
         trayitem.showShop = false;
     }
 }
Beispiel #3
0
    IEnumerator HideBuyComplete()
    {
        yield return(new WaitForSeconds(2f));

        iTween.Stop(imageItem.gameObject);
        buyItemComplete.SetActive(false);
        string name = ObscuredPrefs.GetString("item");
        string key  = "total" + name;

        Data.UpdateData(key, countItem);
        countItem = 1;
        if (Application.loadedLevelName == "GamePlay")
        {
            GP_TrayItem trayItem = FindObjectOfType <GP_TrayItem>();
            trayItem.GetDataItem();
        }
    }
Beispiel #4
0
    void OnMouseDown()
    {
        GP_TrayItem trayItem = FindObjectOfType <GP_TrayItem>();

        if (!trayItem.showShop)
        {
            if (trayItem.buaClicked)
            {
                StartCoroutine(trayItem.BuaPlay(gm.board[x, y].piece.position));
                StartCoroutine(DestroyObject(trayItem));
                trayItem.buaClicked = false;
                Data.RemoveData(Data.keyBua, 1);
                trayItem.GetDataItem();
            }
            if (trayItem.bantayClicked)
            {
                trayItem.countInput++;

                if (trayItem.countInput == 1)
                {
                    StartCoroutine(trayItem.BanTayPlay(gm.board[x, y].piece.position));
                    trayItem.pos1[0] = x;
                    trayItem.pos1[1] = y;
                }
                if (trayItem.countInput == 2)
                {
                    if (x == trayItem.pos1[0] + 1 && y == trayItem.pos1[1] || x == trayItem.pos1[0] - 1 && y == trayItem.pos1[1] || x == trayItem.pos1[0] && y == trayItem.pos1[1] + 1 || x == trayItem.pos1[0] && y == trayItem.pos1[1] - 1)
                    {
                        StartCoroutine(trayItem.BanTayPlay(gm.board[x, y].piece.position));
                        trayItem.pos2[0] = x;
                        trayItem.pos2[1] = y;
                        StartCoroutine(gm.switchPositions(trayItem.pos1[0], trayItem.pos1[1], trayItem.pos2[0], trayItem.pos2[1]));
                        trayItem.countInput = 0;
                        Data.RemoveData(Data.keyBanTay, 1);
                        trayItem.GetDataItem();
                    }
                    else
                    {
                        trayItem.countInput = 1;
                    }
                }
            }
            if (trayItem.binhxitClicked)
            {
                if (gm.board[x, y].piece.thisPiece.tag == "fruitbom")
                {
                    gm.board[x, y].piece.thisPiece.transform.GetChild(0).gameObject.SetActive(false);
                    gm.board[x, y].piece.thisPiece.transform.GetChild(1).gameObject.SetActive(false);
                    gm.board[x, y].piece.thisPiece.GetComponent <GP_PieceScripts>().enabled = false;
                    Data.RemoveData(Data.keyBinhXit, 1);
                    trayItem.GetDataItem();
                    trayItem.AllButtonNormal();
                }
            }

            if (trayItem.binhthuocClicked)
            {
                Board board = gm.board[x, y];
                MusicControll.musicControll.MakeSound(MusicControll.musicControll.convertingSpecialFx);

                gm.animScript.doAnim(animType.CONVERTSPEC, board.arrayRef[0], board.arrayRef[1]);
                GameObject pm = gm.pieceManager;
                board.convertToSpecial(pm.GetComponent <SpecialFive>(), 0);
                gm.board[x, y].panelHit();
                gm.lockJustCreated(x, y, 0.3f);
                Data.RemoveData(Data.keyBinhThuoc, 1);
                trayItem.GetDataItem();
                trayItem.AllButtonNormal();
            }
        }
    }