using System;
|
using System.Collections.Generic;
|
using System.IO;
|
using UnityEngine;
|
|
|
public class DownLoadAssetTask : LaunchTask
|
{
|
public override float expectTime
|
{
|
get { return LocalSave.GetFloat("DownLoadAssetTask_ExpectTime", 3f); }
|
protected set { LocalSave.SetFloat("DownLoadAssetTask_ExpectTime", value); }
|
}
|
|
public override void Begin()
|
{
|
LaunchInHot.m_CurrentStage = LaunchStage.DownLoad;
|
outTime = 9999f;
|
duration = Mathf.Max(0.5f, expectTime);
|
if (VersionUtility.Instance.NeedDownAsset())
|
{
|
if (!AssetVersionUtility.priorAssetDownLoadDone)
|
{
|
AssetVersionUtility.BeginDownLoadTask(true);
|
done = false;
|
progress = 0f;
|
}
|
else
|
{
|
done = true;
|
}
|
|
}
|
else
|
{
|
done = true;
|
}
|
}
|
|
public override void End()
|
{
|
expectTime = timer;
|
Debug.LogFormat("{0}执行时长:{1};", this.GetType().Name, timer);
|
if (!AssetVersionUtility.unPriorAssetDownLoadDone)
|
{
|
AssetVersionUtility.BeginDownLoadTask(false);
|
}
|
}
|
|
public override void Update()
|
{
|
if (done)
|
{
|
return;
|
}
|
|
timer += Time.deltaTime;
|
if (!AssetVersionUtility.priorAssetDownLoadDone)
|
{
|
done = false;
|
progress = 0f;
|
}
|
else
|
{
|
done = true;
|
}
|
|
ExceptionReport();
|
}
|
|
}
|
|
public class AssetBundleInitTask : LaunchTask
|
{
|
public override float expectTime
|
{
|
get { return LocalSave.GetFloat("AssetBundleInitTask_ExpectTime", 1f); }
|
protected set { LocalSave.SetFloat("AssetBundleInitTask_ExpectTime", value); }
|
}
|
|
public override void Begin()
|
{
|
LaunchInHot.m_CurrentStage = LaunchStage.AssetBundleInit;
|
|
duration = Mathf.Max(0.5f, expectTime);
|
if (!AssetSource.allFromEditor)
|
{
|
AssetBundleUtility.Instance.Initialize();
|
done = false;
|
progress = 0f;
|
}
|
else
|
{
|
done = true;
|
}
|
}
|
|
public override void End()
|
{
|
expectTime = timer;
|
// TODO YYL
|
// UILoader.LoadWindowAsync("LaunchBackGroundWin", null);
|
Debug.LogFormat("{0}执行时长:{1};", this.GetType().Name, timer);
|
}
|
|
public override void Update()
|
{
|
if (done)
|
{
|
return;
|
}
|
|
if (AssetBundleUtility.Instance.initialized && AssetBundleUtility.Instance.initializedUIAssetBundle)
|
{
|
done = true;
|
}
|
else
|
{
|
done = false;
|
progress = timer / duration;
|
}
|
|
ExceptionReport();
|
}
|
}
|
|
public class ConfigInitTask : LaunchTask
|
{
|
public override float expectTime
|
{
|
get { return LocalSave.GetFloat("ConfigInitTask_ExpectTime", 10f); }
|
protected set { LocalSave.SetFloat("ConfigInitTask_ExpectTime", value); }
|
}
|
|
float threshold = 1f;
|
|
public override void Begin()
|
{
|
LaunchInHot.m_CurrentStage = LaunchStage.ConfigInit;
|
duration = Mathf.Max(0.5f, expectTime);
|
threshold = Application.platform == RuntimePlatform.WindowsEditor ? 1f : 0.9f;
|
|
// LaunchPostProcess.Instance.Begin();
|
// InitialFunctionConfig.Init(true); //有更新再初始化一次
|
}
|
|
public override void End()
|
{
|
expectTime = timer;
|
Debug.LogFormat("{0}执行时长:{1};", this.GetType().Name, timer);
|
|
// TODO YYL
|
// OperationLogCollect.Instance.RecordLauchEvent(3);
|
// OperationLogCollect.Instance.RecordEvent(3);
|
}
|
|
public override void Update()
|
{
|
if (done)
|
{
|
return;
|
}
|
|
timer += Time.deltaTime;
|
// if (!ConfigInitiator.IsLoginConfigInited)\
|
// TODO YYL
|
// if (!ConfigInitiator.done)
|
// {
|
// done = false;
|
// progress = timer / duration;
|
// }
|
// else
|
{
|
done = true;
|
}
|
|
ExceptionReport();
|
}
|
|
}
|
|
public class LaunchFadeOutTask : LaunchTask
|
{
|
public override float expectTime
|
{
|
get { return LocalSave.GetFloat("LaunchFadeOutTask_ExpectTime", 1f); }
|
protected set { LocalSave.SetFloat("LaunchFadeOutTask_ExpectTime", value); }
|
}
|
|
public override void Begin()
|
{
|
LaunchInHot.m_CurrentStage = LaunchStage.Complete;
|
duration = 0.5f;
|
|
ShaderUtility.WarmUpAll();
|
//SpeechTranslate.Instance.RequestGetToken();
|
// TODO CYL
|
// WindowCenter.Instance.Open<LaunchBackGroundWin>(true);
|
|
// var launchWin = WindowCenter.Instance.Get<LaunchWin>();
|
// if (launchWin != null)
|
// {
|
// launchWin.FadeOut();
|
// }
|
|
// try
|
// {
|
// LogicLauncher.LaunchStart();
|
// }
|
// catch (Exception e)
|
// {
|
// UnityEngine.Debug.LogError(e);
|
// }
|
}
|
|
public override void End()
|
{
|
expectTime = timer;
|
Debug.LogFormat("{0}执行时长:{1};", this.GetType().Name, timer);
|
|
|
}
|
|
public override void Update()
|
{
|
if (done)
|
{
|
return;
|
}
|
timer += Time.deltaTime;
|
|
if (timer >= 0.5f)//&& ILLauncherProxy.Instance.started)
|
{
|
done = true;
|
}
|
else
|
{
|
done = false;
|
progress = Mathf.Clamp01(timer / expectTime);
|
}
|
|
ExceptionReport();
|
}
|
|
}
|
|
public class WaitTask : LaunchTask
|
{
|
public WaitTask(float seconds)
|
{
|
expectTime = Mathf.Max(0.1f, seconds);
|
}
|
|
public override void Begin()
|
{
|
}
|
|
public override void End()
|
{
|
}
|
|
public override void Update()
|
{
|
timer += Time.deltaTime;
|
|
if (timer >= expectTime)
|
{
|
done = true;
|
}
|
else
|
{
|
done = false;
|
progress = Mathf.Clamp01(timer / expectTime);
|
}
|
}
|
|
}
|