コード例 #1
0
 public void SetChecked(Weapon.WeaponId weaponId, bool isChecked)
 {
     if (toggleButtons.ContainsKey(weaponId))
     {
         toggleButtons[weaponId].IsChecked = isChecked;
     }
 }
コード例 #2
0
 public bool?IsChecked(Weapon.WeaponId weaponId)
 {
     if (toggleButtons.ContainsKey(weaponId))
     {
         return(toggleButtons[weaponId].IsChecked);
     }
     return(null);
 }
コード例 #3
0
ファイル: Game.cs プロジェクト: SciLor/MashedTrainer
        private void RandomWeaponEquip()
        {
            RandomWeaponSettings rws = Settings.RandomWeaponSettings;

            if (!rws.IsEnabled)
            {
                return;
            }

            List <Weapon.WeaponId> weapons = rws.WeaponSelector.GetEnabledWeapons();

            if (weapons.Count == 0)
            {
                return;
            }

            if (DateTime.Now.Subtract(rws.NextRandomWeaponTimeStamp).TotalMilliseconds > 0)
            {
                Weapon.WeaponId nextWeapon = weapons[StaticRandom.Random.Next(weapons.Count)];
                foreach (Player player in Players.Where(p => p.IsAlive))
                {
                    if (player.IsBot && rws.IsSkipBots)
                    {
                        continue;
                    }

                    if (!rws.IsSameWeaponForAll)
                    {
                        nextWeapon = weapons[StaticRandom.Random.Next(weapons.Count)];
                    }

                    if (rws.IsDropPreviousWeapon || player.Weapon.GetActiveWeaponId() == WeaponId.None)
                    {
                        player.EquipWeapon(nextWeapon);
                    }
                }

                rws.NextRandomWeaponTimeStamp = DateTime.Now.AddSeconds(StaticRandom.Random.Next(
                                                                            Math.Min(rws.MinimalTimeInS, rws.MaximalTimeInS),
                                                                            Math.Max(rws.MinimalTimeInS, rws.MaximalTimeInS)
                                                                            ));
            }
        }