1
|
using System.Collections;
|
2
|
using System.Collections.Generic;
|
3
|
using UnityEngine;
|
4
|
|
5
|
public class MenuButtonHandler : MonoBehaviour
|
6
|
{
|
7
|
public MenuButtonColorListener home;
|
8
|
public MenuButtonColorListener map;
|
9
|
public MenuButtonColorListener settings;
|
10
|
|
11
|
public GameObject mainPanel;
|
12
|
public void OnClicked(MenuButtonColorListener selected, params MenuButtonColorListener[] deselected)
|
13
|
{
|
14
|
foreach (var btn in deselected)
|
15
|
{
|
16
|
if (btn.IsSelected()) btn.Animate(false);
|
17
|
btn.OnDeselected();
|
18
|
}
|
19
|
|
20
|
selected.OnSelected();
|
21
|
}
|
22
|
|
23
|
public void OnHomeClicked()
|
24
|
{
|
25
|
Debug.Log("home");
|
26
|
mainPanel.SetActive(true);
|
27
|
OnClicked(home, map, settings);
|
28
|
}
|
29
|
|
30
|
public void OnMapClicked()
|
31
|
{
|
32
|
mainPanel.SetActive(false);
|
33
|
Debug.Log("map");
|
34
|
OnClicked(map, home, settings);
|
35
|
}
|
36
|
|
37
|
public void OnSettingsClicked()
|
38
|
{
|
39
|
mainPanel.SetActive(false);
|
40
|
Debug.Log("settings");
|
41
|
OnClicked(settings, map, home);
|
42
|
}
|
43
|
}
|