本文整理汇总了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();
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例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();
}
}
示例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;
}
示例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;
}
示例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;
}
}
示例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);
}
}
示例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;
}
示例12: Initialise
public void Initialise(int _maxPoints, float _width, Color _colour, string speciesName) {
maxPoints = _maxPoints;
width = _width;
colour = _colour;
name = speciesName + " " + colour.ToString();
}
示例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);
}
示例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());
}
示例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();
}
}