public override void UpdateButtons(Form Window) { if (Buttons.Count() != 0) { ButtonBack.ChangePosition(new Vector((global.form_menu.Map.Width / 10) - BText.Size.Width / 2, global.form_menu.Map.Height - BText.Size.Height)); } }
public void Update() { //Checks to see which buttons are pressed and then adds them to the execute list. It's not as easy as the keyboard var pressedButtons = new Buttons[arrayLength]; foreach (Buttons button in Enum.GetValues(typeof(Buttons))) { if (GamePad.GetState(PlayerIndex.One).IsButtonDown(button)) { pressedButtons[pressedButtons.Count()] = button; } } foreach (Buttons button in pressedButtons) { //If game is paused or in finishing state, only accept unpause if (Game1.Instance.CurrentState == Game1.GameState.Paused || Game1.Instance.CurrentState == Game1.GameState.End) { if (button == Buttons.Start) { controllerMappings[button].Execute(); } } else { if (controllerMappings.ContainsKey(button)) { controllerMappings[button].Execute(); } } } }
public override void UpdateButtons(Form Window) { if (Buttons.Count() != 0) { ButtonBack.ChangePosition(new Vector((global.form_menu.Map.Width / 2) - CText.Size.Width / 2 + 9 * BIcon.Width, global.form_menu.Map.Height / 2 - CText.Size.Height / 2 + 8 * BIcon.Height / 3)); ButtonRetry.ChangePosition(new Vector((global.form_menu.Map.Width / 2) - CText.Size.Width / 2 + 4 * RIcon.Width, global.form_menu.Map.Height / 2 - CText.Size.Height / 2 + 8 * RIcon.Height / 3)); } }
public override void UpdateButtons(Form Window) { Form1 Form = Window as Form1; if (Buttons.Count() != 0) { ButtonBack.ChangePosition(new Vector((Form.Map.Width / 10) - BText.Size.Width / 2, Form.Map.Height - BText.Size.Height)); } }
void LayoutItems() { EnsureControlsAdded(); int vcentre = ClientRectangle.Height / 2; int hcentre = ClientRectangle.Width / 2; int husabled = ClientRectangle.Width - Padding.Horizontal; backgroundpanel.Size = ClientRectangle.Size; textlab.Location = new Point(Padding.Left, Padding.Top); textlab.Size = new Size(husabled, 20); int buttonvtop = ClientRectangle.Height; if (Buttons != null) { int totalwidth = (from x in Buttons select x.Width).Sum() + (Buttons.Count() - 1) * ButtonSpacing; int maxvertheight = (from x in Buttons select x.Height).Max(); int buttonvcentre = ClientRectangle.Height - Padding.Bottom - maxvertheight / 2; buttonvtop = buttonvcentre - maxvertheight / 2; //System.Diagnostics.Debug.WriteLine("Button vline at " + buttonvcentre); int sp = hcentre - totalwidth / 2; foreach (ExtButton b in Buttons) { b.Location = new Point(sp, buttonvcentre - b.Height / 2); //System.Diagnostics.Debug.WriteLine("Button {0} {1}", b.Name, b.Location); sp += b.Width + ButtonSpacing; } } if (Decals != null) { int totalwidth = (from x in Decals select x.Width).Sum() + (Decals.Count() - 1) * DecalSpacing; int maxvertheight = (from x in Decals select x.Height).Max(); int decalvcentre = vcentre; if (decalvcentre + maxvertheight / 2 >= buttonvtop) { decalvcentre = buttonvtop - maxvertheight / 2 - MinimumDecalButtonVerticalSpacing; } //System.Diagnostics.Debug.WriteLine("Decal vline at " + decalvcentre); int sp = hcentre - totalwidth / 2; foreach (Panel bm in Decals) { bm.Location = new Point(sp, decalvcentre - bm.Height / 2); sp += bm.Width + DecalSpacing; } } Invalidate(); }
public override void UpdateButtons(Form Window) { if (Buttons.Count() != 0) { Image Add = global.ScaleImage(FTR.Properties.Resources.VolumeAdd); Image Sub = global.ScaleImage(FTR.Properties.Resources.VolumeSubtract); ButtonBack.ChangePosition(new Vector((global.form_menu.Map.Width / 10) - BText.Size.Width / 2, global.form_menu.Map.Height - BText.Size.Height)); ButtonAdd.ChangePosition(new Vector(((global.form_menu.Map.Width / 2) + Bar.Width / 2 + Add.Width / 2), (global.form_menu.Map.Height / 2))); ButtonDistract.ChangePosition(new Vector(((global.form_menu.Map.Width / 2) - Bar.Width / 2 - Sub.Width * 1.5f), (global.form_menu.Map.Height / 2))); } }
private void AddTicket() { if (!string.IsNullOrEmpty(ProblemName) && Buttons.Count(m => m.IsVis == true) == 1) { var ticket = new TicketModel() { ProblemName = ProblemName, TicketPriority = Buttons.FirstOrDefault(m => m.IsVis).TicketPriority }; _ticketService.AddTicketToJson(ticket); Close(this); } }
public override void UpdateButtons(Form Window) { if (Buttons.Count() != 0) { Form1 Form = Window as Form1; ButtonLevel.ChangePosition(new Vector((Form.Map.Width / 2) - ButtonLevel.SpriteBtm.Width / 2, Form.Map.Height / 2)); ButtonCredits.ChangePosition(new Vector((Form.Map.Width / 2) - ButtonCredits.SpriteBtm.Width / 2, Form.Map.Height / 2 + ButtonLevel.SpriteBtm.Height * 2)); ButtonExit.ChangePosition(new Vector((Form.Map.Width / 2) - ButtonExit.SpriteBtm.Width / 2, Form.Map.Height / 2 + ButtonLevel.SpriteBtm.Height * 4)); Settings.ChangePosition(new Vector((Form.Map.Width) - Settings.SpriteBtm.Width * 1.2f, Form.Map.Height - Settings.SpriteBtm.Height * 1.2f)); Moon.ChangePosition(new Vector(1735f * global.ScreenScale.X, 95.416f * global.ScreenScale.Y)); } }
private bool CheckForPossibility() { if (Buttons == null || Buttons.Count == 0) { return(false); } int sum = 4;//Row number with empty button, starts from 1 for (int i = 0; i < BUTTONS_COUNT; i++) { sum += Buttons.Count(x => x.Position > i && x.Value < Buttons[i].Value); } return(sum % 2 == 0); }
public override void UpdateButtons(Form Window) { if (Buttons.Count() != 0) { Form1 Form = Window as Form1; ButtonBack.ChangePosition(new Vector((Form.Map.Width / 10) - BText.Size.Width / 2, Form.Map.Height - BText.Size.Height)); LevelPads[0].ChangePosition(new Vector(Pad.Width, Pad.Height / 2)); for (int i = 1; i < 5; i++) { LevelPads[i].ChangePosition(new Vector(LevelPads[i - 1].Position.X + 3 * Pad.Width / 2, Pad.Height / 2)); } for (int i = 5; i < 10; i++) { LevelPads[i].ChangePosition(new Vector(LevelPads[i - 5].Position.X, Pad.Height * 2)); } } }
static public void Prefix(Settings __instance) { var keyTransformBase = __instance.m_keys[__instance.m_keys.Count() - 1].m_keyTransform; var panelTransform = keyTransformBase.parent.parent.parent.GetComponent <RectTransform>(); var tabHandler = keyTransformBase.parent.parent.parent.GetComponentInChildren <TabHandler>(); var tabTransform = tabHandler.GetComponentInParent <RectTransform>(); float verticalOffset = -20.0f; float evenHorizontalOffset = -232.0f - keyTransformBase.localPosition.x; foreach ((var button, bool even) in Buttons.Select((value, i) => (value, i % 2 == 0))) { var keyTransform = Instantiate(keyTransformBase, keyTransformBase.parent); if (even) { keyTransform.localPosition = keyTransformBase.localPosition + new Vector3(evenHorizontalOffset, verticalOffset, 0.0f); panelTransform.anchorMin += new Vector2(0.0f, -0.02f); tabTransform.anchoredPosition += new Vector2(0.0f, 10.0f); } else { keyTransform.localPosition = keyTransformBase.localPosition + new Vector3(0.0f, verticalOffset, 0.0f); verticalOffset -= 20.0f; } keyTransform.GetComponentInChildren <UnityEngine.UI.Text>().text = button.displayName + ':'; var keySetting = new Settings.KeySetting { m_keyName = button.name, m_keyTransform = keyTransform }; __instance.m_keys.Add(keySetting); } if (Buttons.Count() % 2 != 0) { panelTransform.anchorMin += new Vector2(0.0f, -0.02f); } tabTransform.anchoredPosition += new Vector2(0.0f, 12.0f); }
/// <summary> /// 判断是否有了对应按钮 /// </summary> /// <param name="ButtonKey"></param> /// <returns></returns> public bool HaveButton(string ButtonKey) => Buttons != null && Buttons.Count(o => o.ButtonKey == ButtonKey) > 0;