public void RemoveChatBox() { isActive = false; showRightButton = false; rightButtonClickDelegate = null; leftButtonClickDelegate = null; }
public void remove(ButtonClickDelegate _userMethod) { if (this._buttonDelegate != null) { this._buttonDelegate -= _userMethod; } }
public ButtonData(string name, string text, ButtonClickDelegate action, bool interactable, bool active) { Name = name; Text = text; Action = action; Interactable = interactable; Active = active; }
private UIElasticButton AddBtn(List <UIElasticButton> targ, string imgname, ButtonClickDelegate onClick) { var ui = Content.Get().CustomUI; var btn = new UIElasticButton(ui.Get(imgname).Get(GameFacade.GraphicsDevice)); btn.OnButtonClick += onClick; targ.Add(btn); Add(btn); return(btn); }
public void add(ButtonClickDelegate _userMethod) { if (this._buttonDelegate == null) { this._buttonDelegate = _userMethod; } else { this._buttonDelegate += _userMethod; } }
public Button(string label, CCNode parent, ButtonClickDelegate d) { _label = label; _parent = parent; _onClick = d; CCLabelTTF ttf = CCLabelTTF.labelWithString(label, "Arial", 32f); CCMenuItemLabel item = CCMenuItemLabel.itemWithLabel(ttf, null, new SEL_MenuHandler(d)); CCMenu pMenu = CCMenu.menuWithItems(item); pMenu.position = new CCPoint(0, 0); addChild(pMenu); }
/// <summary> /// Creates an instance of UIButton that has a texture. /// </summary> /// <param name="X">The x-coordinate where the button will be displayed.</param> /// <param name="Y">The y-coordinate where the button will be displayed.</param> /// <param name="Texture">The texture for this button.</param> /// <param name="Enabled">Is this button enabled?</param> /// <param name="StrID">The button's string ID.</param> /// <param name="Screen">The UIScreen instance that will draw and update this button.</param> public UIButton(float X, float Y, Texture2D Texture, bool Disabled, string StrID, UIScreen Screen) : base(Screen, StrID, DrawLevel.DontGiveAFuck) { m_X = X; m_Y = Y; m_Texture = Texture; m_Disabled = Disabled; m_StrID = StrID; //All buttons have 4 frames... m_Width = Texture.Width / 4; m_CurrentFrame = 0; OnButtonClick += new ButtonClickDelegate(delegate(UIButton btn) { Screen.RegisterClick(this); }); }
public static GlassButton CreateGlassButton(string buttonTitle, UIColor color, float width, float height, ButtonClickDelegate touchUpInside) { GlassButton button = new GlassButton(new RectangleF(0, 0, width, height)); button.NormalColor = color; button.HighlightedColor = UIColor.LightGray; button.SetTitleColor(UIColor.FromRGBA(255, 255, 255, 255), UIControlState.Normal); button.SetTitleColor(UIColor.FromRGBA(0, 0, 0, 255), UIControlState.Highlighted); button.HorizontalAlignment = UIControlContentHorizontalAlignment.Center; button.SetTitle(buttonTitle, UIControlState.Normal); button.TouchUpInside += (s, e) => { if (touchUpInside != null) touchUpInside(s, e); }; return button; }
public void Init(ManageForm parent, string tipText, int interval, bool displayNow, ButtonClickDelegate buttonOKClick, ButtonClickDelegate buttonCancleClick) { TimeSpan span = (TimeSpan) (DateTime.Now - this._closeTime); if ((span.TotalSeconds >= 30.0) || displayNow) { this._closeTime = DateTime.Now; this._parent = parent; this.labelText.Text = tipText; this._buttonOKClick = buttonOKClick; this._buttonCancleClick = buttonCancleClick; if (interval > 0) { this._messageFormTimer.Tick += new EventHandler(this.MessageFormThreadFunc); this._messageFormTimer.Interval = interval * 0x3e8; this._messageFormTimer.Enabled = true; } base.Visible = true; } }
public void Init(ManageForm parent, string tipText, int interval, bool displayNow, ButtonClickDelegate buttonOKClick, ButtonClickDelegate buttonCancleClick) { TimeSpan span = (TimeSpan)(DateTime.Now - this._closeTime); if ((span.TotalSeconds >= 30.0) || displayNow) { this._closeTime = DateTime.Now; this._parent = parent; this.labelText.Text = tipText; this._buttonOKClick = buttonOKClick; this._buttonCancleClick = buttonCancleClick; if (interval > 0) { this._messageFormTimer.Tick += new EventHandler(this.MessageFormThreadFunc); this._messageFormTimer.Interval = interval * 0x3e8; this._messageFormTimer.Enabled = true; } base.Visible = true; } }
private void SetRightButton(ButtonClickDelegate rightButtonClick) { rightButtonClickDelegate += rightButtonClick; showRightButton = true; }
public void SetButtonCallbacks(ChoiceButtonClickDelegate leftButtonClick, ButtonClickDelegate rightButtonClick) { showRightButton = false; SetLeftButton(leftButtonClick); SetRightButton(rightButtonClick); }
public UIAlertButton(UIAlertButtonType type, ButtonClickDelegate handler, string text) { Type = type; Handler = handler; Text = text; }
public UIAlertButton(UIAlertButtonType type, ButtonClickDelegate handler) { Type = type; Handler = handler; }
public static UIAlertButton[] YesNoCancel(ButtonClickDelegate yesCallback, ButtonClickDelegate noCallback, ButtonClickDelegate cancel) { return(new UIAlertButton[] { new UIAlertButton(UIAlertButtonType.Yes, yesCallback), new UIAlertButton(UIAlertButtonType.No, noCallback), new UIAlertButton(UIAlertButtonType.Cancel, cancel) }); }
public static UIAlertButton[] Ok(ButtonClickDelegate callback) { return(new UIAlertButton[] { new UIAlertButton(UIAlertButtonType.OK, callback) }); }
/// <summary> /// Creates an instance of UIButton that has a texture and a caption. /// </summary> /// <param name="X">The x-coordinate where the button will be displayed.</param> /// <param name="Y">The y-coordinate where the button will be displayed.</param> /// <param name="Texture">The texture for this button.</param> /// <param name="Caption">The button's caption.</param> /// <param name="CaptionID">The ID for the string to use as the button's caption.</param> /// <param name="Screen">The UIScreen instance that will draw and update this button.</param> public UIButton(float X, float Y, Texture2D Texture, int CaptionID, string StrID, UIScreen Screen) : base(Screen, StrID, DrawLevel.DontGiveAFuck) { m_X = X; m_Y = Y; m_Texture = Texture; m_StrID = StrID; //All buttons have 4 frames... m_Width = Texture.Width / 4; m_CurrentFrame = 0; OnButtonClick += new ButtonClickDelegate(delegate(UIButton btn) { Screen.RegisterClick(this); }); if (Screen.ScreenMgr.TextDict.ContainsKey(CaptionID)) m_Caption = Screen.ScreenMgr.TextDict[CaptionID]; }
private void txtFilter_TextChanged(object sender, EventArgs e) { if (txtFilter.Text != "") { //string currentDateString = this.dateTimePLog.Value.ToShortDateString(); bsPLog.Filter = "EmployeeName LIKE '%" + txtFilter.Text + "%' " + "AND InputDate =#" + string.Format("{0:MM/dd/yyyy}", dateTimePLog.Value) + "#"; //"Input Date = '" + currentDateString + "'"; } else { btnClickEventHandler = new ButtonClickDelegate(btnClearFilter_Click); btnClickEventHandler.Invoke(btnClearFilter, EventArgs.Empty); } }
public frmMain() { InitializeComponent(); btnClickEventHandler = new ButtonClickDelegate(btnClearFilter_Click); }
public static void Set_Button_On_Click(string parent_game_object_name, string button_game_object_name, ButtonClickDelegate delegate_p) { GameObject button_game_object = GameObject.Find(string.Format("{0}/{1}", parent_game_object_name, button_game_object_name)); Button.ButtonClickedEvent on_click = new Button.ButtonClickedEvent(); on_click.AddListener(delegate() { delegate_p(); }); button_game_object.GetComponentInChildren <Button>().onClick = on_click; }
public void SetClickCallBack(ButtonClickDelegate clickCallBack, object value) { this.ButtonClickCallBack = clickCallBack; CallBackValue = value; }
public UIHouseSelectPanel(int houseID) { var screen = GameFacade.Screens.CurrentUIScreen; var extra = Math.Max(0, (screen.ScreenHeight - 640) / 128) * 64; HouseID = houseID; Diag = new UIDiagonalStripe(new Point(screen.ScreenWidth / 2, screen.ScreenHeight + 16), UIDiagonalStripeSide.RIGHT, UIStyle.Current.Bg); Diag.Y = -16; Diag.ListenForMouse(Diag.GetBounds(), (e, s) => { }); Add(Diag); TitleStripe = new UIDiagonalStripe(new Point(screen.ScreenWidth / 2, 92 + 8 + 32), UIDiagonalStripeSide.RIGHT, UIStyle.Current.Bg); TitleStripe.StartOff = 8 + 32; TitleStripe.Y = -16 + extra; Add(TitleStripe); var neigh = Content.Get().Neighborhood; var house = neigh.GetHouse(houseID); var street = neigh.StreetNames; var assignment = street.Get <STR>(2001).GetString(houseID - 1); int streetName; if (int.TryParse(assignment, out streetName)) { StreetTitle = new UILabel(); StreetTitle.Position = new Vector2(30, 94 + extra - 64); InitLabel(StreetTitle); StreetTitle.CaptionStyle.Color = UIStyle.Current.BtnActive; StreetTitle.Caption = street.Get <STR>(2000).GetString(streetName - 1).Replace("%s", houseID.ToString()); } var nameDesc = neigh.GetHouseNameDesc(houseID); var name = nameDesc.Item1; if (name == "") { name = StreetTitle.Caption; } LotTitle = new UILabel(); LotTitle.Position = new Vector2(30, 122 + extra - 64); InitLabel(LotTitle); LotTitle.CaptionStyle.Size = 37; LotTitle.Caption = name; var family = neigh.GetFamilyForHouse((short)houseID); LotDescription = new UILabel(); LotDescription.Position = new Vector2(30, 206 + extra); InitLabel(LotDescription); //LotDescription.CaptionStyle.Size = 15; LotDescription.Size = new Vector2(screen.ScreenWidth / 2 - 60, screen.ScreenHeight - 415); LotDescription.Wrapped = true; LotDescription.Alignment = TextAlignment.Top | TextAlignment.Left; SecondaryText = new UILabel(); SecondaryText.Position = new Vector2(30, screen.ScreenHeight - (165 + extra)); InitLabel(SecondaryText); SecondaryText.Size = new Vector2(screen.ScreenWidth / 2 - 60, 29); SecondaryText.Wrapped = true; SecondaryText.Alignment = TextAlignment.Bottom | TextAlignment.Right; SecondaryText.CaptionStyle.Color = UIStyle.Current.SecondaryText; var moveInID = (UIScreen.Current as Screens.TS1GameScreen).MoveInFamily; var moveIn = (moveInID == null) ? null : Content.Get().Neighborhood.GetFamily((ushort)moveInID.Value); var buttonValid = true; if (family != null) { var famUI = new UIHouseFamilyList(family); var scale = Math.Max(2 / 3f, Math.Min(1, screen.ScreenWidth / 1704f)); famUI.ScaleX = famUI.ScaleY = scale; var space = (96 * scale) - 56; LotDescription.Y += space; famUI.Position = new Vector2(48 + space / 2, 152 + extra + space / 2); Add(famUI); FamilyDisplay = famUI; LotDescription.Caption = GameFacade.Strings.GetString("134", "0", new string[] { Content.Get().Neighborhood.MainResource.Get <FAMs>(family.ChunkID)?.GetString(0) ?? "?", "§" + (family.ValueInArch + family.Budget).ToString("##,#0"), //should include lot value eventually family.FamilyFriends.ToString() }); LotDescription.CaptionStyle.Color = UIStyle.Current.SecondaryText; if (moveIn != null) { SecondaryText.Caption = GameFacade.Strings.GetString("132", "15"); //house occupied buttonValid = false; } } else { LotDescription.Y -= 64; LotDescription.Size = new Vector2(LotDescription.Size.X, LotDescription.Size.Y + 65); //LotDescription.Caption = new string(Enumerable.Range(1, 255).Select(x => 'a').ToArray()); LotDescription.Caption = nameDesc.Item2; //set up the secondary text var zones = neigh.ZoningDictionary; short result = 1; if (!zones.TryGetValue((short)houseID, out result)) { result = (short)((houseID >= 81 && houseID <= 89) ? 2 : 1); } if (result > 0) { //zone string str; if (moveIn != null) { str = GameFacade.Strings.GetString("134", "18").Substring(8); //is community, can't move in buttonValid = false; } else { str = GameFacade.Strings.GetString("134", "17").Substring(8); //is community } SecondaryText.Caption = str; } else { //show price var price = house.Get <SIMI>(1)?.PurchaseValue ?? 0; string str; if (houseID >= 90 && houseID <= 92) { //also requires magicoins var magicoins = neigh.GetMagicoinsForFamily(family); var requiredMC = int.Parse(GameFacade.Strings.GetString("134", (32 + Math.Abs(91 - houseID)).ToString())); if (moveIn != null) { if (magicoins >= requiredMC) { if (moveIn.Budget >= price) { str = GameFacade.Strings.GetString("134", "31", new string[] { "", "", "§" + price.ToString("##,#0"), requiredMC.ToString() }); } else { //missing simoleons str = GameFacade.Strings.GetString("134", "38", new string[] { "", "", "§" + price.ToString("##,#0"), requiredMC.ToString(), moveIn.ChunkParent.Get <FAMs>(moveIn.ChunkID)?.GetString(0) ?? "", "§" + moveIn.Budget.ToString("##,#0") }).Substring(4); buttonValid = false; } } else { if (moveIn.Budget >= price) { //missing magicoins str = GameFacade.Strings.GetString("134", "36", new string[] { "", "", "§" + price.ToString("##,#0"), requiredMC.ToString(), moveIn.ChunkParent.Get <FAMs>(moveIn.ChunkID)?.GetString(0) ?? "", magicoins.ToString() }).Substring(4); } else { //missing both str = GameFacade.Strings.GetString("134", "37", new string[] { "", "", "§" + price.ToString("##,#0"), requiredMC.ToString(), moveIn.ChunkParent.Get <FAMs>(moveIn.ChunkID)?.GetString(0) ?? "", magicoins.ToString() }).Substring(4); buttonValid = false; } buttonValid = false; } } else { //suggest move in str = GameFacade.Strings.GetString("134", "29", new string[] { "", "", "§" + price.ToString("##,#0"), requiredMC.ToString() }).Substring(4); } } else { if (moveIn != null) { if (moveIn.Budget >= price) { str = GameFacade.Strings.GetString("134", "5", new string[] { "", "", "§" + price.ToString("##,#0"), "§" + (moveIn.Budget - price).ToString("##,#0") }).Substring(4); } else { str = GameFacade.Strings.GetString("134", "4", new string[] { "", "", "§" + price.ToString("##,#0"), moveIn.ChunkParent.Get <FAMs>(moveIn.ChunkID)?.GetString(0) ?? "", "§" + moveIn.Budget.ToString("##,#0") }).Substring(4); buttonValid = false; } } else { //suggest move in str = GameFacade.Strings.GetString("134", "1", new string[] { "", "", "§" + price.ToString("##,#0") }).Substring(4); } } SecondaryText.Caption = str; SecondaryText.CaptionStyle.Size = 15; } } EnterLot = new UIBigButton(false); EnterLot.Caption = (moveIn == null)?"Enter Lot":"Move In"; EnterLot.Width = (moveIn == null)? (screen.ScreenWidth / 2 - 293) : (screen.ScreenWidth / 2 - 60); EnterLot.Disabled = !buttonValid; EnterLot.Position = new Vector2(30, screen.ScreenHeight - (extra + 125)); EnterLot.OnButtonClick += (b) => { OnSelected?.Invoke(houseID); Kill(); }; Add(EnterLot); More = new UIBigButton(true); More.Caption = "More"; More.Width = 208; More.Position = new Vector2(screen.ScreenWidth / 2 - 238, screen.ScreenHeight - (extra + 125)); More.OnButtonClick += (btn) => { ShowMore(true); }; if (moveIn == null) { Add(More); } var optionFunctions = new ButtonClickDelegate[] { (family == null)?null:(ButtonClickDelegate)((btn) => Evict(family)), null, null, (btn) => ShowMore(false) }; var optionNames = new string[] { (family == null)?"Bulldoze":"Evict", "Rezone", "Export", "Back" }; var bY = extra + 140; for (int i = 0; i < optionFunctions.Length; i++) { var btn = new UIBigButton(i == optionFunctions.Length - 1); btn.Caption = optionNames[i]; btn.Position = new Vector2(screen.ScreenWidth / 4 - btn.Width / 2, bY); btn.Disabled = optionFunctions[i] == null; btn.OnButtonClick += optionFunctions[i]; Add(btn); bY += 120; OptionButtons.Add(btn); } X = screen.ScreenWidth / -2; GameFacade.Screens.Tween.To(this, 0.5f, new Dictionary <string, float>() { { "X", 0f } }, TweenQuad.EaseOut); MoreTween = MoreTween; }
public static UIAlertButton[] OkCancel(ButtonClickDelegate okCallback, ButtonClickDelegate noCallback) { return(new UIAlertButton[] { new UIAlertButton(UIAlertButtonType.OK, okCallback), new UIAlertButton(UIAlertButtonType.Cancel, noCallback) }); }
/// <summary> /// Creates an instance of UIButton that has a scaled texture. /// </summary> /// <param name="X">The x-coordinate where the button will be displayed.</param> /// <param name="Y">The y-coordinate where the button will be displayed.</param> /// <param name="ScaleX">The scaling-factor used to scale this button's texture on the X-axis.</param> /// <param name="ScaleY">The scaling-factor used to scale this button's texture on the Y-axis.</param> /// <param name="Texture">The texture for this button.</param> /// <param name="StrID">The button's string ID.</param> /// <param name="Screen">The UIScreen instance that will draw and update this button.</param> public UIButton(int X, int Y, int ScaleX, int ScaleY, Texture2D Texture, string StrID, UIScreen Screen) : base(Screen, StrID, DrawLevel.DontGiveAFuck) { m_X = X; m_Y = Y; m_ScaleX = ScaleX; m_ScaleY = ScaleY; m_Texture = Texture; m_StrID = StrID; //All buttons have 4 frames... m_Width = Texture.Width / 4; m_CurrentFrame = 0; OnButtonClick += new ButtonClickDelegate(delegate(UIButton btn) { Screen.RegisterClick(this); }); }