mirror of
https://github.com/Kizuren/ShantiManti.git
synced 2026-01-07 06:59:31 +01:00
Refactored SceneSystem and rewritten ClearData
Current project version: 2.2.0 Preparing for 2.2 release Rewritten CheckDeleted
This commit is contained in:
parent
bd9c0a657f
commit
3145dbf93e
11 changed files with 8604 additions and 1684 deletions
54
Assets/game/Scripts/UI/ClearData.cs
Normal file
54
Assets/game/Scripts/UI/ClearData.cs
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class ClearData : MonoBehaviour
|
||||
{
|
||||
[Header("UI Elements")]
|
||||
public GameObject ConfirmationDialog;
|
||||
public GameObject DarkBackground;
|
||||
public GameObject ErrorDialog;
|
||||
|
||||
[Header("")]
|
||||
public float waitForDeletion = 0.1f;
|
||||
|
||||
void Start()
|
||||
{
|
||||
ConfirmationDialog.SetActive(true);
|
||||
DarkBackground.SetActive(false);
|
||||
ErrorDialog.SetActive(false);
|
||||
}
|
||||
|
||||
public void Confirm()
|
||||
{
|
||||
ErrorDialog.SetActive(false);
|
||||
ConfirmationDialog.SetActive(false);
|
||||
DarkBackground.SetActive(true);
|
||||
|
||||
StartCoroutine(CheckDelete());
|
||||
}
|
||||
|
||||
IEnumerator CheckDelete()
|
||||
{
|
||||
PlayerSaving.DeletePlayer();
|
||||
yield return new WaitForSeconds(waitForDeletion);
|
||||
|
||||
int[] defaultInts = { 0, 0 };
|
||||
bool[] defaultBools = { false, true };
|
||||
int[] checkInts = { PlayerSaving.level, PlayerSaving.coins };
|
||||
bool[] checkBools = { PlayerSaving.hasCompletedTutorial, PlayerSaving.movingClouds };
|
||||
|
||||
for (int i = 0; i < defaultInts.Length; i++)
|
||||
{
|
||||
if (checkInts[i] != defaultInts[i] || checkBools[i] != defaultBools[i])
|
||||
{
|
||||
ErrorDialog.SetActive(true);
|
||||
DarkBackground.SetActive(false);
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
|
||||
MainMenu mainMenu = FindObjectOfType<MainMenu>().GetComponent<MainMenu>();
|
||||
mainMenu.LoadScene(0);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue