This commit is contained in:
2026-02-12 22:15:15 +08:00
parent 47a5cff08b
commit 502c6efedc
58 changed files with 2114 additions and 708 deletions

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 438abb1f3b6d4cc0b53b38e4a3ce2dca
timeCreated: 1770893968

View File

@@ -0,0 +1,27 @@
/**本脚本为自动生成每次生成会覆盖请勿手动修改生成插件文档及项目地址https://git.whoot.com/whoot-games/whoot.fguieditorplugin**/
using FairyGUI;
using FairyGUI.Utils;
using NBC;
namespace NBF
{
public partial class VideoEditorItem
{
public const string URL = "ui://hxr7rc7pxjb91hr";
public GButton BtnEdit;
public GButton BtnDelete;
public override void ConstructFromXML(XML xml)
{
base.ConstructFromXML(xml);
BtnEdit = (GButton)GetChild("BtnEdit");
BtnDelete = (GButton)GetChild("BtnDelete");
OnInited();
UILanguage.TrySetComponentLanguage(this);
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 099e24366cdaca745a18241b7f4433f3
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,27 @@
// 本脚本只在不存在时会生成一次。组件逻辑写在当前脚本内。已存在不会再次生成覆盖
using UnityEngine;
using FairyGUI;
using NBC;
namespace NBF
{
public partial class VideoEditorItem : GButton
{
private VideoRetData _video;
private void OnInited()
{
BtnDelete.onClick.Set(OnBtnDelete);
}
public void InitData(VideoRetData videoRetData)
{
_video = videoRetData;
}
private void OnBtnDelete()
{
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 9084f28041b341548a5902db8e6f8fce
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,44 @@
/**本脚本为自动生成每次生成会覆盖请勿手动修改生成插件文档及项目地址https://git.whoot.com/whoot-games/whoot.fguieditorplugin**/
using FairyGUI;
using FairyGUI.Utils;
using NBC;
using System.Collections.Generic;
namespace NBF
{
/// <summary> </summary>
public partial class VideoEditorPanel
{
public GObject this[string aKey] => ContentPane.GetChild(aKey);
public override string UIPackName => "Main";
public override string UIResName => "VideoEditorPanel";
[AutoFind(Name = "page")]
public Controller page;
[AutoFind(Name = "List")]
public VideoListPage List;
[AutoFind(Name = "Nav")]
public GLabel Nav;
[AutoFind(Name = "BtnStatistics")]
public GButton BtnStatistics;
[AutoFind(Name = "BtnVideoList")]
public GButton BtnVideoList;
[AutoFind(Name = "BtnAdd")]
public GButton BtnAdd;
[AutoFind(Name = "BtnDevice")]
public GButton BtnDevice;
[AutoFind(Name = "BtnAdmin")]
public GButton BtnAdmin;
[AutoFind(Name = "MenuGroup")]
public GGroup MenuGroup;
public override string[] GetDependPackages(){ return new string[] {}; }
public static void Show(object param = null){ UI.Inst.OpenUI<VideoEditorPanel>(param); }
public static void Hide(){ UI.Inst.HideUI<VideoEditorPanel>(); }
public static void Del(){ UI.Inst.DestroyUI<VideoEditorPanel>(); }
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 27be91422465e4b47931adc9c17d8585
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,11 @@
// 本脚本只在不存在时会生成一次。已存在不会再次生成覆盖
using UnityEngine;
using NBC;
namespace NBF
{
public partial class VideoEditorPanel : UIPanel
{
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 768e9416eb4a9a74c894f1244463d0e6
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,25 @@
/**本脚本为自动生成每次生成会覆盖请勿手动修改生成插件文档及项目地址https://git.whoot.com/whoot-games/whoot.fguieditorplugin**/
using FairyGUI;
using FairyGUI.Utils;
using NBC;
namespace NBF
{
public partial class VideoListPage
{
public const string URL = "ui://hxr7rc7pxjb91hz";
public GList List;
public override void ConstructFromXML(XML xml)
{
base.ConstructFromXML(xml);
List = (GList)GetChild("List");
OnInited();
UILanguage.TrySetComponentLanguage(this);
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 82bf9bcc224708147b555ad12a9f8536
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,97 @@
// 本脚本只在不存在时会生成一次。组件逻辑写在当前脚本内。已存在不会再次生成覆盖
using System.Collections.Generic;
using UnityEngine;
using FairyGUI;
using NBC;
namespace NBF
{
public partial class VideoListPage : GComponent
{
public const int PageSize = 20;
private readonly List<VideoRetData> Videos = new List<VideoRetData>();
private GComponent _footer;
private Controller _controller;
public int Page = 0;
private void OnInited()
{
List.itemRenderer = RenderListItem1;
List.SetVirtual();
List.scrollPane.onPullUpRelease.Add(OnPullUpToRefresh);
_footer = (GComponent)List.scrollPane.footer;
_controller = _footer.GetController("style");
}
private void SetList()
{
List.numItems = Videos.Count;
}
void RenderListItem1(int index, GObject obj)
{
if (obj is VideoEditorItem item)
{
}
// GButton item = obj.asButton;
// item.title = "Item " + (_list1.numItems - index - 1);
}
void OnPullUpToRefresh()
{
_controller.selectedIndex = 1;
List.scrollPane.LockFooter(_footer.sourceHeight);
GetList(Page + 1);
// //Simulate a async resquest
// Timers.inst.Add(2, 1, (object param) =>
// {
// List.numItems += 5;
//
// //Refresh completed
// _controller.selectedIndex = 0;
// List.scrollPane.LockFooter(0);
// });
}
#region
private void GetList(int page)
{
if (page < 1) return;
var dic = new Dictionary<string, string>
{
{ "page", page.ToString() },
{ "PageSize", PageSize.ToString() }
};
Net.Instance.Send("/api/list", dic, ParseVideo);
}
private void ParseVideo(HttpResult httpResult)
{
_controller.selectedIndex = 0;
List.scrollPane.LockFooter(0);
if (httpResult.Code == 0)
{
var retData = httpResult.Data.ToObject<PageListData<VideoRetData>>();
if (retData != null)
{
if (retData.List.Count > 0)
{
Videos.AddRange(retData.List);
}
Page = retData.Page;
}
}
SetList();
}
#endregion
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f48b7c83438fa874f835afb8a9adf58f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -12,6 +12,7 @@ namespace NBF
{
private string serverUrl;
private string serverPassword;
private bool autoLogin = true;
protected override void OnInit()
{
@@ -29,7 +30,7 @@ namespace NBF
InputPass.Input.text = serverPassword;
if (!string.IsNullOrEmpty(serverUrl) && !string.IsNullOrEmpty(serverPassword))
{
Connect();
if (autoLogin) Connect();
}
}
@@ -62,12 +63,16 @@ namespace NBF
PlayerPrefs.SetString("serverUrl", serverUrl);
PlayerPrefs.SetString("serverPassword", serverPassword);
Game.Instance.Tick((ret) =>
// PlayerPanel.Show();
autoLogin = false;
Net.Instance.Tick(0, 0, 0, (ret) =>
{
if (ret)
if (ret.Code == 0)
{
PlayerPanel.Show();
// PlayerPanel.Show();
VideoEditorPanel.Show();
}
else
{

View File

@@ -10,8 +10,11 @@ namespace NBF
public static void BindAll()
{
UIObjectFactory.SetPackageItemExtension(CommonInput.URL, typeof(CommonInput));
UIObjectFactory.SetPackageItemExtension(PlayRightGroup.URL, typeof(PlayRightGroup));
UIObjectFactory.SetPackageItemExtension(PlayerBottomInfo.URL, typeof(PlayerBottomInfo));
UIObjectFactory.SetPackageItemExtension(VideoPlayer.URL, typeof(VideoPlayer));
UIObjectFactory.SetPackageItemExtension(VideoEditorItem.URL, typeof(VideoEditorItem));
UIObjectFactory.SetPackageItemExtension(VideoListPage.URL, typeof(VideoListPage));
}
}
}

View File

@@ -0,0 +1,33 @@
/**本脚本为自动生成每次生成会覆盖请勿手动修改生成插件文档及项目地址https://git.whoot.com/whoot-games/whoot.fguieditorplugin**/
using FairyGUI;
using FairyGUI.Utils;
using NBC;
namespace NBF
{
public partial class PlayRightGroup
{
public const string URL = "ui://hxr7rc7pt33p1h6";
public GComponent Head;
public GButton BtnLike;
public GButton BtnMessage;
public GButton BtnCollect;
public GButton BtnShare;
public override void ConstructFromXML(XML xml)
{
base.ConstructFromXML(xml);
Head = (GComponent)GetChild("Head");
BtnLike = (GButton)GetChild("BtnLike");
BtnMessage = (GButton)GetChild("BtnMessage");
BtnCollect = (GButton)GetChild("BtnCollect");
BtnShare = (GButton)GetChild("BtnShare");
OnInited();
UILanguage.TrySetComponentLanguage(this);
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 4dc0689bc069b2543be2ec2fb3b217a2
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,23 @@
// 本脚本只在不存在时会生成一次。组件逻辑写在当前脚本内。已存在不会再次生成覆盖
using UnityEngine;
using FairyGUI;
using NBC;
namespace NBF
{
public partial class PlayRightGroup : GComponent
{
private void OnInited()
{
}
public void SetData(VideoRetData videoRetData)
{
BtnLike.title = videoRetData.Like.FormatNumber();
BtnCollect.title = videoRetData.Collect.FormatNumber();
BtnMessage.title = videoRetData.Message.FormatNumber();
BtnShare.title = videoRetData.Share.FormatNumber();
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: ad974c2bb232b2a428c282c4333372a4
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -11,5 +11,11 @@ namespace NBF
private void OnInited()
{
}
public void SetData(VideoRetData videoRetData)
{
TextName.text = $"@{videoRetData.AuthorName}";
TextDesc.text = $"@{videoRetData.Title}{videoRetData.Desc}";
}
}
}

View File

@@ -14,20 +14,20 @@ namespace NBF
public override string UIPackName => "Main";
public override string UIResName => "PlayerPanel";
[AutoFind(Name = "stageCtrl")]
public Controller stageCtrl;
[AutoFind(Name = "PlayBack")]
public GGraph PlayBack;
[AutoFind(Name = "Video")]
public VideoPlayer Video;
[AutoFind(Name = "VideoMask")]
public GGraph VideoMask;
[AutoFind(Name = "bottomBack")]
public GGraph bottomBack;
[AutoFind(Name = "BtnNext")]
public GButton BtnNext;
[AutoFind(Name = "BtnPrev")]
public GButton BtnPrev;
[AutoFind(Name = "VideoTop")]
public VideoPlayer VideoTop;
[AutoFind(Name = "Video")]
public VideoPlayer Video;
[AutoFind(Name = "VideoBottom")]
public VideoPlayer VideoBottom;
[AutoFind(Name = "Progress")]
public GProgressBar Progress;
[AutoFind(Name = "BtnPause")]
public GComponent BtnPause;
public override string[] GetDependPackages(){ return new string[] {}; }
public static void Show(object param = null){ UI.Inst.OpenUI<PlayerPanel>(param); }

View File

@@ -1,5 +1,7 @@
// 本脚本只在不存在时会生成一次。已存在不会再次生成覆盖
using System;
using System.Collections.Generic;
using FairyGUI;
using UnityEngine;
using NBC;
@@ -16,45 +18,138 @@ namespace NBF
this.AutoAddClick(OnClick);
TryGetTime = 5;
Progress.max = 1;
GetVideoData();
stageCtrl.selectedIndex = 0;
}
private void GetVideoData()
protected override void OnInit()
{
Game.Instance.GetList(OnGetList);
SwipeGesture gesture = new SwipeGesture(BtnPause);
gesture.onBegin.Set(OnSwipeBegin);
gesture.onMove.Set(OnSwipeMove);
gesture.onEnd.Set(OnSwipeEnd);
gesture.onAction.Add(OnSwipeGesture);
Game.Instance.PreLoadNextData(Nmsl);
// ResetPlayerPos();
}
private void OnGetList()
private void Nmsl()
{
if (Game.Instance.Videos.Count > 0)
Play(0);
}
#region UI组件管理
// private void ResetPlayerPos()
// {
// for (int i = 0; i < _videoPlayers.Count; i++)
// {
// var player = _videoPlayers[i];
// player.y = BtnPause.height * (i - 1);
// player.x = 0;
// player.size = BtnPause.size;
// }
// }
#endregion
#region
// private int _tryTime = 1;
// private int _lastPlayValue;
private int _nowIndex = 0;
public void Play(int value = 0)
{
var nowIndex = _nowIndex + value;
VideoTop.PlayVideo(nowIndex - 1, VideoPlayMode.Top);
VideoBottom.PlayVideo(nowIndex + 1, VideoPlayMode.Bottom);
Video.PlayVideo(nowIndex, VideoPlayMode.Mid);
_nowIndex = nowIndex;
Video.height = BtnPause.height;
VideoTop.height = BtnPause.height;
VideoBottom.height = BtnPause.height;
VideoManager.Instance.ReturnPlayer(_nowIndex);
}
#endregion
#region
private float _defY = 0;
private float _offsetValue;
private void OnSwipeBegin(EventContext context)
{
_offsetValue = 0;
}
private void OnSwipeMove(EventContext context)
{
// if (IsLoading) return;
var gesture = context.sender as SwipeGesture;
if (gesture == null) return;
_offsetValue += gesture.delta.y;
if (_nowIndex == 0 && _offsetValue > 0)
{
stageCtrl.selectedIndex = 1;
return; // 第一个不允许滑动至上一个
}
else
Video.y = _defY + _offsetValue;
}
private void OnSwipeEnd(EventContext context)
{
Video.y = _defY;
}
private void OnSwipeGesture(EventContext context)
{
// if (IsLoading) return;
SwipeGesture swipeGesture = (SwipeGesture)context.sender;
var value = Math.Abs(_offsetValue);
if (value < 300)
{
Notices.Show($"没有视频数据!{TryGetTime}秒后重试");
Timer.Once(TryGetTime, this, GetVideoData);
TryGetTime *= 2;
return;
}
if (swipeGesture.position.y < 0) //向上滑动
{
Log.Info($"向上滑动 切换下一个视频 _offsetValue={_offsetValue} y={swipeGesture.position.y}");
if (Game.Instance.IsLastVideo(_nowIndex))
{
Game.Instance.PreLoadNextData();
return;
}
Play(1);
}
else if (_nowIndex > 0)
{
Log.Info($"向下滑动 切换上一个视频 _offsetValue={_offsetValue} y={swipeGesture.position.y}");
Play(-1);
}
}
#endregion
protected override void OnUpdate()
{
base.OnUpdate();
Progress.value = VideoManager.Instance.PlayProgress;
// Progress.value = VideoManager.Instance.PlayProgress;
}
private void OnClick(GComponent btn)
{
if (btn == BtnNext)
{
VideoManager.Instance.Next();
}
else if (btn == BtnPrev)
{
VideoManager.Instance.Previous();
}
// if (btn == BtnNext)
// {
// // VideoManager.Instance.Next();
// }
// else if (btn == BtnPrev)
// {
// // VideoManager.Instance.Previous();
// }
}
}
}

View File

@@ -22,8 +22,6 @@ namespace NBF
Add("ui://hxr7rc7pfhdrzd", new UIComponentLanguage()
{
{ "n12_t33p", "请输入账号" },
{ "n13_t33p", "请输入密码" },
{ "n10_t33p", "请输入服务器地址" },
}
);

View File

@@ -12,9 +12,12 @@ namespace NBF
public const string URL = "ui://hxr7rc7pt33p1hg";
public Controller pauseCtrl;
public Controller stageCtrl;
public GGraph PlayBack;
public GLoader VideoVer;
public GComponent BtnPause;
public PlayerBottomInfo BottomInfo;
public PlayRightGroup LeftInfo;
public Transition pause;
public Transition play;
public Transition StartedAnim;
@@ -24,9 +27,12 @@ namespace NBF
base.ConstructFromXML(xml);
pauseCtrl = GetController("pauseCtrl");
stageCtrl = GetController("stageCtrl");
PlayBack = (GGraph)GetChild("PlayBack");
VideoVer = (GLoader)GetChild("VideoVer");
BtnPause = (GComponent)GetChild("BtnPause");
BottomInfo = (PlayerBottomInfo)GetChild("BottomInfo");
LeftInfo = (PlayRightGroup)GetChild("LeftInfo");
pause = GetTransition("pause");
play = GetTransition("play");
StartedAnim = GetTransition("StartedAnim");

View File

@@ -1,130 +1,188 @@
// 本脚本只在不存在时会生成一次。组件逻辑写在当前脚本内。已存在不会再次生成覆盖
using System;
using UnityEngine;
using FairyGUI;
using NBC;
using RenderHeads.Media.AVProVideo;
namespace NBF
{
public enum VideoPlayMode
{
Top,
Mid,
Bottom
}
public partial class VideoPlayer : GComponent
{
private VideoPlayerComponent _playerComponent;
private NTexture _texture;
private float _defY;
public bool IsLoading => stageCtrl.selectedIndex == 0;
private VideoRetData _videoRetData;
public int VideoIndex { get; private set; }
private void OnInited()
{
VideoManager.Instance.OnPlayStart += OnPlayStart;
VideoManager.Instance.OnHandleEvent += OnHandleEvent;
BtnPause.onClick.Set(OnClickPause);
}
SwipeGesture gesture = new SwipeGesture(BtnPause);
gesture.onBegin.Set(OnSwipeBegin);
gesture.onMove.Set(OnSwipeMove);
gesture.onEnd.Set(OnSwipeEnd);
gesture.onAction.Add(OnSwipeGesture);
_defY = VideoVer.y;
// Video.texture = new NTexture(Game.Instance.RT);
// Player.on
// Player.OpenMedia()
public void PlayVideo(int videoIndex, VideoPlayMode mode)
{
VideoIndex = videoIndex;
name = videoIndex.ToString();
gameObjectName = videoIndex.ToString();
if (VideoIndex < 0) return;
_videoRetData = Game.Instance.GetVideoDataByIndex(videoIndex);
if (_playerComponent != null)
{
StopVideo();
}
// stageCtrl.selectedIndex = 0;
// _videoRetData = videoRetData;
_playerComponent = VideoManager.Instance.GetPlayer(VideoIndex);
_playerComponent.VideoIndex = videoIndex;
_playerComponent.OnPlayStart += OnPlayStart;
_playerComponent.OnHandleEvent += OnHandleEvent;
var videoUrl = $"{Net.Instance.ServerUrl}/files/videos/{_videoRetData.FilePath}";
_playerComponent.ChangeVideo(videoUrl, mode == VideoPlayMode.Mid);
SetRt();
// _playerComponent =
}
public void StopVideo()
{
// var offset = _playerComponent.VideoIndex
// if(_playerComponent.VideoIndex)
_playerComponent.OnPlayStart -= OnPlayStart;
_playerComponent.OnHandleEvent -= OnHandleEvent;
}
protected override void OnUpdate()
{
base.OnUpdate();
UpdateTick();
}
public override void Dispose()
{
VideoManager.Instance.OnPlayStart -= OnPlayStart;
VideoManager.Instance.OnHandleEvent -= OnHandleEvent;
if (_texture != null)
{
_texture.Dispose();
}
StopVideo();
// if (_texture != null)
// {
// _texture.Dispose();
// }
base.Dispose();
}
#region
private float _offsetValue;
private void OnSwipeBegin(EventContext context)
{
}
private void OnSwipeMove(EventContext context)
{
var gesture = context.sender as SwipeGesture;
if (gesture == null) return;
Log.Info($"gesture.delta.y={gesture.delta.y}");
_offsetValue += gesture.delta.y;
VideoVer.y = _defY + _offsetValue;
}
private void OnSwipeEnd(EventContext context)
{
_offsetValue = 0;
VideoVer.y = _defY;
}
private void OnSwipeGesture(EventContext context)
{
SwipeGesture swipeGesture = (SwipeGesture)context.sender;
var value = Math.Abs(swipeGesture.position.y);
if (value < 200)
{
return;
}
if (swipeGesture.position.y < 0) //向上滑动
{
Log.Info($"向上滑动 y={swipeGesture.position.y}");
VideoManager.Instance.Next();
}
else
{
Log.Info($"向下滑动 y={swipeGesture.position.y}");
VideoManager.Instance.Previous();
}
VideoVer.alpha = 0;
}
#endregion
#region
private void OnHandleEvent(MediaPlayerEvent.EventType eventType)
{
if (isDisposed) return;
if (displayObject == null) return;
if (displayObject.gameObject == null) return;
if (eventType == MediaPlayerEvent.EventType.Paused)
{
// pauseCtrl.selectedIndex = 1;
pauseCtrl.selectedIndex = 1;
}
else if (eventType == MediaPlayerEvent.EventType.Unpaused)
{
pauseCtrl.selectedIndex = 0;
}
// else if (eventType == MediaPlayerEvent.EventType.Unpaused ||
// eventType == MediaPlayerEvent.EventType.Started)
// {
// // pauseCtrl.selectedIndex = 0;
// }
else if (eventType == MediaPlayerEvent.EventType.Started)
{
_watchCount = 1;
pauseCtrl.selectedIndex = 0;
stageCtrl.selectedIndex = 1;
StartedAnim.Play();
}
else if (eventType == MediaPlayerEvent.EventType.StartedSeeking)
{
_watchCount++;
Tick(); //重播时也上报tick
}
}
private void OnPlayStart(RenderTexture rt)
{
// if (_texture != null)
// {
// _texture.Dispose();
// }
//
// if (_playerComponent != null)
// {
// _texture = new NTexture(_playerComponent.NowRT);
// VideoVer.texture = _texture;
// }
if (_texture.width != rt.width || _texture.height != rt.height)
{
SetRt();
}
// _texture.width = rt.width;
// _texture.
stageCtrl.selectedIndex = 1;
}
private void SetRt()
{
if (_texture != null)
{
_texture.Dispose();
}
_texture = new NTexture(rt);
VideoVer.texture = _texture;
if (_playerComponent != null)
{
_texture = new NTexture(_playerComponent.NowRT)
{
destroyMethod = DestroyMethod.Custom
};
VideoVer.texture = _texture;
}
}
#endregion
#region
private void OnClickPause()
{
VideoManager.Instance.TogglePlayPause();
_playerComponent.TogglePlayPause();
}
#endregion
#region tick
private float _videoPlayTime;
private int _watchCount;
private void UpdateTick()
{
if (IsLoading) return;
if (_playerComponent.IsPlaying)
{
_videoPlayTime += Time.deltaTime;
if (_videoPlayTime >= 5)
{
Tick(); //5秒上报一次
}
}
}
private void Tick()
{
if (_videoRetData == null) return;
Net.Instance.Tick(_videoRetData.Id, (int)_videoPlayTime, _watchCount);
_watchCount = 0;
_videoPlayTime = 0;
}
#endregion