86 lines
2.2 KiB
C#
86 lines
2.2 KiB
C#
|
|
using QFramework.Example;
|
||
|
|
using System;
|
||
|
|
using UnityEngine;
|
||
|
|
|
||
|
|
namespace QFramework
|
||
|
|
{
|
||
|
|
internal class VideoAction : IAction
|
||
|
|
{
|
||
|
|
public string txt;
|
||
|
|
public System.Action OnFinished { get; set; }
|
||
|
|
|
||
|
|
|
||
|
|
private VideoAction()
|
||
|
|
{
|
||
|
|
}
|
||
|
|
|
||
|
|
private static readonly SimpleObjectPool<VideoAction> mPool =
|
||
|
|
new SimpleObjectPool<VideoAction>(() => new VideoAction(), null, 10);
|
||
|
|
|
||
|
|
public string url;
|
||
|
|
public string size;
|
||
|
|
public string offset;
|
||
|
|
public string finishedEvent;
|
||
|
|
public string closeEvent;
|
||
|
|
public static VideoAction Allocate(string url, string size, string offset, string finishedEvent, string closeEvent, System.Action OnFinished = null)
|
||
|
|
{
|
||
|
|
var retNode = mPool.Allocate();
|
||
|
|
retNode.ActionID = ActionKit.ID_GENERATOR++;
|
||
|
|
retNode.Deinited = false;
|
||
|
|
retNode.Reset();
|
||
|
|
retNode.url = url;
|
||
|
|
retNode.size = size;
|
||
|
|
retNode.offset = offset;
|
||
|
|
retNode.finishedEvent = finishedEvent;
|
||
|
|
retNode.closeEvent = closeEvent;
|
||
|
|
retNode.OnFinished = OnFinished;
|
||
|
|
return retNode;
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
public ulong ActionID { get; set; }
|
||
|
|
public ActionStatus Status { get; set; }
|
||
|
|
|
||
|
|
public void OnStart()
|
||
|
|
{
|
||
|
|
UIVideoData data = new UIVideoData();
|
||
|
|
data.url = url;
|
||
|
|
data.size = Utility.GetVector2FromStrArray(size);
|
||
|
|
data.offset = Utility.GetVector2FromStrArray(offset);
|
||
|
|
data.finishedEvent = finishedEvent;
|
||
|
|
data.closeEvent = closeEvent;
|
||
|
|
UIKit.OpenPanelAsync<UIVideo>(uiData: data, canvasLevel: UILevel.PopUI).ToAction().StartGlobal(() => this.Finish());
|
||
|
|
}
|
||
|
|
|
||
|
|
public void OnExecute(float dt)
|
||
|
|
{
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
public void OnFinish()
|
||
|
|
{
|
||
|
|
}
|
||
|
|
|
||
|
|
public void Reset()
|
||
|
|
{
|
||
|
|
Status = ActionStatus.NotStart;
|
||
|
|
Paused = false;
|
||
|
|
}
|
||
|
|
|
||
|
|
public bool Paused { get; set; }
|
||
|
|
|
||
|
|
public void Deinit()
|
||
|
|
{
|
||
|
|
if (!Deinited)
|
||
|
|
{
|
||
|
|
OnFinished = null;
|
||
|
|
Deinited = true;
|
||
|
|
mPool.Recycle(this);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
public bool Deinited { get; set; }
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
}
|