示例#1
0
        public override void Start()
        {
            base.Start();
            LockPauseModule.PauseGame(PauseLockType.AllowMenu, this);

            CalculateValues();
            PaintAll();
        }
示例#2
0
        public override void Start()
        {
            base.Start();

            LockPauseModule.LockControls(InputLockType.GameOnly, this);
            LockPauseModule.PauseGame(PauseLockType.All, this);

            ClearState();
            PaintAll();
        }
示例#3
0
        public static void InitiateDialogue(string dialogue, bool pause, DialogueFinishedDelegate callback)
        {
            DialogueController.CurrentDialogue = dialogue;
            DialogueController.CurrentCallback = callback;
            var prefab = CoreUtils.LoadResource <GameObject>("UI/DialogueSystem");
            var go     = GameObject.Instantiate <GameObject>(prefab, CoreUtils.GetWorldRoot());

            if (pause)
            {
                LockPauseModule.PauseGame(PauseLockType.All, go);
            }
        }
示例#4
0
    public static void TestWeakReferencePauseLock()
    {
        AsyncUtils.RunWithExceptionHandling(async() =>
        {
            object lockObject = new object();
            WeakReference untypedWeakReference = new WeakReference(lockObject);
            LockPauseModule.PauseGame(PauseLockType.AllowMenu, untypedWeakReference);
            Debug.Log("Untyped lock added!");

            await Task.Delay(3000);
            AsyncUtils.ThrowIfEditorStopped();

            lockObject = null;
            CoreUtils.CollectGarbage(false);

            Debug.Log("Untyped lock released!");

            await Task.Yield();
            AsyncUtils.ThrowIfEditorStopped();

            LockPauseModule.ForceCleanLocks();

            Debug.Log("Locks cleaned!");

            await Task.Delay(5000);
            AsyncUtils.ThrowIfEditorStopped();

            IEnumerable typedLockObject = new string[] { "lol", "hi" };
            WeakReference <IEnumerable> typedWeakReference = new WeakReference <IEnumerable>(typedLockObject);

            LockPauseModule.PauseGame(PauseLockType.AllowMenu, typedWeakReference);
            Debug.Log("Typed lock added!");

            await Task.Delay(3000);
            AsyncUtils.ThrowIfEditorStopped();

            typedLockObject = null;
            CoreUtils.CollectGarbage(false);

            Debug.Log("Typed lock released!");

            await Task.Yield();
            AsyncUtils.ThrowIfEditorStopped();

            LockPauseModule.ForceCleanLocks();

            Debug.Log("Locks cleaned!");
        });
    }
示例#5
0
 private void DoPause()
 {
     LockPauseModule.PauseGame(PauseLockType.AllowMenu, this);
     LockPauseModule.LockControls(InputLockType.GameOnly, this);
 }