Ejemplo n.º 1
0
    private void FinishPrint()
    {
        AnalyticsAgent.LogAnalyticEvent(AnalyticsAgent.AnalyticEvent.PrintFinished);
        AudioAgent.StopSoundEffect(AudioAgent.SoundEffectType.Print);
        AudioAgent.PlaySoundEffect(AudioAgent.SoundEffectType.PrintFinish);

        ChangeState(State.Finished);
    }
Ejemplo n.º 2
0
    private void OnShareAreaTouch()
    {
        wasSharing = true;

        AnalyticsAgent.LogAnalyticEvent(AnalyticsAgent.AnalyticEvent.Share);

        StartCoroutine("DoShare");
    }
Ejemplo n.º 3
0
        public async void CanRun()
        {
            await InitializeQueue();

            ILoggerFactory logger = new LoggerFactory();
            AnalyticsAgent agent  = new AnalyticsAgent(queue, client, logger, photoRepository, recognitionResultsRepository, configuration);

            agent.PollingTask();
            Thread.Sleep(1000);

            Assert.True(recognitionResultsRepository.GetRecognitionResultsByPhotoId(2) != null);
        }
Ejemplo n.º 4
0
    /*
     * void OnGUI()
     * {
     *      GUI.Label( new Rect( 10f, 10f, 1000f, 1000f ), "" + currentState );
     * }
     */

    private void OnRestartAreaTouch()
    {
        wasRestarting = true;

        if (currentState != State.Finished)
        {
            AudioAgent.StopSoundEffect(AudioAgent.SoundEffectType.Print);
            AnalyticsAgent.LogAnalyticEvent(AnalyticsAgent.AnalyticEvent.PrintFinished);
        }

//		ChangeState( State.Advertising );
        ChangeState(State.Ready);
    }
Ejemplo n.º 5
0
    private void internalCheckForPrompt()
    {
        if (hasSaidWouldRate)
        {
            return;
        }

        int numPrints = AnalyticsAgent.GetNumPrints();

        if (numPrints == 10 || numPrints == 25 || numPrints % 100 == 50)
        {
            SetPopUpEnabled(true);
        }
    }
Ejemplo n.º 6
0
    void Awake()
    {
        if (mInstance != null)
        {
            Debug.LogError("Only one instance of AnalyticsAgent allowed. Destroying " + gameObject + " and leaving " + mInstance.gameObject);
            Destroy(gameObject);
            return;
        }

        mInstance = this;

        if (PlayerPrefs.HasKey(lifetimePrintsString))
        {
            numPrints = PlayerPrefs.GetInt(lifetimePrintsString);
        }
    }
Ejemplo n.º 7
0
    private IEnumerator DoNavigation(float toX)
    {
        if (currentState == State.Printing)
        {
            ChangeState(State.Paused);
        }

        float fromX       = CameraAgent.MainCameraObject.transform.localPosition.x;
        float currentTime = 0f;
        float lerp;

        do
        {
            currentTime += Time.deltaTime;
            lerp         = Mathf.Clamp01(currentTime / navigationDuration);

            lerp = Mathf.Pow(lerp, 0.5f);

            //lerp = 3f * Mathf.Pow( lerp, 2f ) - 2f * Mathf.Pow( lerp, 3f );

            SetCameraX(Mathf.Lerp(fromX, toX, lerp));

            yield return(null);
        } while(currentTime < navigationDuration);

        SetCameraX(toX);

        UpdateNavigationHighlight(true);

        if (currentState == State.Ready && currentScreenX == 0f)
        {
            SetUIEnabled(false);
            TipAgent.SetTipEnabled(true);
            UpdateNavigationHighlight(true);
        }

        if (currentScreenX < 0f)
        {
            AnalyticsAgent.LogAnalyticEvent(AnalyticsAgent.AnalyticEvent.SettingsScreen);
        }

        if (currentScreenX > 0f)
        {
            AnalyticsAgent.LogAnalyticEvent(AnalyticsAgent.AnalyticEvent.StoreScreen);
        }
    }
Ejemplo n.º 8
0
        public IActionResult UploadPhotoAndStartSession([FromBody] PhotoRequest photoRequest,
                                                        [FromServices] UserManager <ApplicationUser> userManager,
                                                        [FromServices] SessionTracker sessionTracker,
                                                        [FromServices] IImageDecryptor imageDecryptor,
                                                        [FromServices] RecognitionTaskQueue taskQueue,
                                                        [FromServices] IConfiguration configuration,
                                                        [FromServices] AnalyticsAgent agent)
        {
            using (_logger.BeginScope(nameof(UploadPhotoAndStartSession)))
            {
                //validate request
                if (photoRequest == null)
                {
                    _logger.LogError("Attempt to start a session because of null mobile photo request.");
                    return(BadRequest(new { message = "Error: something in your request is empty" }));
                }

                try
                {
                    //try start new session
                    var session = sessionTracker.StartSession(Convert.ToInt32(userManager.GetUserId(HttpContext.User)), photoRequest.TimeStamp);

                    //decrypt image and send to db
                    _logger.LogInformation($"Trying decrypt image...");
                    var decrypredImage = imageDecryptor.Decrypt(Convert.FromBase64String(photoRequest.Image));
                    var image          = new Photo(session.SessionID, decrypredImage, photoRequest.TimeStamp);
                    _photoRepository.Add(image);
                    _logger.LogInformation($"Ecrypted image was decrypted and saved to db.");

                    //send to analytics task queue
                    _logger.LogInformation($"Trying send photoId to RecognitionTaskQueue");
                    string modelName = configuration.GetSection("ModelName").Value; // get model name for analytics
                    taskQueue.Enqueue(new RecognitionTask(modelName, image.PhotoID));
                    _logger.LogInformation("Photo was sent to RecognitionTaskQueue");

                    var sessionResponse = new SessionResponse(session.SessionID);
                    return(Ok(sessionResponse));
                }
                catch (Exception ex)
                {
                    _logger.LogError("Exception caught: {0}, {1}", ex.Message, ex.StackTrace);
                    return(StatusCode(409, new { message = ex.Message }));
                }
            }
        }
Ejemplo n.º 9
0
    private IEnumerator WaitForAdSuccess(int spriteIndexToUnlock)
    {
        hasWatchedAd = false;

        while (!hasWatchedAd)
        {
            yield return(null);
        }

        UnlockSprite(spriteIndexToUnlock);

        SetSpriteIndex(spriteIndexToUnlock);

        AnalyticsAgent.LogAnalyticEvent(AnalyticsAgent.AnalyticEvent.UnlockSprite);
//		PreferencesAgent.UpdateICloud();

        CheckAllSpritesUnlocked();
    }
Ejemplo n.º 10
0
    private void internalShowNextTip()
    {
        int randomIndex = NextRandomIndex();

        if (GameAgent.GetCurrentState() != GameAgent.State.Finished)
        {
            while (randomIndex == firstTipIndex || randomIndex == secondTipIndex)
            {
                randomIndex = NextRandomIndex();
            }
        }
        else
        {
            if (AnalyticsAgent.GetNumPrints() == 1)
            {
                randomIndex = secondTipIndex;
            }
        }

        SetTip(randomIndex);
    }
Ejemplo n.º 11
0
    private void OnMoreAreaTouch()
    {
        AnalyticsAgent.LogAnalyticEvent(AnalyticsAgent.AnalyticEvent.More);

        Application.OpenURL("http://mostnights.com/");
    }