2020-04-04 15:11:28 +02:00
|
|
|
|
using System;
|
2020-10-30 16:06:48 +01:00
|
|
|
|
using Content.Client.Administration;
|
2020-11-10 16:50:28 +01:00
|
|
|
|
using Content.Client.Eui;
|
2018-12-13 07:47:19 -06:00
|
|
|
|
using Content.Client.GameObjects.Components.Actor;
|
2018-08-16 15:57:11 -07:00
|
|
|
|
using Content.Client.Input;
|
2018-11-21 21:11:30 +01:00
|
|
|
|
using Content.Client.Interfaces;
|
2019-07-30 23:13:05 +02:00
|
|
|
|
using Content.Client.Interfaces.Chat;
|
2018-11-30 21:54:30 +01:00
|
|
|
|
using Content.Client.Interfaces.Parallax;
|
|
|
|
|
|
using Content.Client.Parallax;
|
2019-10-02 10:45:06 +02:00
|
|
|
|
using Content.Client.Sandbox;
|
2019-12-06 00:41:30 +01:00
|
|
|
|
using Content.Client.State;
|
2020-08-18 14:29:13 +02:00
|
|
|
|
using Content.Client.StationEvents;
|
2019-07-30 23:13:05 +02:00
|
|
|
|
using Content.Client.UserInterface;
|
2020-08-25 17:18:32 +02:00
|
|
|
|
using Content.Client.UserInterface.AdminMenu;
|
2020-04-04 15:10:51 +02:00
|
|
|
|
using Content.Client.UserInterface.Stylesheets;
|
2021-01-24 08:17:45 +00:00
|
|
|
|
using Content.Client.Graphics.Overlays;
|
2021-02-16 15:07:17 +01:00
|
|
|
|
using Content.Client.Voting;
|
2020-12-13 14:28:20 -08:00
|
|
|
|
using Content.Shared.Actions;
|
2019-09-01 22:15:34 +02:00
|
|
|
|
using Content.Shared.GameObjects.Components;
|
2019-11-21 16:37:15 -08:00
|
|
|
|
using Content.Shared.GameObjects.Components.Cargo;
|
2020-08-13 14:40:27 +02:00
|
|
|
|
using Content.Shared.GameObjects.Components.Chemistry.ChemMaster;
|
|
|
|
|
|
using Content.Shared.GameObjects.Components.Chemistry.ReagentDispenser;
|
2020-05-02 15:02:52 +01:00
|
|
|
|
using Content.Shared.GameObjects.Components.Gravity;
|
2019-07-30 23:13:05 +02:00
|
|
|
|
using Content.Shared.GameObjects.Components.Markers;
|
2020-08-29 06:05:44 -05:00
|
|
|
|
using Content.Shared.GameObjects.Components.Power.AME;
|
2019-07-30 23:13:05 +02:00
|
|
|
|
using Content.Shared.GameObjects.Components.Research;
|
2019-08-14 10:49:28 +02:00
|
|
|
|
using Content.Shared.GameObjects.Components.VendingMachines;
|
2020-05-01 23:34:04 -05:00
|
|
|
|
using Content.Shared.Kitchen;
|
2020-11-09 20:22:19 -08:00
|
|
|
|
using Content.Shared.Alert;
|
2020-04-13 22:27:47 +02:00
|
|
|
|
using Robust.Client;
|
2021-02-11 01:13:03 -08:00
|
|
|
|
using Robust.Client.Graphics;
|
|
|
|
|
|
using Robust.Client.Input;
|
2019-04-15 21:11:38 -06:00
|
|
|
|
using Robust.Client.Player;
|
2021-02-11 01:13:03 -08:00
|
|
|
|
using Robust.Client.State;
|
2019-04-15 21:11:38 -06:00
|
|
|
|
using Robust.Shared.ContentPack;
|
2021-02-11 01:13:03 -08:00
|
|
|
|
using Robust.Shared.GameObjects;
|
2019-04-15 21:11:38 -06:00
|
|
|
|
using Robust.Shared.IoC;
|
2020-01-18 01:54:13 +01:00
|
|
|
|
using Robust.Shared.Map;
|
2019-04-15 21:11:38 -06:00
|
|
|
|
using Robust.Shared.Prototypes;
|
2019-08-04 01:08:55 +02:00
|
|
|
|
using Robust.Shared.Timing;
|
2017-08-04 14:24:01 +02:00
|
|
|
|
|
|
|
|
|
|
namespace Content.Client
|
|
|
|
|
|
{
|
|
|
|
|
|
public class EntryPoint : GameClient
|
|
|
|
|
|
{
|
2020-08-24 14:10:28 +02:00
|
|
|
|
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
|
|
|
|
|
[Dependency] private readonly IBaseClient _baseClient = default!;
|
|
|
|
|
|
[Dependency] private readonly IEscapeMenuOwner _escapeMenuOwner = default!;
|
|
|
|
|
|
[Dependency] private readonly IGameController _gameController = default!;
|
|
|
|
|
|
[Dependency] private readonly IStateManager _stateManager = default!;
|
2019-04-29 12:53:09 +02:00
|
|
|
|
|
2017-08-04 14:24:01 +02:00
|
|
|
|
public override void Init()
|
|
|
|
|
|
{
|
2017-09-26 19:59:31 +02:00
|
|
|
|
var factory = IoCManager.Resolve<IComponentFactory>();
|
2018-08-02 08:29:55 +02:00
|
|
|
|
var prototypes = IoCManager.Resolve<IPrototypeManager>();
|
2017-09-26 19:59:31 +02:00
|
|
|
|
|
2019-07-31 15:02:36 +02:00
|
|
|
|
factory.DoAutoRegistrations();
|
2017-09-26 21:27:48 +02:00
|
|
|
|
|
2020-07-02 09:50:45 -04:00
|
|
|
|
foreach (var ignoreName in IgnoredComponents.List)
|
2019-07-31 15:02:36 +02:00
|
|
|
|
{
|
|
|
|
|
|
factory.RegisterIgnore(ignoreName);
|
|
|
|
|
|
}
|
2019-07-18 23:33:02 +02:00
|
|
|
|
|
2019-09-03 22:51:19 +02:00
|
|
|
|
factory.Register<SharedResearchConsoleComponent>();
|
2019-07-31 15:02:36 +02:00
|
|
|
|
factory.Register<SharedLatheComponent>();
|
|
|
|
|
|
factory.Register<SharedSpawnPointComponent>();
|
2019-08-14 10:49:28 +02:00
|
|
|
|
factory.Register<SharedVendingMachineComponent>();
|
2019-09-01 22:15:34 +02:00
|
|
|
|
factory.Register<SharedWiresComponent>();
|
2019-11-21 16:37:15 -08:00
|
|
|
|
factory.Register<SharedCargoConsoleComponent>();
|
Reagent dispensers (#360)
* Expose more private values of Solution and SolutionComponent
Expose SolutionComponent.ContainedSolution and Solution.Contents. Both needed by ReagentDispenserComponent.
* Implement IExamine for SolutionComponent
Allows players to see the contents of a solution by examining the entity which contains it.
* Implement ReagentDispenserComponent
Adds ReagentDispenserComponent. A component which can add or remove reagents from a solution container. It's written in a general way so that it can be used for things such as the Chemical dispensers in chemistry, but also the booze and soda dispensers in the bar.
The chemicals it may dispense are defined in yaml, similar to the way that vending machines define which entities they can dispense, by defining a reagent pack.
* Add chemical dispenser and equipment
Adds the chemical dispenser, beaker, large beaker, dropper, and a few more chemicals.
* Add booze and soda dispensers.
Adds the booze and soda dispensers, and a few chemicals for them to dispense. There's no drink mixing or drunkenness yet.
* Update engine submodule.
* Remove unneeded and commented out code
Had a few WIP notes and debug code bits I forgot to remove beforehand.
* Make SolutionComponent._containedSolution and it's values private again
- Remove `SolutionComponent.ContainedSolution` property, replace with specific access functions to maintain safety.
- Make Solution.Contents return a `ReadOnlyCollection` instead of `_contents` to prevent uncontrolled access to the Solution values.
- Add `SolutionComponent.RemoveAllSolution()`
* Update Content.Shared/Chemistry/Solution.cs
Commits a suggestion from RemieRichards to match the coding style of the rest of the codebase. Using `IReadOnlyList` instead of `IReadOnlyCollection`.
Co-Authored-By: Remie Richards <remierichards@gmail.com>
* Update Content.Shared/GameObjects/Components/Chemistry/SolutionComponent.cs
Commits a suggestion from RemieRichards to match the coding style of the rest of the codebase. Using `IReadOnlyList` instead of `IReadOnlyCollection`.
Co-Authored-By: Remie Richards <remierichards@gmail.com>
* Add import for IReadOnlyList to Shared/SolutionComponent.cs
* Add documentation
* Improve localization
Improve use of ILocalizationManager.
* Resolve ReagentDispenserWindow._localizationManager before using it
Forgot to do this in the last commit, resulting in a crash. Oops.
* Add SolutionCaps.FitsInDispenser. Use in ReagentDispenserComponent.
Used to limit large containers like buckets or mop buckets from being placed in a dispenser. Both have large capacities (500) and weren't designed to hold certain chemicals like a beaker is, so for now they can be blocked from being put in a dispenser by giving them that flag.
* Add colors to new reagents
* Update engine submodule
2019-10-05 09:10:05 -04:00
|
|
|
|
factory.Register<SharedReagentDispenserComponent>();
|
2020-07-17 15:41:19 -05:00
|
|
|
|
factory.Register<SharedChemMasterComponent>();
|
2020-05-01 23:34:04 -05:00
|
|
|
|
factory.Register<SharedMicrowaveComponent>();
|
2020-05-02 15:02:52 +01:00
|
|
|
|
factory.Register<SharedGravityGeneratorComponent>();
|
2020-08-29 06:05:44 -05:00
|
|
|
|
factory.Register<SharedAMEControllerComponent>();
|
2020-05-02 15:02:52 +01:00
|
|
|
|
|
2018-08-02 08:29:55 +02:00
|
|
|
|
prototypes.RegisterIgnore("material");
|
2019-10-11 16:57:16 -04:00
|
|
|
|
prototypes.RegisterIgnore("reaction"); //Chemical reactions only needed by server. Reactions checks are server-side.
|
Adds atmos (#1389)
* Add initial atmospherics framework
* Make walls and airlocks airtight
* Add the basic atmosphere gas system
* Atmos: move CardinalToIntVec and Offset into extention methods in EntityNetworkUtils
* Optimize vending machine code a bit.
* Address feedback from Atmos PR, make code compile
Fix use of OnMove -> SnapGridComponent.OnPositionChanged.
Added pause checking to atmos simulations.
* Improvements to the existing ZAS prototype (#996)
* Rename Volume -> Quantity in GasProperty
This makes the name consistent with the rest of the code, given that
it's meant to be a mol value.
* Replace Gas enum with GasPrototype
Unused as of yet, but laying the groundwork for future changes.
* Update AtmosphereMap, improving maths
Adds a temporary default atmosphere, hardcoded in for testing. It will
be replaced eventually.
Fixed a maths mistake in the original code involving unit conversions.
Added the Take() method to IAtmosphere, for taking some volume of
mixture out of a gas mix. This will be pretty handy in the future, but
for now it's used by walls to delete air where they are built.
* Fix merging, splitting logic for zones
Removing a cell from a zone now correctly reduces its volume.
Adding a cell to a zone now correctly increases its volume.
* Improvements to atmos code, reorganising of types
Moved GasPrototype to shared, because it's going to be used by the
client later.
Split up the atmosphere code. Now zones are explicitly their own kind of
atmosphere, which should speed up some loops and also solve
inconsistencies in the volume calculation.
GasMixtures are another type of atmosphere, for more general use.
Try to fix the splitting/merging code, which was quite cryptic and not
clear at all. It *should* work now.
* Switch zones back to MapIndices
Turns out I'm an idiot who misunderstood the code. MapIndices can be
used as one-per-tile, which is what is needed for atmos. GridCoordinates
are many-per-tile, and were causing lots of problems.
* Add zone debugging overlay
This is the first example of zone information being sent to a client.
It adds the `togglezoneinfo` command, which overlays the tiles and gas
information for the zone currently occupied by the user on the screen.
This was helpful for debugging the GridCoordinates problem.
* Fix position of atmos zone debug text
* Make AirtightComponent only activate on MapInit
This should stop it splitting atmospheres in mapping.
* Doc comments improvements to AtmosphereMap
Fix some malformed comments, inherit some useful docs, document some
more functions.
* Add zone logic for changing tiles to/from space
Zones are now correctly created when all the tiles in a room are built,
and destroyed when one of the tiles is destroyed.
* update engine
* right
* Cleanup code
* Port GasMixture, further cleanup
* Fix windows not being airtight, some other stuff
* Work on atmos
* Difference between ZoneBlocked and AirBlocked
* Big GridAtmosphereManager cleanup, zones are broken now oops
* Remove zones, add excited group implementation
* Further cleanup
* Further work on atmos
* Work on gas overlay.
* PumpGasTo and ReleaseGasTo methods for GasMixture.
* Adds Tile Overlay System.
* More work on atmos
* Gasses spread, equalize and all that
* Fix a few crashes
* Gas can actually spread from room to room after opening airlocks
* Add explosive depressurization, tile prying on depressurization, gas spreading on wall break. Etc.
* More work
* Remove atmoschem, add "performant" gas overlays
* what the fuck git
* More work I guess?
* Fix stuff, create a few (empty) components for future work
* Fix temperature
* Fix tile air sharing
* Atmos optimizations
* Further atmos optimizations
* Even more optimizations!
* Update Content.Client/GameObjects/EntitySystems/GasTileOverlaySystem.cs
Co-authored-by: Pieter-Jan Briers <pieterjan.briers@gmail.com>
* Update Content.Client/GameObjects/EntitySystems/GasTileOverlaySystem.cs
Co-authored-by: Pieter-Jan Briers <pieterjan.briers@gmail.com>
* Update Content.Client/GameObjects/EntitySystems/GasTileOverlaySystem.cs
Co-authored-by: Pieter-Jan Briers <pieterjan.briers@gmail.com>
* Address a few reviews
* Oops, forgot to remove this
* Update Content.Server/Atmos/AtmosphereMap.cs
Co-authored-by: Pieter-Jan Briers <pieterjan.briers@gmail.com>
* Fix compile
* Improved client gas tile overlays
* Less allocations
* Even less allocations!
* some stuff dunno
* Big refactor time, oh yeah
* it truly is 1 AM
* bruh
* No idea why now it doesn't work.
Oh well! I'll fix this on thursday :relieved:
* Basic atmos serialization
* Fix bugs, add VV attributes
* Start adding stuff for gas reactions
* Add a few atmos commands
* Fill gas command
* Changes to gas opacity
* Fixes I guess
* Fixes, add space wind sound
* High pressure movement!
* Better high pressure movements.
* Fix direction, maybe?
* And now it works great
* Science!
* and this is why you don't trust people
* remove logging
* Turns out I'm fucking dumb
* Work on hotspots and reactions, add tritium gas
* IGridAtmosphereComponent interface! For future unsimulated grids.
* Makes atmos updates NoGC.
* C E A S E
* Add settemp atmos command
* Important reminder.
* Remove useless AtmosCooldown.
* More work on hotspots
* Overlays for hotspots. Fire works!
* Turns out I suck at coding
* Fire texture change
* Yeah let's make that an absolute value, hmm?
* Support for atmos after teleporting grid (more or less)
* fix attempt (doesn't actually fix it)
* Make static variable not static
* Remove magic numbers
* Stopwatch moment
* Slight cleanup.
* More cleanup.
* Atmos optimizations
* Fix build
* Remove useless ghost atmos shit
* Adds CanSeeGases component for gas overlay stuff
* Component and prototype ignores
* ExcitedGroups now dispose on being merged with others
* Some tweaking.
* Atmos now uses frame time for updates.
* Nullable boogaloo
* IExamine fix
* Fix build
* Fix restartround
* Atmos tweaking, use invalid direction
* Increase high pressure movement force
* Better sort
* Update submodule.
* NULLABILITY AAAAH
Special thanks to monster860 and all monstermos contributors!
Co-authored-by: Campbell Suter <znix@znix.xyz>
Co-authored-by: Pieter-Jan Briers <pieterjan.briers+git@gmail.com>
Co-authored-by: ComicIronic <comicironic@gmail.com>
Co-authored-by: silicons <2003111+silicons@users.noreply.github.com>
Co-authored-by: Pieter-Jan Briers <pieterjan.briers@gmail.com>
2020-08-02 20:08:20 +02:00
|
|
|
|
prototypes.RegisterIgnore("gasReaction");
|
2020-10-27 00:10:38 +01:00
|
|
|
|
prototypes.RegisterIgnore("seed"); // Seeds prototypes are server-only.
|
2020-04-23 00:58:43 +02:00
|
|
|
|
prototypes.RegisterIgnore("barSign");
|
2020-11-22 08:38:07 +01:00
|
|
|
|
prototypes.RegisterIgnore("objective");
|
2021-02-12 10:55:45 +01:00
|
|
|
|
prototypes.RegisterIgnore("holiday");
|
2018-08-16 15:57:11 -07:00
|
|
|
|
|
2019-11-23 15:55:31 -05:00
|
|
|
|
ClientContentIoC.Register();
|
2019-10-02 10:45:06 +02:00
|
|
|
|
|
2020-10-29 17:50:25 +01:00
|
|
|
|
foreach (var callback in TestingCallbacks)
|
2019-06-29 01:58:16 +02:00
|
|
|
|
{
|
2020-10-29 17:50:25 +01:00
|
|
|
|
var cast = (ClientModuleTestingCallbacks) callback;
|
2019-06-29 01:58:16 +02:00
|
|
|
|
cast.ClientBeforeIoC?.Invoke();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2018-11-21 21:11:30 +01:00
|
|
|
|
IoCManager.BuildGraph();
|
2018-11-30 21:54:30 +01:00
|
|
|
|
|
2020-10-30 16:06:48 +01:00
|
|
|
|
IoCManager.Resolve<IClientAdminManager>().Initialize();
|
2018-11-30 21:54:30 +01:00
|
|
|
|
IoCManager.Resolve<IParallaxManager>().LoadParallax();
|
2018-12-13 07:47:19 -06:00
|
|
|
|
IoCManager.Resolve<IBaseClient>().PlayerJoinedServer += SubscribePlayerAttachmentEvents;
|
2020-04-04 15:10:51 +02:00
|
|
|
|
IoCManager.Resolve<IStylesheetManager>().Initialize();
|
2020-04-30 12:45:21 +02:00
|
|
|
|
IoCManager.Resolve<IScreenshotHook>().Initialize();
|
2019-04-29 12:53:09 +02:00
|
|
|
|
|
|
|
|
|
|
IoCManager.InjectDependencies(this);
|
2018-12-13 07:47:19 -06:00
|
|
|
|
|
2019-05-14 15:19:41 +02:00
|
|
|
|
_escapeMenuOwner.Initialize();
|
2019-12-06 00:41:30 +01:00
|
|
|
|
|
2020-01-20 00:36:34 -08:00
|
|
|
|
_baseClient.PlayerJoinedServer += (sender, args) =>
|
|
|
|
|
|
{
|
|
|
|
|
|
IoCManager.Resolve<IMapManager>().CreateNewMapEntity(MapId.Nullspace);
|
|
|
|
|
|
};
|
2019-05-14 15:19:41 +02:00
|
|
|
|
}
|
2019-07-31 15:02:36 +02:00
|
|
|
|
|
2018-12-13 07:47:19 -06:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Subscribe events to the player manager after the player manager is set up
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
|
/// <param name="args"></param>
|
|
|
|
|
|
public void SubscribePlayerAttachmentEvents(object sender, EventArgs args)
|
|
|
|
|
|
{
|
2019-04-29 12:53:09 +02:00
|
|
|
|
_playerManager.LocalPlayer.EntityAttached += AttachPlayerToEntity;
|
|
|
|
|
|
_playerManager.LocalPlayer.EntityDetached += DetachPlayerFromEntity;
|
2018-12-13 07:47:19 -06:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Add the character interface master which combines all character interfaces into one window
|
|
|
|
|
|
/// </summary>
|
2019-04-29 12:53:09 +02:00
|
|
|
|
public static void AttachPlayerToEntity(EntityAttachedEventArgs eventArgs)
|
2018-12-13 07:47:19 -06:00
|
|
|
|
{
|
2019-04-29 12:53:09 +02:00
|
|
|
|
eventArgs.NewEntity.AddComponent<CharacterInterface>();
|
2018-12-13 07:47:19 -06:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Remove the character interface master from this entity now that we have detached ourselves from it
|
|
|
|
|
|
/// </summary>
|
2019-04-29 12:53:09 +02:00
|
|
|
|
public static void DetachPlayerFromEntity(EntityDetachedEventArgs eventArgs)
|
2018-12-13 07:47:19 -06:00
|
|
|
|
{
|
2020-07-03 23:26:30 +02:00
|
|
|
|
if (!eventArgs.OldEntity.Deleted)
|
|
|
|
|
|
{
|
|
|
|
|
|
eventArgs.OldEntity.RemoveComponent<CharacterInterface>();
|
|
|
|
|
|
}
|
2018-08-16 15:57:11 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override void PostInit()
|
|
|
|
|
|
{
|
|
|
|
|
|
base.PostInit();
|
|
|
|
|
|
|
|
|
|
|
|
// Setup key contexts
|
|
|
|
|
|
var inputMan = IoCManager.Resolve<IInputManager>();
|
|
|
|
|
|
ContentContexts.SetupContexts(inputMan.Contexts);
|
2018-11-21 21:11:30 +01:00
|
|
|
|
|
2019-07-15 18:57:17 +02:00
|
|
|
|
IoCManager.Resolve<IGameHud>().Initialize();
|
2018-11-21 21:11:30 +01:00
|
|
|
|
IoCManager.Resolve<IClientNotifyManager>().Initialize();
|
2018-11-25 19:04:49 +01:00
|
|
|
|
IoCManager.Resolve<IClientGameTicker>().Initialize();
|
2021-01-24 08:17:45 +00:00
|
|
|
|
var overlayMgr = IoCManager.Resolve<IOverlayManager>();
|
|
|
|
|
|
overlayMgr.AddOverlay(new ParallaxOverlay());
|
|
|
|
|
|
overlayMgr.AddOverlay(new GradientCircleMaskOverlay());
|
|
|
|
|
|
overlayMgr.AddOverlay(new CircleMaskOverlay());
|
|
|
|
|
|
overlayMgr.AddOverlay(new FlashOverlay());
|
|
|
|
|
|
overlayMgr.AddOverlay(new RadiationPulseOverlay());
|
2019-04-13 09:45:09 +02:00
|
|
|
|
IoCManager.Resolve<IChatManager>().Initialize();
|
2019-10-02 10:45:06 +02:00
|
|
|
|
IoCManager.Resolve<ISandboxManager>().Initialize();
|
2019-12-22 13:47:34 +01:00
|
|
|
|
IoCManager.Resolve<IClientPreferencesManager>().Initialize();
|
2020-08-18 14:29:13 +02:00
|
|
|
|
IoCManager.Resolve<IStationEventManager>().Initialize();
|
2020-08-25 17:18:32 +02:00
|
|
|
|
IoCManager.Resolve<IAdminMenuManager>().Initialize();
|
2020-11-10 16:50:28 +01:00
|
|
|
|
IoCManager.Resolve<EuiManager>().Initialize();
|
2020-11-09 20:22:19 -08:00
|
|
|
|
IoCManager.Resolve<AlertManager>().Initialize();
|
2020-12-13 14:28:20 -08:00
|
|
|
|
IoCManager.Resolve<ActionManager>().Initialize();
|
2021-02-16 15:07:17 +01:00
|
|
|
|
IoCManager.Resolve<IVoteManager>().Initialize();
|
2020-04-04 15:11:28 +02:00
|
|
|
|
|
2020-04-13 22:27:47 +02:00
|
|
|
|
_baseClient.RunLevelChanged += (sender, args) =>
|
|
|
|
|
|
{
|
|
|
|
|
|
if (args.NewLevel == ClientRunLevel.Initialize)
|
|
|
|
|
|
{
|
2020-04-17 14:44:33 +02:00
|
|
|
|
SwitchToDefaultState(args.OldLevel == ClientRunLevel.Connected ||
|
|
|
|
|
|
args.OldLevel == ClientRunLevel.InGame);
|
2020-04-13 22:27:47 +02:00
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2020-04-17 14:44:33 +02:00
|
|
|
|
SwitchToDefaultState();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void SwitchToDefaultState(bool disconnected = false)
|
|
|
|
|
|
{
|
2020-04-04 15:11:28 +02:00
|
|
|
|
// Fire off into state dependent on launcher or not.
|
2020-04-17 14:44:33 +02:00
|
|
|
|
|
2020-04-04 15:11:28 +02:00
|
|
|
|
if (_gameController.LaunchState.FromLauncher)
|
|
|
|
|
|
{
|
|
|
|
|
|
_stateManager.RequestStateChange<LauncherConnecting>();
|
2020-04-17 14:44:33 +02:00
|
|
|
|
var state = (LauncherConnecting) _stateManager.CurrentState;
|
|
|
|
|
|
|
|
|
|
|
|
if (disconnected)
|
|
|
|
|
|
{
|
|
|
|
|
|
state.SetDisconnected();
|
|
|
|
|
|
}
|
2020-04-04 15:11:28 +02:00
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
_stateManager.RequestStateChange<MainScreen>();
|
|
|
|
|
|
}
|
2018-11-21 21:11:30 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
2019-08-04 01:08:55 +02:00
|
|
|
|
public override void Update(ModUpdateLevel level, FrameEventArgs frameEventArgs)
|
2018-11-21 21:11:30 +01:00
|
|
|
|
{
|
2019-08-04 01:08:55 +02:00
|
|
|
|
base.Update(level, frameEventArgs);
|
2018-11-21 21:11:30 +01:00
|
|
|
|
|
|
|
|
|
|
switch (level)
|
|
|
|
|
|
{
|
2019-06-04 19:08:15 +02:00
|
|
|
|
case ModUpdateLevel.FramePreEngine:
|
2019-08-04 01:08:55 +02:00
|
|
|
|
IoCManager.Resolve<IClientNotifyManager>().FrameUpdate(frameEventArgs);
|
|
|
|
|
|
IoCManager.Resolve<IChatManager>().FrameUpdate(frameEventArgs);
|
2018-11-21 21:11:30 +01:00
|
|
|
|
break;
|
|
|
|
|
|
}
|
2017-08-04 14:24:01 +02:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|