protected override YAMLMappingNode ExportYAMLRoot(IExportContainer container) { YAMLMappingNode node = base.ExportYAMLRoot(container); node.AddSerializedVersion(GetSerializedVersion(container.ExportVersion)); node.Add(TypeName, (int)Type); node.Add(ColorName, Color.ExportYAML(container)); node.Add(IntensityName, Intensity); node.Add(RangeName, Range); node.Add(SpotAngleName, SpotAngle); node.Add(CookieSizeName, CookieSize); node.Add(ShadowsName, Shadows.ExportYAML(container)); node.Add(CookieName, Cookie.ExportYAML(container)); node.Add(DrawHaloName, DrawHalo); node.Add(FlareName, Flare.ExportYAML(container)); node.Add(RenderModeName, (int)RenderMode); node.Add(CullingMaskName, CullingMask.ExportYAML(container)); node.Add(LightmappingName, (int)Lightmapping); node.Add(AreaSizeName, AreaSize.ExportYAML(container)); node.Add(BounceIntensityName, BounceIntensity); node.Add(ColorTemperatureName, ColorTemperature); node.Add(UseColorTemperatureName, UseColorTemperature); node.Add(ShadowRadiusName, 0); node.Add(ShadowAngleName, 0); return(node); }
protected override YAMLMappingNode ExportYAMLRoot(IExportContainer container) { #warning TODO: serialized version acording to read version (current 2017.3.0f3) YAMLMappingNode node = base.ExportYAMLRoot(container); node.AddSerializedVersion(GetSerializedVersion(container.Version)); node.Add("m_Type", (int)Type); node.Add("m_Color", Color.ExportYAML(container)); node.Add("m_Intensity", Intensity); node.Add("m_Range", Range); node.Add("m_SpotAngle", SpotAngle); node.Add("m_CookieSize", CookieSize); node.Add("m_Shadows", Shadows.ExportYAML(container)); node.Add("m_Cookie", Cookie.ExportYAML(container)); node.Add("m_DrawHalo", DrawHalo); node.Add("m_Flare", Flare.ExportYAML(container)); node.Add("m_RenderMode", (int)RenderMode); node.Add("m_CullingMask", CullingMask.ExportYAML(container)); node.Add("m_Lightmapping", (int)Lightmapping); node.Add("m_AreaSize", AreaSize.ExportYAML(container)); node.Add("m_BounceIntensity", BounceIntensity); node.Add("m_ColorTemperature", ColorTemperature); node.Add("m_UseColorTemperature", UseColorTemperature); #warning ??? node.Add("m_ShadowRadius", 0); node.Add("m_ShadowAngle", 0); return(node); }
public override bool Initialize(GameHost host) { tabletDriver = new TabletDriver { // for now let's keep things simple and always use absolute mode. // this will likely be a user setting in the future. OutputMode = new AbsoluteTabletMode(this) }; updateOutputArea(host.Window); host.Window.Resized += () => updateOutputArea(host.Window); AreaOffset.BindValueChanged(_ => updateInputArea()); AreaSize.BindValueChanged(_ => updateInputArea(), true); Rotation.BindValueChanged(_ => updateInputArea(), true); tabletDriver.TabletChanged += (sender, e) => updateInputArea(); tabletDriver.ReportReceived += (sender, report) => { switch (report) { case ITabletReport tabletReport: handleTabletReport(tabletReport); break; case IAuxReport auxiliaryReport: handleAuxiliaryReport(auxiliaryReport); break; } }; Enabled.BindValueChanged(d => { if (d.NewValue) { if (tabletDriver.Tablet == null) { tabletDriver.DetectTablet(); } } tabletDriver.EnableInput = d.NewValue; }, true); return(true); }
protected override YAMLMappingNode ExportYAMLRoot(IExportContainer container) { YAMLMappingNode node = base.ExportYAMLRoot(container); node.AddSerializedVersion(ToSerializedVersion(container.ExportVersion)); node.Add(TypeName, (int)Type); if (HasShape(container.ExportVersion)) { node.Add(ShapeName, (int)Shape); } node.Add(ColorName, Color.ExportYAML(container)); node.Add(IntensityName, Intensity); node.Add(RangeName, Range); node.Add(SpotAngleName, SpotAngle); if (HasInnerSpotAngle(container.ExportVersion)) { node.Add(InnerSpotAngleName, InnerSpotAngle); } node.Add(CookieSizeName, CookieSize); node.Add(ShadowsName, Shadows.ExportYAML(container)); node.Add(CookieName, Cookie.ExportYAML(container)); node.Add(DrawHaloName, DrawHalo); if (HasBakingOutput(container.ExportVersion, container.ExportFlags)) { node.Add(BakingOutputName, BakingOutput.ExportYAML(container)); } node.Add(FlareName, Flare.ExportYAML(container)); node.Add(RenderModeName, (int)RenderMode); node.Add(CullingMaskName, CullingMask.ExportYAML(container)); if (HasRenderingLayerMask(container.ExportVersion)) { node.Add(RenderingLayerMaskName, RenderingLayerMask); } node.Add(LightmappingName, (int)Lightmapping); node.Add(AreaSizeName, AreaSize.ExportYAML(container)); node.Add(BounceIntensityName, BounceIntensity); node.Add(ColorTemperatureName, ColorTemperature); node.Add(UseColorTemperatureName, UseColorTemperature); if (HasBoundingSphereOverride(container.ExportVersion)) { node.Add(BoundingSphereOverrideName, BoundingSphereOverride.ExportYAML(container)); node.Add(UseBoundingSphereOverrideName, UseBoundingSphereOverride); } node.Add(ShadowRadiusName, GetShadowRadius(container.Version, container.Flags)); node.Add(ShadowAngleName, GetShadowAngle(container.Version, container.Flags)); return(node); }
private void updateInputArea([CanBeNull] InputDeviceTree inputDevice) { if (inputDevice == null) { return; } var digitizer = inputDevice.Properties.Specifications.Digitizer; float inputWidth = digitizer.Width; float inputHeight = digitizer.Height; AreaSize.Default = new Vector2(inputWidth, inputHeight); // if it's clear the user has not configured the area, take the full area from the tablet that was just found. if (AreaSize.Value == Vector2.Zero) { AreaSize.SetDefault(); } AreaOffset.Default = new Vector2(inputWidth / 2, inputHeight / 2); // likewise with the position, use the centre point if it has not been configured. // it's safe to assume no user would set their centre point to 0,0 for now. if (AreaOffset.Value == Vector2.Zero) { AreaOffset.SetDefault(); } tablet.Value = new TabletInfo(inputDevice.Properties.Name, AreaSize.Default); switch (inputDevice.OutputMode) { case AbsoluteOutputMode absoluteOutputMode: { // Set input area in millimeters absoluteOutputMode.Input = new Area { Width = AreaSize.Value.X, Height = AreaSize.Value.Y, Position = new System.Numerics.Vector2(AreaOffset.Value.X, AreaOffset.Value.Y), Rotation = Rotation.Value }; break; } } }
public void SetTabletSize(Vector2 size) { tablet.Value = size != Vector2.Zero ? new TabletInfo($"test tablet T-{RNG.Next(999):000}", size) : null; AreaSize.Default = new Vector2(size.X, size.Y); // if it's clear the user has not configured the area, take the full area from the tablet that was just found. if (AreaSize.Value == Vector2.Zero) { AreaSize.SetDefault(); } AreaOffset.Default = new Vector2(size.X / 2, size.Y / 2); // likewise with the position, use the centre point if it has not been configured. // it's safe to assume no user would set their centre point to 0,0 for now. if (AreaOffset.Value == Vector2.Zero) { AreaOffset.SetDefault(); } }
public override bool Initialize(GameHost host) { outputMode = new AbsoluteTabletMode(this); host.Window.Resized += () => updateOutputArea(host.Window); AreaOffset.BindValueChanged(_ => updateInputArea(device)); AreaSize.BindValueChanged(_ => updateInputArea(device), true); Rotation.BindValueChanged(_ => updateInputArea(device), true); Enabled.BindValueChanged(d => { if (d.NewValue && tabletDriver == null) { tabletDriver = TabletDriver.Create(); tabletDriver.TabletsChanged += (s, e) => { device = e.Any() ? tabletDriver.InputDevices.First() : null; if (device != null) { device.OutputMode = outputMode; outputMode.Tablet = device.CreateReference(); updateInputArea(device); updateOutputArea(host.Window); } }; tabletDriver.DeviceReported += handleDeviceReported; tabletDriver.Detect(); } else if (!d.NewValue && tabletDriver != null) { tabletDriver.Dispose(); tabletDriver = null; } }, true); return(true); }
public override void Read(AssetReader reader) { base.Read(reader); Type = (LightType)reader.ReadInt32(); Color.Read(reader); if (IsReadAttenuate(reader.Version)) { Attenuate = reader.ReadBoolean(); if (IsAlign(reader.Version)) { reader.AlignStream(AlignType.Align4); } } if (IsReadIntensity(reader.Version)) { Intensity = reader.ReadSingle(); } Range = reader.ReadSingle(); SpotAngle = reader.ReadSingle(); if (IsReadCookieSize(reader.Version)) { CookieSize = reader.ReadSingle(); } if (IsReadShadows(reader.Version)) { Shadows.Read(reader); } Cookie.Read(reader); DrawHalo = reader.ReadBoolean(); if (IsReadActuallyLightmapped(reader.Version)) { ActuallyLightmapped = reader.ReadBoolean(); } if (IsAlign(reader.Version)) { reader.AlignStream(AlignType.Align4); } if (IsReadBakedIndex(reader.Version)) { BakedIndex = reader.ReadInt32(); } if (IsReadBakingOutput(reader.Version)) { BakingOutput.Read(reader); } Flare.Read(reader); RenderMode = (LightRenderMode)reader.ReadInt32(); if (IsReadCullingMask(reader.Version)) { CullingMask.Read(reader); } if (IsReadLightmapping(reader.Version)) { Lightmapping = (LightmappingMode)reader.ReadInt32(); } if (IsReadLightShadowCasterMode(reader.Version)) { LightShadowCasterMode = (LightShadowCasterMode)reader.ReadInt32(); } if (IsReadAreaSize(reader.Version)) { AreaSize.Read(reader); } if (IsReadBounceIntensity(reader.Version)) { BounceIntensity = reader.ReadSingle(); } if (IsReadFalloffTable(reader.Version)) { FalloffTable.Read(reader); } if (IsReadColorTemperature(reader.Version)) { ColorTemperature = reader.ReadSingle(); UseColorTemperature = reader.ReadBoolean(); reader.AlignStream(AlignType.Align4); } }
public override void Read(AssetReader reader) { base.Read(reader); Type = (LightType)reader.ReadInt32(); if (HasShape(reader.Version)) { Shape = (LightShape)reader.ReadInt32(); } Color.Read(reader); if (HasAttenuate(reader.Version)) { Attenuate = reader.ReadBoolean(); if (IsAlign(reader.Version)) { reader.AlignStream(); } } if (HasIntensity(reader.Version)) { Intensity = reader.ReadSingle(); } Range = reader.ReadSingle(); SpotAngle = reader.ReadSingle(); if (HasInnerSpotAngle(reader.Version)) { InnerSpotAngle = reader.ReadSingle(); } if (HasCookieSize(reader.Version)) { CookieSize = reader.ReadSingle(); } if (HasShadows(reader.Version)) { Shadows.Read(reader); } Cookie.Read(reader); DrawHalo = reader.ReadBoolean(); if (HasActuallyLightmapped(reader.Version)) { ActuallyLightmapped = reader.ReadBoolean(); } if (IsAlign(reader.Version)) { reader.AlignStream(); } if (HasBakedIndex(reader.Version)) { BakedIndex = reader.ReadInt32(); } if (HasBakingOutput(reader.Version, reader.Flags)) { BakingOutput.Read(reader); } Flare.Read(reader); RenderMode = (LightRenderMode)reader.ReadInt32(); if (HasCullingMask(reader.Version)) { CullingMask.Read(reader); } if (HasRenderingLayerMask(reader.Version)) { RenderingLayerMask = reader.ReadInt32(); } if (HasLightmapping(reader.Version)) { Lightmapping = (LightmappingMode)reader.ReadInt32(); } if (HasLightShadowCasterMode(reader.Version)) { LightShadowCasterMode = (LightShadowCasterMode)reader.ReadInt32(); } if (HasAreaSize(reader.Version)) { AreaSize.Read(reader); } if (HasBounceIntensity(reader.Version)) { BounceIntensity = reader.ReadSingle(); } if (HasFalloffTable(reader.Version)) { FalloffTable.Read(reader); } if (HasColorTemperature(reader.Version)) { ColorTemperature = reader.ReadSingle(); } if (HasUseColorTemperature(reader.Version)) { UseColorTemperature = reader.ReadBoolean(); reader.AlignStream(); } if (HasBoundingSphereOverride(reader.Version)) { BoundingSphereOverride.Read(reader); UseBoundingSphereOverride = reader.ReadBoolean(); reader.AlignStream(); } #if UNIVERSAL if (HasShadowRadius(reader.Version, reader.Flags)) { ShadowRadius = reader.ReadSingle(); ShadowAngle = reader.ReadSingle(); } #endif }
public override void Read(AssetStream stream) { base.Read(stream); Type = (LightType)stream.ReadInt32(); Color.Read(stream); if (IsReadAttenuate(stream.Version)) { Attenuate = stream.ReadBoolean(); if (IsAlign(stream.Version)) { stream.AlignStream(AlignType.Align4); } } if (IsReadIntensity(stream.Version)) { Intensity = stream.ReadSingle(); } Range = stream.ReadSingle(); SpotAngle = stream.ReadSingle(); if (IsReadCookieSize(stream.Version)) { CookieSize = stream.ReadSingle(); } if (IsReadShadows(stream.Version)) { Shadows.Read(stream); } Cookie.Read(stream); DrawHalo = stream.ReadBoolean(); if (IsReadActuallyLightmapped(stream.Version)) { ActuallyLightmapped = stream.ReadBoolean(); } if (IsAlign(stream.Version)) { stream.AlignStream(AlignType.Align4); } if (IsReadBakedIndex(stream.Version)) { BakedIndex = stream.ReadInt32(); } if (IsReadBakingOutput(stream.Version)) { BakingOutput.Read(stream); } Flare.Read(stream); RenderMode = (LightRenderMode)stream.ReadInt32(); if (IsReadCullingMask(stream.Version)) { CullingMask.Read(stream); } if (IsReadLightmapping(stream.Version)) { Lightmapping = (LightmappingMode)stream.ReadInt32(); } if (IsReadAreaSize(stream.Version)) { AreaSize.Read(stream); } if (IsReadBounceIntensity(stream.Version)) { BounceIntensity = stream.ReadSingle(); } if (IsReadColorTemperature(stream.Version)) { ColorTemperature = stream.ReadSingle(); UseColorTemperature = stream.ReadBoolean(); stream.AlignStream(AlignType.Align4); } }
private void InitializeBoard(AreaSize areaSize) { this.game.CreateBoard(areaSize); this.DrawInitialBoard(); this.Steps = 0; }
public ConcreteArea(IAreaPrinter printer, Position startPosition, AreaSize size) : base(printer) { StartPosition = startPosition; Size = size; }
public IAreaBuilder SetAreaSize(AreaSize areaSize) { _size = areaSize; return(this); }