protected override void UpdateState(BoundUserInterfaceState state) { base.UpdateState(state); var castState = (IdCardConsoleBoundUserInterfaceState)state; _window.UpdateState(castState); }
protected override void UpdateState(BoundUserInterfaceState state) { base.UpdateState(state); if (_menu == null) { return; } switch (state) { case PDAUpdateState msg: { _menu.FlashLightToggleButton.Pressed = msg.FlashlightEnabled; if (msg.PDAOwnerInfo.ActualOwnerName != null) { _menu.PDAOwnerLabel.SetMarkup(Loc.GetString("comp-pda-ui-owner", ("ActualOwnerName", msg.PDAOwnerInfo.ActualOwnerName))); } if (msg.PDAOwnerInfo.IdOwner != null || msg.PDAOwnerInfo.JobTitle != null) { _menu.IDInfoLabel.SetMarkup(Loc.GetString("comp-pda-ui", ("Owner", msg.PDAOwnerInfo.IdOwner ?? "Unknown"), ("JobTitle", msg.PDAOwnerInfo.JobTitle ?? "Unassigned"))); } else { _menu.IDInfoLabel.SetMarkup(Loc.GetString("comp-pda-ui-blank")); } _menu.EjectIDButton.Visible = msg.PDAOwnerInfo.IdOwner != null || msg.PDAOwnerInfo.JobTitle != null; _menu.EjectPenButton.Visible = msg.HasPen; if (msg.Account != null) { _menu.CurrentLoggedInAccount = msg.Account; var balance = msg.Account.DataBalance; var weightedColor = GetWeightedColorString(balance); _menu.BalanceInfo.SetMarkup(Loc.GetString("pda-bound-user-interface-tc-balance-popup", ("weightedColor", weightedColor), ("balance", balance))); } if (msg.Listings != null) { _menu.ClearListings(); foreach (var item in msg.Listings) //Should probably chunk these out instead. to-do if this clogs the internet tubes. { _menu.AddListingGui(item); } } _menu.MasterTabContainer.SetTabVisible(1, msg.Account != null); break; } } }
protected override void UpdateState(BoundUserInterfaceState state) { base.UpdateState(state); var castState = (ApcBoundInterfaceState)state; _breakerButton.Pressed = castState.MainBreaker; switch (castState.ApcExternalPower) { case ApcExternalPowerState.None: _externalPowerStateLabel.Text = "None"; _externalPowerStateLabel.SetOnlyStyleClass(NanoStyle.StyleClassPowerStateNone); break; case ApcExternalPowerState.Low: _externalPowerStateLabel.Text = "Low"; _externalPowerStateLabel.SetOnlyStyleClass(NanoStyle.StyleClassPowerStateLow); break; case ApcExternalPowerState.Good: _externalPowerStateLabel.Text = "Good"; _externalPowerStateLabel.SetOnlyStyleClass(NanoStyle.StyleClassPowerStateGood); break; default: throw new ArgumentOutOfRangeException(); } _chargeBar.Value = castState.Charge; UpdateChargeBarColor(castState.Charge); float ChargePercentage = (castState.Charge / _chargeBar.MaxValue) * 100.0f; _window.ChargePercentage.Text = " " + ChargePercentage.ToString("0.00") + "%"; }
protected override void UpdateState(BoundUserInterfaceState state) { base.UpdateState(state); if (state is not CommunicationsConsoleInterfaceState commsState) { return; } CanAnnounce = commsState.CanAnnounce; CanCall = commsState.CanCall; _expectedCountdownTime = commsState.ExpectedCountdownEnd; CountdownStarted = commsState.CountdownStarted; AlertLevelSelectable = commsState.AlertLevels != null && !float.IsNaN(commsState.CurrentAlertDelay) && commsState.CurrentAlertDelay <= 0; CurrentLevel = commsState.CurrentAlert; if (_menu != null) { _menu.UpdateCountdown(); _menu.UpdateAlertLevels(commsState.AlertLevels, CurrentLevel); _menu.AlertLevelButton.Disabled = !AlertLevelSelectable; _menu.EmergencyShuttleButton.Disabled = !CanCall; _menu.AnnounceButton.Disabled = !CanAnnounce; } }
/// <summary> /// Update the UI state when new state data is received from the server. /// </summary> /// <param name="state">State data sent by the server.</param> public void UpdateState(BoundUserInterfaceState state) { var castState = (ReagentDispenserBoundUserInterfaceState)state; Title = castState.DispenserName; UpdateContainerInfo(castState); // Disable all buttons if not powered if (Contents.Children != null) { ButtonHelpers.SetButtonDisabledRecursive(Contents, !castState.HasPower); EjectButton.Disabled = false; } // Disable the Clear & Eject button if no beaker if (!castState.HasBeaker) { ClearButton.Disabled = true; EjectButton.Disabled = true; } switch (castState.SelectedDispenseAmount.Int()) { case 1: DispenseButton1.Pressed = true; break; case 5: DispenseButton5.Pressed = true; break; case 10: DispenseButton10.Pressed = true; break; case 15: DispenseButton15.Pressed = true; break; case 20: DispenseButton20.Pressed = true; break; case 25: DispenseButton25.Pressed = true; break; case 30: DispenseButton30.Pressed = true; break; case 50: DispenseButton50.Pressed = true; break; case 100: DispenseButton100.Pressed = true; break; } }
/// <summary> /// Update the UI state when new state data is received from the server. /// </summary> /// <param name="state">State data sent by the server.</param> public void UpdateState(BoundUserInterfaceState state) { var castState = (AMEControllerBoundUserInterfaceState)state; // Disable all buttons if not powered if (Contents.Children != null) { SetButtonDisabledRecursive(Contents, !castState.HasPower); EjectButton.Disabled = false; } if (!castState.HasFuelJar) { EjectButton.Disabled = true; ToggleInjection.Disabled = true; FuelAmount.Text = Loc.GetString("No fuel inserted"); } else { EjectButton.Disabled = false; ToggleInjection.Disabled = false; FuelAmount.Text = $"{castState.FuelAmount}"; } if (!castState.IsMaster) { ToggleInjection.Disabled = true; } RefreshPartsButton.Disabled = castState.Injecting; CoreCount.Text = $"{castState.CoreCount}"; InjectionAmount.Text = $"{castState.InjectionAmount}"; }
protected override void UpdateState(BoundUserInterfaceState state) { base.UpdateState(state); var castState = (ApcBoundInterfaceState)state; _breakerButton.Pressed = castState.MainBreaker; switch (castState.ApcExternalPower) { case ApcExternalPowerState.None: _externalPowerStateLabel.Text = "None"; break; case ApcExternalPowerState.Low: _externalPowerStateLabel.Text = "Low"; break; case ApcExternalPowerState.Good: _externalPowerStateLabel.Text = "Good"; break; default: throw new ArgumentOutOfRangeException(); } _chargeBar.Value = castState.Charge; }
protected override void UpdateState(BoundUserInterfaceState state) { base.UpdateState(state); var castState = (ApcBoundInterfaceState)state; _menu?.UpdateState(castState); }
protected override void UpdateState(BoundUserInterfaceState state) { base.UpdateState(state); var castState = (NetworkConfiguratorUserInterfaceState)state; _listMenu?.UpdateState(castState); }
protected override void UpdateState(BoundUserInterfaceState state) { base.UpdateState(state); var castState = (SharedGravityGeneratorComponent.GeneratorState)state; _window?.UpdateState(castState); }
/// <summary> /// Update the ui each time new state data is sent from the server. /// </summary> /// <param name="state"> /// Data of the <see cref="SharedReagentDispenserComponent"/> that this ui represents. /// Sent from the server. /// </param> protected override void UpdateState(BoundUserInterfaceState state) { base.UpdateState(state); var castState = (AMEControllerBoundUserInterfaceState)state; _window?.UpdateState(castState); //Update window state }
protected override void UpdateState(BoundUserInterfaceState state) { base.UpdateState(state); if (_menu == null) { return; } switch (state) { case PDAUpdateState msg: { _menu.FlashLightToggleButton.Pressed = msg.FlashlightEnabled; if (msg.PDAOwnerInfo.ActualOwnerName != null) { _menu.PDAOwnerLabel.SetMarkup(Loc.GetString("Owner: [color=white]{0}[/color]", msg.PDAOwnerInfo.ActualOwnerName)); } if (msg.PDAOwnerInfo.JobTitle == null || msg.PDAOwnerInfo.IdOwner == null) { _menu.IDInfoLabel.SetMarkup(Loc.GetString("ID:")); } else { _menu.IDInfoLabel.SetMarkup(Loc.GetString( "ID: [color=white]{0}[/color], [color=yellow]{1}[/color]", msg.PDAOwnerInfo.IdOwner, msg.PDAOwnerInfo.JobTitle)); } _menu.EjectIDButton.Visible = msg.PDAOwnerInfo.IdOwner != null; _menu.EjectPenButton.Visible = msg.HasPen; if (msg.Account != null) { _menu.CurrentLoggedInAccount = msg.Account; var balance = msg.Account.DataBalance; var weightedColor = GetWeightedColorString(balance); _menu.BalanceInfo.SetMarkup(Loc.GetString("TC Balance: [color={0}]{1}[/color]", weightedColor, balance)); } if (msg.Listings != null) { _menu.ClearListings(); foreach (var item in msg.Listings) //Should probably chunk these out instead. to-do if this clogs the internet tubes. { _menu.AddListingGui(item); } } _menu.MasterTabContainer.SetTabVisible(1, msg.Account != null); break; } } }
protected override void UpdateState(BoundUserInterfaceState state) { base.UpdateState(state); if (state is not ResearchClientBoundInterfaceState rState) { return; } _menu?.Populate(rState.ServerCount, rState.ServerNames, rState.ServerIds, rState.SelectedServerId); }
protected override void UpdateState(BoundUserInterfaceState state) { base.UpdateState(state); if (!(state is SharedResearchClientComponent.ResearchClientBoundInterfaceState rstate)) { return; } _menu.Populate(rstate.ServerCount, rstate.ServerNames, rstate.ServerIds, rstate.SelectedServerId); }
protected override void UpdateState(BoundUserInterfaceState state) { base.UpdateState(state); switch (state) { case SignalPortsState data: _menu?.UpdateState(data); break; } }
/// <summary> /// Update the UI state based on server-sent info /// </summary> /// <param name="state"></param> protected override void UpdateState(BoundUserInterfaceState state) { base.UpdateState(state); if (_window == null || state is not HandLabelerBoundUserInterfaceState cast) { return; } _window.SetCurrentLabel(cast.CurrentLabel); }
protected override void UpdateState(BoundUserInterfaceState state) { base.UpdateState(state); if (!(state is ReagentGrinderInterfaceState cState)) { return; } _menu?.UpdateState(cState); }
protected override void UpdateState(BoundUserInterfaceState state) { base.UpdateState(state); if (!(state is MicrowaveUpdateUserInterfaceState cstate)) { return; } RefreshContentsDisplay(cstate.ReagentsReagents, cstate.ContainedSolids); }
protected override void UpdateState(BoundUserInterfaceState state) { base.UpdateState(state); if (state is not DisposalMailingUnitBoundUserInterfaceState cast) { return; } _window?.UpdateState(cast); }
protected override void UpdateState(BoundUserInterfaceState state) { base.UpdateState(state); if (!(state is DisposalRouterUserInterfaceState cast)) { return; } _window?.UpdateState(cast); }
protected override void UpdateState(BoundUserInterfaceState state) { base.UpdateState(state); if (state is not ShuttleConsoleBoundInterfaceState cState) { return; } _window?.SetMatrix(cState.Coordinates, cState.Angle); _window?.UpdateState(cState); }
protected override void UpdateState(BoundUserInterfaceState state) { base.UpdateState(state); if (state is not MedicalScannerBoundUserInterfaceState cast) { return; } _window?.Populate(cast); }
/// <summary> /// Update the ui each time new state data is sent from the server. /// </summary> /// <param name="state"> /// Data of the <see cref="SharedReagentDispenserComponent"/> that this ui represents. /// Sent from the server. /// </param> protected override void UpdateState(BoundUserInterfaceState state) { base.UpdateState(state); var castState = (ReagentDispenserBoundUserInterfaceState)state; _lastState = castState; UpdateReagentsList(castState.Inventory); //Update reagents list & reagent button actions _window?.UpdateState(castState); //Update window state }
protected override void UpdateState(BoundUserInterfaceState state) { base.UpdateState(state); if (_window == null) { return; } _window.UpdateState((S)state); }
protected override void UpdateState(BoundUserInterfaceState state) { base.UpdateState(state); if (state is not ConfigurationBoundUserInterfaceState configurationState) { return; } _menu?.Populate(configurationState); }
protected override void UpdateState(BoundUserInterfaceState state) { base.UpdateState(state); if (!(state is GasCanisterBoundUserInterfaceState cast)) { return; } _window?.UpdateState(cast); }
protected override void UpdateState(BoundUserInterfaceState state) { base.UpdateState(state); if (!(state is MicrowaveUpdateUserInterfaceState cstate)) { return; } _menu.ToggleBusyDisableOverlayPanel(cstate.IsMicrowaveBusy); RefreshContentsDisplay(cstate.ReagentsReagents, cstate.ContainedSolids); }
protected override void UpdateState(BoundUserInterfaceState state) { base.UpdateState(state); var castState = (SharedResearchConsoleComponent.ResearchConsoleBoundInterfaceState)state; Points = castState.Points; PointsPerSecond = castState.PointsPerSecond; // We update the user interface here. _consoleMenu?.PopulatePoints(); }
protected override void UpdateState(BoundUserInterfaceState state) { if (!(state is CommunicationsConsoleInterfaceState commsState)) { return; } _expectedCountdownTime = commsState.ExpectedCountdownEnd; CountdownStarted = commsState.CountdownStarted; _menu?.UpdateCountdown(); }
/// <summary> /// Update the UI state based on server-sent info /// </summary> /// <param name="state"></param> protected override void UpdateState(BoundUserInterfaceState state) { base.UpdateState(state); if (_window == null || state is not AgentIDCardBoundUserInterfaceState cast) { return; } _window.SetCurrentName(cast.CurrentName); _window.SetCurrentJob(cast.CurrentJob); }