internal void WriteDisplayEntry(DisplayEntry displayEntry) { if (displayEntry.ValueType == DisplayEntryValueType.Property) { _writer.WriteElementString("PropertyName", displayEntry.Value); } else if (displayEntry.ValueType == DisplayEntryValueType.ScriptBlock) { _writer.WriteStartElement("ScriptBlock"); _writer.WriteValue(_exportScriptBlock ? displayEntry.Value : ";"); _writer.WriteEndElement(/*</ScriptBlock>*/); } }
internal void Advertise( string Text, Visibility Visibility, uint SoundToPlay, double DisplayTime, double MinimumDisplayTime ) { DisplayEntry Entry; Entry = new DisplayEntry(); Entry.Message = Text; Entry.Visibility = Visibility; Entry.SoundToPlay = SoundToPlay; Entry.DisplayTime = DisplayTime; Entry.MinimumDisplayTime = MinimumDisplayTime; DisplayFile.AddLast( Entry ); }
/// <summary> /// New from format table control data. /// </summary> internal Meta(DisplayEntry entry, TableControlColumnHeader header) // no checks, until it is internal { if (entry.ValueType == DisplayEntryValueType.Property) { _Property = entry.Value; } else { //! Perf: with no cache it takes 15% on scan for file system items. //+ 131122 PS V3 uses its own cache, let's do not care of V2. _Script = ScriptBlock.Create(entry.Value); } if (!string.IsNullOrEmpty(header.Label)) { _ColumnName = header.Label; } _Width = header.Width; Alignment = header.Alignment; }
public void Dispose() { DisplayFile.Clear(); ActualyDisplayedEntry = null; }
internal void Clear() { if( ActualyDisplayedEntry != null ) { GameEnv.GuiManager.RemoveFrame( Frame_Text ); ActualText = null; ActualyDisplayedEntry = null; } DisplayFile.Clear(); }
internal void Advertising_Actions( float FrameTime ) { Vector2 Size; bool Stop; if( ActualyDisplayedEntry == null ) { if( !Flag_Shown ) return; if( DisplayFile.First != null ) { ActualyDisplayedEntry = DisplayFile.First.Value; DisplayFile.RemoveFirst(); if( ActualyDisplayedEntry.SoundToPlay != 0 ) this.GameEnv.Sound.PlaySound( ActualyDisplayedEntry.SoundToPlay ); switch( ActualyDisplayedEntry.Visibility ) { default: break; case Visibility.VISIBILITY_HIGH: ActualText = ActualyDisplayedEntry.Message; Frame_Text.SetDisplayText( ActualText ); Frame_Text.Font = GameEnv.default_font; Frame_Text.FontSize = 2.0f / 40; Frame_Text.GetTextDisplaySize( out Size ); if( Size.X > 2.0f - 0.125f ) Size.X = 2.0f - 0.125f; Frame_Text.SetPosition( ( 2.0f - Size.X ) / 2.0f, ( 2.0f / 4.0f ) - ( Size.Y / 2.0f ) ); // Frame_Text.SetPosition( (2.0f - Size.X) / 2.0f , (2.0f / 2.5f) - (Size.Y / 2.0f) ); Frame_Text.SetSize( Size.X, Size.Y ); GameEnv.GuiManager.AddFrame( Frame_Text ); break; case Visibility.VISIBILITY_MEDIUM: ActualText = ActualyDisplayedEntry.Message; Frame_Text.SetDisplayText( ActualText ); Frame_Text.Font = GameEnv.default_font; Frame_Text.FontSize = 2.0f / 20; Frame_Text.GetTextDisplaySize( out Size ); if( Size.X > 2.0f - 0.125f ) Size.X = 2.0f - 0.125f; Frame_Text.SetPosition( ( 2.0f - Size.X ) / 2.0f, ( 2.0f / 4.0f ) - ( Size.Y / 2.0f ) ); Frame_Text.SetSize( Size.X, Size.Y ); GameEnv.GuiManager.AddFrame( Frame_Text ); break; case Visibility.VISIBILITY_MEDLOW: ActualText = ActualyDisplayedEntry.Message; Frame_Text.SetDisplayText( ActualText ); Frame_Text.Font = GameEnv.default_font; Frame_Text.FontSize = 2.0f / 20; Frame_Text.GetTextDisplaySize( out Size ); if( Size.X > 2.0f - 0.125f ) Size.X = 2.0f - 0.125f; Frame_Text.SetPosition( ( 2.0f - Size.X ) / 2.0f, ( 2.0f * 0.75f ) - ( Size.Y / 2.0f ) ); Frame_Text.SetSize( Size.X, Size.Y ); GameEnv.GuiManager.AddFrame( Frame_Text ); break; case Visibility.VISIBILITY_LOW: ActualText = ActualyDisplayedEntry.Message; Frame_Text.SetDisplayText( ActualText ); Frame_Text.Font = GameEnv.default_font; Frame_Text.FontSize = 2.0f / 30; Frame_Text.GetTextDisplaySize( out Size ); if( Size.X > 2.0f - 0.125f ) Size.X = 2.0f - 0.125f; Frame_Text.SetPosition( ( 2.0f - Size.X ) / 2.0f, ( 2.0f * 0.75f ) - ( Size.Y / 2.0f ) ); Frame_Text.SetSize( Size.X, Size.Y ); GameEnv.GuiManager.AddFrame( Frame_Text ); break; case Visibility.VISIBILITY_VERYLOW: ActualText = ActualyDisplayedEntry.Message; Frame_Text.SetDisplayText( ActualText ); Frame_Text.Font = GameEnv.default_font; Frame_Text.FontSize = 2.0f / 30; Frame_Text.GetTextDisplaySize( out Size ); if( Size.X > 2.0f - 0.125f ) Size.X = 2.0f - 0.125f; Frame_Text.SetPosition( ( 2.0f - Size.X ) / 2.0f, ( 2.0f * 0.95f ) - ( Size.Y / 2.0f ) ); Frame_Text.SetSize( Size.X, Size.Y ); GameEnv.GuiManager.AddFrame( Frame_Text ); break; case Visibility.VISIBILITY_VERYHARDTOREAD: ActualText = ActualyDisplayedEntry.Message; Frame_Text.SetDisplayText( ActualText ); Frame_Text.Font = GameEnv.default_font; Frame_Text.FontSize = 2.0f / 80; Frame_Text.GetTextDisplaySize( out Size ); if( Size.X > 2.0f - 0.125f ) Size.X = 2.0f - 0.125f; Frame_Text.SetPosition( ( 2.0f - Size.X ) / 2.0f, ( 2.0f * 0.95f ) - ( Size.Y / 2.0f ) ); Frame_Text.SetSize( Size.X, Size.Y ); GameEnv.GuiManager.AddFrame( Frame_Text ); break; } } } else { ActualyDisplayedEntry.DisplayTime -= FrameTime; ActualyDisplayedEntry.MinimumDisplayTime -= FrameTime; Stop = false; if( !Flag_Shown ) Stop = true; else if( ActualyDisplayedEntry.DisplayTime < 0.0 ) Stop = true; else if( ( ActualyDisplayedEntry.MinimumDisplayTime < 0.0 ) && DisplayFile.Count > 2 ) Stop = true; if( Stop ) { GameEnv.GuiManager.RemoveFrame( Frame_Text ); ActualText = null; ActualyDisplayedEntry = null; } } }