private void GoToStep(int step) { btnBack.Enabled = step > 0; if (step >= stepsList.Count) { return; } KillCurrentStep(); currentStepIndex = step; currentStep = stepsList[step]; currentStep.Size = StepPanel.Size; currentStep.Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top | AnchorStyles.Bottom; btn_Next.Visible = currentStep.CanProceed && step != stepsList.Count - 1; if (currentStep.Profile != currentProfile)// dont reinitialize, user is coming back { currentStep.Initialize(currentGameInfo, currentProfile); } StepPanel.Controls.Add(currentStep); currentStep.Size = StepPanel.Size; // for some reason this line must exist or the PositionsControl get messed up label_StepTitle.Text = currentStep.Title; }
async void handHeldController_StateChanged(object sender, XboxControllerStateChangedEventArgs e) { if (null != panTilt && null != firingControl) { await UserInputControl.HandleInput(this, panTilt, firingControl, null, this.handHeldController); } }
// Make Singleton private void OnEnable() { if (m_userInputControl == null) { m_userInputControl = this; } else if (m_userInputControl != this) { Destroy(this); } }
private void GoToStep(int step) { if (step == 1 && DoesntNeedOptions()) { step++; } BrowserBtns.SetPreviousButtonState(step > 0); if (step >= stepsList.Count) { return; } else if (step >= 2) { // Custom steps #if false List <CustomStep> customSteps = handlerData.CustomSteps; int customStepIndex = step - 2; CustomStep customStep = customSteps[0]; if (customStep.Required) { jsControl.CustomStep = customStep; jsControl.DataManager = handlerDataManager; } else { BrowserBtns.SetPlayButtonState(true); return; } #endif } KillCurrentStep(); currentStepIndex = step; currentStep = stepsList[step]; currentStep.Size = panel_steps.Size; currentStep.Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top | AnchorStyles.Bottom; #if false currentStep.Initialize(handlerData, userGame, currentProfile); #endif BrowserBtns.SetNextButtonState(currentStep.CanProceed && step != stepsList.Count - 1); panel_steps.Controls.Add(currentStep); currentStep.Size = panel_steps.Size; // for some reason this line must exist or the PositionsControl get messed up MainForm.Instance.ChangeTitle(currentStep.Title, currentStep.Image); }
protected override void start() { base.start(); for (int i = 0; i < PrefabEnem.Length; i++) { PrefabEnem[i] = GameObject.Find("Enemy" + (i + 1)); } lastSpawn = Time.time; gameControl.addEvent("Reset", reset); gameControl.addEvent("StarSpawn", spawnStar); UserInputControl input = basicGameControl.SubController <UserInputControl>("UserInputControl"); input.addKeyMap(new KeyMap(new KeyCode[] { KeyCode.M }, "SpawnStar", () => { spawnStar(); }, Input.GetKeyDown, UserInputControl.SeldomtimePress)); }
private void GoToStep(int step) { btnBack.Enabled = step > 0; if (step >= stepsList.Count) { return; } if (step >= 2) { // Custom steps List <CustomStep> customSteps = currentGame.CustomSteps; int customStepIndex = step - 2; CustomStep customStep = customSteps[0]; if (customStep.UpdateRequired != null) { customStep.UpdateRequired(); } if (customStep.Required) { jsControl.CustomStep = customStep; jsControl.Content = content; } else { EnablePlay(); return; } } KillCurrentStep(); currentStepIndex = step; currentStep = stepsList[step]; currentStep.Size = StepPanel.Size; currentStep.Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top | AnchorStyles.Bottom; currentStep.Initialize(currentGameInfo, currentProfile); btn_Next.Enabled = currentStep.CanProceed && step != stepsList.Count - 1; StepPanel.Controls.Add(currentStep); currentStep.Size = StepPanel.Size; // for some reason this line must exist or the PositionsControl get messed up label_StepTitle.Text = currentStep.Title; }
private void GoToStep(int step) { btn_Previous.Enabled = step > 0; if (step >= stepsList.Count) { return; } if (step >= 2) { // Custom steps List <CustomStep> customSteps = handlerData.CustomSteps; int customStepIndex = step - 2; CustomStep customStep = customSteps[0]; if (customStep.Required) { jsControl.CustomStep = customStep; jsControl.DataManager = handlerDataManager; } else { EnablePlay(); return; } } KillCurrentStep(); currentStepIndex = step; currentStep = stepsList[step]; currentStep.Size = panel_Steps.Size; currentStep.Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top | AnchorStyles.Bottom; currentStep.Initialize(handlerData, selectedControl.UserGameInfo, currentProfile); btn_Next.Enabled = currentStep.CanProceed && step != stepsList.Count - 1; panel_Steps.Controls.Add(currentStep); currentStep.Size = panel_Steps.Size; // for some reason this line must exist or the PositionsControl get messed up lbl_StepTitle.Text = currentStep.Title; }
public void Execute(object parameter) { bool created = false; bool cancelled = false; while (!cancelled && !created) { UserInputControl userControl = new UserInputControl("Library name:", ""); WpfDialog.WpfDialogOptions options = new WpfDialog.WpfDialogOptions(); options.DialogType = WpfDialog.DialogType.Question; options.PossibleResponses = new WpfDialog.UserResponses(new string[] { "Create", "Cancel" }, 0); options.CustomContent = userControl; options.TitleBarIcon = ((Window)parameter).Icon; WpfDialog dialog = new WpfDialog(Helpers.AssemblyProperties.AssemblyTitle, "Enter the name of the new library.", options); dialog.Owner = (Window)parameter; dialog.ShowDialog(); if (dialog.UserResponse.Equals("Create", StringComparison.CurrentCultureIgnoreCase)) { if (userControl.InputText.Length > 0) { _viewModel.CreateLibrary(userControl.InputText); created = true; } else { WpfDialog.WpfDialogOptions errorOptions = new WpfDialog.WpfDialogOptions(); errorOptions.DialogType = WpfDialog.DialogType.Error; errorOptions.TitleBarIcon = ((Window)parameter).Icon; WpfDialog errorDialog = new WpfDialog(Helpers.AssemblyProperties.AssemblyTitle, "You must enter a name for the new library.", errorOptions); errorDialog.Owner = (Window)parameter; errorDialog.ShowDialog(); } } else { cancelled = true; } } }
protected override void instantiate <T>() { base.instantiate <KarapanGameControl>(); base.name = Name; userInputControl = gameObject.GetComponent <UserInputControl>(); playerControl = GameObject.Find("Player").GetComponent <KarapanPlayerControl>(); lifeControl = gameObject.GetComponent <KarapanLifeControl>(); speedControl = gameObject.GetComponent <KarapanSpeedControl>(); progressControl = gameObject.GetComponent <ProgressControl>(); playerControl = GameObject.Find("Player").GetComponent <KarapanPlayerControl>(); addSubController("LifeControl", lifeControl); addSubController("SpeedControl", speedControl); addSubController("PlayerControl", playerControl); addSubController("ProgressControl", progressControl); addSubController("UserInputControl", userInputControl); UnityEngine.Debug.Log(userInputControl); userInputControl.addKeyMap(new KeyMap(new KeyCode[] { KeyCode.Space }, "TogglePause", delegate() { togglePause(); }, Input.GetKeyDown, 0.75F)); userInputControl.addKeyMap(new KeyMap(new KeyCode[] { KeyCode.Slash }, "DEBUG", delegate() { toggleDebug(); }, Input.GetKeyDown, UserInputControl.SeldomtimePress)); userInputControl.addKeyMap(new KeyMap(new KeyCode[] { KeyCode.Equals }, "reset", delegate() { gameOver(); resetGame(); }, Input.GetKeyDown, UserInputControl.SometimePress)); }
//Some way of using the controller // An event handler // Takes in XInput.Event args // if (b.Key == XInput.Controller.Key."B") // { this.trackingMode = TrackingMode.SKELETAL // AudioViewBox.Visisbility = Visibility.Hidden; /// <summary> /// Handles an 'controller' actions using the keyboard interface /// </summary> /// <param name="sender"></param> /// <param name="e"></param> async void MainWindow_KeyDown(object sender, System.Windows.Input.KeyEventArgs e) { //passing the xbox controller here effectivley makes the xbox control able to override the keyboard await UserInputControl.HandleInput(this, panTilt, firingControl, e.Key, this.handHeldController); }
private void SaveControlValueToContext(UserInputControl input) { object value = input.Value; _context.SaveResult(input.ResultName, value, true); }