private CameraRecoilSystem(IEntityManager entityManager) : base(entityManager) { _log = Logger.GetSawmill($"ecs.systems.{nameof(CameraRecoilSystem)}"); SubscribeNetworkEvent <CameraKickEvent>(HandleCameraKick); }
public override void Initialize() { Sawmill = Logger.GetSawmill("gun"); Sawmill.Level = LogLevel.Info; SubscribeLocalEvent <GunComponent, ComponentGetState>(OnGetState); SubscribeAllEvent <RequestShootEvent>(OnShootRequest); SubscribeAllEvent <RequestStopShootEvent>(OnStopShootRequest); SubscribeLocalEvent <GunComponent, ComponentHandleState>(OnHandleState); SubscribeLocalEvent <GunComponent, MeleeAttackAttemptEvent>(OnGunMeleeAttempt); // Ammo providers InitializeBallistic(); InitializeBattery(); InitializeCartridge(); InitializeChamberMagazine(); InitializeMagazine(); InitializeRevolver(); InitializeBasicEntity(); // Interactions SubscribeLocalEvent <GunComponent, GetVerbsEvent <AlternativeVerb> >(OnAltVerb); SubscribeLocalEvent <GunComponent, ExaminedEvent>(OnExamine); SubscribeLocalEvent <GunComponent, CycleModeEvent>(OnCycleMode); SubscribeLocalEvent <GunComponent, ComponentInit>(OnGunInit); }
public ManagedHttpListenerMetricsServer(ISawmill sawmill, string host, int port, string url = "metrics/", CollectorRegistry?registry = null) : base(registry) { _sawmill = sawmill; _listener = new HttpListener(); _listener.Prefixes.Add($"http://{host}:{port}/{url}"); }
public AlertsFramePresenter() { // This is a lot easier than a factory IoCManager.InjectDependencies(this); _logger = _logMan.GetSawmill("alerts"); _logger.Info("Constructor"); _alertsFrame = new AlertsUI(_chatManager); _userInterfaceManager.StateRoot.AddChild((AlertsUI)_alertsFrame); // This is required so that if we load after the system is initialized, we can bind to it immediately if (_systemManager.TryGetEntitySystem <ClientAlertsSystem>(out var alertsSystem)) { SystemBindingChanged(alertsSystem); } _systemManager.SystemLoaded += OnSystemLoaded; _systemManager.SystemUnloaded += OnSystemUnloaded; _alertsFrame.AlertPressed += OnAlertPressed; // initially populate the frame if system is available var alerts = alertsSystem?.ActiveAlerts; if (alerts != null) { SystemOnSyncAlerts(alertsSystem, alerts); } }
public static Image <Rgba32> GenerateParallax(TomlTable config, Size size, ISawmill sawmill, List <Image <Rgba32> > debugLayerDump) { sawmill.Debug("Generating parallax!"); var generator = new ParallaxGenerator(); generator._loadConfig(config); sawmill.Debug("Timing start!"); var sw = new Stopwatch(); sw.Start(); var image = new Image <Rgba32>(Configuration.Default, size.Width, size.Height, new Rgba32(0, 0, 0, 255)); var count = 0; foreach (var layer in generator.Layers) { layer.Apply(image); debugLayerDump?.Add(image.Clone()); sawmill.Debug("Layer {0} done!", count++); } sw.Stop(); sawmill.Debug("Total time: {0}", sw.Elapsed.TotalSeconds); return(image); }
public GlfwWindowingImpl(Clyde clyde) { _clyde = clyde; IoCManager.InjectDependencies(this); _sawmill = _logManager.GetSawmill("clyde.win"); _sawmillGlfw = _logManager.GetSawmill("clyde.win.glfw"); }
public override void Initialize() { base.Initialize(); _sawmill = Logger.GetSawmill("thirst"); SubscribeLocalEvent <ThirstComponent, RefreshMovementSpeedModifiersEvent>(OnRefreshMovespeed); SubscribeLocalEvent <ThirstComponent, ComponentStartup>(OnComponentStartup); }
public override void Initialize() { base.Initialize(); _sawmill = Logger.GetSawmill("cargo"); InitializeConsole(); InitializeShuttle(); InitializeTelepad(); SubscribeLocalEvent <StationInitializedEvent>(OnStationInit); }
/// <inheritdoc /> public override void Initialize() { base.Initialize(); _sawmill = Logger.GetSawmill("npc"); InitializeUtility(); SubscribeLocalEvent <NPCComponent, MobStateChangedEvent>(OnMobStateChange); SubscribeLocalEvent <NPCComponent, ComponentInit>(OnNPCInit); SubscribeLocalEvent <NPCComponent, ComponentShutdown>(OnNPCShutdown); _configurationManager.OnValueChanged(CCVars.NPCEnabled, SetEnabled, true); _configurationManager.OnValueChanged(CCVars.NPCMaxUpdates, SetMaxUpdates, true); }
public override void Initialize() { base.Initialize(); _sawmill = Logger.GetSawmill("basicevents"); // Can't just check debug / release for a default given mappers need to use release mode // As such we'll always pause it by default. _configurationManager.OnValueChanged(CCVars.EventsEnabled, value => RuleAdded = value, true); SubscribeLocalEvent <RoundRestartCleanupEvent>(Reset); }
public void Initialize() { LogSzr = Logger.GetSawmill("szr"); _dict = new MappedStringDict(LogSzr); if (_net.IsClient) { // Client cannot make its own string dictionary, lock immediately. _dict.Locked = true; } NetworkInitialize(); }
public override void Initialize() { base.Initialize(); _sawmill = _logManager.GetSawmill(SawmillName); InitializeGraphs(); InitializeGuided(); InitializeInteractions(); InitializeInitial(); SubscribeLocalEvent <ConstructionComponent, ComponentInit>(OnConstructionInit); SubscribeLocalEvent <ConstructionComponent, ComponentStartup>(OnConstructionStartup); }
public bool InitializePreWindowing() { _sawmillOgl = Logger.GetSawmill("clyde.ogl"); _cfg.OnValueChanged(CVars.DisplayOGLCheckErrors, b => _checkGLErrors = b, true); _cfg.OnValueChanged(CVars.DisplayVSync, VSyncChanged, true); _cfg.OnValueChanged(CVars.DisplayWindowMode, WindowModeChanged, true); _cfg.OnValueChanged(CVars.DisplayLightMapDivider, LightmapDividerChanged, true); _cfg.OnValueChanged(CVars.DisplayMaxLightsPerScene, MaxLightsPerSceneChanged, true); _cfg.OnValueChanged(CVars.DisplaySoftShadows, SoftShadowsChanged, true); // I can't be bothered to tear down and set these threads up in a cvar change handler. _threadWindowBlit = _cfg.GetCVar(CVars.DisplayThreadWindowBlit); return(InitWindowing()); }
public override void Initialize() { base.Initialize(); _sawmill = _logManager.GetSawmill(SawmillName); InitializeGraphs(); InitializeSteps(); InitializeInitial(); SubscribeLocalEvent <ConstructionComponent, ComponentInit>(OnConstructionInit); SubscribeLocalEvent <ConstructionComponent, ComponentStartup>(OnConstructionStartup); SubscribeLocalEvent <ConstructionComponent, GetOtherVerbsEvent>(AddDeconstructVerb); SubscribeLocalEvent <ConstructionComponent, ExaminedEvent>(HandleConstructionExamined); }
public override void Initialize() { base.Initialize(); _sawmill = Logger.GetSawmill("docking"); SubscribeLocalEvent <DockingComponent, ComponentStartup>(OnStartup); SubscribeLocalEvent <DockingComponent, ComponentShutdown>(OnShutdown); SubscribeLocalEvent <DockingComponent, AnchorStateChangedEvent>(OnAnchorChange); SubscribeLocalEvent <DockingComponent, ReAnchorEvent>(OnDockingReAnchor); SubscribeLocalEvent <DockingComponent, BeforeDoorAutoCloseEvent>(OnAutoClose); // Yes this isn't in shuttle console; it may be used by other systems technically. // in which case I would also add their subs here. SubscribeLocalEvent <ShuttleConsoleComponent, AutodockRequestMessage>(OnRequestAutodock); SubscribeLocalEvent <ShuttleConsoleComponent, StopAutodockRequestMessage>(OnRequestStopAutodock); SubscribeLocalEvent <ShuttleConsoleComponent, UndockRequestMessage>(OnRequestUndock); }
public static Image <Rgba32> GenerateParallax(TomlTable config, Size size, ISawmill sawmill) { sawmill.Debug("Generating parallax!"); var generator = new ParallaxGenerator(); generator._loadConfig(config); var image = new Image <Rgba32>(Configuration.Default, size.Width, size.Height, Rgba32.Black); var count = 0; foreach (var layer in generator.Layers) { layer.Apply(image); sawmill.Debug("Layer {0} done!", count++); } return(image); }
public override void Initialize() { base.Initialize(); _sawmill = Logger.GetSawmill("shuttles"); InitializeEmergencyConsole(); InitializeEscape(); InitializeFTL(); SubscribeLocalEvent <ShuttleComponent, ComponentAdd>(OnShuttleAdd); SubscribeLocalEvent <ShuttleComponent, ComponentStartup>(OnShuttleStartup); SubscribeLocalEvent <ShuttleComponent, ComponentShutdown>(OnShuttleShutdown); SubscribeLocalEvent <RoundRestartCleanupEvent>(OnRoundRestart); SubscribeLocalEvent <GridInitializeEvent>(OnGridInit); SubscribeLocalEvent <GridFixtureChangeEvent>(OnGridFixtureChange); }
public override void Initialize() { base.Initialize(); DebugTools.Assert(!_initialized); DebugTools.Assert(!_postInitialized); _sawmill = _logManager.GetSawmill("ticker"); // Initialize the other parts of the game ticker. InitializeStatusShell(); InitializeCVars(); InitializePlayer(); InitializeLobbyMusic(); InitializeGamePreset(); InitializeJobController(); InitializeUpdates(); _initialized = true; }
private void InitializeFluidsynth() { if (FluidsynthInitialized || _failedInitialize) { return; } try { _loggerDelegate = LoggerDelegate; _sawmill = Logger.GetSawmill("midi.fluidsynth"); NFluidsynth.Logger.SetLoggerMethod(_loggerDelegate); // Will cause a safe DllNotFoundException if not available. _settings = new Settings(); _settings["synth.sample-rate"].DoubleValue = 44100; _settings["player.timing-source"].StringValue = "sample"; _settings["synth.lock-memory"].IntValue = 0; _settings["synth.threadsafe-api"].IntValue = 1; _settings["synth.gain"].DoubleValue = 1.0d; _settings["audio.driver"].StringValue = "file"; _settings["midi.autoconnect"].IntValue = 1; _settings["player.reset-synth"].IntValue = 0; _settings["synth.midi-bank-select"].StringValue = "gm"; } catch (Exception e) { Logger.WarningS("midi", "Failed to initialize fluidsynth due to exception, disabling MIDI support:\n{0}", e); _failedInitialize = true; return; } _midiThread = new Thread(ThreadUpdate); _midiThread.Start(); _midiSawmill = IoCManager.Resolve <ILogManager>().GetSawmill("midi"); _soundfontLoaderCallbacks = new ResourceLoaderCallbacks(); FluidsynthInitialized = true; }
public override void Initialize() { base.Initialize(); DebugTools.Assert(!_initialized); DebugTools.Assert(!_postInitialized); _sawmill = _logManager.GetSawmill("ticker"); // Initialize the other parts of the game ticker. InitializeStatusShell(); InitializeCVars(); InitializePlayer(); InitializeLobbyMusic(); InitializeLobbyBackground(); InitializeGamePreset(); DebugTools.Assert(_prototypeManager.Index <JobPrototype>(FallbackOverflowJob).Name == FallbackOverflowJobName, "Overflow role does not have the correct name!"); InitializeGameRules(); _initialized = true; }
public MSLogger(ISawmill sawmill) { _sawmill = sawmill; }
public void PostInject() { _sawmill = _logManager.GetSawmill(SawmillId); }
private void PreloadTextures(ISawmill sawmill) { sawmill.Debug("Preloading textures..."); var sw = Stopwatch.StartNew(); var resList = GetTypeDict <TextureResource>(); var texList = ContentFindFiles("/Textures/") // Skip PNG files inside RSIs. .Where(p => p.Extension == "png" && !p.ToString().Contains(".rsi/") && !resList.ContainsKey(p)) .Select(p => new TextureResource.LoadStepData { Path = p }) .ToArray(); Parallel.ForEach(texList, data => { try { TextureResource.LoadPreTexture(this, data); } catch (Exception e) { // Mark failed loads as bad and skip them in the next few stages. // Avoids any silly array resizing or similar. sawmill.Error($"Exception while loading RSI {data.Path}:\n{e}"); data.Bad = true; } }); foreach (var data in texList) { if (data.Bad) { continue; } try { TextureResource.LoadTexture(_clyde, data); } catch (Exception e) { sawmill.Error($"Exception while loading RSI {data.Path}:\n{e}"); data.Bad = true; } } var errors = 0; foreach (var data in texList) { if (data.Bad) { errors += 1; continue; } try { var texResource = new TextureResource(); texResource.LoadFinish(this, data); resList[data.Path] = texResource; } catch (Exception e) { sawmill.Error($"Exception while loading RSI {data.Path}:\n{e}"); data.Bad = true; errors += 1; } } sawmill.Debug( "Preloaded {CountLoaded} textures ({CountErrored} errored) in {LoadTime}", texList.Length, errors, sw.Elapsed); }
internal static void PrintRuntimeInfo(ISawmill sawmill) { sawmill.Debug($"Runtime: {RuntimeInformation.FrameworkDescription} {RuntimeInformation.RuntimeIdentifier}"); sawmill.Debug($"OS: {RuntimeInformation.OSDescription} {RuntimeInformation.OSArchitecture}"); }
public NativeLogger(ISawmill sawmill) { _sawmill = sawmill; }
public MappedStringDict(ISawmill sawmill) { _sawmill = sawmill; }
public override void Initialize() { base.Initialize(); _log = Logger.GetSawmill($"ecs.systems.{nameof(SharedCameraRecoilSystem)}"); }
/// <summary> /// Creates a new instance of <see cref="ConGroupContainer" /> . /// </summary> /// <param name="resMan">ResourceManager to use for file I/O.</param> /// <param name="logger">Sawmill to use for logging messages.</param> public ConGroupContainer(IResourceManager resMan, ISawmill logger) { _resMan = resMan; _logger = logger; }
public override void Initialize() { base.Initialize(); Sawmill = Logger.GetSawmill("stationevents"); }
/// <summary> /// Constructor. /// </summary> /// <param name="directory">Directory to mount.</param> /// <param name="sawmill"></param> public DirLoader(DirectoryInfo directory, ISawmill sawmill) { _directory = directory; _sawmill = sawmill; }