Steam lobby implemented
This commit is contained in:
@ -1,47 +1,59 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine.SceneManagement;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class MainMenuManager : MonoBehaviour
|
||||
{
|
||||
private string component = "_FaceDilate";
|
||||
[SerializeField]
|
||||
private TMP_Text title;
|
||||
[SerializeField]
|
||||
private List<TMP_Text> textList= new List<TMP_Text>();
|
||||
private List<float> initDilates= new List<float>();
|
||||
private List<float> dilates= new List<float>();
|
||||
[SerializeField] private TMP_Text title;
|
||||
|
||||
[SerializeField] private List<TMP_Text> textList = new();
|
||||
|
||||
[SerializeField] private float dilateSpeed = 0.1f;
|
||||
|
||||
[SerializeField] private Animator cover;
|
||||
|
||||
private readonly string component = "_FaceDilate";
|
||||
private float dilate = -1;
|
||||
private readonly List<float> dilates = new();
|
||||
private float initDilate;
|
||||
[SerializeField]
|
||||
float dilateSpeed = 0.1f;
|
||||
[SerializeField]
|
||||
private Animator cover;
|
||||
private bool transitioning = false;
|
||||
private readonly List<float> initDilates = new();
|
||||
private bool transitioning;
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
private void Start()
|
||||
{
|
||||
//initDilate = title.fontSharedMaterials[0].GetFloat(component);
|
||||
initDilate = title.fontMaterials[0].GetFloat(component);
|
||||
|
||||
|
||||
foreach(TMP_Text text in this.textList)
|
||||
|
||||
foreach (var text in textList)
|
||||
{
|
||||
this.initDilates.Add(text.fontMaterials[0].GetFloat(component));
|
||||
this.dilates.Add(-1f);
|
||||
|
||||
|
||||
initDilates.Add(text.fontMaterials[0].GetFloat(component));
|
||||
dilates.Add(-1f);
|
||||
}
|
||||
this.textList[0].GetComponent<Button>().onClick.AddListener(LoadFirstLevel);
|
||||
this.textList[2].GetComponent<Button>().onClick.AddListener(ExitApp);
|
||||
|
||||
|
||||
textList[0].GetComponent<Button>().onClick.AddListener(LoadFirstLevel);
|
||||
textList[2].GetComponent<Button>().onClick.AddListener(ExitApp);
|
||||
}
|
||||
void LoadFirstLevel()
|
||||
|
||||
|
||||
// Update is called once per frame
|
||||
private void Update()
|
||||
{
|
||||
//dilate = Mathf.Min(initDilate, dilate += Time.deltaTime);
|
||||
dilate = Mathf.Lerp(dilate, initDilate, Time.deltaTime * dilateSpeed);
|
||||
title.fontMaterials[0].SetFloat(component, dilate);
|
||||
for (var i = 0; i < textList.Count; i++)
|
||||
{
|
||||
dilates[i] = Mathf.Lerp(dilates[i], initDilates[i], Time.deltaTime * dilateSpeed);
|
||||
textList[i].fontMaterials[0].SetFloat(component, dilates[i]);
|
||||
}
|
||||
}
|
||||
|
||||
private void LoadFirstLevel()
|
||||
{
|
||||
if (!transitioning)
|
||||
{
|
||||
@ -49,32 +61,16 @@ public class MainMenuManager : MonoBehaviour
|
||||
transitioning = true;
|
||||
StartCoroutine(_LoadFirstLevel());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private IEnumerator _LoadFirstLevel()
|
||||
{
|
||||
yield return new WaitForSeconds(4);
|
||||
SceneManager.LoadScene(1);
|
||||
}
|
||||
|
||||
void ExitApp()
|
||||
private void ExitApp()
|
||||
{
|
||||
Application.Quit();
|
||||
}
|
||||
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
//dilate = Mathf.Min(initDilate, dilate += Time.deltaTime);
|
||||
dilate = Mathf.Lerp(dilate, initDilate, Time.deltaTime*dilateSpeed);
|
||||
title.fontMaterials[0].SetFloat(component, dilate);
|
||||
for(int i =0;i<this.textList.Count;i++)
|
||||
{
|
||||
|
||||
dilates[i] = Mathf.Lerp(dilates[i], initDilates[i],Time.deltaTime*dilateSpeed);
|
||||
textList[i].fontMaterials[0].SetFloat(component, dilates[i]);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user