public static void ValidatePuzzleResult(int puzzleId, int score, string hash, List <STPuzzleMove> moveset, Action <bool> callback) { if (!JavascriptInteractor.Actions.ContainsKey("ValidatePuzzle")) { JavascriptInteractor.Actions.Add("ValidatePuzzle", (result) => { var r = JsonUtility.FromJson <ValidatePuzzleData>(result); callback.Invoke(r.result); }); } else { JavascriptInteractor.Actions["ValidatePuzzle"] = (result) => { var r = JsonUtility.FromJson <ValidatePuzzleData>(result); callback.Invoke(r.result); } }; var movesSetWrapper = new MovesSetData(); movesSetWrapper.moveset = moveset; var temp = JsonUtility.ToJson(movesSetWrapper); MetamaskManager.ValidatePuzzleResult(puzzleId, score, hash, temp); } }
public static void GetPuzzleHash(Action <string> callback, Action <Exception> errorCallback) { if (!JavascriptInteractor.Actions.ContainsKey("GetPuzzle")) { JavascriptInteractor.Actions.Add("GetPuzzle", callback); } else { JavascriptInteractor.Actions["GetPuzzle"] = callback; } MetamaskManager.GetPuzzle(); }
public static void GetTopScores(Action <List <TopScore> > callback) { if (!JavascriptInteractor.Actions.ContainsKey("GetTopScores")) { JavascriptInteractor.Actions.Add("GetTopScores", (result) => { ProcessGetTopScores(result, callback); }); } else { JavascriptInteractor.Actions["GetTopScores"] = (result) => { ProcessGetTopScores(result, callback); } }; MetamaskManager.GetTopScores(50); }
private static void GetEndOfSeason(Action <long> callback) { if (!JavascriptInteractor.Actions.ContainsKey("GetEndOfSeason")) { JavascriptInteractor.Actions.Add("GetEndOfSeason", (result) => { ProcessEndOfSeason(result, callback); }); } else { JavascriptInteractor.Actions["GetEndOfSeason"] = (result) => { ProcessEndOfSeason(result, callback); } }; MetamaskManager.GetEndOfSeason(); }
public static void PushScore(int score, Action <bool> callback) { if (!JavascriptInteractor.Actions.ContainsKey("SetScore")) { JavascriptInteractor.Actions.Add("SetScore", (result) => { var r = JsonUtility.FromJson <SetScoreData>(result); callback.Invoke(r.result); }); } else { JavascriptInteractor.Actions["SetScore"] = (result) => { var r = JsonUtility.FromJson <SetScoreData>(result); callback.Invoke(r.result); }; } MetamaskManager.SetScore(score); }
private void UpdateLevelData(int index) { if (index >= PuzzleLevels.Count) { return; } var level = PuzzleLevels[index]; if (level == null) { return; } if (LevelName == null) { return; } LevelName.text = level.Name; LevelDescription.text = level.Description; LevelImage.sprite = level.Image; MetamaskManager.SelectGame(index); }
public static void GetAccount(Action <string> callback) { Address = MetamaskManager.GetAccount(); MainThreadDispatcher.EnqueueAction(() => callback(Address)); }