ColorComponent(Vector4 color, ColorTypes type) : this() { IsValid = true; Tag = ElementTag.New(); Color = color; Type = type; }
void OnTriggerEnter2D(Collider2D other) { if (other.gameObject.GetComponent <GetColor>()) { if (currentColor == ColorTypes.NONE || other.gameObject.GetComponent <GetColor>().currentColor != currentColor) { currentColor = other.gameObject.GetComponent <GetColor>().currentColor; gameManagerRef.Score += 5; gameManagerRef.CurrentChain += 1; if (gameManagerRef.CurrentChain % 5 == 0) { GetPowerup(); } Destroy(other.gameObject); } else if (currentColor == other.gameObject.GetComponent <GetColor>().currentColor) { gameManagerRef.Score -= 5; gameManagerRef.Lives -= 1; Destroy(other.gameObject); } } }
internal ColorData(string name, string escapeSequence, Color color, ColorTypes type) { Name = name; EscapeSequence = escapeSequence; Color = color; Type = type; }
/// <summary> /// Get a circle of the specified color - create if one does not exist. /// </summary> /// <param name="color"></param> /// <returns></returns> public static IShape GetCircle(ColorTypes color) { if (!shapesByColor.ContainsKey(color)) { shapesByColor.Add(color, new DimensionalCircle(color)); Console.WriteLine($"Created {color} circle."); } return(shapesByColor[color]); }
/// <summary> /// Creates a new instance of PngHeader /// </summary> public PngHeader(int width, int height) { _width = width; _height = height; _bitdepth = BitDepths.Eight; _colortype = ColorTypes.TruecolorAlpha; _interlaceMethod = InterlaceMethods.NoInterlacing; }
public void SetToAutomaticTitleBar() { if (frameworkElement.ActualTheme == ElementTheme.Light) { SetToLightTitleBar(true); } else { SetToDarkTitleBar(true); } ColorType = ColorTypes.Automatic; }
public void SetTitleBarColor(Color color, bool suppressColorTypeChange = false) { formattableTitleBar.ButtonForegroundColor = color; formattableTitleBar.ButtonHoverForegroundColor = color; formattableTitleBar.ButtonPressedForegroundColor = color; formattableTitleBar.InactiveForegroundColor = color; formattableTitleBar.ButtonHoverBackgroundColor = Color.FromArgb(20, color.R, color.G, color.B); formattableTitleBar.ButtonPressedBackgroundColor = Color.FromArgb(40, color.R, color.G, color.B); if (suppressColorTypeChange == false) { ColorType = ColorTypes.Custom; } }
public void Initialize(int number, int count, int maxCount, ColorTypes colorType, Image baseLine) { BarImage.color = ColorPresets[(int)colorType]; baseLine.color = ColorPresets[(int)colorType]; NumberText.color = ColorPresets[(int)colorType]; NumberText.text = number != 10 ? number.ToString() : "10+"; CountText.text = count > 0 ? count.ToString() : ""; if (maxCount == 0) { SliderBar.value = 0; } else { SliderBar.value = (float)count / maxCount; } }
void SpawnBox() { Color color = Color.gray; ColorTypes colorType = ColorTypes.UNSET; int temp = Random.Range(0, 5); switch (temp) { case 0: color = Color.blue; colorType = ColorTypes.BLUE; break; case 1: color = Color.green; colorType = ColorTypes.GREEN; break; case 2: color = Color.red; colorType = ColorTypes.RED; break; case 3: color = Color.yellow; colorType = ColorTypes.YELLOW; break; case 4: color = Color.magenta; colorType = ColorTypes.MAGENTA; break; default: Debug.LogWarning("BoxSpawner::SpawnBox::ColorOutOfRange"); break; } GameObject boxGO = Instantiate(boxPrefab, transform.position, Quaternion.identity) as GameObject; boxGO.GetComponentInChildren <SpriteRenderer>().color = color; boxGO.GetComponent <Box>().colorType = colorType; }
public void UpdateSpriteColor() { sprite.color = ColorTypes.ColorByType(myColor); }
static void Main(string[] args) { //***** Exemple 1 ***** // Spécifiez une instance de balise. ColorTypes tagValue = ColorTypes.Rouge; if (tagValue == ColorTypes.Rouge) { // Sera afficher. Console.WriteLine("Rouge"); } else { // Ne Sera pas afficher. Console.WriteLine("Pas Vrai"); } Console.WriteLine(); //Affiche : //Rouge //***** Exemple 2 ***** //Console.WriteLine peut appeler automatiquement la méthode ToString. // ... Deux variables enum. ColorTypes color = ColorTypes.Bleu; VisibilityTypes visible = VisibilityTypes.Hidden; // ... Utilisez Console.WriteLine pour imprimer les valeurs d'héritier. Console.WriteLine(color); Console.WriteLine(visible); Console.WriteLine(); //***** Exemple 3 ***** // ... Test enum avec la méthode switch. FormatTypes formatValue = FormatTypes.None; if (IsFormat(formatValue)) { // Ceci n'est pas atteint, car None ne renvoie pas une vraie valeur dans IsFormat. Console.WriteLine("Error"); } // ... Testez une autre énumération avec switch. formatValue = FormatTypes.ItalicsFormat; if (IsFormat(formatValue)) { // Ceci est imprimé, car nous recevons true de IsFormat. Console.WriteLine("True"); } Console.WriteLine(); //Affiche : //True //*********************************************************** // ***** recupere un Char defini dans l'enum ***** CharTypes charEnum = CharTypes.AnoniemNIETActive; Console.WriteLine("{0}: {1}", (char)charEnum, charEnum); Console.WriteLine(); //Affiche : //R : AnoniemNIETActive // ***** recupere un string defini dans l'enum ***** ColorTypes colorType = ColorTypes.Bleu; Console.WriteLine(colorType); Console.WriteLine("string : " + colorType + ", " + "Valeur : " + (int)colorType); Console.WriteLine(); //Affiche : //Bleu //string : Bleu, Valeur : 33 //ou foreach (var item in Enum.GetNames(typeof(ColorTypes)).ToList()) { Console.WriteLine(item); } Console.WriteLine(); //Affiche : //Rouge //Vert //Bleu // ***** recupere les valeurs defini dans l'enum ***** foreach (int item in Enum.GetValues(typeof(ColorTypes))) { Console.WriteLine(item); } Console.WriteLine(); //Affiche : //0 //1 //2 //33 foreach (int item in Enum.GetValues(typeof(CharTypes))) { Console.WriteLine(item); } Console.WriteLine(); //Affiche : //32 //65 //82 //87 //90 Console.WriteLine((char)(int)CharTypes.Archive); Console.WriteLine((char)CharTypes.AnoniemActive); Console.WriteLine(CharTypes.AnoniemActive); }
public DimensionalCircle(ColorTypes color) { mColor = color; }
public ShapeDef(int shapeType, ColorTypes colour) { m_shapeType = shapeType; m_colour = colour; }
/// <summary> /// 表示输出一个适用于 Bootstrap 风格的 div 元素,该元素将使用 alert 作为 class 样式。 /// </summary> /// <param name="htmlHelper">此方法扩展的 HTML 帮助器实例。</param> /// <param name="color">警告框的颜色风格,参见 Bootstrap 样式。</param> /// <param name="content">文本内容。</param> /// <param name="htmlAttributes">一个对象,其中包含要为该元素设置的 HTML 特性。</param> /// <returns>一个 适用于 Bootstrap 风格的 HTML div 元素。</returns> public static MvcHtmlString BootstrapAlert(this HtmlHelper htmlHelper, string content, ColorTypes color = ColorTypes.Primary, object htmlAttributes = null) { var attributes = HtmlHelper.ObjectToDictionary(htmlAttributes); attributes.AddOrMerge("class", "alert"); attributes.BuildColorClass(" alert-", color); TagBuilder tag = new TagBuilder("div"); tag.InnerHtml += content; tag.MergeAttributes(attributes); return(MvcHtmlString.Create(tag.ToString())); }
/// <summary> /// 为 BootstrapValidationSummary 控件添加相应的消息。当在 View 中使用 Html.BootstrapValidationSummary 时会输出对应颜色的内容。 /// </summary> /// <param name="modelState">被扩展的ModelStateDictionary对象</param> /// <param name="colorType">Bootstrap颜色类型,最后将输出同一种颜色的消息</param> /// <param name="content">自定义内容。</param> public static void AddBootstrapValidationMessage(this ModelStateDictionary modelState, ColorTypes colorType, string content) { modelState.AddModelError("bootstrap-validation-message-{0}".StringFormat(colorType), content); }
/// <summary> /// 返回适用于 Bootstrap 中的 System.Web.Mvc.ModelStateDictionary 对象中的验证消息的未排序列表(ul 元素),并使用 alert 样式进行布局。 /// </summary> /// <param name="htmlHelper">此方法扩展的 HTML 帮助器实例。</param> /// <param name="colorType">输出指定颜色类型的验证信息。</param> /// <param name="hasClose">一个布尔值,表示是否输出 "X" 并由关闭当前的 alert 效果。</param> /// <param name="htmlAttributes">一个对象,其中包含要为该元素设置的 HTML 特性。</param> /// <returns>一个字符串,其中包含验证消息的未排序列表(ul 元素)。</returns> public static MvcHtmlString BootstrapValidationSummary(this HtmlHelper htmlHelper, ColorTypes colorType = ColorTypes.Danger, bool hasClose = true, object htmlAttributes = null) { var errorCollection = htmlHelper.ViewData.ModelState["bootstrap-validation-message-{0}".StringFormat(colorType)]; if (errorCollection != null) { var errorBuilder = new StringBuilder(); if (hasClose) { errorBuilder.AppendLine("<button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-label=\"Close\"><span aria-hidden = \"true\"> ×</span></button>"); } errorBuilder.AppendLine("<ul>"); foreach (var error in errorCollection.Errors) { errorBuilder.AppendLine($"<li><strong>{error.ErrorMessage}</strong></li>"); } errorBuilder.AppendLine("</ul>"); return(htmlHelper.BootstrapAlert(errorBuilder.ToString(), colorType, htmlAttributes)); } return(MvcHtmlString.Empty); }
public static SolidColorBrush GetColor(ColorTypes color, double opacity = 1) { return(GetFromString(ColorList[color].Color, opacity)); }
public AnimalDef(AnimalTypes animalType, ColorTypes colour) { m_animalType = animalType; m_colour = colour; }
public virtual int GetSpriteColor() { currentColor = (ColorTypes)Random.Range(0, 3); return((int)currentColor); }
/// <summary> /// 根据ColorType生成对应的Bootstrap所适应的颜色class /// </summary> /// <param name="attributes">该元素设置的 HTML 特性。</param> /// <param name="prefix">前缀,例如按钮是btn。</param> /// <param name="color">颜色</param> public static void BuildColorClass(this IDictionary <string, object> attributes, string prefix = null, ColorTypes color = ColorTypes.Primary) { attributes.AddOrMerge("class", " {0}{1} ".StringFormat(prefix, color.ToString().ToLower())); }
public Budgie(string name, int age, ColorTypes color) : base(name, age, Bird.FoodTypes.Herbivore) { Color = color; }
public static IColor Get(ColorTypes color) { return(ColorList[color]); }