This repository was archived by the owner on Nov 30, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRegistry.py
59 lines (51 loc) · 1.7 KB
/
Registry.py
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
# Manages all data going in and out
import Util
import Enum as CEnum
class Registry():
def __init__(self):
self.entities = {}
self.settings = {
"ShowFps": {
"DisplayName": "Show FPS Counter",
"InputType": CEnum.InputFieldType.Switch,
"Value": False
},
"ShowVer": {
"DisplayName": "Show Version",
"InputType": CEnum.InputFieldType.Switch,
"Value": False
},
"FpsLimit": {
"DisplayName": "FPS Limit",
"Value": 60
},
"Sounds": {
"DisplayName": "Sounds",
"Value": True
},
"DebugMode": {
"DisplayName": "Debug Mode",
"Value": False
},
"CommandCon": {
"DisplayName": "Command Console",
"Value": False
},
"MouseSpeed": {
"DisplayName": "Mouse Speed",
"Value": 0.1
}
}
def __setattr__(self, attr, value):
print("[REGISTRY] Attr {} has been changed to {}".format(attr, value))
super(Registry, self).__setattr__(attr, value)
def register_entity(self, entity):
"""Register an entity in the Registry
Parameters:
entity (DefaultEntity): The default entity
Returns:
uuid: Generated UUID
"""
generatedUuid = Util.generate_unique_uuid_retry(self.entities)
print("[REGISTRY] Entity {} has been registered with UUID {}".format(entity, generatedUuid.hex))
self.entities[generatedUuid.hex] = generatedUuid