public void SetLevelFB(ushort level) { var hub = MessageHub.Instance; LoadOnEvent loadOnMessage = new LoadOnEvent(this); loadOnMessage.IsOn = this.IsOn(); hub.Publish <LoadOnEvent>(loadOnMessage); LoadLevelEvent message = new LoadLevelEvent(this); message.Level = level; _levelFB = level; hub.Publish <LoadLevelEvent>(message); }
public void SetLevel(ushort level) { if (_crestronLoad.Type == eLoadType.Switch) { if (level > 0) { FullOn(); } else { Off(); } } else if (_crestronLoad.Type == eLoadType.Dimmer) { ((DimmingLoad)_crestronLoad).Level.UShortValue = level; _level = level; var hub = MessageHub.Instance; LoadToggleOnEvent message = new LoadToggleOnEvent(this); if (level != 0) { message.IsOn = true; } else { message.IsOn = false; } message.stopwatch.Start(); hub.Publish <LoadToggleOnEvent>(message); //Testing with multiple loads going on LoadLevelEvent lmessage = new LoadLevelEvent(this); lmessage.Level = level; hub.Publish <LoadLevelEvent>(lmessage); } return; }
/// <summary> /// Processes the message /// </summary> /// <param name="connectionBase">The connection bae</param> /// <param name="message">The playerio message</param> /// <param name="handled">Whether the message was already handled</param> public void Process(ConnectionBase connectionBase, Message message, bool handled) { WorldConnection worldCon = (WorldConnection)connectionBase; World world = worldCon.World; if (!handled) { world.Deserialize(message); foreach (KeyValuePair <int, WorldPlayer> player in worldCon.Players.GetDictionary()) { player.Value.Reset(); } } LoadLevelEvent loadLevelEvent = new LoadLevelEvent() { Raw = message, World = world }; connectionBase.RaiseServerEvent <LoadLevelEvent>(loadLevelEvent); }
/// <summary> /// Called on set level command success to ensure that the level has been successfully loaded before continuing /// </summary> private void LevelLoaded() { LoadLevelEvent?.Invoke(); }
private void On(LoadLevelEvent e) { this.World = GetWorld(e.PlayerIOMessage, this.Width, this.Height); }
void onLoadLevel(LoadLevelEvent e) { LoadLevel(e.index); }
private void On(LoadLevelEvent e) { this.Reindex(); }
public void ProcessLoadLevelEvent(LoadLevelEvent levelEvent) { }
private void OnLoadlevel(LoadLevelEvent data) { this.ChangeGeneralGameState(data.currentGameState, false); }
private void ReceiveLoadingLevelEvent(LoadLevelEvent data) { if (data.currentGameState == GameManager.GameState.Level && data.nextGameState != GameManager.GameState.Level) { this.StopMusic(); } switch (data.nextGameState) { case GameManager.GameState.MainMenu: { GameObject gameObject = this.commonAudio.MusicTheme; this.StartMusic(gameObject.GetComponent <AudioSource>(), 0f, 2.2f, MusicManager.MusicStartOption.StartFromBeginning); break; } case GameManager.GameState.EpisodeSelection: case GameManager.GameState.LevelSelection: case GameManager.GameState.SandboxLevelSelection: { GameObject gameObject = this.commonAudio.LevelSelectionMusic; this.StartMusic(gameObject.GetComponent <AudioSource>(), 0f, 2.2f, MusicManager.MusicStartOption.StartFromBeginning); break; } case GameManager.GameState.Level: { this.FadeOutMusic(0.4f); GameObject gameObject; if (Singleton <GameManager> .Instance.OverrideBuildMusic) { gameObject = Singleton <GameManager> .Instance.OverriddenBuildMusic; } else { gameObject = this.commonAudio.BuildMusic; } this.StartMusic(gameObject.GetComponent <AudioSource>(), 0.6f, 2.2f, MusicManager.MusicStartOption.StartFromBeginning); break; } case GameManager.GameState.Cutscene: this.FadeOutMusic(0.4f); break; case GameManager.GameState.StarLevelCutscene: this.FadeOutMusic(0.4f); break; case GameManager.GameState.KingPigFeeding: { this.FadeOutMusic(0.4f); GameObject gameObject; if (Singleton <TimeManager> .IsInstantiated() && Singleton <TimeManager> .Instance.Initialized && Singleton <TimeManager> .Instance.CurrentTime.Month == 12) { gameObject = this.commonAudio.XmasThemeSong; } else { gameObject = this.commonAudio.FeedingMusic; } this.StartMusic(gameObject.GetComponent <AudioSource>(), 0.6f, 2.2f, MusicManager.MusicStartOption.StartFromBeginning); break; } case GameManager.GameState.WorkShop: this.FadeOutMusic(0.4f); this.StartMusic(this.commonAudio.craftAmbience, 0.6f, 2.2f, MusicManager.MusicStartOption.StartFromBeginning); break; case GameManager.GameState.CakeRaceMenu: { this.FadeOutMusic(0.4f); GameObject gameObject = this.commonAudio.CakeRaceTheme; this.StartMusic(gameObject.GetComponent <AudioSource>(), 0.6f, 2.2f, MusicManager.MusicStartOption.StartFromBeginning); break; } } }
private void OnLoadLevel(LoadLevelEvent e) { this.World = BlockUtils.GetWorld(e.PlayerIOMessage, this.Width, this.Height, 0); }
private void OnLoadLevel(LoadLevelEvent e) { ScanForPlaygrounds(); }
private void LoadLevel(LoadLevelEvent e) { LoadLevel(e.iLevel); }