海淀天下城电子沙盘单机版
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

52 lines
1.1 KiB

using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using System.IO;
using AX.Serialization;
using UnityEngine.SceneManagement;
public class ReplayButton : MonoBehaviour {
public string fileFullPath;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
private void OnEnable()
{
GetComponent<Button>().onClick.AddListener(OnClick);
}
private void OnDisable()
{
GetComponent<Button>().onClick.RemoveListener(OnClick);
}
private void OnDestroy()
{
GetComponent<Button>().onClick.RemoveListener(OnClick);
}
private void OnClick()
{
if (File.Exists(fileFullPath))
{
var fileAllBytes = File.ReadAllBytes(fileFullPath);
Replay.inputHistory = fileAllBytes.CompressedDeserialize<InputHistory>();
GameSettings.othersSettings.isReplayMode = true;
SceneManager.LoadScene("MainScene");
}
}
}