Exemplo n.º 1
0
        public SimplifiedMatchInfo GetSimplified(ServerPlayer caller)
        {
            SimplifiedMatchInfo info = new SimplifiedMatchInfo
            {
                Name           = Name,
                MaxPlayers     = MaxPlayers,
                MatchedPlayers = MatchedPlayers.Count,
                IsMatching     = IsActive,
                IsGameStarted  = GameStarted,
                TimeRem        = innerCounter,
                ReminChance    = (MaxChancePerDay == -1 ? -1 : (MaxChancePerDay - caller.TryGetInt("PVEMatchJoined")))
            };

            return(info);
        }
Exemplo n.º 2
0
        public UIMatchGameBar(SimplifiedMatchInfo info)
        {
            matchInfo           = info;
            this.dividerTexture = TextureManager.Load("Images/UI/Divider");
            this.Width.Set(0, 1f);
            this.Height.Set(140f, 0f);
            this.CornerSize  = new Vector2(8, 8);
            base.MainTexture = ServerSideCharacter2.ModTexturesTable["Box"];
            base.SetPadding(6f);
            this.OverflowHidden = true;


            nameLabel = new UIText(matchInfo.Name);
            nameLabel.Top.Set(10, 0f);
            nameLabel.Left.Set(5, 0);
            Append(nameLabel);

            var matchingStateText = new UIText("");

            matchingStateText.Top.Set(10f, 0f);
            matchingStateText.Left.Set(-100f, 1f);
            if (!info.IsMatching)
            {
                matchingStateText.SetText("匹配未开始");
                matchingStateText.TextColor = Color.Red;
            }
            else if (!info.IsGameStarted)
            {
                matchingStateText.SetText("匹配中……");
                matchingStateText.TextColor = Color.Lime;
            }
            else
            {
                matchingStateText.SetText("游戏中……");
                matchingStateText.TextColor = Color.Yellow;
            }
            Append(matchingStateText);

            //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);

            //if (!info.IsFriend)
            //{
            //	addFriendButton = new UICDButton(null, true);
            //	addFriendButton.Top.Set(0f, 0f);
            //	addFriendButton.Left.Set(-70f, 1f);
            //	addFriendButton.Width.Set(70f, 0f);
            //	addFriendButton.Height.Set(38f, 0f);
            //	addFriendButton.BoxTexture = ServerSideCharacter2.ModTexturesTable["AdvInvBack3"];
            //	addFriendButton.ButtonDefaultColor = new Color(200, 200, 200);
            //	addFriendButton.ButtonChangeColor = Color.White;
            //	addFriendButton.CornerSize = new Vector2(12, 12);
            //	addFriendButton.ButtonText = "+好友";
            //	addFriendButton.OnClick += AddFriendButton_OnClick;
            //	Append(addFriendButton);
            //}
            var matchedPlayerText = new UIText("");

            matchedPlayerText.Top.Set(50f, 0f);
            matchedPlayerText.Left.Set(5, 0f);
            if (!info.IsMatching)
            {
                info.MatchedPlayers = 0;
            }
            matchedPlayerText.SetText($"匹配人数:{info.MatchedPlayers} / {info.MaxPlayers}");
            Append(matchedPlayerText);

            matchTimeRem = new UIText("");
            matchTimeRem.Top.Set(10f, 0f);
            matchTimeRem.Left.Set(-300, 1f);
            matchTimeRem.SetText($"剩余时间:{info.TimeRem / 60}s");
            Append(matchTimeRem);

            reminCountText = new UIText("");
            reminCountText.Top.Set(50f, 0f);
            reminCountText.Left.Set(-160, 1f);
            reminCountText.SetText($"今日剩余:{(info.ReminChance == -1?"无数":info.ReminChance.ToString())}次");
            Append(reminCountText);

            AddExtraButtons(extraButtons);

            SetUpExtraButtons();
        }