public void UpdateCallback(InitializeEvent @event) { //In the event that this is called twice, do *not* reload our config. if (ModConfig != null) { return; } //Our config file will live inside our mod's folder. var configLocation = Path.Combine(PathOnDisk, "Config.json"); //If the file doesn't exist, create it. if (!File.Exists(configLocation)) { Console.WriteLine("The config file for MeadMod was not found, attempting creation..."); Config c = new Config(); c.EnablePlugin = true; File.WriteAllBytes(configLocation, Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(c))); } //Once we are sure the file exists, load it. ModConfig = JsonConvert.DeserializeObject <Config>(Encoding.UTF8.GetString(File.ReadAllBytes(configLocation))); Console.WriteLine("The config file for MeadMod has been loaded."); Console.WriteLine("\tEnablePlugin: " + ModConfig.EnablePlugin); //Possibly do other stuff, then alert that we are done. Console.WriteLine("MeadMod Initialization Completed"); }
void OnStartRun(InitializeEvent e) { _maxSpeed = 0; _startTime = Time.time; _jumpCount = 0; _frames = 0; }
public void InitializeCallback(InitializeEvent @event) { FreezeInsideConfig = new ModConfig(); FreezeInsideConfig = (ModConfig)Config.InitializeConfig(PathOnDisk + "\\Config.json", FreezeInsideConfig); /* * var configLocation = Path.Combine(PathOnDisk, "Config.json"); * if (!File.Exists(configLocation)) * { * Console.WriteLine("The config file for FreezeInside was not found, attempting creation..."); * ModConfig = new Config(); * ModConfig.FreezeTimeInMines = false; * ModConfig.LetMachinesRunWhileTimeFrozen = true; * File.WriteAllBytes(configLocation, Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(ModConfig, Formatting.Indented))); * Console.WriteLine("The config file for FreezeInside has been loaded. \n\tFreezeTimeInMines: {0}, LetMachinesRunWhileTimeFrozen: {1}", * ModConfig.FreezeTimeInMines, ModConfig.LetMachinesRunWhileTimeFrozen); * } * else * { * ModConfig = JsonConvert.DeserializeObject<Config>(Encoding.UTF8.GetString(File.ReadAllBytes(configLocation))); * Console.WriteLine("The config file for FreezeInside has been loaded.\n\tFreezeTimeInMines: {0}, LetMachinesRunWhileTimeFrozen: {1}", * ModConfig.FreezeTimeInMines, ModConfig.LetMachinesRunWhileTimeFrozen); * } * * Console.WriteLine("FreezeInside Initialization Completed"); */ Console.WriteLine("The config file for FreezeInside has been loaded. \n\tFreezeTimeInMines: {0}, LetMachinesRunWhileTimeFrozen: {1}", FreezeInsideConfig.FreezeTimeInMines, FreezeInsideConfig.LetMachinesRunWhileTimeFrozen); Console.WriteLine("FreezeInside Initialization Completed"); }
public async Task HandleAsync(DomainCommandContext context, InitializeCommand command) { var applicationSettings = await _applicationSettingsRepository.LoadAsync(); var games = await _gameRepository.LoadAllAsync(); var gameProfileId = await _gameRepository.LoadGameProfileIdAsync(); var textureManagementSettings = await _textureManagementSettingsRepository.LoadAsync(); var usageStatistics = await _usageStatisticsRepository.LoadAsync(); var @event = new InitializeEvent( applicationSettings.Map <ApplicationSettings>(), games.Map <IEnumerable <Game> >(), gameProfileId?.Value, textureManagementSettings.Map <TextureManagementSettings>(), usageStatistics.Map <SharedModel.UsageStatistics>()); foreach (var settings in games) { await _processWatcher.WatchAsync(settings.Id); } await context.PublishAsync(@event); }
public void InitializeCallback(InitializeEvent @event) { ModConfig = new Config(this); menuKey = (Keys)Enum.Parse(typeof(Keys), ModConfig.menuKey.ToUpper()); waitMenu = new WaitMenu(@event.Root, this); this.Root = @event.Root; Console.WriteLine("WaitAround Initialization Completed"); }
public static DetourEvent InitializeCallback(StaticContextAccessor accesor) { WrappedGame.Version += ", " + AssemblyInfo.NICE_VERSION; WrappedGame.Version += ", mods loaded: " + EventBus.mods.Count; WrappedGame.Window.Title = "Stardew Valley - Version " + WrappedGame.Version; Logging.DebugLog("Game Initialized"); var @event = new InitializeEvent(); FireEvent(@event); return(@event); }
// Use this for initialization void Start() { currentSceneNumber = 1; isDuringTransition = false; currentTransitionType = TransitionType.None; distanceFromAdjustedCameraPositionThreshold = 0.2f; afterAnimationCoroutineIsRunning = false; oldAnimator = animator; InitializeEvent?.Invoke(); //StartCoroutine(AdjustCameraRigAndUserHeight()); }
public RenderWindow( MouseButtonEvent mouseButtonEvent = null, RenderEvent renderEvent = null, SysCommandEvent sysCommandEvent = null, ResizeEvent resizeEvent = null, CloseEvent closeEvent = null, InitializeEvent initializeEvent = null, CreateEvent createEvent = null) { _mouseButtonEvent = mouseButtonEvent; _renderEvent = renderEvent; _sysCommandEvent = sysCommandEvent; _resizeEvent = resizeEvent; _closeEvent = closeEvent; _initializeEvent = initializeEvent; _createEvent = createEvent; }
public void InitializeCallback(InitializeEvent @event) { TConfig = new TestConfig(); //THIS IS REQUIRED //Initializes the config class, loading an existing config or generating a new one. //GetBasePath will return a string to the DLL's folder plus "Config.json", so that the config file is next to the DLL. //This should be used unless a modder specifically wants to initialize a config in anoter location. TConfig = (TestConfig)Config.InitializeConfig(Config.GetBasePath(this), TConfig); //BASE JSON OUTPUT AFTER RUNNING THE FIRST TIME: /* * { * "AnExampleField": "DefaultValue", * "WillIDoSomething": false, * "MoveSpeedOrSomething": 5 * } */ //SECOND RUN - NOTHING CHANGED - THE FILE IS ONLY UPDATED IF THINGS ARE ADDED/REMOVED IN THE CLASS (OR THE FILE IS INVALID) /* * { * "AnExampleField": "DefaultValue", * "WillIDoSomething": false, * "MoveSpeedOrSomething": 5, * } */ //NOW A USER CHANGES THE BOOL TO TRUE AND RUNS IT AGAIN. OUTPUT: /* * { * "AnExampleField": "DefaultValue", * "WillIDoSomething": true, //ONLY THIS CHANGED, BECAUSE OF THE USER - THE FILE RETAINS ITS STATE * "MoveSpeedOrSomething": 5, * } */ //If an invalid value appears in any field, the JSON file will be renamed and the user will be notified. //If a value is removed from the inherited config class, it will be stripped from the JSON on the next load. //If a value is added to the inherited config class, it will be added to the JSON on the next load. }
void OnInitialize(InitializeEvent e) { _initialized = true; _haveLaunchedTuto = G.Sys.dataMaster.PlayTuto; var prefab = G.Sys.dataMaster.PlayTuto ? startTutoPrefab : startChunkPrefab; var data = GetDataFromChunk(prefab); var chunk = Instantiate(prefab); chunk.transform.position = new Vector3(0, chunk.transform.FindChild("Start").transform.position.y, 0); chunk.transform.Rotate(0, -data.startRotation, 0); _chunks.Add(new Chunk(chunk, data, -data.startRotation, false)); while (_chunks[_chunks.Count - 1].gameObject.transform.position.y - _chunks[_chunks.Count - 1].datas.height > e.pos.y - distanceToLoadChunk) { addChunk(); } }
public void InitializeCallback(InitializeEvent @event) { var configLocation = Path.Combine(ParentPathOnDisk, "BerryBoostConfig.json"); if (!File.Exists(configLocation)) { ModConfig = new Config(); ModConfig.EnableJojaCola = false; File.WriteAllBytes(configLocation, Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(ModConfig))); Console.WriteLine("The config file for BerryBoost has been loaded.\n\tJojaCola Enabled: {0}", ModConfig.EnableJojaCola); } else { ModConfig = JsonConvert.DeserializeObject <Config>(Encoding.UTF8.GetString(File.ReadAllBytes(configLocation))); Console.WriteLine("The config file for BerryBoost has been loaded.\n\tJojaCola Enabled: {0}", ModConfig.EnableJojaCola); } Console.WriteLine("BerryBoost v0.02 initialized."); }
//Credit goes to Zoryn for pieces of this config generation that I kinda repurposed. public void InitializeCallback(InitializeEvent @event) { var configLocation = Path.Combine(PathOnDisk, "BuildEnduranceConfig.json"); if (!File.Exists(configLocation)) { Logging.LogToFile("The config file for BuildEndurance was not found, guess I'll create it..."); ModConfig = new Config(); ModConfig.BuildEndurance_current_lvl = 0; ModConfig.BuildEndurance_max_lvl = 100; ModConfig.BuildEndurance_stam_increase_upon_lvl_up = 1; ModConfig.BuildEndurance_xp_current = 0; ModConfig.BuildEndurance_xp_nextlvl = 20; ModConfig.BuildEndurance_xp_curve = 1.15; ModConfig.BuildEndurance_xp_eating = 2; ModConfig.BuildEndurance_xp_sleeping = 10; ModConfig.BuildEndurance_xp_tooluse = 1; ModConfig.BuildEndurance_ini_stam_boost = 0; ModConfig.BuildEndurance_stam_accumulated = 0; File.WriteAllBytes(configLocation, Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(ModConfig))); // Console.WriteLine("The config file for MoreRain has been loaded.\n\t RainChance: {0}, ThunderChance: {1}", // ModConfig.RainChance, ModConfig.ThunderChance); } else { ModConfig = JsonConvert.DeserializeObject <Config>(Encoding.UTF8.GetString(File.ReadAllBytes(configLocation))); Logging.LogToFile("Found BuildEndurance config file."); } DataLoader(); MyWritter(); Logging.LogToFile("BuildEndurance Initialization Completed"); }
public void init(InitializeEvent @event) { locs = new NPCMenu(@event.Root); NConfig = new NPCLocationConfig(); NConfig = (NPCLocationConfig)Config.InitializeConfig(Config.GetBasePath(this), NConfig); if (Enum.IsDefined(typeof(Keys), NConfig.KeyboardKey.ToUpper())) { openKey = (Keys)Enum.Parse(typeof(Keys), NConfig.KeyboardKey.ToUpper()); } else { openKey = Keys.Z; } if (Enum.IsDefined(typeof(Buttons), NConfig.ButtonKey)) { openButton = (Buttons)Enum.Parse(typeof(Buttons), NConfig.ButtonKey); } else { openButton = Buttons.LeftShoulder; } }
//Credit goes to Zoryn for pieces of this config generation that I kinda repurposed. public void InitializeCallback(InitializeEvent @event) { var configLocation = Path.Combine(PathOnDisk, "Config.json"); if (!File.Exists(configLocation)) { Console.WriteLine("The config file for MoreRain was not found, guess I'll create it..."); ModConfig = new Config(); ModConfig.RainChance = 30; ModConfig.ThunderChance = 10; File.WriteAllBytes(configLocation, Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(ModConfig))); Console.WriteLine("The config file for MoreRain has been loaded.\n\t RainChance: {0}, ThunderChance: {1}", ModConfig.RainChance, ModConfig.ThunderChance); } else { ModConfig = JsonConvert.DeserializeObject <Config>(Encoding.UTF8.GetString(File.ReadAllBytes(configLocation))); Console.WriteLine("The config file for MoreRain has been loaded.\n\tRainChance: {0}, ThunderChance: {1}", ModConfig.RainChance, ModConfig.ThunderChance); } Console.WriteLine("MoreRain Initialization Completed"); }
public static void SendInitializeEvent(bool success) { #if UNITY_ANALYTICS if (!s_Initialized && !Initialize()) { return; } var data = new InitializeEvent { success = success, runtime = OpenXRRuntime.name, runtime_version = OpenXRRuntime.version, plugin_version = OpenXRRuntime.pluginVersion, api_version = OpenXRRuntime.apiVersion, enabled_extensions = OpenXRRuntime.GetEnabledExtensions() .Select(ext => $"{ext}_{OpenXRRuntime.GetExtensionVersion(ext)}") .ToArray(), available_extensions = OpenXRRuntime.GetAvailableExtensions() .Select(ext => $"{ext}_{OpenXRRuntime.GetExtensionVersion(ext)}") .ToArray(), enabled_features = OpenXRSettings.Instance.features .Where(f => f != null && f.enabled) .Select(f => $"{f.GetType().FullName}_{f.version}").ToArray(), failed_features = OpenXRSettings.Instance.features .Where(f => f != null && f.failedInitialization) .Select(f => $"{f.GetType().FullName}_{f.version}").ToArray() }; #if UNITY_EDITOR EditorAnalytics.SendEventWithLimit(kEventInitialize, data); #else Analytics.Analytics.SendEvent(kEventInitialize, data); #endif #endif }
public void InitializeCallback(InitializeEvent @event) { var configLocation = Path.Combine(ParentPathOnDisk, "Config.json"); if (!File.Exists(configLocation)) { Console.WriteLine("The config file for MovementSpeedModifier was not found, attempting creation..."); ModConfig = new Config(); ModConfig.EnableDiagonalMovementSpeedFix = true; ModConfig.PlayerRunningSpeed = 5; ModConfig.PlayerWalkingSpeed = 2; File.WriteAllBytes(configLocation, Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(ModConfig))); Console.WriteLine("The config file for MovementSpeedModifier has been loaded.\n\tDiagonalFix: {0}, PlayerWalkingSpeed: {1}, PlayerRunningSpeed: {2}", ModConfig.EnableDiagonalMovementSpeedFix, ModConfig.PlayerWalkingSpeed, ModConfig.PlayerRunningSpeed); } else { ModConfig = JsonConvert.DeserializeObject <Config>(Encoding.UTF8.GetString(File.ReadAllBytes(configLocation))); Console.WriteLine("The config file for MovementSpeedModifier has been loaded.\n\tDiagonalFix: {0}, PlayerWalkingSpeed: {1}, PlayerRunningSpeed: {2}", ModConfig.EnableDiagonalMovementSpeedFix, ModConfig.PlayerWalkingSpeed, ModConfig.PlayerRunningSpeed); } Console.WriteLine("MovementSpeedModifier Initialization Completed"); }
protected override void Initialize() { InitializeEvent.Set(); InitializedEvent.WaitOne(TimeoutDelay); ThrowIfCancellationRequested(); }
remove => RemoveHandler(InitializeEvent, value);
add => AddHandler(InitializeEvent, value);
void HandleMessage(string msg, dynamic args, Request request) { LogDebug("(in) " + request.type + " " + msg); LogVerbose("... " + JsonConvert.SerializeObject(request)); args = args ?? new { }; try { switch (msg) { case "initialize": var cap = new Capabilities(); InitializeEvent?.Invoke(request, cap); Send(request, cap); Initialized(); break; case "configurationDone": ConfigurationDoneEvent?.Invoke(request); break; case "launch": LaunchEvent?.Invoke(request, JsonConvert.SerializeObject(args)); break; case "attach": AttachEvent?.Invoke(request, JsonConvert.SerializeObject(args)); break; case "disconnect": DisconnectEvent?.Invoke(request); break; case "next": StepOverEvent?.Invoke(request); break; case "continue": ContinueEvent?.Invoke(request); break; case "stepIn": StepInEvent?.Invoke(request); break; case "stepOut": StepOutEvent?.Invoke(request); break; case "pause": PauseEvent?.Invoke(request); break; case "threads": GetThreadsEvent?.Invoke(request); break; case "scopes": GetScopesEvent?.Invoke(request, (int)args.frameId); break; case "stackTrace": GetStackTraceEvent?.Invoke(request); break; case "variables": _tempVariables.Clear(); GetVariablesEvent?.Invoke(request, (int)args.variablesReference, _tempVariables); Send(request, new VariablesResponseBody(_tempVariables)); break; case "setVariable": var variable = new Variable((string)args.name, (string)args.value, "", (int)args.variablesReference); SetVariableEvent?.Invoke( request, variable ); Send( request, new SetVariableResponseBody(variable.value, variable.variablesReference) ); break; case "loadedSources": GetLoadedSourcesEvent?.Invoke(request); break; case "source": GetSourceEvent?.Invoke(request); break; case "evaluate": string resultEval = ""; EvaluateEvent?.Invoke( request, (int)args.frameId, (string)args.context, (string)args.expression, (bool)(args.format?.hex ?? false), ref resultEval ); Send( request, new EvaluateResponseBody( resultEval ) ); break; case "completions": GetCompletionsEvent?.Invoke( request, (int)args.frameId, (int)args.line, (int)args.column, (string )args.text ); break; case "setBreakpoints": SetBreakpointsEvent?.Invoke(request); break; // case "runInTerminal": // OnRunInTerminal?.Invoke( pRequest ); // break; // case "setFunctionBreakpoints": // SetFunctionBreakpoints( pResponse, pArgs ); // break; // case "setExceptionBreakpoints": // SetExceptionBreakpoints( pResponse, pArgs ); // break; default: CustomRequestEvent?.Invoke(request); if (!request.responded) { Log( Logging.Severity.Error, string.Format("Request not handled: '{0}' [{1}]", msg, Convert.Encode(request.arguments.ToString())) ); } break; } } catch (Exception e) { Log( Logging.Severity.Error, $"Error during request '{Convert.Encode( request.arguments.ToString() )}' [{msg}] (exception: {e.Message})\n{e}" ); Send(new Response(request, errorMsg: e.Message)); } }
protected override void Initialize() { InitializeEvent.Set(); InitializedEvent.WaitOne(TimeoutDelay); }
public void Initialize(InitializeEvent @e) { }
void OnInit(InitializeEvent e) { targetHeight = e.pos.y; }
private void OnInitEvent() { InitializeEvent?.Invoke(this, EventArgs.Empty); }
public void Init(InitializeEvent @event) { SConfig = new SprinklerConfig(); SConfig = (SprinklerConfig)Config.InitializeConfig(Config.GetBasePath(this), SConfig); }