Esempio 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();
    }
Esempio 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();
    }
Esempio n. 3
0
    //GetFriendsListResult getfriendlist;

    private void Awake()
    {
        manage = this;
        if (string.IsNullOrEmpty(PlayFabSettings.TitleId))
        {
            PlayFabSettings.TitleId = "5225C";
        }
    }
Esempio n. 4
0
    // Use this for initialization
    void Start()
    {
        m_plate = GameObject.Find("plate").GetComponent <SpriteRenderer>();

        m_nextLocation = transform.position;
        m_needsToMove  = false;

        m_recipes = PlayFabLogin.GetMinigameRecipes();
    }
Esempio n. 5
0
 // Start is called before the first frame update
 void Start()
 {
     _stateMachine = new ConnectionStateMachine(this);
     _stateMachine.OnEnable(ConnectionFSMStateEnum.StateEnum.START);
     if (_playFab == null)
     {
         _playFab = GetComponent <PlayFabLogin>();
     }
 }
Esempio n. 6
0
    void Start()
    {
        oldPosition = this.transform.localPosition;
        GameObject manager = GameObject.Find("PlayFabManager");

        if (manager != null)
        {
            playfabLogin = manager.GetComponent <PlayFabLogin>();
        }
        ;
    }
Esempio n. 7
0
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else
     {
         Destroy(gameObject);
     }
     DontDestroyOnLoad(gameObject);
 }
Esempio n. 8
0
    void Start()
    {
        autoRequest = GetComponent <PlayFabAutoRequest>();
        isGet       = false;

        if (playFabLogin == default || waitConnect == default)
        {
            GameObject playFabManager = GameObject.Find("PlayFabManager");
            playFabLogin = playFabManager.GetComponent <PlayFabLogin>();
            waitConnect  = playFabManager.GetComponent <PlayFabWaitConnect>();
        }
    }
Esempio n. 9
0
 private void OnEnable()
 {
     if (manage == null)
     {
         manage = this;
     }
     else
     {
         if (manage != this)
         {
             Destroy(this.gameObject);
         }
     }
 }
Esempio n. 10
0
    public void RecruitWaiter()
    {
        PurchaseItemRequest request = new PurchaseItemRequest();

        request.ItemId          = "waiter_cat";
        request.CatalogVersion  = "Items";
        request.VirtualCurrency = "NM";
        request.Price           = 0;
        PlayFabClientAPI.PurchaseItem(request, result => {
            PlayFabLogin.GetMoney();
            //gameObject.SetActive(false);
            //result is a List<ItemInstance> object
            Debug.Log("got a cat!");
            PlayFabLogin.SetItemCutsomData(data.GetCustomDataFromWaiterData(), result.Items[0].ItemInstanceId, PlayFabLogin.playerId);
        }, error => { Debug.LogError(error.ErrorMessage); });
    }
Esempio n. 11
0
    public void CompletePurchase()
    {
        PurchaseItemRequest request = new PurchaseItemRequest();

        request.ItemId          = "" + data.id;
        request.CatalogVersion  = "Items";
        request.VirtualCurrency = "NM";
        request.Price           = data.cost;
        DecorationData d = data;

        PlayFabClientAPI.PurchaseItem(request, result => {
            Debug.Log("Purchased!");
            PlayFabLogin.GetMoney();
            CatInventory.catInv.SortChoice();
            gameObject.SetActive(false);
            //result is a List<ItemInstance> object
            CatInventory.catInv.AddOwnedDecoration(d, result.Items[0]);
        }, error => { Debug.LogError(error.ErrorMessage); });
        data = null;
    }
Esempio n. 12
0
 void Start()
 {
     Login = GetComponent <PlayFabLogin>();
 }
Esempio n. 13
0
 private void Start()
 {
     PFL = PlayFabLogin.instance;
     UsernameText.text = PlayerPrefs.GetString("Username");
 }
Esempio n. 14
0
 public static IEnumerator ExitLoad(MonoBehaviour parent, int Game)
 {
     yield return(parent.StartCoroutine(LeaveFromRoom(Game, GlobalDefines.RecRoom, PlayFabLogin.ReturnMobileID())));
 }
Esempio n. 15
0
 public void OnApplicationQuit()
 {
     StartCoroutine(Disconnect(this, PlayFabLogin.ReturnMobileID(), GlobalDefines.RecGame, 0));
 }
Esempio n. 16
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)));
    }
Esempio n. 17
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");
    }