first commit

This commit is contained in:
2023-07-03 13:42:10 +05:00
parent 6b36de32ec
commit a7fc084abf
2399 changed files with 334747 additions and 0 deletions
@@ -0,0 +1,87 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using Zenject;
using TMPro;
using YandexQuest.Models;
using Cysharp.Threading.Tasks;
public class Authorization : MonoBehaviour
{
[Inject] private readonly ClientDataService _clientDataService;
[Inject] private readonly NetworkService _networkService;
[SerializeField] private TMP_InputField _codeInputField;
[SerializeField] private Button _codeAcceptButton;
[SerializeField] private TMP_Text _errorText;
private void Start()
{
var clientData = _clientDataService.data;
if(clientData != null)
{
Debug.LogWarning($"данные клианта загружены: город - {clientData.city}, найдено тэгов - {clientData.games.Count}");
return;
}
_codeInputField.onValueChanged.AddListener(stringValue =>
{
if(stringValue.Length != 6)
{
_codeAcceptButton.interactable = false;
}
else
{
_codeAcceptButton.interactable = true;
}
});
_codeAcceptButton.onClick.AddListener(async () =>
{
await SendCode(_codeInputField.text);
});
}
private async UniTask SendCode(string inputFieldText)
{
CityUniqueCode cityUniqueCode = null;
_networkService.OnGetResponse += CheckResponseAdmin;
cityUniqueCode = await _networkService.GetAsync<CityUniqueCode>($"auth/admin/{inputFieldText}");
async void CheckResponseAdmin(int responseCode)
{
_networkService.OnGetResponse -= CheckResponseAdmin;
if(responseCode == 0) Debug.LogError("Нет соединения с сервером");
else if (responseCode == 404)
{
Client client = new Client();
Debug.LogWarning("такого админа нет в базе. ищем город...");
_networkService.OnGetResponse += CheckResponse;
client = await _networkService.GetAsync<Client>($"auth/{inputFieldText}");
void CheckResponse(int responseCode)
{
_networkService.OnGetResponse -= CheckResponse;
if(responseCode == 404)
{
Debug.LogError("такого кода нет в базе");
}
else if(responseCode == 0) Debug.LogError("Нет соединения с сервером");
else if( responseCode == 200)
{
_clientDataService.data = client;
Debug.Log(client.city.ToString());
}
}
}
else if(responseCode == 200)
{
Debug.Log(cityUniqueCode.city);
}
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 463389b2b938e4b40af7aa639400f07a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+25
View File
@@ -0,0 +1,25 @@
using System.Collections;
using System.Collections.Generic;
using Cysharp.Threading.Tasks;
using UnityEngine;
using DG.Tweening;
public class MainMenu : MonoBehaviour
{
[SerializeField] CanvasGroup _splash;
[SerializeField] GameObject _welcomeWarning;
[SerializeField] GameObject _authorization;
private IEnumerator Start()
{
_authorization.SetActive(false);
_welcomeWarning.SetActive(false);
yield return new WaitForSeconds(3);
_welcomeWarning.SetActive(true);
_splash.DOFade(0, .5f)
.SetEase(Ease.Linear)
.OnComplete(() => _splash.gameObject.SetActive(false));
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: ca30badc3005aaa4ba9f9742c2f24e7a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: