158 lines
3.7 KiB
C#
158 lines
3.7 KiB
C#
using UnityEngine;
|
|
using TMPro;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
|
|
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);
|
|
Statics.uuid = data.uuid;
|
|
List<DeckUnitInfo> units = data.deck_unit.OrderBy(n => n.unit_data_id).ToList();
|
|
Statics.deck_info = data.deck_info.OrderBy(n => n.id).ToList();
|
|
Statics.equipment = data.equipment.OrderBy(n => n.equipment_data_id).ToList();
|
|
//À¯´ÖÁ¤º¸ Set
|
|
foreach (DeckUnitInfo item in units)
|
|
{
|
|
Statics.deckUnit.Add(item.id, item);
|
|
}
|
|
//´ÙÀ̳ª¹Í µ¥ÀÌÅÍ Set
|
|
foreach(var item in data.dynamic_data)
|
|
{
|
|
Statics.dynamic.Add(item.name, item.value);
|
|
}
|
|
|
|
Statics.nickname = data.nickname;
|
|
Statics.gold = data.gold;
|
|
Statics.cash = data.cash;
|
|
|
|
GameManager.Instance.NextScene(GameManager.eScene.Game);
|
|
}
|
|
else
|
|
{
|
|
PlayerPrefs.SetString("uuid", "");
|
|
Awake();
|
|
}
|
|
}, () =>
|
|
{
|
|
|
|
});
|
|
|
|
|
|
}
|
|
}
|