class

mail@pastecode.io avatar
unknown
csharp
a year ago
1.9 kB
0
Indexable
Never
using System;
using BepInEx;
using System.Collections;
using UnityEngine;
using UnityEngine.UI;

// Token: 0x0200008E RID: 142
public class customInteractInfo : MonoBehaviour
{
	public GameObject clear;
	public Text clearText;
	private Vector2 origin;
	public float timer = 1.25f;
	public GameObject info;
	public Text infoText;
	public Color offColor = new Color(1f, 1f, 1f, 0f);
	public static customInteractInfo interactInfo;
	public int i;

	public void Start()
	{
        //int screen_height = Screen.height;
        //int screen_width = Screen.width;
		info = infoText.gameObject;

		infoText.color = Color.white;
		origin = new Vector2(700, 700);
	}

    public void setString(string message)
    {
        infoText.text = message;
    }

	public void inform(string msg, Color col)
	{
		msg = locHandler.getMiscTranslation(msg);
		info.transform.position = origin;
		base.StartCoroutine(showInfo());
		base.StartCoroutine(moveInfo());
		infoText.color = col;
		infoText.text = msg;
	}

	public void showCleared()
	{
		if (dayCycleController.underground)
		{
			clearText.color = Color.white;
		}
		else
		{
			clearText.color = Color.black;
		}
		clear.SetActive(true);
	}

	private IEnumerator moveInfo()
	{
		Vector2 newPos = info.transform.position;
		i = 0;
		while (i < 50)
		{
			newPos.y += 0f;
			info.transform.position = newPos;
			yield return new WaitForSeconds((timer + 0.35f) / 50f);
			i++;
		}
		yield break;
	}

	private IEnumerator showInfo()
	{
		yield return new WaitForSeconds(timer);
		Color fader = infoText.color;
		fader.a -= 0.25f;
		infoText.color = fader;
		yield return new WaitForSeconds(0.05f);
		fader.a -= 0.25f;
		infoText.color = fader;
		yield return new WaitForSeconds(0.05f);
		fader.a -= 0.25f;
		infoText.color = fader;
		yield return new WaitForSeconds(0.05f);
		fader.a -= 0.25f;
		infoText.color = fader;
		yield break;
	}
}