TutorialManager.cs 2.09 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",
	};

	private Image[] buttons;

	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;
		}

		this.buttons = new Image[] {
			this.translateImage,
			this.micImage,
			this.dictionaryImage,
			this.subtitlesImage
		};
	}

	private Image getButton() {
		return this.index <= 3 ? this.buttons[this.index] : null;
	}

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

	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;
		else
			this.sliderShadow.SetActive(false);

		this.description.text = this.descriptions[index];
	}

}