78 lines
1.8 KiB
C#
78 lines
1.8 KiB
C#
// ***********************************************************************
|
|
// Assembly : Game
|
|
// Author : Kimch
|
|
// Created : 2021-05-11
|
|
// Description :
|
|
// Last Modified By :
|
|
// Last Modified On :
|
|
// ***********************************************************************
|
|
// <copyright file= "OpeningManager" company="Kunpo"></copyright>
|
|
// <summary></summary>
|
|
// ***********************************************************************
|
|
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
#if !UNITY_WEBGL
|
|
using UnityEngine.Video;
|
|
#endif
|
|
|
|
namespace G
|
|
{
|
|
/// <summary>
|
|
/// 开场
|
|
/// </summary>
|
|
public class OpeningPanel : KUIWidget
|
|
{
|
|
#if !UNITY_WEBGL
|
|
#region Field
|
|
|
|
public VideoPlayer videoPlayer;
|
|
|
|
public Button skipBtn;
|
|
|
|
#endregion
|
|
|
|
#region Method
|
|
|
|
void EndReached(UnityEngine.Video.VideoPlayer vp)
|
|
{
|
|
LevelProxy.Instance.FirstLevel();
|
|
}
|
|
|
|
void OnSkipBtnClick()
|
|
{
|
|
videoPlayer.loopPointReached -= EndReached;
|
|
skipBtn.interactable = false;
|
|
LevelProxy.Instance.FirstLevel();
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Unity
|
|
|
|
// Use this for initialization
|
|
private void Start()
|
|
{
|
|
videoPlayer.loopPointReached += EndReached;
|
|
skipBtn.onClick.AddListener(this.OnSkipBtnClick);
|
|
|
|
skipBtn.gameObject.SetActive(false);
|
|
}
|
|
|
|
// Update is called once per frame
|
|
private void Update()
|
|
{
|
|
if (!skipBtn.gameObject.activeSelf && videoPlayer.time > videoPlayer.length * 0.2f)
|
|
{
|
|
skipBtn.gameObject.SetActive(true);
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#endif
|
|
}
|
|
}
|