/// <summary> /// Function to be used with the ConsoleBlockMap / ConsoleScreen class /// Replaces the destination block, no questions asked /// </summary> /// <param name="dx">Destination map X</param> /// <param name="dy">Destination map Y</param> /// <param name="di">Destination map index</param> /// <param name="dblock">Destination map block</param> /// <param name="x">Source map X</param> /// <param name="y">Source map Y</param> /// <param name="i">Source map index</param> /// <param name="block">Source map block</param> /// <returns>Merged block</returns> public static ConsoleBlock BlockJustReplace( int dx, int dy, int di, ConsoleBlock dblock, int x, int y, int i, ConsoleBlock block ) { return block; }
/// <summary> /// Function to be used with the ConsoleBlockMap / ConsoleScreen class /// If the source block isn't transparent, put it on the destination one /// </summary> /// <param name="dx">Destination map X</param> /// <param name="dy">Destination map Y</param> /// <param name="di">Destination map index</param> /// <param name="dblock">Destination map block</param> /// <param name="x">Source map X</param> /// <param name="y">Source map Y</param> /// <param name="i">Source map index</param> /// <param name="block">Source map block</param> /// <returns>Merged block</returns> public static ConsoleBlock BlockJustReplaceIfNotEmpty( int dx, int dy, int di, ConsoleBlock dblock, int x, int y, int i, ConsoleBlock block ) { return char.IsWhiteSpace(block.Character) ? dblock : block; }
/// <summary> /// Function to be used with the ConsoleBlockMap / ConsoleScreen class /// Replaces the destination block, no questions asked /// </summary> /// <param name="dx">Destination map X</param> /// <param name="dy">Destination map Y</param> /// <param name="di">Destination map index</param> /// <param name="dblock">Destination map block</param> /// <param name="x">Source map X</param> /// <param name="y">Source map Y</param> /// <param name="i">Source map index</param> /// <param name="block">Source map block</param> /// <returns>Merged block</returns> public static ConsoleBlock BlockJustReplace( int dx, int dy, int di, ConsoleBlock dblock, int x, int y, int i, ConsoleBlock block ) { return(block); }
/// <summary> /// Function to be used with the ConsoleBlockMap / ConsoleScreen class /// If the source block isn't transparent, put it on the destination one /// </summary> /// <param name="dx">Destination map X</param> /// <param name="dy">Destination map Y</param> /// <param name="di">Destination map index</param> /// <param name="dblock">Destination map block</param> /// <param name="x">Source map X</param> /// <param name="y">Source map Y</param> /// <param name="i">Source map index</param> /// <param name="block">Source map block</param> /// <returns>Merged block</returns> public static ConsoleBlock BlockJustReplaceIfNotEmpty( int dx, int dy, int di, ConsoleBlock dblock, int x, int y, int i, ConsoleBlock block ) { return(char.IsWhiteSpace(block.Character) ? dblock : block); }
/// <summary> /// Function to be used with the ConsoleBlockMap / ConsoleScreen class /// If the source block isn't transparent, put it on the destination one /// </summary> /// <param name="dx">Destination map X</param> /// <param name="dy">Destination map Y</param> /// <param name="di">Destination map index</param> /// <param name="dblock">Destination map block</param> /// <param name="x">Source line character index</param> /// <param name="y">Source line index</param> /// <param name="i">Source index</param> /// <param name="chr">Source line character</param> /// <returns>Merged block</returns> public static ConsoleBlock TextJustReplace( int dx, int dy, int di, ConsoleBlock dblock, int x, int y, int i, char chr ) { dblock.Character = chr; return(dblock); }
/// <summary> /// Returns if the current object is equal to another /// </summary> /// <param name="obj">Object to compare</param> /// <returns>If they're the same</returns> public override bool Equals(object obj) { // If the given object to compare to is null or isn't the same type of this one if ((obj == null) || !(obj is ConsoleBlock)) { // Then uses the original equals function return(base.Equals(obj)); } // If the object is the same type as this, then convert it ConsoleBlock other = (ConsoleBlock)obj; // And compare if they have the same settings return( (BackgroundColor == other.BackgroundColor) && (ForegroundColor == other.ForegroundColor) && (Character == other.Character) ); }
/// <summary> /// Function to be used with the ConsoleBlockMap / ConsoleScreen class /// If the source block isn't transparent, put it on the destination one /// </summary> /// <param name="dx">Destination map X</param> /// <param name="dy">Destination map Y</param> /// <param name="di">Destination map index</param> /// <param name="dblock">Destination map block</param> /// <param name="x">Source line character index</param> /// <param name="y">Source line index</param> /// <param name="i">Source index</param> /// <param name="chr">Source line character</param> /// <returns>Merged block</returns> public static ConsoleBlock TextJustReplace( int dx, int dy, int di, ConsoleBlock dblock, int x, int y, int i, char chr ) { dblock.Character = chr; return dblock; }