public void OnSelectedColorIndexChanged() { if (SelectedColorIndex != -1) { SelectedColor = AvailableColors.ElementAt(SelectedColorIndex); } }
public AvailableColors[] GetRandomColors(int amount, AvailableColorPalettes fromPalette = AvailableColorPalettes.Default) { switch (fromPalette) { default: _colors = RawColors.Keys.ToList(); break; case AvailableColorPalettes.Distinct: _colors = DistinctColors.Keys.ToList(); break; } var usedAmount = amount > _colors.Count ? _colors.Count : amount; AvailableColors[] returnColors = new AvailableColors[usedAmount]; int randIndex = 0; for (int i = 0; i < usedAmount; i++) { randIndex = _random.Next(0, _colors.Count); returnColors[i] = _colors[randIndex]; _colors.RemoveAt(randIndex); } _colors = null; return(returnColors); }
private void ApplyFontColor() { int colorIndex = AvailableColors.GetFontColorIndex(this.Font.Color); this.FontControl.colorPicker.colorComboBox.SelectedIndex = colorIndex; this.FontControl.colorPicker.colorComboBox.BringIntoView(); }
private (AvailableColors, int) CountOfFigureColor(FigureType type) { bool colornull = true; AvailableColors color = AvailableColors.Blue; int count = 0; foreach (var figure in _spawnedFigures) { if (figure.GetFigureType == type) { if (colornull) { color = figure.GetColor; count = 1; colornull = false; continue; } if (figure.GetColor == color) { count++; } } } return(color, count); }
public static Color GetColorFromAvailable(AvailableColors color) { string htmlColor = ""; switch (color) { case AvailableColors.Red: htmlColor = "#E92727"; break; case AvailableColors.Gray: htmlColor = "#212F32"; break; case AvailableColors.Blue: htmlColor = "#308EA2"; break; case AvailableColors.Green: htmlColor = "#30AB36"; break; } Color returnColor; if (ColorUtility.TryParseHtmlString(htmlColor, out returnColor)) { return(returnColor); } return(Color.white); }
public MemoflowStepVO(int symbol, AvailableColors symbolColor, AvailableColors borderColor, float rot = 0) { BorderColor = borderColor; SymbolId = symbol; SymbolColor = symbolColor; Rot = rot; }
public void Reset() { NewTagName = string.Empty; NewTagColor = AvailableColors.First(); ReadTagNames(); ClearValidationErrors(); }
private void SyncBackground() { int colorIdx = AvailableColors.GetFontColorIndex(this.Font.Background); this.colorFontChooser.backgroundPicker.superCombo.SelectedIndex = colorIdx; this.colorFontChooser.txtSampleText.Background = this.Font.Background.Brush; this.colorFontChooser.backgroundPicker.superCombo.BringIntoView(); }
// All properties are set by the model, for now no need to take care about it public FlashGlanceRoundItemVO(int id, int cypher, SafeHashCodePoint gridPosition, int rotation, float scale, AvailableColors color) { Id = id; Cypher = cypher; GridPosition = gridPosition; Rotation = rotation; Scale = scale; Color = color; }
void Awake() { //basic singleton stuff-- make sure there's only one instance, and it's this one! if (Instance == null) { Instance = this; //there is no PlayerManager-- so this can be it DontDestroyOnLoad(gameObject); //pls don't destroy thanks index = 0; AvailableColors = new List <ColorIDs.Colors>(); AvailableColors.Add(ColorIDs.Colors.NONE); CurrentColor = AvailableColors[index]; //for testing color switching: give us all colors if (giveDebugColors) { AddColor(ColorIDs.Colors.Green); AddColor(ColorIDs.Colors.Blue); AddColor(ColorIDs.Colors.Red); } } else { Destroy(gameObject); //ok there's already a PlayerManager. so die } //on Awake, find the player player = GameObject.FindWithTag("Player"); //The following block is for loading a scene's data when restarting it //we have a LoadSceneData and its scene number is the same as our scene if (lsd != null && lsd.sceneName == LevelManager.CurrentSceneName) { //so we must be reloading this scene-- let's set all this data back //to where it was when we started this scene! CurrentColor = lsd.saved_CurrentColor; AvailableColors.Clear(); foreach (ColorIDs.Colors c in lsd.saved_AvailableColors) { AvailableColors.Add(c); } index = lsd.saved_index; player.SetActive(false); UpdatePlayerPos(); player.SetActive(true); } else { //ok either we have no LoadSceneData or its sceneName is different //from our last one-- save current info as our new LoadSceneData SaveCurrentInfoAsLSD(); } //a quick note on the else block: we could add an UpdateData() function to the //LoadSceneData class if so desired (would maybe save some space) }
public Truck() { if (AvailableColors.Count > 0) { Color = AvailableColors[0]; AvailableColors.Remove(Color); } else { Color = "blue"; } }
public void SetColorAll(AvailableColors color) { int r, g, b; convertColorValues(color, out r, out g, out b); for (int i = 0; i < _lightArray.ColumnCount - 1; ) { _lightArray[i] = r; _lightArray[i + 1] = g; _lightArray[i + 2] = b; i = i + 3; } }
public static List <string> DecodeColors(int color) { List <string> colors = new List <string>(); for (int i = 0; i < AvailableColors.Length; i++) { if ((color & (1 << i)) > 0) { colors.Add(AvailableColors.GetValue(i).ToString()); } } return(colors); }
void Awake() { if (!instance) { instance = this; DontDestroyOnLoad(this); } else { Debug.LogError("Only one instance of " + this.GetType().ToString() + " is allowed within a scene."); Destroy(this.gameObject); } }
public void SetColorAll(AvailableColors color) { int r, g, b; convertColorValues(color, out r, out g, out b); for (int i = 0; i < _lightArray.ColumnCount - 1;) { _lightArray[i] = r; _lightArray[i + 1] = g; _lightArray[i + 2] = b; i = i + 3; } }
public ColorSpace GetNextAvailableColor() { var result = AvailableColors.FirstOrDefault(); if (result == null) { _maxUsageLevel++; return(GetNextAvailableColor()); } _colorDictionary[result] = _maxUsageLevel; return(result); }
private int GetColorCount(AvailableColors color) { int count = 0; foreach (var figure in _spawnedFigures) { if (figure.GetColor == color) { count++; } } return(count); }
public void ColorQuestion(AvailableColors _trueColor, AvailableColors _falseColor, bool equals = false) { if (_firstButton != null) { Destroy(_firstButton.gameObject); Destroy(_secondButton.gameObject); } if (equals) { _firstButton = Instantiate(_colorButtonPrefab, transform); _firstButton.transform.DOLocalMove(_firstButtonPosition.localPosition, 0.6f); _firstButton.CallOnButtonClick += () => CallOnQuestionTrue?.Invoke(); _firstButton.SetColor(_trueColor); _secondButton = Instantiate(_colorButtonPrefab, transform); _secondButton.transform.DOLocalMove(_secondButtonPosition.localPosition, 0.6f); _secondButton.CallOnButtonClick += () => CallOnQuestionTrue?.Invoke(); _secondButton.SetColor(_falseColor); return; } if (RandomBool()) { Debug.Log("rand true"); _firstButton = Instantiate(_colorButtonPrefab, transform); _firstButton.transform.DOLocalMove(_firstButtonPosition.localPosition, 0.6f); _firstButton.CallOnButtonClick += () => CallOnQuestionTrue?.Invoke(); _firstButton.SetColor(_trueColor); _secondButton = Instantiate(_colorButtonPrefab, transform); _secondButton.transform.DOLocalMove(_secondButtonPosition.localPosition, 0.6f); _secondButton.CallOnButtonClick += () => CallOnQuestionFalse?.Invoke(); _secondButton.SetColor(_falseColor); } else { Debug.Log("rand false"); _secondButton = Instantiate(_colorButtonPrefab, transform); _secondButton.transform.DOLocalMove(_secondButtonPosition.localPosition, 0.6f); _secondButton.CallOnButtonClick += () => CallOnQuestionTrue?.Invoke(); _secondButton.SetColor(_trueColor); _firstButton = Instantiate(_colorButtonPrefab, transform); _firstButton.transform.DOLocalMove(_firstButtonPosition.localPosition, 0.6f); _firstButton.CallOnButtonClick += () => CallOnQuestionFalse?.Invoke(); _firstButton.SetColor(_falseColor); } }
public Window1() { InitializeComponent(); SelectedColors = new Dictionary <string, ColorInfo>(); SelectedColors.Add("color0", AvailableColors.First()); SelectedColors.Add("color1", AvailableColors.Last()); XmlReader xaml = XmlReader.Create("newcontrol.xml"); newControl.Content = XamlReader.Load(xaml); newControl.DataContext = SelectedColors; DataContext = this; }
//adds the color specified, switches to it, special case for first color added public static void AddColor(ColorIDs.Colors c) { if (!AvailableColors.Contains(c)) { AvailableColors.Add(c); SwitchColor(); } if (AvailableColors.Contains(ColorIDs.Colors.NONE)) { //special case: for the first color added, remove NONE from the available colors //list and force the index back down to the first element (which is now our color) AvailableColors.Remove(ColorIDs.Colors.NONE); index = 0; } }
private void SetNormalisationChoices() { var dcs = new DicomColors(); var fields = typeof(DicomColors).GetFields(); foreach (var field in fields) { AvailableColors.Add((DicomColor)field.GetValue(dcs)); } RelativeNormalisationOptions = new List <RelativeNormalisationOption>() { RelativeNormalisationOption.Max, RelativeNormalisationOption.POI, }; NormalisationTypes = new List <NormalisationType>() { NormalisationType.Relative, NormalisationType.Absolute }; POIs = new ObservableCollection <PointOfInterest>(); }
protected virtual MemoflowStepVO CreateStepWithMatch(MemoflowStepVO nbs, MemoflowMatchType matchType) { MemoflowConfiguration memoflowConfig = (MemoflowConfiguration)ExerciseConfiguration; //create completely different step... int symbol = GetUniqueElement(_availableSymbols, nbs.SymbolId); AvailableColors borderColor = GetUniqueElement(_availableColors, nbs.BorderColor); float rotation = GetUniqueElement(_availableRotations, nbs.Rot); //...add a match if necessary if (matchType == MemoflowMatchType.COLOR) { borderColor = nbs.BorderColor; } if (matchType == MemoflowMatchType.SYMBOL) { symbol = nbs.SymbolId; } //if( matchType == MATCH_TYPE.ROTATION) rotation = nbs.rotation; //otherwise NO_MATCH was the case. return(new MemoflowStepVO(symbol, _availableColors[_colorIndex], borderColor, rotation)); }
/// <summary> /// Converts the available color to an R, G, and B integer value /// for this device. /// </summary> /// <param name="color"></param> /// <param name="r"></param> /// <param name="g"></param> /// <param name="b"></param> private void convertColorValues(AvailableColors color, out int r, out int g, out int b) { r = g = b = 0; switch (color) { case AvailableColors.HiWhite: r = g = b = 45; break; case AvailableColors.HiRed: r = 45; g = b = 0; break; case AvailableColors.HiBlue: b = 45; r = g = 0; break; case AvailableColors.HiGreen: g = 45; r = b = 0; break; case AvailableColors.HiPaleBlue: b = 45; r = g = 10; break; case AvailableColors.HiOrange: break; case AvailableColors.HiYellow: break; case AvailableColors.LowWhite: r = g = b = 20; break; case AvailableColors.LowRed: r = 20; g = b = 0; break; case AvailableColors.LowBlue: b = 20; r = g = 0; break; case AvailableColors.LowGreen: g = 20; r = b = 0; break; case AvailableColors.LowPaleBlue: b = 20; r = g = 5; break; case AvailableColors.LowOrange: break; case AvailableColors.LowYellow: break; case AvailableColors.Off: default: r = g = b = 0; break; } }
public void FigureAndColorCountQuestion(FigureType _trueFigure, FigureType _falseFigure, AvailableColors _trueColor, AvailableColors _falseColor, bool equals = false) { if (_firstButton != null) { Destroy(_firstButton.gameObject); Destroy(_secondButton.gameObject); } if (equals) { _firstButton = Instantiate(GetPrefabByFigureType(_trueFigure), transform); _firstButton.transform.DOLocalMove(_firstButtonPosition.localPosition, 0.3f); _firstButton.CallOnButtonClick += () => CallOnQuestionTrue?.Invoke(); _firstButton.SetColor(_trueColor); _secondButton = Instantiate(GetPrefabByFigureType(_falseFigure), transform); _secondButton.transform.DOLocalMove(_secondButtonPosition.localPosition, 0.3f); _secondButton.CallOnButtonClick += () => CallOnQuestionTrue?.Invoke(); _secondButton.SetColor(_falseColor); return; } if (RandomBool()) { _firstButton = Instantiate(GetPrefabByFigureType(_trueFigure), transform); _firstButton.transform.DOLocalMove(_firstButtonPosition.localPosition, 0.6f); _firstButton.CallOnButtonClick += () => CallOnQuestionTrue?.Invoke(); _firstButton.SetColor(_trueColor); _secondButton = Instantiate(GetPrefabByFigureType(_falseFigure), transform); _secondButton.transform.DOLocalMove(_secondButtonPosition.localPosition, 0.6f); _secondButton.CallOnButtonClick += () => CallOnQuestionFalse?.Invoke(); _secondButton.SetColor(_falseColor); } else { _secondButton = Instantiate(GetPrefabByFigureType(_trueFigure), transform); _secondButton.transform.DOLocalMove(_secondButtonPosition.localPosition, 0.6f); _secondButton.CallOnButtonClick += () => CallOnQuestionTrue?.Invoke(); _secondButton.SetColor(_trueColor); _firstButton = Instantiate(GetPrefabByFigureType(_falseFigure), transform); _firstButton.transform.DOLocalMove(_firstButtonPosition.localPosition, 0.6f); _firstButton.CallOnButtonClick += () => CallOnQuestionFalse?.Invoke(); _firstButton.SetColor(_falseColor); } }
/// <summary> /// /// </summary> public ColorPickerViewModel() { this.selectedFontColor = AvailableColors.GetFontColor(Colors.Black); this.roFontColors = new ReadOnlyCollection <FontColor>(new AvailableColors()); }
/// <summary> /// Converts the available color to an R, G, and B integer value /// for this device. /// </summary> /// <param name="color"></param> /// <param name="r"></param> /// <param name="g"></param> /// <param name="b"></param> private void convertColorValues(AvailableColors color, out int r, out int g, out int b) { r = g = b = 0; switch (color) { case AvailableColors.HiWhite: r = g = b = 45; break; case AvailableColors.HiRed: r = 45; g = b = 0; break; case AvailableColors.HiBlue: b = 45; r = g = 0; break; case AvailableColors.HiGreen: g = 45; r = b = 0; break; case AvailableColors.HiPaleBlue: b = 45; r = g = 10; break; case AvailableColors.HiOrange: break; case AvailableColors.HiYellow: break; case AvailableColors.LowWhite: r = g = b = 20; break; case AvailableColors.LowRed: r = 20; g = b = 0; break; case AvailableColors.LowBlue: b = 20; r = g = 0; break; case AvailableColors.LowGreen: g = 20; r = b = 0; break; case AvailableColors.LowPaleBlue: b = 20; r = g = 5; break; case AvailableColors.LowOrange: break; case AvailableColors.LowYellow: break; case AvailableColors.Off: default: r = g = b = 0; break; } }
public void CreateNewColorQuest(AvailableColors _trueColor, AvailableColors _falseColor, bool equals = false) { _questManager.ColorQuestion(_trueColor, _falseColor, equals); }
public modelFont() { AvailableColors AvCol = new AvailableColors(); availableColours = AvCol.GetFontColorsList().ToObservableCollection(); }
public override void OnStart() { base.OnStart(); if (CheepsAmongUsMod.CheepsAmongUsMod.IsDecidingClient) { Task.Run(async() => { await Task.Delay(1500); // Wait a bit Random random = new Random(); List <ColorType> AvailableColors = new List <ColorType>((IEnumerable <ColorType>)Enum.GetValues(typeof(ColorType))); List <ColorType> AvailableNames = new List <ColorType>(AvailableColors); foreach (var player in PlayerController.AllPlayerControls) { #region ---------- This is required, if more than 12 players are online, as the game only offers 12 colors ---------- if (AvailableColors.Count == 0 || AvailableNames.Count == 0) { AvailableColors = new List <ColorType>((IEnumerable <ColorType>)Enum.GetValues(typeof(ColorType))); AvailableNames = new List <ColorType>(AvailableColors); } #endregion #region ---------- Select random color and name ---------- var color = AvailableColors[random.Next(AvailableColors.Count)]; var name = AvailableNames[random.Next(AvailableNames.Count)]; AvailableColors.Remove(color); AvailableNames.Remove(name); #endregion #region ---------- As long as the name matches the color, change it ---------- while (color == name) { name = AvailableNames[random.Next(AvailableNames.Count)]; } #endregion if (player.IsLocalPlayer) { player.RpcSetColor(color); player.RpcSetHat(HatType.NoHat); player.RpcSetName(name.ToString()); player.RpcSetSkin(SkinType.None); player.RpcSetPet(PetType.NoPet); } else { var writer = RpcManager.StartRpc(Confusion.ConfusionRpc); writer.Write((byte)0); writer.Write(player.PlayerId); writer.Write((byte)color); writer.Write(name.ToString()); writer.EndMessage(); } } }); } }
private void ParseInlines(StringBuilder builder, InlineCollection inlines) { foreach (var inline in inlines) { if (inline is LineBreak) { builder.Append("\n"); continue; } var container = inline as InlineUIContainer; if (container != null) { var userView = container.Child as UserView; if (userView != null) { builder.Append($"[user]{userView.Character.Character.Name}[/user]"); } continue; } var customTag = inline.Tag != null; ICollection <string> tags = new LinkedList <string>(); if (inline.FontWeight > FontWeights.Normal) { tags.Add("b"); } if (inline.FontStyle == FontStyles.Italic) { tags.Add("i"); } if (inline.TextDecorations.Any(x => x.Location == TextDecorationLocation.Underline)) { tags.Add("u"); } if (inline.TextDecorations.Any(x => x.Location == TextDecorationLocation.Strikethrough)) { tags.Add("s"); } if (inline.BaselineAlignment == BaselineAlignment.Subscript) { tags.Add("sub"); } if (inline.BaselineAlignment == BaselineAlignment.Superscript) { tags.Add("sup"); } if (inline is Hyperlink && !customTag) { tags.Add("url=" + ((Hyperlink)inline).NavigateUri); } if (inline.FontSize == theme.FontSizeBig) { tags.Add("big"); } if (inline.FontSize == theme.FontSizeSmall) { tags.Add("small"); } var color = inline.Foreground as SolidColorBrush; if (color != null && AvailableColors.ContainsKey(color.Color)) { tags.Add("color=" + AvailableColors[color.Color]); } foreach (var tag in tags) { builder.Append("[" + tag + "]"); } if (customTag) { builder.Append(inline.Tag); } else { var run = inline as Run; if (run != null) { builder.Append(run.Text); } else { var span = inline as Span; if (span != null) { ParseInlines(builder, span.Inlines); } } } foreach (var tag in tags.Reverse()) { var index = tag.IndexOf("="); builder.Append("[/" + (index > 0 ? tag.Substring(0, index) : tag) + "]"); } } }
public void CreateNewFigureAndColorQuest(FigureType _trueFigure, FigureType _falseFigure, AvailableColors _trueColor, AvailableColors _falseColor, bool equals = false) { _questManager.FigureAndColorCountQuestion(_trueFigure, _falseFigure, _trueColor, _falseColor, equals); }
public void SetColor(AvailableColors color) { _image.color = ColorManager.GetColorFromAvailable(color); }