Exemplo n.º 1
0
        public void Initialise()
        {
            Name = NameOffset + Id;

            var localId     = _identityCalculator.GetSponsorId(Id) - 1;
            var localTypeId = _identityCalculator.GetSponsorTypeId(Id);

            // Initialise Entity fields
            var entityCalculatedOffset = EntityBaseOffset + EntityLocalOffset * Id;

            EntityTypeValue     = entityCalculatedOffset + EntityTypeValueOffset;
            EntityResourceValue = entityCalculatedOffset + EntityResourceValueOffset;
            EntityDataValue     = entityCalculatedOffset + EntityDataValueOffset;

            switch (localTypeId)
            {
            case 1:     // Team Sponsor
            case 5:     // Cash Sponsor
                InitialiseCashRatingFields(localId, localTypeId);
                InitialiseContractFields(localId, localTypeId);
                break;

            case 2:     // Engine Supplier
            case 3:     // Tyre Supplier
            case 4:     // Fuel Supplier
                InitialiseCashRatingFields(localId, localTypeId);
                InitialiseRadRatingFields(localId, localTypeId);
                InitialiseInactiveFields(localId, localTypeId);
                InitialiseContractFields(localId, localTypeId);
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(localTypeId));
            }

            switch (localTypeId)
            {
            case 1:     // Team Sponsor
                break;

            case 2:     // Engine Supplier
                InitialiseEngineAttributeFields(localId);
                break;

            case 3:     // Tyre Supplier
                InitialiseTyreAttributeFields(localId);
                break;

            case 4:     // Fuel Supplier
                InitialiseFuelAttributeFields(localId);
                break;

            case 5:     // Cash Sponsor
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(localTypeId));
            }
        }
        private void ImportEntityValues(SponsorDataEntity dataEntity, SponsorDataLocator dataLocator)
        {
            ImportLanguageCatalogueValue(_dataEndpoint, dataEntity.Name, dataLocator.Name);

            dataEntity.SponsorId     = _identityCalculator.GetSponsorId(dataEntity.Id);
            dataEntity.SponsorTypeId = _identityCalculator.GetSponsorTypeId(dataEntity.Id);

            dataEntity.EntityTypeId   = _dataEndpoint.GameExecutableFileResource.ReadByte(dataLocator.EntityTypeValue);
            dataEntity.EntityResource = _dataEndpoint.GameExecutableFileResource.ReadInteger(dataLocator.EntityResourceValue);
            dataEntity.EntityData     = _dataEndpoint.GameExecutableFileResource.ReadInteger(dataLocator.EntityDataValue);
        }