//ボタンに各ステートに対応した設定をセット。 private void SetButtonGUI() { switch (state) { case FactoryLineInfo.LineState.Initial: _ButtonText.text = "準備中"; break; case FactoryLineInfo.LineState.Idle: _ButtonText.text = "OK"; //生産開始処理。 _ButtonFunc = InvokeLine; break; case FactoryLineInfo.LineState.Generating: _ButtonText.text = "キャンセル"; //生産中止処理。 _ButtonFunc = StopLine; break; case FactoryLineInfo.LineState.Completed: _ButtonText.text = "受け取る"; //弾丸受け取り。 _ButtonFunc = CompletedLine; break; } }
void MainMenuInput() { timer += Time.deltaTime; if(timer > m_keyTimer){ m_takeInput = true; } if(Input.GetKey(KeyCode.Joystick1Button0) || Input.GetKeyDown(KeyCode.Space)){ ButtonFunction buttonFunction = new ButtonFunction(Foo); switch(m_mainMenuSelection){ case 0: buttonFunction = new ButtonFunction(StartButton); break; case 1: buttonFunction = new ButtonFunction(OptionsButton); break; case 2: break; } p_mainMenuButtons[m_mainMenuSelection].ButtonPress(buttonFunction); p_mainMenuButtons[m_mainMenuSelection].m_isPressed = true; } //Move the current selection up/down if (Input.GetAxis("Vert_Dpad_1") > 0 && m_takeInput || Input.GetKeyDown (KeyCode.UpArrow) && m_takeInput) {m_mainMenuSelection--; m_takeInput = false; timer = 0; audio.PlayOneShot(SoundMoveSelection);} else if (Input.GetAxis("Vert_Dpad_1") < 0 && m_takeInput || Input.GetKeyDown (KeyCode.DownArrow) && m_takeInput) {m_mainMenuSelection++; m_takeInput = false; timer = 0; audio.PlayOneShot(SoundMoveSelection);} //Cycle the menu if you go passed a boundary. if (m_mainMenuSelection >= p_mainMenuButtons.Length) {m_mainMenuSelection = 0;} else if(m_mainMenuSelection < 0){m_mainMenuSelection = p_mainMenuButtons.Length -1;} }
public void RunProgress(float timeToComplete, ButtonFunction CurrentFunction) { if (!IsRunning) { StartCoroutine(RadialProgress(timeToComplete, CurrentFunction)); } }
public void RemoveButtonUpFunc(ButtonFunction func) { if (HasUpFunc(func)) { _buttonUpFunc.Remove(func); } }
// Use this for initialization void Start() { GameObject button1 = GameObject.Find("button1"); GameObject button2 = GameObject.Find("button2"); GameObject button3 = GameObject.Find("button3"); GameObject button4 = GameObject.Find("button4"); GameObject button5 = GameObject.Find("button5"); GameObject button6 = GameObject.Find("button6"); GameObject button7 = GameObject.Find("button7"); GameObject button8 = GameObject.Find("button8"); GameObject button9 = GameObject.Find("button9"); _anim = SafeDoor.GetComponent <Animator>(); _audioSourceSafe = SafeDoor.GetComponent <AudioSource>(); _buttonFunction1 = button1.GetComponent <ButtonFunction>(); _buttonFunction2 = button2.GetComponent <ButtonFunction>(); _buttonFunction3 = button3.GetComponent <ButtonFunction>(); _buttonFunction4 = button4.GetComponent <ButtonFunction>(); _buttonFunction5 = button5.GetComponent <ButtonFunction>(); _buttonFunction6 = button6.GetComponent <ButtonFunction>(); _buttonFunction7 = button7.GetComponent <ButtonFunction>(); _buttonFunction8 = button8.GetComponent <ButtonFunction>(); _buttonFunction9 = button9.GetComponent <ButtonFunction>(); _values = new List <int>(); }
public PanelHome() { InitializeComponent(); SettingForm(); this.mouseMessageFilter = new MouseMoveMessageFilter(); this.mouseMessageFilter.TargetForm = this; StartFiltering(this.mouseMessageFilter); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(PanelHome)); flowLayoutPanel.SuspendLayout(); List <tb_exercise> exercises = ExerciseModelManage.Instance.FindAllExercise(); foreach (tb_exercise e in exercises) { ButtonFunction button = new ButtonFunction(); button.GroupButtonName = "ButtonFunction"; button.Margin = new System.Windows.Forms.Padding(5); button.Name = "btn" + "-" + e.ExerciseID; button.NameButtonText = e.Title; button.PtrBoxImage = ((System.Drawing.Image)(resources.GetObject("telephony__icon"))); button.Size = new System.Drawing.Size(325, 110); button.TabIndex = 1; button.TablePanelMainBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(106)))), ((int)(((byte)(178)))), ((int)(((byte)(183))))); button.TablePanelMainBackgroundImage = null; button.TextDescription3 = "- Kết quả tập luyện"; button.TextDescription1 = "- Giới thiệu bài tập"; button.TextDescription2 = "- Tình trạng sức khỏe"; flowLayoutPanel.Controls.Add(button); } flowLayoutPanel.ResumeLayout(); }
public ButtonConfig(string value, string text, string menu, ButtonFunction btFunction) { m_Value = value; m_Text = text; m_BtFunction = btFunction; m_Menu = menu; }
public static INodeBase Factory(ButtonFunction functions, INode node) { switch (functions) { case ButtonFunction.Standard: { return(CreateStandard(node)); } case ButtonFunction.ToggleGroup: { return(CreateLinkedToggles(node)); } case ButtonFunction.ToggleNotLinked: { return(CreateTogglesNotLinked(node)); } case ButtonFunction.CancelOrBack: { return(CreateCancelOrBack(node)); } case ButtonFunction.InGameUi: { return(CreateInGameUi(node)); } default: throw new Exception("No Node Type Found"); } }
public void RemoveButtonDwonFunc(ButtonFunction func) { if (HasDwonFunc(func)) { _buttonDownFunc.Remove(func); } }
public void RegisterButtonUpFunc(ButtonFunction func) { if (!HasUpFunc(func)) { _buttonUpFunc.Add(func); } }
public void RemoveButtonPressFunc(ButtonFunction func) { if (HasPressFunc(func)) { _buttonPressFunc.Remove(func); } }
void ActivateButton(ButtonFunction function) { foreach (var button in _ButtonList) { button.mActive = button.mFunction == function; } }
void NextResearch(int ind, UiMaster master, ButtonFunction b) { if (stager[b].Item2 == true) { master.ManipulateElements("Tree Complete", Player_Modes.Research, b.ToString(), ind); switch (b) { case ButtonFunction.R1: Statistics.Ending = Endings.Death; break; case ButtonFunction.R2: Statistics.Ending = Endings.Passive; break; case ButtonFunction.R3: Statistics.Ending = Endings.God; break; } return; } master.ManipulateElements(research[b].ToList()[stager[b].Item3].Value.Data.Name + "\r\n" + research[b].ToList()[stager[b].Item3].Value.CurrentProgress.PercentAofB(research[b].ToList()[stager[b].Item3].Value.Data.ResearchTime) + "%", Player_Modes.Research, b.ToString(), ind); }
private void GenerateButtons(Grid a_GridToPopulate, ButtonFunction a_ButtonFunction) { Button v_ButtonToAdd; for (int i = 0; i < m_PlayerAmount; i++) { int v_YActual = m_FirstLineY + i * m_IncrementY; v_ButtonToAdd = new Button(); v_ButtonToAdd.VerticalAlignment = VerticalAlignment.Top; v_ButtonToAdd.Height = m_HeightTextBox; v_ButtonToAdd.Margin = new Thickness(m_OffsetX, v_YActual, 0, 0); if (a_ButtonFunction == ButtonFunction.Reset) { v_ButtonToAdd.Click += ResetButton_Click; v_ButtonToAdd.Name = "btReset_" + i; v_ButtonToAdd.Content = "Reset"; } else if (a_ButtonFunction == ButtonFunction.Remove) { v_ButtonToAdd.Click += RemoveButton_Click; v_ButtonToAdd.Name = "btRemove_" + i; v_ButtonToAdd.Content = "Remove"; } a_GridToPopulate.Children.Add(v_ButtonToAdd); Grid.SetColumn(v_ButtonToAdd, 3); m_PlayerResultButtons.Add(v_ButtonToAdd); } }
/// <summary> /// Creates a new button that will perform a given function when clicked. /// </summary> /// <param name="pos">Area to which the button will be drawn, and on which it will check for input</param> /// <param name="spriteSheet">Texture sheet of the button. Should contain an up-state, a down-state, and an over-state.</param> /// <param name="function">The executable function this button well perform when clicked.</param> /// <param name="bClickable">Sets whether this button will perform its function when clicked</param> /// <param name="bActive">Sets whether this button will appear</param> public Button(Rectangle pos, Sprite spriteSheet, ButtonFunction function, bool bClickable = true, bool bActive = true) { this.position = pos; this.function = function; this.buttonImage = spriteSheet; this.bActive = bActive; this.bClickable = bClickable; }
public ButtonConfig(string value, string text, string menu, ButtonFunction btFunction) { m_Value = value; m_Text = text; m_BtFunction = btFunction; m_Menu = menu; DelegateEnableItems = EnableMainSoftKeys; }
public ButtonConfig(string value, string text, string menu, ButtonFunction btFunction, EnableItems FuncEnable) { m_Value = value; m_Text = text; m_BtFunction = btFunction; m_Menu = menu; DelegateEnableItems = FuncEnable; }
public void SetButton(string text, FrontPanelColors color, bool dim, ButtonFunction function, int value) { Text = text; ColorIndex = (int)color; AlternateColorIndex = (int)color; Dim = dim; Function = function; Value = value; }
private void RefreshStatus() { String statusInfoText = modelView.RefreshStatusInfo(); if (!String.IsNullOrEmpty(statusInfoText)) { statusInfoLabel.Text = statusInfoText; } ButtonFunctions functions = modelView.RefreshButtonFunctions(); switch (functions) { case ButtonFunctions.PauseStop: { button1.Visible = button2.Visible = true; button1.Text = "Pause"; button2.Text = "Stop"; button1Function = ButtonFunction.Pause; button2Function = ButtonFunction.Stop; break; } case ButtonFunctions.NoneClose: { button1.Visible = false; button2.Visible = true; button2.Text = "Close"; button1Function = ButtonFunction.None; button2Function = ButtonFunction.Close; break; } case ButtonFunctions.ResumeStop: { button1.Visible = button2.Visible = true; button1.Text = "Resume"; button2.Text = "Stop"; button1Function = ButtonFunction.Resume; button2Function = ButtonFunction.Stop; break; } case ButtonFunctions.OpenClose: { button1.Visible = button2.Visible = true; button1.Text = "Open"; button2.Text = "Close"; button1Function = ButtonFunction.Open; button2Function = ButtonFunction.Close; break; } default: { button1.Visible = button2.Visible = false; button1Function = ButtonFunction.None; button2Function = ButtonFunction.None; break; } } }
void BounceButton(ButtonFunction selectedFunction) { CustomButton button = _ButtonList.Where(b => b.mFunction == selectedFunction).First(); if (!LeanTween.isTweening(button.mRect)) { LeanTween.move(button.mRect, button.mBounceEnd, 0.08f).setEase(LeanTweenType.easeOutCubic) .setOnComplete(() => LeanTween.move(button.mRect, button.mEnd, 0.4f).setEase(LeanTweenType.easeOutBounce)); } }
bool CheckResearchActivity(ButtonFunction bf, int stage) { if (research[bf].ToList()[stage].Value.State == ResearchState.Waiting) { return(true); } else { return(false); } }
private DownloadDialog() { if (!DesignMode) { this.Font = SystemFonts.MessageBoxFont; } InitializeComponent(); button1Function = ButtonFunction.Pause; button2Function = ButtonFunction.Stop; this.bottomLayout.Paint += new System.Windows.Forms.PaintEventHandler(this.BottomLayout_Paint); }
public ImageButton(int nX, int nY, string sOffFilename, string sOnFilename, string sHoverFilename, ButtonFunction pFunc) { m_X = nX; m_Y = nY; m_OffImage = new Image(sOffFilename); m_OnImage = new Image(sOnFilename); m_HoverImage = new Image(sHoverFilename); m_Rect = m_OffImage.GetRect(); m_Rect.X += m_X; m_Rect.Y += m_Y; m_Function = pFunc; }
void MainMenuInput() { timer += Time.deltaTime; if (timer > m_keyTimer) { m_takeInput = true; } if (Input.GetKey(KeyCode.Joystick1Button0) || Input.GetKeyDown(KeyCode.Space)) { ButtonFunction buttonFunction = new ButtonFunction(Foo); switch (m_mainMenuSelection) { case 0: buttonFunction = new ButtonFunction(StartButton); break; case 1: buttonFunction = new ButtonFunction(OptionsButton); break; case 2: break; } p_mainMenuButtons[m_mainMenuSelection].ButtonPress(buttonFunction); p_mainMenuButtons[m_mainMenuSelection].m_isPressed = true; } //Move the current selection up/down if (Input.GetAxis("Vert_Dpad_1") > 0 && m_takeInput || Input.GetKeyDown(KeyCode.UpArrow) && m_takeInput) { m_mainMenuSelection--; m_takeInput = false; timer = 0; audio.PlayOneShot(SoundMoveSelection); } else if (Input.GetAxis("Vert_Dpad_1") < 0 && m_takeInput || Input.GetKeyDown(KeyCode.DownArrow) && m_takeInput) { m_mainMenuSelection++; m_takeInput = false; timer = 0; audio.PlayOneShot(SoundMoveSelection); } //Cycle the menu if you go passed a boundary. if (m_mainMenuSelection >= p_mainMenuButtons.Length) { m_mainMenuSelection = 0; } else if (m_mainMenuSelection < 0) { m_mainMenuSelection = p_mainMenuButtons.Length - 1; } }
IEnumerator RadialProgress(float time, ButtonFunction CurrentFunction) { IsRunning = true; float rate = 1 / time; float i = 0; while (i < 1) { i += Time.deltaTime * rate; gameObject.GetComponent <Renderer>().material.SetFloat("_Progress", i); yield return(0); } IsRunning = false; CurrentFunction.Function(); }
public ImageButton(int nX, int nY, string sOffFilename, string sOnFilename, string sHoverFilename, ButtonFunction pFunc) { m_X = nX; m_Y = nY; m_OffImage = new Image(sOffFilename); m_OnImage = new Image(sOnFilename); m_HoverImage = new Image(sHoverFilename); m_Rect = m_OffImage.GetRect(); m_Rect.X += m_X; m_Rect.Y += m_Y; m_Function = pFunc; m_vb = new VertexBuffer(typeof(CustomVertex.TransformedTextured), 4, CGameEngine.Device3D, Usage.WriteOnly, CustomVertex.TransformedTextured.Format, Pool.Default); }
public void Update(Player p, GameTime gt) { foreach (KeyValuePair <Player_Modes, List <IElement> > kv in elements) { foreach (IElement ie in kv.Value) { if (ie.IsActive && p.Mode == kv.Key || (kv.Key == Player_Modes.All && p.Mode != Player_Modes.MainMenu && p.Mode != Player_Modes.End_Screen)) { ie.Update(p.Cursor); if (ie is Strip) { string action = ((Strip)ie).GetClicked(); if (action != null) { ParseAction(action, gt); } string highlight = ((Strip)ie).GetHighlighted(); if (highlight != null) { ParseHighlight(highlight); } } if (ie is Button) { if (((Button)ie).IsClicked) { ParseAction(((Button)ie).Name, gt); } } } } } infoManager.Update(gt, this, p); if ((elasped += gt.ElapsedGameTime.Milliseconds) >= uiActionTime) { prev_action = ButtonFunction.Nan; } messenger.Update(gt); }
void HandleButtonClick(ButtonFunction selectedFunction) { // Only run code if not animating and only when changing function if (!_AnimationRunning && _SelectedFunction != selectedFunction) { _SelectedFunction = selectedFunction; // Reset all to hidden, then display the one we want, easier to manage Reset(); BounceButton(selectedFunction); switch (selectedFunction) { case ButtonFunction.VegasModel: ActivateButton(ButtonFunction.VegasModel); SetupVegasModel(); break; case ButtonFunction.EmpireModel: ActivateButton(ButtonFunction.EmpireModel); SetupEmpireStateModel(); break; case ButtonFunction.EmpireImageSlider: ActivateButton(ButtonFunction.EmpireImageSlider); ImageSliderGUI.Show(); break; case ButtonFunction.EmpireInfo: ActivateButton(ButtonFunction.EmpireInfo); InfoBoxGUI.Show(); break; case ButtonFunction.Panoramic: ActivateButton(ButtonFunction.Panoramic); PanoramicGUI.Show(); break; default: break; } } }
IEnumerator CheckButtons() { while (true) { if (Physics.Raycast(Check, out Hit, Mathf.Infinity, ButtonLayer)) { CurrentFunction = Hit.collider.GetComponent <ButtonFunction>(); CurrentFunction.SwitchHighlight(true); ReticuleLoding.RunProgress(TimerToCallButton, CurrentFunction); } else { if (CurrentFunction != null) { CurrentFunction.SwitchHighlight(false); ReticuleLoding.ResetProgress(); } } yield return(new WaitForSeconds(TimeBeteweenIteration)); } }
void ParseHighlight(string action) { ButtonFunction func = ButtonFunction.Examine; bool match = false; foreach (KeyValuePair <ButtonFunction, string> kv in functions) { if (kv.Value == action) { func = kv.Key; match = true; break; } } if (!match) { return; } highlighted = func; }
void ParseAction(string action, GameTime gt) { ButtonFunction func = ButtonFunction.Examine; bool match = false; foreach (KeyValuePair <ButtonFunction, string> kv in functions) { if (kv.Value == action) { func = kv.Key; match = true; break; } } if (!match) { return; } action_queue.Add(func); }
//must fire in order for length, width, height etc. to get properly set private void video_MediaOpened(object sender, RoutedEventArgs e) { if (!hasBeenOpened) { _aspectRatio = (double)_video.NaturalVideoWidth / (double)_video.NaturalVideoHeight; Resize(_preferredSize.Width,_preferredSize.Height); _layoutRoot.Children.Add(_controls); Grid.SetRow(_controls, 1); _controls.videoSlider.Maximum = 1; _controls.Show(); //MediaElement has this weird bug where it always starts from 0:00 the first time it is played, regardless of its actual position - this prevents that _video.Play(); _video.Pause(); playButtonFunction = playVideo; hasBeenOpened = true; } }
public void pauseVideo() { _video.Pause(); _sliderTimer.Stop(); _controls.ShowPlay(); playButtonFunction = playVideo; }
/// <summary> /// Creates a button with a background and text on top of it. /// </summary> /// <param name="position">Top left corner of the textbutton, and its size.</param> /// <param name="sprite">Sprite containing the up, over, and down animations.</param> /// <param name="function">Function performed when the button is clicked</param> /// <param name="font">Font used to draw the text</param> /// <param name="text">Text to draw on the button</param> /// <param name="bClickable">Sets whether the button will respond to input</param> /// <param name="bActive">Sets whether the button will appear</param> public TextButton(Rectangle position, Sprite sprite, ButtonFunction function, SpriteFont font, String text = "", bool bClickable = true, bool bActive = true) : base(position, sprite, function, bClickable, bActive) { this.font = font; this.text = text; }
private void playVideo() { _video.Play(); _sliderTimer.Start(); _controls.ShowPause(); playButtonFunction = pauseVideo; }
private void RaiseParamsEvent(List<Parameter> transitionParams, ButtonFunction buttonFunction, Transition transition) { if(ParamsActivtyEvent != null) { var args = new ParamsEventHandlerArgs(); args.ButtonPressed = buttonFunction; args.TransitionParameters = transitionParams; args.Transition = transition; ParamsActivtyEvent.Invoke(null, args); } }
public void ButtonPress(ButtonFunction _delegate) { audio.PlayOneShot(SelectSound); _delegate(); //Call the delegates function }