379 lines
9.6 KiB
C#
379 lines
9.6 KiB
C#
using System;
|
|
using System.Collections;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
using UnityEngine.EventSystems;
|
|
using UnityEngine.UI;
|
|
using UnityEngine.Video;
|
|
|
|
// Token: 0x020000A2 RID: 162
|
|
public class DeathScreen : MonoBehaviour
|
|
{
|
|
// Token: 0x06000F36 RID: 3894 RVA: 0x001281FC File Offset: 0x001263FC
|
|
public void Setup()
|
|
{
|
|
if (Links.x.sensory)
|
|
{
|
|
Records.x.SetTypingState(true);
|
|
Links.x.gameplay.TogglePause(true);
|
|
Records.x.RemoveControls(true);
|
|
}
|
|
this.startVideo.enabled = false;
|
|
if (this.rt != null)
|
|
{
|
|
this.rt.Release();
|
|
}
|
|
RenderTextureFormat renderTextureFormat = RenderTextureFormat.Default;
|
|
this.rt = new RenderTexture(1920, 1080, 24, renderTextureFormat);
|
|
this.startVideo.targetTexture = this.rt;
|
|
this.videoImg.texture = this.rt;
|
|
this.done = false;
|
|
this.skipText.enabled = false;
|
|
RenderTexture active = RenderTexture.active;
|
|
RenderTexture.active = this.rt;
|
|
GL.Clear(true, true, Color.black);
|
|
RenderTexture.active = active;
|
|
if (!this.forDemo)
|
|
{
|
|
this.animator.Play("DeathScreenVideo");
|
|
}
|
|
Time.timeScale = 1f;
|
|
if (this.forDemo)
|
|
{
|
|
this.WatchTrailer();
|
|
return;
|
|
}
|
|
this.coroutineStart = this.VideoStart();
|
|
base.StartCoroutine(this.coroutineStart);
|
|
}
|
|
|
|
// Token: 0x06000F37 RID: 3895 RVA: 0x0012831F File Offset: 0x0012651F
|
|
private IEnumerator VideoStart()
|
|
{
|
|
Links.x.gaia.PlayFade("Out", "Unscaled");
|
|
yield return new WaitForSecondsRealtime(0.5f);
|
|
RenderTexture active = RenderTexture.active;
|
|
RenderTexture.active = this.startVideo.targetTexture;
|
|
GL.Clear(true, true, Color.black);
|
|
RenderTexture.active = active;
|
|
Links.x.gaia.PlayFade("In", "Unscaled");
|
|
if (Records.x.linux)
|
|
{
|
|
this.startVideo.clip = this.mmVideoStartLinux;
|
|
}
|
|
else if (!Records.x.linux && (Records.x.windows7 || Records.x.alwaysPlayTranscodedVideo))
|
|
{
|
|
this.startVideo.clip = this.mmVideoStartWindows7;
|
|
}
|
|
else
|
|
{
|
|
this.startVideo.clip = this.mmVideoStart;
|
|
}
|
|
if (this.forDemo)
|
|
{
|
|
this.startVideo.isLooping = true;
|
|
}
|
|
this.startVideo.targetTexture = this.rt;
|
|
this.videoImg.texture = this.rt;
|
|
this.startVideo.SetDirectAudioVolume(0, Links.x.options.musicVolume);
|
|
RenderTexture active2 = RenderTexture.active;
|
|
RenderTexture.active = this.startVideo.targetTexture;
|
|
GL.Clear(true, true, Color.black);
|
|
RenderTexture.active = active2;
|
|
this.startVideo.enabled = true;
|
|
this.startVideo.started += this.VideoStarted;
|
|
this.startVideo.loopPointReached += this.EndReached;
|
|
this.videoImg.enabled = true;
|
|
yield break;
|
|
}
|
|
|
|
// Token: 0x06000F38 RID: 3896 RVA: 0x00128330 File Offset: 0x00126530
|
|
private void Update()
|
|
{
|
|
float num = this.rectTransformBlack.sizeDelta.x;
|
|
float num2 = this.rectTransformBlack.sizeDelta.y;
|
|
float num3 = (float)Screen.width / (float)Screen.height;
|
|
float num4 = 1.7777778f;
|
|
if (num3 != num4)
|
|
{
|
|
if (num3 > num4)
|
|
{
|
|
num = num2 * num4;
|
|
}
|
|
else
|
|
{
|
|
num2 = num / num4;
|
|
}
|
|
}
|
|
this.rectTransform.sizeDelta = new Vector2(num, num2);
|
|
}
|
|
|
|
// Token: 0x06000F39 RID: 3897 RVA: 0x00128397 File Offset: 0x00126597
|
|
public void VideoStarted(VideoPlayer vp)
|
|
{
|
|
base.StartCoroutine(this.VideoStarting());
|
|
}
|
|
|
|
// Token: 0x06000F3A RID: 3898 RVA: 0x001283A6 File Offset: 0x001265A6
|
|
private IEnumerator VideoStarting()
|
|
{
|
|
if (Time.timeScale > 0.5f)
|
|
{
|
|
Time.timeScale = 1f;
|
|
}
|
|
this.skipText.enabled = false;
|
|
this.skipText.spriteAsset = Links.x.GetSpriteSheetAsset(Links.x.gameplay.currentSpriteSheetAsset);
|
|
this.str.Clear();
|
|
this.str.Append("Skip ");
|
|
this.str.Append(" <voffset=.4em><size=50><sprite=");
|
|
if (Links.x.mk)
|
|
{
|
|
int keyIconIndex = Links.x.keyControl.GetKeyIconIndex("LMB");
|
|
this.str.Append(keyIconIndex);
|
|
this.str.Append("></size></voffset>");
|
|
}
|
|
else
|
|
{
|
|
int controllerSprite = Links.x.gameplay.GetControllerSprite("Cancel", Links.x.gameplay.controllerName);
|
|
this.str.Append(controllerSprite);
|
|
this.str.Append("></size></voffset>");
|
|
}
|
|
this.skipText.text = this.str.ToString();
|
|
float timeToLerp = 1f;
|
|
float percentage = 0f;
|
|
float startTime = Time.time;
|
|
while (percentage < 1f)
|
|
{
|
|
if (Time.timeScale > 0.5f)
|
|
{
|
|
Time.timeScale = 1f;
|
|
}
|
|
percentage = (Time.time - startTime) / timeToLerp;
|
|
yield return null;
|
|
}
|
|
this.skipText.enabled = true;
|
|
timeToLerp = 6f;
|
|
percentage = 0f;
|
|
startTime = Time.time;
|
|
while (percentage < 1f && !this.Clicked())
|
|
{
|
|
if (Time.timeScale > 0.5f)
|
|
{
|
|
Time.timeScale = 1f;
|
|
}
|
|
percentage = (Time.time - startTime) / timeToLerp;
|
|
yield return null;
|
|
}
|
|
if (!this.done && !this.forDemo)
|
|
{
|
|
this.animator.Play("DeathScreenIn");
|
|
this.SetFirstObject();
|
|
}
|
|
yield break;
|
|
}
|
|
|
|
// Token: 0x06000F3B RID: 3899 RVA: 0x001283B5 File Offset: 0x001265B5
|
|
public void SetFirstObject()
|
|
{
|
|
this.skipText.enabled = false;
|
|
if (Links.x.joy)
|
|
{
|
|
base.StartCoroutine(this.WaitToSetFirstObject());
|
|
}
|
|
}
|
|
|
|
// Token: 0x06000F3C RID: 3900 RVA: 0x001283DC File Offset: 0x001265DC
|
|
private void OnDestroy()
|
|
{
|
|
if (this.rt != null)
|
|
{
|
|
this.rt.Release();
|
|
}
|
|
}
|
|
|
|
// Token: 0x06000F3D RID: 3901 RVA: 0x001283F7 File Offset: 0x001265F7
|
|
private IEnumerator WaitToSetFirstObject()
|
|
{
|
|
yield return new WaitForSeconds(0.1f);
|
|
while (!this.loadBtn.activeSelf || !this.loadBtn.activeInHierarchy)
|
|
{
|
|
yield return null;
|
|
}
|
|
EventSystem.current.SetSelectedGameObject(this.loadBtn);
|
|
this.loadBtn.GetComponent<UITriggerButton>().SetSelected(true);
|
|
yield break;
|
|
}
|
|
|
|
// Token: 0x06000F3E RID: 3902 RVA: 0x00128406 File Offset: 0x00126606
|
|
public void EndReached(VideoPlayer vp)
|
|
{
|
|
if (!this.forDemo)
|
|
{
|
|
vp.enabled = false;
|
|
this.videoImg.enabled = false;
|
|
}
|
|
this.done = true;
|
|
}
|
|
|
|
// Token: 0x06000F3F RID: 3903 RVA: 0x0012842A File Offset: 0x0012662A
|
|
public void DeathScreenOut()
|
|
{
|
|
Links.x.hudControl.JoyBox(false);
|
|
this.startVideo.enabled = false;
|
|
this.videoImg.enabled = false;
|
|
this.animator.Play("DeathScreenOut");
|
|
}
|
|
|
|
// Token: 0x06000F40 RID: 3904 RVA: 0x00128464 File Offset: 0x00126664
|
|
public void DeathScreenOut2()
|
|
{
|
|
Links.x.hudControl.JoyBox(false);
|
|
this.startVideo.enabled = false;
|
|
this.videoImg.enabled = false;
|
|
this.animator.Play("DeathScreenOut2");
|
|
}
|
|
|
|
// Token: 0x06000F41 RID: 3905 RVA: 0x0012849E File Offset: 0x0012669E
|
|
public void TurnOffScreen()
|
|
{
|
|
base.gameObject.SetActive(false);
|
|
if (this.rt != null)
|
|
{
|
|
this.rt.Release();
|
|
}
|
|
}
|
|
|
|
// Token: 0x06000F42 RID: 3906 RVA: 0x001284C8 File Offset: 0x001266C8
|
|
private bool Clicked()
|
|
{
|
|
if (Links.x.joy)
|
|
{
|
|
if (Links.x.gameplay.cancelStart || Links.x.gameplay.actionStart || Links.x.gameplay.interactStart)
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
else if (Input.GetMouseButtonUp(0) || Input.GetMouseButtonUp(1) || Input.GetKeyDown(KeyCode.Space) || Input.GetKeyDown(KeyCode.Return))
|
|
{
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
// Token: 0x06000F43 RID: 3907 RVA: 0x0012853B File Offset: 0x0012673B
|
|
public void ReturnToGame()
|
|
{
|
|
Records.x.RemoveControls(false);
|
|
Links.x.gameplay.TogglePause(false);
|
|
Records.x.SetTypingState(false);
|
|
base.gameObject.SetActive(false);
|
|
}
|
|
|
|
// Token: 0x06000F44 RID: 3908 RVA: 0x0012856F File Offset: 0x0012676F
|
|
public void BuyGame()
|
|
{
|
|
if (Links.x.main)
|
|
{
|
|
EventSystem.current.SetSelectedGameObject(null);
|
|
}
|
|
Application.OpenURL("https://banquetforfools.com/");
|
|
}
|
|
|
|
// Token: 0x06000F45 RID: 3909 RVA: 0x00128597 File Offset: 0x00126797
|
|
public void WatchTrailer()
|
|
{
|
|
this.animator.Play("DemoScreenTrailer");
|
|
if (Links.x.mk)
|
|
{
|
|
EventSystem.current.SetSelectedGameObject(null);
|
|
}
|
|
base.StartCoroutine(this.TrailerStart());
|
|
}
|
|
|
|
// Token: 0x06000F46 RID: 3910 RVA: 0x001285CD File Offset: 0x001267CD
|
|
private IEnumerator TrailerStart()
|
|
{
|
|
RenderTextureFormat renderTextureFormat = RenderTextureFormat.ARGB32;
|
|
this.rt = new RenderTexture(1920, 1080, 24, renderTextureFormat);
|
|
this.startVideo.targetTexture = this.rt;
|
|
this.videoImg.texture = this.rt;
|
|
this.startVideo.isLooping = false;
|
|
this.startVideo.SetDirectAudioVolume(0, Links.x.options.musicVolume);
|
|
yield return new WaitForSecondsRealtime(0.25f);
|
|
this.startVideo.enabled = true;
|
|
this.startVideo.loopPointReached += this.TrailerEndReached;
|
|
this.videoImg.enabled = true;
|
|
yield break;
|
|
}
|
|
|
|
// Token: 0x06000F47 RID: 3911 RVA: 0x001285DC File Offset: 0x001267DC
|
|
public void TrailerEndReached(VideoPlayer vp)
|
|
{
|
|
this.coroutineStart = this.VideoStart();
|
|
base.StartCoroutine(this.coroutineStart);
|
|
this.animator.Play("DemoScreenIn", 0, 0f);
|
|
this.startVideo.loopPointReached -= this.TrailerEndReached;
|
|
this.startVideo.isLooping = true;
|
|
}
|
|
|
|
// Token: 0x040018FE RID: 6398
|
|
public VideoPlayer startVideo;
|
|
|
|
// Token: 0x040018FF RID: 6399
|
|
public VideoPlayer loopVideo;
|
|
|
|
// Token: 0x04001900 RID: 6400
|
|
public VideoClip mmVideoStart;
|
|
|
|
// Token: 0x04001901 RID: 6401
|
|
public VideoClip mmVideoStartLinux;
|
|
|
|
// Token: 0x04001902 RID: 6402
|
|
public VideoClip mmVideoStartWindows7;
|
|
|
|
// Token: 0x04001903 RID: 6403
|
|
public VideoClip trailerVideo;
|
|
|
|
// Token: 0x04001904 RID: 6404
|
|
public VideoClip trailerVideoLinux;
|
|
|
|
// Token: 0x04001905 RID: 6405
|
|
public RawImage videoImg;
|
|
|
|
// Token: 0x04001906 RID: 6406
|
|
private RenderTexture rt;
|
|
|
|
// Token: 0x04001907 RID: 6407
|
|
private IEnumerator coroutineStart;
|
|
|
|
// Token: 0x04001908 RID: 6408
|
|
public Animator animator;
|
|
|
|
// Token: 0x04001909 RID: 6409
|
|
private int clickCount;
|
|
|
|
// Token: 0x0400190A RID: 6410
|
|
private float clickTime;
|
|
|
|
// Token: 0x0400190B RID: 6411
|
|
private bool done;
|
|
|
|
// Token: 0x0400190C RID: 6412
|
|
public bool forDemo;
|
|
|
|
// Token: 0x0400190D RID: 6413
|
|
public RectTransform rectTransform;
|
|
|
|
// Token: 0x0400190E RID: 6414
|
|
public RectTransform rectTransformBlack;
|
|
|
|
// Token: 0x0400190F RID: 6415
|
|
public GameObject loadBtn;
|
|
|
|
// Token: 0x04001910 RID: 6416
|
|
public TextMeshProUGUI skipText;
|
|
|
|
// Token: 0x04001911 RID: 6417
|
|
private StringFast str = new StringFast(32);
|
|
}
|