Пример #1
0
        public override void getAndProcessHistoryData()
        {
            cumulus.LogDebugMessage("Lock: Station waiting for the lock");
            Cumulus.syncInit.Wait();
            cumulus.LogDebugMessage("Lock: Station has the lock");
            try
            {
                var stTime = cumulus.LastUpdateTime;
                if (FirstRun)
                {
                    stTime = DateTime.Now.AddDays(-cumulus.WeatherFlowOptions.WFDaysHist);
                }

                var recs = StationListener.GetRestPacket(StationListener.REST_URL,
                                                         cumulus.WeatherFlowOptions.WFToken, cumulus.WeatherFlowOptions.WFDeviceId,
                                                         stTime, DateTime.Now, cumulus);

                ProcessHistoryData(recs);
            }
            catch (Exception ex)
            {
                cumulus.LogMessage("Exception occurred reading archive data: " + ex.Message);
                Exception te = ex;
                while (te != null)
                {
                    cumulus.LogConsoleMessage($"Error getting history data: {te.Message}");
                    te = te.InnerException;
                }
            }
            cumulus.LogDebugMessage("Lock: Station releasing the lock");
            Cumulus.syncInit.Release();
            StartLoop();
        }
Пример #2
0
    // Awaits notification from stations they are ready to play and starts the game
    public void readyToPlay(StationListener station)
    {
        //stationsReady++;
        //if (stationsReady == StationListeners.Count) {

        //          StartGameStations();
        //          stationsReady = 0;
        //      }
    }
Пример #3
0
        public override void Start()
        {
            cumulus.CurrentActivity = "Normal running";
            StationListener.WeatherPacketReceived = WeatherPacketReceived;
            StationListener.Start(cumulus);
            DoDayResetIfNeeded();
            DoTrendValues(DateTime.Now);

            cumulus.StartTimersAndSensors();
        }
Пример #4
0
 private void StartGameStations()
 {
     Debug.Log("StartGameStations()");
     foreach (KeyValuePair <int, StationListener> kvp in StationListeners)
     {
         StationListener station = kvp.Value;
         // only play if we're in welcome state...
         Debug.Log("-- Starting station " + station.StationIndex);
         if (station.AutoPlay || (int)station.currentState == 1)
         {
             station.ChangeState(StationState.PLAYING);
         }
         station.Play();
     }
     StartCoroutine("WaitToPlay");
 }
Пример #5
0
        /// <summary>
        /// Creates a new station object with its left-top corner at
        /// the specified location.
        /// </summary>
        /// <param name="_type">
        /// Type of the station to be built.
        /// </param>
        public Station(StationContribution _type, WorldLocator wloc) : base(_type, wloc)
        {
            this.type  = _type;
            this._name = string.Format("ST{0,2:d}", iota++);
            if (wloc.world == World.world)
            {
                World.world.stations.add(this);
                World.world.clock.registerRepeated(new ClockHandler(clockHandlerHour), TimeLength.fromHours(1));
                World.world.clock.registerRepeated(new ClockHandler(clockHandlerDay), TimeLength.fromHours(24));
            }
            Distance r = new Distance(REACH_RANGE, REACH_RANGE, REACH_RANGE);

            // advertise listeners in the neighborhood that a new station is available
            foreach (Entity e in Cube.createInclusive(baseLocation - r, baseLocation + r).getEntities())
            {
                StationListener l = (StationListener)e.queryInterface(typeof(StationListener));
                if (l != null)
                {
                    l.advertiseStation(this);
                }
            }
        }
Пример #6
0
 public YCM()
 {
     listener = new StationListener();
     listener.Start();
 }
Пример #7
0
 public YCM()
 {
     listener           = new StationListener();
     listener.OnNewCar += car => OnNewCar?.Invoke(car);
     listener.Start();
 }
Пример #8
0
 public void remove(StationListener listener)
 {
     core.remove(listener);
 }
Пример #9
0
 public void add(StationListener listener)
 {
     core.add(listener);
 }
Пример #10
0
 public override void Stop()
 {
     StationListener.Stop();
 }
Пример #11
0
    void Update()
    {
        //HOW TO PLAY SOUND
        if (Input.GetKeyUp(KeyCode.S))
        {
            KinectBodiesReceiver.Instance.PlaySound("success", 4);
        }

        //ALSO SOUND :D
        if (Input.GetKeyUp(KeyCode.I))
        {
            KinectBodiesReceiver.Instance.PlayIdentification(4);
        }


        // Update each station with remaining song time, adjusted for gap skipping over drop beginning to middle of drop
        foreach (KeyValuePair <int, StationListener> ki in StationListeners)
        {
            //	ki.Value.UpdateTime(_AudioPlayer.SecondsLeft);
        }


        // Key press game jumping logic

        if (Input.anyKeyDown)           // for making individual stations ready - assigns stations user names

        {
            foreach (KeyValuePair <KeyCode, int> ki in KeyCodeStation)
            {
                if (Input.GetKeyDown(ki.Key) && StationListeners.ContainsKey(ki.Value))
                {
                    StationListener station = StationListeners[ki.Value];
                    station.ChangeState(StationState.WELCOME);

//					}
                }
            }

            // For playing, pausing and jumping to different  points in game progression
            if (Input.GetKeyDown(PlayKey) && (StationListeners.Count > 0))
            {
                Debug.Log("1 pressed");

                foreach (KeyValuePair <int, StationListener> kvp in StationListeners)
                {
                    StationListener station = kvp.Value;
                    if (station.AutoPlay)
                    {
                        station.ChangeState(StationState.PLAYING);
                    }
                }
            }
            else if (Input.GetKeyDown(PauseKey))
            {
                //	_AudioPlayer.Pause();
            }
            else if (Input.GetKeyDown(EndKey))
            {
                //_AudioPlayer.SkipToSampleTime(7329750);
            }
            else if (Input.GetKeyDown(DropKey) || Input.GetKey(DropKey2))
            {
                //_AudioPlayer.SkipToSampleTime(3240000);
            }
            else if (Input.GetKeyDown(ResetKey) || Input.GetKey(ResetKey2))
            {
                //_AudioPlayer.SkipToSampleTime(0);
            }
            else if (Input.GetKeyDown(VerseKey))
            {
                //	_AudioPlayer.SkipToSampleTime(1350000);
            }
            else if (Input.GetKeyDown(ResetKey) || Input.GetKey(ResetKey2))
            {
                //_AudioPlayer.SkipToSampleTime(0);
            }
            else if (Input.GetKeyDown(VerseKey))
            {
                //_AudioPlayer.SkipToSampleTime(1350000);
            }
            else if (Input.GetKeyDown(ResetKey) || Input.GetKey(ResetKey2))
            {
                //	_AudioPlayer.SkipToSampleTime(0);
            }
            else if (Input.GetKeyDown(KeyCode.LeftShift) && Input.GetKeyDown(KeyCode.S))
            {
                // TODO: start game stations
                Debug.Log("Starting game stations...");
                foreach (StationListener station in StationListeners.Values)
                {
                    //station.
                    Debug.Log("-- " + station.StationIndex);
                }
            }
        }
    }
Пример #12
0
    // starts the gesture icon sprite anim based on the int value from koreo

/*	private void GestureBeat(KoreographyEvent koreoEvent)
 *      {
 *     //if (koreoEvent.HasTextPayload()) print(koreoEvent.GetTextValue());
 *              // timing of key scene events
 *              if (koreoEvent.GetColorValue () == Color.black) {
 *                      for (int i = 0; i < 8; i++) {
 *                              if (StationListeners.ContainsKey (i))
 *                                      StationListeners [i].Drop ();
 *                              _AudioPlayer.SkipToSampleTime(3898255);
 *                      }
 *              } else if (koreoEvent.GetColorValue () == Color.red) {
 *                      for (int i = 0; i < 8; i++) {
 *                              if (StationListeners.ContainsKey (i))
 *                                      StationListeners [i].DropEnd ();
 *                      }
 *              } else if (koreoEvent.GetColorValue () == Color.green) {
 *                      for (int i = 0; i < 8; i++) {
 *                              if (StationListeners.ContainsKey (i))
 *                                      StationListeners [i].FinalScoreLeadUp ();
 *                      }
 *              }
 *
 *              // triggers gestures based on koreo notes
 *              switch( koreoEvent.GetTextValue() )
 *              {
 *
 *
 *              case "C" :
 *
 *                      ActiveGesture = GestureNums.TwoHandsDown;
 *                      for(int i = 0; i < 8; i++){if(StationListeners.ContainsKey (i))StationListeners[i].TwoHandsDown.SetTrigger("Start");  }
 *                      LastPlacement = Placement.HighMiddleHalf;
 *                      break;
 *
 *              case "C#/Db" :
 *
 *                      ActiveGesture = GestureNums.UpLeft;
 *                      for(int i = 0; i < 8; i++){if(StationListeners.ContainsKey (i))StationListeners[i].UpLeft.SetTrigger("Start");  }
 *                      LastPlacement = Placement.HighLeftQuad;
 *                      break;
 *
 *              case "D" :
 *                      ActiveGesture = GestureNums.UpRight;
 *                      for(int i = 0; i < 8; i++){if(StationListeners.ContainsKey (i))StationListeners[i].UpRight.SetTrigger("Start");  }
 *                      LastPlacement = Placement.HighRightQuad;
 *                      break;
 *
 *              case "D#/Eb" :
 *                      ActiveGesture = GestureNums.StraightLeft;
 *                      for(int i = 0; i < 8; i++){if(StationListeners.ContainsKey (i))StationListeners[i].StraightLeft.SetTrigger("Start");  }
 *                      LastPlacement = Placement.LowLeftQuad; // not
 *                      break;
 *
 *              case "E" :
 *                      ActiveGesture = GestureNums.StraightRight;
 *                      for(int i = 0; i < 8; i++){if(StationListeners.ContainsKey (i))StationListeners[i].StraighRight.SetTrigger("Start");  }
 *                      LastPlacement = Placement.LowRightQuad; // not
 *                      break;
 *
 *              case "F" :
 *                      ActiveGesture = GestureNums.CurlRight;
 *                      for(int i = 0; i < 8; i++){if(StationListeners.ContainsKey (i))StationListeners[i].CurlRight.SetTrigger("Start");  }
 *                      LastPlacement = Placement.HighLeftQuad;
 *                      break;
 *
 *              case "F#/Gb" :
 *                      ActiveGesture = GestureNums.CurlLeft;
 *                      for(int i = 0; i < 8; i++){if(StationListeners.ContainsKey (i))StationListeners[i].CurlLeft.SetTrigger("Start");  }
 *                      LastPlacement = Placement.HighRightQuad;
 *                      break;
 *
 *              case "G" :
 *                      ActiveGesture = GestureNums.BigWaveRight;
 *                      for(int i = 0; i < 8; i++){if(StationListeners.ContainsKey (i))StationListeners[i].BigWaveRight.SetTrigger("Start");  }
 *                      LastPlacement = Placement.LowLeftQuad;
 *                      break;
 *
 *              case "G#/Ab" :
 *                              ActiveGesture = GestureNums.BigWaveLeft;
 *                      for(int i = 0; i <8; i++){if(StationListeners.ContainsKey (i))StationListeners[i].BigWaveLeft.SetTrigger("Start");  }
 *                      LastPlacement = Placement.LowRightQuad;
 *                      break;
 *
 *              case "A" :
 *                      ActiveGesture = GestureNums.TwoHandsUp;
 *                      for(int i = 0; i < 8; i++){if(StationListeners.ContainsKey (i))StationListeners[i].TwoHandsUp.SetTrigger("Start");  }
 *                      LastPlacement = Placement.HighMiddleHalf;
 *                      break;
 *
 *              case "A#/Bb" :
 *                      ActiveGesture = GestureNums.TwoHandsWaveRight;
 *                      for(int i = 0; i < 8; i++){if(StationListeners.ContainsKey (i))StationListeners[i].TwoHandsWaveRight.SetTrigger("Start");  }
 *                      LastPlacement = Placement.LowMiddleHalf;
 *                      break;
 *
 *              case "B" :
 *                      ActiveGesture = GestureNums.TwoHandsWaveLeft;
 *                      for(int i = 0; i < 8; i++){if(StationListeners.ContainsKey (i))StationListeners[i].TwoHandsWaveLeft.SetTrigger("Start");  }
 *                      LastPlacement = Placement.LowMiddleHalf;
 *                      break;
 *              case "StartTutorialIntro" :
 *                      for(int i = 0; i < 8; i++){if(StationListeners.ContainsKey (i))StationListeners[i].StartTutorialIntro();}
 *                      break;
 *              case "EndTutorialIntro" :
 *                      for(int i = 0; i < 8; i++){if(StationListeners.ContainsKey (i))StationListeners[i].EndTutorialIntro();}
 *                      break;
 *              case "StartTutorialInstructions01" :
 *                      for(int i = 0; i < 8; i++){if(StationListeners.ContainsKey (i))StationListeners[i].StartTutorialInstructions01();}
 *                      break;
 *              case "EndTutorialInstructions01" :
 *                      for(int i = 0; i < 8; i++){if(StationListeners.ContainsKey (i))StationListeners[i].EndTutorialInstructions01();}
 *                      break;
 *              case "StartTutorialInstructions02pt1" :
 *                      for(int i = 0; i < 8; i++){if(StationListeners.ContainsKey (i))StationListeners[i].StartTutorialInstructions02pt1();}
 *                      break;
 *              case "EndTutorialInstructions02pt1" :
 *                      for(int i = 0; i < 8; i++){if(StationListeners.ContainsKey (i))StationListeners[i].EndTutorialInstructions02pt1();}
 *                      break;
 *              case "StartTutorialInstructions02pt2" :
 *                      for(int i = 0; i < 8; i++){if(StationListeners.ContainsKey (i))StationListeners[i].StartTutorialInstructions02pt2();}
 *                      break;
 *              case "EndTutorialInstructions02pt2" :
 *                      for(int i = 0; i < 8; i++){if(StationListeners.ContainsKey (i))StationListeners[i].EndTutorialInstructions02pt2();}
 *                      break;
 *              case "StartTutorialOutro" :
 *                      for(int i = 0; i < 8; i++){if(StationListeners.ContainsKey (i))StationListeners[i].StartTutorialOutro();}
 *                      break;
 *              case "EndTutorialOutro" :
 *                      for(int i = 0; i < 8; i++){if(StationListeners.ContainsKey (i))StationListeners[i].EndTutorialOutro();}
 *                      break;
 *              case "GetReady" :
 *                      for(int i = 0; i < 8; i++){if(StationListeners.ContainsKey (i)){
 *
 *                                      StationListeners[i].GetReady.SetTrigger("Start");
 *                              } }
 *                      break;
 *
 *              case "ScoreTimerStart":
 *
 *
 *                      for(int i = 0; i < 8; i++){if(StationListeners.ContainsKey (i))
 *                              {
 *                                      StationListeners[i].ScoreTimerObject.gameObject.SetActive (true);
 *                                      StationListeners[i]._ScoreTimerScript.isVisible = true;	} }
 *                      break;
 *              default:
 *                      break;
 *              }
 *      }*/
    //ScoreTimerObject.gameObject.SetActive (true);
    //_ScoreTimerScript.MakeVisible ();

    internal void AddStation(int stationNum, StationListener stationListener)
    {
        //print ("Addstation");
        StationListeners.Add(stationNum, stationListener);
    }