private void Start() { Application.targetFrameRate = 60; InitialBalls = 80; SetupDebugConsole(); // This is a static class that contains some tweaks BallGameGeneralCommandHandlers.Initialize(); // Register the command handlers in this instance (i.e. non-static command handlers) CommandHandlers.RegisterCommandHandlers(this); _gameOverUI.Setup(this); _hud.Setup(this); _ballPrefab.SetActive(false); foreach (var ballSpawner in _ballSpawners) { ballSpawner.Setup(this, _ballPrefab); } BeginGame(); }
private void Start() { _screenHeight = Screen.currentResolution.height; _screenWidth = Screen.currentResolution.width; CommandHandlers.RegisterCommandHandlers(this); CommandHandlers.BeforeCommandExecutedHook = BeforeCommandHook; // ConsoleBindsListener.Instance.LoadBinds(); }
protected void Awake() { CommandHandlers.RegisterCommandHandlers(this); // Subscribe to save and load events. SaveGame.OnSaved += SaveGame_OnSaved; SaveGame.OnLoaded += SaveGame_OnLoaded; TrackerManager.OnDataUpdated += TrackerManagerOnDataUpdated; TrackerManager.OnFirstDataAdded += TrackerManagerOnFirstDataAdded; }
public MockLocationService(ITimerService timerService) { timerService.AddListenerOnTimer(OnTimePassed, 2); OnlineMapsLocationService ls = OnlineMapsLocationService.instance; ls.OnLocationChanged += pos => { hasInitialized = true; realPos = GPSPos.FromOnlineMapVector2(pos); UpdateCurrentPos(); onLocationChanged.SafeInvoke(currentPos); }; CommandHandlers.RegisterCommandHandlers(this); }
private void Awake() { CommandHandlers.RegisterCommandHandlers(this); // This allows you to return your save file so that it can be attached to log emails. // In your own game, you might serialize out your save file, then return the contents of it as a string here. // Of course, you can also return any information you file helpful for debugging here. DebugConsole.SaveFileProvider += () => new[] { new SaveFileData("save.json", "{\"test\": 42}", SaveFileDataType.JSON), new SaveFileData("info.txt", "This is some plain-text data", SaveFileDataType.TEXT) }; // Use this to add information to the 'info' tab of the log emails. DebugConsole.GameInfoProvider += () => { return(new List <KeyValuePair <string, string> > { new KeyValuePair <string, string>("Number of balls created", _numberOfBallsCreated.ToString()), new KeyValuePair <string, string>("Sky color", Camera.main.backgroundColor.ToString()), new KeyValuePair <string, string>("Gravity", Physics.gravity.ToString()) }); }; }
static DeveloperCheats() { CommandHandlers.RegisterCommandHandlers(typeof(DeveloperCheats)); }
public static void Initialize() { #if USE_TOUCHCONSOLE CommandHandlers.RegisterCommandHandlers(typeof(CheatCommandHandlers)); #endif }
private void Awake() { CommandHandlers.RegisterCommandHandlers(this); }
private void Awake() { // This registers command handlers like normal, the only interesting thing here is that the only method // in this class that has a [CommandHandler] attribute has a single parameter of "params string[]". CommandHandlers.RegisterCommandHandlers(typeof(AdvancedCommandHandlerDemo)); // This method will register a command 'on the fly'. Optionally, you can specify the name and description. CommandHandlers.RegisterCommandHandler <string, int>(DynamicallyRegisteredMethod); // This method registers a command on the fly, but in this case, we're registering a method that has a params[] argument. // The user will be able to pass 0 or more strings into this command. CommandHandlers.RegisterCommandHandler <int, string[]>(DynamicParamsMethod1, "DynamicParamsMethod1"); // This method allows you to specify the number of values that should be put into the 'params' parameter. // This only works in the params parameter is of type object[]. // It'll apply the normal rules for commands - e.g. checking the right number of parameters, and values // passed to your function will be of the types you specify. CommandHandlers.RegisterCommandHandler <Color, string[]>(DynamicParamsMethod2, "DynamicParamsMethod2", "Method that tests dynamic parameters with overridden types", new[] { typeof(int), typeof(string) }); // This is similar to the above, except you can specify more information about the parameters // you're passing, e.g. names, default values etc. CommandHandlers.RegisterCommandHandler <Color, string[]>(DynamicParamsMethod2, "DynamicParamsMethod3", "Method that tests dynamic parameters with overridden full parameter infos", new[] { new ParamInfo() { Type = typeof(int), Name = "magicNumber" }, new ParamInfo() { Type = typeof(string), IsOptional = true, // if you set IsOptional, make sure you set a DefaultValue too. Name = "cake", DefaultValue = "victoria", AutoCompleteOptions = new[] { "carrot", "coffee", "red velvet", "victoria" } // these are the suggestions provided }, }); // This registers a 'property' command handler, i.e. two functions, one for getting, one for setting. // You have to specify a name for this property as it can't be inferred from the method names. CommandHandlers.RegisterCommandHandler <int>(GetDynamicValue, SetDynamicValue, "DynamicValue"); // The following demonstrates registering multiple commands to the same method. Useful if you have your // own method for handling commands, or want to pass them off to another system (or over the network). CommandHandlers.RegisterCommandHandler <object[]>(MultipleCommandHandler, "MultiCommand1", types: new[] { typeof(int), typeof(string) }); CommandHandlers.RegisterCommandHandler <object[]>(MultipleCommandHandler, "MultiCommand2", types: new[] { typeof(Color) }); // Of course, you can also register commands with lambda functions, as follows: CommandHandlers.RegisterCommandHandler <string>( value => { Debug.Log("Call lambda command with value " + value); }, "LambdaCommand"); // As a final resort, you can use this to handle any command that hasn't already been handled. // If you use this, you'll only get given a list of strings for arguments, and you won't have any // of the autocomplete suggestions. I strongly advise you use the above method if at all possible. CommandHandlers.DefaultCommandHandler = DefaultCommandHandler; }
public MockActivityService(ITimeNotifications timeNotifier) { timeNotifier.AddCallbackOnTimePassed(TimePassed); CommandHandlers.RegisterCommandHandlers(this); }
private void Start() { CommandHandlers.RegisterCommandHandlers(this); }
private void Start() { PerformFakeStartupFlow(); CommandHandlers.RegisterCommandHandlers(this); }
public static void Initialize() { CommandHandlers.RegisterCommandHandlers(typeof(BallGameGeneralCommandHandlers)); }