コード例 #1
0
ファイル: Builder.cs プロジェクト: kenwilcox/x937
        public static X9Record GetObjectFor(XRecord record)
        {
            X9Record ret;

            switch (record.TypeId)
            {
            case "01": ret = new R01(); break;

            case "10": ret = new R10(); break;

            case "20": ret = new R20(); break;

            case "25": ret = new R25(); break;

            case "26": ret = new R26(); break;

            case "50": ret = new R50(); break;

            case "52": ret = new R52(); break;

            case "61": ret = new R61(); break;

            case "70": ret = new R70(); break;

            case "90": ret = new R90(); break;

            case "99": ret = new R99(); break;

            default: ret = new Unknown(); break;
            }
            return(ret);
        }
コード例 #2
0
        public R99RecordTests()
        {
            var record = new XRecord("FileControlRecord", "99");
            var meta   = Builder.GetMeta()[record];

            _data = Builder.GetTestStringFor(meta);
            _sut  = new R99();
            _sut.SetData(_data);
        }
コード例 #3
0
        private static IWeapon CreateFromRecognizedString(string recognizedName, IWeapon currentWeapon, int offsetX, int offsetY, float sensitivityScale)
        {
            var weaponName = recognizedName.FindMostSimilar(WeaponNamesToTypes.Keys);

            WeaponNamesToTypes.TryGetValue(weaponName, out var weaponType);

            var     inGameName = weaponType.GetWeaponName();
            IWeapon result;

            if (currentWeapon?.IsTheSameWeapon(inGameName) ?? weaponType == WeaponAL.Unknown)
            {
                return(currentWeapon);
            }

            var numOfMods = WeaponTypesToNumOfMods[weaponType];

            switch (weaponType)
            {
            case WeaponAL.Wingman:
            case WeaponAL.MASTIFF:
            case WeaponAL.KRABER:
            case WeaponAL.Longbow:
            case WeaponAL.Peacekeeper:
            case WeaponAL.TripleTake:
                result = new NonAdjustableWeapon(inGameName, 0, recognizedName, numOfMods);
                break;

            case WeaponAL.Havoc:
                result = new Havoc(inGameName, 2, recognizedName, numOfMods);
                break;

            case WeaponAL.Devotion:
                result = new Devotion(inGameName, 2, recognizedName, numOfMods);
                break;

            case WeaponAL.LStar:
                result = new LStar(inGameName, 2, recognizedName, numOfMods);
                break;

            case WeaponAL.Flatline:
                result = new Flatline(inGameName, 2, recognizedName, numOfMods);
                break;

            case WeaponAL.Hemlok:
                result = new Hemlok(inGameName, 2, recognizedName, numOfMods);
                break;

            case WeaponAL.Prowler:
                result = new Prowler(inGameName, 2, recognizedName, numOfMods);
                break;

            case WeaponAL.RE45:
                result = new RE45(inGameName, 2, recognizedName, numOfMods);
                break;

            case WeaponAL.R301:
                result = new R301(inGameName, 2, recognizedName, numOfMods);
                break;

            case WeaponAL.R99:
                result = new R99(inGameName, 1.5, recognizedName, numOfMods);
                break;

            case WeaponAL.Alternator:
                result = new Alternator(inGameName, 2, recognizedName, numOfMods);
                break;

            case WeaponAL.G7Scout:
                result = new G7Scout(inGameName, 2, recognizedName, numOfMods);
                break;

            case WeaponAL.Unknown:
            case WeaponAL.Spitfire:
            case WeaponAL.EVA8Auto:
            case WeaponAL.Mozambique:
            case WeaponAL.P2020:
                result = new RegularAdjustmentWeapon(inGameName, 2, recognizedName, numOfMods);
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }


            result.SetOffsets(offsetX, offsetY);
            result.SetSensitivityScale(sensitivityScale);
            return(result);
        }