C# Класс SadConsole.Consoles.SurfaceEditor

Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
TimesShiftedDown int
TimesShiftedLeft int
TimesShiftedRight int
TimesShiftedUp int
UsePrintProcessor bool

Защищенные свойства (Protected)

Свойство Тип Описание
textSurface ITextSurface

Private Properties

Свойство Тип Описание
PrintNoCheck void

Открытые методы

Метод Описание
Clear ( ) : void

Clears the console data. Characters are reset to 0, the forground and background are set to default, and effect set to none.

Clear ( int x, int y ) : void

Clears a cell. Character is reset to 0, the forground and background is set to default, and effect is set to none.

ClearShiftValues ( ) : void
Fill ( Microsoft.Xna.Framework.Color foreground, Microsoft.Xna.Framework.Color background, int glyph, Microsoft.Xna.Framework.Graphics.SpriteEffects spriteEffect = null ) : Cell[]

Fills the console.

Fill ( Microsoft.Xna.Framework.Rectangle area, Microsoft.Xna.Framework.Color foreground, Microsoft.Xna.Framework.Color background, int glyph, Microsoft.Xna.Framework.Graphics.SpriteEffects spriteEffect = null ) : Cell[]

Fills the specified area.

FillWithRandomGarbage ( bool useEffect = false ) : void

Fills a console with random colors and glyphs.

GetBackground ( int x, int y ) : Microsoft.Xna.Framework.Color

Gets the background of a specified cell.

GetCellAppearance ( int x, int y ) : ICellAppearance

Gets the appearance of a cell.

GetEffect ( int x, int y ) : Effects.ICellEffect

Gets the effect of the specified cell.

GetForeground ( int x, int y ) : Microsoft.Xna.Framework.Color

Gets the foreground of a specified cell.

GetGlyph ( int x, int y ) : int

Gets the glyph of a specified cell.

GetSpriteEffect ( int x, int y ) : Microsoft.Xna.Framework.Graphics.SpriteEffects

Gets the sprite effect of a specified cell.

GetString ( int index, int length ) : string

Builds a string from the text surface.

GetString ( int x, int y, int length ) : string

Builds a string from the text surface from the specified coordinates.

GetStringColored ( int index, int length ) : ColoredString

Builds a string from the text surface.

GetStringColored ( int x, int y, int length ) : ColoredString

Builds a string from the text surface from the specified coordinates.

IsValidCell ( int index ) : bool

Tests if a cell is valid based on its index.

IsValidCell ( int x, int y ) : bool

Tests if a cell is valid based on its x,y position.

IsValidCell ( int x, int y, int &index ) : bool

Tests if a cell is valid based on its x,y position.

Print ( int x, int y, ColoredString text ) : void

Draws the string on the console at the specified location, wrapping if needed.

Print ( int x, int y, string text ) : void

Draws the string on the console at the specified location, wrapping if needed.

Print ( int x, int y, string text, ICellAppearance appearance, ICellEffect effect = null ) : void

Draws the string on the console at the specified location, wrapping if needed.

Print ( int x, int y, string text, Microsoft.Xna.Framework.Color foreground ) : void

Draws the string on the console at the specified location and color, wrapping if needed.

Print ( int x, int y, string text, Microsoft.Xna.Framework.Color foreground, Microsoft.Xna.Framework.Color background ) : void

Draws the string on the console at the specified location with the specified foreground and background color, wrapping if needed.

Print ( int x, int y, string text, Microsoft.Xna.Framework.Color foreground = null, Microsoft.Xna.Framework.Color background = null, Microsoft.Xna.Framework.Graphics.SpriteEffects spriteEffect = null ) : void

Draws the string on the console at the specified location with the specified settings.

SetBackground ( int x, int y, Microsoft.Xna.Framework.Color color ) : void

Changes the background of a cell to the specified color.

SetCellAppearance ( int x, int y, ICellAppearance appearance ) : void

Changes the appearance of the cell. The appearance represents the look of a cell and will first be cloned, then applied to the cell.

SetEffect ( IEnumerable cells, Effects effect ) : void

Changes the effect of a list of cells to the specified effect.

SetEffect ( int index, ICellEffect effect ) : void

Changes the effect of a cell to the specified effect.

SetEffect ( int x, int y, Effects effect ) : void

Changes the effect of a cell to the specified effect.

SetForeground ( int x, int y, Microsoft.Xna.Framework.Color color ) : void

Changes the foreground of a specified cell to a new color.

SetGlyph ( int x, int y, int glyph ) : void

Changes the glyph of a specified cell to a new value.

SetGlyph ( int x, int y, int glyph, Microsoft.Xna.Framework.Color foreground ) : void

Changes the glyph, foreground, and background of a cell.

SetGlyph ( int x, int y, int glyph, Microsoft.Xna.Framework.Color foreground, Microsoft.Xna.Framework.Color background ) : void

Changes the glyph, foreground, and background of a cell.

SetGlyph ( int x, int y, int glyph, Microsoft.Xna.Framework.Color foreground, Microsoft.Xna.Framework.Color background, ICellEffect effect ) : void

Changes the glyph, foreground, background, and effect of a cell.

SetPixels ( Microsoft.Xna.Framework.Color pixels ) : void

Sets each background of a cell to the array of colors. Must be the same length as this cell surface.

SetSpriteEffect ( int x, int y, Microsoft.Xna.Framework.Graphics.SpriteEffects spriteEffect ) : void

Sets the sprite effect of a specified cell.

ShiftDown ( ) : void

Scrolls all the console data down by one.

ShiftDown ( int amount, bool wrap = false ) : void

Scrolls all the console data down by the specified amount of rows.

ShiftLeft ( ) : void

Scrolls all the console data left by one.

ShiftLeft ( int amount, bool wrap = false ) : void

Scrolls all the console data left by the specified amount.

ShiftRight ( ) : void

Scrolls all the console data right by one.

ShiftRight ( int amount, bool wrap = false ) : void

Scrolls all the console data right by the specified amount.

ShiftUp ( ) : void

Scrolls all the console data up by one.

ShiftUp ( int amount, bool wrap = false ) : void

Scrolls all the console data up by the specified amount of rows.

SurfaceEditor ( ITextSurface surface ) : System

Creates a new cell surface that can be resized and also have its textSurface.Cells resized.

You must set the Font property before rendering this cell surface.

this ( int index ) : Cell

Gets a cell by index.

this ( int x, int y ) : Cell

Gets a cell based on it's coordinates on the surface.

Защищенные методы

Метод Описание
OnSurfaceChanged ( ITextSurface oldSurface, ITextSurface newSurface ) : void

Called when the TextSurface property is changed. Sets Effects to a new instance of EffectsManager.

Приватные методы

Метод Описание
PrintNoCheck ( int index, ColoredString text ) : void

Описание методов

Clear() публичный Метод

Clears the console data. Characters are reset to 0, the forground and background are set to default, and effect set to none.
public Clear ( ) : void
Результат void

Clear() публичный Метод

Clears a cell. Character is reset to 0, the forground and background is set to default, and effect is set to none.
public Clear ( int x, int y ) : void
x int The x location of the cell.
y int The y location of the cell.
Результат void

ClearShiftValues() публичный Метод

public ClearShiftValues ( ) : void
Результат void

Fill() публичный Метод

Fills the console.
public Fill ( Microsoft.Xna.Framework.Color foreground, Microsoft.Xna.Framework.Color background, int glyph, Microsoft.Xna.Framework.Graphics.SpriteEffects spriteEffect = null ) : Cell[]
foreground Microsoft.Xna.Framework.Color Foregorund of every cell. If null, skips.
background Microsoft.Xna.Framework.Color Foregorund of every cell. If null, skips.
glyph int Glyph of every cell. If null, skips.
spriteEffect Microsoft.Xna.Framework.Graphics.SpriteEffects Sprite effect of every cell. If null, skips.
Результат Cell[]

Fill() публичный Метод

Fills the specified area.
public Fill ( Microsoft.Xna.Framework.Rectangle area, Microsoft.Xna.Framework.Color foreground, Microsoft.Xna.Framework.Color background, int glyph, Microsoft.Xna.Framework.Graphics.SpriteEffects spriteEffect = null ) : Cell[]
area Microsoft.Xna.Framework.Rectangle The area to fill.
foreground Microsoft.Xna.Framework.Color Foregorund of every cell. If null, skips.
background Microsoft.Xna.Framework.Color Foregorund of every cell. If null, skips.
glyph int Glyph of every cell. If null, skips.
spriteEffect Microsoft.Xna.Framework.Graphics.SpriteEffects Sprite effect of every cell. If null, skips.
Результат Cell[]

FillWithRandomGarbage() публичный Метод

Fills a console with random colors and glyphs.
public FillWithRandomGarbage ( bool useEffect = false ) : void
useEffect bool
Результат void

GetBackground() публичный Метод

Gets the background of a specified cell.
public GetBackground ( int x, int y ) : Microsoft.Xna.Framework.Color
x int The x location of the cell.
y int The y location of the cell.
Результат Microsoft.Xna.Framework.Color

GetCellAppearance() публичный Метод

Gets the appearance of a cell.
public GetCellAppearance ( int x, int y ) : ICellAppearance
x int The x location of the cell.
y int The y location of the cell.
Результат ICellAppearance

GetEffect() публичный Метод

Gets the effect of the specified cell.
public GetEffect ( int x, int y ) : Effects.ICellEffect
x int The x location of the cell.
y int The y location of the cell.
Результат Effects.ICellEffect

GetForeground() публичный Метод

Gets the foreground of a specified cell.
public GetForeground ( int x, int y ) : Microsoft.Xna.Framework.Color
x int The x location of the cell.
y int The y location of the cell.
Результат Microsoft.Xna.Framework.Color

GetGlyph() публичный Метод

Gets the glyph of a specified cell.
public GetGlyph ( int x, int y ) : int
x int The x location of the cell.
y int The y location of the cell.
Результат int

GetSpriteEffect() публичный Метод

Gets the sprite effect of a specified cell.
public GetSpriteEffect ( int x, int y ) : Microsoft.Xna.Framework.Graphics.SpriteEffects
x int The x location of the cell.
y int The y location of the cell.
Результат Microsoft.Xna.Framework.Graphics.SpriteEffects

GetString() публичный Метод

Builds a string from the text surface.
public GetString ( int index, int length ) : string
index int Where to start getting characters from.
length int How many characters to fill the string with.
Результат string

GetString() публичный Метод

Builds a string from the text surface from the specified coordinates.
public GetString ( int x, int y, int length ) : string
x int The x position of the surface to start at.
y int The y position of the surface to start at.
length int How many characters to fill the string with.
Результат string

GetStringColored() публичный Метод

Builds a string from the text surface.
public GetStringColored ( int index, int length ) : ColoredString
index int Where to start getting characters from.
length int How many characters to fill the string with.
Результат ColoredString

GetStringColored() публичный Метод

Builds a string from the text surface from the specified coordinates.
public GetStringColored ( int x, int y, int length ) : ColoredString
x int The x position of the surface to start at.
y int The y position of the surface to start at.
length int How many characters to fill the string with.
Результат ColoredString

IsValidCell() публичный Метод

Tests if a cell is valid based on its index.
public IsValidCell ( int index ) : bool
index int The index to test.
Результат bool

IsValidCell() публичный Метод

Tests if a cell is valid based on its x,y position.
public IsValidCell ( int x, int y ) : bool
x int The x coordinate of the cell to test.
y int The y coordinate of the cell to test.
Результат bool

IsValidCell() публичный Метод

Tests if a cell is valid based on its x,y position.
public IsValidCell ( int x, int y, int &index ) : bool
x int The x coordinate of the cell to test.
y int The y coordinate of the cell to test.
index int If the cell is valid, the index of the cell when found.
Результат bool

OnSurfaceChanged() защищенный Метод

Called when the TextSurface property is changed. Sets Effects to a new instance of EffectsManager.
protected OnSurfaceChanged ( ITextSurface oldSurface, ITextSurface newSurface ) : void
oldSurface ITextSurface The previous text surface.
newSurface ITextSurface The new text surface.
Результат void

Print() публичный Метод

Draws the string on the console at the specified location, wrapping if needed.
public Print ( int x, int y, ColoredString text ) : void
x int X location of the text.
y int Y location of the text.
text ColoredString The string to display.
Результат void

Print() публичный Метод

Draws the string on the console at the specified location, wrapping if needed.
public Print ( int x, int y, string text ) : void
x int X location of the text.
y int Y location of the text.
text string The string to display.
Результат void

Print() публичный Метод

Draws the string on the console at the specified location, wrapping if needed.
public Print ( int x, int y, string text, ICellAppearance appearance, ICellEffect effect = null ) : void
x int X location of the text.
y int Y location of the text.
text string The string to display.
appearance ICellAppearance The appearance of the cell
effect ICellEffect An optional effect to apply to the printed cells.
Результат void

Print() публичный Метод

Draws the string on the console at the specified location and color, wrapping if needed.
public Print ( int x, int y, string text, Microsoft.Xna.Framework.Color foreground ) : void
x int X location of the text.
y int Y location of the text.
text string The string to display.
foreground Microsoft.Xna.Framework.Color Sets the foreground of all characters in the text.
Результат void

Print() публичный Метод

Draws the string on the console at the specified location with the specified foreground and background color, wrapping if needed.
public Print ( int x, int y, string text, Microsoft.Xna.Framework.Color foreground, Microsoft.Xna.Framework.Color background ) : void
x int X location of the text.
y int Y location of the text.
text string The string to display.
foreground Microsoft.Xna.Framework.Color Sets the foreground of all characters in the text.
background Microsoft.Xna.Framework.Color Sets the background of all characters in the text.
Результат void

Print() публичный Метод

Draws the string on the console at the specified location with the specified settings.
public Print ( int x, int y, string text, Microsoft.Xna.Framework.Color foreground = null, Microsoft.Xna.Framework.Color background = null, Microsoft.Xna.Framework.Graphics.SpriteEffects spriteEffect = null ) : void
x int X location of the text.
y int Y location of the text.
text string The string to display.
foreground Microsoft.Xna.Framework.Color Sets the foreground of all characters in the text.
background Microsoft.Xna.Framework.Color Sets the background of all characters in the text.
spriteEffect Microsoft.Xna.Framework.Graphics.SpriteEffects The sprite effect to set on the cell.
Результат void

SetBackground() публичный Метод

Changes the background of a cell to the specified color.
public SetBackground ( int x, int y, Microsoft.Xna.Framework.Color color ) : void
x int The x location of the cell.
y int The y location of the cell.
color Microsoft.Xna.Framework.Color The desired color of the cell.
Результат void

SetCellAppearance() публичный Метод

Changes the appearance of the cell. The appearance represents the look of a cell and will first be cloned, then applied to the cell.
public SetCellAppearance ( int x, int y, ICellAppearance appearance ) : void
x int The x location of the cell.
y int The y location of the cell.
appearance ICellAppearance The desired appearance of the cell. A null value cannot be passed.
Результат void

SetEffect() публичный Метод

Changes the effect of a list of cells to the specified effect.
public SetEffect ( IEnumerable cells, Effects effect ) : void
cells IEnumerable The cells for the effect.
effect Effects The desired effect.
Результат void

SetEffect() публичный Метод

Changes the effect of a cell to the specified effect.
public SetEffect ( int index, ICellEffect effect ) : void
index int Index of the cell.
effect ICellEffect The desired effect.
Результат void

SetEffect() публичный Метод

Changes the effect of a cell to the specified effect.
public SetEffect ( int x, int y, Effects effect ) : void
x int The x location of the cell.
y int The y location of the cell.
effect Effects The desired effect.
Результат void

SetForeground() публичный Метод

Changes the foreground of a specified cell to a new color.
public SetForeground ( int x, int y, Microsoft.Xna.Framework.Color color ) : void
x int The x location of the cell.
y int The y location of the cell.
color Microsoft.Xna.Framework.Color The desired color of the cell.
Результат void

SetGlyph() публичный Метод

Changes the glyph of a specified cell to a new value.
public SetGlyph ( int x, int y, int glyph ) : void
x int The x location of the cell.
y int The y location of the cell.
glyph int The desired glyph of the cell.
Результат void

SetGlyph() публичный Метод

Changes the glyph, foreground, and background of a cell.
public SetGlyph ( int x, int y, int glyph, Microsoft.Xna.Framework.Color foreground ) : void
x int The x location of the cell.
y int The y location of the cell.
glyph int The desired glyph.
foreground Microsoft.Xna.Framework.Color The desired foreground.
Результат void

SetGlyph() публичный Метод

Changes the glyph, foreground, and background of a cell.
public SetGlyph ( int x, int y, int glyph, Microsoft.Xna.Framework.Color foreground, Microsoft.Xna.Framework.Color background ) : void
x int The x location of the cell.
y int The y location of the cell.
glyph int The desired glyph.
foreground Microsoft.Xna.Framework.Color The desired foreground.
background Microsoft.Xna.Framework.Color The desired background.
Результат void

SetGlyph() публичный Метод

Changes the glyph, foreground, background, and effect of a cell.
public SetGlyph ( int x, int y, int glyph, Microsoft.Xna.Framework.Color foreground, Microsoft.Xna.Framework.Color background, ICellEffect effect ) : void
x int The x location of the cell.
y int The y location of the cell.
glyph int The desired glyph.
foreground Microsoft.Xna.Framework.Color The desired foreground.
background Microsoft.Xna.Framework.Color The desired background.
effect ICellEffect Sets the effect of the cell
Результат void

SetPixels() публичный Метод

Sets each background of a cell to the array of colors. Must be the same length as this cell surface.
public SetPixels ( Microsoft.Xna.Framework.Color pixels ) : void
pixels Microsoft.Xna.Framework.Color The colors to place.
Результат void

SetSpriteEffect() публичный Метод

Sets the sprite effect of a specified cell.
public SetSpriteEffect ( int x, int y, Microsoft.Xna.Framework.Graphics.SpriteEffects spriteEffect ) : void
x int The x location of the cell.
y int The y location of the cell.
spriteEffect Microsoft.Xna.Framework.Graphics.SpriteEffects The sprite effect of the cell.
Результат void

ShiftDown() публичный Метод

Scrolls all the console data down by one.
public ShiftDown ( ) : void
Результат void

ShiftDown() публичный Метод

Scrolls all the console data down by the specified amount of rows.
public ShiftDown ( int amount, bool wrap = false ) : void
amount int How many rows to shift.
wrap bool
Результат void

ShiftLeft() публичный Метод

Scrolls all the console data left by one.
public ShiftLeft ( ) : void
Результат void

ShiftLeft() публичный Метод

Scrolls all the console data left by the specified amount.
public ShiftLeft ( int amount, bool wrap = false ) : void
amount int How much to scroll.
wrap bool
Результат void

ShiftRight() публичный Метод

Scrolls all the console data right by one.
public ShiftRight ( ) : void
Результат void

ShiftRight() публичный Метод

Scrolls all the console data right by the specified amount.
public ShiftRight ( int amount, bool wrap = false ) : void
amount int How much to scroll.
wrap bool
Результат void

ShiftUp() публичный Метод

Scrolls all the console data up by one.
public ShiftUp ( ) : void
Результат void

ShiftUp() публичный Метод

Scrolls all the console data up by the specified amount of rows.
public ShiftUp ( int amount, bool wrap = false ) : void
amount int How many rows to shift.
wrap bool
Результат void

SurfaceEditor() публичный Метод

Creates a new cell surface that can be resized and also have its textSurface.Cells resized.
You must set the Font property before rendering this cell surface.
public SurfaceEditor ( ITextSurface surface ) : System
surface ITextSurface
Результат System

this() публичный Метод

Gets a cell by index.
public this ( int index ) : Cell
index int The index of the cell.
Результат Cell

this() публичный Метод

Gets a cell based on it's coordinates on the surface.
public this ( int x, int y ) : Cell
x int The X coordinate.
y int The Y coordinate.
Результат Cell

Описание свойств

TimesShiftedDown публичное свойство

public int TimesShiftedDown
Результат int

TimesShiftedLeft публичное свойство

public int TimesShiftedLeft
Результат int

TimesShiftedRight публичное свойство

public int TimesShiftedRight
Результат int

TimesShiftedUp публичное свойство

public int TimesShiftedUp
Результат int

UsePrintProcessor публичное свойство

When true, the ColoredString.Parse(string, int, ITextSurface, ParseCommandStacks) command is used to print strings.
public bool UsePrintProcessor
Результат bool

textSurface защищенное свойство

protected ITextSurface textSurface
Результат ITextSurface