Commit 662f5684 authored by radow's avatar radow
Browse files

all the menu quatsch

parent 230ff8e3
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class BackButton : MonoBehaviour
{
private void OnEnable()
{
Menu.RegisterBackButton(GetComponent<Button>());
}
private void OnDisable()
{
Menu.DeRegisterBackButton(GetComponent<Button>());
}
}
fileFormatVersion: 2
guid: cf9be0fa6526b3c4cbfdd49ebe26b6f9
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Menulamp : MonoBehaviour
{
public Material lit, unlit;
public GameObject light, lightsmall;
public MeshRenderer lamp;
public void SetMode(bool on)
{
var mats = lamp.materials;
mats[1] = on ? lit : unlit;
lamp.materials = mats;
light.SetActive(on);
lightsmall.SetActive(on);
}
}
fileFormatVersion: 2
guid: b296491226e24df4e80961335fbe0366
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
This diff is collapsed.
This diff is collapsed.
......@@ -4,6 +4,7 @@ using UnityEngine;
using DG.Tweening;
using UnityEngine.Rendering.PostProcessing;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
public class Menu : MonoBehaviour
{
......@@ -20,6 +21,7 @@ public class Menu : MonoBehaviour
public GameObject settingsMain, settingsGraphics, settingsAudio, settingsControls;
public GameObject menuWrapper, mainMenuGO, settingsGO, creditsGO, controlsGO, quitGO;
public GameObject playButton, continueButton, helpButton;
public TextColorSwap gameplayButton;
public Ease ease;
public float duration = 3f;
......@@ -71,7 +73,7 @@ public class Menu : MonoBehaviour
settingsAudio.SetActive(false);
settingsControls.SetActive(false);
mover = DOTween.Sequence().Append(Camera.main.transform.DOMove(settingsCamAnchor.position, duration * dist).SetEase(ease)).AppendCallback(() => { settingsGO.SetActive(true); });
mover = DOTween.Sequence().Append(Camera.main.transform.DOMove(settingsCamAnchor.position, duration * dist).SetEase(ease)).AppendCallback(() => { settingsGO.SetActive(true); gameplayButton.Select(); });
break;
case Sub.CONTROLS:
mover = DOTween.Sequence().Append(Camera.main.transform.DOMove(controlsCamAnchor.position, duration * dist).SetEase(ease)).AppendCallback(() => { controlsGO.SetActive(true); });
......@@ -108,16 +110,35 @@ public class Menu : MonoBehaviour
}
public static Button currentBackButton;
public static void RegisterBackButton(Button b)
{
currentBackButton = b;
}
public static void DeRegisterBackButton(Button b)
{
if (currentBackButton == b) currentBackButton = null;
}
PostProcessVolume m_Volume;
DepthOfField m_DepthOfField;
bool menuMode;
private void Update()
{
if(Input.GetButtonDown("Cancel") && (SceneManager.GetActiveScene().buildIndex != 0) && InputMode.mode != InputMode.Mode.SCENE)
if(Input.GetButtonDown("Cancel") && (SceneManager.GetActiveScene().buildIndex != 0) && InputMode.mode == InputMode.Mode.PLAYMODE)
{
SetPausemenu(!menuMode);
}
if ((SceneManager.GetActiveScene().buildIndex == 0 || menuMode) && (Input.GetButtonDown("Cancel")|| Input.GetButtonDown("Fire2")))
{
if (currentMenu == Sub.MAIN) {
if(SceneManager.GetActiveScene().buildIndex != 0) SetPausemenu(false);
}
else
{
if (currentBackButton) currentBackButton.onClick.Invoke();
}
}
}
public void SetPausemenu(bool on)
......
......@@ -8,18 +8,15 @@ public class TextColorSwap : MonoBehaviour
public Color regular, selected;
TextMeshProUGUI text;
void Start()
{
text = GetComponent<TextMeshProUGUI>();
}
public void Select()
{
text = GetComponent<TextMeshProUGUI>();
text.color = selected;
}
public void DeSelect()
{
text = GetComponent<TextMeshProUGUI>();
text.color = regular;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment