-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMain.gd
103 lines (83 loc) · 2.88 KB
/
Main.gd
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
extends Node
signal sceneChange(scene)
# Mode scenes
#var AlarmScene : PackedScene = load("res://Alarm.tscn")
var ClockScene : PackedScene = load("res://Clock.tscn")
var TimerScene : PackedScene = load("res://Timer.tscn")
var StopwatchScene : PackedScene = load("res://Stopwatch.tscn")
# Only load the screen once
var isSceneLoaded = false
var screenDimentions := Vector2(0,0);
# Called when the node enters the scene tree for the first time.
func _ready():
#Variables.currentScene = Variables.defaultScene
screenDimentions = self.rect_size
var clockScene = ClockScene.instance()
var stopwatchScene = StopwatchScene.instance()
var timerScene = TimerScene.instance()
var Menu : PackedScene = load("res://Menu.tscn")
var menu = Menu.instance()
# var ModeList : PackedScene = load("res://ModeList.tscn")
# var modeList = ModeList.instance()
var sceneChange = $"/root/System"
sceneChange.connect("swipeDirection", self, "directionChange")
if (!isSceneLoaded):
#match Variables.currentScene:
# Variables.CurrentSceneIs.ALARM:
# #var AlarmScene = AlarmScene.instance()
# #add_child(alarmScene)
# pass
# Variables.CurrentSceneIs.CLOCK:
# var clockScene = ClockScene.instance()
# add_child(clockScene)
# clockScene.rect_size = screenDimentions
# pass
# Variables.CurrentSceneIs.TIMER:
# #var timerScene = TimerScene.instance()
# #add_child(timerScene)
# pass
# Variables.CurrentSceneIs.STOPWATCH:
# var stopwatchScene = StopwatchScene.instance()
# #stopwatchScene.rect_size = screenDimentions;
# add_child(stopwatchScene)
# pass
# Clock
add_child(clockScene)
clockScene.rect_size = screenDimentions
clockScene.visible = false; #remove once timer is finished
# Stopwatch
add_child(stopwatchScene)
stopwatchScene.rect_size = screenDimentions;
stopwatchScene.visible = false;
# Timer
add_child(timerScene)
timerScene.rect_size = screenDimentions;
timerScene.visible = false;
# Mode List
#add_child(modeList)
# Menu
add_child(menu)
isSceneLoaded = true
func _process(_delta):
pass
func directionChange(direction):
if (direction == Variables.SwipeDirection.UP):
pass
if (direction == Variables.SwipeDirection.DOWN):
pass
if (direction == Variables.SwipeDirection.LEFT):
Variables.currentScene = Variables.CurrentSceneIs.STOPWATCH
$Clock.visible = false
$Stopwatch.visible = true
emit_signal("sceneChange", Variables.CurrentSceneIs.STOPWATCH)
#Variables.switchScene = true
pass
if (direction == Variables.SwipeDirection.RIGHT):
Variables.currentScene = Variables.CurrentSceneIs.CLOCK
$Clock.visible = true
$Stopwatch.visible = false
emit_signal("sceneChange", Variables.CurrentSceneIs.CLOCK)
#Variables.switchScene = true
pass
Variables.swipeDirection = null
pass