Example #1
0
        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;
        }
Example #2
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);
        }