public void InputEntered(string input) { var storedColors = ColorStore.StoreCurrentColors(); currentControlLayout.Input(input); storedColors.Restore(); }
public bool KeyPressed(ConsoleKeyInfo key) { var storedColors = ColorStore.StoreCurrentColors(); bool result = currentControlLayout.KeyPressed(key); storedColors.Restore(); return(result); }
public static ColorStore GetColorStore() { ColorStore colorStore = new ColorStore(new Dictionary <Color, ConsoleColor>(), new Dictionary <ConsoleColor, Color>()); colorStore.Update(TEST_COLOR, TEST_CONSOLE_COLOR); return(colorStore); }
public void RequiresUpdate_ReturnsFalse_IfColorStoreContainsColor() { ColorStore colorStore = GetColorStore(); bool requiresUpdate = colorStore.RequiresUpdate(TEST_COLOR); Assert.IsFalse(requiresUpdate); }
public void RequiresUpdate_ReturnsTrue_IfColorStoreDoesNotContainColor() { ColorStore colorStore = GetColorStore(); Color notInStore = Color.Red; bool requiresUpdate = colorStore.RequiresUpdate(notInStore); Assert.IsTrue(requiresUpdate); }
protected override void DrawUnselected(Controls.UserControl ctrl) { base.DrawUnselected(ctrl); var storedColors = ColorStore.StoreCurrentColors(); Console.BackgroundColor = Configuration.Global.GetValue <ConsoleColor>("term_color_control_unselected_background"); Console.ForegroundColor = Configuration.Global.GetValue <ConsoleColor>("term_color_control_unselected_foreground"); DrawControl(ctrl); storedColors.Restore(); }
public SavedOutfit(SimBuilder builder) { foreach (CASPart oldPart in builder.mCASParts.Values) { string oldPreset = builder.GetDesignPresetString(oldPart); mParts.Add(new SavedPart(oldPart, oldPreset)); } mStore = new ColorStore(this); }
public Element() { var globalConf = Configuration.Global; subElements = new List <Element>(); NormalColors = new ColorStore(globalConf.GetValue <ConsoleColor>("mbc_console_text_foreground"), globalConf.GetValue <ConsoleColor>("mbc_console_text_background")); SelectedColors = new ColorStore(globalConf.GetValue <ConsoleColor>("mbc_console_text_selected_foreground"), globalConf.GetValue <ConsoleColor>("mbc_console_text_selected_background")); FlashColors = new ColorStore(globalConf.GetValue <ConsoleColor>("mbc_console_text_flashing_foreground"), globalConf.GetValue <ConsoleColor>("mbc_console_text_flashing_background")); ThreadRequired = false; }
public void RefreshDisplay(int x, int y, int w, int h) { var storedColors = ColorStore.StoreCurrentColors(); writePosX = x; writePosY = y; writeWidth = w; writeHeight = h; curX = 0; curY = 0; Align(); Display(); storedColors.Restore(); }
public SavedOutfit(SimOutfit outfit) { if (outfit != null) { foreach (CASPart oldPart in outfit.Parts) { string oldPreset = outfit.GetPartPreset(oldPart.Key); mParts.Add(new SavedPart(oldPart, oldPreset)); } } mStore = new ColorStore(this); }
private void ModifyASCII(int ctrlIdx, int x, int y, char character, ConsoleColor text, ConsoleColor background) { int sidePad = 10; int pad = (Width - 2) - (competition.FieldSize.X + (sidePad * 3)); int baseX = sidePad + ctrlIdx * (competition.FieldSize.X + pad); AlignToCoord(baseX + x, 8 + y); ColorStore prevColors = ColorStore.StoreCurrentColors(); Console.BackgroundColor = background; Console.ForegroundColor = text; WriteCharRepeat(character, 1); prevColors.Restore(); }
public ColorManager GetManager( ColorStore colorStore, int maxColorChanges, int initialColorChangeCountValue, bool isInCompatibilityMode) { var colorMapper = GetColorMapperSafe(ColorManager.IsWindows()); return(new ColorManager( colorStore, colorMapper, maxColorChanges, initialColorChangeCountValue, isInCompatibilityMode)); }
public ColorManager GetManager( ConcurrentDictionary <Color, ConsoleColor> colorMap, ConcurrentDictionary <ConsoleColor, Color> consoleColorMap, int maxColorChanges, int initialColorChangeCountValue, bool isInCompatibilityMode) { var colorStore = new ColorStore(colorMap, consoleColorMap); var colorMapper = GetColorMapperSafe(ColorManager.IsWindows()); return(new ColorManager( colorStore, colorMapper, maxColorChanges, initialColorChangeCountValue, isInCompatibilityMode)); }
public void Apply(SimBuilder builder, bool applyHairColor, IEnumerable <BodyTypes> argTypes, IEnumerable <BodyTypes> argNotTypes) { List <BodyTypes> types = null; if (argTypes != null) { types = new List <BodyTypes>(argTypes); } List <BodyTypes> notTypes = null; if (argNotTypes != null) { notTypes = new List <BodyTypes>(argNotTypes); } if ((types == null) || (types.Count == 0)) { types = null; } else if (notTypes != null) { foreach (BodyTypes type in types) { notTypes.Remove(type); } } ColorStore store = mStore; if (!applyHairColor) { store = new ColorStore(builder); } if (types != null) { if ((types.Contains(BodyTypes.UpperBody)) || (types.Contains(BodyTypes.LowerBody))) { builder.RemoveParts(new BodyTypes[] { BodyTypes.FullBody }); } if (types.Contains(BodyTypes.FullBody)) { builder.RemoveParts(new BodyTypes[] { BodyTypes.UpperBody, BodyTypes.LowerBody }); } builder.RemoveParts(types.ToArray()); } else { List <BodyTypes> allTypes = new List <BodyTypes>(CASParts.AllTypes); if (notTypes != null) { foreach (BodyTypes type in notTypes) { allTypes.Remove(type); } } builder.RemoveParts(allTypes.ToArray()); } foreach (SavedPart part in mParts) { if (types != null) { if (!types.Contains(part.mPart.BodyType)) { continue; } } if (notTypes != null) { if (notTypes.Contains(part.mPart.BodyType)) { continue; } } builder.AddPart(part.mPart); if ((part.mPreset != null) && CASUtils.ApplyPresetToPart(builder, part.mPart, part.mPreset)) { builder.SetPartPreset(part.mPart.Key, null, part.mPreset); } } store.Apply(builder); }
public ColorsController(ColorStore colorStore) { _colorStore = colorStore; }
public void Apply(SimBuilder builder, bool applyHairColor, IEnumerable<BodyTypes> argTypes, IEnumerable<BodyTypes> argNotTypes) { List<BodyTypes> types = null; if (argTypes != null) { types = new List<BodyTypes>(argTypes); } List<BodyTypes> notTypes = null; if (argNotTypes != null) { notTypes = new List<BodyTypes>(argNotTypes); } if ((types == null) || (types.Count == 0)) { types = null; } else if (notTypes != null) { foreach(BodyTypes type in types) { notTypes.Remove(type); } } ColorStore store = mStore; if (!applyHairColor) { store = new ColorStore(builder); } if (types != null) { if ((types.Contains(BodyTypes.UpperBody)) || (types.Contains(BodyTypes.LowerBody))) { builder.RemoveParts(new BodyTypes[] { BodyTypes.FullBody }); } if (types.Contains(BodyTypes.FullBody)) { builder.RemoveParts(new BodyTypes[] { BodyTypes.UpperBody, BodyTypes.LowerBody }); } builder.RemoveParts(types.ToArray()); } else { List<BodyTypes> allTypes = new List<BodyTypes>(CASParts.AllTypes); if (notTypes != null) { foreach(BodyTypes type in notTypes) { allTypes.Remove(type); } } builder.RemoveParts(allTypes.ToArray()); } foreach (SavedPart part in mParts) { if (types != null) { if (!types.Contains(part.mPart.BodyType)) continue; } if (notTypes != null) { if (notTypes.Contains(part.mPart.BodyType)) continue; } builder.AddPart(part.mPart); if ((part.mPreset != null) && CASUtils.ApplyPresetToPart(builder, part.mPart, part.mPreset)) { builder.SetPartPreset(part.mPart.Key, null, part.mPreset); } } store.Apply(builder); }