using Godot; using System; using System.Collections.Generic; using System.Threading.Tasks; public partial class Main : Control { [Export] public LineEdit NameField; [Export] public TsunagiteHandler Handler; [Export] public Label ResultLabel; // Called when the node enters the scene tree for the first time. public override void _Ready() { Handler.Reauthorize(); } // Called every frame. 'delta' is the elapsed time since the previous frame. public override void _Process(double delta) { } public void _OnLoginPressed() { string handle = NameField.Text; Handler.Authorize(handle); } public void _OnHandleLoaded(string handle) { NameField.Text = handle; } public void _OnAuthComplete(bool authed) { GD.Print($"Authed: {authed}"); } public void _OnDoThingPressed() { DoThisPlease(); } public async Task DoThisPlease() { TsunagiteScore score = new() { Timestamp = DateTime.Now, SongKey = "mirinTestSong", ChartKey = "mirinTestSong-expert", Judgments = new JudgmentTotals() { {Judgment.critPerfect, new JudgmentTotalSet() {Total = 33}}, {Judgment.perfect, new JudgmentTotalSet() {Total = 15, Early = 5, Late = 10}}, {Judgment.great, new JudgmentTotalSet() {Total = 10, Early = 6, Late = 3}}, {Judgment.good, new JudgmentTotalSet() {Total = 2, Late = 2}}, {Judgment.miss, new JudgmentTotalSet() {Total = 2}} }, ScoreComponents = new Dictionary() { {"lamp", new EnumComponent(Lamp.pass)}, {"points", new PointsComponent(18500)}, {"accuracy", new PercentageComponent(85.7425f, 4)} } }; string res = await Handler.SubmitScore(score); ResultLabel.Text = res; } }