Ejemplo n.º 1
0
    private IEnumerator ShutdownSequence()
    {
        // To make sure we're separating ourselves from the previous interact event.
        yield return(0.1f);

        Genie.I.LogEnd();

        // To make sure we've had time to at least send the event out.
        yield return(0.2f);

        Genie.I.SyncEvents();

        float waitTimeRemaining = 10f;

        while (Genie.I.IsSyncing && waitTimeRemaining > 0)
        {
            yield return(null);

            waitTimeRemaining -= Time.deltaTime;
        }

        Genie.I.AttemptOpenGenie();
        Genie.I.ForceShutdown();

#if UNITY_EDITOR
        UnityEditor.EditorApplication.isPlaying = false;
#endif
        Application.Quit();

#if UNITY_ANDROID
        AndroidHelper.KillActivity();
#endif
    }
Ejemplo n.º 2
0
        private void OnGenieNotLaunch()
        {
#if UNITY_ANDROID
            var dialog = new AndroidDialog.AlertDialogBuilder();
            dialog.SetMessage("Please launch the game from Genie.");
            dialog.SetPositiveButton("Okay", (int a) => { AndroidHelper.KillActivity(); });
            dialog.ShowAndDispose();
#endif
        }
Ejemplo n.º 3
0
    private void OnApplicationPause(bool pause)
    {
        if (m_AutoDieDelay > 0)
        {
            Application.Quit();
#if UNITY_ANDROID
            AndroidHelper.KillActivity();
#endif
        }
    }
Ejemplo n.º 4
0
        private void OnGenieNotInstalled()
        {
#if UNITY_ANDROID
            var dialog = new AndroidDialog.AlertDialogBuilder();
            dialog.SetMessage("Genie Services is not installed.\nPlease make sure it is installed before launching this game.");
            dialog.SetPositiveButton("Okay.", (int a) => { AndroidHelper.KillActivity(); });
            dialog.SetTitle("Unable to start.");
            dialog.ShowAndDispose();
#else
            CrashScreen.Create("Genie Services is not installed.\n\nPlease make sure Genie Services is installed on your device\nbefore launching this game.", true);
#endif
        }
Ejemplo n.º 5
0
 private void OnApplicationPause(bool paused)
 {
     if (paused && m_Killed)
     {
         AndroidHelper.KillActivity();
         return;
     }
     if (!paused && Exists && IsInitialized)
     {
         CheckProfileChanged();
     }
 }
Ejemplo n.º 6
0
    static public bool CheckInstalled()
    {
#if UNITY_ANDROID
        if (AndroidHelper.IsInstalled("org.enlearn.enlearnService"))
        {
            return(true);
        }

        var dialog = new AndroidDialog.AlertDialogBuilder();
        dialog.SetMessage("Enlearn Service is not installed.\nPlease make sure it is installed before launching this game.");
        dialog.SetPositiveButton("Okay.", (int a) => { AndroidHelper.KillActivity(); });
        dialog.SetTitle("Unable to start.");
        dialog.ShowAndDispose();

        return(false);
#else
        return(true);
#endif
    }
Ejemplo n.º 7
0
 public override void Process(GenieResponseWrapper inWrapper)
 {
     if (inWrapper.getStatus() == "successful")
     {
         string uid = inWrapper.getStringResult("uid");
         if (uid != Genie.I.UserID)
         {
             Logger.Log("User changed partway through - restarting the application.");
             Genie.I.LogEnd();
             Genie.instance.GetUserResult(true, inWrapper);
             AndroidHelper.RestartActivity();
         }
     }
     else
     {
         AndroidToast.Show("Please sign back into Genie.");
         AndroidHelper.KillActivity();
     }
 }
Ejemplo n.º 8
0
    private void Update()
    {
        if (!m_MouseDown)
        {
            m_ScrollOffset *= 0.25f;

            if (UnityEngine.Input.GetMouseButton(0))
            {
                m_MouseDown    = true;
                m_MouseY       = Input.mousePosition.y;
                m_Dragging     = false;
                m_ScrollOffset = 0.0f;
            }
        }
        else
        {
            if (!Input.GetMouseButton(0))
            {
                if (m_Dragging)
                {
                    m_Dragging = false;
                }
                else
                {
                    m_MessageIndex = (m_MessageIndex + 1) % s_Messages.Count;
                }

                m_MouseDown = false;
            }
            else
            {
                float mouseY     = Input.mousePosition.y;
                float mouseDelta = mouseY - m_MouseY;
                if (!m_Dragging && Math.Abs(mouseDelta) >= Screen.height * DRAG_PERCENTAGE_THRESHOLD)
                {
                    m_Dragging = true;
                }

                if (m_Dragging)
                {
                    m_ScrollOffset = -mouseDelta;
                }
            }
        }

        if (UnityEngine.Input.GetKeyUp(KeyCode.Escape))
        {
            Application.Quit();
#if UNITY_ANDROID
            AndroidHelper.KillActivity();
#endif
        }

        if (m_AutoDieDelay > 0)
        {
            m_AutoDieDelay -= Time.deltaTime;
            if (m_AutoDieDelay <= 0.0f)
            {
                Application.Quit();
#if UNITY_ANDROID
                AndroidHelper.KillActivity();
#endif
            }
        }
    }