51 lines
1.1 KiB
C#
51 lines
1.1 KiB
C#
using System.Linq;
|
|
using Michsky.UI.Heat;
|
|
using Obvious.Soap;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class UI_MainMenuBackground : MonoBehaviour
|
|
{
|
|
public PlayerProfile PlayerProfile;
|
|
|
|
public BoolVariable IsInGameMainMenuEnabled;
|
|
|
|
[SerializeField]
|
|
private Image image;
|
|
|
|
[SerializeField]
|
|
private GameObject filter;
|
|
|
|
[SerializeField]
|
|
private GameObject shadows;
|
|
|
|
[SerializeField]
|
|
private GameObject waterPrefab;
|
|
|
|
private void Start()
|
|
{
|
|
if (IsInGameMainMenuEnabled.Value)
|
|
{
|
|
if (string.IsNullOrEmpty(PlayerProfile.LastLoadedChapterID))
|
|
{
|
|
return;
|
|
}
|
|
ChapterManager chapterManager = Object.FindFirstObjectByType<ChapterManager>(FindObjectsInactive.Include);
|
|
if ((bool)chapterManager)
|
|
{
|
|
ChapterManager.ChapterItem chapterItem = chapterManager.chapters.FirstOrDefault((ChapterManager.ChapterItem c) => c.chapterID == PlayerProfile.LastLoadedChapterID);
|
|
if (chapterItem != null)
|
|
{
|
|
image.sprite = chapterItem.background;
|
|
image.gameObject.SetActive(value: true);
|
|
shadows.SetActive(value: false);
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
Object.Instantiate(waterPrefab, base.gameObject.scene);
|
|
}
|
|
}
|
|
}
|