本文整理汇总了C#中UnityEditor.MaterialEditor.ColorProperty方法的典型用法代码示例。如果您正苦于以下问题:C# MaterialEditor.ColorProperty方法的具体用法?C# MaterialEditor.ColorProperty怎么用?C# MaterialEditor.ColorProperty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UnityEditor.MaterialEditor
的用法示例。
在下文中一共展示了MaterialEditor.ColorProperty方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DissolveControl
private void DissolveControl(MaterialEditor target)
{
Header("Dissolve", "http://wiki.next-gen-sprites.com/doku.php?id=shaders:feature:dissolve");
target.TextureProperty(_dissolveMap, "Dissolve Pattern", scaleOffset: false);
target.RangeProperty(_dissolveBlend, "Blend");
GUILayout.Space(5f);
target.RangeProperty(_dissolveBorderWidth, "Border Width");
target.ColorProperty(_dissolveGlowColor, "Border Glow Tint");
target.RangeProperty(_dissolveGlowStrength, "Border Glow width");
GUILayout.Space(10f);
DrawWideBox(1f);
if (!_shaderCompileKeywords.Contains(ShaderFeature.Dissolve.GetString()))
EditorGUI.EndDisabledGroup();
}
示例2: OnGUI
override public void OnGUI(Rect position, MaterialProperty prop, string label, MaterialEditor editor) {
//Debug.Log("OnGUI: " + label + " RTP_MaterialProp");
if (!parsed)
{
parsed = true;
parsedLabel = RTP_MatPropStringParser.Parse(label);
}
label = parsedLabel;
if (editor is RTP_CustomShaderGUI)
{
RTP_CustomShaderGUI customEditor = editor as RTP_CustomShaderGUI;
if (customEditor.showFlag && (show_for_active_layer == -1 || customEditor.active_layer == show_for_active_layer) && prop.name!= "dummy_end") {
EditorGUI.BeginDisabledGroup(customEditor.inactiveFlag);
switch (prop.type)
{
//case MaterialProperty.PropType.Range: // float ranges
// {
// editor.RangeProperty(position, prop, label);
// break;
// }
//case MaterialProperty.PropType.Float: // floats
// {
// editor.FloatProperty(position, prop, label);
// break;
// }
case MaterialProperty.PropType.Color: // colors
{
EditorGUIUtility.labelWidth -= 30;
if (noAlphaFlag)
{
EditorGUI.ColorField(position, new GUIContent(label, ""), prop.colorValue, true, false, false, null);
}
else
{
editor.ColorProperty(position, prop, label);
}
break;
}
case MaterialProperty.PropType.Texture: // textures
{
EditorGUI.BeginChangeCheck();
if (miniThumbFlag)
{
editor.TexturePropertyMiniThumbnail(position, prop, label,"");
} else
{
editor.TextureProperty(position, prop, label, !noTileOffsetFlag);
}
if (EditorGUI.EndChangeCheck() && prop.textureValue!=null && sharedTextures!=null)
{
for(int j=0; j<sharedTextures.Length; j++)
{
foreach(Material mat in editor.targets)
{
if (mat.HasProperty(sharedTextures[j]))
{
mat.SetTexture(sharedTextures[j], prop.textureValue);
}
}
}
}
break;
}
case MaterialProperty.PropType.Vector: // vectors
{
if (byLayerFlag)
{
//
// affect single vector component depending on active layer
//
int layerNum = customEditor.active_layer;
float pval = prop.vectorValue[layerNum];
float nval;
if (minVal == maxVal)
{
// float
EditorGUIUtility.labelWidth -= 23;
nval = EditorGUI.FloatField(position, label, pval);
}
else
{
// slider
EditorGUIUtility.labelWidth = 160;
nval = EditorGUI.Slider(position, label, pval, minVal, maxVal);
}
if (pval!=nval)
{
for(int i=0; i< prop.targets.Length; i++)
{
Material mat = (prop.targets[i] as Material);
Vector4 vec = mat.GetVector(prop.name);
vec[layerNum] = nval;
mat.SetVector(prop.name, vec);
}
}
//.........这里部分代码省略.........
示例3: EmissionControl
private void EmissionControl(MaterialEditor target, bool noDisablegroup)
{
Header("Emission", "http://wiki.next-gen-sprites.com/doku.php?id=shaders:feature:emission");
target.RangeProperty(_emissionStrength, "Strength");
if (_hasEmissionTint)
{
target.ColorProperty(_emissionTint, "Tint");
GUILayout.Space(5f);
target.TextureProperty(_emissionMask, "Mask");
}
GUILayout.Space(10f);
DrawWideBox(1f);
//Turn off the Disable group?
if (noDisablegroup) return;
if (!_shaderCompileKeywords.Contains(ShaderFeature.Emission.GetString()))
EditorGUI.EndDisabledGroup();
}
示例4: CurvatureControl
private void CurvatureControl(MaterialEditor target)
{
Header("Curvature", "http://wiki.next-gen-sprites.com/doku.php?id=shaders:fx:lava#curvature");
target.TextureProperty(_curvatureMap, "Curvature Map");
target.RangeProperty(_curvatureDepth, "Depth");
target.ColorProperty(_curvatureHighlight, "Highlight Color");
target.RangeProperty(_curvatureGloss, "Gloss");
GUILayout.Space(10f);
DrawWideBox(1f);
if (!_shaderCompileKeywords.Contains(ShaderFeature.Curvature.GetString()))
EditorGUI.EndDisabledGroup();
}
示例5: SpriteControl
private void SpriteControl(MaterialEditor target)
{
target.TextureProperty(_mainSprite, "Sprite", scaleOffset: false);
if (_hasSpriteTint)
target.ColorProperty(_mainSpriteTint, "Tint");
GUILayout.Space(10f);
DrawWideBox(1f);
}
示例6: MainView
//This is the Main view with all shader controlls
private void MainView(MaterialEditor materialEditor)
{
GUILayout.Space(5f);
switch (_setPanel)
{
case SettingsMode.Sprites:
EditorGUILayout.BeginHorizontal();
GUILayout.FlexibleSpace();
ButtonOpenUrl(_btnHelp, "http://wiki.next-gen-sprites.com/doku.php?id=shaders:feature:sprite");
GUILayout.Space(10f);
EditorGUILayout.EndHorizontal();
GUILayout.Space(5f);
materialEditor.TextureProperty(_mainSprite, "Sprite", scaleOffset: false);
DrawWideBox();
GUILayout.Space(10f);
GUILayout.BeginHorizontal();
materialEditor.ColorProperty(_mainSpriteTint, "Tint");
if (GUILayout.Button("Reset Tint"))
{
_matTarget.SetColor(ShaderColor.Sprite.GetString(), Color.white);
}
GUILayout.EndHorizontal();
GUILayout.Space(15f);
ToggleFeature(_matTarget, "Main Layer Scrolling", ShaderFeature.SpriteScrolling);
GUILayout.Space(5f);
materialEditor.RangeProperty(_spriteLayer1ScrollingX, "X-Axis");
materialEditor.RangeProperty(_spriteLayer1ScrollingY, "Y-Axis");
GUILayout.BeginHorizontal();
if (GUILayout.Button("Reset Scrolling"))
{
_matTarget.SetFloat(ShaderFloat.SpriteLayer0ScrollingX.GetString(), 0f);
_matTarget.SetFloat(ShaderFloat.SpriteLayer0ScrollingY.GetString(), 0f);
}
GUILayout.FlexibleSpace();
GUILayout.EndHorizontal();
EditorGUI.EndDisabledGroup();
GUILayout.Space(5f);
DrawWideBox();
GUILayout.Space(5f);
ToggleFeature(_matTarget, "Multi Layer", ShaderFeature.SpriteMultiLayer, disableGroup: false);
if (_matTarget.IsKeywordEnabled(ShaderFeature.SpriteMultiLayer.GetString()))
{
EditorGUILayout.BeginHorizontal();
GUILayout.FlexibleSpace();
ButtonOpenUrl(_btnHelp, "http://wiki.next-gen-sprites.com/doku.php?id=shaders:feature:sprite#multi_layer");
GUILayout.Space(10f);
EditorGUILayout.EndHorizontal();
ToggleFeature(_matTarget, "Stencil Mask", ShaderFeature.SpriteStencil, disableGroup: true);
materialEditor.TextureProperty(_spriteLayerStencil, "Stencil Mask");
EditorGUILayout.BeginHorizontal();
GUILayout.FlexibleSpace();
EditorGUILayout.HelpBox("Red: Layer 1# | Green: Layer 2# | Blue: Layer 3#", MessageType.None);
GUILayout.FlexibleSpace();
EditorGUILayout.EndHorizontal();
DrawWideBox();
EditorGUI.EndDisabledGroup();
GUILayout.Box("Layer 1#", EditorStyles.miniButton);
materialEditor.TextureProperty(_spriteLayer2Tex, "Sprite");
GUILayout.Space(10f);
materialEditor.RangeProperty(_spriteLayer2Opacity, "Opacity");
materialEditor.ColorProperty(_spriteLayer2Color, "Tint");
materialEditor.RangeProperty(_spriteLayer2ScrollingX, "Scrolling X-Axis");
materialEditor.RangeProperty(_spriteLayer2ScrollingY, "Scrolling Y-Axis");
GUILayout.Space(10f);
GUILayout.BeginHorizontal();
GUILayout.FlexibleSpace();
if (GUILayout.Button("Reset"))
{
_matTarget.SetFloat(ShaderFloat.SpriteLayer1Opacity.GetString(), 1f);
_matTarget.SetColor(ShaderColor.SpriteLayer1.GetString(), Color.white);
_matTarget.SetFloat(ShaderFloat.SpriteLayer1ScrollingX.GetString(), 0f);
_matTarget.SetFloat(ShaderFloat.SpriteLayer1ScrollingY.GetString(), 0f);
}
GUILayout.EndHorizontal();
GUILayout.Space(10f);
DrawWideBox();
GUILayout.Box("Layer 2#", EditorStyles.miniButton);
materialEditor.TextureProperty(_spriteLayer3Tex, "Sprite");
GUILayout.Space(10f);
materialEditor.RangeProperty(_spriteLayer3Opacity, "Opacity");
materialEditor.ColorProperty(_spriteLayer3Color, "Tint");
materialEditor.RangeProperty(_spriteLayer3ScrollingX, "Scrolling X-Axis");
materialEditor.RangeProperty(_spriteLayer3ScrollingY, "Scrolling Y-Axis");
//.........这里部分代码省略.........
示例7: OnGUI
override public void OnGUI(Rect position, MaterialProperty prop, string label, MaterialEditor editor) {
bool inactiveFlag = false;
if (!checkNormalmapsUsage(editor.target as Material, label)) return;
if (!checkDetailUsage(editor.target as Material, label)) return;
if (!checkSpecUsage(editor.target as Material, label)) return;
#if UNITY_5
if (prop.name=="unity_SpecCube" || prop.name=="unity_SpecCube1") return;
#endif
if (checkVisible (editor, label, ref inactiveFlag)) {
EditorGUI.BeginDisabledGroup(inactiveFlag);
switch (prop.type) {
case MaterialProperty.PropType.Range: // float ranges
{
editor.RangeProperty(position, prop, label);
break;
}
case MaterialProperty.PropType.Float: // floats
{
editor.FloatProperty(position, prop, label);
break;
}
case MaterialProperty.PropType.Color: // colors
{
editor.ColorProperty(position, prop, label);
break;
}
case MaterialProperty.PropType.Texture: // textures
{
editor.TextureProperty(position, prop, label, texTileOffset);
break;
}
case MaterialProperty.PropType.Vector: // vectors
{
position.x+=12;
position.width-=12;
editor.VectorProperty(position, prop, label);
break;
}
default:
{
GUILayout.Label("Unknown prop type... ("+label+")");
break;
}
}
EditorGUI.EndDisabledGroup();
}
}