コード例 #1
0
        private static BasicRenderInformation GetTextForRoadNode(BoardTextDescriptorGeneralXml textDescriptor, ushort refID, int boardIdx, int secIdx, ref DynamicSpriteFont baseFont)
        {
            CacheRoadNodeItem data = WTSRoadNodesData.Instance.BoardsContainers[refID, boardIdx, secIdx];

            if (data == null)
            {
                return(null);
            }

            if (baseFont == null)
            {
                baseFont = FontServer.instance[WTSRoadNodesData.Instance.DefaultFont];
            }

            TextType targetType = textDescriptor.m_textType;

            switch (targetType)
            {
            case TextType.ParkOrDistrict: targetType = data.m_districtParkId > 0 ? TextType.Park : TextType.District; break;

            case TextType.DistrictOrPark: targetType = data.m_districtId == 0 && data.m_districtParkId > 0 ? TextType.Park : TextType.District; break;

            case TextType.Park:
                if (data.m_districtParkId == 0)
                {
                    return(null);
                }
                break;
            }
            switch (targetType)
            {
            case TextType.GameSprite: return(GetSpriteFromParameter(data.m_currentDescriptor.Descriptor.CachedProp, textDescriptor.m_spriteParam));

            case TextType.DistanceFromReference: return(WTSCacheSingleton.GetTextData($"{data.m_distanceRefKm}", textDescriptor.m_prefix, textDescriptor.m_suffix, baseFont, textDescriptor.m_overrideFont));

            case TextType.Fixed: return(WTSCacheSingleton.GetTextData(textDescriptor.m_fixedText ?? "", textDescriptor.m_prefix, textDescriptor.m_suffix, baseFont, textDescriptor.m_overrideFont));

            case TextType.StreetSuffix: return(GetFromCacheArray(textDescriptor, WTSCacheSingleton.instance.GetSegment(data.m_segmentId).StreetName, baseFont));

            case TextType.StreetNameComplete: return(GetFromCacheArray(textDescriptor, WTSCacheSingleton.instance.GetSegment(data.m_segmentId).FullStreetName, baseFont));

            case TextType.StreetPrefix: return(GetFromCacheArray(textDescriptor, WTSCacheSingleton.instance.GetSegment(data.m_segmentId).StreetQualifier, baseFont));

            case TextType.District: return(GetFromCacheArray(textDescriptor, WTSCacheSingleton.instance.GetDistrict(data.m_districtId).Name, baseFont));

            case TextType.Park: return(GetFromCacheArray(textDescriptor, WTSCacheSingleton.instance.GetPark(data.m_districtParkId).Name, baseFont));

            case TextType.PostalCode: return(GetFromCacheArray(textDescriptor, WTSCacheSingleton.instance.GetSegment(data.m_segmentId).PostalCode, baseFont));

            case TextType.CityName: return(GetFromCacheArray(textDescriptor, WTSCacheSingleton.instance.GetDistrict(0).Name, baseFont));

            default: return(null);
            }
            ;
        }
コード例 #2
0
        internal bool CalculateGroupData(ushort nodeID, int layer, ref int vertexCount, ref int triangleCount, ref int objectCount, ref RenderGroup.VertexArrays vertexArrays)
        {
            var result = false;

            for (int y = 0; y < Data.BoardsContainers.GetLength(1); y++)
            {
                for (int z = 0; z < Data.BoardsContainers.GetLength(2); z++)
                {
                    ref CacheRoadNodeItem item = ref Data.BoardsContainers[nodeID, y, z];
                    if (item?.m_renderPlate ?? false)
                    {
                        ref BoardInstanceRoadNodeXml targetDescriptor = ref item.m_currentDescriptor;
                        if (targetDescriptor?.Descriptor?.PropName == null)
                        {
                            continue;
                        }

                        WTSDynamicTextRenderingRules.GetColorForRule(nodeID, y, z, targetDescriptor.Descriptor, targetDescriptor, out bool rendered);
                        if (rendered && !(item.m_currentDescriptor.Descriptor?.CachedProp is null))
                        {
                            result = PropInstance.CalculateGroupData(item.m_currentDescriptor.Descriptor.CachedProp, layer, ref vertexCount, ref triangleCount, ref objectCount, ref vertexArrays);
                        }
                    }
                }