This commit is contained in:
2025-10-31 15:20:38 +08:00
parent 254e1926cf
commit 5ad8b2b7e1
6502 changed files with 581819 additions and 0 deletions

View File

@@ -0,0 +1,123 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
public class BaseShow : MonoBehaviour
{
/// <summary>
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
/// </summary>
public Data info;
/// <summary>
/// <20>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD>Ե<EFBFBD><D4B5><EFBFBD>
/// </summary>
public bool CanClick = true;
/// <summary>
/// <20><><EFBFBD><EFBFBD>״̬<D7B4>ı<EFBFBD><C4B1>¼<EFBFBD>
/// </summary>
public event UnityAction CanClickStatusChanged;
///// <summary>
///// <20><><EFBFBD><EFBFBD>״̬
///// </summary>
//bool canClickNewStatus;
//// <20><>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>
//float distance;
/// <summary>
/// ѡ<>п<EFBFBD><D0BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
/// </summary>
public ShowBoxCollider sbc;
void Awake()
{
sbc = GetComponent<ShowBoxCollider>();
}
public void OnStatusChange()
{
if (CanClickStatusChanged != null)
{
CanClickStatusChanged();
}
}
~BaseShow()
{
// ShowController.Instance.RemoveShow(this);
}
public virtual void OnClick()
{
}
bool IsMaskShow
{
get
{
sbc = GetComponent<ShowBoxCollider>();
if (sbc == null)
return false;
else
return sbc.showMask;
}
}
public void OnMouseUp()
{
if (BaseController.CanControl && IsMaskShow)
{
OnClick();
TipPlayerEx.Instance.HideTip();
}
}
//void LateUpdate()
//{
// if (info != null)
// {
// // <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD>õľ<C3B5><C4BE><EFBFBD>
// distance = Vector3.Distance(CommonData.MainCamera.transform.position, transform.position);
// canClickNewStatus = (distance <= info.ClickDistance);
// // <20>ɵ<EFBFBD><C9B5><EFBFBD>״̬<D7B4><CCAC><EFBFBD><EFBFBD><EFBFBD>ı<C4B1><E4A3A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Զ<EFBFBD>
// if (CanClick != canClickNewStatus)
// {
// CanClick = canClickNewStatus;
// if (CanClick)
// {
// gameObject.AddComponent<ShowBoxCollider>();
// }
// else
// {
// Destroy(gameObject.GetComponent<ShowBoxCollider>());
// }
// if (CanClickStatusChanged != null)
// {
// CanClickStatusChanged();
// }
// // <20><><EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD>п<EFBFBD><D0BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
// if (sbc != null)
// {
// if (CanClick)
// {
// sbc.enabled = true;
// }
// else
// {
// sbc.enabled = false;
// }
// }
// }
// }
//}
}

View File

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

View File

@@ -0,0 +1,17 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Networking;
public class GameShow : BaseShow
{
public override void OnClick()
{
if (BaseController.CanControl)
{
BaseController.CanControl = false;
AudioManager.Instance.PauseBackgroundMusic();
BundleLoader.Instance.LoadBundle(info.GameName);
}
}
}

View File

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

View File

@@ -0,0 +1,181 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// ͼƬչʾ<D5B9><CABE>
/// </summary>
public class ImageShow : BaseShow
{
/// <summary>
/// <20><>ʾ<EFBFBD>IJ<EFBFBD><C4B2><EFBFBD>
/// </summary>
Material matShow;
/// <summary>
/// <20><>ǰͼƬ<CDBC><C6AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Զ<EFBFBD>ͼģʽ<C4A3><CABD>
/// </summary>
int currentIndex;
Texture textureDefault;
void Start()
{
Renderer renderer = GetComponent<Renderer>();
if (renderer == null && !string.IsNullOrEmpty(info.ParentID))
{
GameObject obj = GameObject.Find(info.ParentID);
if (obj != null)
{
renderer = obj.GetComponent<Renderer>();
}
}
if ( renderer != null && info.PlayOnObject)
{
// playOnObject = true;
matShow = renderer.material;
// matShow = renderer.sharedMaterial;
textureDefault = matShow.mainTexture;
LoadImage();
}
if (info.Clickable)
{
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ײ<EFBFBD><D7B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if (GetComponent<Collider>() == null)
{
gameObject.AddComponent<MeshCollider>();
}
}
currentIndex = info.Index;
// CanClickStatusChanged += ImageShow_CanClickStatusChanged;
}
private void ImageShow_CanClickStatusChanged()
{
if (info.PlayOnObject)
{
LoadImage();
}
}
string imgName = null;
/// <summary>
/// <20><><EFBFBD><EFBFBD>ͼƬ
/// </summary>
public void LoadImage()
{
if (info.IsType(DataType.Image))
{
imgName = info.ImageName;
info.CurrentURL = info.URL;
}
else // if (info.Type == DataType.MultiImage) // <20><>ͼģʽ
{
if (info.DataDetails.Length < 0)
{
Debug.Log(string.Format("ObjectID:{0}<7D><>DataDetails<6C><73>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", info.ObjectID));
return;
}
if (info.DisplayMode == DisplayMode.RandomPics) // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>ͼ
{
currentIndex = Random.Range(0, info.DataDetails.Length);
}
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>ͼƬ<CDBC>ͳ<EFBFBD><CDB3><EFBFBD><EFBFBD><EFBFBD>
imgName = info.DataDetails[currentIndex];
info.ImageName = imgName;
if (info.Clickable)
{
if (currentIndex < info.UrlDetails.Length)
{
info.CurrentURL = info.UrlDetails[currentIndex];
info.VideoName = info.CurrentURL;
}
else
{
info.CurrentURL = "";
info.VideoName = info.CurrentURL;
}
if (currentIndex < info.TitleDetails.Length)
{
info.Title = info.TitleDetails[currentIndex];
}
}
if (info.DisplayMode == DisplayMode.MultiPics) // ˳<><CBB3><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>ͼ
{
currentIndex++;
currentIndex = currentIndex % info.DataDetails.Length;
}
}
if (CanClick)
{
if (gameObject.activeInHierarchy)
{
StartCoroutine(
ImageLoader<Material>.LoadImage(CommonData.HighImageFullPath + imgName, matShow)
);
}
// <20><><EFBFBD><EFBFBD><EFBFBD>Ƕ<EFBFBD>ͼ<EFBFBD><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD><C3B5><EFBFBD>ʾ<EFBFBD>ٶȺ<D9B6><C8BA>ټ<EFBFBD><D9BC><EFBFBD>ͼƬ
if (info.IsType(DataType.MultiImage) && info.AutoPlay)
{
Invoke("LoadImage", info.DisplaySpeed);
}
}
else
{
matShow.mainTexture = textureDefault;
if (matShow.IsKeywordEnabled("_EMISSION"))
{
matShow.SetTexture("_EmissionMap", textureDefault);
}
ImageLoader<Material>.RemoveImage(CommonData.HighImageFullPath + imgName);
}
}
/// <summary>
/// <20><><EFBFBD><EFBFBD><EAB5A5><EFBFBD>¼<EFBFBD>
/// </summary>
public override void OnClick()
{
if (BaseController.CanControl)
{
Invoke("ShowImageEx", 0.01f);
}
}
void ShowImageEx()
{
// <20>ж<EFBFBD><D0B6>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD>Ե<EFBFBD><D4B5><EFBFBD>
//if (!BaseController.IsJoyStickOnControl
// && !BaseController.IsUIClicked
// && BaseController.CanControl
// && BaseController.IsMouseOnControl
// && CanClick)
if (BaseController.CanControl && CanClick)
{
if (info.PlayOnObject)
{
if (!string.IsNullOrEmpty(info.CurrentURL))
{
// Debug.Log(info.CurrentURL);
// H5Controller.OpenUrl(url);
}
}
else if ((info.IsType(DataType.Image) && !string.IsNullOrEmpty(info.ImageName)) || info.IsType(DataType.MultiImage))
{
ImagePlayerEx.Instance.info = info;
ImagePlayerEx.Instance.ShowImage(info.Index);
}
}
}
}

View File

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

View File

@@ -0,0 +1,50 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MaterialShow : BaseShow
{
/// <summary>
/// <20><>ʾ<EFBFBD>IJ<EFBFBD><C4B2><EFBFBD>
/// </summary>
Material matShow;
Texture textureDefault;
void Start()
{
Renderer renderer = GetComponent<Renderer>();
if (renderer != null)
{
matShow = renderer.material;
// matShow = renderer.sharedMaterial;
textureDefault = matShow.mainTexture;
LoadImage();
}
}
private void OnDestroy()
{
DisposeImage();
}
/// <summary>
/// <20><><EFBFBD><EFBFBD>ͼƬ
/// </summary>
public void LoadImage()
{
StartCoroutine(
ImageLoader<Material>.LoadImage(CommonData.HighImageFullPath + info.ImageName, matShow)
);
}
public void DisposeImage()
{
matShow.mainTexture = textureDefault;
if (matShow.IsKeywordEnabled("_EMISSION"))
{
matShow.SetTexture("_EmissionMap", textureDefault);
}
ImageLoader<Material>.RemoveImage(CommonData.HighImageFullPath + info.ImageName);
}
}

View File

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

View File

@@ -0,0 +1,17 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ModelShow : BaseShow
{
/// <summary>
/// <20><><EFBFBD><EFBFBD><EAB5A5><EFBFBD>¼<EFBFBD>
/// </summary>
public override void OnClick()
{
if (BaseController.CanControl && CanClick)
{
ModelPlayerEx.Instance.ShowModel(info, gameObject);
}
}
}

View File

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

View File

@@ -0,0 +1,20 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Networking;
/// <summary>
/// չʾ<D5B9><CABE>(<28><><EFBFBD><EFBFBD>)
/// </summary>
public class SceneShow : BaseShow
{
public override void OnClick()
{
if (BaseController.CanControl)
{
// AudioManager.Instance.PauseBackgroundMusic();
XMZJ.Instance.LoadXMZJ(info.SceneIndex);
}
}
}

View File

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

View File

@@ -0,0 +1,243 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
public class ShowBoxCollider : MonoBehaviour
{
/// <summary>
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><><D6B1><EFBFBD><EFBFBD>ʾ<EFBFBD>ȵ<EFBFBD><C8B5><EFBFBD>
/// </summary>
public bool Test;
/// <summary>
/// <20>ȵ<EFBFBD><C8B5><EFBFBD><EFBFBD><EFBFBD>ɫ
/// </summary>
public string ColorString = "#FF000030"; // #00000055
Color clr;
/// <summary>
/// <20>Ƿ<EFBFBD><C7B7><EFBFBD>ʾ<EFBFBD>ȵ<EFBFBD><C8B5><EFBFBD>
/// </summary>
public bool showHotTip = true;
/// <summary>
/// <20>Ƿ<EFBFBD><C7B7><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>Box<6F><78>
/// </summary>
public bool showBox = false;
void Start()
{
ColorUtility.TryParseHtmlString(ColorString, out clr);
//if(Application.isEditor)
//{
// Test = true;
//}
}
public bool showMask;
BaseShow baseShow;
private void OnMouseOver()
{
if (baseShow == null)
{
Invoke("OnMouseEnter", 0.3f);
}
}
void OnMouseEnter()
{
baseShow = GetComponent<BaseShow>();
if (baseShow != null && baseShow.CanClick)
{
showMask = true;
if (!string.IsNullOrEmpty(baseShow.info.Title) && BaseController.CanControl)
{
TipPlayerEx.Instance.ShowTip(baseShow.info);
}
}
}
void OnMouseExit()
{
showMask = false;
TipPlayerEx.Instance.HideTip();
}
void OnRenderObject()
{
if ( Test || ( BaseController.CanControl && showHotTip && showMask))
{
var colliders = gameObject.GetComponents<BoxCollider>();
if (colliders == null)
{
Destroy(this);
}
CreateLineMaterial();
lineMaterial.SetPass(0);
GL.PushMatrix();
GL.MultMatrix(transform.localToWorldMatrix);
//for (int i = 0; i < colliders.Length; i++)
{
// var col = colliders[i];
var col = colliders[0];
var c = col.center;
var size = col.size;
float rx = size.x / 2f;
float ry = size.y / 2f;
float rz = size.z / 2f;
Vector3 p0, p1, p2, p3;
Vector3 p4, p5, p6, p7;
p0 = c + new Vector3(-rx, -ry, rz);
p1 = c + new Vector3(rx, -ry, rz);
p2 = c + new Vector3(rx, -ry, -rz);
p3 = c + new Vector3(-rx, -ry, -rz);
p4 = c + new Vector3(-rx, ry, rz);
p5 = c + new Vector3(rx, ry, rz);
p6 = c + new Vector3(rx, ry, -rz);
p7 = c + new Vector3(-rx, ry, -rz);
GL.Begin(GL.QUADS);
GL.Color(clr);
GL.Vertex(p0);
GL.Vertex(p1);
GL.Vertex(p2);
GL.Vertex(p3);
GL.End();
if (showBox)
{
GL.Begin(GL.QUADS);
GL.Color(clr);
GL.Vertex(p4);
GL.Vertex(p5);
GL.Vertex(p6);
GL.Vertex(p7);
GL.End();
GL.Begin(GL.QUADS);
GL.Color(clr);
GL.Vertex(p0);
GL.Vertex(p1);
GL.Vertex(p5);
GL.Vertex(p4);
GL.End();
GL.Begin(GL.QUADS);
GL.Color(clr);
GL.Vertex(p1);
GL.Vertex(p2);
GL.Vertex(p6);
GL.Vertex(p5);
GL.End();
GL.Begin(GL.QUADS);
GL.Color(clr);
GL.Vertex(p2);
GL.Vertex(p3);
GL.Vertex(p7);
GL.Vertex(p6);
GL.End();
GL.Begin(GL.QUADS);
GL.Color(clr);
GL.Vertex(p0);
GL.Vertex(p3);
GL.Vertex(p7);
GL.Vertex(p4);
GL.End();
}
#region <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
//GL.Begin(GL.LINES);
//GL.Color(Color.red);
//GL.Vertex(p0);
//GL.Vertex(p1);
//GL.End();
//GL.Begin(GL.LINES);
//GL.Color(Color.red);
//GL.Vertex(p1);
//GL.Vertex(p2);
//GL.End();
//GL.Begin(GL.LINES);
//GL.Color(Color.red);
//GL.Vertex(p2);
//GL.Vertex(p3);
//GL.End();
//GL.Begin(GL.LINES);
//GL.Color(Color.red);
//GL.Vertex(p0);
//GL.Vertex(p3);
//GL.End();
//GL.Begin(GL.LINES);
//GL.Color(Color.red);
//GL.Vertex(p4);
//GL.Vertex(p5);
//GL.End();
//GL.Begin(GL.LINES);
//GL.Color(Color.red);
//GL.Vertex(p5);
//GL.Vertex(p6);
//GL.End();
//GL.Begin(GL.LINES);
//GL.Color(Color.red);
//GL.Vertex(p6);
//GL.Vertex(p7);
//GL.End();
//GL.Begin(GL.LINES);
//GL.Color(Color.red);
//GL.Vertex(p4);
//GL.Vertex(p7);
//GL.End();
//GL.Begin(GL.LINES);
//GL.Color(Color.red);
//GL.Vertex(p0);
//GL.Vertex(p4);
//GL.End();
//GL.Begin(GL.LINES);
//GL.Color(Color.red);
//GL.Vertex(p1);
//GL.Vertex(p5);
//GL.End();
//GL.Begin(GL.LINES);
//GL.Color(Color.red);
//GL.Vertex(p2);
//GL.Vertex(p6);
//GL.End();
//GL.Begin(GL.LINES);
//GL.Color(Color.red);
//GL.Vertex(p3);
//GL.Vertex(p7);
//GL.End();
#endregion
}
GL.PopMatrix();
}
}
static Material lineMaterial;
static void CreateLineMaterial()
{
if (!lineMaterial)
{
// Unity has a built-in shader that is useful for drawing
// simple colored things.
Shader shader = Shader.Find("Hidden/Internal-Colored");
lineMaterial = new Material(shader);
lineMaterial.hideFlags = HideFlags.HideAndDontSave;
// Turn on alpha blending
lineMaterial.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.SrcAlpha);
lineMaterial.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.OneMinusSrcAlpha);
// Turn backface culling off
lineMaterial.SetInt("_Cull", (int)UnityEngine.Rendering.CullMode.Off);
// Turn off depth writes
lineMaterial.SetInt("_ZWrite", 0);
}
}
}

View File

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

View File

@@ -0,0 +1,17 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class TipShow : BaseShow
{
private void OnTriggerEnter(Collider other)
{
TipPlayerEx.Instance.ShowTip(info);
}
private void OnTriggerExit(Collider other)
{
TipPlayerEx.Instance.HideTip();
}
}

View File

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

View File

@@ -0,0 +1,48 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class TipShowX : BaseShow, IComparable
{
public int CompareTo(object obj)
{
TipShow another = obj as TipShow;
return
Vector3.Distance(
CommonData.MainCamera.transform.position,
ResetVector3_Y( another.transform.position)
)
.CompareTo(Vector3.Distance(
CommonData.MainCamera.transform.position,
ResetVector3_Y(transform.position)
));
}
Vector3 ResetVector3_Y(Vector3 pos, float y = 0)
{
return new Vector3(pos.x, y, pos.z);
}
//public bool isplay;
//void OnBecameVisible() //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ұ
//{
// Debug.Log(gameObject.name + "In");
//}
//void OnBecameInvisible() //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EBBFAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ұ
//{
// Debug.Log(gameObject.name + "Out");
//}
//void Update()
//{
// Vector3 screenCenter = new Vector3(Screen.width / 2, Screen.height / 2, 0);
// Vector3 objectPosition = CommonData.MainCamera.WorldToScreenPoint(transform.position);
// if (objectPosition.x >= screenCenter.x && objectPosition.x <= screenCenter.x + Screen.width &&
// objectPosition.y >= screenCenter.y && objectPosition.y <= screenCenter.y + Screen.height)
// {
// Debug.Log(gameObject.name + "In");
// }
//}
}

View File

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

View File

@@ -0,0 +1,17 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class UrlShow : BaseShow
{
/// <summary>
/// <20><><EFBFBD><EFBFBD><EAB5A5><EFBFBD>¼<EFBFBD>
/// </summary>
public override void OnClick()
{
if (BaseController.CanControl && CanClick)
{
H5Controller.OpenUrl(info.URL);
}
}
}

View File

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

View File

@@ -0,0 +1,120 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Video;
//[RequireComponent(typeof(VideoPlayer))]
public class VideoShow : BaseShow
{
public static VideoPlayer vpPlaying;
/// <summary>
/// <20><>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
/// </summary>
VideoPlayer vp;
/// <summary>
/// <20><>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>չ<EFBFBD><D5B9><EFBFBD><EFBFBD>
/// </summary>
VideoPlayerEx vpEx;
void Start()
{
if (info != null)
{
Renderer renderer = GetComponent<Renderer>();
if (info.PlayVideoOnObject)
{
vp = gameObject.AddComponent<VideoPlayer>();
// vp = GetComponent<VideoPlayer>();
vp.targetMaterialRenderer = renderer;
vp.playOnAwake = info.AutoPlay;
vp.isLooping = info.Loop;
vp.source = VideoSource.Url;
vp.url = CommonData.VideoFullPath + info.VideoName;
vp.renderMode = VideoRenderMode.MaterialOverride;
}
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾCoverͼƬ
if (!info.AutoPlay && !string.IsNullOrEmpty(info.ImageName))
{
StartCoroutine(ImageLoader<Material>.LoadImage(CommonData.ImageFullPath + info.ImageName, renderer.sharedMaterial));
}
if (info.Clickable)
{
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ײ<EFBFBD><D7B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if (GetComponent<Collider>() == null)
{
gameObject.AddComponent<MeshCollider>();
}
}
}
vpEx = FindObjectOfType<VideoPlayerEx>();
if (vpEx != null)
{
vpEx.onVideoClosed += delegate {
BtnController.Instance.SetCanControlDelay();
// Invoke("SetControl", 0.2f);
// BaseController.CanControl = true;
// Caching.ClearCache();
};
}
}
public override void OnClick()
{
if (BaseController.CanControl)
{
Invoke("ShowVideoEx", 0.01f);
}
}
void ShowVideoEx()
{
//if (!BaseController.IsJoyStickOnControl && BaseController.CanControl && CanClick)
if (BaseController.CanControl && CanClick)
{
if (info.PlayVideoOnObject)
{
if (vp != null)
{
if (vp.isPlaying)
{
vp.Pause();
}
else
{
if (vpPlaying != null && vpPlaying.isPlaying)
{
vpPlaying.Pause();
}
vp.Play();
vpPlaying = vp;
}
}
}
else
{
if (vpEx != null && !string.IsNullOrEmpty(info.VideoName))
{
BaseController.CanControl = false;
AudioManager.Instance.PauseBackgroundMusic();
if (H5Controller.IsMobileBroswer())
{
H5Controller.LoadVideo(info.VideoName, info.Title);
}
else
{
vpEx.ShowVideoPlayer();
vpEx.PlayVideo(info.VideoName, info.Title);
}
}
}
}
}
}

View File

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