當前位置: 首頁>>代碼示例>>C#>>正文


C# Color.ToString方法代碼示例

本文整理匯總了C#中Color.ToString方法的典型用法代碼示例。如果您正苦於以下問題:C# Color.ToString方法的具體用法?C# Color.ToString怎麽用?C# Color.ToString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Color的用法示例。


在下文中一共展示了Color.ToString方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: SetMapNameSimple

	public void SetMapNameSimple( string _strName, Color _color)
	{
		m_strMapName = _strName;
		m_TempColor = _color;

		mapName.Text = m_TempColor.ToString() + _strName;
		RsetSize();
	}
開發者ID:ftcaicai,項目名稱:ArkClient,代碼行數:8,代碼來源:UIZoneImg.cs

示例2: FromColor

        public static string FromColor(Color color)
        {
            KeyValuePair<string, Color> pair = _colorMap.FirstOrDefault(a => a.Value == color);

            if (pair.Value == null)
                throw new Exception("Cannot find BackColorname for: " + color.ToString());

            return pair.Key;
        }
開發者ID:mrommel,項目名稱:MiRo.SimHexWorld,代碼行數:9,代碼來源:ColorConversion.cs

示例3: CreateTileSprite

    // TODO this method probably belongs somewhere else
    public static Sprite CreateTileSprite(Color color, int size)
    {
        var texture = new Texture2D(size, size);
        var colors = Enumerable.Repeat<Color>(color, size * size).ToArray();
        texture.SetPixels(0, 0, size, size, colors);

        var sprite = Sprite.Create(texture, new Rect(0f, 0f, texture.width, texture.height), Vector2.zero);
        sprite.name = color.ToString();
        return sprite;
    }
開發者ID:ntl92bk,項目名稱:UnityTileMap,代碼行數:11,代碼來源:TilePainter.cs

示例4: GenerateEvent

 //generates and enables a point event
 static void GenerateEvent()
 {
     //	current_color = colors[0];
     current_color = colors[Random.Range(0,colors.Length)];
     current_dur = durations[Random.Range(0,durations.Length)];
     current_mul = multipliers[Random.Range(0,multipliers.Length)];
     event_on = true;
     last_event_generated = Time.time;
     Debug.Log("new event generated: "+current_color.ToString()+" "+current_dur+" "+current_mul);
 }
開發者ID:mbc1990,項目名稱:Orb,代碼行數:11,代碼來源:Event_Generator.cs

示例5: parse

        public override void parse(string curLine)
        {
            TextParser tp = new TextParser();
            actionType = ActionType.Fade;

            color = ColorUtils.colorFromHexString(curLine.Substring(6, 6));
            color.A = 0;
            time = int.Parse(tp.seperateWords(curLine)[2]);
            Console.WriteLine("Parsed a fade! Color " + color.ToString());
            elapsed = 0;
        }
開發者ID:TheMightyComp,項目名稱:LibCSL,代碼行數:11,代碼來源:FadeAction.cs

示例6: FormatColourString

 public static string FormatColourString(Color colour, ColourRepresentations format)
 {
     switch (format)
     {
         case ColourRepresentations.RGB:
             return colour.R.ToString() + "," + colour.G.ToString() + "," + colour.B.ToString();
         case ColourRepresentations.Hex:
             return "#" + colour.ToArgb().ToString("X6");
         default:
             return colour.ToString();
     }
 }
開發者ID:tdwright,項目名稱:ColourPickerComponents,代碼行數:12,代碼來源:ColourHandler.cs

示例7: SpriteLayer

        public SpriteLayer(string mat, Color c)
        {
            MatName = mat;
            LayerColor = c;

            Material baseMat = Resources.Load(mat) as Material;
            if (baseMat == null)
            {
                Debug.Log("Unable to load material " + mat);
                return;
            }

            LayerMaterial = new Material(baseMat);

            LayerImage = LayerMaterial.mainTexture;
            LayerMaterial.name += c.ToString();
            LayerMaterial.color = c;
        }
開發者ID:JeffM2501,項目名稱:CSC370,代碼行數:18,代碼來源:SpriteManager.cs

示例8: Button_PicColor

    public void Button_PicColor(UnityEngine.UI.Button f_button)
    {
        Debug.Log("Picking Color");
        UnityEngine.UI.ColorBlock cb = f_button.colors;
        playerColor = cb.normalColor;
        Debug.Log("Picked: " + cb.normalColor.ToString());

        cb = colorButton.colors;
        cb.normalColor = playerColor;
        cb.pressedColor = playerColor;
        cb.highlightedColor = playerColor;
        Debug.Log("New Player Color: "+playerColor.ToString());
        colorButton.colors = cb;

        colorButton.gameObject.SetActive(true);
        colorPickerPanel.gameObject.SetActive(false);
        SettingsController.GetInstance().playerFile.Color = playerColor;
    }
開發者ID:simonides,項目名稱:space_concept,代碼行數:18,代碼來源:StartMenuController.cs

示例9: Create

        public static Texture2D Create(GraphicsDevice graphicsDevice, int width, int height, Color color)
        {
            string key = color.ToString () + width + "x" + height;
            if (textureCache.ContainsKey (key)) {
                return textureCache [key];
            }
            else {
                // create a texture with the specified size
                Texture2D texture = new Texture2D (graphicsDevice, width, height);

                // fill it with the specified colors
                Color[] colors = new Color[width * height];
                for (int i = 0; i < colors.Length; i++) {
                    colors [i] = new Color (color.ToVector3 ());
                }
                texture.SetData (colors);
                textureCache [key] = texture;
                return texture;
            }
        }
開發者ID:knot3,項目名稱:knot3-prototype,代碼行數:20,代碼來源:TextureHelper.cs

示例10: changeColor

 void changeColor(GameObject brick)
 {
     //Color color = brick.transform.renderer.material.color;
     SpriteRenderer sr = GetComponent<SpriteRenderer>();
     Color color = sr.color;
     Color ORANGE = new Color(0.934f, 0.409f, 0.124f, 1.00f);
     Color GOLD = new Color(1.000f, 0.929f, 0.037f, 1.000f);
     Color BLUE = new Color(0.026f, 0.396f, 0.893f, 1.000f);
     if (color.ToString().Equals(ORANGE.ToString()))
     {
         sr.color = GOLD;
     }
     else if (color.ToString().Equals(GOLD.ToString()))
     {
         sr.color = BLUE;
     }
     else if (color.ToString().Equals(BLUE.ToString()))
     {
         sr.color = new Color(1f, 1f, 1f, 1f);
     }
 }
開發者ID:Xociety,項目名稱:Retro-,代碼行數:21,代碼來源:BrickCollision.cs

示例11: Combine

        public static Color Combine(this Color color, Color otherColor)
        {
            // primary combinations
            if ((color == Red && otherColor == Blue) || (color == Blue && otherColor == Red))
                return Purple;
            if ((color == Blue && otherColor == Yellow) || (color == Yellow && otherColor == Blue))
                return Green;
            if ((color == Red && otherColor == Yellow) || (color == Yellow && otherColor == Red))
                return Orange;

            // redundant color combinations
            if (color.Contains(otherColor))
                return color;
            if (otherColor.Contains(color))
                return otherColor;

            #if DEBUG
            Console.WriteLine(String.Format("Possibly unsupported color combination: {0} and {1}", color.ToString(), otherColor.ToString()));
            #endif
            return Black;
        }
開發者ID:akbiggs,項目名稱:Trauma,代碼行數:21,代碼來源:ColorHelper.cs

示例12: Initialise

	public void Initialise(int _maxPoints, float _width, Color _colour, string speciesName) {
		maxPoints = _maxPoints;
		width = _width;
		colour = _colour;
		name = speciesName + " " + colour.ToString();
	}
開發者ID:jxz12,項目名稱:ecosystems_game,代碼行數:6,代碼來源:Graph.cs

示例13: CheckGetQuestItem

	public void CheckGetQuestItem(int iItemID)
	{
		Item nowItem = ItemMgr.ItemManagement.GetItem(iItemID);

		if (nowItem.ItemData.GetItemType() != Item.eITEM_TYPE.UseItem)
			return;

		if (nowItem.ItemData.GetSubType() != (int)Item.eUSE_ITEM.GetQuest)
			return;

		Color textColor = new Color(1.0f, 0.717f, 0.0627f, 1.0f);

		System.Text.StringBuilder sb = new System.Text.StringBuilder(textColor.ToString());
		sb.Append(AsTableManager.Instance.GetTbl_String(2134));

		ArkQuestmanager.instance.ShowBalloonRewardMsgBox(sb.ToString(), AsTableManager.Instance.GetTbl_String(2134), 10.0f);
	}
開發者ID:ftcaicai,項目名稱:ArkClient,代碼行數:17,代碼來源:Inventory.cs

示例14: SetActiveColor

    public void SetActiveColor(string color)
    {
        Color activeColor = new Color();
        switch (color)
        {
        case "red":
            activeColor = Color.red;
            break;
        case "blue":
            activeColor = Color.blue;
            break;
        case "yellow":
            activeColor = Color.yellow;
            break;
        case "green":
            activeColor = Color.green;
            break;
        case "black":
            activeColor = Color.black;
            break;
        default:
            activeColor = Color.black;
            break;
        }

        AccessCamera.SendMessage("setColor", activeColor.ToString());
    }
開發者ID:rinkenuyten,項目名稱:ExpoDraw,代碼行數:27,代碼來源:UIScript.cs

示例15: OnSetColor

	public void OnSetColor(Color color)
	{
		Debug.Log ("on set color, " + color.ToString ());

		foreach (int id in _selectedMaterials) {
			_materialColors[id] = color;
			_materialsDict[id].GetComponent<MaterialLineController>().SetColor (color);

			// TODO refresh mesh color
			_demo.RefreshMesh();
		}
		
	}
開發者ID:whztt07,項目名稱:PolyWorldEditor,代碼行數:13,代碼來源:MaterialsController.cs


注:本文中的Color.ToString方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。