Esempio n. 1
0
        private void RenderDescriptor(ref Vehicle v, RenderManager.CameraInfo cameraInfo, ushort vehicleId, Vector3 position, Matrix4x4 vehicleMatrix, ref LayoutDescriptorVehicleXml targetDescriptor)
        {
            var instance = VehicleManager.instance;

            for (int j = 0; j < targetDescriptor.TextDescriptors.Length; j++)
            {
                ref BoardTextDescriptorGeneralXml descriptor = ref targetDescriptor.TextDescriptors[j];
                if (descriptor != null && cameraInfo.CheckRenderDistance(position, 200 * descriptor.m_textScale * (descriptor.IlluminationConfig?.IlluminationType == FontStashSharp.MaterialType.OPAQUE ? 1 : 2)))
                {
                    MaterialPropertyBlock properties = instance.m_materialBlock;
                    properties.Clear();
                    var flags = v.m_flags;
                    if ((flags & Vehicle.Flags.Inverted) != 0)
                    {
                        flags ^= Vehicle.Flags.Reversed;
                    }
                    ref Vehicle vehicle = ref instance.m_vehicles.m_buffer[vehicleId];
                    WTSDynamicTextRenderingRules.RenderTextMesh(vehicleId, 0, 0, targetDescriptor, vehicleMatrix, null, ref targetDescriptor.TextDescriptors[j], properties, (int)flags, vehicle.Info.m_vehicleAI.GetColor(vehicleId, ref vehicle, InfoManager.InfoMode.None), v.Info, ref VehicleManager.instance.m_drawCallData.m_batchedCalls);
                }
Esempio n. 2
0
        internal static void GetTargetDescriptor(string vehicle, out ConfigurationSource source, out LayoutDescriptorVehicleXml target)
        {
            if (vehicle == null)
            {
                source = ConfigurationSource.NONE;
                target = null;
                return;
            }

            if (WTSVehicleData.Instance.CityDescriptors.ContainsKey(vehicle))
            {
                source = ConfigurationSource.CITY;
                target = WTSVehicleData.Instance.CityDescriptors[vehicle];
                return;
            }

            if (WTSVehicleData.Instance.GlobalDescriptors.ContainsKey(vehicle))
            {
                source = ConfigurationSource.GLOBAL;
                target = WTSVehicleData.Instance.GlobalDescriptors[vehicle];
                return;
            }

            if (WTSVehicleData.Instance.AssetsDescriptors.ContainsKey(vehicle))
            {
                source = ConfigurationSource.ASSET;
                target = WTSVehicleData.Instance.AssetsDescriptors[vehicle];
                return;
            }

            source = ConfigurationSource.NONE;
            target = null;
        }