/// <summary> /// 生成選擇視窗。 /// </summary> public void ChoiceDialog() { //設置視窗功能 //內容設置 string question = "你喜歡什麼顏色?"; //按鍵客制設置 List <ButtonOption> btnOptions = new List <ButtonOption>(); ButtonOption o1 = new ButtonOption("Red", new Color32(255, 153, 153, 255), ChoiceResultAlertDialog); o1.color = new Color32(255, 153, 153, 255); btnOptions.Add(o1); ButtonOption o2 = new ButtonOption("Blue", new Color32(153, 218, 255, 255), ChoiceResultAlertDialog); btnOptions.Add(o2); ButtonOption o3 = new ButtonOption("Green", new Color32(153, 255, 194, 255), ChoiceResultAlertDialog); btnOptions.Add(o3); DialogOption option = new DialogOption(DialogOption.Type.CHOICE_DIALOG, question, btnOptions);//設置視窗功能 //創建視窗 dialogManager.Create(option); }
public static MvcHtmlString Submit(this HtmlHelper htmlHelper, string title, object htmlAttributes, string icon = ButtonIcon.Save, ButtonOption option = ButtonOption.Primary, ButtonSize size = ButtonSize.Small) { var button = new TagBuilder("button"); button.AddCssClass("btn"); button.AddCssClass(option.Text()); button.AddCssClass(size.Text()); button.MergeAttribute("type", "submit"); var attributes = ((IDictionary <string, object>)HtmlHelper.AnonymousObjectToHtmlAttributes(htmlAttributes)); button.MergeAttributes(attributes); if (icon != ButtonIcon.Null) { var i = new TagBuilder("i"); i.MergeAttribute("class", string.Format("{0}", icon)); button.InnerHtml += i; button.InnerHtml += " "; } button.InnerHtml += title; return(MvcHtmlString.Create(button.ToString(TagRenderMode.Normal))); }
public MessengerObjects(Component MessageObject, string Message, ButtonOption Option, bool SendOnStart) { this.MessageObject = MessageObject; this.Message = Message; this.Option = Option; this.SendOnStart = SendOnStart; }
public MessengerObjects (Component MessageObject, string Message, ButtonOption Option, bool SendOnStart) { this.MessageObject = MessageObject; this.Message = Message; this.Option = Option; this.SendOnStart = SendOnStart; }
/// <summary> /// Create a dynamic action option, resolving placeholders from a button option /// </summary> /// <param name="buttonOption">The button option that is the basis for this dynamic action option</param> /// <param name="buttonContext">The button context that is the source of the menu</param> /// <returns>A Dynamic action option with resovled text and possibly an image, if appicable</returns> private DynamicActionOption CreateDynamicActionOption(ButtonOption buttonOption, IButtonContext buttonContext) { var text = buttonOption.GetText(this); if (string.IsNullOrEmpty(text)) { return(default);
/// <summary> /// Create DynamicActionOption with a reference to the original dynamic action requesting the menu and the menu option to display /// </summary> /// <param name="buttonContext">Button context for the button that requires the menu</param> /// <param name="option">Option to pass to the right click request if this dynamic action is selected</param> /// <param name="text">Text to display for the menu</param> /// <param name="image">Image to display for the menu- will use a blank image if null or empty</param> public DynamicActionOption(IButtonContext buttonContext, ButtonOption option = null, string text = null, string image = null) { ButtonContext = buttonContext; Option = option; Text = text; Image = string.IsNullOrEmpty(image) ? ImageUtils.BlankImage() : image; }
public void Movement() { //toggle button for start pathfinding buttonOption = ButtonOption.DEFAULT; startFindPath = true; Move.instance.speed = 5f; }
public static MvcHtmlString BackButton(this HtmlHelper htmlHelper, string icon = ButtonIcon.Null, ButtonOption option = ButtonOption.Default, ButtonSize size = ButtonSize.Small) { var a = new TagBuilder("a"); a.MergeAttribute("href", "#"); a.MergeAttribute("data-pjax", ""); a.AddCssClass("btn"); a.AddCssClass(option.Text()); a.AddCssClass(size.Text()); a.MergeAttribute("onclick", "history.go(-1)"); if (icon != ButtonIcon.Null) { var i = new TagBuilder("i"); i.MergeAttribute("class", string.Format("{0}", icon)); a.InnerHtml += i; a.InnerHtml += " "; } a.InnerHtml += "返回"; return(MvcHtmlString.Create(a.ToString(TagRenderMode.Normal))); }
public static MvcHtmlString ConfirmButton(this HtmlHelper htmlHelper, string title, string url, string confirmMessage, string icon, ButtonOption option = ButtonOption.Default, ButtonSize size = ButtonSize.Small) { var a = new TagBuilder("a"); a.MergeAttribute("href", url); a.AddCssClass("btn"); a.AddCssClass(option.Text()); a.AddCssClass(size.Text()); a.MergeAttribute("data-ajax", "true"); a.MergeAttribute("data-ajax-confirm", confirmMessage); a.MergeAttribute("data-ajax-method", "POST"); a.MergeAttribute("data-ajax-mode", "replace"); a.MergeAttribute("data-ajax-update", "#" + FrameworkKeys.MainContent); if (icon != ButtonIcon.Null) { var i = new TagBuilder("i"); i.MergeAttribute("class", string.Format("{0}", icon)); a.InnerHtml += i; a.InnerHtml += " "; } a.InnerHtml += title; return(MvcHtmlString.Create(a.ToString(TagRenderMode.Normal))); }
public ButtonClickRequest(CardGroupId cardGroupId, ButtonMode buttonMode, int zoneIndex, int index, MouseButton mouseButton, ButtonOption buttonOption) { CardGroupId = cardGroupId; ButtonMode = buttonMode; ZoneIndex = zoneIndex; Index = index; MouseButton = mouseButton; ButtonOption = buttonOption; }
public void DeleteStart() { buttonOption = ButtonOption.DELETE_START; if (buttonOption == ButtonOption.DELETE_START) { GameObject.Destroy(GameObject.FindGameObjectWithTag("StartPoint")); SpawnTarget.instance.isSetStart = false; } }
private void SendMessagesAll(ButtonOption option) { for (int i = 0; i < Messengers.Length; i++) { if (Messengers[i].MessageObject && Messengers[i].Message != "" && Messengers[i].Option == option) { Messengers[i].MessageObject.SendMessage(Messengers[i].Message, this); } } }
private void InitializeButton(ButtonOption buttonOption, int buttonNumber, Question question, int[] order) { const int correctAnswerIndex = 0; if (buttonOption) { buttonOption.SetText(question.possible_answers[order[buttonNumber]]); buttonOption.isCorrect = order[buttonNumber] == correctAnswerIndex; } }
private bool CheckOption(ButtonOption option) { for (int i = 0; i < Messengers.Length; i++) { if (Messengers[i].Option == option) { return(true); } } return(false); }
public void HtmlAttribute_SetsCssClassAttribute() { actual = string.Empty; returnHtml = string.Empty; ButtonOption target = new ButtonOption(); string expected = target.CssClass = "Sample"; returnHtml = Utility.ControlOptionHtmlBuilder <ButtonOption>(target, _startTag); actual = Utility.GetAttribute(returnHtml, "class", _startTag); Assert.AreEqual(expected, actual); }
/// <summary> /// Make dialog window /// </summary> /// <param name="STitle">Title</param> /// <param name="SText">Message text</param> /// <param name="SButton1">Button 1 - Left = text</param> /// <param name="SButton2">Button 2 - middle = text</param> /// <param name="SButton3">Button 3 - right = text</param> public PWindow_SpecialDialog(string STitle, string SText, string SButton1, string SButton2, string SButton3) { InitializeComponent(); option = ButtonOption.None; Title = STitle; TB_Text.Text = SText; TB_B1.Text = SButton1; TB_B2.Text = SButton2; TB_B3.Text = SButton3; }
/** * Responds current question with selected option. */ public void Respond(ButtonOption selectedOption) { if (selectedOption.isCorrect) { Success(); } else { Failure(); } }
public void HtmlAttribute_SetsDisabledAttribute() { actual = string.Empty; returnHtml = string.Empty; ButtonOption target = new ButtonOption(); target.Disabled = true; string expected = "{\"disabled\":true}"; returnHtml = Utility.ControlOptionHtmlBuilder <ButtonOption>(target, _startTag); actual = Utility.GetAttribute(returnHtml, "data-control-options", _startTag); Assert.AreEqual(expected, actual); }
private static void ModifyMenu(int position, uint sourceId, UIntPtr destId, IntPtr windowMenu, ButtonOption buttonFlag) { var buttonLabel = GetButtonLabel(position, windowMenu); // Skip the menu separator if (String.IsNullOrEmpty(buttonLabel)) { return; } var flags = (uint)MenuOption.GetByCommand | (uint)buttonFlag; WinApi.ModifyMenu(windowMenu, sourceId, flags, destId, buttonLabel); }
public void HtmlAttribute_SetsCustomHtmlAttribute() { actual = string.Empty; returnHtml = string.Empty; ButtonOption target = new ButtonOption(); target.HtmlAttributeList = new RouteValueDictionary(new { CustomAttribute = "Sample" }); string expected = "Sample"; returnHtml = Utility.ControlOptionHtmlBuilder <ButtonOption>(target, _startTag); actual = Utility.GetAttribute(returnHtml, "CustomAttribute", _startTag); Assert.AreEqual(expected, actual); }
public void HtmlAttribute_SetsIconsAttribute() { actual = string.Empty; returnHtml = string.Empty; ButtonOption target = new ButtonOption(); target.Icons = new ButtonIcon("ui-icon-gear"); string expected = "{\"icons\":{\"primary\":\"ui-icon-gear\"}}"; returnHtml = Utility.ControlOptionHtmlBuilder <ButtonOption>(target, _startTag); actual = Utility.GetAttribute(returnHtml, "data-control-options", _startTag); Assert.AreEqual(expected, actual); }
public void HtmlAttribute_SetsLabelAttribute() { actual = string.Empty; returnHtml = string.Empty; ButtonOption target = new ButtonOption(); target.Label = "Sample Label"; string expected = "{\"label\":\"Sample Label\"}"; returnHtml = Utility.ControlOptionHtmlBuilder <ButtonOption>(target, _startTag); actual = Utility.GetAttribute(returnHtml, "data-control-options", _startTag); Assert.AreEqual(expected, actual); }
public void HtmlAttribute_SetsButtonTypeAttribute() { actual = string.Empty; returnHtml = string.Empty; ButtonOption target = new ButtonOption(); target.ButtonType = ButtonType.Button; string expected = "button"; returnHtml = Utility.ControlOptionHtmlBuilder <ButtonOption>(target, _startTag); actual = Utility.GetAttribute(returnHtml, "type", _startTag); Assert.AreEqual(expected, actual); }
public string ProcessButton(ButtonOption Btn, string Num = "") //This is what happens whenever a button is pressed. { switch (Btn) //Which button is pressed will decide what the program should do. { case ButtonOption.Clear: //If the Clear button is pressed: Reset(); //Do predefined process 'Reset' (see below). break; case ButtonOption.Add: //If the Add button is pressed, case ButtonOption.Subtract: //Or the Subtract button is pressed, case ButtonOption.Multiply: //Or the Multiply button is pressed, case ButtonOption.Divide: //Or the Divide button is pressed: if (CurrentOperation != null) { CalculateResult(); //If an operation button has already been pressed, do predefined process 'CalculateResult'. } NewOperation = true; //Store True to NewOperation. CurrentOperation = Btn; //Store the operation button that was pressed to CurrentOperation. break; case ButtonOption.Equals: //If the Equals button is pressed: CalculateResult(); //Do predefined process 'CalculateResult'. NewOperation = true; //Store True to NewOperation. break; default: //If any other button is pressed (a number button): if (NewOperation == true) //If the last button that was pressed was an operation button, { NewOperation = false; //Store False to NewOperation. FirstNumber = Display; //Store the number that is on the display as FirstNumber. Display = "0"; //Reset Display to 0. } if (Display == "0") //If Display is 0, { Display = Num; //Display the number that has been pressed. } else //If Display is not 0 (so a number has already been pressed), { Display += Num; //Put the number that was pressed on the end on the number that is on the display. } break; } return(Display); //Show the variable 'Display' on screen. }
private IList <ButtonOption> GetButtonsDefault() { if (ResponseTriggerModel == null) { return(null); } var lista = new List <ButtonOption>(); var maisUm = new ButtonOption() { Value = ResponseTriggerModel.Trigger, Type = TypeButton.PostBack, Title = "Mais um" }; var randomCommmand = new ButtonOption() { Value = "random", Type = TypeButton.PostBack, Title = "Random" }; var help = new ButtonOption() { Value = "help", Type = TypeButton.PostBack, Title = "Help" }; var subscribe = new ButtonOption() { Value = "subscribe|" + ResponseTriggerModel.Trigger, Type = TypeButton.PostBack, Title = "Subscribe" }; lista.Add(maisUm); lista.Add(randomCommmand); lista.Add(subscribe); lista.Add(help); return(lista); }
public void DeleteTarget() { buttonOption = ButtonOption.DELETE_TARGET; if (buttonOption == ButtonOption.DELETE_TARGET) { int targetObjCount = SpawnTarget.instance.newTargetList.Count; if (targetObjCount != 0) { //Destroy target object one by one from last one in the list Destroy(SpawnTarget.instance.newTargetList[SpawnTarget.instance.newTargetList.Count - 1].gameObject); SpawnTarget.instance.newTargetList.RemoveAt(targetObjCount - 1); //If targets are deleted completely, no longer delete them if (SpawnTarget.instance.newTargetList.Count == 0) { SpawnTarget.instance.isSetTarget = false; } } } }
/// <summary> /// Make dialog window with default button /// </summary> /// <param name="STitle">Title</param> /// <param name="SText">Message text</param> /// <param name="SButton1">Button 1 - Left = text</param> /// <param name="SButton2">Button 2 - middle = text</param> /// <param name="SButton3">Button 3 - right = text</param> /// <param name="SetDefault">Set default button = 1 is Button 1; 2 is Button 2; 3 is Button 3</param> public PWindow_SpecialDialog(string STitle, string SText, string SButton1, string SButton2, string SButton3, int SetDefault) { InitializeComponent(); option = ButtonOption.None; Title = STitle; TB_Text.Text = SText; TB_B1.Text = SButton1; TB_B2.Text = SButton2; TB_B3.Text = SButton3; if (SetDefault == 1) { B_Opt1.IsDefault = true; } else if (SetDefault == 2) { B_Opt2.IsDefault = true; } else if (SetDefault == 3) { B_Opt3.IsDefault = true; } }
/// <summary> /// Creates the scene. /// </summary> /// <remarks> /// This method is called before all <see cref="T:WaveEngine.Framework.Entity" /> instances in this instance are initialized. /// </remarks> protected override void CreateScene() { this.VirtualScreenManager.Activate(1024, 728, WaveEngine.Framework.Managers.StretchMode.Uniform); // Dark background Entity dark = new Entity() .AddComponent(new Transform2D() { Opacity = 0.4f, DrawOrder = 2f, }) .AddComponent(new Sprite(StaticResources.WhitePixel) { TintColor = Color.Black }) .AddComponent(new SpriteRenderer(DefaultLayers.Alpha)) .AddComponent(new StretchBehavior()); EntityManager.Add(dark); // Pause text Image i_pausetext = new Image(WaveContent.Assets.Textures.pause_text_PNG) { HorizontalAlignment = HorizontalAlignment.Center, Margin = new Thickness(0, 132, 0, 0), }; EntityManager.Add(i_pausetext); // Panel Grid gridPanel = new Grid() { HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, Width = 475, Height = 418, }; EntityManager.Add(gridPanel.Entity); gridPanel.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Proportional) }); gridPanel.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Proportional) }); gridPanel.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Proportional) }); gridPanel.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Proportional) }); // Resume option ButtonOption b_resume = new ButtonOption("resume", () => { WaveServices.ScreenContextManager.Pop(); SoundsManager.Instance.PlaySound(SoundsManager.SOUNDS.Button); }); b_resume.Grid.SetValue(GridControl.RowProperty, 0); b_resume.Grid.SetValue(GridControl.ColumnProperty, 0); gridPanel.Add(b_resume.Grid); // Restart option ButtonOption b_restart = new ButtonOption("restart", () => { gameplayScene.CurrentState = GamePlayScene.States.HurryUp; WaveServices.ScreenContextManager.Pop(); SoundsManager.Instance.PlaySound(SoundsManager.SOUNDS.Button); }); b_restart.Grid.SetValue(GridControl.RowProperty, 1); b_restart.Grid.SetValue(GridControl.ColumnProperty, 0); gridPanel.Add(b_restart.Grid); // Exit option ButtonOption b_exit = new ButtonOption("exit", () => { gameplayScene.CurrentState = GamePlayScene.States.TapToStart; WaveServices.ScreenContextManager.Pop(); SoundsManager.Instance.PlaySound(SoundsManager.SOUNDS.Button); }); b_exit.Grid.SetValue(GridControl.RowProperty, 2); b_exit.Grid.SetValue(GridControl.ColumnProperty, 0); gridPanel.Add(b_exit.Grid); // Scene behavior this.AddSceneBehavior(new DebugSceneBehavior(), SceneBehavior.Order.PostUpdate); }
private void SendMessagesAll (ButtonOption option) { for (int i = 0; i < Messengers.Length; i++) { if(Messengers[i].MessageObject && Messengers[i].Message != "" && Messengers[i].Option == option) Messengers[i].MessageObject.SendMessage(Messengers[i].Message, this); } }
private bool CheckOption (ButtonOption option) { for (int i = 0; i < Messengers.Length; i++) { if(Messengers[i].Option == option) return true; } return false; }
/// <summary> /// Creates the scene. /// </summary> /// <remarks> /// This method is called before all <see cref="T:WaveEngine.Framework.Entity" /> instances in this instance are initialized. /// </remarks> protected override void CreateScene() { FixedCamera2D camera2d = new FixedCamera2D("camera2d") { ClearFlags = ClearFlags.DepthAndStencil, }; EntityManager.Add(camera2d); // Dark background Entity dark = new Entity() .AddComponent(new Transform2D() { X = WaveServices.ViewportManager.LeftEdge, Y = WaveServices.ViewportManager.TopEdge, XScale = 1 / WaveServices.ViewportManager.RatioX, YScale = 1 / WaveServices.ViewportManager.RatioY, Opacity = 0.4f, DrawOrder = 2f, }) .AddComponent(new ImageControl(Color.Black, (int)WaveServices.ViewportManager.ScreenWidth, (int)WaveServices.ViewportManager.ScreenHeight)) .AddComponent(new ImageControlRenderer(DefaultLayers.GUI)); EntityManager.Add(dark); // Pause text Image i_pausetext = new Image(WaveContent.Assets.Textures.pause_text_PNG) { HorizontalAlignment = HorizontalAlignment.Center, Margin = new Thickness(0, 132, 0, 0), }; EntityManager.Add(i_pausetext); // Panel Grid gridPanel = new Grid() { HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, Width = 475, Height = 418, }; EntityManager.Add(gridPanel.Entity); gridPanel.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Proportional) }); gridPanel.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Proportional) }); gridPanel.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Proportional) }); gridPanel.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Proportional) }); // Resume option ButtonOption b_resume = new ButtonOption("resume", () => { WaveServices.ScreenContextManager.Pop(); SoundsManager.Instance.PlaySound(SoundsManager.SOUNDS.Button); }); b_resume.Grid.SetValue(GridControl.RowProperty, 0); b_resume.Grid.SetValue(GridControl.ColumnProperty, 0); gridPanel.Add(b_resume.Grid); // Restart option ButtonOption b_restart = new ButtonOption("restart", () => { gameplayScene.CurrentState = GamePlayScene.States.HurryUp; WaveServices.ScreenContextManager.Pop(); SoundsManager.Instance.PlaySound(SoundsManager.SOUNDS.Button); }); b_restart.Grid.SetValue(GridControl.RowProperty, 1); b_restart.Grid.SetValue(GridControl.ColumnProperty, 0); gridPanel.Add(b_restart.Grid); // Exit option ButtonOption b_exit = new ButtonOption("exit", () => { gameplayScene.CurrentState = GamePlayScene.States.TapToStart; WaveServices.ScreenContextManager.Pop(); SoundsManager.Instance.PlaySound(SoundsManager.SOUNDS.Button); }); b_exit.Grid.SetValue(GridControl.RowProperty, 2); b_exit.Grid.SetValue(GridControl.ColumnProperty, 0); gridPanel.Add(b_exit.Grid); // Scene behavior this.AddSceneBehavior(new DebugSceneBehavior(), SceneBehavior.Order.PostUpdate); }
void SetWindowMenuButtons(IntPtr window, ButtonOption buttonFlag) { // Find all the buttons on the window's menu var windowMenu = GetSystemMenu(window); var itemsCount = WinApi.GetMenuItemCount(windowMenu); if (itemsCount == 0) { return; } if (_originalButtonIds == null) { _originalButtonIds = new UIntPtr[itemsCount]; } // Modify each button for (var position = 0; position < itemsCount; position++) { uint sourceId; UIntPtr destId; // Swap source and destination IDs to turn it on/off switch (buttonFlag) { case ButtonOption.Enabled: sourceId = UInt32.MaxValue - (uint)position; destId = _originalButtonIds[position]; break; case ButtonOption.Grayed: sourceId = (uint)WinApi.GetMenuItemID(windowMenu, position); destId = new UIntPtr(UInt32.MaxValue - (uint)position); RetainOriginalButtonId(position, sourceId); break; default: throw new ArgumentOutOfRangeException("buttonFlag"); } ModifyMenu(position, sourceId, destId, windowMenu, buttonFlag); } }
public void Start() { instance = this; buttonOption = ButtonOption.DEFAULT; }
public void SetStart() { buttonOption = ButtonOption.SET_START; }
public void SetTarget() { buttonOption = ButtonOption.SET_TARGET; }