62 lines
1.5 KiB
C#
62 lines
1.5 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.U2D;
|
|
using UnityEngine.UI;
|
|
using VersionFlow.Runtime;
|
|
|
|
public class test : MonoBehaviour, IVersionFlowVisual
|
|
{
|
|
private void Awake()
|
|
{
|
|
StartCoroutine(VersionFlowX.StartVersionFlow(this));
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
if (Input.GetKeyDown(KeyCode.Keypad1))
|
|
VersionFlowX.BundleMgr.Instantiate("Assets/Test/UI/p1.prefab", uiParent);
|
|
if (Input.GetKeyDown(KeyCode.Keypad2))
|
|
VersionFlowX.BundleMgr.Instantiate("Assets/Test/UI/p2.prefab", uiParent);
|
|
}
|
|
|
|
[SerializeField]
|
|
Text ui_state;
|
|
[SerializeField]
|
|
Slider ui_slider;
|
|
[SerializeField]
|
|
RectTransform uiParent;
|
|
|
|
public void StateChange(EnumVersionFlowState state)
|
|
{
|
|
ui_state.text = state.ToString();
|
|
}
|
|
|
|
public void ShowDownloadProgress(ulong downloadBytes, ulong totalBytes)
|
|
{
|
|
ui_slider.minValue = 0;
|
|
ui_slider.maxValue = totalBytes;
|
|
ui_slider.value = downloadBytes;
|
|
}
|
|
|
|
public void HideDownloadProgress()
|
|
{
|
|
ui_slider.gameObject.SetActive(false);
|
|
}
|
|
|
|
public void DownloadConfirm(ulong totalSize, Action<bool> confirm)
|
|
{
|
|
confirm.Invoke(true);
|
|
}
|
|
|
|
public void OnError(string msg, string btnTxt, Action callback, string title = "错误")
|
|
{
|
|
ui_state.text = msg;
|
|
}
|
|
|
|
public void SetVersion(string localVer, string remoteVer)
|
|
{
|
|
}
|
|
}
|