mirror of
https://github.com/HarmonyHoney/tiny_crate.git
synced 2026-01-23 02:34:53 +00:00
remove addons & multiplayer calls
This commit is contained in:
parent
a627dd11f1
commit
15af541390
79 changed files with 14 additions and 7033 deletions
|
|
@ -1,57 +0,0 @@
|
|||
extends Node
|
||||
|
||||
onready var api_file = load("silent_wolf_api_key.gd")
|
||||
var api_key := ""
|
||||
var is_online := false
|
||||
var scores := {}
|
||||
|
||||
signal new_score
|
||||
|
||||
func _ready():
|
||||
is_online = api_file is Script
|
||||
if !is_online: return
|
||||
|
||||
print("Leaderboard Shared.username: ", Shared.username)
|
||||
|
||||
api_key = api_file.source_code.strip_edges().replace('"', "")
|
||||
SilentWolf.configure({
|
||||
"api_key": api_key,
|
||||
"game_id": "TinyCrate",
|
||||
"game_version": "1.0.0",
|
||||
"log_level": 1})
|
||||
|
||||
SilentWolf.configure_scores({"open_scene_on_close": "res://scenes/MainPage.tscn"})
|
||||
|
||||
|
||||
yield(get_tree(), "idle_frame")
|
||||
SilentWolf.Scores.persist_score(Shared.username, 1)
|
||||
|
||||
func refresh_scores():
|
||||
if !is_online: return
|
||||
|
||||
var a = Shared.maps.duplicate()
|
||||
var notes = []
|
||||
for i in a:
|
||||
notes.append(i + "-note")
|
||||
a.append_array(notes)
|
||||
for i in a:
|
||||
yield(SilentWolf.Scores.get_high_scores(0, i), "sw_scores_received")
|
||||
if SilentWolf.Scores.leaderboards.has(i):
|
||||
var s = SilentWolf.Scores.leaderboards[i]
|
||||
scores[i] = s
|
||||
|
||||
func refresh_score(map_name):
|
||||
if !is_online: return
|
||||
|
||||
yield(SilentWolf.Scores.get_high_scores(0, map_name), "sw_scores_received")
|
||||
if SilentWolf.Scores.leaderboards.has(map_name):
|
||||
var s = SilentWolf.Scores.leaderboards[map_name]
|
||||
scores[map_name] = s
|
||||
emit_signal("new_score")
|
||||
#print(s)
|
||||
|
||||
func submit_score(board_name, score, _username := Shared.username):
|
||||
if !is_online: return
|
||||
|
||||
SilentWolf.Scores.persist_score(_username , score, board_name)
|
||||
|
||||
|
|
@ -464,7 +464,7 @@ func win():
|
|||
|
||||
print("map complete")
|
||||
|
||||
Leaderboard.submit_score(m, -map_frame)
|
||||
#Leaderboard.submit_score(m, -map_frame)
|
||||
|
||||
wipe_scene(level_select_path)
|
||||
|
||||
|
|
@ -502,8 +502,8 @@ func die():
|
|||
else:
|
||||
s["die"] += 1
|
||||
|
||||
Leaderboard.submit_score("death", 1)
|
||||
Leaderboard.submit_score("death", 1, map_name)
|
||||
#Leaderboard.submit_score("death", 1)
|
||||
#Leaderboard.submit_score("death", 1, map_name)
|
||||
print("you died")
|
||||
|
||||
func pick_player_colors():
|
||||
|
|
|
|||
|
|
@ -63,8 +63,8 @@ var blink_clock := 0.0
|
|||
var blink_count = 10
|
||||
|
||||
func _ready():
|
||||
Leaderboard.connect("new_score", self, "new_score")
|
||||
SilentWolf.Scores.connect("sw_scores_received", self, "new_score")
|
||||
#Leaderboard.connect("new_score", self, "new_score")
|
||||
#SilentWolf.Scores.connect("sw_scores_received", self, "new_score")
|
||||
|
||||
is_faster_note = Shared.is_faster_note
|
||||
is_faster = is_faster_note or Shared.is_faster
|
||||
|
|
@ -276,7 +276,7 @@ func refresh_score(var map_name : String = current_map):
|
|||
write_score()
|
||||
|
||||
if !last_refresh.has(map_name) or last_refresh[map_name] == 0:
|
||||
Leaderboard.refresh_score(map_name)
|
||||
#Leaderboard.refresh_score(map_name)
|
||||
print(map_name, " FRESH FRESH FRESH FRESH FRESH FRESH FRESH FRESH FRESH FRESH FRESH FRESH FRESH FRESH FRESH ")
|
||||
last_refresh[map_name] = refresh_wait
|
||||
|
||||
|
|
@ -287,27 +287,14 @@ func write_score():
|
|||
var map_name = current_map + ("-note" if show_score == 2 else "")
|
||||
var t = ""
|
||||
var count = 0
|
||||
if Leaderboard.is_online:
|
||||
if Leaderboard.scores.has(map_name):
|
||||
var s = Leaderboard.scores[map_name]
|
||||
if s.empty():
|
||||
t = "no data!"
|
||||
else:
|
||||
for i in s:
|
||||
t += Shared.time_to_string(-int(i["score"])) + " " + str(i["player_name"]) + "\n"
|
||||
count += 1
|
||||
if count > 9 : break
|
||||
else:
|
||||
t = "loading..."
|
||||
if Shared.replays.has(map_name):
|
||||
for i in Shared.replays[map_name]:
|
||||
if i.has("frames"):
|
||||
t += Shared.time_to_string(int(i["frames"])) + "\n"
|
||||
count += 1
|
||||
if count > 9 : break
|
||||
else:
|
||||
if Shared.replays.has(map_name):
|
||||
for i in Shared.replays[map_name]:
|
||||
if i.has("frames"):
|
||||
t += Shared.time_to_string(int(i["frames"])) + "\n"
|
||||
count += 1
|
||||
if count > 9 : break
|
||||
else:
|
||||
t = "NO DATA!"
|
||||
t = "NO DATA!"
|
||||
|
||||
score_list.text = t
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue