public void updateUI()
    {
        Sprite[] tempSpriteList = new Sprite[1];
        tempSpriteList[0] = actualGlass.glassSprite;

        playingUI.setSprites(tempSpriteList, PlayingUI.UIPosition.BottomRight);

        playingUI.updateSpritesOnScreen(PlayingUI.UIPosition.BottomRight);
    }
Esempio n. 2
0
    void setUI()
    {
        Sprite[] tempSprites   = new Sprite[subGlassesNumber];
        int      tempSpriteNum = 0;

        for (int i = 0; i < glassElement.Length; i++)
        {
            int spriteElementNum = 0;

            for (int j = 0; j < glassElement[i].glass.subGlassList.Length; j++)
            {
                if (glassElement[i].glass.subGlassList[j] != null)
                {
                    subGlass sottoVetrino = glassElement[i].glass.subGlassList[j].GetComponent <subGlass>();
                    if (sottoVetrino.taken)
                    {
                        tempSprites[tempSpriteNum] = glassElement[i].glassPiecesImages[spriteElementNum].takenSprite;
                    }
                    else
                    {
                        tempSprites[tempSpriteNum] = glassElement[i].glassPiecesImages[spriteElementNum].notTakenSprite;
                    }

                    spriteElementNum++;
                    tempSpriteNum++;
                }
            }
        }

        playingUI.setSprites(tempSprites, PlayingUI.UIPosition.UpperLeft);
        playingUI.setVertical(PlayingUI.UIPosition.UpperLeft, true);
        playingUI.updateSpritesOnScreen(PlayingUI.UIPosition.UpperLeft);
    }
    void Start()
    {
        canvasPlayingUI = GameObject.FindGameObjectWithTag("CanvasPlayingUI");
        if (canvasPlayingUI == null)
        {
            Debug.Log("ATTENZIONE!! canvasPlayingUI non trovato!! Assicurarsi che il relativo prefab sia nella scena");
        }
        else
        {
            playingUI = canvasPlayingUI.GetComponent <PlayingUI> ();
        }

        controller    = GameObject.FindGameObjectWithTag("Controller");
        cursorHandler = controller.GetComponent <CursorHandler> ();

        Sprite[] sprites = new Sprite[1];
        sprites [0] = info;


        if (playingUI != null)
        {
            playingUI.setSprites(sprites, PlayingUI.UIPosition.UpperRight);
        }

        Sprite buttonSprite;

        if (cursorHandler.useController)
        {
            buttonSprite = controllerButton;
        }
        else
        {
            buttonSprite = keyboardButton;
        }

        if (playingUI != null)
        {
            playingUI.setButtonSprite(PlayingUI.UIPosition.UpperRight, buttonSprite);

            playingUI.setVerticalButton(PlayingUI.UIPosition.UpperRight, false);
            playingUI.setSpritesSize(PlayingUI.UIPosition.UpperRight, PlayingUI.UISize.Big);

            playingUI.updateSpritesOnScreen(PlayingUI.UIPosition.UpperRight);
        }
    }