Example #1
0
        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);
        }
    }
Example #2
0
 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();
 }
Example #3
0
 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);
 }
Example #4
0
 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();
 }
Example #5
0
 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);
 }
Example #6
0
    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);
    }
Example #7
0
 public static void GetAccount(Action <string> callback)
 {
     Address = MetamaskManager.GetAccount();
     MainThreadDispatcher.EnqueueAction(() => callback(Address));
 }