void Awake()
	{
		instance = this;
		
		if (itemIdx >= 0 && (highlightObjects == null || highlightObjects.Length < 2)) {
			highlightObjects = new GameObject[2];
		}
	}
    void Start()
    {
        TutorialsSystem tutorialSystem = TutorialsSystem.Instance;

        if (tutorialSystem == null)
        {
            Debug.LogWarning("No tutorial system");
            return;
        }

        myLabel      = GetComponent <UILabel>();
        myLabel.text = Language.Get(tutorialSystem.textKey);

        if (PlayerPrefs.GetInt(tutorialSystem.textKey, 0) != 0 ||
            Match3BoardRenderer.levelIdx < LoadLevelButton.lastUnlockedLevel)
        {
            //already shown tutorial
            myLabel.text = myLabel.text.Replace("\n<TOKEN>", "");
            myLabel.text = myLabel.text.Replace("<TOKEN>", "");
            myLabel.text = myLabel.text.Replace("\n<FREE_ICE_PICKS>", "");
            myLabel.text = myLabel.text.Replace("<FREE_ICE_PICKS>", "");
            myLabel.text = myLabel.text.Replace("\n<FREE_SNOWBALLS>", "");
            myLabel.text = myLabel.text.Replace("<FREE_SNOWBALLS>", "");
            myLabel.text = myLabel.text.Replace("\n<FREE_HOURGLASSES>", "");
            myLabel.text = myLabel.text.Replace("<FREE_HOURGLASSES>", "");
        }
        else
        {
            myLabel.text = myLabel.text.Replace("<TOKEN>", Language.Get("TUTORIAL_ITEM_TOKENS"));
            myLabel.text = myLabel.text.Replace("<FREE_ICE_PICKS>", Language.Get("TUTORIAL_FREE_ICE_PICKS"));
            myLabel.text = myLabel.text.Replace("<FREE_SNOWBALLS>", Language.Get("TUTORIAL_FREE_SNOWBALLS"));
            myLabel.text = myLabel.text.Replace("<FREE_HOURGLASSES>", Language.Get("TUTORIAL_FREE_HOURGLASSES"));
        }

        daddy = transform.parent.gameObject;
        daddy.transform.parent.localPosition = tutorialSystem.messagePosition;

        TutorialsSystem.OnTutorialShow += ShowTutorial;

        tutorialSystem.animationTime = daddy.animation["ScaleDown"].length + 0.01f;

        if (tutorialSystem.itemIdx >= 0 && tutorialSystem.itemIdx < items.Length)
        {
            if (tutorialSystem.highlightObjects[0] == null)
            {
                tutorialSystem.highlightObjects[0] = items[tutorialSystem.itemIdx];
            }
            else
            {
                tutorialSystem.highlightObjects[1] = items[tutorialSystem.itemIdx];
            }

            StartCoroutine(WaitForSetItem());
        }
    }