示例#1
0
 /// <summary>
 /// this method is used to send a signal to the implementation
 /// to wrap things up.
 /// </summary>
 /// <returns></returns>
 public virtual bool CancelGame()
 {
     IemUtils.DLog("calling CancelGame in IemGame");
     CurrentState = IemUtils.State.Cancelled;
     CleanUp();
     Interface.Oxide.CallHook("OnGameCancelled", this);
     return(true);
 }
示例#2
0
 public virtual bool StartGame()
 {
     IemUtils.DLog("calling StartGame in IemGameBase");
     if (!CanStart())
     {
         return(false);
     }
     CurrentState = IemUtils.State.Running;
     StartedTime  = DateTime.Now;
     Interface.Oxide.CallHook("OnGameStarted", this);
     return(true);
 }
示例#3
0
        public static void CreateFadeoutBanner(BasePlayer player, string message)
        {
            string ARENA = $"{message}";

            IemUtils.DLog(message);
            string gui = "CreateFadeoutBanner";

            guiList.Add(gui);

            CuiHelper.DestroyUi(player, gui);

            var        elements    = new CuiElementContainer();
            CuiElement textElement = new CuiElement
            {
                Name       = gui,
                Parent     = "Hud.Under",
                FadeOut    = 3,
                Components =
                {
                    new CuiTextComponent
                    {
                        Text     = $"<color=#cc0000>{message}</color>",
                        FontSize = 22,
                        Align    = TextAnchor.MiddleCenter,
                        //FadeIn = 5
                    },
                    new CuiOutlineComponent
                    {
                        Distance = "1.0 1.0",
                        Color    = "1.0 1.0 1.0 1.0"
                    },
                    new CuiRectTransformComponent
                    {
                        AnchorMin = "0.22 0.895",
                        AnchorMax = "0.78 0.945"
                                    //AnchorMin = "0.7 0.65",
                                    //AnchorMax =  "0.9 0.85"
                    }
                }
            };

            elements.Add(textElement);
            CuiHelper.AddUi(player, elements);
        }
示例#4
0
            public override bool CanStart()
            {
                //if (ForceStart)
                //    return true;

                int totalPlayers = 0;

                foreach (KeyValuePair <string, IemUtils.IIemTeam> team in Teams)
                {
                    if (team.Value.Players.Count < MinPlayersPerTeam)
                    {
                        IemUtils.DLog("too few players on team for Game MinPlayersPerTeam " + team.Value.Name);
                        return(false);
                    }

                    if (team.Value.Players.Count > MaxPlayersPerTeam)
                    {
                        IemUtils.DLog("too many players on team  Game MaxPlayersPerTeam" + team.Value.Name);
                        return(false);
                    }

                    if (team.Value.Players.Count < team.Value.MinPlayers)
                    {
                        IemUtils.DLog("too few players on team for Team MinPlayers " + team.Value.Name);
                        return(false);
                    }

                    if (team.Value.Players.Count > team.Value.MaxPlayers)
                    {
                        IemUtils.DLog("too many players on team Team MaxPlayers " + team.Value.Name);
                        return(false);
                    }

                    totalPlayers = totalPlayers + team.Value.Players.Count;
                }

                if (totalPlayers < MinPlayers)
                {
                    IemUtils.DLog("below min players");
                    return(false);
                }

                if (totalPlayers > MaxPlayers)
                {
                    IemUtils.DLog("above max players");
                    return(false);
                }


                return(base.CanStart());
            }
示例#5
0
 public IemTeam AddTeam(IemTeam team)
 {
     if (Teams.Count >= MaxTeams)
     {
         IemUtils.DLog("returning null");
         return(null);
     }
     if (!Teams.ContainsKey(team.GetGuid().ToString()))
     {
         Teams.Add(team.GetGuid().ToString(), team);
     }
     team.TeamGame = this;
     return(team);
 }
示例#6
0
 IemUtils.IIemTeam GetTeamFromZone(string ZoneID)
 {
     //IemUtils.DLog("team substring is " + ZoneID.Substring(10));
     foreach (var team in teamGame.Teams)
     {
         // IemUtils.DLog("checking team is " + team.Key);
         if (team.Key == ZoneID.Substring(10))
         {
             IemUtils.DLog("returning team is " + team.Value.Name);
             return(team.Value);
         }
     }
     return(null);
 }
示例#7
0
        public static Dictionary <string, GameManager> GetGameManagers()
        {
            IemUtils.DLog("listing game managers registered");

            return(gameManagers);
        }