贺州人民医院电子沙盘
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.
 
 
 
 

51 lines
1.2 KiB

using AX.NetworkSystem;
using System;
using System.IO;
using UnityEngine;
public class UploadFileTest : MonoBehaviour
{
public string Fullname;
public string Filename;
private string progress;
private bool completed;
private void Start()
{
if (Fullname == null || Filename == null)
throw new ArgumentNullException(Fullname + " | " + Filename);
}
private void OnGUI()
{
GUILayout.BeginArea(new Rect(0, 0, 600, 400));
GUILayout.BeginVertical();
if (GUILayout.Button("上传文件" + "{" + Fullname + "}"))
{
NetworkManager.Default.UploadFileAsync(Fullname, Filename, null, OnProgressChanged, OnCompleted);
}
GUILayout.BeginHorizontal();
GUILayout.Label(Fullname + ": 进度 ");
GUILayout.Label(progress + ", 完成 ");
GUILayout.Label(completed ? "√" : "×");
GUILayout.EndHorizontal();
GUILayout.EndVertical();
GUILayout.EndArea();
}
private void OnCompleted(string fullname, string filename)
{
completed = true;
}
private void OnProgressChanged(string fullname, string filename, float progress)
{
this.progress = progress.ToString();
}
}