private void OnInitialize() { Visible = false; SetProcess(false); SetPhysicsProcess(false); var commands = _providers.SelectMany(p => p.CreateCommands(this)); _commandMap.Clear(); foreach (var command in commands) { _commandMap.Add(command.Key, command); } InputField.OnUnhandledInput() .OfType <InputEventKey>() .Where(e => e.Scancode == (int)KeyList.Space && e.Control && e.Pressed && !e.IsEcho()) .Select(_ => InputField.Text.Substring(0, InputField.CaretPosition)) .Subscribe(AutoComplete) .AddTo(this); Player.OnAnimationFinish() .Where(e => e.Animation == ShowAnimation) .Subscribe(_ => OnShown()) .AddTo(this); Player.OnAnimationFinish() .Where(e => e.Animation == HideAnimation) .Subscribe(_ => OnHidden()) .AddTo(this); Content.AddColorOverride("default_color", TextColor); }
private void OnInitialize() { Visible = false; SetProcess(false); SetPhysicsProcess(false); var commands = _providers.SelectMany(p => p.Commands); _commandMap.Clear(); foreach (var command in commands) { _commandMap.Add(command.Key, command); } this.OnInput() .Where(e => e.IsActionPressed(ToggleAction)) .Subscribe(_ => Toggle()) .AddTo(this); Player.OnAnimationFinish() .Where(e => e.Animation == ShowAnimation) .AsUnitObservable() .Subscribe(_ => Input.GrabFocus()) .AddTo(this); Content.AddColorOverride("default_color", TextColor); }