-
Notifications
You must be signed in to change notification settings - Fork 0
/
GenericSystem.kt
68 lines (59 loc) · 2.15 KB
/
GenericSystem.kt
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
package top.kkoishi.stg.logic
import top.kkoishi.stg.common.ui.*
import java.util.concurrent.atomic.AtomicBoolean
import java.util.concurrent.atomic.AtomicInteger
object GenericSystem {
/**
* Identify that the game engine should display menus.
*
* ## Instructions of this constant
* In this state, only [UIObject] in [ObjectPool.UIObjects] will be rendered and calculated.
*
* @see top.kkoishi.stg.test.Test.mainMenu
*/
const val STATE_MENU = 1
/**
* Identify that the game has been paused.
*
* ## Instructions of this constant
* Before switch the game state to this, please make sure you have initialized or reinitialized the stage and
* player instance, and you should add a pause menu into UIObjects at the mean time.
* ### They are located in [PlayerManager.curStage], [ObjectPool.player] and [ObjectPool.UIObjects].
* Also, some [UIObject] which are added to UIObjects and can action during playing will
* be rendered and calculated.
*
*/
const val STATE_PAUSE = 2
/**
* Identify that the game has begun.
*
* ## Instructions of this constant
* Before switch the game state to this, please make sure you have initialized or reinitialized the stage
* and the player correctly.
* ### They are located in [PlayerManager.curStage] and [ObjectPool.player].
* Also, some [UIObject] which are added to [ObjectPool.UIObjects] and can action during playing will
* be rendered and calculated.
*
* @see top.kkoishi.stg.test.Test.start
*/
const val STATE_PLAYING = 3
/**
* Identify that the game is loading.
*/
const val STATE_LOADING = 0
/**
* Used to identify the game state.
*
* ### This static variable should be set to [STATE_LOADING], [STATE_PLAYING], [STATE_PAUSE] or [STATE_MENU].
*/
@JvmStatic
val gameState = AtomicInteger(STATE_LOADING)
@JvmStatic
var logToFile: Boolean = false
@JvmStatic
private val inDialogImpl = AtomicBoolean(false)
@JvmStatic
var inDialog: Boolean
set(value) = inDialogImpl.set(value)
get() = inDialogImpl.get()
}