Beispiel #1
0
        public UIUnionMemberBar(SimplifiedPlayerInfo info, UnionPosition position, long donation) : base(info)
        {
            _position = position;
            if (position == UnionPosition.会长)
            {
                _defaultColor = Color.LimeGreen;
                this.Color    = _defaultColor * 0.7f;
            }
            expandedHeight = 135;

            var classText = new UIText(position.ToString());

            classText.Top.Set(10, 0f);
            classText.Left.Set(165, 0);
            Append(classText);

            var donationText = new UIText($"贡献:{donation}");

            donationText.Top.Set(50, 0f);
            donationText.Left.Set(5f, 0);
            Append(donationText);

            AddExtraButton();

            SetUpExtraButtons();
        }
        /// <summary>
        /// 相对于玩家id为id的玩家的简化玩家信息,便于确认是否是玩家的好友
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public SimplifiedPlayerInfo GetSimplified(int id)
        {
            var isFriend = (id == -1) || (id == this.playerID) ||
                           (Main.player[id].GetServerPlayer().Friends.Contains(this.Name));
            var info = new SimplifiedPlayerInfo
            {
                Name             = this.Name,
                IsLogin          = this.IsLogin,
                PlayerID         = playerID,
                GUID             = this._info.ID,
                ChatColor        = Group.ChatColor,
                ChatPrefix       = Group.ChatPrefix,
                CustomChatPrefix = this.qqAuth.CustomChatPrefix,
                GroupName        = Group.Name,
                UnionName        = Union == null ? "无" : this.Union.Name,
                IsFriend         = isFriend,
                Rank             = this.Rank,
                KillCount        = this.KillCount,
                RegistedTime     = this.RegistedTime,
                QQNumber         = this.qqAuth.QQ,
                CurrentMatch     = this.CurrentMatch == null ? "" : this.CurrentMatch.Name,
                VIPLevel         = this.VIPLevel,
                GuCoin           = this.GuCoin,
                ExtraData        = this.ExtraInfos
            };

            return(info);
        }
        public UIUnionCandidateBar(SimplifiedPlayerInfo info) : base(info)
        {
            collapsedHeight   = expandedHeight = 50f;
            shouldDrawDivider = false;
            var acceptCandidateButton = new UICDButton(null, true);

            acceptCandidateButton.Top.Set(0f, 0f);
            acceptCandidateButton.Left.Set(-70f, 1f);
            acceptCandidateButton.Width.Set(70f, 0f);
            acceptCandidateButton.Height.Set(38f, 0f);
            acceptCandidateButton.BoxTexture         = ServerSideCharacter2.ModTexturesTable["AdvInvBack3"];
            acceptCandidateButton.ButtonDefaultColor = new Color(200, 200, 200);
            acceptCandidateButton.ButtonChangeColor  = Color.White;
            acceptCandidateButton.CornerSize         = new Vector2(12, 12);
            acceptCandidateButton.ButtonText         = "接受";
            acceptCandidateButton.OnClick           += AcceptCandidateButton_OnClick;
            Append(acceptCandidateButton);

            var rejectButton = new UICDButton(null, true);

            rejectButton.Top.Set(0f, 0f);
            rejectButton.Left.Set(-155f, 1f);
            rejectButton.Width.Set(70f, 0f);
            rejectButton.Height.Set(38f, 0f);
            rejectButton.BoxTexture         = ServerSideCharacter2.ModTexturesTable["AdvInvBackRej"];
            rejectButton.ButtonDefaultColor = new Color(200, 200, 200);
            rejectButton.ButtonChangeColor  = Color.White;
            rejectButton.CornerSize         = new Vector2(12, 12);
            rejectButton.ButtonText         = "拒绝";
            rejectButton.OnClick           += RejectButton_OnClick;
            Append(rejectButton);
        }
        public UINormalPlayerBar(SimplifiedPlayerInfo info)
        {
            playerInfo          = info;
            this.dividerTexture = TextureManager.Load("Images/UI/Divider");
            this.Width.Set(0, 1f);
            this.Height.Set(50f, 0f);
            this.CornerSize  = new Vector2(8, 8);
            base.MainTexture = ServerSideCharacter2.ModTexturesTable["Box"];
            base.SetPadding(6f);
            this.OverflowHidden = true;


            nameLabel = new UIText(info.Name);
            nameLabel.Top.Set(10, 0f);
            nameLabel.Left.Set(5f, 0);
            if (!info.IsLogin)
            {
                nameLabel.TextColor = Color.Gray;
            }
            Append(nameLabel);

            //bool male = Main.player[playerInfo.PlayerID].Male;
            //UIImage _genderImage = new UIImage(ServerSideCharacter2.ModTexturesTable[male ? "Male" : "Female"]);
            //_genderImage.Top.Set(-GENDER_ICON_SIZE / 2, 0.5f);
            //_genderImage.Left.Set(LABEL_MAX_WIDTH + 10, 0);
            //_genderImage.Width.Set(GENDER_ICON_SIZE, 0);
            //_genderImage.Height.Set(GENDER_ICON_SIZE, 0);
            //_onlinePlayerPanel.Append(_genderImage);

            AddExtraButtons(extraButtons);
            SetUpExtraButtons();
        }
Beispiel #5
0
        public UIRankBoardPlayerBar(SimplifiedPlayerInfo info, int rank) : base(info)
        {
            this.rank = rank;
            var orderText = new UIText(rank.ToString());

            orderText.Top.Set(10, 0f);
            orderText.Left.Set(5, 0);
            Append(orderText);
            nameLabel.Left.Set(30, 0f);
            nameLabel.TextColor = GetColor(rank);

            var rankText = new UIText("分数: " + info.Rank.ToString())
            {
                HAlign = 1f
            };

            rankText.Top.Set(10, 0f);
            rankText.PaddingRight = 5f;
            Append(rankText);
        }
Beispiel #6
0
        public void RefreshBoard()
        {
            _onlinePlayerList.Clear();

            if (Main.netMode == 1)
            {
                MessageSender.SendRequestRankBoard();
            }
            else
            {
                List <SimplifiedPlayerInfo> list = new List <SimplifiedPlayerInfo>();
                for (var i = 0; i < 20; i++)
                {
                    var testinfo = new SimplifiedPlayerInfo()
                    {
                        Name      = ServerUtils.RandomGenString(),
                        Rank      = Main.rand.Next(1000) + 1000,
                        KillCount = Main.rand.Next(100),
                        IsFriend  = true,
                    };
                    list.Add(testinfo);
                }
                list.Sort(SimplifiedPlayerInfo.CompareB);
                list.Reverse();
                int k = 1;
                foreach (var info in list)
                {
                    var bar = new UIRankBoardPlayerBar(info, k);
                    _onlinePlayerList.Add(bar);
                    k++;
                }
                seasonEndTime = DateTime.Now.AddDays(5);
            }
            _relaxTimer = 180;
            _rotation   = 0f;
        }
Beispiel #7
0
        public void SetPlayer(SimplifiedPlayerInfo info)
        {
            _info = info;
            infoList.Clear();
            textName.SetText((string.IsNullOrWhiteSpace(info.CustomChatPrefix) ? "" : ("【" + info.CustomChatPrefix + "】")) + info.Name);
            var type  = Ranking.GetRankType(info.Rank);
            var range = Ranking.GetRankRange(type);

            rankLabel.SetText($"{info.Rank} / {range.Item2}");

            gucoinText.SetText(info.GuCoin.ToString());

            var percent = (info.Rank - range.Item1) / (float)(range.Item2 - range.Item1);

            rankBar.Value = percent;

            rankimage.SetImage(ServerSideCharacter2.ModTexturesTable[type.ToString()]);
            rankimage.Left.Set(center.X - rankimage.Width.Pixels / 2, 0);
            rankimage.Top.Set(center.Y - rankimage.Height.Pixels / 2, 0);
            rankimage.Tooltip = Ranking.GetName(type);

            var stateText = new UIText("");

            infoList.Add(stateText);
            if (!_info.IsLogin)
            {
                stateText.SetText($"状态:{addColor("离线", Color.Gray)}");
            }
            else if (_info.CurrentMatch == "")
            {
                stateText.SetText($"状态:{addColor("在线", Color.LimeGreen)}");
            }
            else
            {
                stateText.SetText($"状态:{addColor(_info.CurrentMatch + " 游戏中", Color.Yellow)}");
            }

            if (Main.netMode == 0 || ServerSideCharacter2.MainPlayerGroup.IsSuperAdmin)
            {
                var guidText = new UIText($"GUID:{_info.GUID}");
                infoList.Add(guidText);
                var qqNumberText = new UIText($"QQ:{_info.QQNumber}");
                infoList.Add(qqNumberText);
            }
            var playerIDText = new UIText($"玩家ID:{_info.PlayerID}");

            infoList.Add(playerIDText);

            var unionText = new UIText($"所属公会:{_info.UnionName}");

            infoList.Add(unionText);

            var killcountText = new UIText($"击杀数:{_info.KillCount}");

            infoList.Add(killcountText);

            var grouptext = new UIText($"权限组:[c/{_info.ChatColor.Hex3()}:{_info.ChatPrefix}]");

            infoList.Add(grouptext);

            if (_info.PlayerID >= 0)
            {
                var sexText = new UIText($"性别:{((Main.player[_info.PlayerID].Male) ? "男" : "女")}");
                infoList.Add(sexText);
            }

            var regTimeText = new UIText($"注册时间:{_info.RegistedTime:g}");

            infoList.Add(regTimeText);
        }
Beispiel #8
0
 public UIFriendBar(SimplifiedPlayerInfo info) : base(info)
 {
     // nameLabel.TextColor = info.IsLogin ? Color.LimeGreen : new Color(180, 180, 180);
 }