示例#1
0
        private void ChangeWeapon(int direction)
        {
            var wlist  = EnumUtils.EnumToList <WeaponType>();
            var cIndex = _weaponIndex + direction;

            if (cIndex >= wlist.Count)
            {
                cIndex = wlist.Count - 1;
                return;
            }
            else if (cIndex < 1)
            {
                cIndex = 1;
                return;
            }

            _isBlockClick = true;

            if (CheckApruveWeapon(wlist[cIndex]))
            {
                _weaponIndex             = cIndex;
                _gameModel.Weapons.Value = wlist[cIndex];

                _delayService.DelayedCall(0.5f, () => { _isBlockClick = false; });

                _soundManager.PlaySFX(SoundDataConfig.CHANGE_WEAPON);

                return;
            }

            _isBlockClick = false;
        }
示例#2
0
        private static void EnumToList()
        {
            Console.Clear();
            Console.WriteLine("\t\t--------------- EnumToList ---------------");

            var weekdays = EnumUtils.EnumToList <EnumDayOfWeek>().ToList();

            foreach (var item in weekdays)
            {
                Console.WriteLine($"\t\tName:{item}");
            }
            Console.ReadKey();
            RecarregarMenu();
        }
        public ICollection <HostType> GetSupported()
        {
            var results = new Collection <HostType>();

            foreach (var hostType in EnumUtils.EnumToList <HostType>())
            {
                try {
                    this.passwordChangerFactory.Create(hostType);
                    results.Add(hostType);
                }
                catch (NotSupportedException) {
                }
            }
            return(results);
        }
示例#4
0
        private void FillItems(Type enumType)
        {
            List <KeyValuePair <object, string> > values = new List <KeyValuePair <object, string> >();

            foreach (var idx in EnumUtils.EnumToList(enumType))
            {
                values.Add(new KeyValuePair <object, string>(idx.Item1, idx.Item2));
            }

            this.ItemsSource = values.Select(o => o.Key.ToString()).ToList();

            UpdateLayout();
            this.ItemsSource       = values;
            this.DisplayMemberPath = "Value";
            this.SelectedValuePath = "Key";
        }