public MatchManager(AutoController scene) { scene.Game.AddTicking(this); scene.Components.GetOrRegister <Message <Board> >((int)ComponentKeys.BoardCreatedMessage, Message <Board> .Create) .Subscribe(new SimpleListener <Board>(ReceivedNewBoard)); localInfo = scene.Game.Components.GetOrRegister <LocalPlayerInformation>((int)ComponentKeys.LocalPlayerInformation, LocalPlayerInformation.Create); matchState = scene.Components.GetOrRegister <StateMachine>((int)ComponentKeys.MatchState, StateMachine.Create); startTurnCommand = scene.Components.GetOrRegister <Command <bool> >((int)ComponentKeys.NextTurnCommand, Command <bool> .Create); gameOverMessage = scene.Components.GetOrRegister <Message <GameEndType> >((int)ComponentKeys.GameEnd, Message <GameEndType> .Create); checkGameOver = scene.Components.GetOrRegister <Query <EoTScriptState> >((int)ComponentKeys.GameOverQuery, Query <EoTScriptState> .Create); sendEoTState = scene.Game.Components.GetOrRegister <Command <EndOfTurnState> >((int)ComponentKeys.SendEndOfTurnState, Command <EndOfTurnState> .Create); stopRefreshEoTState = scene.Game.Components.GetOrRegister <Command>((int)ComponentKeys.StopRefreshEndOfTurnState, Command.Create); turnStateChange = scene.Components.GetOrRegister <Message>((int)ComponentKeys.TurnState, Message.Create); turnStateChange.Subscribe(new SimpleListener(OnTurnStateChange)); scene.Components.GetOrRegister <Command <TurnActionExecutionResult> > ((int)ComponentKeys.HandleEndOfTurn, Command <TurnActionExecutionResult> .Create).Handler = DoEndOfTurn; scene.ActivatableList.Add(new ListenerJanitor <IListener <ServerEndOfTurnState> >( scene.Game.Components.GetOrRegister <Message <ServerEndOfTurnState> >((int)ComponentKeys.EndOfTurnStateReceived, Message <ServerEndOfTurnState> .Create), new SimpleListener <ServerEndOfTurnState>(OnReceivedEndOfTurnState))); }
public ModListController(AutoController scene) { statusSortOrder = new Dictionary <int, int>(); statusSortOrder[(int)ModNetworkStatus.Playable] = 0; statusSortOrder[(int)ModNetworkStatus.HostOutOfDate] = 1; statusSortOrder[(int)ModNetworkStatus.ClientOutOfDate] = 1; statusSortOrder[(int)ModNetworkStatus.OnlyHost] = 2; statusSortOrder[(int)ModNetworkStatus.OnlyClient] = 3; statusSortOrder[(int)ModNetworkStatus.Unknown] = 4; localMods = new List <LocalModInfo>(); networkMods = new List <NetworkModInfo>(); allMods = new List <ComboModInfo>(); showNotLocalMods = true; prevChoices = scene.Game.Components.Get <LobbyChoices>((int)ComponentKeys.LobbyChoices); ComponentRegistry guiComps = scene.Components.Get <ComponentRegistry>((int)ComponentKeys.LobbyGUIMessages); modButtons = new ModList(); guiComps.Register((int)GUICompKeys.ModList, modButtons); modButtons.OnButtonClick.Subscribe(new SimpleListener <int>(OnModButtonClick)); pickedLabelTop = new SubscribableObject <string>(""); guiComps.Register((int)GUICompKeys.ModListLabelTop, pickedLabelTop); pickedLabelBottom = new SubscribableObject <string>(""); guiComps.Register((int)GUICompKeys.ModListLabelBottom, pickedLabelBottom); pickedModTop = new SubscribableObject <string>(""); guiComps.Register((int)GUICompKeys.ModListPickedTop, pickedModTop); pickedModBottom = new SubscribableObject <string>(""); guiComps.Register((int)GUICompKeys.ModListPickedBottom, pickedModBottom); Message reloadBtnPressed = new Message(); guiComps.Register((int)GUICompKeys.ModListReloadBtnPress, reloadBtnPressed); reloadBtnPressed.Subscribe(new SimpleListener(OnReloadButton)); Message hideBtnPressed = new Message(); guiComps.Register((int)GUICompKeys.ModListHideBtnPress, hideBtnPressed); hideBtnPressed.Subscribe(new SimpleListener(OnHideButton)); reqSendNetworkModList = scene.Game.Components.Get <Command <List <LocalModInfo> > >((int)ComponentKeys.NetworkModListSendRequest); scene.ActivatableList.Add(new ListenerJanitor <IListener <List <NetworkModInfo> > >( scene.Game.Components.Get <Message <List <NetworkModInfo> > >((int)ComponentKeys.NetworkModListReceived), new SimpleListener <List <NetworkModInfo> >(OnNetworkModListReceived))); reqSendPickedMod = scene.Game.Components.Get <Command <bool, string> >((int)ComponentKeys.NetworkPickedModSendRequest); scene.ActivatableList.Add(new ListenerJanitor <IListener <bool, string> > ( scene.Game.Components.Get <Message <bool, string> >((int)ComponentKeys.NetworkPickedModReceived), new SimpleListener <bool, string>(OnNetworkPickedModReceived))); selectedModName = scene.Components.GetOrRegister((int)ComponentKeys.LobbyModSelected, SubscribableObject <string> .Create); modSearcher = scene.Components.GetOrRegister <Query <List <LocalModInfo>, string> > ((int)ComponentKeys.SearchModFolderRequest, Query <List <LocalModInfo>, string> .Create); localInfo = scene.Game.Components.Get <LocalPlayerInformation>((int)ComponentKeys.LocalPlayerInformation); initState = scene.Components.GetOrRegister <StateMachine>((int)ComponentKeys.LobbyInitStatus, StateMachine.Create); initState.EnterStateMessenger.Subscribe(new SimpleListener <int>((s) => InitStatusChange())); scene.Components.GetOrRegister <Query <string, string> >((int)ComponentKeys.GetCachedModFolder, Query <string, string> .Create) .Handler = GetCachedModFolder; readyStatus = scene.Components.GetOrRegister <SubscribableBool>((int)ComponentKeys.LobbyReadyStatus, SubscribableBool.Create); readyStatus.Subscribe(new SimpleListener <bool>((v) => OnReadyStatusChange())); screen = scene.Components.Get <StateMachine>((int)ComponentKeys.LobbyScreen); screen.EnterStateMessenger.Subscribe(new SimpleListener <int>((s) => { switch ((LobbyScreen)s) { case LobbyScreen.ClientGamePrefs: case LobbyScreen.HostGamePrefs: OnEnterScreen(); break; } })); }
private void Awake() { LoadPrefs(); Resources.UnloadUnusedAssets(); prev_width = Screen.width; prev_height = Screen.height; Restart_Button.onClick.AddListener(/*Restart*/ StartRestart); Options_Button.onClick.AddListener(Options); Menu_Button.onClick.AddListener(ReturnToMenu); Fullscreen_Button.onClick.AddListener(ToggleFullscreen); Particles_Button.onClick.AddListener(ToggleParticles); Effects_Button.onClick.AddListener(TogglePostProcessing); Res1440_Button.onClick.AddListener(() => { SetResolution(1440); }); Res1080_Button.onClick.AddListener(() => { SetResolution(1080); }); Res720_Button.onClick.AddListener(() => { SetResolution(720); }); setButtonOn(Fullscreen_Button, Screen.fullScreen); Fullscreen_Button.GetComponentInChildren <Text>().text = "FULLSCREEN: " + (Screen.fullScreen ? "ON" : "OFF"); setButtonOn(Particles_Button, PlayerPrefs.GetInt("screen_particles") == 1 ? true : false); Particles_Button.GetComponentInChildren <Text>().text = "SCREEN PARTICLES: " + (PlayerPrefs.GetInt("screen_particles") == 1 ? "ON" : "OFF"); setButtonOn(Effects_Button, postfxon); Effects_Button.GetComponentInChildren <Text>().text = "POST PROCESSING: " + (postfxon ? "ON" : "OFF"); MusicSlider.value = music_volume; SfxSlider.value = sfx_volume; Saving.text = ""; LoadData(); int i = 0; for (int j = 0; j < coin_count.Length; j++) { CoinIcons[j].GetComponent <Image>().color = new Color(1, 1, 1, coin_count[j] == 1 ? 1 : 0); Coins[i].gameObject.SetActive(coin_count[j] == 0); Coins[i + 1].gameObject.SetActive(coin_count[j] == 1); i += 2; } player = GameObject.Find("Player"); playerlight = GameObject.Find("Player Light Bright"); playerlight.SetActive(false); effects = GameObject.Find("EFFECTS"); globallight = GameObject.Find("Global Light"); cubecontroller = player.GetComponent <CubeController>(); autocontroller = player.GetComponent <AutoController>(); shipcontroller = player.GetComponent <ShipController>(); autoshipcontroller = player.GetComponent <AutoShipController>(); ufocontroller = player.GetComponent <UfoController>(); autoufocontroller = player.GetComponent <AutoUfoController>(); wavecontroller = player.GetComponent <WaveController>(); autowavecontroller = player.GetComponent <AutoWaveController>(); ballcontroller = player.GetComponent <BallController>(); autoballcontroller = player.GetComponent <AutoBallController>(); spidercontroller = player.GetComponent <SpiderController>(); autospidercontroller = player.GetComponent <AutoSpiderController>(); coptercontroller = player.GetComponent <CopterController>(); autocoptercontroller = player.GetComponent <AutoCopterController>(); //------------------------------------------------------------------------------------------------ playercontroller = cubecontroller; checkpointcontroller = FindObjectOfType <Checkpoint_Controller>(); playercontroller.setBGMusic(bgmusic.audio); newbgmusic = bgmusic; iconcontroller = FindObjectOfType <IconController>(); icon = iconcontroller.getIcon(); playercontroller.setIcons(icon); // ------------------------------------------------------------------------------------------------ /*channel_colors = new Color[color_channels.Length]; * int i = 0; * foreach(ColorReference c in color_channels) * { * channel_colors[i] = c.channelcolor; * if(c.refer != null) { channel_colors[i] = c.refer.channelcolor; } * i++; * }*/ // camera list ------------------------ cameraList = new List <CinemachineVirtualCamera>(); initialList = GameObject.FindGameObjectsWithTag("Camera"); i = 0; foreach (GameObject g in initialList) { cameraList.Add(g.GetComponent <CinemachineVirtualCamera>()); cameraList[i].gameObject.SetActive(true); cameraList[i].Priority = 5; } /*if (postfxon && main_camera_brain.ActiveVirtualCamera.VirtualCameraGameObject.GetComponent<CinemachineVolumeSettings>() != null) * { * main_camera_brain.ActiveVirtualCamera.VirtualCameraGameObject.GetComponent<CinemachineVolumeSettings>().enabled = true; * effects.SetActive(true); * } * else * { * main_camera_brain.ActiveVirtualCamera.VirtualCameraGameObject.GetComponent<CinemachineVolumeSettings>().enabled = false; * effects.SetActive(false); * }*/ }
public ShallowModLoader(AutoController scene) { this.scene = scene; scene.Components.Register((int)ComponentKeys.SearchModFolderRequest, new Query <List <LocalModInfo>, string>(SearchForMods)); }
// Start is called before the first frame update void Start() { _AutoController = Car.GetComponent <AutoController>(); }
public override void Awake() { base.Awake(); handcontroller = GetComponentInChildren <CameraController> (); autocontroller = GetComponentInChildren <AutoController>(); }
public BoardCreator(AutoController scene) { localPlayer = scene.Game.Components.Get <LocalPlayerInformation>((int)ComponentKeys.LocalPlayerInformation); scene.Components.GetOrRegister <Query <Board, NetworkGameState> > ((int)ComponentKeys.CreateBoardCommand, Query <Board, NetworkGameState> .Create).Handler = CreateBoard; }
public TurnOrderSelectionController(AutoController scene) { tickHelper = new TickingJanitor(scene.Game, this); tickHelper.Active = false; ComponentRegistry guiComps = scene.Components.Get <ComponentRegistry>((int)ComponentKeys.LobbyGUIMessages); btnsInteractable = guiComps.GetOrRegister <SubscribableBool>((int)GUICompKeys.TOSInteractable, SubscribableBool.Create); btnsInteractable.Value = true; toggleValues = new SubscribableBool[3]; toggleValues[0] = new SubscribableBool(false); guiComps.Register((int)GUICompKeys.TOSOpt1Set, toggleValues[0]); toggleValues[1] = new SubscribableBool(false); guiComps.Register((int)GUICompKeys.TOSOpt2Set, toggleValues[1]); toggleValues[2] = new SubscribableBool(false); guiComps.Register((int)GUICompKeys.TOSOpt3Set, toggleValues[2]); Message <bool>[] toggleChanges = new Message <bool> [3]; toggleChanges[0] = new Message <bool>(); guiComps.Register((int)GUICompKeys.TOSOpt1Change, toggleChanges[0]); toggleChanges[1] = new Message <bool>(); guiComps.Register((int)GUICompKeys.TOSOpt2Change, toggleChanges[1]); toggleChanges[2] = new Message <bool>(); guiComps.Register((int)GUICompKeys.TOSOpt3Change, toggleChanges[2]); for (int i = 0; i < toggleChanges.Length; i++) { int index = i; toggleChanges[i].Subscribe(new SimpleListener <bool>((v) => OnToggleChange(index, v))); } choiceBtnIndex = new Dictionary <LobbyTurnOrderChoice, int>(); choiceBtnIndex[LobbyTurnOrderChoice.HostIsFirst] = 0; choiceBtnIndex[LobbyTurnOrderChoice.ClientIsFirst] = 1; choiceBtnIndex[LobbyTurnOrderChoice.Random] = 2; choiceBtnIndex[LobbyTurnOrderChoice.None] = -1; otherSelLabel = new SubscribableObject <string>(""); guiComps.Register((int)GUICompKeys.TOSOtherSelectionLabel, otherSelLabel); otherSelValue = new SubscribableObject <string>(""); guiComps.Register((int)GUICompKeys.TOSOtherSelectionValue, otherSelValue); allowTogglesOff = new SubscribableBool(false); guiComps.Register((int)GUICompKeys.TOSAllowAllTogglesOff, allowTogglesOff); prevChoices = scene.Game.Components.Get <LobbyChoices>((int)ComponentKeys.LobbyChoices); selected = new SubscribableInt(0); //scene.SceneComponents.Register((int)ComponentKeys.LobbyTurnOrderSelected, selected); initStatus = scene.Components.GetOrRegister <StateMachine>((int)ComponentKeys.LobbyInitStatus, StateMachine.Create); initStatus.EnterStateMessenger.Subscribe(new SimpleListener <int>((s) => InitStatusChange())); reqSendPick = scene.Game.Components.Get <Command <LobbyTurnOrderChoice> >((int)ComponentKeys.LobbyTurnOrderChoiceNotify); scene.ActivatableList.Add(new ListenerJanitor <IListener <LobbyTurnOrderChoice> >( scene.Game.Components.Get <IMessage <LobbyTurnOrderChoice> >((int)ComponentKeys.LobbyTurnOrderChoiceReceived), new SimpleListener <LobbyTurnOrderChoice>(OnNetworkPickReceived))); readyStatus = scene.Components.GetOrRegister <SubscribableBool>((int)ComponentKeys.LobbyReadyStatus, SubscribableBool.Create); readyStatus.Subscribe(new SimpleListener <bool>((v) => OnReadyStatusChange())); screen = scene.Components.Get <StateMachine>((int)ComponentKeys.LobbyScreen); screen.EnterStateMessenger.Subscribe(new SimpleListener <int>((s) => { isHost = s == (int)LobbyScreen.HostGamePrefs; if (s == (int)LobbyScreen.HostGamePrefs || s == (int)LobbyScreen.ClientGamePrefs) { ScreenEnter(); } })); }
public ModErrorLog(AutoController scene) { scripts = scene.Game.Components.Get <ScriptController>((int)ComponentKeys.LuaScripts); scene.Components.GetOrRegister <Message <string> >((int)ComponentKeys.ModLoadError, Message <string> .Create) .Subscribe(new SimpleListener <string>(LogError)); }
/// <summary> /// Task which is used for scanning pending commands and broadcast to external terminals. /// </summary> private void SearchWarehousePendingCommands() { while (true) { // Task is not allowed to run. if (!_isTaskRunning) { Thread.Sleep(Setting.CommandScanTaskInterval); continue; } // Wait for signal from another thread to start this one. _manualResetScannerEvent.WaitOne(); try { // Message will be built base on the being activated automated warehouse controller. var message = ""; #region Message construction // Operating warehouse controller is material. if (TerminalName.Material.Equals(_terminalSetting.Key)) { #region Automated warehouse status validation. // No material warehouse controller has been configured in application setting file. if (string.IsNullOrEmpty(AutoController.MaterialAutoWarehouseDeviceCode)) { Message.InitiateMessage(DateTime.Now, MessageType.Information, $"No material warehouse controller device code has been configured into application setting file. Restart in {Setting.CommandScanTaskInterval} milliseconds."); // Sleep the thread for 3 secs. Thread.Sleep(Setting.CommandScanTaskInterval); continue; } // Material auto warehouse controller is offline. if (!MaterialAutoWarehouseController.IsAutoWarehouseOnline(AutoController.MaterialAutoWarehouseDeviceCode)) { Message.InitiateMessage(DateTime.Now, MessageType.Information, $"Material automated warehouse is offline. Restart in {Setting.CommandScanTaskInterval} milliseconds."); // Sleep the thread for awhile. Thread.Sleep(Setting.CommandScanTaskInterval); continue; } #endregion #region Message initialization try { // Find pending material command in database. var commands = AutoController.FindPendingMaterialCommands(); // Command is not valid. if (commands == null || commands.Count < 1) { //Message.InitiateMessage(DateTime.Now, MessageType.Information, //$"No pending command has been found. Broadcaster will be restarted in {Setting.CommandScanTaskInterval} milliseconds."); Thread.Sleep(Setting.CommandScanTaskInterval); continue; } // ProceedIncommingCommand database records. MaterialAutoWarehouseController.ProcessDataBase(commands, AutoController.MaterialAutoWarehouseDeviceCode, _terminalSetting.Value.Outgoing); Thread.Sleep(Setting.CommandScanTaskInterval); continue; } catch (Exception exception) { Log.Error(exception.Message, exception); Message.InitiateMessage(DateTime.Now, MessageType.Error, exception.Message); Thread.Sleep(Setting.CommandScanTaskInterval); continue; } #endregion } else if (TerminalName.PreProduct.Equals(_terminalSetting.Key)) { using (var context = new KCSGDbContext()) using (var unitOfWork = new UnitOfWork(context)) { // delete off empty command var preProduct = unitOfWork.PreProductWarehouseCommandRepository.GetMany( i => i.F50_From.Trim().Equals("")) .FirstOrDefault(); if (preProduct != null) { unitOfWork.PreProductWarehouseCommandRepository.Delete(preProduct); unitOfWork.Commit(); } } #region Automated warehouse status validation. // No material warehouse controller has been configured in application setting file. if (string.IsNullOrEmpty(AutoController.PreProductAutoWarehouseDeviceCode)) { Message.InitiateMessage(DateTime.Now, MessageType.Information, $"No pre-product warehouse controller device code has been configured into application setting file. Restart in {Setting.CommandScanTaskInterval} milliseconds."); // Sleep the thread for 3 secs. Thread.Sleep(3000); continue; } // Material auto warehouse controller is offline. if (!PreProductAutoWarehouseController.IsAutoWarehouseOnline(AutoController.PreProductAutoWarehouseDeviceCode)) { Message.InitiateMessage(DateTime.Now, MessageType.Information, $"Pre-product automated warehouse is offline. Restart in {Setting.CommandScanTaskInterval} milliseconds."); // Sleep the thread for awhile. Thread.Sleep(Setting.CommandScanTaskInterval); continue; } #endregion #region Pre-product initialization try { var commands = AutoController.FindPendingPreProductCommands(); if (commands == null || commands.Count < 1) { //Message.InitiateMessage(DateTime.Now, MessageType.Information, //$"No pending command has been found. Listener will be restarted in {Setting.CommandScanTaskInterval} milliseconds."); Thread.Sleep(Setting.CommandScanTaskInterval); continue; } // ProceedIncommingCommand messages list. PreProductAutoWarehouseController.ProceedMessages(commands, AutoController.PreProductAutoWarehouseDeviceCode, _terminalSetting.Value.Outgoing); Thread.Sleep(Setting.CommandScanTaskInterval); } catch (Exception exception) { Log.Error(exception.Message, exception); Message.InitiateMessage(DateTime.Now, MessageType.Error, exception.Message); } #endregion } else if (TerminalName.Product.Equals(_terminalSetting.Key)) { #region Automated warehouse status validation. // No material warehouse controller has been configured in application setting file. if (string.IsNullOrEmpty(AutoController.ProductAutoWarehouseDeviceCode)) { Message.InitiateMessage(DateTime.Now, MessageType.Information, $"No product warehouse controller device code has been configured into application setting file. Restart in {Setting.CommandScanTaskInterval} milliseconds."); // Sleep the thread for 3 secs. Thread.Sleep(3000); continue; } // Material auto warehouse controller is offline. if (!ProductAutoWarehouseController.IsAutoWarehouseOnline(AutoController.ProductAutoWarehouseDeviceCode)) { Message.InitiateMessage(DateTime.Now, MessageType.Information, $"Product automated warehouse is offline. Restart in {Setting.CommandScanTaskInterval} milliseconds."); // Sleep the thread for awhile. Thread.Sleep(Setting.CommandScanTaskInterval); continue; } #endregion #region Products initialization try { // TODO: Disabled it at 2017-05-17 (Consider enable it back) //var commands = AutoController.FindPendingProductCommands(); //if (commands == null || commands.Count < 1) //{ // //Message.InitiateMessage(DateTime.Now, MessageType.Information, // //$"No pending command has been found. Listener will be restarted in {Setting.CommandScanTaskInterval} milliseconds."); // Thread.Sleep(Setting.CommandScanTaskInterval); // continue; //} //ProductAutoWarehouseController.ProcessDataList(commands, // AutoController.ProductAutoWarehouseDeviceCode, _terminalSetting.Value.Outgoing); //Thread.Sleep(Setting.CommandScanTaskInterval); var command = AutoController.FindPendingProductCommands().FirstOrDefault(); if (command == null) { Thread.Sleep(Setting.CommandScanTaskInterval); continue; } ProductAutoWarehouseController.ProcessDataList(new[] { command }, AutoController.ProductAutoWarehouseDeviceCode, _terminalSetting.Value.Outgoing); Thread.Sleep(Setting.CommandScanTaskInterval); } catch (Exception exception) { Log.Error(exception.Message, exception); Message.InitiateMessage(DateTime.Now, MessageType.Error, exception.Message); } #endregion } else { Message.InitiateMessage(DateTime.Now, MessageType.Error, $"Material, Pre-Product, Product should be selected to broadcast message. Restart message broadcaster in {Setting.CommandScanTaskInterval} milliseconds."); Thread.Sleep(Setting.CommandScanTaskInterval); continue; } #endregion } catch (EntityException entityException) { Log.Error(entityException.Message, entityException); Message.ShowMessageBox(View.FindView(), "There is something wrong with database. Please check database configuration in configuration file.", "System Message", MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.OK); Application.Current.Dispatcher.Invoke(() => { IsTaskRunning = false; }); } catch (Exception exception) { Log.Error(exception.Message, exception); } } }
//private int frame; public SetupHostScreenManager(AutoController scene) { state = State.Hidden; ComponentRegistry guiComps = scene.Components.Get <ComponentRegistry>((int)ComponentKeys.LobbyGUIMessages); guiComps.Register((int)GUICompKeys.BtnHostCancelPress, new Message()); guiComps.Register((int)GUICompKeys.BtnStartHostPress, new Message()); guiComps.Register((int)GUICompKeys.HostPortChange, new Message <string>()); guiComps.Register((int)GUICompKeys.ClientAddressChange, new Message <string>()); startBtnEnabled = new SubscribableBool(hasPort); guiComps.Register((int)GUICompKeys.BtnHostStartEnabledCommand, startBtnEnabled); setInputInteractable = new SubscribableBool(state != State.Connecting); guiComps.Register((int)GUICompKeys.HostStartInputInteractable, setInputInteractable); setPortField = new SubscribableObject <string>(port.ToString()); guiComps.Register((int)GUICompKeys.HostPortSetCommand, setPortField); setAddressField = new SubscribableObject <string>(""); guiComps.Register((int)GUICompKeys.ClientAddressTextField, setAddressField); setAddressInteractable = new SubscribableBool(false); guiComps.Register((int)GUICompKeys.HostAddressInteractable, setAddressInteractable); statusText = new SubscribableObject <string>(""); guiComps.Register((int)GUICompKeys.HostConnectionStatusLabel, statusText); titleText = new SubscribableObject <string>(""); guiComps.Register((int)GUICompKeys.StartGameTitleText, titleText); startButtonText = new SubscribableObject <string>(""); guiComps.Register((int)GUICompKeys.StartGameStartButtonText, startButtonText); guiComps.Get <Message <string> >((int)GUICompKeys.HostPortChange).Subscribe(new SimpleListener <string>(OnPortChange)); guiComps.Get <Message <string> >((int)GUICompKeys.ClientAddressChange).Subscribe(new SimpleListener <string>(OnAddressChange)); guiComps.Get <Message>((int)GUICompKeys.BtnHostCancelPress).Subscribe(new SimpleListener(OnCancelPress)); guiComps.Get <Message>((int)GUICompKeys.BtnStartHostPress).Subscribe(new SimpleListener(OnStartPress)); setPasswordField = new SubscribableObject <string>(""); guiComps.Register((int)GUICompKeys.PasswordTextSet, setPasswordField); Message <string> passwordChange = new Message <string>(); guiComps.Register((int)GUICompKeys.PasswordChange, passwordChange); passwordChange.Subscribe(new SimpleListener <string>(OnPasswordChange)); choices = scene.Game.Components.Get <LobbyChoices>((int)ComponentKeys.LobbyChoices); screen = scene.Components.Get <StateMachine>((int)ComponentKeys.LobbyScreen); netHelper = scene.Game.Components.Get <ConnectionHelper>((int)ComponentKeys.ConnectionHelper); scene.ActivatableList.Add(new ListenerJanitor <IListener <int> >( netHelper.Connection.EnterStateMessenger, new SimpleListener <int>(OnConnectionChange))); screen.EnterStateMessenger.Subscribe(new SimpleListener <int>((s) => { //BalugaDebug.Log("Entering screen " + (LobbyScreen)s); if (s == (int)LobbyScreen.SetupHost || s == (int)LobbyScreen.SetupClient) { state = State.Choosing; EnterScreen(); } else { state = State.Hidden; } })); }