|
|
@ -2113,87 +2113,87 @@ namespace Fungus.EditorUtils |
|
|
|
windowRelativeRect.position += flowchart.ScrollPos; |
|
|
|
windowRelativeRect.position += flowchart.ScrollPos; |
|
|
|
|
|
|
|
|
|
|
|
//skip if outside of view |
|
|
|
//skip if outside of view |
|
|
|
if (!scriptViewRect.Overlaps(windowRelativeRect)) |
|
|
|
if (scriptViewRect.Overlaps(windowRelativeRect)) |
|
|
|
return; |
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
var tmpNormBg = nodeStyle.normal.background; |
|
|
|
var tmpNormBg = nodeStyle.normal.background; |
|
|
|
|
|
|
|
|
|
|
|
// Draw untinted highlight |
|
|
|
// Draw untinted highlight |
|
|
|
if (block.IsSelected && !block.IsControlSelected) |
|
|
|
if (block.IsSelected && !block.IsControlSelected) |
|
|
|
{ |
|
|
|
{ |
|
|
|
GUI.backgroundColor = Color.white; |
|
|
|
GUI.backgroundColor = Color.white; |
|
|
|
nodeStyle.normal.background = graphics.onTexture; |
|
|
|
nodeStyle.normal.background = graphics.onTexture; |
|
|
|
GUI.Box(windowRelativeRect, "", nodeStyle); |
|
|
|
GUI.Box(windowRelativeRect, "", nodeStyle); |
|
|
|
nodeStyle.normal.background = tmpNormBg; |
|
|
|
nodeStyle.normal.background = tmpNormBg; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (block.IsControlSelected && !block.IsSelected) |
|
|
|
if (block.IsControlSelected && !block.IsSelected) |
|
|
|
{ |
|
|
|
{ |
|
|
|
GUI.backgroundColor = Color.white; |
|
|
|
GUI.backgroundColor = Color.white; |
|
|
|
nodeStyle.normal.background = graphics.onTexture; |
|
|
|
nodeStyle.normal.background = graphics.onTexture; |
|
|
|
var c = GUI.backgroundColor; |
|
|
|
var c = GUI.backgroundColor; |
|
|
|
c.a = 0.5f; |
|
|
|
c.a = 0.5f; |
|
|
|
GUI.backgroundColor = c; |
|
|
|
GUI.backgroundColor = c; |
|
|
|
GUI.Box(windowRelativeRect, "", nodeStyle); |
|
|
|
GUI.Box(windowRelativeRect, "", nodeStyle); |
|
|
|
nodeStyle.normal.background = tmpNormBg; |
|
|
|
nodeStyle.normal.background = tmpNormBg; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Draw tinted block; ensure text is readable |
|
|
|
// Draw tinted block; ensure text is readable |
|
|
|
var brightness = graphics.tint.r * 0.3 + graphics.tint.g * 0.59 + graphics.tint.b * 0.11; |
|
|
|
var brightness = graphics.tint.r * 0.3 + graphics.tint.g * 0.59 + graphics.tint.b * 0.11; |
|
|
|
var tmpNormTxtCol = nodeStyle.normal.textColor; |
|
|
|
var tmpNormTxtCol = nodeStyle.normal.textColor; |
|
|
|
nodeStyle.normal.textColor = brightness >= 0.5 ? Color.black : Color.white; |
|
|
|
nodeStyle.normal.textColor = brightness >= 0.5 ? Color.black : Color.white; |
|
|
|
|
|
|
|
|
|
|
|
switch (block.FilterState) |
|
|
|
switch (block.FilterState) |
|
|
|
{ |
|
|
|
{ |
|
|
|
case Block.FilteredState.Full: |
|
|
|
case Block.FilteredState.Full: |
|
|
|
break; |
|
|
|
break; |
|
|
|
case Block.FilteredState.Partial: |
|
|
|
case Block.FilteredState.Partial: |
|
|
|
graphics.tint.a *= 0.65f; |
|
|
|
graphics.tint.a *= 0.65f; |
|
|
|
break; |
|
|
|
break; |
|
|
|
case Block.FilteredState.None: |
|
|
|
case Block.FilteredState.None: |
|
|
|
graphics.tint.a *= 0.2f; |
|
|
|
graphics.tint.a *= 0.2f; |
|
|
|
break; |
|
|
|
break; |
|
|
|
default: |
|
|
|
default: |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
nodeStyle.normal.background = graphics.offTexture; |
|
|
|
nodeStyle.normal.background = graphics.offTexture; |
|
|
|
GUI.backgroundColor = graphics.tint; |
|
|
|
GUI.backgroundColor = graphics.tint; |
|
|
|
GUI.Box(windowRelativeRect, block.BlockName, nodeStyle); |
|
|
|
GUI.Box(windowRelativeRect, block.BlockName, nodeStyle); |
|
|
|
|
|
|
|
|
|
|
|
GUI.backgroundColor = Color.white; |
|
|
|
GUI.backgroundColor = Color.white; |
|
|
|
|
|
|
|
|
|
|
|
if (block.Description.Length > 0) |
|
|
|
if (block.Description.Length > 0) |
|
|
|
{ |
|
|
|
{ |
|
|
|
var content = new GUIContent(block.Description); |
|
|
|
var content = new GUIContent(block.Description); |
|
|
|
windowRelativeRect.y += windowRelativeRect.height; |
|
|
|
windowRelativeRect.y += windowRelativeRect.height; |
|
|
|
windowRelativeRect.height = descriptionStyle.CalcHeight(content, windowRelativeRect.width); |
|
|
|
windowRelativeRect.height = descriptionStyle.CalcHeight(content, windowRelativeRect.width); |
|
|
|
GUI.Label(windowRelativeRect, content, descriptionStyle); |
|
|
|
GUI.Label(windowRelativeRect, content, descriptionStyle); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
GUI.backgroundColor = Color.white; |
|
|
|
GUI.backgroundColor = Color.white; |
|
|
|
|
|
|
|
|
|
|
|
nodeStyle.normal.textColor = tmpNormTxtCol; |
|
|
|
nodeStyle.normal.textColor = tmpNormTxtCol; |
|
|
|
nodeStyle.normal.background = tmpNormBg; |
|
|
|
nodeStyle.normal.background = tmpNormBg; |
|
|
|
|
|
|
|
|
|
|
|
// Draw Event Handler labels |
|
|
|
// Draw Event Handler labels |
|
|
|
if (block._EventHandler != null) |
|
|
|
if (block._EventHandler != null) |
|
|
|
{ |
|
|
|
|
|
|
|
string handlerLabel = ""; |
|
|
|
|
|
|
|
EventHandlerInfoAttribute info = EventHandlerEditor.GetEventHandlerInfo(block._EventHandler.GetType()); |
|
|
|
|
|
|
|
if (info != null) |
|
|
|
|
|
|
|
{ |
|
|
|
{ |
|
|
|
handlerLabel = "<" + info.EventHandlerName + "> "; |
|
|
|
string handlerLabel = ""; |
|
|
|
} |
|
|
|
EventHandlerInfoAttribute info = EventHandlerEditor.GetEventHandlerInfo(block._EventHandler.GetType()); |
|
|
|
|
|
|
|
if (info != null) |
|
|
|
Rect rect = new Rect(block._NodeRect); |
|
|
|
{ |
|
|
|
rect.height = handlerStyle.CalcHeight(new GUIContent(handlerLabel), block._NodeRect.width); |
|
|
|
handlerLabel = "<" + info.EventHandlerName + "> "; |
|
|
|
rect.x += flowchart.ScrollPos.x; |
|
|
|
} |
|
|
|
rect.y += flowchart.ScrollPos.y - rect.height; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GUI.Label(rect, handlerLabel, handlerStyle); |
|
|
|
Rect rect = new Rect(block._NodeRect); |
|
|
|
} |
|
|
|
rect.height = handlerStyle.CalcHeight(new GUIContent(handlerLabel), block._NodeRect.width); |
|
|
|
|
|
|
|
rect.x += flowchart.ScrollPos.x; |
|
|
|
|
|
|
|
rect.y += flowchart.ScrollPos.y - rect.height; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GUI.Label(rect, handlerLabel, handlerStyle); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
DrawConnections(block); |
|
|
|
DrawConnections(block); |
|
|
|
} |
|
|
|
} |
|
|
|