Revert most of the autoformatting in saving.gd.
This commit is contained in:
parent
cbf5abf724
commit
3d30a74477
1 changed files with 40 additions and 207 deletions
|
@ -5,201 +5,38 @@ var key = "creature"
|
||||||
var data = {}
|
var data = {}
|
||||||
|
|
||||||
var default = {
|
var default = {
|
||||||
"0":
|
"0": { "drag": 0, "identification": 930245150, "offset": "Vector2(0, 0)", "parentId": null, "path": "user://defaultAvatar/body.png", "pos": "Vector2(0, 0)", "rotDrag": 0, "showBlink": 0, "showTalk": 0, "type": "sprite", "useMidiWobble": false, "xAmp": 9, "xFrq": 0.002, "yAmp": 11, "yFrq": 0.004, "zindex": -1 },
|
||||||
{
|
"1": { "drag": 1, "identification": 456157398, "offset": "Vector2(0, 0)", "parentId": 930245150, "path": "user://defaultAvatar/head.png", "pos": "Vector2(0, 0)", "rotDrag": 0, "showBlink": 0, "showTalk": 0, "type": "sprite", "useMidiWobble": false, "xAmp": 0, "xFrq": 0, "yAmp": 0, "yFrq": 0, "zindex": 0 },
|
||||||
"drag": 0,
|
"2": { "drag": 4, "identification": 928082759, "offset": "Vector2(0, 0)", "parentId": 456157398, "path": "user://defaultAvatar/hair.png", "pos": "Vector2(0, 0)", "rotDrag": 0, "showBlink": 0, "showTalk": 0, "type": "sprite", "useMidiWobble": false, "xAmp": 0, "xFrq": 0, "yAmp": 0, "yFrq": 0, "zindex": -2 },
|
||||||
"identification": 930245150,
|
"3": { "drag": 0, "identification": 346749260, "offset": "Vector2(0, 0)", "parentId": 456157398, "path": "user://defaultAvatar/mouth1.png", "pos": "Vector2(0, 0)", "rotDrag": 0, "showBlink": 0, "showTalk": 1, "type": "sprite", "useMidiWobble": false, "xAmp": 0, "xFrq": 0, "yAmp": 0, "yFrq": 0, "zindex": 0 },
|
||||||
"offset": "Vector2(0, 0)",
|
"4": { "drag": 0, "identification": 348929106, "offset": "Vector2(0, 0)", "parentId": 456157398, "path": "user://defaultAvatar/mouth2.png", "pos": "Vector2(0, 0)", "rotDrag": 0, "showBlink": 0, "showTalk": 2, "type": "sprite", "useMidiWobble": false, "xAmp": 0, "xFrq": 0, "yAmp": 0, "yFrq": 0, "zindex": 0 },
|
||||||
"parentId": null,
|
"5": { "drag": 0, "identification": 66364456, "offset": "Vector2(0, 0)", "parentId": 456157398, "path": "user://defaultAvatar/eye1.png", "pos": "Vector2(0, 0)", "rotDrag": 0, "showBlink": 1, "showTalk": 2, "type": "sprite", "useMidiWobble": false, "xAmp": 0, "xFrq": 0, "yAmp": 0, "yFrq": 0, "zindex": 0 },
|
||||||
"path": "user://defaultAvatar/body.png",
|
"6": { "drag": 0, "identification": 261040117, "offset": "Vector2(0, 0)", "parentId": 456157398, "path": "user://defaultAvatar/eye2.png", "pos": "Vector2(0, 0)", "rotDrag": 0, "showBlink": 1, "showTalk": 1, "type": "sprite", "useMidiWobble": false, "xAmp": 0, "xFrq": 0, "yAmp": 0, "yFrq": 0, "zindex": 0 },
|
||||||
"pos": "Vector2(0, 0)",
|
"7": { "drag": 0, "identification": 291459997, "offset": "Vector2(0, 0)", "parentId": 456157398, "path": "user://defaultAvatar/eye3.png", "pos": "Vector2(0, 0)", "rotDrag": 0, "showBlink": 2, "showTalk": 0, "type": "sprite", "useMidiWobble": false, "xAmp": 0, "xFrq": 0, "yAmp": 0, "yFrq": 0, "zindex": 0 },
|
||||||
"rotDrag": 0,
|
"8": { "drag": 0, "identification": 148065686, "offset": "Vector2(-74, 92)", "parentId": 456157398, "path": "user://defaultAvatar/hat.png", "pos": "Vector2(72, -89)", "rotDrag": -2, "showBlink": 0, "showTalk": 0, "type": "sprite", "useMidiWobble": false, "xAmp": 0, "xFrq": 0, "yAmp": 0, "yFrq": 0, "zindex": 2 }
|
||||||
"showBlink": 0,
|
|
||||||
"showTalk": 0,
|
|
||||||
"type": "sprite",
|
|
||||||
"useMidiWobble": false,
|
|
||||||
"xAmp": 9,
|
|
||||||
"xFrq": 0.002,
|
|
||||||
"yAmp": 11,
|
|
||||||
"yFrq": 0.004,
|
|
||||||
"zindex": -1
|
|
||||||
},
|
|
||||||
"1":
|
|
||||||
{
|
|
||||||
"drag": 1,
|
|
||||||
"identification": 456157398,
|
|
||||||
"offset": "Vector2(0, 0)",
|
|
||||||
"parentId": 930245150,
|
|
||||||
"path": "user://defaultAvatar/head.png",
|
|
||||||
"pos": "Vector2(0, 0)",
|
|
||||||
"rotDrag": 0,
|
|
||||||
"showBlink": 0,
|
|
||||||
"showTalk": 0,
|
|
||||||
"type": "sprite",
|
|
||||||
"useMidiWobble": false,
|
|
||||||
"xAmp": 0,
|
|
||||||
"xFrq": 0,
|
|
||||||
"yAmp": 0,
|
|
||||||
"yFrq": 0,
|
|
||||||
"zindex": 0
|
|
||||||
},
|
|
||||||
"2":
|
|
||||||
{
|
|
||||||
"drag": 4,
|
|
||||||
"identification": 928082759,
|
|
||||||
"offset": "Vector2(0, 0)",
|
|
||||||
"parentId": 456157398,
|
|
||||||
"path": "user://defaultAvatar/hair.png",
|
|
||||||
"pos": "Vector2(0, 0)",
|
|
||||||
"rotDrag": 0,
|
|
||||||
"showBlink": 0,
|
|
||||||
"showTalk": 0,
|
|
||||||
"type": "sprite",
|
|
||||||
"useMidiWobble": false,
|
|
||||||
"xAmp": 0,
|
|
||||||
"xFrq": 0,
|
|
||||||
"yAmp": 0,
|
|
||||||
"yFrq": 0,
|
|
||||||
"zindex": -2
|
|
||||||
},
|
|
||||||
"3":
|
|
||||||
{
|
|
||||||
"drag": 0,
|
|
||||||
"identification": 346749260,
|
|
||||||
"offset": "Vector2(0, 0)",
|
|
||||||
"parentId": 456157398,
|
|
||||||
"path": "user://defaultAvatar/mouth1.png",
|
|
||||||
"pos": "Vector2(0, 0)",
|
|
||||||
"rotDrag": 0,
|
|
||||||
"showBlink": 0,
|
|
||||||
"showTalk": 1,
|
|
||||||
"type": "sprite",
|
|
||||||
"useMidiWobble": false,
|
|
||||||
"xAmp": 0,
|
|
||||||
"xFrq": 0,
|
|
||||||
"yAmp": 0,
|
|
||||||
"yFrq": 0,
|
|
||||||
"zindex": 0
|
|
||||||
},
|
|
||||||
"4":
|
|
||||||
{
|
|
||||||
"drag": 0,
|
|
||||||
"identification": 348929106,
|
|
||||||
"offset": "Vector2(0, 0)",
|
|
||||||
"parentId": 456157398,
|
|
||||||
"path": "user://defaultAvatar/mouth2.png",
|
|
||||||
"pos": "Vector2(0, 0)",
|
|
||||||
"rotDrag": 0,
|
|
||||||
"showBlink": 0,
|
|
||||||
"showTalk": 2,
|
|
||||||
"type": "sprite",
|
|
||||||
"useMidiWobble": false,
|
|
||||||
"xAmp": 0,
|
|
||||||
"xFrq": 0,
|
|
||||||
"yAmp": 0,
|
|
||||||
"yFrq": 0,
|
|
||||||
"zindex": 0
|
|
||||||
},
|
|
||||||
"5":
|
|
||||||
{
|
|
||||||
"drag": 0,
|
|
||||||
"identification": 66364456,
|
|
||||||
"offset": "Vector2(0, 0)",
|
|
||||||
"parentId": 456157398,
|
|
||||||
"path": "user://defaultAvatar/eye1.png",
|
|
||||||
"pos": "Vector2(0, 0)",
|
|
||||||
"rotDrag": 0,
|
|
||||||
"showBlink": 1,
|
|
||||||
"showTalk": 2,
|
|
||||||
"type": "sprite",
|
|
||||||
"useMidiWobble": false,
|
|
||||||
"xAmp": 0,
|
|
||||||
"xFrq": 0,
|
|
||||||
"yAmp": 0,
|
|
||||||
"yFrq": 0,
|
|
||||||
"zindex": 0
|
|
||||||
},
|
|
||||||
"6":
|
|
||||||
{
|
|
||||||
"drag": 0,
|
|
||||||
"identification": 261040117,
|
|
||||||
"offset": "Vector2(0, 0)",
|
|
||||||
"parentId": 456157398,
|
|
||||||
"path": "user://defaultAvatar/eye2.png",
|
|
||||||
"pos": "Vector2(0, 0)",
|
|
||||||
"rotDrag": 0,
|
|
||||||
"showBlink": 1,
|
|
||||||
"showTalk": 1,
|
|
||||||
"type": "sprite",
|
|
||||||
"useMidiWobble": false,
|
|
||||||
"xAmp": 0,
|
|
||||||
"xFrq": 0,
|
|
||||||
"yAmp": 0,
|
|
||||||
"yFrq": 0,
|
|
||||||
"zindex": 0
|
|
||||||
},
|
|
||||||
"7":
|
|
||||||
{
|
|
||||||
"drag": 0,
|
|
||||||
"identification": 291459997,
|
|
||||||
"offset": "Vector2(0, 0)",
|
|
||||||
"parentId": 456157398,
|
|
||||||
"path": "user://defaultAvatar/eye3.png",
|
|
||||||
"pos": "Vector2(0, 0)",
|
|
||||||
"rotDrag": 0,
|
|
||||||
"showBlink": 2,
|
|
||||||
"showTalk": 0,
|
|
||||||
"type": "sprite",
|
|
||||||
"useMidiWobble": false,
|
|
||||||
"xAmp": 0,
|
|
||||||
"xFrq": 0,
|
|
||||||
"yAmp": 0,
|
|
||||||
"yFrq": 0,
|
|
||||||
"zindex": 0
|
|
||||||
},
|
|
||||||
"8":
|
|
||||||
{
|
|
||||||
"drag": 0,
|
|
||||||
"identification": 148065686,
|
|
||||||
"offset": "Vector2(-74, 92)",
|
|
||||||
"parentId": 456157398,
|
|
||||||
"path": "user://defaultAvatar/hat.png",
|
|
||||||
"pos": "Vector2(72, -89)",
|
|
||||||
"rotDrag": -2,
|
|
||||||
"showBlink": 0,
|
|
||||||
"showTalk": 0,
|
|
||||||
"type": "sprite",
|
|
||||||
"useMidiWobble": false,
|
|
||||||
"xAmp": 0,
|
|
||||||
"xFrq": 0,
|
|
||||||
"yAmp": 0,
|
|
||||||
"yFrq": 0,
|
|
||||||
"zindex": 2
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var settings = {
|
var settings = {
|
||||||
"newUser": true,
|
"newUser":true,
|
||||||
"lastAvatar": "",
|
"lastAvatar":"",
|
||||||
"volume": 0.185,
|
"volume":0.185,
|
||||||
"sense": 0.25,
|
"sense":0.25,
|
||||||
"windowSize": Vector2i(1280, 720),
|
"windowSize":Vector2i(1280,720),
|
||||||
"useStreamDeck": false,
|
"useStreamDeck":false,
|
||||||
"bounce": 250,
|
"bounce":250,
|
||||||
"gravity": 1000,
|
"gravity":1000,
|
||||||
"maxFPS": 60,
|
"maxFPS":60,
|
||||||
"secondsToMicReset": 180,
|
"secondsToMicReset":180,
|
||||||
"backgroundColor": var_to_str(Color(0.0, 0.0, 0.0, 0.0)),
|
"backgroundColor":var_to_str(Color(0.0,0.0,0.0,0.0)),
|
||||||
"filtering": false,
|
"filtering":false,
|
||||||
"costumeKeys": ["1", "2", "3", "4", "5", "6", "7", "8", "9", "0"],
|
"costumeKeys":["1","2","3","4","5","6","7","8","9","0"],
|
||||||
"blinkSpeed": 1.0,
|
"blinkSpeed":1.0,
|
||||||
"blinkChance": 200,
|
"blinkChance":200,
|
||||||
"bounceOnCostumeChange": false,
|
"bounceOnCostumeChange":false,
|
||||||
}
|
}
|
||||||
|
|
||||||
var settingsPath = "user://settings.pngtp"
|
var settingsPath = "user://settings.pngtp"
|
||||||
|
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
var datas = read_save(settingsPath)
|
var datas = read_save(settingsPath)
|
||||||
if datas == null:
|
if datas == null:
|
||||||
|
@ -207,18 +44,19 @@ func _ready():
|
||||||
else:
|
else:
|
||||||
settings = datas.duplicate()
|
settings = datas.duplicate()
|
||||||
|
|
||||||
|
|
||||||
func _exit_tree():
|
func _exit_tree():
|
||||||
write_settings(settingsPath)
|
write_settings(settingsPath)
|
||||||
|
|
||||||
|
|
||||||
func read_save(path):
|
func read_save(path):
|
||||||
|
|
||||||
if path == "default":
|
if path == "default":
|
||||||
return DefaultAvatarData.data
|
return DefaultAvatarData.data
|
||||||
|
|
||||||
if OS.has_feature("web"):
|
|
||||||
|
if OS.has_feature('web'):
|
||||||
var JSONstr = JavaScriptBridge.eval("window.localStorage.getItem('" + key + "');")
|
var JSONstr = JavaScriptBridge.eval("window.localStorage.getItem('" + key + "');")
|
||||||
if JSONstr:
|
if (JSONstr):
|
||||||
return JSON.parse_string(JSONstr)
|
return JSON.parse_string(JSONstr)
|
||||||
else:
|
else:
|
||||||
return null
|
return null
|
||||||
|
@ -230,18 +68,14 @@ func read_save(path):
|
||||||
file.close()
|
file.close()
|
||||||
return newData
|
return newData
|
||||||
|
|
||||||
|
|
||||||
func write_save(path):
|
func write_save(path):
|
||||||
if OS.has_feature("web"):
|
if OS.has_feature('web'):
|
||||||
JavaScriptBridge.eval(
|
JavaScriptBridge.eval("window.localStorage.setItem('" + key + "', '" + JSON.stringify(data) + "');")
|
||||||
"window.localStorage.setItem('" + key + "', '" + JSON.stringify(data) + "');"
|
|
||||||
)
|
|
||||||
else:
|
else:
|
||||||
var file = FileAccess.open(path, FileAccess.WRITE)
|
var file = FileAccess.open(path, FileAccess.WRITE)
|
||||||
file.store_line(JSON.stringify(data))
|
file.store_line(JSON.stringify(data))
|
||||||
file.close()
|
file.close()
|
||||||
|
|
||||||
|
|
||||||
func write_settings(path):
|
func write_settings(path):
|
||||||
var file = FileAccess.open(path, FileAccess.WRITE)
|
var file = FileAccess.open(path, FileAccess.WRITE)
|
||||||
file.store_line(JSON.stringify(settings))
|
file.store_line(JSON.stringify(settings))
|
||||||
|
@ -249,9 +83,10 @@ func write_settings(path):
|
||||||
|
|
||||||
|
|
||||||
func clearSave():
|
func clearSave():
|
||||||
if OS.has_feature("web"):
|
|
||||||
|
if OS.has_feature('web'):
|
||||||
var JSONstr = JavaScriptBridge.eval("window.localStorage.getItem('" + key + "');")
|
var JSONstr = JavaScriptBridge.eval("window.localStorage.getItem('" + key + "');")
|
||||||
if JSONstr:
|
if (JSONstr):
|
||||||
JavaScriptBridge.eval("window.localStorage.removeItem('" + key + "');")
|
JavaScriptBridge.eval("window.localStorage.removeItem('" + key + "');")
|
||||||
else:
|
else:
|
||||||
return null
|
return null
|
||||||
|
@ -263,17 +98,15 @@ func clearSave():
|
||||||
var dir = DirAccess.open("user://")
|
var dir = DirAccess.open("user://")
|
||||||
dir.remove(key + ".save")
|
dir.remove(key + ".save")
|
||||||
data = {}
|
data = {}
|
||||||
|
|
||||||
|
|
||||||
func open_site(url):
|
func open_site(url):
|
||||||
if OS.has_feature("web"):
|
if OS.has_feature('web'):
|
||||||
JavaScriptBridge.eval('window.open("' + url + '");')
|
JavaScriptBridge.eval("window.open(\"" + url + "\");")
|
||||||
else:
|
else:
|
||||||
print("Could not open site " + url + " without an HTML5 build")
|
print("Could not open site " + url + " without an HTML5 build")
|
||||||
|
|
||||||
|
|
||||||
func switchToSite(url):
|
func switchToSite(url):
|
||||||
if OS.has_feature("web"):
|
if OS.has_feature('web'):
|
||||||
JavaScriptBridge.eval('window.open("' + url + '", "_parent");')
|
JavaScriptBridge.eval("window.open(\"" + url + "\", \"_parent\");")
|
||||||
else:
|
else:
|
||||||
print("Could not switch to site " + url + " without an HTML5 build")
|
print("Could not switch to site " + url + " without an HTML5 build")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue