コード例 #1
0
ファイル: MainMenuBtnQuit.cs プロジェクト: PWLPavan/Pavan
    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
    }
コード例 #2
0
ファイル: Genie.cs プロジェクト: PWLPavan/Pavan
        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
        }
コード例 #3
0
ファイル: CrashScreen.cs プロジェクト: PWLPavan/Pavan
    private void OnApplicationPause(bool pause)
    {
        if (m_AutoDieDelay > 0)
        {
            Application.Quit();
#if UNITY_ANDROID
            AndroidHelper.KillActivity();
#endif
        }
    }
コード例 #4
0
ファイル: Genie.cs プロジェクト: PWLPavan/Pavan
        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
        }
コード例 #5
0
ファイル: Genie.cs プロジェクト: PWLPavan/Pavan
 private void OnApplicationPause(bool paused)
 {
     if (paused && m_Killed)
     {
         AndroidHelper.KillActivity();
         return;
     }
     if (!paused && Exists && IsInitialized)
     {
         CheckProfileChanged();
     }
 }
コード例 #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
    }
コード例 #7
0
ファイル: Genie.User.cs プロジェクト: PWLPavan/Pavan
 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();
     }
 }
コード例 #8
0
ファイル: CrashScreen.cs プロジェクト: PWLPavan/Pavan
    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
            }
        }
    }