public static MvcHtmlString UxButtonGroupWithDataSource(this HtmlHelper htmlHelper, DataSource dataSource, string selectedValue = null, ButtonGroupSize size = null, string clientId = null) { var group = new ButtonGroup(true, size, selectedValue, dataSource, clientId); MvcHtmlString start = htmlHelper.Partial("ControlTemplates/" + group.ViewTemplate + "Start", group); MvcHtmlString end = htmlHelper.Partial("ControlTemplates/" + group.ViewTemplate + "End", group); return MvcHtmlString.Create(start.ToHtmlString() + end.ToHtmlString()); }
public IconViewModel(INavigationManager navigation) { _navigation = navigation; GoBack = new DelegateCommand(() => _navigation.GoBack()); Groups = new ObservableCollection<IGroup>(); buttonGroup = new ButtonGroup("Buttons") { Items = new ObservableCollection<string>() }; Groups.Add(new ButtonAnatomyGroup()); Groups.Add(buttonGroup); }
public TextStyleViewModel(INavigationManager navigation) { _navigation = navigation; GoBack = new DelegateCommand(() => _navigation.GoBack()); var bg = new ButtonGroup("TextBlock Styles") { Items = new ObservableCollection<string>() }; var items = ResourceFileParser.GetKeysTargeting(@"Common\StandardStyles.xaml", "TextBlock"); foreach (var i in items) bg.Items.Add(i); Groups = new ObservableCollection<IGroup> { bg }; }
/// <summary> /// 创建菜单 /// </summary> /// <param name="accessToken"></param> /// <param name="buttonData">菜单内容</param> /// <returns></returns> public WxJsonResult CreateMenu(string accessToken, ButtonGroup buttonData) { JavaScriptSerializer js = new JavaScriptSerializer(); var jsonString = js.Serialize(buttonData); CookieContainer cookieContainer = null;// new CookieContainer(); using (MemoryStream ms = new MemoryStream()) { var bytes = Encoding.UTF8.GetBytes(jsonString); ms.Write(bytes, 0, bytes.Length); ms.Seek(0, SeekOrigin.Begin); var url = string.Format("https://api.weixin.qq.com/cgi-bin/menu/create?access_token={0}", accessToken); var result = Post.PostGetJson<WxJsonResult>(url, cookieContainer, ms); return result; } }
protected override void Awake() { base.Awake(); ButtonBack = Global.FindChild <ButtonGroup>(transform, "ButtonBack"); }
public static void Init() { try { SubMenu headLightSub = new SubMenu("Head Light", "headLightSubMenu", "Head Light"); SubMenu headLightColorSub = new SubMenu("Head Light Colors", "headLightColorSubMen", "HeadLight Colors"); SubMenu headLightColorAdjustSub = new SubMenu("Head Light Color Adjust", "headLightColorAdjuSubMen", "HeadLight Color Adjust"); headLightSub.PageLayoutGroup.m_Spacing = -15; ButtonGroup buttgroup = null; headLightSub.AddButtonGroup(new ButtonGroup("Head Light", "Head Light", new System.Collections.Generic.List <IButtonGroupElement>() { new ToggleButton((state) => ToggleLight(state), LightOn, LightOff, "Head Light Toggle", "HeadlightToggle", "Toggle Headlight On", "Toggle Headlight Off"), new ToggleButton((state) => { if (state) { Config.lightType = LightType.Point; } else { Config.lightType = LightType.Spot; } UpdateLight(); }, LightOn, flashLight, "Spot/Point", "SpotPointToggle", "Switch to Point Light", "Switch to Spot Light"), new SingleButton(() => { UiManager.OpenSubMenu(UiManager.QMStateController.field_Private_UIPage_0, headLightColorSub.uiPage); }, ColorPicker, "Color", "ColorAdj", "Adjust Colors"), }, (group) => buttgroup = group) ); buttgroup.ButtonLayoutGroup.constraintCount = 3; buttgroup.RemoveButtonHeader(); headLightSub.AddButtonGroup(new ButtonGroup("Options", "Options", new System.Collections.Generic.List <IButtonGroupElement>() { new SingleButton(() => { Config.lightIntensity += .1f; UpdateLight(); }, BrightnessHigher, "Intensity +", "Intensity+Button", "Brighten"), new SingleButton(() => { Config.lightSpotAngle += 5f; UpdateLight(); }, AnglePlus, "Angle +", "Angle+Button", "Widen Angle"), new SingleButton(() => { Config.lightRange += 1f; UpdateLight(); }, SizePlus, "Range +", "Range+Button", "Increase Range"), new SingleButton(() => { Config.lightIntensity = Utils.Clamp(Config.lightIntensity - .1f, 0, 1000); UpdateLight(); }, BrightnessLower, "Intensity -", "Intensity-Button", "Dim"), new SingleButton(() => { Config.lightSpotAngle = Utils.Clamp(Config.lightSpotAngle - 5f, 0, 2000); UpdateLight(); }, AngleMinus, "Angle -", "Angle-Button", "Narrow Angle"), new SingleButton(() => { Config.lightRange = Utils.Clamp(Config.lightRange - 1f, 0, 2000); UpdateLight(); }, SizeMinus, "Range -", "Range-Button", "Lower Range"), new SingleButton(() => { Config.lightIntensity = 1f; UpdateLight(); }, Reset, "Reset", "IntensityResetButton", "Reset Brightness"), new SingleButton(() => { Config.lightSpotAngle = 40f; UpdateLight(); }, Reset, "Reset", "AngleResetButton", "Reset Angle"), new SingleButton(() => { Config.lightRange = 10f; UpdateLight(); }, Reset, "Reset", "RangeResetButton", "Reset Range"), }, (group) => buttgroup = group) ); buttgroup.ButtonLayoutGroup.constraintCount = 3; headLightColorSub.AddButtonGroup(new ButtonGroup("Options", "Options", new System.Collections.Generic.List <IButtonGroupElement>() { new SingleButton(() => { Config.lightColor = Color.white; UpdateLight(); }, Trans, "<color=#FFFFFF>White</color>", "WhiteButton"), new SingleButton(() => { Config.lightColor = Color.red; UpdateLight(); }, Trans, "<color=#FF0000>Red</color>", "RedButton"), new SingleButton(() => { Config.lightColor = Color.green; UpdateLight(); }, Trans, "<color=#00FF00>Green</color>", "GreenButton"), new SingleButton(() => { Config.lightColor = Color.blue; UpdateLight(); }, Trans, "<color=#0000FF>Blue</color>", "BlueButton"), new SingleButton(() => UiManager.OpenSubMenu(UiManager.QMStateController.field_Private_UIPage_0, headLightColorAdjustSub.uiPage), Trans, "<color=#FF0000>C</color><color=#FFFF00>u</color><color=#00FF00>s</color><color=#00FFFF>t</color><color=#0000FF>o</color><color=#FF00FF>m</color> Color", "CustomColorButton", "Adjust the color"), new SingleButton(() => { Config.lightColor = Color.magenta; UpdateLight(); }, Trans, "<color=#FF00FF>Magenta</color>", "MagentaButton"), new SingleButton(() => { Config.lightColor = Color.yellow; UpdateLight(); }, Trans, "<color=#FFFF00>Yellow</color>", "YellowButton"), new SingleButton(() => { Config.lightColor = Color.cyan; UpdateLight(); }, Trans, "<color=#00FFFF>Cyan</color>", "CyanButton"), }) ); headLightColorAdjustSub.AddButtonGroup(new ButtonGroup("Options", "Options", new System.Collections.Generic.List <IButtonGroupElement>() { new SingleButton(() => { Config.lightColor.r = Utils.Clamp(Config.lightColor.r + .1f, 0f, 2f); UpdateLight(); }, Trans, "<color=#FF0000>Red +</color>", "Red+Button"), new SingleButton(() => { Config.lightColor.g = Utils.Clamp(Config.lightColor.g + .1f, 0f, 2f); UpdateLight(); }, Trans, "<color=#00FF00>Green +</color>", "Green+Button"), new SingleButton(() => { Config.lightColor.b = Utils.Clamp(Config.lightColor.b + .1f, 0f, 2f); UpdateLight(); }, Trans, "<color=#0000FF>Blue +</color>", "Blue+Button"), new SingleButton(() => { Config.lightColor.r = Utils.Clamp(Config.lightColor.r + .1f, 0f, 2f); Config.lightColor.g = Utils.Clamp(Config.lightColor.g + .1f, 0f, 2f); Config.lightColor.b = Utils.Clamp(Config.lightColor.b + .1f, 0f, 2f); UpdateLight(); }, Trans, "<color=#FF0000>A</color><color=#00FF00>L</color><color=#0000FF>L</color> +", "All+Button"), new SingleButton(() => { Config.lightColor.r = Utils.Clamp(Config.lightColor.r - .1f, 0f, 2f); UpdateLight(); }, Trans, "<color=#FF0000>Red -</color>", "Red-Button"), new SingleButton(() => { Config.lightColor.g = Utils.Clamp(Config.lightColor.g - .1f, 0f, 2f); UpdateLight(); }, Trans, "<color=#00FF00>Green -</color>", "Green-Button"), new SingleButton(() => { Config.lightColor.b = Utils.Clamp(Config.lightColor.b - .1f, 0f, 2f); UpdateLight(); }, Trans, "<color=#0000FF>Blue -</color>", "Blue-Button"), new SingleButton(() => { Config.lightColor.r = Utils.Clamp(Config.lightColor.r - .1f, 0f, 2f); Config.lightColor.g = Utils.Clamp(Config.lightColor.g - .1f, 0f, 2f); Config.lightColor.b = Utils.Clamp(Config.lightColor.b - .1f, 0f, 2f); UpdateLight(); }, Trans, "<color=#FF0000>A</color><color=#00FF00>L</color><color=#0000FF>L</color> -", "All-Button"), new SingleButton(() => { Config.lightColor.r = 1f; UpdateLight(); }, Reset, "Reset", "RedResetButton"), new SingleButton(() => { Config.lightColor.g = 1f; UpdateLight(); }, Reset, "Reset", "GreenResetButton"), new SingleButton(() => { Config.lightColor.b = 1f; UpdateLight(); }, Reset, "Reset", "BlueResetButton"), new SingleButton(() => { Config.lightColor.r = 1f; Config.lightColor.g = 1f; Config.lightColor.b = 1f; UpdateLight(); }, Reset, "Reset", "AllResetButton") }, (group) => buttgroup = group) ); var origButt = UiManager.QMStateController.transform.Find("Container/Window/QMParent/Menu_Here/QMHeader_H1/RightItemContainer/Button_QM_Expand"); var newButt = UnityEngine.Object.Instantiate(origButt); var butAction = new System.Action(() => { UiManager.OpenSubMenu(UiManager.QMStateController.field_Private_UIPage_0, headLightSub.uiPage); }); newButt.name = "HeadLight_UI"; newButt.SetParent(UiManager.QMStateController.transform.Find("Container/Window/QMParent/Menu_Here/QMHeader_H1")); newButt.localPosition = new Vector3(buttX.Value, buttY.Value, 0f); //200f, -60f newButt.GetComponent <Button>().onClick = new Button.ButtonClickedEvent(); newButt.GetComponent <Button>().onClick.AddListener(butAction); newButt.GetComponent <VRC.UI.Elements.Tooltips.UiTooltip>().field_Public_String_0 = "HeadLight"; newButt.GetComponentInChildren <Image>().overrideSprite = flashLight; uiButton = newButt; buttX.OnValueChanged += OnPositionChange; buttY.OnValueChanged += OnPositionChange; } catch (System.Exception ex) { MelonLogger.Error("LocalHeadLightMoid Init: " + ex.ToString()); } }
private void BuildStep3() { currentStep = 3; mainText.Text = "Tell us a little bit more \r\n about your bisness"; bottomLayout.Children.Clear(); var label = new CustomLabel() { Text = "What is your typical price range", TextColor = Color.Black, FontSize = 16, FontFamily = UIUtils.FONT_SFUIDISPLAY_REGULAR, HorizontalTextAlignment = TextAlignment.Center, VerticalTextAlignment = TextAlignment.Center, Margin = new Thickness(20) }; bottomLayout.Children.Add(label); tierGroup = new ButtonGroup(); tierGroup.Buttons = new List <string> { "5K - 10K", "10K - 25K", "25K+" }; tierGroup.HorizontalOptions = LayoutOptions.Center; tierGroup.Margin = new Thickness(0, 10, 0, 20); bottomLayout.Children.Add(tierGroup); var label2 = new CustomLabel() { Text = "Are you willing to travel to the customer's location?", TextColor = Color.Black, FontSize = 16, FontFamily = UIUtils.FONT_SFUIDISPLAY_REGULAR, HorizontalTextAlignment = TextAlignment.Center, VerticalTextAlignment = TextAlignment.Center, Margin = new Thickness(20) }; bottomLayout.Children.Add(label2); travelGroup = new ButtonGroup(); travelGroup.Buttons = new List <string> { "Yes", "No" }; travelGroup.HorizontalOptions = LayoutOptions.Center; travelGroup.Margin = new Thickness(0, 10, 0, 20); bottomLayout.Children.Add(travelGroup); var label3 = new CustomLabel() { Text = "How much will you charge to travel?", TextColor = Color.Black, FontSize = 16, FontFamily = UIUtils.FONT_SFUIDISPLAY_REGULAR, HorizontalTextAlignment = TextAlignment.Center, VerticalTextAlignment = TextAlignment.Center, Margin = new Thickness(20) }; bottomLayout.Children.Add(label3); travelEntry = UIUtils.MakeEntry("Travel charge", UIUtils.FONT_SFUIDISPLAY_BOLD); travelEntry.Keyboard = Keyboard.Numeric; bottomLayout.Children.Add(travelEntry); bottomLayout.Children.Add(UIUtils.MakeSeparator()); var continueButton = UIUtils.MakeButton("CONTINUE", UIUtils.FONT_SFUIDISPLAY_REGULAR); continueButton.Clicked += OnContinue; bottomLayout.Children.Add(continueButton); bottomLayout.ForceLayout(); }
public GetMenuResult() { menu = new ButtonGroup(); }
/// <summary> /// 根据微信返回的Json数据得到可用的GetMenuResult结果 /// </summary> /// <param name="resultFull"></param> /// <returns></returns> public GetMenuResult GetMenuFromJsonResult(GetMenuResultFull resultFull) { GetMenuResult result = null; try { //重新整理按钮信息 ButtonGroup bg = new ButtonGroup(); foreach (var rootButton in resultFull.menu.button) { if (rootButton.name == null) { continue; //没有设置一级菜单 } var availableSubButton = rootButton.sub_button.Count(z => !string.IsNullOrEmpty(z.name)); //可用二级菜单按钮数量 if (availableSubButton == 0) { //底部单击按钮 if (rootButton.type.Equals("CLICK", StringComparison.OrdinalIgnoreCase) && string.IsNullOrEmpty(rootButton.key)) { throw new WeixinMenuException("单击按钮的key不能为空!"); } if (rootButton.type.Equals("CLICK", StringComparison.OrdinalIgnoreCase)) { //点击 bg.button.Add(new SingleClickButton() { name = rootButton.name, key = rootButton.key, type = rootButton.type }); } else { //URL bg.button.Add(new SingleViewButton() { name = rootButton.name, url = rootButton.url, type = rootButton.type }); } } //else if (availableSubButton < 1) //{ // throw new WeixinMenuException("子菜单至少需要填写1个!"); //} else { //底部二级菜单 var subButton = new SubButton(rootButton.name); bg.button.Add(subButton); foreach (var subSubButton in rootButton.sub_button) { if (subSubButton.name == null) { continue; //没有设置菜单 } if (subSubButton.type.Equals("CLICK", StringComparison.OrdinalIgnoreCase) && string.IsNullOrEmpty(subSubButton.key)) { throw new WeixinMenuException("单击按钮的key不能为空!"); } if (subSubButton.type.Equals("CLICK", StringComparison.OrdinalIgnoreCase)) { //点击 subButton.sub_button.Add(new SingleClickButton() { name = subSubButton.name, key = subSubButton.key, type = subSubButton.type }); } else { //URL subButton.sub_button.Add(new SingleViewButton() { name = subSubButton.name, url = subSubButton.url, type = subSubButton.type }); } } } } if (bg.button.Count < 1) { throw new WeixinMenuException("一级菜单按钮至少为1个!"); } result = new GetMenuResult(bg) { menu = bg }; } catch (Exception ex) { throw new WeixinMenuException(ex.Message, ex); } return(result); }
public CharacterPickerButton( IEntityManager entityManager, IClientPreferencesManager preferencesManager, ButtonGroup group, ICharacterProfile profile) { AddStyleClass(StyleClassButton); ToggleMode = true; Group = group; _previewDummy = entityManager.SpawnEntity("HumanMob_Dummy", MapCoordinates.Nullspace); _previewDummy.GetComponent <HumanoidAppearanceComponent>().UpdateFromProfile(profile); var humanoid = profile as HumanoidCharacterProfile; if (humanoid != null) { LobbyCharacterPreviewPanel.GiveDummyJobClothes(_previewDummy, humanoid); } var isSelectedCharacter = profile == preferencesManager.Preferences.SelectedCharacter; if (isSelectedCharacter) { Pressed = true; } var view = new SpriteView { Sprite = _previewDummy.GetComponent <SpriteComponent>(), Scale = (2, 2), OverrideDirection = Direction.South }; var description = profile.Name; var highPriorityJob = humanoid?.JobPriorities.SingleOrDefault(p => p.Value == JobPriority.High).Key; if (highPriorityJob != null) { var jobName = IoCManager.Resolve <IPrototypeManager>().Index <JobPrototype>(highPriorityJob).Name; description = $"{description}\n{jobName}"; } var descriptionLabel = new Label { Text = description, ClipText = true, SizeFlagsHorizontal = SizeFlags.FillExpand }; var deleteButton = new Button { Text = "Delete", Visible = !isSelectedCharacter, }; deleteButton.OnPressed += args => { Parent.RemoveChild(this); preferencesManager.DeleteCharacter(profile); }; var internalHBox = new HBoxContainer { SizeFlagsHorizontal = SizeFlags.FillExpand, SeparationOverride = 0, Children = { view, descriptionLabel, deleteButton } }; AddChild(internalHBox); }
public void SetButton(ButtonGroup group, ButtonIlluminationState state) { if (_outputDevice != null) { if (group == ButtonGroup.JogButtons || group == ButtonGroup.AllButtons) { for (int i = (int)Button.JogPad01; i <= (int)Button.JogPad08; i++) { _outputDevice.SendNoteOn(Channel.Channel6, (Pitch)i, (int)state); } } if (group == ButtonGroup.SmallPadButtons || group == ButtonGroup.AllButtons) { for (int i = (int)Button.SmallPad01; i <= (int)Button.SmallPad08; i++) { _outputDevice.SendNoteOn(Channel.Channel6, (Pitch)i, (int)state); } } if (group == ButtonGroup.LargePadButtons || group == ButtonGroup.AllButtons) { for (int i = (int)Button.LargePad01; i <= (int)Button.LargePad16; i++) { _outputDevice.SendNoteOn(Channel.Channel6, (Pitch)i, (int)state); } } } }
public ResponseUnit(ButtonGroup btnGroup, Button btn) { this.btnGroup = btnGroup; this.btn = btn; }
/// <summary> /// Sets up the GUI. </summary> /// <param name="index"> the index of the network node to preselect. </param> private void setupGUI(int index) { string routine = "StateMod_RiverNetworkNode_JFrame.setupGUI"; addWindowListener(this); JPanel p1 = new JPanel(); // entire top half __searchID = new JTextField(10); __searchName = new JTextField(10); __findNext = new JButton(__BUTTON_FIND_NEXT); __searchCriteriaGroup = new ButtonGroup(); __searchIDJRadioButton = new JRadioButton("ID", true); __searchIDJRadioButton.addActionListener(this); __searchCriteriaGroup.add(__searchIDJRadioButton); __searchNameJRadioButton = new JRadioButton("Name", false); __searchNameJRadioButton.addActionListener(this); __searchCriteriaGroup.add(__searchNameJRadioButton); __idJTextField = new JTextField(12); __idJTextField.setEditable(false); __nameJTextField = new JTextField(24); __nameJTextField.setEditable(false); __nodeJTextField = new JTextField(12); __commentJTextField = new JTextField(24); __showOnMap_JButton = new SimpleJButton(__BUTTON_SHOW_ON_MAP, this); __showOnMap_JButton.setToolTipText("Annotate map with location (button is disabled if layer does not have matching ID)"); __showOnNetwork_JButton = new SimpleJButton(__BUTTON_SHOW_ON_NETWORK, this); __showOnNetwork_JButton.setToolTipText("Annotate network with location"); __applyJButton = new JButton(__BUTTON_APPLY); __cancelJButton = new JButton(__BUTTON_CANCEL); __helpJButton = new JButton(__BUTTON_HELP); __closeJButton = new JButton(__BUTTON_CLOSE); GridBagLayout gb = new GridBagLayout(); p1.setLayout(gb); int y = 0; PropList p = new PropList("StateMod_RiverNetworkNode_JFrame.JWorksheet"); p.add("JWorksheet.ShowPopupMenu=true"); p.add("JWorksheet.AllowCopy=true"); p.add("JWorksheet.SelectionMode=SingleRowSelection"); int[] widths = null; JScrollWorksheet jsw = null; try { StateMod_RiverNetworkNode_TableModel tmr = new StateMod_RiverNetworkNode_TableModel(__riverNetworkNodesVector); StateMod_RiverNetworkNode_CellRenderer crr = new StateMod_RiverNetworkNode_CellRenderer(tmr); jsw = new JScrollWorksheet(crr, tmr, p); __worksheet = jsw.getJWorksheet(); widths = crr.getColumnWidths(); } catch (Exception e) { Message.printWarning(2, routine, e); jsw = new JScrollWorksheet(0, 0, p); __worksheet = jsw.getJWorksheet(); } __worksheet.setPreferredScrollableViewportSize(null); __worksheet.setHourglassJFrame(this); __worksheet.addMouseListener(this); __worksheet.addKeyListener(this); JGUIUtil.addComponent(p1, jsw, 0, y, 4, 9, 1, 1, 0, 0, 0, 0, GridBagConstraints.BOTH, GridBagConstraints.WEST); JGUIUtil.addComponent(p1, new JLabel("ID:"), 5, y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.EAST); JGUIUtil.addComponent(p1, __idJTextField, 6, y++, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); JGUIUtil.addComponent(p1, new JLabel("Name:"), 5, y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.EAST); JGUIUtil.addComponent(p1, __nameJTextField, 6, y++, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); JGUIUtil.addComponent(p1, new JLabel("Downstream Node:"), 5, y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.EAST); JGUIUtil.addComponent(p1, __nodeJTextField, 6, y++, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); JGUIUtil.addComponent(p1, new JLabel("Comment:"), 5, y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.EAST); JGUIUtil.addComponent(p1, __commentJTextField, 6, y++, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); // // add search areas // y = 10; JPanel searchPanel = new JPanel(); searchPanel.setLayout(gb); searchPanel.setBorder(BorderFactory.createTitledBorder("Search list for: ")); JGUIUtil.addComponent(p1, searchPanel, 0, y, 1, 1, 0, 0, 10, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); JGUIUtil.addComponent(searchPanel, __searchIDJRadioButton, 0, ++y, 1, 1, 0, 0, 5, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); JGUIUtil.addComponent(searchPanel, __searchID, 1, y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.HORIZONTAL, GridBagConstraints.EAST); __searchID.addActionListener(this); JGUIUtil.addComponent(searchPanel, __searchNameJRadioButton, 0, ++y, 1, 1, 0, 0, 5, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); __searchName.setEditable(false); JGUIUtil.addComponent(searchPanel, __searchName, 1, y, 1, 1, 0, 0, 0, 0, 0, 0, GridBagConstraints.HORIZONTAL, GridBagConstraints.EAST); __searchName.addActionListener(this); JGUIUtil.addComponent(searchPanel, __findNext, 0, ++y, 4, 1, 0, 0, 10, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST); __findNext.addActionListener(this); // // add close and help buttons // JPanel pfinal = new JPanel(); FlowLayout fl = new FlowLayout(FlowLayout.RIGHT); pfinal.setLayout(fl); __helpJButton.setEnabled(false); pfinal.add(__showOnMap_JButton); pfinal.add(__showOnNetwork_JButton); if (__editable) { pfinal.add(__applyJButton); pfinal.add(__cancelJButton); } pfinal.add(__closeJButton); // pfinal.add(__helpJButton); __applyJButton.addActionListener(this); __cancelJButton.addActionListener(this); __helpJButton.addActionListener(this); __closeJButton.addActionListener(this); getContentPane().add("Center", p1); getContentPane().add("South", pfinal); initializeDisables(); selectTableIndex(index); if (__dataset_wm != null) { __dataset_wm.setWindowOpen(StateMod_DataSet_WindowManager.WINDOW_RIVER_NETWORK, this); } pack(); setSize(690, 400); JGUIUtil.center(this); setVisible(true); if (widths != null) { __worksheet.setColumnWidths(widths); } __worksheet.addSortListener(this); }
internal ButtonGroupBuilder(HtmlHelper <TModel> htmlHelper, ButtonGroup buttonGroup) : base(htmlHelper, buttonGroup) { }
public static string CreateMenu() { var accessToken = AccessTokenContainer.TryGetAccessToken(appid, secret); ButtonGroup bg = new ButtonGroup(); ////单击 //bg.button.Add(new SingleClickButton() //{ // name = "单击测试", // key = "OneClick", // type = ButtonType.click.ToString(),//默认已经设为此类型,这里只作为演示 //}); //bg.button.Add(new SingleViewButton() //{ // url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx8773baee612e9144&redirect_uri=http%3a%2f%2fwww.mingshukeji.com.cn%2fwechat%2fh5%2f%23%2fanswer&response_type=code&scope=snsapi_userinfo&state=success#wechat_redirect", // name = "有奖问题" //}); //二级菜单 var subButton = new SubButton() { name = "公司介绍" }; subButton.sub_button.Add(new SingleViewButton() { url = "https://www.baidu.com/", name = "联系我们" }); subButton.sub_button.Add(new SingleViewButton() { url = "https://www.baidu.com/", name = "关于快享" }); bg.button.Add(subButton); var subButton1 = new SubButton() { name = "方案介绍" }; subButton1.sub_button.Add(new SingleViewButton() { url = "https://www.baidu.com/", name = "Q&A" }); subButton1.sub_button.Add(new SingleViewButton() { url = "https://www.baidu.com/", name = "案例分享" }); subButton1.sub_button.Add(new SingleViewButton() { url = "https://www.baidu.com/", name = "院内物流中心" }); subButton1.sub_button.Add(new SingleViewButton() { url = "https://www.baidu.com/", name = "物资云" }); bg.button.Add(subButton1); bg.button.Add(new SingleViewButton() { //url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx8773baee612e9144&redirect_uri=http%3a%2f%2fwww.mingshukeji.com.cn%2fWechatManage%2fLoginAuthorise&response_type=code&scope=snsapi_userinfo&state=success#wechat_redirect", url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx8773baee612e9144&redirect_uri=http%3a%2f%2fwww.mingshukeji.com.cn%2fQuickShareWechat%2fh5%2f%23%2fregister&response_type=code&scope=snsapi_userinfo&state=success#wechat_redirect", name = "有奖问答" }); var result = CommonApi.CreateMenu(accessToken, bg); return("菜单创建成功"); }
public SelectionEventArgs(ButtonGroup selected, ButtonGroup unselected) { Selected = selected; Unselected = unselected; }
public UIPauseState(UIHandler uiHandler, GameObject parentNode, ButtonGroup buttonGroup) : base(uiHandler, parentNode) { this.buttonGroup = buttonGroup; }
/// <summary> /// 创建菜单 /// </summary> /// <param name="accessToken"></param> /// <param name="agentId"></param> /// <param name="buttonData">菜单内容</param> /// <param name="timeOut">代理请求超时时间(毫秒)</param> /// <returns></returns> public static WorkJsonResult CreateMenu(string accessTokenOrAppId, int agentId, ButtonGroup buttonData, int timeOut = Config.TIME_OUT) { return(ApiHandlerWapper.TryCommonApi(accessToken => { ////对特殊符号进行URL转义 //foreach (var button in buttonData.button) //{ // button.name = ButtonNameEncode(button.name);//button.name.UrlEncode(); // if (button is SubButton) // { // var subButtonList = button as SubButton; // foreach (var subButton in subButtonList.sub_button) // { // subButton.name = ButtonNameEncode(button.name);//button.name.UrlEncode(); // } // } //} var urlFormat = string.Format(Config.ApiWorkHost + "/cgi-bin/menu/create?access_token={0}&agentid={1}", accessToken.AsUrlData(), agentId); return CommonJsonSend.Send <WorkJsonResult>(accessToken, urlFormat, buttonData, CommonJsonSendType.POST, timeOut: timeOut); }, accessTokenOrAppId)); }
//保存 protected void btnSubmit_Click(object sender, EventArgs e) { try { string error = string.Empty; string accessToken = cpp.GetAccessToken(this.id, out error); if (!string.IsNullOrEmpty(error)) { JscriptMsg(error, string.Empty); return; } //重新整理按钮信息 ButtonGroup bg = new ButtonGroup(); TextBox txtName = new TextBox(); TextBox txtKey = new TextBox(); TextBox txtUrl = new TextBox(); IList <BaseButton> topList = new List <BaseButton>(); IList <SingleButton> subList = new List <SingleButton>(); //菜单设置 for (int i = 0; i < 3; i++) { txtName = this.FindControl("txtTop" + (i + 1) + "Name") as TextBox; txtKey = this.FindControl("txtTop" + (i + 1) + "Key") as TextBox; txtUrl = this.FindControl("txtTop" + (i + 1) + "Url") as TextBox; if (txtName.Text.Trim() == "") { // 如果名称为空,则忽略该菜单,以及下面的子菜单 continue; } subList = new List <SingleButton>(); TextBox txtSubName = new TextBox(); TextBox txtSubKey = new TextBox(); TextBox txtSubUrl = new TextBox(); for (int j = 0; j < 5; j++) { //子菜单的设置 txtSubName = this.FindControl("txtMenu" + (i + 1) + (j + 1) + "Name") as TextBox; txtSubKey = this.FindControl("txtMenu" + (i + 1) + (j + 1) + "Key") as TextBox; txtSubUrl = this.FindControl("txtMenu" + (i + 1) + (j + 1) + "Url") as TextBox; if (txtSubName.Text.Trim() == "") { continue; } if (txtSubUrl.Text.Trim() != "") { SingleViewButton sub = new SingleViewButton(); sub.name = txtSubName.Text.Trim(); sub.url = txtSubUrl.Text.Trim(); subList.Add(sub); } else if (txtSubKey.Text.Trim() != "") { SingleClickButton sub = new SingleClickButton(); sub.name = txtSubName.Text.Trim(); sub.key = txtSubKey.Text.Trim(); subList.Add(sub); } else { //报错 :子菜单必须有key和name JscriptMsg("二级菜单的名称和key或者url必填!", string.Empty); return; } } if (subList != null && subList.Count > 0) { //有子菜单, 该一级菜单是SubButton if (subList.Count < 1) { JscriptMsg("子菜单个数必须为2至5个!", string.Empty); return; } SubButton topButton = new SubButton(Utils.CutString(txtName.Text.Trim(), 16)); topButton.sub_button.AddRange(subList); topList.Add(topButton); } else { // 无子菜单 if (txtKey.Text.Trim() == "" && txtUrl.Text.Trim() == "") { JscriptMsg("如无子菜单,必须填写Key或者URL值!", string.Empty); return; } if (txtUrl.Text.Trim() != "") { //view 页面跳转 SingleViewButton topSingleButton = new SingleViewButton(); topSingleButton.name = txtName.Text.Trim(); topSingleButton.url = txtUrl.Text.Trim(); topList.Add(topSingleButton); } else if (txtKey.Text.Trim() != "") { SingleClickButton topSingleButton = new SingleClickButton(); topSingleButton.name = txtName.Text.Trim(); topSingleButton.key = txtKey.Text.Trim(); topList.Add(topSingleButton); } } } bg.button.AddRange(topList); var result = mMrg.CreateMenu(accessToken, bg); JscriptMsg("自定义菜单保存成功!", "menu_list.aspx"); } catch (Exception ex) { JscriptMsg("出错了:" + ex.Message, string.Empty); } }
public async Task <WxJsonResult> SyncMenu(List <MpMenu> menus) { var mpid = await _userMpAppService.GetDefaultMpId(); var account = _mpAccountAppService.Get(new Abp.Application.Services.Dto.EntityDto <int> { Id = mpid }).Result; var access_token = await _accessTokenContainer.TryGetAccessTokenAsync(account.AppId, account.AppSecret); var bg = new ButtonGroup(); foreach (var rootButton in menus.Where(c => c.Length == 1)) { var subbuttons = menus.Where(c => c.ParentID == rootButton.Id); #region 无子菜单 if (subbuttons.Count() == 0) { //底部单击按钮 if (rootButton.Type == null || (rootButton.Type.Equals("CLICK", StringComparison.OrdinalIgnoreCase) && rootButton.Id == 0)) { throw new WeixinMenuException("单击按钮的key不能为空!"); } if (rootButton.Type.Equals("CLICK", StringComparison.OrdinalIgnoreCase)) { //点击 bg.button.Add(new SingleClickButton() { name = rootButton.Name, key = rootButton.MenuKey, type = rootButton.Type }); } else if (rootButton.Type.Equals("VIEW", StringComparison.OrdinalIgnoreCase)) { //URL bg.button.Add(new SingleViewButton() { name = rootButton.Name, url = rootButton.LinkUrl, type = rootButton.Type }); } else if (rootButton.Type.Equals("LOCATION_SELECT", StringComparison.OrdinalIgnoreCase)) { //弹出地理位置选择器 bg.button.Add(new SingleLocationSelectButton() { name = rootButton.Name, key = rootButton.MenuKey, type = rootButton.Type }); } else if (rootButton.Type.Equals("PIC_PHOTO_OR_ALBUM", StringComparison.OrdinalIgnoreCase)) { //弹出拍照或者相册发图 bg.button.Add(new SinglePicPhotoOrAlbumButton() { name = rootButton.Name, key = rootButton.MenuKey, type = rootButton.Type }); } else if (rootButton.Type.Equals("PIC_SYSPHOTO", StringComparison.OrdinalIgnoreCase)) { //弹出系统拍照发图 bg.button.Add(new SinglePicSysphotoButton() { name = rootButton.Name, key = rootButton.MenuKey, type = rootButton.Type }); } else if (rootButton.Type.Equals("PIC_WEIXIN", StringComparison.OrdinalIgnoreCase)) { //弹出微信相册发图器 bg.button.Add(new SinglePicWeixinButton() { name = rootButton.Name, key = rootButton.MenuKey, type = rootButton.Type }); } else if (rootButton.Type.Equals("SCANCODE_PUSH", StringComparison.OrdinalIgnoreCase)) { //扫码推事件 bg.button.Add(new SingleScancodePushButton() { name = rootButton.Name, key = rootButton.MenuKey, type = rootButton.Type }); } else { //扫码推事件且弹出“消息接收中”提示框 bg.button.Add(new SingleScancodeWaitmsgButton() { name = rootButton.Name, key = rootButton.MenuKey, type = rootButton.Type }); } } #endregion #region 子菜单 else { var subButton = new SubButton(rootButton.Name); bg.button.Add(subButton); foreach (var subSubButton in subbuttons) { if (subSubButton.Name == null) { continue; //没有设置菜单 } if (subSubButton.Type.Equals("CLICK", StringComparison.OrdinalIgnoreCase) && subSubButton.Id == 0) { throw new WeixinMenuException("单击按钮的key不能为空!"); } if (subSubButton.Type.Equals("CLICK", StringComparison.OrdinalIgnoreCase)) { //点击 subButton.sub_button.Add(new SingleClickButton() { name = subSubButton.Name, key = subSubButton.MenuKey, type = subSubButton.Type }); } else if (subSubButton.Type.Equals("VIEW", StringComparison.OrdinalIgnoreCase)) { //URL subButton.sub_button.Add(new SingleViewButton() { name = subSubButton.Name, url = subSubButton.LinkUrl, type = subSubButton.Type }); } else if (subSubButton.Type.Equals("LOCATION_SELECT", StringComparison.OrdinalIgnoreCase)) { //弹出地理位置选择器 subButton.sub_button.Add(new SingleLocationSelectButton() { name = subSubButton.Name, key = subSubButton.MenuKey, type = subSubButton.Type }); } else if (subSubButton.Type.Equals("PIC_PHOTO_OR_ALBUM", StringComparison.OrdinalIgnoreCase)) { //弹出拍照或者相册发图 subButton.sub_button.Add(new SinglePicPhotoOrAlbumButton() { name = subSubButton.Name, key = subSubButton.MenuKey, type = subSubButton.Type }); } else if (subSubButton.Type.Equals("PIC_SYSPHOTO", StringComparison.OrdinalIgnoreCase)) { //弹出系统拍照发图 subButton.sub_button.Add(new SinglePicSysphotoButton() { name = subSubButton.Name, key = subSubButton.MenuKey, type = subSubButton.Type }); } else if (subSubButton.Type.Equals("PIC_WEIXIN", StringComparison.OrdinalIgnoreCase)) { //弹出微信相册发图器 subButton.sub_button.Add(new SinglePicWeixinButton() { name = subSubButton.Name, key = subSubButton.MenuKey, type = subSubButton.Type }); } else if (subSubButton.Type.Equals("SCANCODE_PUSH", StringComparison.OrdinalIgnoreCase)) { //扫码推事件 subButton.sub_button.Add(new SingleScancodePushButton() { name = subSubButton.Name, key = subSubButton.MenuKey, type = subSubButton.Type }); } else { //扫码推事件且弹出“消息接收中”提示框 subButton.sub_button.Add(new SingleScancodeWaitmsgButton() { name = subSubButton.Name, key = subSubButton.MenuKey, type = subSubButton.Type }); } } } #endregion } WxJsonResult result = null; try { result = CommonApi.CreateMenu(access_token, bg); } catch (Exception ex) { Logger.Error(string.Format("更新MpID为{0}的菜单报错,原因:{1}", mpid, ex)); try { access_token = await _accessTokenContainer.TryGetAccessTokenAsync(account.AppId, account.AppSecret, true); result = CommonApi.CreateMenu(access_token, bg); } catch (Exception e) { throw new UserFriendlyException(e.Message); } } //if (result.errcode != ReturnCode.请求成功) // result = CommonApi.CreateMenu(access_token, bg); //if (result.errcode != ReturnCode.请求成功) // throw new WeixinException("更新MpID为" + mpid + "的菜单报错,原因:" + result.errmsg); return(result); }
public CharacterPickerButton( IEntityManager entityManager, IClientPreferencesManager preferencesManager, IPrototypeManager prototypeManager, ButtonGroup group, ICharacterProfile profile) { AddStyleClass(StyleClassButton); ToggleMode = true; Group = group; var humanoid = profile as HumanoidCharacterProfile; if (humanoid is not null) { var dummy = prototypeManager.Index <SpeciesPrototype>(humanoid.Species).DollPrototype; _previewDummy = entityManager.SpawnEntity(dummy, MapCoordinates.Nullspace); } else { _previewDummy = entityManager.SpawnEntity(prototypeManager.Index <SpeciesPrototype>(SpeciesManager.DefaultSpecies).DollPrototype, MapCoordinates.Nullspace); } EntitySystem.Get <SharedHumanoidAppearanceSystem>().UpdateFromProfile(_previewDummy, profile); if (humanoid != null) { LobbyCharacterPreviewPanel.GiveDummyJobClothes(_previewDummy, humanoid); } var isSelectedCharacter = profile == preferencesManager.Preferences?.SelectedCharacter; if (isSelectedCharacter) { Pressed = true; } var view = new SpriteView { Sprite = entityManager.GetComponent <SpriteComponent>(_previewDummy), Scale = (2, 2), OverrideDirection = Direction.South }; var description = profile.Name; var highPriorityJob = humanoid?.JobPriorities.SingleOrDefault(p => p.Value == JobPriority.High).Key; if (highPriorityJob != null) { var jobName = IoCManager.Resolve <IPrototypeManager>().Index <JobPrototype>(highPriorityJob).LocalizedName; description = $"{description}\n{jobName}"; } var descriptionLabel = new Label { Text = description, ClipText = true, HorizontalExpand = true }; var deleteButton = new Button { Text = Loc.GetString("character-setup-gui-character-picker-button-delete-button"), Visible = !isSelectedCharacter, }; deleteButton.OnPressed += _ => { Parent?.RemoveChild(this); preferencesManager.DeleteCharacter(profile); }; var internalHBox = new BoxContainer { Orientation = LayoutOrientation.Horizontal, HorizontalExpand = true, SeparationOverride = 0, Children = { view, descriptionLabel, deleteButton } }; AddChild(internalHBox); }
public HumanoidProfileEditor(IClientPreferencesManager preferencesManager, IPrototypeManager prototypeManager) { _random = IoCManager.Resolve<IRobustRandom>(); _preferencesManager = preferencesManager; var margin = new MarginContainer { MarginTopOverride = 10, MarginBottomOverride = 10, MarginLeftOverride = 10, MarginRightOverride = 10 }; AddChild(margin); var vBox = new VBoxContainer(); margin.AddChild(vBox); var middleContainer = new HBoxContainer { SeparationOverride = 10 }; vBox.AddChild(middleContainer); var leftColumn = new VBoxContainer(); middleContainer.AddChild(leftColumn); #region Randomize { var panel = HighlightedContainer(); var randomizeEverythingButton = new Button { Text = Loc.GetString("Randomize everything") }; randomizeEverythingButton.OnPressed += args => { RandomizeEverything(); }; panel.AddChild(randomizeEverythingButton); leftColumn.AddChild(panel); } #endregion Randomize #region Name { var panel = HighlightedContainer(); var hBox = new HBoxContainer { SizeFlagsVertical = SizeFlags.FillExpand }; var nameLabel = new Label {Text = Loc.GetString("Name:")}; _nameEdit = new LineEdit { CustomMinimumSize = (270, 0), SizeFlagsVertical = SizeFlags.ShrinkCenter }; _nameEdit.OnTextChanged += args => { SetName(args.Text); }; var nameRandomButton = new Button { Text = Loc.GetString("Randomize"), }; nameRandomButton.OnPressed += args => RandomizeName(); hBox.AddChild(nameLabel); hBox.AddChild(_nameEdit); hBox.AddChild(nameRandomButton); panel.AddChild(hBox); leftColumn.AddChild(panel); } #endregion Name var tabContainer = new TabContainer {SizeFlagsVertical = SizeFlags.FillExpand}; vBox.AddChild(tabContainer); #region Appearance { var appearanceVBox = new VBoxContainer(); tabContainer.AddChild(appearanceVBox); tabContainer.SetTabTitle(0, Loc.GetString("Appearance")); var sexAndAgeRow = new HBoxContainer { SeparationOverride = 10 }; appearanceVBox.AddChild(sexAndAgeRow); #region Sex { var panel = HighlightedContainer(); var hBox = new HBoxContainer(); var sexLabel = new Label {Text = Loc.GetString("Sex:")}; var sexButtonGroup = new ButtonGroup(); _sexMaleButton = new Button { Text = Loc.GetString("Male"), Group = sexButtonGroup }; _sexMaleButton.OnPressed += args => { SetSex(Sex.Male); }; _sexFemaleButton = new Button { Text = Loc.GetString("Female"), Group = sexButtonGroup }; _sexFemaleButton.OnPressed += args => { SetSex(Sex.Female); }; hBox.AddChild(sexLabel); hBox.AddChild(_sexMaleButton); hBox.AddChild(_sexFemaleButton); panel.AddChild(hBox); sexAndAgeRow.AddChild(panel); } #endregion Sex #region Age { var panel = HighlightedContainer(); var hBox = new HBoxContainer(); var ageLabel = new Label {Text = Loc.GetString("Age:")}; _ageEdit = new LineEdit {CustomMinimumSize = (40, 0)}; _ageEdit.OnTextChanged += args => { if (!int.TryParse(args.Text, out var newAge)) return; SetAge(newAge); }; hBox.AddChild(ageLabel); hBox.AddChild(_ageEdit); panel.AddChild(hBox); sexAndAgeRow.AddChild(panel); } #endregion Age #region Hair { var panel = HighlightedContainer(); panel.SizeFlagsHorizontal = SizeFlags.None; var hairHBox = new HBoxContainer(); _hairPicker = new HairStylePicker(); _hairPicker.Populate(); _hairPicker.OnHairStylePicked += newStyle => { if (Profile is null) return; Profile = Profile.WithCharacterAppearance( Profile.Appearance.WithHairStyleName(newStyle)); IsDirty = true; }; _hairPicker.OnHairColorPicked += newColor => { if (Profile is null) return; Profile = Profile.WithCharacterAppearance( Profile.Appearance.WithHairColor(newColor)); IsDirty = true; }; _facialHairPicker = new FacialHairStylePicker(); _facialHairPicker.Populate(); _facialHairPicker.OnHairStylePicked += newStyle => { if (Profile is null) return; Profile = Profile.WithCharacterAppearance( Profile.Appearance.WithFacialHairStyleName(newStyle)); IsDirty = true; }; _facialHairPicker.OnHairColorPicked += newColor => { if (Profile is null) return; Profile = Profile.WithCharacterAppearance( Profile.Appearance.WithFacialHairColor(newColor)); IsDirty = true; }; hairHBox.AddChild(_hairPicker); hairHBox.AddChild(_facialHairPicker); panel.AddChild(hairHBox); appearanceVBox.AddChild(panel); } #endregion Hair } #endregion #region Jobs { var jobList = new VBoxContainer(); var jobVBox = new VBoxContainer { Children = { (_preferenceUnavailableButton = new OptionButton()), new ScrollContainer { SizeFlagsVertical = SizeFlags.FillExpand, Children = { jobList } } } }; tabContainer.AddChild(jobVBox); tabContainer.SetTabTitle(1, Loc.GetString("Jobs")); _preferenceUnavailableButton.AddItem( Loc.GetString("Stay in lobby if preference unavailable."), (int) PreferenceUnavailableMode.StayInLobby); _preferenceUnavailableButton.AddItem( Loc.GetString("Be an {0} if preference unavailable.", Loc.GetString(SharedGameTicker.OverflowJobName)), (int) PreferenceUnavailableMode.SpawnAsOverflow); _preferenceUnavailableButton.OnItemSelected += args => { _preferenceUnavailableButton.SelectId(args.Id); Profile = Profile.WithPreferenceUnavailable((PreferenceUnavailableMode) args.Id); IsDirty = true; }; _jobPriorities = new List<JobPrioritySelector>(); foreach (var job in prototypeManager.EnumeratePrototypes<JobPrototype>().OrderBy(j => j.Name)) { var selector = new JobPrioritySelector(job); jobList.AddChild(selector); _jobPriorities.Add(selector); selector.PriorityChanged += priority => { Profile = Profile.WithJobPriority(job.ID, priority); IsDirty = true; if (priority == JobPriority.High) { // Lower any other high priorities to medium. foreach (var jobSelector in _jobPriorities) { if (jobSelector != selector && jobSelector.Priority == JobPriority.High) { jobSelector.Priority = JobPriority.Medium; Profile = Profile.WithJobPriority(jobSelector.Job.ID, JobPriority.Medium); } } } }; } } #endregion #region Antags { var antagList = new VBoxContainer(); var antagVBox = new VBoxContainer { Children = { new ScrollContainer { SizeFlagsVertical = SizeFlags.FillExpand, Children = { antagList } } } }; tabContainer.AddChild(antagVBox); tabContainer.SetTabTitle(2, Loc.GetString("Antags")); _antagPreferences = new List<AntagPreferenceSelector>(); foreach (var antag in prototypeManager.EnumeratePrototypes<AntagPrototype>().OrderBy(a => a.Name)) { if(!antag.SetPreference) { continue; } var selector = new AntagPreferenceSelector(antag); antagList.AddChild(selector); _antagPreferences.Add(selector); selector.PreferenceChanged += preference => { Profile = Profile.WithAntagPreference(antag.ID, preference); IsDirty = true; }; } } #endregion var rightColumn = new VBoxContainer(); middleContainer.AddChild(rightColumn); #region Import/Export { var panelContainer = HighlightedContainer(); var hBox = new HBoxContainer(); var importButton = new Button { Text = Loc.GetString("Import"), Disabled = true, ToolTip = "Not yet implemented!" }; var exportButton = new Button { Text = Loc.GetString("Export"), Disabled = true, ToolTip = "Not yet implemented!" }; hBox.AddChild(importButton); hBox.AddChild(exportButton); panelContainer.AddChild(hBox); rightColumn.AddChild(panelContainer); } #endregion Import/Export #region Save { var panel = HighlightedContainer(); _saveButton = new Button { Text = Loc.GetString("Save"), SizeFlagsHorizontal = SizeFlags.ShrinkCenter }; _saveButton.OnPressed += args => { Save(); }; panel.AddChild(_saveButton); rightColumn.AddChild(panel); } #endregion Save if (preferencesManager.ServerDataLoaded) { LoadServerData(); } preferencesManager.OnServerDataLoaded += LoadServerData; IsDirty = false; }
protected override void Awake() { base.Awake(); Text = GetComponentInChildren <Text>(); ContinueButtonGroup = Global.FindChild <ButtonGroup>(transform, "ContinueButtonGroup"); }
public void CreateMenuTest() { return;//已经通过测试 //var accessToken = AccessTokenContainer.GetAccessToken(_appId); ButtonGroup bg = new ButtonGroup(); //二级菜单 var subButton = new SubButton() { name = "二级菜单" }; bg.button.Add(subButton); subButton.sub_button.Add(new SingleViewButton() { url = "https://book.weixin.senparc.com/book/link?code=SenparcRobotMenu", name = "《微信开发深度解析》" }); subButton.sub_button.Add(new SingleViewButton() { url = "https://sdk.weixin.senparc.com/TenpayV3/ProductList", name = "微信支付" }); subButton.sub_button.Add(new SingleClickButton() { key = "Description", name = "测试使用说明" }); subButton.sub_button.Add(new SingleClickButton() { key = "OneClick", name = "单击测试" }); subButton.sub_button.Add(new SingleViewButton() { url = "https://weixin.senparc.com/", name = "Url跳转" }); //二级菜单 var subButton2 = new SubButton() { name = "二级菜单" }; bg.button.Add(subButton2); subButton2.sub_button.Add(new SingleClickButton() { key = "SubClickRoot_Text", name = "返回文本" }); subButton2.sub_button.Add(new SingleClickButton() { key = "SubClickRoot_News", name = "返回图文" }); subButton2.sub_button.Add(new SingleClickButton() { key = "SubClickRoot_Music", name = "返回音乐" }); subButton2.sub_button.Add(new SingleClickButton() { key = "SubClickRoot_Image", name = "返回图片" }); subButton2.sub_button.Add(new SingleClickButton() { key = "OAuth", name = "OAuth2.0授权测试" }); //二级菜单 var subButton3 = new SubButton() { name = "更多" }; bg.button.Add(subButton3); subButton3.sub_button.Add(new SingleClickButton() { key = "SubClickRoot_Agent", name = "代理消息-返回图文" }); var result = CommonApi.CreateMenu(_appId, bg); Assert.IsNotNull(result); Assert.AreEqual("ok", result.errmsg); }
public ButtonGroupBuilder <TModel> Begin(ButtonGroup buttonGroup) { return(new ButtonGroupBuilder <TModel>(Html, buttonGroup)); }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); segoeFont = Content.Load<SpriteFont>("Fonts/Segoe"); gameClock = new Clock(Content.Load<Texture2D>("Textures/sprite0_0"), Content.Load<Texture2D>("Textures/Triangle")); gameClock.Position = new Vector3(30, 30, -1); gameClock.Parent = states[GameState.Play]; gameClock.TimeUpEvent += GameOver; #region Sound Intialization // play background music (using the system SoundPlayer which only plays waves...) player.SoundLocation = Content.RootDirectory + "\\Sounds\\Acid_Swamps.wav"; player.PlayLooping(); click = Content.Load<SoundEffect>("Sounds/click_tiny"); cannonShot = Content.Load<SoundEffect>("Sounds/cannon"); woodHit = Content.Load<SoundEffect>("Sounds/wood2"); rockHit = Content.Load<SoundEffect>("Sounds/crunchy"); glassHit = Content.Load<SoundEffect>("Sounds/breaking"); #endregion #region Camera Initialization cameras = new Camera[3]; cameras[0] = new Camera(); cameras[0].Position = new Vector3(0, 0, 10); cameras[0].AspectRatio = GraphicsDevice.Viewport.AspectRatio; cameras[1] = new Camera(); cameras[1].RotateX = -MathHelper.PiOver2; // to look down cameras[1].Position = new Vector3(0,10,0); cameras[1].AspectRatio = GraphicsDevice.Viewport.AspectRatio; cameras[2] = new Camera(); cameras[2].Position = new Vector3(0, 0, 5); cameras[2].AspectRatio = GraphicsDevice.Viewport.AspectRatio; curCamera = 0; // 0 = behind the cannon // 1 = top-down view // 2 = first person #endregion #region Game Objects Initialization generator = new TextureGenerator(GraphicsDevice, 256, 256); // load ground ground = new ModelObject(Content.Load<Model>("Models/Plane"), Vector3.Zero); ground.Position = new Vector3(0, -1, 0); ground.Scale *= 10.0f; ground.Parent = states[GameState.Play]; ground.Texture = generator.makeGroundTexture(); // load cannon cannon = new Cannon(Content.Load<Model>("Models/Torus"), Content.Load<Texture2D>("Textures/Stripes"), generator.makeBlank(), new Vector3(0,0,5)); cannon.Parent = states[GameState.Play]; cannon.FireEvent += FireCannon; ball = Content.Load<Model>("Models/Sphere"); // create the blocks cube = Content.Load<Model>("Models/Cube"); //SkyBox stuff skyCube = Content.Load<Model>("Models/Cube"); skyboxTexture = Content.Load<TextureCube>("Skyboxes/SunnySkybox"); skyboxEffect = Content.Load<Effect>("Skyboxes/Skybox"); skybox = new Skybox(skyCube,skyboxTexture,skyboxEffect); #endregion #region GUI Intialization pausePanel = new GUIElement(Content.Load<Texture2D>("Textures/Square"), 200, 200); pausePanel.Position = new Vector3(0,20,-1); pausePanel.Parent = states[GameState.Pause]; infoPanel = new GUIElement(Content.Load<Texture2D>("Textures/Square"), 200, 200); infoPanel.Position = new Vector3(0, 0, -2); infoPanel.Parent = states[GameState.Info]; mainMenuPanel = new GUIElement(Content.Load<Texture2D>("Textures/Square"), 200, 120); mainMenuPanel.Position = new Vector3(0, 0, -2); mainMenuPanel.Parent = states[GameState.Menu]; howToPanel = new GUIElement(Content.Load<Texture2D>("Textures/Square"), 500, 200); howToPanel.Position = new Vector3(200, 60, -1); howToPanel.eleColor = Color.Yellow; howToPanel.Parent = states[GameState.Info]; playPanel = new GUIElement(Content.Load<Texture2D>("Textures/Square"), 270, 70); playPanel.Position = new Vector3(180, 0, -1); playPanel.eleColor = Color.SeaShell; playPanel.Parent = states[GameState.Play]; playButton = new Button(40, 50, 50, 25, Content.Load<Texture2D>("Textures/Square"), segoeFont); playButton.MouseDown += PlayGame; playButton.TextColor = Color.Black; playButton.HoverColor = Color.YellowGreen; playButton.Text = "Play"; infoButton = new Button(40, 75, 50, 25, Content.Load<Texture2D>("Textures/Square"), segoeFont); infoButton.MouseDown += InfoMenu; infoButton.TextColor = Color.Black; infoButton.HoverColor = Color.YellowGreen; infoButton.Text = "Info"; quitButton = new Button(40, 75, 50, 25, Content.Load<Texture2D>("Textures/Square"), segoeFont); quitButton.MouseDown += QuitGame; quitButton.TextColor = Color.Black; quitButton.HoverColor = Color.YellowGreen; quitButton.Text = "Quit"; menuButton = new Button(40, 100, 50, 25, Content.Load<Texture2D>("Textures/Square"), segoeFont); menuButton.MouseDown += ToMenu; menuButton.TextColor = Color.Black; menuButton.HoverColor = Color.YellowGreen; menuButton.Text = "Main Menu"; mainMenuButtons = new ButtonGroup(Color.YellowGreen, click); mainMenuButtons.addButton(playButton); mainMenuButtons.addButton(quitButton); mainMenuButtons.Parent = states[GameState.Menu]; pauseMenuButtons = new ButtonGroup(Color.YellowGreen, click); pauseMenuButtons.addButton(playButton); pauseMenuButtons.addButton(infoButton); pauseMenuButtons.addButton(menuButton); pauseMenuButtons.Parent = states[GameState.Pause]; infoMenuButtons = new ButtonGroup(Color.YellowGreen, click); infoMenuButtons.addButton(playButton); infoMenuButtons.addButton(menuButton); infoMenuButtons.Parent = states[GameState.Info]; gameOverMenuButtons = new ButtonGroup(Color.YellowGreen, click); gameOverMenuButtons.addButton(menuButton); gameOverMenuButtons.addButton(quitButton); gameOverMenuButtons.Parent = states[GameState.End]; #endregion GUI Intialization }
public void CreateMenu() { try { var appid = _settingManager.GetSettingValue(AppSettings.Weixin.AppId); var appsecret = _settingManager.GetSettingValue(AppSettings.Weixin.AppSecret); var siteAddress = _settingManager.GetSettingValue(AppSettings.Wuye.Host); var menuService = _settingManager.GetSettingValue(AppSettings.Weixin.MenuService); var menuMall = _settingManager.GetSettingValue(AppSettings.Weixin.MenuMall); var menuMy = _settingManager.GetSettingValue(AppSettings.Weixin.MenuMy); var serviceTemplate = _settingManager.GetSettingValue(AppSettings.Weixin.ServiceTemplate); var mallTemplate = _settingManager.GetSettingValue(AppSettings.Weixin.MallTemplate); var myTemplate = _settingManager.GetSettingValue(AppSettings.Weixin.MyTemplate); if (!AccessTokenContainer.CheckRegistered(appid)) { AccessTokenContainer.Register(appid, appsecret); } ButtonGroup bg = new ButtonGroup(); if (menuService == "true") { string url = siteAddress + "/weixin/index"; switch (serviceTemplate) { case "SHOPPING-CENTER-001": url = siteAddress + "/weixin/shopping-center-001/index"; break; } bg.button.Add(new SingleViewButton() { name = "商户服务", type = "view", url = url }); } if (menuMall == "true") { string url = siteAddress + "/weixin/mall"; bg.button.Add(new SingleViewButton() { name = "商城", type = "view", url = url }); } if (menuMy == "true") { string url = siteAddress + "/weixin/my"; switch (myTemplate) { case "SHOPPING-CENTER-001": url = siteAddress + "/weixin/shopping-center-001/my"; break; } bg.button.Add(new SingleViewButton() { name = "我的", type = "view", url = url }); } var doresult = CommonApi.CreateMenu(AccessTokenContainer.GetAccessToken(appid), bg); } catch (Exception ex) { _logger.Error("创建微信菜单", ex); throw new UserFriendlyException(ex.Message, ex); } }
public void LoadUI(Transform tr) { instance = GameObject.Instantiate(Res, tr); ControlPanel = instance.transform.Find("CopyPlanetPanel").gameObject; ControlPanel.SetActive(false); //ControlPanel.AddComponent<Drag>(); ControlPanelRect = ControlPanel.GetComponent <RectTransform>(); firstPos1 = ControlPanelRect.position; ControlPanel.GetComponent <Image>().color = new Color(1, 1, 1, 1); var title = ControlPanel.transform.Find("title").GetComponent <Text>(); title.text = "星球蓝图 " + CopyPlanetFactory.Version; title.gameObject.AddComponent <DragParent>(); MainPanel = instance.transform.Find("MainPanel").gameObject; MainPanel.SetActive(false); ControlButton = new ButtonGroup(GetButton(instance.transform, "ButtonUIControl")); var rect = ControlPanel.transform.GetComponent <RectTransform>(); ControlButton.button.onClick.AddListener(delegate { //TaskInfo.gameObject.SetActive(!ControlPanel.activeSelf); ControlPanel.SetActive(!ControlPanel.activeSelf); }); ControlButton.SetActive(true); ChangeRecipe = instance.transform.Find("ChangeRecipeControl").gameObject; ChangeRecipe.SetActive(false); SelectBuild = ChangeRecipe.transform.Find("SelectBuild").GetComponent <Dropdown>(); SelectRecipe = ChangeRecipe.transform.Find("SelectRecipe").GetComponent <Dropdown>(); SelectBuild.options.Clear(); SelectBuild.options.Add(new Dropdown.OptionData("无")); SelectRecipe.options.Clear(); SelectRecipe.options.Add(new Dropdown.OptionData("无")); ButtonChangeRecipe = new ButtonGroup(GetButton(ChangeRecipe.transform, "Change")); ButtonChangeRecipe.text.text = ST.更改; Info = ControlPanel.transform.Find("Info").GetComponent <Text>(); Info.color = Color.white; var filePanel = ControlPanel.transform.Find("FilesPanel").gameObject; ButtonDataFile = new ButtonGroup[7]; for (int i = 1; i < 8; i++) { ButtonDataFile[i - 1] = new ButtonGroup(GetButton(filePanel.transform, "B" + i)); ButtonDataFile[i - 1].SetActive(false); ButtonDataFile[i - 1].text.fontSize = 10; } ButtonDataPage = filePanel.transform.Find("Page").gameObject.transform.GetComponentInChildren <Text>(); ButtonDataUp = new ButtonGroup(GetButton(filePanel.transform, "ButtonUp")); ButtonDataDown = new ButtonGroup(GetButton(filePanel.transform, "ButtonDown")); var cpf = ControlPanel.transform; //设置信息面板实例 TaskInfo = instance.transform.Find("TaskInfo").GetComponent <Text>(); //加载拖动组件 TaskInfo.gameObject.AddComponent <Drag>(); //获取任务面板关闭按钮 var closeTask = TaskInfo.GetComponentInChildren <Button>(); ButtonOpneFile = new ButtonGroup(GetButton(ControlPanel.transform, "ButtonFile")); ButtonReLoadFile = new ButtonGroup(GetButton(ControlPanel.transform, "ButtonFileFresh")); closeTask.onClick.AddListener(delegate { //关闭任务面板 TaskInfo.gameObject.SetActive(false); }); TaskInfoRect = TaskInfo.GetComponent <RectTransform>(); TaskInfoRect.sizeDelta = new Vector2(TaskInfoRect.sizeDelta.x, Screen.height * 0.7f); firstPos2 = TaskInfoRect.position; //暂时关闭,只显示错误信息 TaskInfo.gameObject.SetActive(false); //设置按钮实例 buttonCopy = new ButtonGroup(GetButton(cpf, "ButtonCopy")); buttonPaste = new ButtonGroup(GetButton(cpf, "ButtonPaste")); buttonClear = new ButtonGroup(GetButton(cpf, "ButtonClear")); buttonSave = new ButtonGroup(GetButton(cpf, "ButtonSave")); buttonLocal = new ButtonGroup(GetButton(cpf, "ButtonLocal")); buttonClose = new ButtonGroup(GetButton(cpf, "ButtonClose")); buttonZ = new ButtonGroup(GetButton(cpf, "ButtonZ")); buttonClose.button.onClick.AddListener(delegate { ControlPanel.SetActive(false); }); var buttonHelp = ControlPanel.transform.Find("Help").GetComponent <Button>(); buttonHelp.onClick.AddListener(delegate { System.Diagnostics.Process.Start("https://www.bilibili.com/video/BV1gZ4y1w7RY"); buttonHelp.gameObject.SetActive(false); }); if (Localization.language != Language.zhCN) { buttonHelp.gameObject.SetActive(false); } //加载翻译 buttonCopy.text.text = ST.制; buttonPaste.text.text = ST.粘贴; buttonClear.text.text = ST.清空; buttonSave.text.text = ST.保存; buttonLocal.text.text = ST.当前星球; buttonZ.text.text = ST.撤销任务; SaveName = ControlPanel.transform.Find("SaveText").GetComponent <InputField>(); SaveName.text = string.Empty; SaveName.textComponent.color = Color.black; SaveName.textComponent.fontSize = 14; isLoad = true; }
/// <summary> /// Helper that generates a Button Group /// </summary> /// <returns></returns> public ButtonGroup ButtonGroup() { var bg = new ButtonGroup(viewContext); return(bg); }
public JSConsole(string[] args) : base("Rhino JavaScript Console") { JMenuBar menubar = new JMenuBar(); CreateFileChooser(); string[] fileItems = new string[] { "Load...", "Exit" }; string[] fileCmds = new string[] { "Load", "Exit" }; char[] fileShortCuts = new char[] { 'L', 'X' }; string[] editItems = new string[] { "Cut", "Copy", "Paste" }; char[] editShortCuts = new char[] { 'T', 'C', 'P' }; string[] plafItems = new string[] { "Metal", "Windows", "Motif" }; bool[] plafState = new bool[] { true, false, false }; JMenu fileMenu = new JMenu("File"); fileMenu.SetMnemonic('F'); JMenu editMenu = new JMenu("Edit"); editMenu.SetMnemonic('E'); JMenu plafMenu = new JMenu("Platform"); plafMenu.SetMnemonic('P'); for (int i = 0; i < fileItems.Length; ++i) { JMenuItem item = new JMenuItem(fileItems[i], fileShortCuts[i]); item.SetActionCommand(fileCmds[i]); item.AddActionListener(this); fileMenu.Add(item); } for (int i_1 = 0; i_1 < editItems.Length; ++i_1) { JMenuItem item = new JMenuItem(editItems[i_1], editShortCuts[i_1]); item.AddActionListener(this); editMenu.Add(item); } ButtonGroup group = new ButtonGroup(); for (int i_2 = 0; i_2 < plafItems.Length; ++i_2) { JRadioButtonMenuItem item = new JRadioButtonMenuItem(plafItems[i_2], plafState[i_2]); group.Add(item); item.AddActionListener(this); plafMenu.Add(item); } menubar.Add(fileMenu); menubar.Add(editMenu); menubar.Add(plafMenu); SetJMenuBar(menubar); consoleTextArea = new ConsoleTextArea(args); JScrollPane scroller = new JScrollPane(consoleTextArea); SetContentPane(scroller); consoleTextArea.SetRows(24); consoleTextArea.SetColumns(80); AddWindowListener(new _WindowAdapter_135()); Pack(); SetVisible(true); // System.setIn(consoleTextArea.getIn()); // System.setOut(consoleTextArea.getOut()); // System.setErr(consoleTextArea.getErr()); Program.SetIn(consoleTextArea.GetIn()); Program.SetOut(consoleTextArea.GetOut()); Program.SetErr(consoleTextArea.GetErr()); Program.Main(args); }
/// <summary> /// 【异步方法】创建菜单 /// </summary> /// <param name="accessToken"></param> /// <param name="agentId"></param> /// <param name="buttonData">菜单内容</param> /// <param name="timeOut">代理请求超时时间(毫秒)</param> /// <returns></returns> public static async Task <WorkJsonResult> CreateMenuAsync(string accessTokenOrAppKey, int agentId, ButtonGroup buttonData, int timeOut = Config.TIME_OUT) { return(await ApiHandlerWapper.TryCommonApiAsync(async accessToken => { var urlFormat = string.Format(Config.ApiWorkHost + "/cgi-bin/menu/create?access_token={0}&agentid={1}", accessToken.AsUrlData(), agentId); return await CommonJsonSend.SendAsync <WorkJsonResult>(accessToken, urlFormat, buttonData, CommonJsonSendType.POST, timeOut: timeOut); }, accessTokenOrAppKey)); }
public override void LoadContent() { selectedLayer = "_layer1"; components = new List <UIElement>(); Texture2D navbarBG = DrawingService.CreateTexture(GlobalParameters.GlobalGraphics, GlobalParameters.screenWidth, 32, pixel => new Color(35, 35, 35), Shapes.RECTANGLE); Container navbar = new Container(navbarBG, new Vector2(0, 0), new Vector2(GlobalParameters.screenWidth, 32)); // Create Navbar child components Texture2D menuButtonTexture = DrawingService.CreateTexture(GlobalParameters.GlobalGraphics, 100, 32, pixel => new Color(35, 35, 35), Shapes.RECTANGLE); RedirectButton menuButton = new RedirectButton("Menu Scene", menuButtonTexture, new Vector2(0, 0), new Vector2(100, 32), "MENU", Color.White); Texture2D helpButtonTexture = DrawingService.CreateTexture(GlobalParameters.GlobalGraphics, 32, 32, pixel => new Color(100, 100, 200), Shapes.RECTANGLE); Overlay helpOverlay = new Overlay("Static\\SettingsScene/button_export", new Vector2(500, 500), new Vector2(32, 32)); PopupButton helpButton = new PopupButton(helpOverlay, "Static\\DrawingScene/help", new Vector2(menuButton.position.X + menuButton.dimensions.X, 0), new Vector2(32, 32)); //Texture2D settingsButtonTexture = DrawingService.CreateTexture(GlobalParameters.GlobalGraphics, 32, 32, pixel => new Color(255, 255, 0), Shapes.RECTANGLE); Overlay settingsOverlay = new Overlay("Static\\SettingsScene/button_export", new Vector2(600, 500), new Vector2(32, 32)); PopupButton settingsButton = new PopupButton(settingsOverlay, "Static\\DrawingScene/gear", new Vector2(helpButton.position.X + helpButton.dimensions.X, 0), new Vector2(32, 32)); Texture2D colorButtonTexture = DrawingService.CreateTexture(GlobalParameters.GlobalGraphics, 32, 32, pixel => new Color(200, 0, 255), Shapes.CIRCLE); Overlay colorOverlay = new Overlay(colorButtonTexture, new Vector2(1100, 500), new Vector2(32, 32)); PopupButton colorButton = new PopupButton(colorOverlay, colorButtonTexture, new Vector2(GlobalParameters.screenWidth - colorButtonTexture.Width, 0), new Vector2(32, 32)); Texture2D layerButtonTexture = DrawingService.CreateTexture(GlobalParameters.GlobalGraphics, 32, 32, pixel => new Color(0, 0, 255), Shapes.RECTANGLE); Overlay layerOverlay = new Overlay(layerButtonTexture, new Vector2(732, 500), new Vector2(32, 32)); PopupButton layerButton = new PopupButton(layerOverlay, "Static\\DrawingScene/layers", new Vector2(colorButton.position.X - colorButton.dimensions.X, 0), new Vector2(32, 32)); List <RadioButton> buttons = new List <RadioButton>(); Texture2D eraserSelectedTexture = DrawingService.CreateTexture(GlobalParameters.GlobalGraphics, 32, 32, pixel => new Color(255, 0, 0), Shapes.RECTANGLE); Texture2D eraserUnselectedTexture = DrawingService.CreateTexture(GlobalParameters.GlobalGraphics, 32, 32, pixel => new Color(0, 255, 0), Shapes.RECTANGLE); EraserButton eraser = new EraserButton("Static\\DrawingScene/eraser_selected", "Static\\DrawingScene/eraser", false, new Vector2(layerButton.position.X - layerButton.dimensions.X, 0), new Vector2(32, 32)); DrawButton draw = new DrawButton("Static\\DrawingScene/brush_selected", "Static\\DrawingScene/brush", true, new Vector2(eraser.position.X - eraser.dimensions.X, 0), new Vector2(32, 32)); buttons.Add(draw); buttons.Add(eraser); ButtonGroup toolButtons = new ButtonGroup(buttons); // TODO ADD Clickable Buttons // +1 Frame, Last Frame, -1 Frame, First Frame, Play Texture2D frameCounterTexture = DrawingService.CreateTexture(GlobalParameters.GlobalGraphics, 132, 32, pixel => new Color(0, 0, 0), Shapes.RECTANGLE); UIElement frameCounter = new FrameCounterComponent(frameCounterTexture, new Vector2(settingsButton.position.X + settingsButton.dimensions.X, 0), new Vector2(frameCounterTexture.Width, frameCounterTexture.Height)); navbar.uiElements.Add(menuButton); navbar.uiElements.Add(helpButton); navbar.uiElements.Add(settingsButton); navbar.uiElements.Add(colorButton); navbar.uiElements.Add(layerButton); navbar.uiElements.Add(frameCounter); navbar.buttonGroups.Add(toolButtons); // Add the navbar to this scene components.Add(navbar); // Load Frame frames = new List <Frame>(); frameSize = new Vector2(200, 200); framePosition = new Vector2(GlobalParameters.screenWidth / 2 - (int)frameSize.X / 2, GlobalParameters.screenHeight / 2 - (int)frameSize.Y / 2 + menuButton.dimensions.Y / 2); frames.Add(new Frame(framePosition, frameSize)); }
/// <summary> /// 根据微信返回的Json数据得到可用的GetMenuResult结果 /// </summary> /// <param name="resultFull"></param> /// <returns></returns> public static GetMenuResult GetMenuFromJsonResult(GetMenuResultFull resultFull) { GetMenuResult result = null; try { //重新整理按钮信息 ButtonGroup bg = new ButtonGroup(); foreach (var rootButton in resultFull.button) { if (rootButton.name == null) { continue; //没有设置一级菜单 } var availableSubButton = rootButton.sub_button.Count(z => !string.IsNullOrEmpty(z.name)); //可用二级菜单按钮数量 if (availableSubButton == 0) { //底部单击按钮 if (rootButton.type == null || (rootButton.type.Equals("CLICK", StringComparison.OrdinalIgnoreCase) && string.IsNullOrEmpty(rootButton.key))) { throw new WeixinMenuException("单击按钮的key不能为空!"); } if (rootButton.type.Equals("CLICK", StringComparison.OrdinalIgnoreCase)) { //点击 bg.button.Add(new SingleClickButton() { name = rootButton.name, key = rootButton.key, type = rootButton.type }); } else if (rootButton.type.Equals("VIEW", StringComparison.OrdinalIgnoreCase)) { //URL bg.button.Add(new SingleViewButton() { name = rootButton.name, url = rootButton.url, type = rootButton.type }); } else if (rootButton.type.Equals("LOCATION_SELECT", StringComparison.OrdinalIgnoreCase)) { //弹出地理位置选择器 bg.button.Add(new SingleLocationSelectButton() { name = rootButton.name, key = rootButton.key, type = rootButton.type }); } else if (rootButton.type.Equals("PIC_PHOTO_OR_ALBUM", StringComparison.OrdinalIgnoreCase)) { //弹出拍照或者相册发图 bg.button.Add(new SinglePicPhotoOrAlbumButton() { name = rootButton.name, key = rootButton.key, type = rootButton.type }); } else if (rootButton.type.Equals("PIC_SYSPHOTO", StringComparison.OrdinalIgnoreCase)) { //弹出系统拍照发图 bg.button.Add(new SinglePicSysphotoButton() { name = rootButton.name, key = rootButton.key, type = rootButton.type }); } else if (rootButton.type.Equals("PIC_WEIXIN", StringComparison.OrdinalIgnoreCase)) { //弹出微信相册发图器 bg.button.Add(new SinglePicWeixinButton() { name = rootButton.name, key = rootButton.key, type = rootButton.type }); } else if (rootButton.type.Equals("SCANCODE_PUSH", StringComparison.OrdinalIgnoreCase)) { //扫码推事件 bg.button.Add(new SingleScancodePushButton() { name = rootButton.name, key = rootButton.key, type = rootButton.type }); } else { //扫码推事件且弹出“消息接收中”提示框 bg.button.Add(new SingleScancodeWaitmsgButton() { name = rootButton.name, key = rootButton.key, type = rootButton.type }); } } else { //底部二级菜单 var subButton = new SubButton(rootButton.name); bg.button.Add(subButton); foreach (var subSubButton in rootButton.sub_button) { if (subSubButton.name == null) { continue; //没有设置菜单 } if (subSubButton.type.Equals("CLICK", StringComparison.OrdinalIgnoreCase) && string.IsNullOrEmpty(subSubButton.key)) { throw new WeixinMenuException("单击按钮的key不能为空!"); } if (subSubButton.type.Equals("CLICK", StringComparison.OrdinalIgnoreCase)) { //点击 subButton.sub_button.Add(new SingleClickButton() { name = subSubButton.name, key = subSubButton.key, type = subSubButton.type }); } else if (subSubButton.type.Equals("VIEW", StringComparison.OrdinalIgnoreCase)) { //URL subButton.sub_button.Add(new SingleViewButton() { name = subSubButton.name, url = subSubButton.url, type = subSubButton.type }); } else if (subSubButton.type.Equals("LOCATION_SELECT", StringComparison.OrdinalIgnoreCase)) { //弹出地理位置选择器 subButton.sub_button.Add(new SingleLocationSelectButton() { name = subSubButton.name, key = subSubButton.key, type = subSubButton.type }); } else if (subSubButton.type.Equals("PIC_PHOTO_OR_ALBUM", StringComparison.OrdinalIgnoreCase)) { //弹出拍照或者相册发图 subButton.sub_button.Add(new SinglePicPhotoOrAlbumButton() { name = subSubButton.name, key = subSubButton.key, type = subSubButton.type }); } else if (subSubButton.type.Equals("PIC_SYSPHOTO", StringComparison.OrdinalIgnoreCase)) { //弹出系统拍照发图 subButton.sub_button.Add(new SinglePicSysphotoButton() { name = subSubButton.name, key = subSubButton.key, type = subSubButton.type }); } else if (subSubButton.type.Equals("PIC_WEIXIN", StringComparison.OrdinalIgnoreCase)) { //弹出微信相册发图器 subButton.sub_button.Add(new SinglePicWeixinButton() { name = subSubButton.name, key = subSubButton.key, type = subSubButton.type }); } else if (subSubButton.type.Equals("SCANCODE_PUSH", StringComparison.OrdinalIgnoreCase)) { //扫码推事件 subButton.sub_button.Add(new SingleScancodePushButton() { name = subSubButton.name, key = subSubButton.key, type = subSubButton.type }); } else { //扫码推事件且弹出“消息接收中”提示框 subButton.sub_button.Add(new SingleScancodeWaitmsgButton() { name = subSubButton.name, key = subSubButton.key, type = subSubButton.type }); } } } } result = new GetMenuResult() { menu = bg }; } catch (Exception ex) { throw new WeixinMenuException(ex.Message, ex); } return(result); }
public static IDisposable UxButtonGroup(this HtmlHelper htmlHelper, bool toggle = false, ButtonGroupSize size = null, string clientId = null) { var group = new ButtonGroup(toggle, size, null, null, clientId); return RenderUxDispoableWebControl(htmlHelper, group); }
/// <summary> /// 创建菜单 /// </summary> /// <param name="accessToken"></param> /// <param name="buttonData">菜单内容</param> /// <returns></returns> public WxJsonResult CreateMenu(string accessToken, ButtonGroup buttonData) { var result = CommonApi.CreateMenu(accessToken, buttonData); return(result); }
public ButtonGroup GetWechatMenu() { ButtonGroup bg = new ButtonGroup(); var accountBtn = new SubButton("账户管理"); accountBtn.sub_button.Add(new SingleViewButton() { name = "我的账号", url = string.Format("{0}/wechat/account/#/wechatforjeuci?isNeedCallBack", _webchatServiceAddress) }); accountBtn.sub_button.Add(new SingleViewButton() { name = "找回密码", url = string.Format("{0}/wechat/account/#/retrievepwd?isNeedCallBack", _webchatServiceAddress) }); accountBtn.sub_button.Add(new SingleViewButton() { name = "修改密码", url = string.Format("{0}/wechat/account/#/modifypwd?isNeedCallBack", _webchatServiceAddress) }); accountBtn.sub_button.Add(new SingleViewButton() { name = "代理充值", url = string.Format("{0}/wechat/recharge/#/freelist?isNeedCallBack", _webchatServiceAddress) }); accountBtn.sub_button.Add(new SingleClickButton() { name = "帮助", key = WeChatConfig.MENU_SUB_CLICK_HELP, type = "click" }); bg.button.Add(accountBtn); var purchaseServiceBtn = new SubButton("购买软件"); purchaseServiceBtn.sub_button.Add(new SingleViewButton() { name = "掌赢专家", url = string.Format("{0}/wechat/purchase/#/caimeng?isNeedCallBack", _webchatServiceAddress) }); bg.button.Add(purchaseServiceBtn); //var addedServiceBtn = new SubButton("更多服务"); //addedServiceBtn.sub_button.Add(new SingleViewButton() //{ // name = "免费计划", // url = string.Format("{0}/wechat/plan/#/free", _webchatServiceAddress) //}); bg.button.Add(new SingleViewButton() { name = "免费计划", url = string.Format("{0}/wechat/plan/#/free", _webchatServiceAddress) }); // bg.button.Add(addedServiceBtn); return(bg); }
public ButtonGroupPage() { var buttonGroupQuantityItems = new List<string>(); for (var i = 1; i <= max; i++) { buttonGroupQuantityItems.Add(i.ToString(CultureInfo.InvariantCulture)); } var buttonGroupTagCloudItems = new List<string> { "Xamarin", "Xamarin.Forms", "iOS", "Android", "Windows Phone", }; var buttonGroupMovieStartTimesItems = new List<string> { "12:00", "2:30", "5:00", "7:30", }; var buttonGroupQuantity = new ButtonGroup { IsNumber = true, Rounded = true, ViewBackgroundColor = Color.Black, BorderColor = Color.White, OutlineColor = Color.Black, BackgroundColor = Device.OnPlatform(Color.Accent, Color.Accent, Color.White), TextColor = Device.OnPlatform(Color.White, Color.White, Color.Black), SelectedTextColor = Device.OnPlatform(Color.Black, Color.White, Color.White), SelectedBackgroundColor = Device.OnPlatform(Color.White, Color.Black, Color.Black), SelectedBorderColor = Device.OnPlatform(Color.White, Color.Silver, Color.Silver), SelectedFrameBackgroundColor = Device.OnPlatform(Color.Black, Color.Black, Color.Black), SelectedIndex = 3, HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.Center, Padding = new Thickness(5), Font = Device.OnPlatform( Font.OfSize("HelveticaNeue-Light", NamedSize.Medium), Font.OfSize("Roboto Light", NamedSize.Medium), Font.OfSize("Segoe WP Light", NamedSize.Medium)), Items = buttonGroupQuantityItems, }; var buttonGroupTagCloud = new ButtonGroup { Rounded = false, IsNumber = false, ViewBackgroundColor = Color.White, BorderColor = Color.White, OutlineColor = Color.Black, BackgroundColor = Device.OnPlatform(Color.Accent, Color.Accent, Color.White), TextColor = Device.OnPlatform(Color.White, Color.Black, Color.Black), SelectedTextColor = Device.OnPlatform(Color.Black, Color.White, Color.White), SelectedBackgroundColor = Device.OnPlatform(Color.White, Color.Accent, Color.Accent), SelectedBorderColor = Device.OnPlatform(Color.White, Color.Accent, Color.Accent), SelectedFrameBackgroundColor = Device.OnPlatform(Color.White, Color.Accent, Color.Accent), SelectedIndex = 3, HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.Center, Padding = new Thickness(5), Font = Device.OnPlatform( Font.OfSize("HelveticaNeue-Light", NamedSize.Medium), Font.OfSize("Roboto Light", NamedSize.Medium), Font.OfSize("Segoe WP Light", NamedSize.Medium)), Items = buttonGroupTagCloudItems, }; var buttonGroupMovieStartTimes = new ButtonGroup { Rounded = true, IsNumber = false, ViewBackgroundColor = Color.Black, BackgroundColor = Color.Silver, TextColor = Color.White, BorderColor = Color.White, OutlineColor = Color.Black, SelectedBackgroundColor = Color.Silver, SelectedTextColor = Color.Black, SelectedBorderColor = Color.Black, SelectedFrameBackgroundColor = Device.OnPlatform(Color.Black, Color.Black, Color.Black), SelectedIndex = 3, HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.Center, Padding = new Thickness(5), Font = Device.OnPlatform( Font.OfSize("HelveticaNeue-Light", NamedSize.Medium), Font.OfSize("Roboto Light", NamedSize.Medium), Font.OfSize("Segoe WP Light", NamedSize.Medium)), Items = buttonGroupMovieStartTimesItems, }; var labelQuantity = new Label { Text = "Quantity", TextColor = Device.OnPlatform(Color.White, Color.White, Color.White), }; var labelTagCloud = new Label { Text = "Tag Cloud", TextColor = Device.OnPlatform(Color.White, Color.White, Color.White), }; var labelMovieStartTimes = new Label { Text = "Movie Start Times", TextColor = Device.OnPlatform(Color.White, Color.White, Color.White), }; var stack = new StackLayout { Orientation = StackOrientation.Vertical, VerticalOptions = LayoutOptions.StartAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand, Children = { labelQuantity, buttonGroupQuantity, labelTagCloud, buttonGroupTagCloud, labelMovieStartTimes, buttonGroupMovieStartTimes, }, }; Title = "Button Group"; BackgroundColor = Color.Black; Padding = new Thickness(10, Device.OnPlatform(20, 0, 0), 10, 5); Content = stack; }
public void ResetButtonGroup(ButtonGroup buttonGroup) { buttonGroup.transform.SetParent(buttonGroupPoolObject.transform, false); }
public HumanoidProfileEditor(IClientPreferencesManager preferencesManager, IPrototypeManager prototypeManager, IEntityManager entityManager) { RobustXamlLoader.Load(this); _random = IoCManager.Resolve <IRobustRandom>(); _prototypeManager = prototypeManager; _preferencesManager = preferencesManager; #region Left #region Randomize #endregion Randomize #region Name _nameEdit.OnTextChanged += args => { SetName(args.Text); }; _nameRandomButton.OnPressed += args => RandomizeName(); _randomizeEverythingButton.OnPressed += args => { RandomizeEverything(); }; _warningLabel.SetMarkup($"[color=red]{Loc.GetString("humanoid-profile-editor-naming-rules-warning")}[/color]"); #endregion Name #region Appearance _tabContainer.SetTabTitle(0, Loc.GetString("humanoid-profile-editor-appearance-tab")); #region Sex var sexButtonGroup = new ButtonGroup(); _sexMaleButton.Group = sexButtonGroup; _sexMaleButton.OnPressed += args => { SetSex(Sex.Male); if (Profile?.Gender == Gender.Female) { SetGender(Gender.Male); UpdateGenderControls(); } }; _sexFemaleButton.Group = sexButtonGroup; _sexFemaleButton.OnPressed += _ => { SetSex(Sex.Female); if (Profile?.Gender == Gender.Male) { SetGender(Gender.Female); UpdateGenderControls(); } }; #endregion Sex #region Age _ageEdit.OnTextChanged += args => { if (!int.TryParse(args.Text, out var newAge)) { return; } SetAge(newAge); }; #endregion Age #region Gender _genderButton.AddItem(Loc.GetString("humanoid-profile-editor-pronouns-male-text"), (int)Gender.Male); _genderButton.AddItem(Loc.GetString("humanoid-profile-editor-pronouns-female-text"), (int)Gender.Female); _genderButton.AddItem(Loc.GetString("humanoid-profile-editor-pronouns-epicene-text"), (int)Gender.Epicene); _genderButton.AddItem(Loc.GetString("humanoid-profile-editor-pronouns-neuter-text"), (int)Gender.Neuter); _genderButton.OnItemSelected += args => { _genderButton.SelectId(args.Id); SetGender((Gender)args.Id); }; #endregion Gender #region Hair _hairPicker.Populate(); _hairPicker.OnHairStylePicked += newStyle => { if (Profile is null) { return; } Profile = Profile.WithCharacterAppearance( Profile.Appearance.WithHairStyleName(newStyle)); IsDirty = true; }; _hairPicker.OnHairColorPicked += newColor => { if (Profile is null) { return; } Profile = Profile.WithCharacterAppearance( Profile.Appearance.WithHairColor(newColor)); IsDirty = true; }; _facialHairPicker.Populate(); _facialHairPicker.OnHairStylePicked += newStyle => { if (Profile is null) { return; } Profile = Profile.WithCharacterAppearance( Profile.Appearance.WithFacialHairStyleName(newStyle)); IsDirty = true; }; _facialHairPicker.OnHairColorPicked += newColor => { if (Profile is null) { return; } Profile = Profile.WithCharacterAppearance( Profile.Appearance.WithFacialHairColor(newColor)); IsDirty = true; }; #endregion Hair #region Clothing _clothingButton.AddItem(Loc.GetString("humanoid-profile-editor-preference-jumpsuit"), (int)ClothingPreference.Jumpsuit); _clothingButton.AddItem(Loc.GetString("humanoid-profile-editor-preference-jumpskirt"), (int)ClothingPreference.Jumpskirt); _clothingButton.OnItemSelected += args => { _clothingButton.SelectId(args.Id); SetClothing((ClothingPreference)args.Id); }; #endregion Clothing #region Backpack _backpackButton.AddItem(Loc.GetString("humanoid-profile-editor-preference-backpack"), (int)BackpackPreference.Backpack); _backpackButton.AddItem(Loc.GetString("humanoid-profile-editor-preference-satchel"), (int)BackpackPreference.Satchel); _backpackButton.AddItem(Loc.GetString("humanoid-profile-editor-preference-duffelbag"), (int)BackpackPreference.Duffelbag); _backpackButton.OnItemSelected += args => { _backpackButton.SelectId(args.Id); SetBackpack((BackpackPreference)args.Id); }; #endregion Backpack #region Eyes _eyesPicker.OnEyeColorPicked += newColor => { if (Profile is null) { return; } Profile = Profile.WithCharacterAppearance( Profile.Appearance.WithEyeColor(newColor)); IsDirty = true; }; #endregion Eyes #endregion Appearance #region Jobs _tabContainer.SetTabTitle(1, Loc.GetString("humanoid-profile-editor-jobs-tab")); _preferenceUnavailableButton.AddItem( Loc.GetString("humanoid-profile-editor-preference-unavailable-stay-in-lobby-button"), (int)PreferenceUnavailableMode.StayInLobby); _preferenceUnavailableButton.AddItem( Loc.GetString("humanoid-profile-editor-preference-unavailable-spawn-as-overflow-button", ("overflowJob", Loc.GetString(SharedGameTicker.OverflowJobName))), (int)PreferenceUnavailableMode.SpawnAsOverflow); _preferenceUnavailableButton.OnItemSelected += args => { _preferenceUnavailableButton.SelectId(args.Id); Profile = Profile?.WithPreferenceUnavailable((PreferenceUnavailableMode)args.Id); IsDirty = true; }; _jobPriorities = new List <JobPrioritySelector>(); _jobCategories = new Dictionary <string, BoxContainer>(); var firstCategory = true; foreach (var job in prototypeManager.EnumeratePrototypes <JobPrototype>().OrderBy(j => j.Name)) { foreach (var department in job.Departments) { if (!_jobCategories.TryGetValue(department, out var category)) { category = new BoxContainer { Orientation = LayoutOrientation.Vertical, Name = department, ToolTip = Loc.GetString("humanoid-profile-editor-jobs-amount-in-department-tooltip", ("departmentName", department)) }; if (firstCategory) { firstCategory = false; } else { category.AddChild(new Control { MinSize = new Vector2(0, 23), }); } category.AddChild(new PanelContainer { PanelOverride = new StyleBoxFlat { BackgroundColor = Color.FromHex("#464966") }, Children = { new Label { Text = Loc.GetString("humanoid-profile-editor-department-jobs-label", ("departmentName", department)) } } });
/// <summary> /// 根据微信返回的Json数据得到可用的GetMenuResult结果 /// </summary> /// <param name="resultFull"></param> /// <returns></returns> public GetMenuResult GetMenuFromJsonResult(GetMenuResultFull resultFull) { GetMenuResult result = null; try { //重新整理按钮信息 ButtonGroup bg = new ButtonGroup(); foreach (var rootButton in resultFull.menu.button) { if (rootButton.name == null) { continue;//没有设置一级菜单 } var availableSubButton = rootButton.sub_button.Count(z => !string.IsNullOrEmpty(z.name));//可用二级菜单按钮数量 if (availableSubButton == 0) { //底部单击按钮 if (rootButton.type.Equals("CLICK", StringComparison.OrdinalIgnoreCase) && string.IsNullOrEmpty(rootButton.key)) { throw new WeChatMenuException("单击按钮的key不能为空!"); } if (rootButton.type.Equals("CLICK", StringComparison.OrdinalIgnoreCase)) { //点击 bg.button.Add(new SingleClickButton() { name = rootButton.name, key = rootButton.key, type = rootButton.type }); } else { //URL bg.button.Add(new SingleViewButton() { name = rootButton.name, url = rootButton.url, type = rootButton.type }); } } //else if (availableSubButton < 1) //{ // throw new WeChatMenuException("子菜单至少需要填写1个!"); //} else { //底部二级菜单 var subButton = new SubButton(rootButton.name); bg.button.Add(subButton); foreach (var subSubButton in rootButton.sub_button) { if (subSubButton.name == null) { continue; //没有设置菜单 } if (subSubButton.type.Equals("CLICK", StringComparison.OrdinalIgnoreCase) && string.IsNullOrEmpty(subSubButton.key)) { throw new WeChatMenuException("单击按钮的key不能为空!"); } if (subSubButton.type.Equals("CLICK", StringComparison.OrdinalIgnoreCase)) { //点击 subButton.sub_button.Add(new SingleClickButton() { name = subSubButton.name, key = subSubButton.key, type = subSubButton.type }); } else { //URL subButton.sub_button.Add(new SingleViewButton() { name = subSubButton.name, url = subSubButton.url, type = subSubButton.type }); } } } } if (bg.button.Count < 1) { throw new WeChatMenuException("一级菜单按钮至少为1个!"); } result = new GetMenuResult() { menu = bg }; } catch (Exception ex) { throw new WeChatMenuException(ex.Message, ex); } return result; }