本文整理汇总了C#中UnityEngine.Color.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Color.ToString方法的具体用法?C# Color.ToString怎么用?C# Color.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UnityEngine.Color
的用法示例。
在下文中一共展示了Color.ToString方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Start
// Use this for initialization
void Start () {
Bitmap bitmap = new Bitmap("man_ok.png");
Texture2D tex2D = new Texture2D(bitmap.Width, bitmap.Height, TextureFormat.ARGB32, false);
tex2D.name = Path.GetFileNameWithoutExtension("man_ok.png");
for (int row = 0; row < bitmap.Height; row++)
{
for (int col = 0; col < bitmap.Width; col++)
{
System.Drawing.Color srcColor = bitmap.GetPixel(col, row);
UnityEngine.Color tgtColor = new UnityEngine.Color(srcColor.R, srcColor.G, srcColor.B, srcColor.A);
tex2D.SetPixel(col, row, tgtColor);
}
}
renderer.material.mainTexture = tex2D;
System.Drawing.Color srcColor1 = bitmap.GetPixel(100, 100);
UnityEngine.Color tgtColor1 = new UnityEngine.Color(srcColor1.R, srcColor1.G, srcColor1.B, srcColor1.A);
Debug.Log(tgtColor1.ToString());
Debug.Log(srcColor1.ToString());
tex2D.Apply();
// AssetDatabase.CreateFolder("", "hello");
//AssetDatabase.CreateAsset(tex2D, "dragon.asset");
}
示例2: OnGUI
void OnGUI()
{
GUILayout.Label("Render UVs", EditorStyles.boldLabel);
pb_GUI_Utility.DrawSeparator(2, pb_Constant.ProBuilderDarkGray);
GUILayout.Space(2);
imageSize = (ImageSize)EditorGUILayout.EnumPopup(new GUIContent("Image Size", "The pixel size of the image to be rendered."), imageSize);
hideGrid = EditorGUILayout.Toggle(new GUIContent("Hide Grid", "Hide or show the grid lines."), hideGrid);
lineColor = EditorGUILayout.ColorField(new GUIContent("Line Color", "The color of the template lines."), lineColor);
transparentBackground = EditorGUILayout.Toggle(new GUIContent("Transparent Background", "If true, only the template lines will be rendered, leaving the background fully transparent."), transparentBackground);
GUI.enabled = !transparentBackground;
backgroundColor = EditorGUILayout.ColorField(new GUIContent("Background Color", "If `TransparentBackground` is off, this will be the fill color of the image."), backgroundColor);
GUI.enabled = true;
if(GUILayout.Button("Save UV Template"))
{
EditorPrefs.SetInt(PREF_IMAGESIZE, (int)imageSize);
EditorPrefs.SetString(PREF_LINECOLOR, lineColor.ToString());
EditorPrefs.SetString(PREF_BACKGROUNDCOLOR, backgroundColor.ToString());
EditorPrefs.SetBool(PREF_TRANSPARENTBACKGROUND, transparentBackground);
EditorPrefs.SetBool(PREF_HIDEGRID, hideGrid);
if(pb_Editor.instance == null || pb_Editor.instance.selection.Length < 1)
{
Debug.LogWarning("Abandoning UV render because no ProBuilder objects are selected.");
this.Close();
return;
}
screenFunc((int)imageSize, hideGrid, lineColor, transparentBackground, backgroundColor);
this.Close();
}
}
示例3: Track
public Track(Color color)
{
this.Scol = new SColor(color);
name = "track: " + color.ToString();
}
示例4: CompareColors
/// <summary>
/// I need to compare this way because unity optimizes comparison and sometimes is not working,
/// and i don't want to work with alpha channel
/// </summary>
/// <param name="c1"></param>
/// <param name="c2"></param>
/// <returns></returns>
public static bool CompareColors(Color c1, Color c2)
{
if((c1.r == c2.r && c1.g == c2.g && c1.b == c2.b) || c1.ToString().Equals(c2.ToString()))
{
return true;
}
return false;
}
示例5: WWW
/*private IEnumerator LoadBundle()
{
WWW www = new WWW("File:///" + Application.dataPath + "/Mods/Resources/ManyFlares.assetbundle");
yield return www;
AssetBundle asset = www.assetBundle;
Debug.Log("Load Asset completed!");
AssetBundleRequest request = asset.LoadAssetAsync("50mmZoom.flare", typeof(Flare));
yield return request;
Debug.Log("Load Asset completed!");
Flare go = request.asset as Flare;
go.name = "GOOOO";
DontDestroyOnLoad(go);
OkGo = true;
foreach(UnityEngine.Object obj in asset.LoadAllAssets())
{
Instantiate(obj);
}
asset.Unload(false);
}*/
void Start()
{
//Application.LoadLevel (5);
StartCoroutine(SkyBox());
Commands.RegisterHelpMessage("CLOUDS!");
Commands.RegisterCommand("ResetCloudsAmount", (args, notUses) =>
{
if (args.Length < 1)
{
return "ERROR!";
}
try
{
int cccloudcloudAmount = int.Parse(args[0]);
if (cccloudcloudAmount < 0 || cccloudcloudAmount > 3000) { return "Your cloud amount is not available. "; }
else { cloudAmount = cccloudcloudAmount; 保存设定(); }
}
catch
{
return "Could not parse " + args[0] + "to cloud amount";
}
return "There will be " + cloudAmount.ToString() + " clouds";
}, "Reset the amount of clouds. No bigger than 3000 and no less than 2.");//Amount
Commands.RegisterCommand("ResetCloudsSizeScale", (args, notUses) =>
{
if (args.Length < 1)
{
return "ERROR!";
}
try
{
float cccloudcloudSizeScale = float.Parse(args[0]);
if (cccloudcloudSizeScale <= 0) { return "Your cloud size scale is not available. "; }
else { cloudSizeScale = cccloudcloudSizeScale; 保存设定(); }
}
catch
{
return "Could not parse " + args[0] + "to cloud size scale";
}
return "The clouds' size scale will be " + cloudSizeScale.ToString();
}, "Reset Clouds' Size Scale");//SizeScale
Commands.RegisterCommand("ResetLowerCloudsMinHeight", (args, notUses) =>
{
if (args.Length < 1)
{
return "ERROR!";
}
try
{
float llllowerCloudsMinHeight = float.Parse(args[0]);
if (llllowerCloudsMinHeight >= lowerCloudsMaxHeight) { return "Your lower cloud minimum height is not available. "; }
else { lowerCloudsMinHeight = llllowerCloudsMinHeight; 保存设定(); }
}
catch
{
return "Could not parse " + args[0] + "to lower cloud minimum height";
}
return "The lower clouds' minimum height will be " + lowerCloudsMinHeight.ToString();
}, "Reset Lower Clouds' Min Height");//ResetLowerCloudsMinHeight
Commands.RegisterCommand("ResetLowerCloudsMaxHeight", (args, notUses) =>
{
if (args.Length < 1)
{
return "ERROR!";
}
try
{
float llllowerCloudsMaxHeight = float.Parse(args[0]);
if (llllowerCloudsMaxHeight <= lowerCloudsMinHeight) { return "Your lower cloud maximum height is not available. "; }
else { lowerCloudsMaxHeight = llllowerCloudsMaxHeight; 保存设定(); }
}
catch
//.........这里部分代码省略.........
示例6: ModifyPlanet
private void ModifyPlanet(CelestialBody oldB, CelestialBody newB)
{
Debug.Log("Planitron: ModifyPlanet oldB.GetName() = " + oldB.GetName());
Debug.Log("Planitron: ModifyPlanet newB.GetName() = " + newB.GetName());
_currentPlanetName = newB.GetName();
RoundedGeeASL = newB.GeeASL;
RoundedGeeASL = Math.Round(RoundedGeeASL, 2);
_currentGee = RoundedGeeASL.ToString();
if (newB.atmosphere)
{
_currentatmosphereMultiplier = newB.atmosphereMultiplier.ToString();
}
else
{
_currentatmosphereMultiplier = "None";
}
_currentOxygen = newB.atmosphereContainsOxygen;
oldB.atmoshpereTemperatureMultiplier = newB.atmoshpereTemperatureMultiplier;
oldB.atmosphere = newB.atmosphere;
oldB.atmosphereContainsOxygen = newB.atmosphereContainsOxygen;
oldB.atmosphereMultiplier = newB.atmosphereMultiplier;
oldB.atmosphereScaleHeight = newB.atmosphereScaleHeight;
col_R = newB.atmosphericAmbientColor.r;
col_G = newB.atmosphericAmbientColor.g;
col_B = newB.atmosphericAmbientColor.b;
col_A = newB.atmosphericAmbientColor.a;
col_RGBA = new Color(col_R, col_G, col_B, col_A);
oldB.atmosphericAmbientColor = col_RGBA;
oldB.GeeASL = newB.GeeASL;
oldB.gMagnitudeAtCenter = newB.gMagnitudeAtCenter;
oldB.gravParameter = newB.gravParameter;
oldB.Mass = newB.Mass;
oldB.pressureMultiplier = newB.pressureMultiplier;
oldB.staticPressureASL = newB.staticPressureASL;
Debug.Log(" ");
Debug.Log("Planitron: ModifyPlanet: New Values for vessel.mainBody ----------------------------");
Debug.Log("Planitron: ModifyPlanet Post Name = " + oldB.GetName());
Debug.Log("Planitron: ModifyPlanet Post atmoshpereTemperatureMultiplier = " + oldB.atmoshpereTemperatureMultiplier);
Debug.Log("Planitron: ModifyPlanet Post atmosphere = " + oldB.atmosphere);
Debug.Log("Planitron: ModifyPlanet Post atmosphereContainsOxygen = " + oldB.atmosphereContainsOxygen);
Debug.Log("Planitron: ModifyPlanet Post atmosphereMultiplier = " + oldB.atmosphereMultiplier);
Debug.Log("Planitron: ModifyPlanet Post atmosphereScaleHeight = " + oldB.atmosphereScaleHeight);
Debug.Log("Planitron: ModifyPlanet Post col_RGBA.ToString = " + col_RGBA.ToString());
Debug.Log("Planitron: ModifyPlanet Post col_RGBA = " + col_RGBA);
Debug.Log("Planitron: ModifyPlanet Post atmosphericAmbientColor = " + oldB.atmosphericAmbientColor.ToString());
Debug.Log("Planitron: ModifyPlanet Post GeeASL = " + oldB.GeeASL);
Debug.Log("Planitron: ModifyPlanet Post gMagnitudeAtCenter = " + oldB.gMagnitudeAtCenter);
Debug.Log("Planitron: ModifyPlanet Post gravParameter = " + oldB.gravParameter);
Debug.Log("Planitron: ModifyPlanet Post Mass = " + oldB.Mass);
Debug.Log("Planitron: ModifyPlanet Post pressureMultiplier = " + oldB.pressureMultiplier);
Debug.Log("Planitron: ModifyPlanet Post staticPressureASL = " + oldB.staticPressureASL);
Debug.Log(" ");
Debug.Log(" ");
}
开发者ID:philotical,项目名称:PlanitronReloaded,代码行数:58,代码来源:PlanitronReloaded_v0.0.03.06_stable_final_released.cs
示例7: SetPlayer
public void SetPlayer(int player,Color color)
{
Debug.Log(name +": "+ player.ToString() + " " + color.ToString());
m_Image.sprite = m_PlayerSprites[player];
m_Image.color = color;
}