Initial commit
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class EnumeratorAgent : ModuleAgent {
|
||||
public override void AgentLoadingNetwork(DataNetwork data) {
|
||||
StartCoroutine(data.IWebRequest());
|
||||
}
|
||||
public override void AgentNetwork(DataNetwork data) {
|
||||
StartCoroutine(data.IWebRequest());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7f14f51c40117cc4db70bd544f9ee461
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: be53272c8efb1d74e9e1ebb4aca3c814
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,40 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UIElements;
|
||||
using MuHua;
|
||||
|
||||
public class UICuttingWorkshop : ModuleUIPage {
|
||||
[SceneName] public string scene1;
|
||||
[SceneName] public string scene2;
|
||||
[SceneName] public string scene3;
|
||||
[SceneName] public string returnScene;
|
||||
private Button Button1 => root.Q<Button>("Button1");
|
||||
private Button Button2 => root.Q<Button>("Button2");
|
||||
private Button Button3 => root.Q<Button>("Button3");
|
||||
private Button Button4 => root.Q<Button>("Button4");
|
||||
private Button Button5 => root.Q<Button>("Button5");
|
||||
protected override void Awake() {
|
||||
base.Awake();
|
||||
Button1.clicked += Button1_clicked;
|
||||
Button2.clicked += Button2_clicked;
|
||||
Button3.clicked += Button3_clicked;
|
||||
Button4.clicked += Button4_clicked;
|
||||
Button5.clicked += Button5_clicked;
|
||||
}
|
||||
private void Button1_clicked() {
|
||||
ModuleCore.ModuleScene.LoadSceneAsync(scene1);
|
||||
}
|
||||
private void Button2_clicked() {
|
||||
ModuleCore.ModuleScene.LoadSceneAsync(scene2);
|
||||
}
|
||||
private void Button3_clicked() {
|
||||
ModuleCore.ModuleScene.LoadSceneAsync(scene3);
|
||||
}
|
||||
private void Button4_clicked() {
|
||||
ModuleCore.ModuleScene.LoadSceneAsync(returnScene);
|
||||
}
|
||||
private void Button5_clicked() {
|
||||
ModuleCore.LearningVideoPanel.Open(null);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 51510177a79d2ea43b1390e794b0028f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,62 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UIElements;
|
||||
using MuHua;
|
||||
|
||||
public class UIFactoryScenery : ModuleUIPage {
|
||||
public VisualTreeAsset NavigationUnitlAsset;
|
||||
[SceneName] public string returnScene;
|
||||
public List<NavigationData> navigationDatas = new List<NavigationData>();
|
||||
private Button Button1 => root.Q<Button>("Button1");
|
||||
private Button Button2 => root.Q<Button>("Button2");
|
||||
private Button Button3 => root.Q<Button>("Button3");
|
||||
private Button Button4 => root.Q<Button>("Button4");
|
||||
private MUFoldout Foldout => root.Q<MUFoldout>("MUFoldout");
|
||||
protected override void Awake() {
|
||||
base.Awake();
|
||||
Button1.clicked += Button1_clicked;
|
||||
Button2.clicked += Button2_clicked;
|
||||
Button3.clicked += Button3_clicked;
|
||||
Button4.clicked += Button4_clicked;
|
||||
navigationDatas.ForEach(CreateUINavigationUnit);
|
||||
}
|
||||
private void Button1_clicked() {
|
||||
Debug.Log("自动漫游");
|
||||
}
|
||||
private void Button2_clicked() {
|
||||
Debug.Log("手动漫游");
|
||||
}
|
||||
private void Button3_clicked() {
|
||||
Debug.Log("地图导航");
|
||||
}
|
||||
private void Button4_clicked() {
|
||||
ModuleCore.ModuleScene.LoadSceneAsync(returnScene);
|
||||
}
|
||||
public void CreateUINavigationUnit(NavigationData data) {
|
||||
VisualElement element = NavigationUnitlAsset.Instantiate();
|
||||
UINavigationUnit foldout = new UINavigationUnit(data, element);
|
||||
Foldout.AddContainer(foldout.element);
|
||||
}
|
||||
}
|
||||
[Serializable]
|
||||
public class NavigationData {
|
||||
public string name;
|
||||
[SceneName] public string scene;
|
||||
}
|
||||
public class UINavigationUnit {
|
||||
public readonly NavigationData value;
|
||||
public readonly VisualElement element;
|
||||
public Button Button => element.Q<Button>();
|
||||
public ModuleCore ModuleCore => ModuleCore.I;
|
||||
public UINavigationUnit(NavigationData value, VisualElement element) {
|
||||
this.value = value;
|
||||
this.element = element;
|
||||
Button.text = value.name;
|
||||
Button.clicked += Button_clicked;
|
||||
}
|
||||
private void Button_clicked() {
|
||||
ModuleCore.ModuleScene.LoadSceneAsync(value.scene);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1978c6de87b7e6c47a0c13cb49be0d4b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,7 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class UIGlobalPage : ModuleUIPage {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7c68fd17af7408b48803af81cc1db5c4
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,7 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class UILoginInterface : ModuleUIPage {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a567a47e28606be47bd1914fba0312e2
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,35 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UIElements;
|
||||
using MuHua;
|
||||
|
||||
public class UISewingWorkshop : ModuleUIPage {
|
||||
[SceneName]public string scene1;
|
||||
[SceneName]public string scene2;
|
||||
[SceneName]public string scene3;
|
||||
[SceneName]public string returnScene;
|
||||
private Button Button1 => root.Q<Button>("Button1");
|
||||
private Button Button2 => root.Q<Button>("Button2");
|
||||
private Button Button3 => root.Q<Button>("Button3");
|
||||
private Button Button4 => root.Q<Button>("Button4");
|
||||
protected override void Awake() {
|
||||
base.Awake();
|
||||
Button1.clicked += Button1_clicked;
|
||||
Button2.clicked += Button2_clicked;
|
||||
Button3.clicked += Button3_clicked;
|
||||
Button4.clicked += Button4_clicked;
|
||||
}
|
||||
private void Button1_clicked() {
|
||||
ModuleCore.ModuleScene.LoadSceneAsync(scene1);
|
||||
}
|
||||
private void Button2_clicked() {
|
||||
ModuleCore.ModuleScene.LoadSceneAsync(scene2);
|
||||
}
|
||||
private void Button3_clicked() {
|
||||
ModuleCore.ModuleScene.LoadSceneAsync(scene3);
|
||||
}
|
||||
private void Button4_clicked() {
|
||||
ModuleCore.ModuleScene.LoadSceneAsync(returnScene);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0c6570850e7442d479866de845327cab
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f6a1ae78e41b08249ab073c1ce69255b
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,43 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UIElements;
|
||||
|
||||
public class UIDeviceVideo : ModuleUIPanel<DataVideo> {
|
||||
private DataVideo data;
|
||||
private MediaPlayer mediaPlayer;
|
||||
private Button CloseButton => element.Q<Button>("Close");
|
||||
public override void Awake() {
|
||||
//初始化模块
|
||||
ModuleCore.VideoPanel = this;
|
||||
InitElement();
|
||||
//加载视频媒体ui
|
||||
VisualElement media = element.Q<VisualElement>("MediaPlayer");
|
||||
mediaPlayer = new MediaPlayer(media, MediaPlayerFullScreen);
|
||||
//事件绑定
|
||||
CloseButton.clicked += Close;
|
||||
}
|
||||
public override void Open(DataVideo data) {
|
||||
this.data = data;
|
||||
element.style.display = DisplayStyle.Flex;
|
||||
ModuleCore.ModuleVideo.SetValue(data);
|
||||
mediaPlayer.Open();
|
||||
}
|
||||
public override void Close() {
|
||||
mediaPlayer.Close();
|
||||
element.style.display = DisplayStyle.None;
|
||||
}
|
||||
|
||||
private void LateUpdate() {
|
||||
bool isDisplay = element.resolvedStyle.display == DisplayStyle.Flex;
|
||||
if (isDisplay) { mediaPlayer.Update(); }
|
||||
}
|
||||
/// <summary> 全屏播放功能 </summary>
|
||||
private void MediaPlayerFullScreen() {
|
||||
element.style.display = DisplayStyle.None;
|
||||
ModuleCore.FullScreenVideoPanel.Open(() => {
|
||||
mediaPlayer.Open();
|
||||
element.style.display = DisplayStyle.Flex;
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c7c4649f87cd2db46981cc4cebdf9272
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,65 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UIElements;
|
||||
|
||||
public class UIDeviceVideoImage : ModuleUIPanel<DataVideoImage> {
|
||||
private DataVideoImage data;
|
||||
private MediaPlayer mediaPlayer;
|
||||
//private VisualElement Background => element.Q<VisualElement>("Background");
|
||||
private VisualElement Image => element.Q<VisualElement>("Image");
|
||||
private Button Button1 => element.Q<Button>("Button1");
|
||||
private Button Button2 => element.Q<Button>("Button2");
|
||||
private Button Button3 => element.Q<Button>("Button3");
|
||||
private Button CloseButton => element.Q<Button>("Close");
|
||||
|
||||
public override void Awake() {
|
||||
//初始化模块
|
||||
ModuleCore.VideoImagePanel = this;
|
||||
InitElement();
|
||||
//加载视频媒体ui
|
||||
VisualElement media = element.Q<VisualElement>("MediaPlayer");
|
||||
mediaPlayer = new MediaPlayer(media, MediaPlayerFullScreen);
|
||||
//事件绑定
|
||||
Button1.clicked += Button1_clicked;
|
||||
Button2.clicked += Button2_clicked;
|
||||
Button3.clicked += () => { Debug.Log("未定义"); /*FengrenManager.OnAddNum();*/ };
|
||||
CloseButton.clicked += Close;
|
||||
}
|
||||
public override void Open(DataVideoImage data) {
|
||||
this.data = data;
|
||||
element.style.display = DisplayStyle.Flex;
|
||||
ModuleCore.ModuleVideo.SetValue(data.dataVideo);
|
||||
Image.style.backgroundImage = new StyleBackground(data.sprite);
|
||||
Button2_clicked();
|
||||
}
|
||||
public override void Close() {
|
||||
mediaPlayer.Close();
|
||||
element.style.display = DisplayStyle.None;
|
||||
}
|
||||
|
||||
private void LateUpdate() {
|
||||
bool isDisplay = element.resolvedStyle.display == DisplayStyle.Flex;
|
||||
if (isDisplay) { mediaPlayer.Update(); }
|
||||
}
|
||||
/// <summary> 全屏播放功能 </summary>
|
||||
private void MediaPlayerFullScreen() {
|
||||
element.style.display = DisplayStyle.None;
|
||||
ModuleCore.FullScreenVideoPanel.Open(() => {
|
||||
mediaPlayer.Open();
|
||||
element.style.display = DisplayStyle.Flex;
|
||||
});
|
||||
}
|
||||
private void Button1_clicked() {
|
||||
mediaPlayer.Close();
|
||||
Image.style.visibility = Visibility.Visible;
|
||||
Button1.style.display = DisplayStyle.None;
|
||||
Button2.style.display = DisplayStyle.Flex;
|
||||
}
|
||||
private void Button2_clicked() {
|
||||
mediaPlayer.Open();
|
||||
Image.style.visibility = Visibility.Hidden;
|
||||
Button1.style.display = DisplayStyle.Flex;
|
||||
Button2.style.display = DisplayStyle.None;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 94f972cd87afdae4abacd0496a475b91
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,31 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UIElements;
|
||||
|
||||
public class UIFullScreenVideo : ModuleUIPanel<Action> {
|
||||
private Action callback;
|
||||
private MediaPlayer mediaPlayer;
|
||||
public override void Awake() {
|
||||
ModuleCore.FullScreenVideoPanel = this;
|
||||
InitElement();
|
||||
VisualElement media = element.Q<VisualElement>("MediaPlayer");
|
||||
mediaPlayer = new MediaPlayer(media, Close);
|
||||
}
|
||||
public override void Open(Action data) {
|
||||
callback = data;
|
||||
element.style.display = DisplayStyle.Flex;
|
||||
mediaPlayer.Open();
|
||||
}
|
||||
public override void Close() {
|
||||
mediaPlayer.Close();
|
||||
element.style.display = DisplayStyle.None;
|
||||
callback?.Invoke();
|
||||
}
|
||||
|
||||
private void LateUpdate() {
|
||||
bool isDisplay = element.resolvedStyle.display == DisplayStyle.Flex;
|
||||
if (isDisplay) { mediaPlayer.Update(); }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c80447e352c0b954cb6b2c5f550cc2a1
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,72 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UIElements;
|
||||
using UnityEngine.Video;
|
||||
using MuHua;
|
||||
|
||||
public class UILearningVideo : ModuleUIPanel<Action> {
|
||||
[CustomLabel("避色差排料")]
|
||||
public VideoClip clip1;
|
||||
[CustomLabel("混合排料")]
|
||||
public VideoClip clip2;
|
||||
[CustomLabel("女西服排料方法讲解")]
|
||||
public VideoClip clip3;
|
||||
private Action data;
|
||||
private MediaPlayer mediaPlayer;
|
||||
private Button Button1 => element.Q<Button>("Button1");
|
||||
private Button Button2 => element.Q<Button>("Button2");
|
||||
private Button Button3 => element.Q<Button>("Button3");
|
||||
private Button CloseButton => element.Q<Button>("Close");
|
||||
public override void Awake() {
|
||||
//初始化模块
|
||||
ModuleCore.LearningVideoPanel = this;
|
||||
InitElement();
|
||||
//加载视频媒体ui
|
||||
VisualElement media = element.Q<VisualElement>("MediaPlayer");
|
||||
mediaPlayer = new MediaPlayer(media, MediaPlayerFullScreen);
|
||||
//事件绑定
|
||||
Button1.clicked += Button1_clicked;
|
||||
Button2.clicked += Button2_clicked;
|
||||
Button3.clicked += Button3_clicked;
|
||||
CloseButton.clicked += Close;
|
||||
}
|
||||
public override void Open(Action data) {
|
||||
this.data = data;
|
||||
element.style.display = DisplayStyle.Flex;
|
||||
Button1_clicked();
|
||||
}
|
||||
public override void Close() {
|
||||
mediaPlayer.Close();
|
||||
element.style.display = DisplayStyle.None;
|
||||
}
|
||||
|
||||
private void LateUpdate() {
|
||||
bool isDisplay = element.resolvedStyle.display == DisplayStyle.Flex;
|
||||
if (isDisplay) { mediaPlayer.Update(); }
|
||||
}
|
||||
/// <summary> 全屏播放功能 </summary>
|
||||
private void MediaPlayerFullScreen() {
|
||||
element.style.display = DisplayStyle.None;
|
||||
ModuleCore.FullScreenVideoPanel.Open(() => {
|
||||
mediaPlayer.Open();
|
||||
element.style.display = DisplayStyle.Flex;
|
||||
});
|
||||
}
|
||||
private void Button1_clicked() {
|
||||
DataVideoClip videoClip = new DataVideoClip(clip1);
|
||||
ModuleCore.ModuleVideo.SetValue(videoClip);
|
||||
mediaPlayer.Open();
|
||||
}
|
||||
private void Button2_clicked() {
|
||||
DataVideoClip videoClip = new DataVideoClip(clip2);
|
||||
ModuleCore.ModuleVideo.SetValue(videoClip);
|
||||
mediaPlayer.Open();
|
||||
}
|
||||
private void Button3_clicked() {
|
||||
DataVideoClip videoClip = new DataVideoClip(clip3);
|
||||
ModuleCore.ModuleVideo.SetValue(videoClip);
|
||||
mediaPlayer.Open();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: da2d1f0f0c4ac4a46acd84e557c7e0bc
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,36 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
using UnityEngine.UI;
|
||||
using MuHua;
|
||||
|
||||
public class SceneLoader : ModuleScene {
|
||||
public Slider progressBar;
|
||||
public override IEnumerator ILoadSceneAsync(string scene) {
|
||||
int disableProgress = 0;
|
||||
int toProgress = 0;
|
||||
AsyncOperation ao = SceneManager.LoadSceneAsync(scene);
|
||||
ao.allowSceneActivation = false;
|
||||
transform.SonActive(true);
|
||||
while (ao.progress < 0.9f) {
|
||||
toProgress = (int)(ao.progress * 100);
|
||||
while (disableProgress < toProgress) {
|
||||
++disableProgress;
|
||||
progressBar.value = disableProgress / 100.0f;//0.01开始
|
||||
yield return new WaitForEndOfFrame();
|
||||
}
|
||||
}
|
||||
toProgress = 100;
|
||||
while (disableProgress < toProgress) {
|
||||
++disableProgress;
|
||||
progressBar.value = disableProgress / 100.0f;
|
||||
yield return new WaitForEndOfFrame();
|
||||
}
|
||||
ao.allowSceneActivation = true;
|
||||
while (!ao.isDone) {
|
||||
yield return new WaitForEndOfFrame();
|
||||
}
|
||||
transform.SonActive(false);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8965d99865432b844a65b6ea6960406c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,57 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Video;
|
||||
|
||||
[RequireComponent(typeof(VideoPlayer))]
|
||||
public class VideoSystem : ModuleVideo {
|
||||
public Vector2Int renderSize = new Vector2Int(1920, 1080);
|
||||
|
||||
private int index;
|
||||
private RenderTexture rTexture;
|
||||
private List<DataVideo> videoDatas = new List<DataVideo>();
|
||||
private VideoPlayer videoPlayer => GetComponent<VideoPlayer>();
|
||||
|
||||
protected override void Awake() {
|
||||
base.Awake();
|
||||
rTexture = new RenderTexture(renderSize.x, renderSize.y, 0);
|
||||
videoPlayer.targetTexture = rTexture;
|
||||
}
|
||||
protected override bool IsPlaying() => videoPlayer.isPlaying;
|
||||
protected override Vector2Int VideoCount() => new Vector2Int(index, videoDatas.Count);
|
||||
protected override RenderTexture RenderTexture() => rTexture;
|
||||
protected override double Time() => videoPlayer.clockTime;
|
||||
protected override double MaxTime() => videoPlayer.length;
|
||||
protected override long GetFrame() => videoPlayer.frame;
|
||||
protected override void SetFrame(long value) => videoPlayer.frame = value;
|
||||
protected override ulong FrameCount() => videoPlayer.frameCount;
|
||||
|
||||
public override void Play() {
|
||||
videoDatas[index].SetPlayer(videoPlayer);
|
||||
videoPlayer.Play();
|
||||
}
|
||||
public override void Pause() {
|
||||
videoPlayer.Pause();
|
||||
}
|
||||
public override void Stop() {
|
||||
videoPlayer.Stop();
|
||||
}
|
||||
public override void SetIndex(int value) {
|
||||
if (videoDatas.Count == 0) { Debug.LogError("没有视频可以播放!"); Stop(); return; }
|
||||
if (value < 0) { value = videoDatas.Count - 1; }
|
||||
if (value >= videoDatas.Count) { value = 0; }
|
||||
index = value; Play();
|
||||
}
|
||||
public override void AddIndex(int value) {
|
||||
SetIndex(index + value);
|
||||
}
|
||||
|
||||
public override void SetValue(DataVideo value) {
|
||||
index = 0;
|
||||
videoDatas = new List<DataVideo> { value };
|
||||
}
|
||||
public override void SetValue(List<DataVideo> list) {
|
||||
index = 0;
|
||||
videoDatas = list;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d6341a66658f1184e82fba981a431514
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user