feat: 게임 플레이 종료 후 클리어 정보 저장 및 랭킹 정보 저장 로직 추가

This commit is contained in:
aube.lee
2025-02-28 00:55:35 +09:00
parent 1f2e329d55
commit 17e824e29e
9 changed files with 329 additions and 44 deletions

View File

@@ -0,0 +1,35 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace TON
{
[System.Serializable]
public class ClearData
{
public string nickname;
// 클리어한 웨이브 넘버
public int wave;
// 클리어에 소요된 시간
public float playTime;
// 획득 점수
public int score;
public ClearData()
{
nickname = "";
wave = 0;
playTime = 0f;
score = 0;
}
public void UpdateClearData(string nickname, int wave, float playTime, int score)
{
this.nickname = nickname;
this.wave = wave;
this.playTime = playTime;
this.score = score;
}
}
}

View File

@@ -1,34 +0,0 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace TON
{
[System.Serializable]
public class StageClearData
{
// 스테이지 클리어 데이터의 고유 id
public string id;
// 클리어한 캐릭터 아이디
public string characterId;
// 클리어한 스테이지 아이디
public string stageId;
// 클리어에 소요된 시간
public float clearTime;
// 클리어 시간에 따른 별점
public int starRating;
// 클리어한 날짜와 시간 정보
public string dateTime;
public StageClearData(string characterId, string stageId, float clearTime, int starRating)
{
id = $"SC{DateTime.UtcNow:yyyyMMddHHmmss}-{characterId}-{stageId}";
this.characterId = characterId;
this.stageId = stageId;
this.clearTime = Mathf.Round(clearTime * 100f) / 100f; ;
this.starRating = starRating;
dateTime = DateTime.UtcNow.ToString();
}
}
}