144 lines
3.1 KiB
C#
144 lines
3.1 KiB
C#
using UnityEngine;
|
|
using TMPro;
|
|
using System.Collections.Generic;
|
|
|
|
public class MainCtrl : MonoBehaviour
|
|
{
|
|
[SerializeField] TMP_Text title_Text;
|
|
[SerializeField] TMP_Text messageText;
|
|
[SerializeField] TMP_InputField email;
|
|
|
|
[SerializeField] GameObject gameStartButton;
|
|
[SerializeField] GameObject loginButton;
|
|
[SerializeField] GameObject gestLoginButton;
|
|
[SerializeField] GameObject message;
|
|
|
|
bool is_On;
|
|
float dtime = 0;
|
|
bool isUpdate;
|
|
|
|
string uuid;
|
|
|
|
private void Awake()
|
|
{
|
|
gameStartButton.SetActive(false);
|
|
loginButton.SetActive(false);
|
|
gestLoginButton.SetActive(false);
|
|
message.SetActive(true);
|
|
isUpdate = false;
|
|
messageText.text = "data °ËÁõÁß....";
|
|
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
if (GameManager.Instance.isExcel)
|
|
{
|
|
return;
|
|
}
|
|
else if (!isUpdate)
|
|
{
|
|
isUpdate = !isUpdate;
|
|
uuid = PlayerPrefs.GetString("uuid");
|
|
message.SetActive(false);
|
|
if (uuid != "")
|
|
{
|
|
gameStartButton.SetActive(true);
|
|
}
|
|
else
|
|
{
|
|
loginButton.SetActive(true);
|
|
}
|
|
}
|
|
if(is_On)
|
|
{
|
|
if(title_Text.color.a >= 1)
|
|
{
|
|
if(dtime > 1f)
|
|
{
|
|
is_On = !is_On;
|
|
dtime = 0;
|
|
}
|
|
else
|
|
{
|
|
dtime += Time.deltaTime;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
title_Text.color += (Color.black * Time.deltaTime);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (title_Text.color.a <= 0.1)
|
|
{
|
|
is_On = !is_On;
|
|
}
|
|
else
|
|
{
|
|
title_Text.color -= (Color.black * Time.deltaTime);
|
|
}
|
|
}
|
|
}
|
|
//#if UNITY_EDITOR
|
|
public void GestLogin()
|
|
{
|
|
gestLoginButton.SetActive(true);
|
|
}
|
|
|
|
public void Join()
|
|
{
|
|
loginButton.SetActive(false);
|
|
gestLoginButton.SetActive(false);
|
|
gameStartButton.SetActive(true);
|
|
|
|
}
|
|
//#endif
|
|
|
|
public void FireBaseLogin()
|
|
{
|
|
|
|
}
|
|
|
|
public void MastodonLogin()
|
|
{
|
|
|
|
}
|
|
|
|
public void NextButton()
|
|
{
|
|
LoginResp resp = new LoginResp();
|
|
LoginReq req = new LoginReq(email.text, uuid);
|
|
|
|
message.SetActive(true);
|
|
messageText.text = "Login...";
|
|
|
|
resp.Request(req, (data) =>
|
|
{
|
|
//·Î±×ÀÎ ¼º°ø½Ã
|
|
if(data.status.Equals(200))
|
|
{
|
|
PlayerPrefs.SetString("uuid", data.uuid);
|
|
List<DeckUnitInfo> units = data.deck_unit;
|
|
foreach (DeckUnitInfo item in units)
|
|
{
|
|
Statics.deckUnit.Add(item.id, item);
|
|
}
|
|
Statics.leader = data.leader;
|
|
GameManager.Instance.NextScene(GameManager.eScene.Game);
|
|
}
|
|
else
|
|
{
|
|
PlayerPrefs.SetString("uuid", "");
|
|
Awake();
|
|
}
|
|
}, () =>
|
|
{
|
|
|
|
});
|
|
|
|
|
|
}
|
|
}
|