56 lines
1.4 KiB
C#
56 lines
1.4 KiB
C#
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Linq;
|
|||
|
using System.Text;
|
|||
|
using UnityEngine;
|
|||
|
using UnityEngine.Gonbest.MagicCube;
|
|||
|
|
|||
|
namespace Thousandto.Launcher.Form
|
|||
|
{
|
|||
|
/// <summary>
|
|||
|
/// 上传日志的任务
|
|||
|
/// </summary>
|
|||
|
public class FUnityUploadLogTask
|
|||
|
{
|
|||
|
private bool _isRunning = false;
|
|||
|
private float _progress = 0;
|
|||
|
|
|||
|
public float Progress
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
return _progress;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public bool IsRunning { get { return _isRunning; } set { _isRunning = value; } }
|
|||
|
|
|||
|
public void Start()
|
|||
|
{
|
|||
|
_progress = 0;
|
|||
|
_isRunning = true;
|
|||
|
if (AppManager.Instance.LocalVersionData.ContainsKey("UploadServerURL"))
|
|||
|
{
|
|||
|
var url = AppManager.Instance.LocalVersionData["UploadServerURL"];
|
|||
|
Debug.Log("上传日志:目标地址为:"+url);
|
|||
|
FLogUploader.StartUploadLog(url, OnProgressHandler, OnFailHandler);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
Debug.LogError("上传日志:从包体内获取上传地址失败!");
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
private void OnProgressHandler(float val)
|
|||
|
{
|
|||
|
_progress = val;
|
|||
|
}
|
|||
|
|
|||
|
private void OnFailHandler(int val)
|
|||
|
{
|
|||
|
Debug.Log("上传日志:上传完毕!"+val);
|
|||
|
_isRunning = false;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|