コード例 #1
0
        public void Pause()
        {
            switch (CurrentState.CurrentPhase)
            {
            case TimerPhase.Running:
                var realTime = CurrentState.CurrentTime.RealTime;
                if (realTime == null)
                {
                    break;
                }
                CurrentState.TimePausedAt = realTime.Value;
                CurrentState.CurrentPhase = TimerPhase.Paused;
                OnPause?.Invoke(this, null);
                break;

            case TimerPhase.Paused:
                CurrentState.AdjustedStartTime = TimeStamp.Now - CurrentState.TimePausedAt;
                CurrentState.CurrentPhase      = TimerPhase.Running;
                OnResume?.Invoke(this, null);
                break;

            case TimerPhase.NotRunning:
                Start();
                break;

            case TimerPhase.Ended:
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
コード例 #2
0
ファイル: PauseGameUI.cs プロジェクト: StarGaryen/SlowMo
 public void Pause(OnResume _onResume)
 {
     onResume = _onResume;
     //Enable Cursor
     Cursor.visible   = true;
     Cursor.lockState = CursorLockMode.Confined;
     gameObject.SetActive(true);
 }
コード例 #3
0
 /// <summary>
 /// 恢复执行
 /// </summary>
 public void Resume()
 {
     switchTimer();
     if (OnResume != null)
     {
         OnResume.BeginInvoke(this, null, null, null);
     }
 }
コード例 #4
0
ファイル: MediaRecorder.cs プロジェクト: melihercan/WebRTCme
 private MediaRecorder(IJSRuntime jsRuntime, JsObjectRef jsObjectRef, IMediaStream stream,
                       MediaRecorderOptions options) : base(jsRuntime, jsObjectRef)
 {
     AddNativeEventListenerForObjectRef("dataavailable", (s, e) => OnDataAvailable?.Invoke(s, e),
                                        BlobEvent.Create);
     AddNativeEventListenerForObjectRef("error", (s, e) => OnError?.Invoke(s, e),
                                        DOMException.Create);
     AddNativeEventListener("pause", (s, e) => OnPause?.Invoke(s, e));
     AddNativeEventListener("resume", (s, e) => OnResume?.Invoke(s, e));
     AddNativeEventListener("start", (s, e) => OnStart?.Invoke(s, e));
     AddNativeEventListener("stop", (s, e) => OnStop?.Invoke(s, e));
 }
コード例 #5
0
ファイル: GameManager.cs プロジェクト: dozzzl/Zombie
 public void GameResume()
 {
     Paused = false;
     foreach (var component in components.ToArray())
     {
         component.GameResume();
     }
     if (OnResume != null)
     {
         OnResume.Invoke();
     }
 }
コード例 #6
0
ファイル: Saferize.cs プロジェクト: renatost/unity-sdk
        private void HandleApprovalStateChangedEvent(ApprovalStateChangedEvent evt)
        {
            switch (evt.Entity.CurrentState)
            {
            case Approval.StateEnum.ACTIVE:
                OnResume?.Invoke();
                break;

            case Approval.StateEnum.PAUSED:
                OnPause?.Invoke();
                break;
            }
        }
コード例 #7
0
ファイル: Saferize.cs プロジェクト: renatost/unity-sdk
        private void HandleApprovalStatusChangedEvent(ApprovalStatusChangedEvent evt)
        {
            switch (evt.Entity.Status)
            {
            case Approval.StatusEnum.APPROVED:
                OnResume?.Invoke();
                break;

            case Approval.StatusEnum.REJECTED:
                OnRevoke?.Invoke();
                socket.CloseConnection();
                break;
            }
        }
コード例 #8
0
 public void Bind(string luaName)
 {
     LuaOnInit              = GameMode.XLua.GetInPath <OnInit>($"{luaName}.OnInit");
     LuaOnFree              = GameMode.XLua.GetInPath <OnFree>($"{luaName}.OnFree");
     LuaOnUpdate            = GameMode.XLua.GetInPath <OnUpdate>($"{luaName}.OnUpdate");
     LuaOnEnter             = GameMode.XLua.GetInPath <OnEnter>($"{luaName}.OnEnter");
     LuaOnExit              = GameMode.XLua.GetInPath <OnExit>($"{luaName}.OnExit");
     LuaPause               = GameMode.XLua.GetInPath <OnPause>($"{luaName}.OnPause");
     LuaOnResume            = GameMode.XLua.GetInPath <OnResume>($"{luaName}.OnResume");
     LuaOnAnimationStart    = GameMode.XLua.GetInPath <OnAnimationStart>($"{luaName}.OnAnimationStart");
     LuaOnAnimationComplete = GameMode.XLua.GetInPath <OnAnimationComplete>($"{luaName}.OnAnimationComplete");
     LuaOnEventTrigger      = GameMode.XLua.GetInPath <OnEventTrigger>($"{luaName}.OnEventTrigger");
     LuaOnColliderTrigger   = GameMode.XLua.GetInPath <OnColliderTrigger>($"{luaName}.OnColliderTrigger");
 }
コード例 #9
0
 public void Clear()
 {
     LuaOnInit              = null;
     LuaOnFree              = null;
     LuaOnUpdate            = null;
     LuaOnEnter             = null;
     LuaOnExit              = null;
     LuaPause               = null;
     LuaOnResume            = null;
     LuaOnAnimationStart    = null;
     LuaOnAnimationComplete = null;
     LuaOnEventTrigger      = null;
     LuaOnColliderTrigger   = null;
 }
コード例 #10
0
 public void RegisterTimerModel(ITimerModel model)
 {
     model.OnSplit      += (s, e) => OnSplit?.Invoke(this, e);
     model.OnSkipSplit  += (s, e) => OnSkipSplit?.Invoke(this, e);
     model.OnUndoSplit  += (s, e) => OnUndoSplit?.Invoke(this, e);
     model.OnStart      += (s, e) => OnStart?.Invoke(this, e);
     model.OnReset      += (s, e) => OnReset?.Invoke(this, e);
     model.OnPause      += (s, e) => OnPause?.Invoke(this, e);
     model.OnResume     += (s, e) => OnResume?.Invoke(this, e);
     model.OnScrollUp   += (s, e) => OnScrollUp?.Invoke(this, e);
     model.OnScrollDown += (s, e) => OnScrollDown?.Invoke(this, e);
     model.OnSwitchComparisonPrevious += (s, e) => OnSwitchComparisonPrevious?.Invoke(this, e);
     model.OnSwitchComparisonNext     += (s, e) => OnSwitchComparisonNext?.Invoke(this, e);
 }
コード例 #11
0
    public void StartGame(string _m)
    {
        switch (_m)
        {
        case "Controller":
            if (!WSB_InputManager.I.ChangeControllers(ControlsMode.Controller, isBanController))
            {
                return;
            }
            break;

        case "Keyboard":
            if (!WSB_InputManager.I.ChangeControllers(ControlsMode.Keyboard, isBanController))
            {
                return;
            }
            break;

        case "Both":
            if (!WSB_InputManager.I.ChangeControllers(ControlsMode.ControllerKeyboard, isBanController))
            {
                return;
            }
            break;

        default:
            return;
        }

        // Get all the rigidbody in the scene and unfreeze them
        Rigidbody2D[] _physics = FindObjectsOfType <Rigidbody2D>();
        foreach (Rigidbody2D _r in _physics)
        {
            if (_r.GetComponent <WSB_Player>() || _r.GetComponent <WSB_Movable>() || _r.GetComponent <WSB_MovingPlateform>() || _r.transform.tag == "Earth")
            {
                continue;
            }
            _r.isKinematic = false;
        }

        // Set Pause to false
        Paused = false;



        OnResume?.Invoke();

        //// Hide menu
        //menu.SetActive(false);
    }
コード例 #12
0
        public void InvokeResume()
        {
            if (!IsPaused)
            {
                return;
            }
            if (MusicController.IsPaused)
            {
                MusicController.Play();
            }

            IsPaused = false;
            OnResume?.Invoke();
        }
コード例 #13
0
    /// <summary>
    /// Toggle whether the game is paused
    /// </summary>
    public void TogglePause()
    {
        Paused = !paused;

        if (Paused)
        {
            Cursor.visible = true;
            OnPause?.Invoke();
        }
        else
        {
            Cursor.visible = false;
            OnResume?.Invoke();
        }
    }
コード例 #14
0
 public void Resume()
 {
     if (GameStateManager.instance != false)
     {
         AudioManager.instance.PlayAtRandomPitch("ClickSFX");
         pauseScreen.SetActive(false);
         GameStateManager.instance.ResumeGame();
         if (SettingsMenu.instance.IsVisible())
         {
             SettingsMenu.instance.ToggleSettings(false, false);
         }
         OnResume?.Invoke();
         InitStateManager.currGameMode = GameModes.Powercut;
     }
 }
コード例 #15
0
ファイル: PauseGameUI.cs プロジェクト: StarGaryen/SlowMo
 void Awake()
 {
     Debug.Log("Setting PauseGameUI singleton");
     //Setup singleton
     if (singleton == null)
     {
         singleton = this;
     }
     else
     {
         Destroy(gameObject);
         return;
     }
     onResume = null;
 }
コード例 #16
0
    public UIManager(UIComponents _components)
    {
        components = _components;

        components.pauseButton.onClick.AddListener(() =>
        {
            OnPause?.Invoke();
            components.panel.SetActive(true);
        });

        components.resumeButton.onClick.AddListener(() =>
        {
            OnResume?.Invoke();
            components.panel.SetActive(false);
        });
    }
コード例 #17
0
 public void Pause()
 {
     if (CurrentState.CurrentPhase == TimerPhase.Running)
     {
         CurrentState.TimePausedAt = CurrentState.CurrentTime.RealTime.Value;
         CurrentState.CurrentPhase = TimerPhase.Paused;
         OnPause?.Invoke(this, null);
     }
     else if (CurrentState.CurrentPhase == TimerPhase.Paused)
     {
         CurrentState.AdjustedStartTime = TimeStamp.Now - CurrentState.TimePausedAt;
         CurrentState.CurrentPhase      = TimerPhase.Running;
         OnResume?.Invoke(this, null);
     }
     else if (CurrentState.CurrentPhase == TimerPhase.NotRunning)
     {
         Start();  //f**k abahbob
     }
 }
コード例 #18
0
    private void Update()
    {
        timeSinceOpen += Time.deltaTime;

        if (InputManager.GetInput("Pause") > 0f && !isShifting && canPause)
        {
            if (IsPaused)
            {
                OnResume?.Invoke();
            }
            else
            {
                OnPause?.Invoke();
            }

            isShifting = true;
            shiftingUp = IsPaused;
        }

        if (isShifting)
        {
            float scl = Time.timeScale;
            scl += Time.unscaledDeltaTime / (shiftingUp ? SHIFT_DURATION : -SHIFT_DURATION);
            if (scl <= 0f || scl >= intendedTimeSpeed)
            {
                Time.timeScale = Mathf.Clamp(scl, 0f, intendedTimeSpeed);
                isPaused       = !isPaused;
                isShifting     = false;
            }
            else
            {
                Time.timeScale = scl;
            }
        }

        Time.fixedDeltaTime = IsStopped ? 1f : 0.01666666f / Time.timeScale;
    }
コード例 #19
0
 public void PressResume()
 {
     OnResume?.Invoke();
 }
コード例 #20
0
 public void Resume()
 {
     // Set Pause state to false, invoke resume event, hide pause menu
     Paused = false;
     OnResume?.Invoke();
 }
コード例 #21
0
 private void OnOnResume()
 {
     OnResume?.Invoke(this, EventArgs.Empty);
 }
コード例 #22
0
 public void BroadcastResume()
 {
     OnResume?.Invoke();
 }
コード例 #23
0
 public void Resume()
 {
     OnResume.Invoke();
 }
コード例 #24
0
 public void Resume()
 {
     GameIsPause = false;
     OnResume.Invoke();
 }
コード例 #25
0
ファイル: Dialog.cs プロジェクト: KLD/Hoofa
 /// <summary>
 /// Invoked when dialog resumes after pausing.
 /// </summary>
 public virtual void WhenDialogResume()
 {
     OnResume?.Invoke();
 }
コード例 #26
0
ファイル: Menu.cs プロジェクト: theishiopian/ProjectPsi
 public void Resume(string input)
 {
     OnResume?.Invoke();
     Pause.paused = false;
     SceneManager.LoadScene("Level1");
 }
コード例 #27
0
 public void OnBaseResume(object sender, EventArgs e)
 {
     OnResume?.Invoke(sender, e);
 }
コード例 #28
0
 private void InvokeResumeActions()
 {
     OnResume?.Invoke();
     SetCurrentStateMachineType(previousStateMachineType);
 }
コード例 #29
0
ファイル: Event.cs プロジェクト: SeanTongTx/BaseTimeLine
 public Event()
 {
     OnResume.AddEventListener(DefaultResume);
     OnAwait.AddEventListener(DefaultAwait);
 }
コード例 #30
0
 public static void ResumeGame()
 {
     OnResume?.Invoke();
 }