private void Update() { if (Input.GetKeyDown(KeyCode.Escape)) { if (isRunning) { Time.timeScale = 0; menuUI.SetActive(true); isRunning = false; } else { BackToGame(); } } if (canClearGame && !isGameOver) { if (ufoManager.Count <= 0) { StartCoroutine(GameClear()); canClearGame = false; playingStatus = PlayingStatus.GameClear; } } }
public async Task AddPlaying([Remainder] string status) { var config = uow.BotConfig.GetOrCreate(); var toAdd = new PlayingStatus { Status = status }; config.RotatingStatusMessages.Add(toAdd); await uow.SaveChangesAsync(false); await ReplyConfirmLocalized("ropl_added").ConfigureAwait(false); }
private void Start() { _status = FindObjectOfType <PlayingStatus>(); _status.SetPlaying(true); this.UpdateAsObservable() .Where(_ => Input.GetKeyDown(KeyCode.P)) .Subscribe(_ => { GameManager.Instance.SceneTransition.Load("Intro", () => Time.timeScale = 1); }); }
public async Task AddPlaying(ActivityType t, string status) { using (var uow = _db.UnitOfWork) { var config = uow.BotConfig.GetOrCreate(set => set.Include(x => x.RotatingStatusMessages)); var toAdd = new PlayingStatus { Status = status, Type = t }; config.RotatingStatusMessages.Add(toAdd); _bcp.BotConfig.RotatingStatusMessages = config.RotatingStatusMessages; await uow.CompleteAsync().ConfigureAwait(false); } }
public async Task AddPlaying(ActivityType t, string status) { using (var uow = _db.GetDbContext()) { var config = uow.BotConfig.GetOrCreate(set => set.Include(x => x.RotatingStatusMessages)); var toAdd = new PlayingStatus { Status = status, Type = t }; config.RotatingStatusMessages.Add(toAdd); _bcp.BotConfig.RotatingStatusMessages = config.RotatingStatusMessages; await uow.SaveChangesAsync(); } }
public async Task AddPlaying([Remainder] string status) { using (var uow = _db.UnitOfWork) { var config = uow.BotConfig.GetOrCreate(); var toAdd = new PlayingStatus { Status = status }; config.RotatingStatusMessages.Add(toAdd); await uow.CompleteAsync(); } await ReplyConfirmLocalized("ropl_added").ConfigureAwait(false); }
public async Task AddPlaying([Remainder] string status) { using (var uow = DbHandler.UnitOfWork()) { var config = uow.BotConfig.GetOrCreate(); var toAdd = new PlayingStatus { Status = status }; config.RotatingStatusMessages.Add(toAdd); RotatingStatusMessages.Add(toAdd); await uow.CompleteAsync(); } await Context.Channel.SendConfirmAsync("✅ **Added.**").ConfigureAwait(false); }
public async Task AddPlaying(ActivityType t, [Remainder] string status) { using (var uow = _db.UnitOfWork) { var config = uow.BotConfig.GetOrCreate(set => set.Include(x => x.RotatingStatusMessages)); var toAdd = new PlayingStatus { Status = status, Type = t }; config.RotatingStatusMessages.Add(toAdd); await uow.CompleteAsync(); } _bcp.Reload(); await ReplyConfirmLocalized("ropl_added").ConfigureAwait(false); }
private void Start() { _status = FindObjectOfType <PlayingStatus>(); player = GameObject.FindWithTag("Player"); Debug.Assert(player != null); player.GetComponent <PlayerHealth>() .GetHP() .Where(hp => hp <= 0) .Subscribe(_ => GameOver()); _checkPoint = FindObjectOfType <CheckPointManager>(); GameStart(); }
public async Task AddPlaying(IUserMessage umsg, [Remainder] string status) { var channel = (ITextChannel)umsg.Channel; using (var uow = DbHandler.UnitOfWork()) { var config = uow.BotConfig.GetOrCreate(); var toAdd = new PlayingStatus { Status = status }; config.RotatingStatusMessages.Add(toAdd); RotatingStatusMessages.Add(toAdd); await uow.CompleteAsync(); } await channel.SendMessageAsync("`Added.`").ConfigureAwait(false); }
public void OnStatus(PlayingStatus ps, Composition comp, int position) { if (ps == PlayingStatus.BeginPlaying) { _sunccontext.Post(_ => textboxPlaying.Text = comp.Title + " " + comp.Performer + " " + comp.Length, null); _sunccontext.Post(_ => slider1.Value = position, null); } else if (ps == PlayingStatus.PlayingProgress) { _sunccontext.Post(_ => textboxPlaying.Text = comp.Title + " " + comp.Performer + " " + comp.Length, null); _sunccontext.Post(_ => slider1.Value = position, null); } else if (ps == PlayingStatus.EndPlaying) { _sunccontext.Post(_ => textboxPlaying.Text = comp.Title + " " + comp.Performer + " " + comp.Length, null); _sunccontext.Post(_ => slider1.Value = position, null); } }
public void ChildHasFixtures() { using (var db = new SchoolDataContext()) { Fixture fixture = new Fixture(); fixture.Kickoff = DateTime.Now; db.Fixtures.Add(fixture); Child child = new Child(); db.Children.Add(child); PlayingStatus playingStatus = PlayingStatus.Create(fixture, child); db.PlayingStatuses.Add(playingStatus); db.SaveChanges(); Assert.That(child.PlayingStatuses.Contains <PlayingStatus>(playingStatus)); } }
private void Start() { _status = FindObjectOfType <PlayingStatus>(); _pauseManager = FindObjectOfType <PauseManager>(); sight.enabled = false; this.UpdateAsObservable() .Where(_ => !_pauseManager.isPause) .Where(_ => _status.IsPlaying().Value) .Where(_ => Input.GetMouseButton(0)) .ThrottleFirst(TimeSpan.FromSeconds(weapon.Interval)) .Subscribe(_ => { Fire(); }) .AddTo(gameObject); currentIndex .Subscribe(index => { weapon = weapons[index]; }); this.UpdateAsObservable() .Where(_ => _status.IsPlaying().Value) .Where(_ => Input.GetKeyDown(KeyCode.E)) .Subscribe(_ => { if (currentIndex.Value + 1 <= weapons.Count) { currentIndex.Value++; } else { currentIndex.Value = 0; } }); }
/// <summary> /// Stops the current animation /// </summary> private void Stop() { // If the playing state is paused, we need to send the stop signal // to the server to clear out anything that is being displayed. if (this.PlayingStatus == PlayingStatus.Paused) { this.currentFrameIndex = -1; this.FrameShowing = this.SelectedAnimation.Frames[0]; try { this.animatorClient.StopAnimation(true); } catch (InvalidOperationException ioe) { MessageBox.Show(GenerateMessageFromException(ioe), "Tower Lights Controller", MessageBoxButton.OK, MessageBoxImage.Error); } } // Change the state to stopped. This will also cause the // playing thread to stop playing and subsequently send // the stop signal to the server. this.PlayingStatus = PlayingStatus.Stopped; }
/// <summary> /// Plays or pauses the selected animation. This function handles the /// PlayPause command. /// </summary> private void PlayPause() { if (this.PlayingStatus == PlayingStatus.Playing) { // Set the playing status flag to paused. The thread playing the animation will // detect the change and then stop playing the animation. this.PlayingStatus = PlayingStatus.Paused; } else if (this.PlayingStatus == PlayingStatus.Stopped || this.PlayingStatus == PlayingStatus.Paused) { if (this.SelectedAnimation == null) { this.PlayingStatus = PlayingStatus.Stopped; } else { // start playing this.PlayingStatus = PlayingStatus.Playing; Thread playThread = new Thread(new ThreadStart(this.Play)); playThread.Name = "Tower Lights Controller Animation Thread"; playThread.Start(); } } }
private void Play() { status = PlayingStatus.Play; BeginStoryboard(storyboard, HandoffBehavior.SnapshotAndReplace, true); }
private void Pause() { status = PlayingStatus.Pause; storyboard.Pause(this); }
void Awake() { st = this ; //Rect r =new Rect(); _stepMoveDistince = 0.166667f/16.0f ; _minDistince = _stepMoveDistince * 2; Vector3 _down = transform.TransformDirection( Vector3.down ) ; Vector3 _up = transform.TransformDirection( Vector3.up ) ; Vector3 _left = transform.TransformDirection( Vector3.left ) ; Vector3 _right = transform.TransformDirection( Vector3.right ) ; //Vector3 _down = transform.TransformDirection( Vector3.down ) ; //Vector3 _up = transform.TransformDirection( Vector3.up ) ; _up_down = new Vector3[2]; _up_down [0] = _up; _up_down [1] = _up; Vector3Direction vdown = new Vector3Direction(_down, 0.166667f + _minDistince ); Vector3Direction vup = new Vector3Direction(_up, 0.166667f + _minDistince ); Vector3Direction vleft = new Vector3Direction( _left , _minDistince ); Vector3Direction vright = new Vector3Direction( _right , _minDistince ); _listDirection.Add(vdown) ; _listDirection.Add(vright) ; //_listDirection.Add(_up) ; _listDirection.Add(vleft) ; _isGameOver = false ; _isEditing = false ; _status = PlayingStatus.Normal ; _gridWidth =( Screen.width /1024.0f) * _gridWidth; _layerFlashMask = 1 << LayerMask.NameToLayer("flash") ; _layerFlash = LayerMask.NameToLayer("flash") ; _layerNormal = LayerMask.NameToLayer("normal") ; float _width = _gridWidth ; // x 21 y 100 _Maps = new IGMaps[16,108]; for(int i = 0 ;i <16 ; i++ ) { //_Maps[i] = new ObjectsMap[100] ; for(int j = 0 ; j < 108 ; j++ ) { _Maps[i,j] = new IGMaps() ; _Maps[i,j].x = i ; _Maps[i,j].y = j ; //_gameMaps[i][j].ObjectPoint = new Vector2( _width * i + _width/2 ,_width*j + _width/2 ) ; _Maps[i,j].position = Camera.main.ScreenToWorldPoint ( new Vector3( _width * i + _width/2 , _screenHeigh - (_width*j+_width/2) ,2.0f ) ) ; Vector3 v3= Camera.main.ScreenToWorldPoint ( new Vector3( _width * i , _screenHeigh - ( _width*j ) ,2.0f ) ) ; _Maps[i,j].rect = new Rect(v3.x,v3.y,0.1666667f,0.1666667f); //Camera.main.WorldToScreenPoint //_gameMaps[i][j]. // _gameMaps[i][j].ObjectPosition = Camera.main.ScreenToWorldPoint ( new Vector3( _width * i + _width/2 , 768 - (_width*j+_width/2) ,2.0f ) ) ; } } /* for(int j = 0 ; j < 100 ; j++ ) { Vector3 v3 = Camera.main.ScreenToWorldPoint ( new Vector3( 0 , 0 - (_width*j+_width/2) ,2.0f ) ) ; Rect r =new Rect(0,0,0.166667f,0.166667f); Ylist.Add( j ,v3.y ); print( v3.y ) ; } */ // x=-1.166667,y=-0.8333333 // 64x=-1.166667,64y=0.1666667,0x=-1.333333,0y=0,1024x=1.333333,768y=2 Vector3 v64 = Camera.main.ScreenToWorldPoint ( new Vector3( 64.0f , 64.0f ,2.0f ) ) ; Vector3 v0 = Camera.main.ScreenToWorldPoint ( new Vector3( 0f , 0f ,2.0f ) ) ; Vector3 v1024 = Camera.main.ScreenToWorldPoint ( new Vector3( 1024f , 768f ,2.0f ) ) ; print( string.Format( "64x={0},64y={1},0x={2},0y={3},1024x={4},768y={5}",v64.x ,v64.y ,v0.x , v0.y ,v1024.x ,v1024.y ) ) ; StartCoroutine(FlashingOffset()); // GameObject _object = (GameObject)Instantiate(_Prefab); // _object.transform.position = _gameMaps[3][8].ObjectPosion ; }
private void Resume() { status = PlayingStatus.Play; storyboard.Resume(this); }
/// <summary> /// Plays the selected animation. Designed to run in a different thread. It /// will start playing at currentFrameIndex, or it will start at the beginning of /// the animation. /// </summary> private void Play() { // Get the index of the selected animation int animationIndex = this.Animations.IndexOf(this.SelectedAnimation); // The list of frames that we are playing List <KeyFrame> frames = this.SelectedAnimation.Frames; // The time that has already passed before the current frame index TimeSpan delta = this.currentFrameIndex < 0 ? new TimeSpan() : frames[this.currentFrameIndex].StartTime; // Tell the server to start playing try { this.animatorClient.PlayAnimation(animationIndex, delta, this.SelectedAnimation.MusicFilename); } catch (InvalidOperationException e) { this.PlayingStatus = ViewModel.PlayingStatus.Stopped; MessageBox.Show(GenerateMessageFromException(e), "Tower Lights Controller", MessageBoxButton.OK, MessageBoxImage.Error); return; } // If there is no current frame, set the current frame to the first frame. if (this.currentFrameIndex < 0) { this.currentFrameIndex = 0; } Stopwatch frameStopwatch = new Stopwatch(); frameStopwatch.Start(); // Run this loop while there are frames left to play and the playing state hasn't // been changed to something besides playing. while (this.currentFrameIndex < frames.Count && this.PlayingStatus == PlayingStatus.Playing) { // Only go to the next frame if we are that frames start time. // Delta is the time into the animation that it starts at (0 for playing // from a stopped postion, > 0 for playing from a paused position). if (frameStopwatch.Elapsed >= frames[this.currentFrameIndex].StartTime - delta) { // Show the frame this.FrameShowing = frames[this.currentFrameIndex]; this.currentFrameIndex++; } else { // Sleep the thread for a while to stop the thread from burning up too many cycles here ... Thread.Sleep(1); } } // After the loop quits, check the playing state to see if any // further actions are needed. if (this.PlayingStatus == PlayingStatus.Playing) { // A normal stop, the animation is done playing so just stop. // No need to send stop signal, the server will stop automatically this.PlayingStatus = PlayingStatus.Stopped; this.FrameShowing = this.SelectedAnimation.Frames[0]; this.currentFrameIndex = -1; } else if (this.PlayingStatus == PlayingStatus.Paused) { // The loop quit because the state changed to paused, and // the playing needs to be paused. // Send pause signal to server, keep FrameShowing and currentFrameIndex as is try { this.animatorClient.StopAnimation(false); } catch (InvalidOperationException ioe) { MessageBox.Show(GenerateMessageFromException(ioe), "Tower Lights Controller", MessageBoxButton.OK, MessageBoxImage.Error); } } else if (this.PlayingStatus == PlayingStatus.Stopped) { // The loop quit because the state changed to stopped, and // the playing needs to be stopped. // Send stop signal to server, reset FrameShowing and currentFrameIndex try { this.animatorClient.StopAnimation(true); } catch (InvalidOperationException ioe) { MessageBox.Show(GenerateMessageFromException(ioe), "Tower Lights Controller", MessageBoxButton.OK, MessageBoxImage.Error); } this.FrameShowing = this.SelectedAnimation.Frames[0]; this.currentFrameIndex = -1; } }
public PlayingStatusEventArgs(PlayingStatus status) { Status = status; }
private void Awake() { _status = FindObjectOfType <PlayingStatus>(); }
/// <summary> /// Support the event bStop click - stop media /// </summary> private void bStop_Click(object sender, RoutedEventArgs e) { status = PlayingStatus.Stop; bPlayPause.Content = "Play"; storyboard.Stop(this); }