private void OnAvatarClick(AvatarView sender, MouseButtonEvent e) { var pair = avatars.FirstOrDefault(x => x.Value == sender); if (pair.Value != null) { PartyMemberClick.Raise(new PartyMemberClickEvent(pair.Key, e.Button)); } }
public CombatView(Widget parent) : base(parent) { relations = new LinkedList <CombatRelation>(); avatar = new AvatarView(this); avatar.Click += OnCurrentAvatarClick; avatar.Move(-avatar.Width, 0); btnGive = new GiveButton(this); btnGive.Move(-avatar.Width - btnGive.Width - 5, 0); btnGive.Click += OnCurrentGiveButtonClick; }
private void Update() { var removed = new List <int>(avatars.Keys); if (Party != null) { foreach (var member in Party.Members.OrderBy(x => x.Id)) { if (member.Id == PlayerId || removed.Remove(member.Id)) { continue; } var avatar = new AvatarView(this); avatar.Resize(37, 37); avatar.BorderColor = member.Color; avatar.Click += OnAvatarClick; //avatar.Avatar = new Avatar(member.Id, gobCache); avatars.Add(member.Id, avatar); var gob = gobCache.Get(member.Id); if (gob != null) { avatar.Tooltip = (gob.KinInfo != null) ? new Tooltip(gob.KinInfo.Name) : null; } } } foreach (var memberId in removed) { var avatar = avatars[memberId]; avatar.Click -= OnAvatarClick; avatar.Dispose(); avatar.Remove(); avatars.Remove(memberId); } int i = 0; foreach (var avatar in avatars.Values) { avatar.Move((i % 2) * 43, (i / 2) * 43 + 24); i++; } Visible = avatars.Count > 0; }
public CombatRelation(Widget parent, int id) : base(parent) { this.id = id; Size = background.Size; avatar = new AvatarView(this); avatar.Resize(27, 27); avatar.Move(25, (Height - avatar.Height) / 2); avatar.Click += OnAvatarClick; button = new GiveButton(this); button.Resize(15, 15); button.Move(5, 4); button.Click += OnButtonClick; label = new Label(this, Fonts.Default); label.Move(65, 10); }
public BuddyInfo(Widget parent) : base(parent) { av = new AvatarView(this); tbName = new TextBox(this); tbName.Move(10, 100); tbName.Resize(150, 20); tbName.KeyDown += OnNameTextBoxKeyDown; btnChat = new Button(this, 20); btnChat.Move(10, 165); btnChat.Text = "Private chat"; btnChat.Click += () => Chat.Raise(); btnRemove = new Button(this, 20); btnRemove.Move(10, 188); btnRemove.Click += () => RemoveBuddy.Raise(); btnInvite = new Button(this, 20); btnInvite.Move(10, 211); btnInvite.Text = "Invite to party"; btnInvite.Click += () => Invite.Raise(); btnDescribe = new Button(this, 20); btnDescribe.Move(10, 234); btnDescribe.Text = "Describe to..."; btnDescribe.Click += () => Describe.Raise(); btnExile = new Button(this, 20); btnExile.Move(10, 257); btnExile.Text = "Exile"; btnExile.Click += () => Exile.Raise(); lblLastSeen = new Label(this, Fonts.LabelText); lblLastSeen.AutoSize = true; lblLastSeen.Move(10, 150); groupSelector = new GroupSelector(this); groupSelector.Move(8, 128); groupSelector.Select += group => ChangeGroup.Raise(group); Clear(); }
public ListItem(Widget parent, string charName, IEnumerable <Delayed <ISprite> > layers) : base(parent) { Size = background.Size; nameTextLine = new TextLine(Fonts.Heading); nameTextLine.TextColor = Color.White; nameTextLine.Append(charName); btnPlay = new Button(this, 100); btnPlay.Text = "Play"; btnPlay.Move(Width - 105, Height - 24); btnPlay.Click += () => Selected.Raise(); avatar = new AvatarView(this); avatar.Avatar = new Avatar(layers); var padding = (Height - avatar.Height) / 2; avatar.Move(padding, padding); }
private void OnAvatarClick(AvatarView sender, MouseButtonEvent e) { Click.Raise(new CombatRelationClickEvent(e.Button, this)); }