public void TestDadoUnPlayerScoreboardConPlayerNameAlQueLeCambioElNombrePorPepeCuandoLePreguntoPorSuPlayerNameRespondeFoo()
        {
            PlayerScoreboard sut = new PlayerScoreboard();

            sut.changeName("Pepe");
            Assert.AreEqual("Pepe", sut.getPlayerName());
        }
        public void TestDadoUnPlayerScoreboardCon0PuntosDeVenenoYLeRestoUnPuntoDeVenenoCuandoLePreguntoSusPuntosDeVidaResponde0()
        {
            PlayerScoreboard sut = new PlayerScoreboard();

            sut.subOnePoisonPoint();
            Assert.AreEqual(0, sut.getPoisonPoints());
        }
        public void TestDadoUnPlayerScoreboardCon20PuntosDeVidaYLeResto5PuntosDeVidaCuandoLePreguntoSusPuntosDeVidaREsponde25()
        {
            PlayerScoreboard sut = new PlayerScoreboard();

            sut.subFiveLifePoints();
            Assert.AreEqual(15, sut.getLifePoints());
        }
        public void TestDadoUnPlayerScoreboardCon20PuntosDeVidaYLeSumoUnaVidaCuandoLePreguntoSusPuntosDeVidaREsponde21()
        {
            PlayerScoreboard sut = new PlayerScoreboard();

            sut.addOneLifePoints();
            Assert.AreEqual(21, sut.getLifePoints());
        }
Пример #5
0
        private void cmdStats(BasePlayer player, string command, string[] args)
        {
            InitPlayer(player.userID);

            try {
                PlayerScoreboard pScore = GetPlayerStats(player.userID);
                SendReply(player, $"Players Stats\nKills: {pScore.Kills}\nDeaths: {pScore.Deaths}\nRevives: {pScore.Revives}\nDowns: {pScore.Downs}");

                ClanScoreboard cScore = GetClanStats(player.userID);
                SendReply(player, $"Clan Stats\nKills: {cScore.Kills}\nDeaths: {cScore.Deaths}\nRevives: {cScore.Revives}\nDowns: {cScore.Downs}");
            } catch (Exception e) {
            }
        }
Пример #6
0
        void InitPlayer(ulong playerId)
        {
            if (playerId == 0)
            {
                return;
            }
            string playerClan = GetClan(playerId);

            if (!_playerScores.ContainsKey(playerId))
            {
                PlayerScoreboard pScore = new PlayerScoreboard(playerId, playerClan);
                _playerScores.Add(playerId, pScore);
            }
            InitClan(playerClan);
        }
Пример #7
0
        private void cmdCui(BasePlayer player, string command, string[] args)
        {
            CuiElementContainer     container    = new CuiElementContainer();
            List <ClanScoreboard>   cScoreSorted = _clansScores.Values.OrderByDescending(x => x.kdr()).Take(10).ToList();
            List <PlayerScoreboard> pScoreSorted = _playerScores.Values.OrderByDescending(x => x.kdr()).Take(10).ToList();

            if (cScoreSorted.Count > 0)
            {
                mainElementClan = container.Add(new CuiPanel {
                    Image =
                    {
                        Color = "0 0 0 0.5"
                    },
                    RectTransform =
                    {
                        AnchorMin = "0.800 0.650",
                        AnchorMax = "0.995 0.960" //left digit is viewheight from left, right digit is Y axis, viewheight from bottom
                    },
                    CursorEnabled = false,
                }, "Hud", mainPanelClanName);

                container.Add(new CuiLabel {
                    Text =
                    {
                        Text     = "#",
                        FontSize =  15,
                        Align    = TextAnchor.MiddleLeft
                    },
                    RectTransform =
                    {
                        AnchorMin = $"0.05 0.80",
                        AnchorMax = $"0.12 0.95"
                    }
                }, mainElementClan);

                container.Add(new CuiLabel {
                    Text =
                    {
                        Text     = "Clan",
                        FontSize =     15,
                        Align    = TextAnchor.MiddleLeft
                    },
                    RectTransform =
                    {
                        AnchorMin = $"0.15 0.80",
                        AnchorMax = $"0.46 0.95"
                    }
                }, mainElementClan);

                container.Add(new CuiLabel {
                    Text =
                    {
                        Text     = "Kills",
                        FontSize =      15,
                        Align    = TextAnchor.MiddleCenter
                    },
                    RectTransform =
                    {
                        AnchorMin = $"0.49 0.80",
                        AnchorMax = $"0.64 0.95"
                    }
                }, mainElementClan);

                container.Add(new CuiLabel {
                    Text =
                    {
                        Text     = "Deaths",
                        FontSize =       15,
                        Align    = TextAnchor.MiddleCenter
                    },
                    RectTransform =
                    {
                        AnchorMin = $"0.67 0.80",
                        AnchorMax = $"0.85 0.95"
                    }
                }, mainElementClan);

                container.Add(new CuiLabel {
                    Text =
                    {
                        Text     = "KDR",
                        FontSize =    15,
                        Align    = TextAnchor.MiddleCenter
                    },
                    RectTransform =
                    {
                        AnchorMin = $"0.85 0.80",
                        AnchorMax = $"1.00 0.95"
                    }
                }, mainElementClan);


                for (var i = 0; i < cScoreSorted.Count; i++)
                {
                    ClanScoreboard team = cScoreSorted[i];

                    container.Add(new CuiLabel {
                        Text =
                        {
                            Text     = (i + 1).ToString(),
                            FontSize =                 14,
                            Align    = TextAnchor.MiddleLeft
                        },
                        RectTransform =
                        {
                            AnchorMin = $"0.05 {0.825 - 0.075*(i+1)}",
                            AnchorMax = $"0.12 {0.825 - (0.075*i+0)}"
                        }
                    }, mainElementClan);

                    container.Add(new CuiLabel {
                        Text =
                        {
                            Text     = team.clanTag,
                            FontSize =           14,
                            Align    = TextAnchor.MiddleLeft
                        },
                        RectTransform =
                        {
                            AnchorMin = $"0.15 {0.825 - 0.075*(i+1)}",
                            AnchorMax = $"0.30 {0.825 - (0.075*i+0)}"
                        }
                    }, mainElementClan);

                    container.Add(new CuiLabel {
                        Text =
                        {
                            Text     = team.Kills.ToString(),
                            FontSize =                    14,
                            Align    = TextAnchor.MiddleCenter
                        },
                        RectTransform =
                        {
                            AnchorMin = $"0.49 {0.825 - 0.075*(i+1)}",
                            AnchorMax = $"0.64 {0.825 - (0.075*i+0)}"
                        }
                    }, mainElementClan);

                    container.Add(new CuiLabel {
                        Text =
                        {
                            Text     = team.Deaths.ToString(),
                            FontSize =                     14,
                            Align    = TextAnchor.MiddleCenter
                        },
                        RectTransform =
                        {
                            AnchorMin = $"0.67 {0.825 - 0.075*(i+1)}",
                            AnchorMax = $"0.80 {0.825 - (0.075*i+0)}"
                        }
                    }, mainElementClan);

                    container.Add(new CuiLabel {
                        Text =
                        {
                            Text     = team.kdr().ToString(),
                            FontSize =                    14,
                            Align    = TextAnchor.MiddleCenter
                        },
                        RectTransform =
                        {
                            AnchorMin = $"0.85 {0.825 - 0.075*(i+1)}",
                            AnchorMax = $"1.00 {0.825 - (0.075*i+0)}"
                        }
                    }, mainElementClan);
                }
            }
            ////////////////////////////////////////////////////////////////////////////
            ///
            if (pScoreSorted.Count > 0)
            {
                mainElementPlayers = container.Add(new CuiPanel {
                    Image =
                    {
                        Color = "0 0 0 0.5"
                    },
                    RectTransform =
                    {
                        AnchorMin = "0.800 0.335",
                        AnchorMax = "0.995 0.645" //left digit is viewheight from left, right digit is Y axis, viewheight from bottom
                    },
                    CursorEnabled = false,
                }, "Hud", mainPanelPlayersName);

                container.Add(new CuiLabel {
                    Text =
                    {
                        Text     = "#",
                        FontSize =  15,
                        Align    = TextAnchor.MiddleLeft
                    },
                    RectTransform =
                    {
                        AnchorMin = $"0.05 0.80",
                        AnchorMax = $"0.12 0.95"
                    }
                }, mainElementPlayers);

                container.Add(new CuiLabel {
                    Text =
                    {
                        Text     = "Players",
                        FontSize =        15,
                        Align    = TextAnchor.MiddleLeft
                    },
                    RectTransform =
                    {
                        AnchorMin = $"0.15 0.80",
                        AnchorMax = $"0.46 0.95"
                    }
                }, mainElementPlayers);

                container.Add(new CuiLabel {
                    Text =
                    {
                        Text     = "Kills",
                        FontSize =      15,
                        Align    = TextAnchor.MiddleCenter
                    },
                    RectTransform =
                    {
                        AnchorMin = $"0.49 0.80",
                        AnchorMax = $"0.64 0.95"
                    }
                }, mainElementPlayers);

                container.Add(new CuiLabel {
                    Text =
                    {
                        Text     = "Deaths",
                        FontSize =       15,
                        Align    = TextAnchor.MiddleCenter
                    },
                    RectTransform =
                    {
                        AnchorMin = $"0.67 0.80",
                        AnchorMax = $"0.85 0.95"
                    }
                }, mainElementPlayers);

                container.Add(new CuiLabel {
                    Text =
                    {
                        Text     = "KDR",
                        FontSize =    15,
                        Align    = TextAnchor.MiddleCenter
                    },
                    RectTransform =
                    {
                        AnchorMin = $"0.85 0.80",
                        AnchorMax = $"1.00 0.95"
                    }
                }, mainElementPlayers);


                for (var i = 0; i < pScoreSorted.Count; i++)
                {
                    PlayerScoreboard plyr    = pScoreSorted[i];
                    IPlayer          fplayer = covalence.Players.FindPlayerById(plyr.playerId.ToString());

                    container.Add(new CuiLabel {
                        Text =
                        {
                            Text     = (i + 1).ToString(),
                            FontSize =                 14,
                            Align    = TextAnchor.MiddleLeft
                        },
                        RectTransform =
                        {
                            AnchorMin = $"0.05 {0.825 - 0.075*(i+1)}",
                            AnchorMax = $"0.12 {0.825 - (0.075*i+0)}"
                        }
                    }, mainElementPlayers);
                    container.Add(new CuiLabel {
                        Text =
                        {
                            Text     = fplayer != null ? fplayer?.Name : plyr.playerId.ToString(),
                            FontSize =                                                         14,
                            Align    = TextAnchor.MiddleLeft
                        },
                        RectTransform =
                        {
                            AnchorMin = $"0.15 {0.825 - 0.075*(i+1)}",
                            AnchorMax = $"0.40 {0.825 - (0.075*i+0)}"
                        }
                    }, mainElementPlayers);

                    container.Add(new CuiLabel {
                        Text =
                        {
                            Text     = plyr.Kills.ToString(),
                            FontSize =                    14,
                            Align    = TextAnchor.MiddleCenter
                        },
                        RectTransform =
                        {
                            AnchorMin = $"0.49 {0.825 - 0.075*(i+1)}",
                            AnchorMax = $"0.64 {0.825 - (0.075*i+0)}"
                        }
                    }, mainElementPlayers);

                    container.Add(new CuiLabel {
                        Text =
                        {
                            Text     = plyr.Deaths.ToString(),
                            FontSize =                     14,
                            Align    = TextAnchor.MiddleCenter
                        },
                        RectTransform =
                        {
                            AnchorMin = $"0.67 {0.825 - 0.075*(i+1)}",
                            AnchorMax = $"0.80 {0.825 - (0.075*i+0)}"
                        }
                    }, mainElementPlayers);

                    container.Add(new CuiLabel {
                        Text =
                        {
                            Text     = plyr.kdr().ToString(),
                            FontSize =                    14,
                            Align    = TextAnchor.MiddleCenter
                        },
                        RectTransform =
                        {
                            AnchorMin = $"0.85 {0.825 - 0.075*(i+1)}",
                            AnchorMax = $"1.00 {0.825 - (0.075*i+0)}"
                        }
                    }, mainElementPlayers);
                }
            }

            if ((cScoreSorted.Count + pScoreSorted.Count) > 0 && !openPanels.ContainsKey(player.userID))
            {
                openPanels.Add(player.userID, "open");
                CuiHelper.AddUi(player, container);
                timer.Once(10, () => DestroyUI(player));
            }
        }
        public void TestDadoUnPlayerScoreboardConPlayerNameFooCuandoLePreguntoPorSuPlayerNameRespondeFoo()
        {
            PlayerScoreboard sut = new PlayerScoreboard();

            Assert.AreEqual("Foo", sut.getPlayerName());
        }
        public void TestDadoUnPlayerScoreboardCuandoLePreguntoSusPuntosDeVidaResponde20()
        {
            PlayerScoreboard sut = new PlayerScoreboard();

            Assert.AreEqual(20, sut.getLifePoints());
        }
Пример #10
0
 public PlayerScoreboardPostix(PlayerScoreboardAppModel appModel)
 {
     this.appModel = appModel;
     this.owner    = this.appModel.createNewScoreBoard();
     this.initializeCanvas();
 }
Пример #11
0
 private static void OnPlayerScoreBoard(InputAction.CallbackContext context)
 {
     PlayerScoreboard?.Invoke();
 }