Esempio n. 1
0
            public void Register()
            {
                _playFabEvents = PlayFabEvents.Init();

                _playFabEvents.OnLoginWithCustomIDRequestEvent += OnLoginWithCustomId;
                _playFabEvents.OnLoginResultEvent += OnLoginResult;
            }
Esempio n. 2
0
    public void StartSnapPhoto()
    {
        textmesh.text             = "Verifying...";
        cameraButton.interactable = false;

        LoadingCircle.Show();

        StartCoroutine(controller.SnapPhoto(async tex =>
        {
            try
            {
                audioSource.PlayOneShot(clipCamera);

                // encode the image from the camera as a PNG to send to the Computer Vision API
                byte[] pngBuff  = tex.EncodeToPNG();
                MemoryStream ms = new MemoryStream(pngBuff);

                // call the vision service and get the image analysis
                VisionServiceClient client = new VisionServiceClient(Globals.VisionKey, Globals.VisionEndpoint);
                AnalysisResult result      = await client.DescribeAsync(ms);

                // send the tag list to the debug log
                string tags = result.Description.Tags.Aggregate((x, y) => $"{x}, {y}");
                Debug.Log(tags);

                foreach (string itemTag in Globals.CurrentItem.Tags)
                {
                    if (result.Description.Tags.Contains(itemTag.ToLower()))
                    {
                        audioSource.PlayOneShot(clipFound);
                        textmesh.text = "You found it!";

                        PlayFabEvents.WriteEvent(PlayFabEventType.ItemFound);

                        // if the image matches, call the ItemFound function to record it
                        string s = JsonConvert.SerializeObject(Globals.CurrentItem);
                        await Globals.HttpClient.PostAsync("ItemFound", new StringContent(s, Encoding.UTF8, "application/json"));
                        LoadingCircle.Dismiss();
                        SceneManager.LoadScene("ItemList");
                        return;
                    }
                }

                audioSource.PlayOneShot(clipNotFound);
                textmesh.text = "Not a match, please try again.";

                PlayFabEvents.WriteEvent(PlayFabEventType.ItemNotFound);

                controller.StartStream();
                cameraButton.interactable = true;
                LoadingCircle.Dismiss();
            }
            catch (Exception e)
            {
                LoadingCircle.Dismiss();
                Debug.Log(e);
                DialogBox.Show(e.Message);
            }
        }));
    }
Esempio n. 3
0
        static PF()
        {
            PlayFabSettings.TitleId = RuntimeAppConfig.Instance.GetTitleId();
            CatalogVersion          = RuntimeAppConfig.Instance.GetCatalogVersion();
            CloudScriptRevision     = RuntimeAppConfig.Instance.GetCloudScriptRevision();

            PlayfabEvents = PlayFabEvents.Init();
            PlayfabEvents.OnGetTimeResultEvent += PlayfabEvents_OnGetTimeResultEvent;
            PlayfabEvents.OnGlobalErrorEvent   += PlayfabEvents_OnGlobalErrorEvent;

            // Creating all the helpers
            PushNotifications = new PushNotificationsHelper();
            CloudScript       = new CloudScriptHelper();
            Purchasing        = new PurchasingHelper();
            Inventory         = new InventoryHelper();
            Character         = new CharacterHelper();
            TitleData         = new TitleDataHelper();
            VC      = new VirtualCurrencyHelper();
            Catalog = new CatalogHelper();
            Login   = new LoginHelper();
            User    = new UserHelper();
        }
Esempio n. 4
0
 static PF()
 {
     PlayfabEvents = PlayFabEvents.Init();
     PlayfabEvents.OnLoginResultEvent += PlayfabEvents_OnLoginResultEvent;
     PlayFabSettings.TitleId           = AppSettings.ActiveConfig.PlayfabTitleId;
 }