public static void PrepareColorSetting(ColorSetting p_Setting, BSMLAction p_Action, Color p_Value, bool p_RemoveLabel) { p_Setting.gameObject.SetActive(false); p_Value.a = 1.0f; p_Setting.CurrentColor = p_Value; if (p_Action != null) { p_Setting.onChange = p_Action; } p_Setting.updateOnChange = true; if (p_RemoveLabel) { GameObject.Destroy(p_Setting.gameObject.GetComponentsInChildren <TextMeshProUGUI>().ElementAt(0).transform.gameObject); RectTransform l_RectTransform = p_Setting.gameObject.transform.GetChild(1) as RectTransform; l_RectTransform.anchorMin = Vector2.zero; l_RectTransform.anchorMax = Vector2.one; l_RectTransform.sizeDelta = Vector2.one; p_Setting.gameObject.GetComponent <LayoutElement>().preferredWidth = -1f; } p_Setting.gameObject.SetActive(true); }
/// <summary> /// Constructs the default set of logging colors, which if gray, green, yellow, and red foreground for log /// levels debug, info, warn, and error respectively. /// </summary> public LoggingColors() { Debug = ColorSetting.Foreground(ConsoleColor.Gray); Info = ColorSetting.Foreground(ConsoleColor.Green); Warn = ColorSetting.Foreground(ConsoleColor.Yellow); Error = ColorSetting.Foreground(ConsoleColor.Red); }
public Prompt(string text, ColorSetting colorSetting, StroopTestController controller) { Text = text; ColorSetting = colorSetting; switch (ColorSetting) { case ColorSetting.Black: TextColor = controller.Translate ? "hitam" : "black"; break; case ColorSetting.Same: TextColor = text.ToLowerInvariant(); break; case ColorSetting.Random: string randomColor; do { randomColor = controller.AvailableColors[Random.Range(0, controller.AvailableColors.Length)]; if (controller.Translate) { randomColor = controller.ToMalay[randomColor]; } }while (randomColor == text); TextColor = randomColor.ToLowerInvariant(); break; } }
/// <summary> /// この部品の設定が変更された時に通知を受け取る。 /// </summary> /// <param name="model">キャラチップモデル</param> /// <param name="partsType">部品タイプ</param> /// <param name="propertyName">プロパティ名</param> private void OnPartsAttributeChanged(Character model, PartsType partsType, string propertyName) { // 変更対象の部品に関係するレイヤーに設定を適用する。 Parts parts = model.GetParts(partsType); foreach (RenderLayerGroup layerGroup in layerGroups) { foreach (RenderLayer layer in layerGroup) { if (layer.PartsType == partsType) { ApplyLayerOffsets(layer, parts); } if ((layer.ColorPartsRefs == partsType) && (layer.ColorPropertyName.Equals(propertyName))) { ColorSetting setting = parts.GetColorSetting(propertyName); if (setting != null) { ApplyLayerColor(layer, setting); } } } } }
/// <summary> /// キャラクタチップ部品のノードを解析し、設定値を得る。 /// </summary> /// <param name="node">キャラクタチップ部品ノード</param> /// <param name="parts">Partsオブジェクト</param> private static void LoadCharacterPartsNode(XmlNode node, Parts parts) { foreach (XmlAttribute attr in node.Attributes) { // 全ての子要素に対して読み出す。 try { switch (attr.Name) { case GeneratorSettingFileDefs.PartsAttrMaterialName: parts.MaterialName = attr.Value; break; case GeneratorSettingFileDefs.PartsAttrOffsetX: parts.OffsetX = int.Parse(attr.Value); break; case GeneratorSettingFileDefs.PartsAttrOffsetY: parts.OffsetY = int.Parse(attr.Value); break; case GeneratorSettingFileDefs.PartsAttrColor1: parts.Color1 = ColorSetting.Parse(attr.Value); break; case GeneratorSettingFileDefs.PartsAttrColor2: parts.Color2 = ColorSetting.Parse(attr.Value); break; } } catch (Exception) { // ここの解析例外は無視する。 } } }
/// <summary> /// レイヤーにpartsで指定される部品の設定を適用する。 /// </summary> /// <param name="layer">レイヤー</param> /// <param name="setting">色設定</param> private void ApplyLayerColor(RenderLayer layer, ColorSetting setting) { layer.Hue = setting.Hue; layer.Saturation = setting.Saturation; layer.Value = setting.Value; layer.Opacity = setting.Opacity; }
/// <summary> /// 担当者コード入力値を検証し、InputCompanyプロパティ値を制御する。 /// </summary> private void ValidateUserCode() { ColorSetting.ClearLoadedColors(); if (InputCompany == null || string.IsNullOrEmpty(txtUserCode.Text)) // 会社コードが無効 or ユーザコードが空欄 { InputUser = null; return; } var result = GetLoginUserByCode(ApplicationContext.Login.SessionKey, InputCompany.Id, txtUserCode.Text); if (result == null || !result.ProcessResult.Result || result.Users == null || result.Users.Count() < 1) { InputUser = null; return; } var users = GetLoginUser_UseClient(inputCompany.Id); if (users == null || users.Count() < 1) { InputUser = null; return; } InputUser = users.Where(x => x.Code == result.Users.FirstOrDefault().Code).FirstOrDefault(); }
private void mnuColorSetting_Click(object sender, EventArgs e) { ColorSetting form = new ColorSetting(); form.ShowDialog(); FillGrids(); }
protected void Status(double seconds, ColorSetting color, string msg, params object[] args) { if (UI_Control) { TCAGui.Status(seconds, color, msg, args); } }
public void UpdateSettings(ColorSetting settings) { this.settings = settings; if (texture == null) { texture = new Texture2D(textureResolution, 1); } }
public override GameObject CreateObject(Transform parent) { BoolSettingsController baseSetting = MonoBehaviour.Instantiate(Resources.FindObjectsOfTypeAll <BoolSettingsController>().First(x => (x.name == "Fullscreen")), parent, false); baseSetting.name = "BSMLColorSetting"; GameObject gameObject = baseSetting.gameObject; gameObject.SetActive(false); MonoBehaviour.Destroy(baseSetting); ColorSetting colorSetting = gameObject.AddComponent <ColorSetting>(); Transform valuePick = gameObject.transform.Find("ValuePicker"); (valuePick.transform as RectTransform).sizeDelta = new Vector2(13, 0); Button decButton = valuePick.GetComponentsInChildren <Button>().First(); decButton.enabled = false; decButton.interactable = true; GameObject.Destroy(decButton.transform.Find("Arrow").gameObject); GameObject.Destroy(valuePick.GetComponentsInChildren <TextMeshProUGUI>().First().gameObject); colorSetting.editButton = valuePick.GetComponentsInChildren <Button>().Last(); TextMeshProUGUI text = gameObject.GetComponentInChildren <TextMeshProUGUI>(); text.text = "Default Text"; gameObject.AddComponent <ExternalComponents>().components.Add(text); MonoBehaviour.Destroy(text.GetComponent <LocalizedTextMeshProUGUI>()); gameObject.GetComponent <LayoutElement>().preferredWidth = 90; Image colorImage = Object.Instantiate(Resources.FindObjectsOfTypeAll <Image>().First(x => x.gameObject.name == "ColorImage" && x.sprite?.name == "NoteCircle"), valuePick, false); colorImage.name = "BSMLCurrentColor"; (colorImage.gameObject.transform as RectTransform).anchoredPosition = new Vector2(0, 0); (colorImage.gameObject.transform as RectTransform).sizeDelta = new Vector2(5, 5); (colorImage.gameObject.transform as RectTransform).anchorMin = new Vector2(0.3f, 0.2f); (colorImage.gameObject.transform as RectTransform).anchorMax = new Vector2(0.3f, 0.2f); colorSetting.colorImage = colorImage; Image icon = colorSetting.editButton.transform.Find("Arrow").GetComponent <Image>(); icon.name = "EditIcon"; icon.sprite = Utilities.EditIcon; icon.rectTransform.sizeDelta = new Vector2(4, 4); colorSetting.editButton.interactable = true; (colorSetting.editButton.transform as RectTransform).anchorMin = new Vector2(0, 0); colorSetting.modalColorPicker = base.CreateObject(gameObject.transform).GetComponent <ModalColorPicker>(); gameObject.SetActive(true); return(gameObject); }
public void SaveSettings() { ColorSetting setting = _settingManager.GetSettings().OfType <ColorSetting>().First(); setting.Accent = Color.Gold; setting.Theme = Theme.Dark; _settingManager.Flush(); }
/// <summary> /// レイヤーにmodelの持つpartsに相当する部品の設定を適用する。 /// </summary> /// <param name="layer">レイヤー</param> /// <param name="model">キャラチップモデル</param> private void ApplyLayerColor(RenderLayer layer, Character model) { Parts parts = model.GetParts(layer.ColorPartsRefs); ColorSetting setting = parts.GetColorSetting(layer.ColorPropertyName); if (setting != null) { ApplyLayerColor(layer, setting); } }
/// <summary> /// 担当者コード検索画面を表示する。 /// </summary> private void ShowLoginUserSearchDialog() { if (InputCompany == null) { return; } var title = "ログインユーザー検索"; var user = ShowSearchDialog(title, new Dialogs.LoginUserGridLoader(ApplicationContext, true), 800, 600); if (user != null) { InputUser = user; ColorSetting.ClearLoadedColors(); } }
private void RandomizeColors() { RandomizeSettings(); List <ColorSetting> randomizedColors = new List <ColorSetting>(); for (int i = 0; i < Generator.Colors.Count; i++) { var currentColorSetting = new ColorSetting(); currentColorSetting.name = Generator.Colors[i].name; currentColorSetting.color = new Color(Random.Range(0f, 1f), Random.Range(0f, 1f), Random.Range(0f, 1f)); randomizedColors.Add(currentColorSetting); } Generator.Colors.Clear(); Generator.Colors.AddRange(randomizedColors); Generator.StartGeneration(); }
public void ColorSettingEditor() { var colorSetting = new ColorSetting { Accent = Color.Gold, Theme = Theme.Dark }; var colorSettingEditor = new ColorSettingEditorViewModel(MockRepository.GenerateStub <IIndependencyAdjuster <ColorSetting> >()); colorSettingEditor.SetSetting(colorSetting); Assert.That(colorSettingEditor.Color, Is.EqualTo(Color.Red)); Assert.That(colorSettingEditor.Theme, Is.EqualTo(Theme.Light)); colorSettingEditor.Color = Color.DarkOrange; colorSettingEditor.Theme = Theme.Dark; Assert.That(colorSetting.Accent, Is.EqualTo("DarkOrange")); Assert.That(colorSetting.Theme, Is.EqualTo("Dark")); }
void Log(LogLevel level, string message, ColorSetting colorSetting, params object[] objs) { if (_factory._colored) { colorSetting.Apply(); try { Write(level, message, objs); } finally { colorSetting.Revert(); } } else { Write(level, message, objs); } }
void RefreshAllColor() { foreach (var item in allSpirtes) { ColorSetting setting = item.GetComponent <ColorSetting>(); if (setting == null) { var newSet = item.gameObject.AddComponent <ColorSetting>(); newSet.colorSet = true; item.color = InvertColor(item.color); } else { if (!setting.colorSet) { setting.colorSet = true; item.color = InvertColor(item.color); } } } }
private void Rectangle_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) { ColorSetting setting = DataContext as ColorSetting; using (System.Windows.Forms.ColorDialog colorDialog = new System.Windows.Forms.ColorDialog()) { colorDialog.Color = System.Drawing.Color.FromArgb( setting.Value.bA, setting.Value.bR, setting.Value.bG, setting.Value.bB); if (colorDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) { setting.Value = new ColorSetting.Color( colorDialog.Color.A, colorDialog.Color.R, colorDialog.Color.G, colorDialog.Color.B); } } }
/// <summary> /// 会社コード入力値を検証し、InputCompanyプロパティ値を制御する。 /// </summary> private void ValidateCompanyCode() { ColorSetting.ClearLoadedColors(); if (string.IsNullOrEmpty(txtCompanyCode.Text)) { InputCompany = null; txtUserCode.Text = ""; return; } txtCompanyCode.Text = LeftPaddingZero(txtCompanyCode.Text); var result = GetCompanyByCode(ApplicationContext.Login.SessionKey, txtCompanyCode.Text); if (result == null || !result.ProcessResult.Result) { InputCompany = null; return; } var company = result.Company; InputCompany = company; }
private Prompt[] GetRandomPrompts(ColorSetting colorSetting) { Prompt[] prompts = new Prompt[_promptsPerSection]; for (int i = 0; i < prompts.Length; i++) { string randomColor; do { randomColor = AvailableColors[Random.Range(0, AvailableColors.Length)]; if (Translate) { randomColor = ToMalay[randomColor]; } }while(i > 0 && prompts[i - 1].Text == randomColor); prompts[i] = new Prompt(randomColor, colorSetting, this); } return(prompts); }
public string Read(ColorSetting setting) { return PlayerPrefs.GetString(KeysNames[setting]); }
public void ChangeValue(ColorSetting setting, string value) { PlayerPrefs.SetString(KeysNames[setting], value); }
private static void RenderPeptide(ValueRendererSettings rendererSettings, ValueRendererArgs rendererArgs, ValueRendererResult renderingResult) { PDRenderSettings settings = (PDRenderSettings)rendererSettings; if (settings.MaxAcidAmount == 0 || !rendererArgs.DataValue.HasValidValue) { RenderNullImage(rendererArgs, renderingResult); return; } bool isLable = rendererArgs.Width == rendererArgs.Height; int cellHeight = rendererArgs.Height; int cellWidth = rendererArgs.Width / settings.MaxAcidAmount; int fontSize = settings.FontSize; if (isLable) { cellHeight = cellWidth; } Regex regex = new Regex(@"PEPTIDE1\{(.+?)\}"); string cellValue = rendererArgs.DataValue.ValidValue.ToString(); if (!cellValue.Contains(".") || !regex.IsMatch(cellValue)) { Bitmap defaultImage = new Bitmap(rendererArgs.Width, rendererArgs.Height); using (Graphics g = Graphics.FromImage(defaultImage)) { g.DrawString(cellValue, new Font("Tahoma", 8), new SolidBrush(Color.Black), 0, 0); } renderingResult.SetImage(defaultImage); renderingResult.SetTooltip("Not a valid peptide sequence."); return; } var match = regex.Match(cellValue); List <string> peptideList = new List <string>(); List <string> linkerList = new List <string>(); // TODO: Change spliter to "\n" string[] linkerStringArray = cellValue.Split(new string[] { "\n" }, StringSplitOptions.None); if (linkerStringArray.Length == 2) { linkerList.AddRange(linkerStringArray[1].Split(new char[] { '.' })); } string[] monomerArray = match.Groups[1].Captures[0].Value.Split(new char[] { '.' }).ToArray(); for (var i = 0; i < monomerArray.Length; i++) { if (i == 0 && monomerArray[0].Contains("_")) { string[] saltMonomer = monomerArray[0].Split(new[] { '_' }); peptideList.Add(saltMonomer[0] + "-"); peptideList.Add(saltMonomer[1]); } else { peptideList.Add(monomerArray[i]); } } int startIndex = peptideList.Count - linkerList.Count; for (var i = peptideList.Count - 1; i >= startIndex; i--) { if (peptideList[i] == linkerList[i - startIndex]) { peptideList[i] = $"#{peptideList[i]}#"; } } if (cellWidth <= 0) { cellWidth = 1; } if (cellHeight <= 0) { cellHeight = 1; } Bitmap bitmap = new Bitmap(cellWidth * settings.MaxAcidAmount, cellHeight); using (Graphics g = Graphics.FromImage(bitmap)) { g.SmoothingMode = SmoothingMode.AntiAlias; for (int i = 0; i < peptideList.Count && i < settings.MaxAcidAmount; i++) { string monomer = peptideList[i].Replace("[", string.Empty).Replace("]", string.Empty); ColorSetting color = new ColorSetting { ForeColor = settings.DefaultFontColor, BackgroundColor = settings.DefaultBackgroundColor }; if (settings.ColorCodeTable.ContainsKey(monomer)) { color = settings.ColorCodeTable[monomer]; } if (monomer.Contains("(") && monomer.Contains(")")) { color = new ColorSetting { ForeColor = settings.BranchMonomerFontColor, BackgroundColor = settings.BranchMonomerBackgroundColor }; } if (monomer.StartsWith("#") && monomer.EndsWith("#")) { color = new ColorSetting { ForeColor = settings.DefaultFontColor, BackgroundColor = settings.DefaultBackgroundColor }; } if (monomer.StartsWith("(") && monomer.EndsWith(")")) { monomer = monomer.Replace("(", string.Empty).Replace(")", string.Empty); } monomer = monomer.Replace("#", string.Empty).Replace("#", string.Empty); Rectangle rect = new Rectangle(i * cellWidth, 0, cellWidth, cellHeight); g.FillRectangle(new SolidBrush(ColorTranslator.FromHtml(color.BackgroundColor)), rect); g.DrawRectangle(new Pen(Color.White), rect); FontFamily fontFamily = new FontFamily(settings.FontFamily); fontFamily.GetEmHeight(FontStyle.Regular); float ascent = fontFamily.GetCellAscent(FontStyle.Regular); float descent = fontFamily.GetCellDescent(FontStyle.Regular); float size = Convert.ToSingle(cellWidth) / 3 * (fontSize / 100f) * fontFamily.GetEmHeight(FontStyle.Regular) / (ascent + descent); if (isLable) { size = size * 2; } else if (monomer.Length > 3) { size = size * 4.5f / monomer.Length; } Font font = new Font(fontFamily, size, FontStyle.Regular); StringFormat sf = new StringFormat(); sf.Alignment = StringAlignment.Center; sf.LineAlignment = StringAlignment.Center; g.DrawString(monomer, font, new SolidBrush(ColorTranslator.FromHtml(color.ForeColor)), rect, sf); } } renderingResult.SetImage(bitmap); renderingResult.SetTooltip(rendererArgs.DataValue.ValidValue.ToString()); }
public string Read(ColorSetting setting) { return(PlayerPrefs.GetString(KeysNames[setting])); }
public async Task SetColorSettingAsync(ColorSetting setting) { await NoValue(RequestGenerator.Serialize("setColorSetting", ApiVersion.V1_0, setting)).ConfigureAwait(false); }
protected void TmpStatus(ColorSetting color, string msg, params object[] args) { Status(1, color, msg, args); }
public SettingsViewModel() { PanelColor = new PanelColorSetting() { Name = nameof(PanelOpacity) }; PrimaryColor = new PrimaryColorSetting() { Name = nameof(PrimaryColor) }; SecondaryColor = new ColorSetting() { Name = nameof(SecondaryColor) }; SecondaryColorL = new ColorSetting() { Name = nameof(SecondaryColorL) }; ForegroundColor = new ColorSetting() { Name = nameof(ForegroundColor) }; ForegroundColorL = new ColorSetting() { Name = nameof(ForegroundColorL) }; LyricForegroundColor = new ColorSetting() { Name = nameof(LyricForegroundColor) }; LyricHighlightColor = new ColorSetting() { Name = nameof(LyricHighlightColor) }; LyricShadowColor = new ShadowColorSetting() { Name = "LyricShadowEffect" }; TextShadowColor = new ShadowColorSetting() { Name = "TextShadowEffect" }; PrimaryFont = new FontSetting() { Name = nameof(PrimaryFont) }; LyricFont = new FontSetting() { Name = nameof(LyricFont) }; TextMediumFontSize = new DoubleSetting() { Name = nameof(TextMediumFontSize) }; TextSmallFontSize = new DoubleSetting() { Name = nameof(TextSmallFontSize) }; LyricMediumFontSize = new DoubleSetting() { Name = nameof(LyricMediumFontSize) }; LyricSmallFontSize = new DoubleSetting() { Name = nameof(LyricSmallFontSize) }; PanelOpacity = new OpacitySetting() { Name = nameof(PanelOpacity) }; MusicVolume = new VolumeSetting() { Name = nameof(MusicVolume) }; BackgroundCoverVisibility = new VisibilitySetting() { Name = nameof(BackgroundCoverVisibility) }; MiniBackgroundCoverVisibility = new VisibilitySetting() { Name = nameof(MiniBackgroundCoverVisibility) }; }
/// <summary> /// Use given color setting for host /// </summary> /// <param name="setting">given color setting</param> /// <returns>this</returns> public SuitHostBuilder ConfigureColor(ColorSetting setting) { ColorSetting = setting; return(this); }
internal static void DisplayXnaColors(this ToolStripComboBox comboBox, string defaultColor, ColorSetting setting) { // Make the ComboBox owner-drawn. comboBox.ComboBox.DrawMode = DrawMode.OwnerDrawVariable; comboBox.Items.Clear(); comboBox.Items.AddRange(sortedColors); // Subscribe to the DrawItem event. //cbo.MeasureItem += cboDrawImageAndText_MeasureItem; comboBox.ComboBox.DrawItem += ComboBox_DrawItem; comboBox.SelectedItem = defaultColor; comboBox.Tag = setting; }
/// <summary> /// Initializes a new instance of the <see cref="CardViewModel"/> class. /// </summary> /// <param name="navigationService">The navigation service.</param> /// <param name="colorSetting">The color setting.</param> public CardViewModel(INavigationService navigationService, ColorSetting colorSetting) { this.navigationService = navigationService; this.colorSetting = colorSetting; }
private void SetupColorComboBoxMenuItem(ToolStripComboBox menuItem, string selectColor, ColorSetting setting) { menuItem.DisplayXnaColors(selectColor, setting); menuItem.SelectedIndexChanged += BackgroundColorComboBoxMenuItem_SelectedIndexChanged; }