48 lines
1015 B
C#
48 lines
1015 B
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.EventSystems;
|
|
using UnityEngine.UI;
|
|
|
|
public class SaveItem : MonoBehaviour, IPointerClickHandler
|
|
{
|
|
public Text _PlayerName;
|
|
public Text _PlayerLevel;
|
|
|
|
public string DateFileName;
|
|
|
|
public Text DateName;
|
|
|
|
private CharInfo info;
|
|
|
|
public UISaveDate root;
|
|
|
|
public void OnPointerClick(PointerEventData eventData)
|
|
{
|
|
|
|
root.Select(info, DateName.text, DateFileName);
|
|
}
|
|
private void Start()
|
|
{
|
|
Init();
|
|
}
|
|
public void Init()
|
|
{
|
|
//初始化存档数据
|
|
var date = SaveSystem.LoadDate<CharInfo>(DateFileName);
|
|
if (date != null)
|
|
{
|
|
//数据加载
|
|
info = date;
|
|
_PlayerName.text = info.playerName;
|
|
_PlayerLevel.text = "LV " + info.Level.ToString();
|
|
}
|
|
else
|
|
{
|
|
_PlayerName.text = "空白存档";
|
|
_PlayerLevel.text = "LV 1";
|
|
}
|
|
}
|
|
}
|