using System Collections using System Collections Generic using UnityE

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class GameMenuView : WindowView {
IGameMenuPresentation gameMenuPresentation;
public Button loadGameButton;
public Button saveGameButton;
public Button exitGameButton;
float oldTimeScale = 0.0f;
bool timeScaleChanged = false;
public override void setPresentation (MonoBehaviour presentation)
{
gameMenuPresentation = (IGameMenuPresentation)presentation;
if (!gameMenuPresentation.isMultiplayerGame())
{
timeScaleChanged = true;
oldTimeScale = Time.timeScale;
Time.timeScale = 0.0f;
}
loadGameButton.interactable = !gameMenuPresentation.isMultiplayerGame() && !gameMenuPresentation.isTutorial();
saveGameButton.interactable = !gameMenuPresentation.isMultiplayerGame() && !gameMenuPresentation.isTutorial();
exitGameButton.interactable = !gameMenuPresentation.isTutorial() || gameMenuPresentation.isTutorialPassed();
}
void OnDestroy() {
if (timeScaleChanged)
Time.timeScale = oldTimeScale;
}
public void onCreateGameButtonClick() {
gameMenuPresentation.onCreateGameButtonClick ();
}
public void onLoadButtonClick() {
gameMenuPresentation.onLoadButtonClick ();
}
public void onOptionsButtonClick() {
gameMenuPresentation.onOptionsButtonClick ();
}
public void onOptionsGameButtonClick()
{
gameMenuPresentation.onOptionsGameButtonClick();
}
// TODO: Remove this method, replace with onExitButton
public void onExitMenuButtonClick() {
gameMenuPresentation.onExitMenuButtonClick ();
}
public void onExitButtonClick() {
gameMenuPresentation.onExitButtonClick ();
}
public void onSavedButtonClick() {
gameMenuPresentation.onSaveButtonClick();
}
}