private void updateFabric(Texture2D texture2D, FabricState fabricType) { if (texture2D == null) { currentFabricState = FabricState.NO_FABRIC; texture2D = _defaultTexture; } else { currentFabricState = fabricType; } fabricLayer.Decal = texture2D; CustomizationContext.EventBus.DispatchEvent(new CustomizerModelEvents.DecalChangedEvent(fabricLayer.Decal, this, fabricLayer)); _canRotateAndScaleFabric = true; if (texture2D != null) { bool value = false; if (_fabricNameToInteractable != null && _fabricNameToInteractable.TryGetValue(texture2D.name, out value)) { _canRotateAndScaleFabric = value; } } if (texture2D != null) { fabricLayer.Tint = Color.white; CustomizationContext.EventBus.DispatchEvent(new CustomizerModelEvents.DecalTintChangedEvent(fabricLayer.Tint, this, fabricLayer)); } }
public DCustomizationChannel(ChannelMask channelColor) { customizationOptions = new Dictionary <CustomizationOption, bool>(); customizationOptions[CustomizationOption.FABRIC] = false; customizationOptions[CustomizationOption.DECAL] = false; channelName = channelColor.ToString(); channelMask = channelColor; currentFabricState = FabricState.NO_FABRIC; fabricLayer = new DCustomizerLayer(); fabricLayer.Type = DecalType.FABRIC; fabricLayer.Scale = DEFAULT_SCALE; fabricLayer.IsTiled = true; currentDecalState = DecalState.NO_DECAL; decalLayer = new DCustomizerLayer(); decalLayer.Type = DecalType.DECAL; decalLayer.Scale = DEFAULT_SCALE_DECAL; decalLayer.IsTiled = false; DecalRenderer = null; switch (channelMask) { case ChannelMask.RED: fabricLayer.ShaderChannel = DecalColorChannel.RED_1; decalLayer.ShaderChannel = DecalColorChannel.RED_4; break; case ChannelMask.GREEN: fabricLayer.ShaderChannel = DecalColorChannel.GREEN_2; decalLayer.ShaderChannel = DecalColorChannel.GREEN_5; break; case ChannelMask.BLUE: fabricLayer.ShaderChannel = DecalColorChannel.BLUE_3; decalLayer.ShaderChannel = DecalColorChannel.BLUE_6; break; } }