Esempio n. 1
0
 public override int GetHashCode()
 {
     unchecked
     {
         int hash = 23;
         hash = hash * 37 + (Home != null ? Home.GetHashCode() : 0);
         hash = hash * 37 + (Away != null ? Away.GetHashCode() : 0);
         hash = hash * 37 + (ShortHome != null ? ShortHome.GetHashCode() : 0);
         hash = hash * 37 + (ShortAway != null ? ShortAway.GetHashCode() : 0);
         hash = hash * 37 + HomeScore.GetHashCode();
         hash = hash * 37 + AwayScore.GetHashCode();
         hash = hash * 37 + HomeFouls.GetHashCode();
         hash = hash * 37 + AwayFouls.GetHashCode();
         hash = hash * 37 + Period.GetHashCode();
         hash = hash * 37 + PeriodType.GetHashCode();
         hash = hash * 37 + IsTeamEdit.GetHashCode();
         hash = hash * 37 + IsEndGame.GetHashCode();
         hash = hash * 37 + HomeColor.GetHashCode();
         hash = hash * 37 + AwayColor.GetHashCode();
         hash = hash * 37 + (HomeLogo != null ? HomeLogo.GetHashCode() : 0);
         hash = hash * 37 + (AwayLogo != null ? AwayLogo.GetHashCode() : 0);
         hash = hash * 37 + (Configuration != null ? Configuration.GetHashCode() : 0);
         return(hash);
     }
 }
Esempio n. 2
0
        public void Dispose()
        {
            if (Name == null)
            {
                return;
            }

            Name.Dispose();
            Name = null;
            Away.Dispose();
            Away = null;
            Modes.Dispose();
            Modes = null;
            Network.Dispose();
            Network = null;
            RealName.Dispose();
            RealName = null;
            Identity.Dispose();
            Identity = null;
            _knownChannels.Clear();
            _knownChannels.Dispose();
            _knownChannels = null;
            _channels.Clear();
            _channels.Dispose();
            _channels = null;
        }
        private void CreateAwayFoulFile(object sender, RoutedEventArgs e)
        {
            StreamWriter Away;

            Away = File.CreateText("bbAway.Foul");
            Away.WriteLine("0");
            Away.Close();
        }
Esempio n. 4
0
 public double GetTeamScoreTotal(Team team)
 {
     if (Home.Equals(team))
     {
         return(HomeTotal);
     }
     if (Away.Equals(team))
     {
         return(AwayTotal);
     }
     return(0);
 }
        private void CreateFile(object sender, RoutedEventArgs e)
        {
            StreamWriter Home;
            StreamWriter Away;

            Home = File.CreateText("bbHome.Score");
            Home.WriteLine("0");
            Home.Close();
            Away = File.CreateText("bbAway.Score");
            Away.WriteLine("0");
            Away.Close();
        }
Esempio n. 6
0
        public async Task away([Remainder] string message)
        {
            var sb = new StringBuilder();

            try
            {
                var data    = new awaydata();
                var away    = new Away();
                var attempt = data.getAwayUser(Context.User.Username);
                if (!string.IsNullOrEmpty(attempt.User))
                {
                    away.Status  = attempt.Status;
                    away.Message = attempt.Message;
                    away.User    = attempt.User;
                }
                else
                {
                    away.User = Context.User.Username;
                }

                if (string.IsNullOrEmpty(message.ToString()))
                {
                    message = "No message set!";
                }
                if (Context.User.Username == away.User)
                {
                    if (away.Status)
                    {
                        sb.AppendLine($"You're already away, **{Context.User.Mention}**!");
                    }
                    else
                    {
                        sb.AppendLine($"Marking you as away, {Context.User.Mention}, with the message: {message.ToString()}");
                        away.ToggleAway();
                        away.SetMessage(message.ToString());
                        away.User = Context.User.Username;
                        var awayData = new awaydata();
                        awayData.setAwayUser(away);
                    }
                }
            }

            catch (Exception ex)
            {
                Console.WriteLine($"Away command error {ex.Message}");
                sb.AppendLine($"Sorry {Context.User.Mention}, something went wrong with the away command :(");
            }
            finally
            {
                await Context.Channel.SendMessageAsync(sb.ToString());
            }
        }
Esempio n. 7
0
        public async Task back()
        {
            var sb = new StringBuilder();

            try
            {
                var data    = new awaydata();
                var attempt = data.getAwayUser(Context.User.Username);
                var away    = new Away();
                if (!string.IsNullOrEmpty(attempt.User))
                {
                    away.Status  = attempt.Status;
                    away.Message = attempt.Message;
                    away.User    = attempt.User;
                }
                else
                {
                    away.User = Context.User.Username;
                }
                if (Context.User.Username == away.User)
                {
                    if (away.Status)
                    {
                        sb.AppendLine($"you're now set as back{Context.User.Mention}");
                        away.ToggleAway();
                        away.SetMessage(string.Empty);
                        var awaydata = new awaydata();
                        awaydata.setAwayUser(away);
                    }
                    else
                    {
                        sb.AppendLine($"you are not even away yet {Context.User.Mention}");
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine($"away commannd error {ex.Message}");
                sb.AppendLine($"sorry {Context.User.Mention} something went wrong with back command");
            }
            finally
            {
                await Context.Channel.SendMessageAsync(sb.ToString());
            }
        }
Esempio n. 8
0
        public new bool IsWinningTeam(Team team)
        {
            if (!team.Equals(Home) && !team.Equals(Away))
            {
                return(false);
            }

            if (Home.Equals(team))
            {
                return(HomeTotal > AwayTotal);
            }
            if (Away.Equals(team))
            {
                return(HomeTotal < AwayTotal);
            }

            return(false);
        }
Esempio n. 9
0
        public void Update(GameTime gt)
        {
            Home.SendInput(out ll, out rr);
            bd[0].Update(ll, GroundFriction);
            bd[1].Update(rr, GroundFriction);
            Away.SendInput(out ll, out rr);
            bd[2].Update(ll, GroundFriction);
            bd[3].Update(rr, GroundFriction);
            for (i = 0; i < CurrentBalls; i++)
            {
                bl[i].Update();                             //Update BallPosition
                for (int j = 0; j < 4; j++)
                {
                    BlBdColl(ref bl[i], bd[j].bounds);       //Check For Ball-Board Collision
                    BlBdColl(ref bl[i], bouncers[j]);        //Check Ball-Bouncer Collision
                }
                while (i < CurrentBalls && Inside(bl[i]))
                {
                    RemoveBall(i);
                }                                           //Remove if Outside Bounds
            }
            BdBncColl(0, 0);                                //Check Board-Bouncer Collision
            BdBncColl(0, 1);
            BdBncColl(1, 2);
            BdBncColl(1, 3);
            BdBncColl(2, 0);
            BdBncColl(2, 2);
            BdBncColl(3, 1);
            BdBncColl(3, 3);                                 //UpTo Here
            var k = Keyboard.GetState();

            if (k.IsKeyDown(Keys.Space))
            {
                AddBall();
            }
            if (k.IsKeyDown(Keys.X))
            {
                G.ThisGame.Exit();
            }
        }
Esempio n. 10
0
 internal void OnAway(Messages.Receive.v3.AwayMessage message) => Away?.Invoke(message);
Esempio n. 11
0
 public void ProcessAvailability()
 {
     Home.ReduceTimeUntilAvailable();
     Away.ReduceTimeUntilAvailable();
 }
Esempio n. 12
0
 public void MakeAllPlayersAvailable()
 {
     Home.MakeAllPlayersAvailable();
     Away.MakeAllPlayersAvailable();
 }