public void GetTeams()
    {
        btnGo.gameObject.SetActive(false);
        string code = SessieCode.text;

        code = code.Trim('"');
        Debug.Log(code + "code");
        url = "Sessie/toList?code=" + code;
        //Debug.Log(url);
        List <string> teamnamen = new List <string>();

        teamlijst = new Dictionary <string, int>();
        if (SessieCode.text == "666") //dev bypass
        {
            teamnamen = new List <string>();
            teamlijst.Add("dev", -1);
            teamnamen.Add("dev");
            teamlijst.Add("Bypass", -1);
            teamnamen.Add("Bypass");
            teamlijst.Add("HAXXXX!", -1);
            teamnamen.Add("HAXXXX!");
            SetupPutInTeam();
        }
        else
        {
            StartCoroutine(api.Get2(url, GetTeamResult));
        }
    }
Exemplo n.º 2
0
    public void CheckIfRegisterd(string json)
    {
        Debug.Log("Checking...");
        if (json != "-1" && json != "")
        {
            var N = JSON.Parse(json);
            Debug.Log(N);
            textvoornaam   = N["voornaam"].Value.ToString();
            textachternaam = N["achternaam"].Value.ToString();

            Info.Voornaam   = textvoornaam;
            Info.SpelerNaam = textvoornaam + " " + textachternaam;
            Info.spelerId   = N["id"];

            Debug.Log("InfoTypes:");
            Debug.Log("voornaam: " + Info.Voornaam);
            Debug.Log("spelernaam: " + Info.SpelerNaam);
            Debug.Log("spelerid: " + Info.spelerId);

            if (startcheck)
            {
                StartCoroutine(api.Get2("speler/" + Info.spelerId + "/team", CheckInTeam));
                Debug.Log("startcheck");
                startcheck = false;
            }
            button1.interactable = false;
            button2.interactable = true;
            updatetext();
            registerd = true;
            Debug.Log(nextlevel);
        }
    }
    // Update is called once per frame
    void Update()
    {
        // change score on screen
        scoreText.text = CalculateScore().ToString() + "/10";

        // check if player is to low and dies
        if (playerObject.transform.position.y < 0)
        {
            StartCoroutine(Dies());
            StartCoroutine(api.Get2(teamScoreUrl, (result) => getScores(result)));
        }

        // check if player reached end of the game
        if (playerObject.transform.position.x > eindPositie)
        {
            StartCoroutine(Winner());
            StartCoroutine(api.Get2(teamScoreUrl, (result) => getScores(result)));
        }

        Debug.Log("current score is " + CalculateScore());
        try {
            // check if screen is touched to jump
            if (Input.GetTouch(0).phase == TouchPhase.Began)
            {
                animator.SetBool("IsJumping", true);
                jump = true;
            }
        }
        catch (ArgumentException e)
        {
            Debug.Log(e);
        }
    }
    public void EndGameActionfinal(string json, string locatienaam, double score, APICaller API)
    {
        Debug.Log("json for score is" + json);
        if (json == "3")
        {
            Debug.Log("score/" + Info.TeamId + "/" + locatienaam + "/" + score);

            StartCoroutine(API.Get2("score/" + Info.TeamId + "/" + locatienaam + "/" + score, donothing));
            StartCoroutine(API.Get2("team/" + Info.TeamId + "/nextpuzzel", donothing));
        }
        EndGameAction(json);
    }
    public IEnumerator UpdateInfo(APICaller _api, Action doLast)
    {
        isDone = false;
        string url = "Speler/" + Info.spelerId.ToString() + "/Team";

        StartCoroutine(_api.Get2(url, (result) => { //lamba functie zijn ook een opties om dit op te lossen
            GetSpeler(result);
        }));

        url = "Speler/" + Info.spelerId.ToString();
        StartCoroutine(_api.Get2(url, GetSpeler));
        yield return(new WaitUntil(() => !isDone));

        doLast();
    }
    void request()
    {
        url = "quiz/" + count;
        Debug.Log(url);
        WWW www = new WWW(url);

        StartCoroutine(api.Get2(url, ActionGet));
    }
Exemplo n.º 7
0
 void Update()
 {
     if (!_updating)
     {
         _updating = true;
         StartCoroutine(_api.Get2("Team/" + Info.TeamId + "/ActivePuzzel", result));
     }
 }
    public IEnumerator UpdateLocatie(APICaller _api, Action doLast)
    {
        isDone = false;
        var url = "puzzel/" + (Info.Diamanten) + "/location";

        StartCoroutine(_api.Get2(url, Locatie));

        yield return(new WaitUntil(() => !isDone));

        doLast();
    }
Exemplo n.º 9
0
    // Use this for initialization
    void Start()
    {
        url                       = "speler/register/" + SystemInfo.deviceUniqueIdentifier.ToString();
        api                       = gameObject.AddComponent <APICaller>();
        levelLoader               = gameObject.AddComponent <LevelLoader>();
        levelLoader.slider        = slider;
        levelLoader.loadingscreen = loadingscreen;
        button2.onClick.AddListener(OnClick);

        Debug.Log(url);
        StartCoroutine(api.Get2(url, CheckIfRegisterd));
    }
    void UpdateInfo()
    {
        SpelerNaam.text = Info.SpelerNaam;
        TeamNaam.text   = Info.TeamNaam;
        Diamanten.text  = Info.Diamanten.ToString();
        Score.text      = Info.Score.ToString();
        SpelerNaam.text = Info.Voornaam;
        SessieCode.text = Info.SessieCode;
        var url = "Team/" + Info.TeamId.ToString() + "/GetScorePosition";

        StartCoroutine(api.Get2(url, ScorePos));
    }
 public void ChangeGameMode(APICaller apicaller)
 {
     Debug.Log("changegamemode");
     StartCoroutine(apicaller.Get2("team/" + Info.TeamId + "/" + Info.spelerId + "/changegamemode", EndGameAction));
 }