TutorialManager.cs 2.11 KB
using UnityEngine;
using UnityEngine.UI;

public class TutorialManager : MonoBehaviour {

	public ScreenManager screenManager;

	public Text description;
	public Image translateImage;
	public Image micImage;
	public Image dictionaryImage;
	public Image subtitlesImage;
	public GameObject sliderShadow;

	public Color enabledColor;
	public Color disabledColor;

	private int index = 0;
	private string[] descriptions = new string[] {
		"Tradução de Texto\n\nNessa opção você pode entrar com um texto para ser traduzido!",
		"Tradução de Fala\n\nNessa opção, o que você falar será traduzido para LIBRAS",
		"Dicionário\n\nNessa opção você pode ver e reproduzir todos os sinais disponíveis no VLibras",
		"Legendas\n\nNessa opção você pode ativar e desativar as legendas enquanto o sinal é traduzido",
		"Barra de velocidade\n\nNa barra você pode escolher a velocidade que deseja visualizar o sinal",
	};

	protected void Start ()
	{
		if (Screen.dpi < 140)
		{
			this.description.fontSize = 14;
		}

		// 240
		else if (Screen.dpi < 280)
		{
			this.description.fontSize = 20;
		}

		// 320
		else if (Screen.dpi < 400)
		{
			this.description.fontSize = 30;
		}

		// 480
		else if (Screen.dpi < 500)
		{
			this.description.fontSize = 44;
		}

		else
		{
			this.description.fontSize = 14;
		}
	}

	private Image getButton()
	{
		switch (this.index)
		{
			case 0: return this.translateImage;
			case 1: return this.micImage;
			case 2: return this.dictionaryImage;
			case 3: return this.subtitlesImage;
			default: return null;
		}
	}

	public void next()
	{
		if (index == 4)
		{
			this.screenManager.hideScreen();
			select(0);
		}
		else
		{
#if UNITY_IOS
			if (this.index == 0)
				this.index++;
#endif
			select(this.index + 1);
		}
	}

	public void select(int index)
	{
		if (this.index <= 3)
			getButton().color = disabledColor;
		else
			this.sliderShadow.SetActive(true);

		this.index = index;

		if (this.index <= 3)
		{
			getButton().color = enabledColor;
			this.description.text = this.descriptions[index];
		}
		else
		{
			this.sliderShadow.SetActive(false);
			this.description.text = this.descriptions[index];
		}
	}

}