Exemple #1
0
 public void RefreshUnion()
 {
     _memberList.Clear();
     if (Main.netMode == 1)
     {
         MessageSender.GetComplexUnionData();
     }
     else
     {
         for (var i = 0; i < 19; i++)
         {
             var testinfo = new JsonData.SimplifiedPlayerInfo
             {
                 Name    = ServerUtils.RandomGenString(),
                 IsLogin = Main.rand.NextBool(),
             };
             var bar = new UIUnionMemberBar(testinfo, Main.rand.Next(2) == 0 ? UnionPosition.会员 : UnionPosition.建筑师, Main.rand.Next(10000000));
             _memberList.Add(bar);
         }
         var ownerinfo = new JsonData.SimplifiedPlayerInfo
         {
             Name    = "Skirt",
             IsLogin = true,
         };
         _memberList.Add(new UIUnionMemberBar(ownerinfo, UnionPosition.会长, Main.rand.Next(10000000)));
         _memberList.Sort();
         unionNameText.SetText("裙中世界");
         AdjustOwnerUI(true);
     }
     _relaxTimer = 180;
     _rotation   = 0f;
 }
 public void RefreshUnions()
 {
     _unionsList.Clear();
     if (Main.netMode == 1)
     {
         MessageSender.SendGetUnionsData();
     }
     else
     {
         for (var i = 0; i < 20; i++)
         {
             var testinfo = new JsonData.SimplifiedUnionInfo
             {
                 Name      = ServerUtils.RandomGenString(),
                 NumMember = 5,
                 Level     = 3,
                 OwnerName = "裙子"
             };
             var bar = new UIUnionBar(testinfo);
             _unionsList.Add(bar);
         }
     }
     _relaxTimer = 180;
     _rotation   = 0f;
 }
        //private void RefreshButton_OnClick(UIMouseEvent evt, UIElement listeningElement)
        //{
        //	RefreshFriends();
        //}


        public void RefreshGames()
        {
            //uIFriendBars.Clear();
            _matchedGameList.Clear();

            if (Main.netMode == 1)
            {
                MessageSender.SendGetGames();
            }
            else
            {
                for (var i = 0; i < 20; i++)
                {
                    var testinfo = new JsonData.SimplifiedMatchInfo
                    {
                        Name           = ServerUtils.RandomGenString(),
                        IsMatching     = Main.rand.Next(2) == 0 ? true : false,
                        IsGameStarted  = Main.rand.Next(2) == 0 ? true : false,
                        MatchedPlayers = 5,
                        MaxPlayers     = 10
                    };
                    var bar = new UIMatchGameBar(testinfo);
                    _matchedGameList.Add(bar);
                }
            }
            _relaxTimer = 180;
            _rotation   = 0f;
        }
Exemple #4
0
        public void RefreshOnlinePlayer()
        {
            uIPlayerBars.Clear();
            _onlinePlayerList.Clear();

            if (Main.netMode == 1)
            {
                MessageSender.SendRequestOnlinePlayer();
            }
            else
            {
                for (var i = 0; i < 20; i++)
                {
                    var testinfo = new JsonData.SimplifiedPlayerInfo
                    {
                        Name = ServerUtils.RandomGenString()
                    };
                    var bar = new UINormalPlayerBar(testinfo);
                    uIPlayerBars.Add(bar);
                    _onlinePlayerList.Add(bar);
                    onlinelabel.SetText($"在线玩家  人数: {uIPlayerBars.Count}");
                }
            }
            _relaxTimer = 180;
            _rotation   = 0f;
        }
 public void AppendCandidates(JsonData.ComplexUnionInfo info)
 {
     _candidateList.Clear();
     foreach (var player in info.Requests)
     {
         _candidateList.Add(new UIUnionCandidateBar(player));
     }
     UnreadCount = _candidateList.Count;
 }
Exemple #6
0
        public void RefreshFriends()
        {
            //uIFriendBars.Clear();
            _friendList.Clear();

            if (Main.netMode == 1)
            {
                MessageSender.SendGetFriends();
            }
            else
            {
                for (var i = 0; i < 20; i++)
                {
                    var testinfo = new JsonData.SimplifiedPlayerInfo
                    {
                        Name = ServerUtils.RandomGenString()
                    };
                    var bar = new UIFriendBar(testinfo);
                    _friendList.Add(bar);
                }
            }
            _relaxTimer = 180;
            _rotation   = 0f;
        }
        internal void GetMailList()
        {
            lock (this)
            {
                SelectedMailItem = null;
                ClearContent();
                _mailList.Clear();
                if (Main.netMode == 0)
                {
                    for (int i = 0; i < 5; i++)
                    {
                        UISlot slot = new UISlot(ServerSideCharacter2.ModTexturesTable["Box"]);
                        slot.Width.Set(60, 0f);
                        slot.Height.Set(60, 0f);
                        slot.CanPutInSlot += (item) => false;
                        slot.DrawColor     = Drawing.DefaultBoxColor * 0.75f;
                        _uiItemGrid.Add(slot);
                    }

                    for (int i = 0; i < 5; i++)
                    {
                        var testinfo = new MailHead(ServerUtils.RandomGenString(40))
                        {
                            IsRead = Main.rand.NextBool(),
                            Sender = "<系统>"
                        };
                        var bar = new UIMailHead(testinfo);
                        _mailList.Add(bar);
                    }
                }
                else
                {
                    MessageSender.SendGetMailsHead();
                }
            }
        }
Exemple #8
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;
        }
Exemple #9
0
        private void AdjustOwnerUI(bool owner)
        {
            _buttonList.Clear();
            if (owner)
            {
                var candidateButton = new UICDButton(null, true);
                candidateButton.Width.Set(0, 1f);
                candidateButton.Height.Set(50f, 0f);
                candidateButton.BoxTexture         = ServerSideCharacter2.ModTexturesTable["AdvInvBack2"];
                candidateButton.ButtonDefaultColor = new Color(200, 200, 200);
                candidateButton.ButtonChangeColor  = Color.White;
                candidateButton.CornerSize         = new Vector2(12, 12);
                candidateButton.ButtonText         = "申请信息";
                candidateButton.OnClick           += CandidateButton_OnClick;
                _buttonList.Add(candidateButton);

                var exitButton = new UICDButton(null, true);
                exitButton.Width.Set(0, 1f);
                exitButton.Height.Set(50f, 0f);
                exitButton.BoxTexture         = ServerSideCharacter2.ModTexturesTable["AdvInvBack2"];
                exitButton.ButtonDefaultColor = new Color(200, 200, 200);
                exitButton.ButtonChangeColor  = Color.White;
                exitButton.CornerSize         = new Vector2(12, 12);
                exitButton.ButtonText         = "解散";
                exitButton.OnClick           += ExitButton_OnClick1;
                _buttonList.Add(exitButton);
            }
            else
            {
                var exitButton = new UICDButton(null, true);
                exitButton.Width.Set(0, 1f);
                exitButton.Height.Set(50f, 0f);
                exitButton.BoxTexture         = ServerSideCharacter2.ModTexturesTable["AdvInvBack2"];
                exitButton.ButtonDefaultColor = new Color(200, 200, 200);
                exitButton.ButtonChangeColor  = Color.White;
                exitButton.CornerSize         = new Vector2(12, 12);
                exitButton.ButtonText         = "退出";
                exitButton.OnClick           += ExitButton_OnClick;
                _buttonList.Add(exitButton);
            }
            var donateButton = new UICDButton(null, true);

            donateButton.Width.Set(0, 1f);
            donateButton.Height.Set(50, 0f);
            donateButton.BoxTexture         = ServerSideCharacter2.ModTexturesTable["AdvInvBack2"];
            donateButton.ButtonDefaultColor = new Color(200, 200, 200);
            donateButton.ButtonChangeColor  = Color.White;
            donateButton.CornerSize         = new Vector2(12, 12);
            donateButton.ButtonText         = "捐献";
            donateButton.OnClick           += DonateButton_OnClick;
            _buttonList.Add(donateButton);

            var tpRegionButton = new UICDButton(null, true);

            tpRegionButton.Width.Set(0, 1f);
            tpRegionButton.Height.Set(50, 0f);
            tpRegionButton.CoolDownCount      = 60;
            tpRegionButton.BoxTexture         = ServerSideCharacter2.ModTexturesTable["AdvInvBack2"];
            tpRegionButton.ButtonDefaultColor = new Color(200, 200, 200);
            tpRegionButton.ButtonChangeColor  = Color.White;
            tpRegionButton.CornerSize         = new Vector2(12, 12);
            tpRegionButton.ButtonText         = "传送领地";
            tpRegionButton.OnClick           += TpRegionButton_OnClick;
            _buttonList.Add(tpRegionButton);
        }
Exemple #10
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);
        }