Beispiel #1
0
        public override AdrHighwayParameters GetHighwayTypeData(string layoutName)
        {
            var result = new AdrHighwayParameters
            {
                hwIdentifier = "XXX"
            };

            return(AdrFacade.GetHighwayTypeParameters(layoutName, out result.detachedStr, out result.shortCode, out result.longCode)
                ? result
                : null);
        }
Beispiel #2
0
        public override AdrHighwayParameters GetHighwayData(ushort seedId)
        {
            var result = new AdrHighwayParameters();

            if (AdrFacade.GetSeedHighwayParameters(seedId, out result.layoutName, out result.detachedStr, out result.hwIdentifier, out result.shortCode, out result.longCode, out result.hwColor))
            {
                AdrFacade.GetMileageSeedConfig(seedId, out result.mileageOffset, out int src, out int axis);
                result.mileageSrc = (SegmentUtils.MileageStartSource)src;
                result.axis       = (SegmentUtils.MileageStartSource)axis;
                return(result);
            }
            else
            {
                return(null);
            }
        }
Beispiel #3
0
        private static IEnumerator <Texture2D> RenderHighwayShield(DynamicSpriteFont defaultFont, HighwayShieldDescriptor descriptor, AdrHighwayParameters parameters)
        {
            if (defaultFont is null)
            {
                defaultFont = FontServer.instance[WTSEtcData.Instance.FontSettings.GetTargetFont(FontClass.HighwayShields)];
            }

            UITextureAtlas.SpriteInfo spriteInfo = descriptor.BackgroundImageParameter.GetCurrentSpriteInfo(null);
            if (spriteInfo is null)
            {
                LogUtils.DoWarnLog("HW: Background info is invalid for hw shield descriptor " + descriptor.SaveName);
                yield break;
            }
            else
            {
                int shieldHeight  = WTSAtlasLoadingUtils.MAX_SIZE_IMAGE_IMPORT;
                int shieldWidth   = WTSAtlasLoadingUtils.MAX_SIZE_IMAGE_IMPORT;
                var shieldTexture = new Texture2D(spriteInfo.texture.width, spriteInfo.texture.height);
                var targetColor   = descriptor.BackgroundColorIsFromHighway && parameters.hwColor != default ? parameters.hwColor : descriptor.BackgroundColor;
                shieldTexture.SetPixels(spriteInfo.texture.GetPixels().Select(x => x.MultiplyChannelsButAlpha(targetColor)).ToArray());
                TextureScaler.scale(shieldTexture, shieldWidth, shieldHeight);
                Color[] formTexturePixels = shieldTexture.GetPixels();

                foreach (var textDescriptor in descriptor.TextDescriptors)
                {
                    if (!textDescriptor.GetTargetText(parameters, out string text))
                    {
                        continue;
                    }

                    Texture2D overlayTexture;
                    if (text is null && textDescriptor.m_textType == TextType.GameSprite)
                    {
                        var spriteTexture = textDescriptor.m_spriteParam?.GetCurrentSpriteInfo(null)?.texture;
                        if (spriteTexture is null)
                        {
                            continue;
                        }
                        overlayTexture = new Texture2D(spriteTexture.width, spriteTexture.height);
                        overlayTexture.SetPixels(spriteTexture.GetPixels());
                        overlayTexture.Apply();
                    }