Ejemplo n.º 1
0
    public static IEnumerator ConnectToRoom(int Game)
    {
        var Data = new WWWForm();

        Data.AddField("game", Game.ToString());
        Data.AddField("id", PlayFabLogin.ReturnMobileID());
        var Query = new WWW("http://mevlme44.myjino.ru/connect.php/", Data.data);

        yield return(Query);

        if (Query.error != null)
        {
            Debug.Log("Server does not respond : " + Query.error);
        }
        else
        {
            Query.MoveNext();
            if (Query.text == "No room")
            {
                Debug.LogError(Query.text);
            }
            else
            {
                GlobalDefines.RecRoom = int.Parse(Query.text);
                Debug.Log(Query.text);
            }
        }
        Query.Dispose();
    }
Ejemplo n.º 2
0
    public static IEnumerator CheckWinner(int Game, MonoBehaviour parent, string Que)
    {
        var Data = new WWWForm();

        Data.AddField("game", Game.ToString());
        Data.AddField("room", GlobalDefines.RecRoom.ToString());
        Data.AddField("que", Que);
        var Query = new WWW("http://mevlme44.myjino.ru/checkAllPlayers.php/", Data.data);

        yield return(Query);

        if (Query.error != null)
        {
            Debug.Log("Server does not respond : " + Query.error);
        }
        else
        {
            Query.MoveNext();
            var tmp = Query.text.Split(' ');
            Debug.LogError(Query.text);
            GlobalDefines.RecWinner = tmp[0];
            var id = tmp[2];
            if (id == PlayFabLogin.ReturnMobileID())
            {
                GlobalDefines.Win = true;
            }
            GlobalDefines.RecWinScore = int.Parse(tmp[1]);
        }
        Query.Dispose();
    }
Ejemplo n.º 3
0
 public void OnApplicationQuit()
 {
     StartCoroutine(Disconnect(this, PlayFabLogin.ReturnMobileID(), GlobalDefines.RecGame, 0));
 }
Ejemplo n.º 4
0
    public static IEnumerator Disconnect(MonoBehaviour parent, string id, int Game, int score)
    {
        yield return(parent.StartCoroutine(CloudSave.POST(Game.ToString(), GlobalDefines.RecRoom, score.ToString())));

        yield return(parent.StartCoroutine(LeaveFromRoom(Game, GlobalDefines.RecRoom, PlayFabLogin.ReturnMobileID(), true)));
    }
Ejemplo n.º 5
0
    public static IEnumerator loadOut(MonoBehaviour parent, int Game)
    {
        if (Game == 1)
        {
            yield return(parent.StartCoroutine(CloudSave.POST(Game.ToString(), GlobalDefines.RecRoom, GlobalDefines.returnsFirstGame.ToString())));

            yield return(parent.StartCoroutine(WaitForExit(Game, parent)));

            yield return(parent.StartCoroutine(CheckWinner(Game, parent, GlobalDefines.Que)));
        }
        if (Game == 2)
        {
            yield return(parent.StartCoroutine(CloudSave.POST(Game.ToString(), GlobalDefines.RecRoom, GlobalDefines.returnsSecondGame.ToString())));

            yield return(parent.StartCoroutine(WaitForExit(Game, parent)));

            yield return(parent.StartCoroutine(CheckWinner(Game, parent, GlobalDefines.Que)));
        }
        if (Game == 3)
        {
            yield return(parent.StartCoroutine(CloudSave.POST(Game.ToString(), GlobalDefines.RecRoom, GlobalDefines.returnsThirdGame.ToString())));

            yield return(parent.StartCoroutine(WaitForExit(Game, parent)));

            yield return(parent.StartCoroutine(CheckWinner(Game, parent, GlobalDefines.Que)));
        }
        yield return(parent.StartCoroutine(LeaveFromRoom(Game, GlobalDefines.RecRoom, PlayFabLogin.ReturnMobileID())));

        SceneManager.LoadScene("Win");
        yield return(new WaitForSeconds(10));

        SceneManager.LoadScene("SampleScene");
    }
Ejemplo n.º 6
0
 public static IEnumerator ExitLoad(MonoBehaviour parent, int Game)
 {
     yield return(parent.StartCoroutine(LeaveFromRoom(Game, GlobalDefines.RecRoom, PlayFabLogin.ReturnMobileID())));
 }