public virtual void DrawLink() { if (LogicMapEditor.logicMap != null) { if (LogicMapEditor.logicMap.startFunction != null) { foreach (BaseLogicNode node in LogicMapEditor.editor.nodes) { if (node is LogicFunctionNode) { if (LogicMapEditor.logicMap.startFunction == ((LogicFunctionNode)node).logicFunction) { startLogicNode = node; break; } } } } else { startLogicNode = null; } Rect windowRect = LogicMapEditor.logicMap.enterWindowRect; Vector2 startPos; Vector2 endPos; if (startLogicNode != null) { startPos = new Vector2(windowRect.xMax, windowRect.y + windowRect.height / 2); endPos = new Vector2(((LogicFunctionNode)startLogicNode).logicFunction.GetWindowRect().xMin, ((LogicFunctionNode)startLogicNode).logicFunction.GetWindowRect().y + 25); Vector2 startTan = startPos + Vector2.right * 50; Vector2 endTan = endPos + Vector2.left * 50; Color activeColor = Color.blue; Color backColor = Color.black; if (LogicMapEditor.logicMap.startRealize) { activeColor = Color.magenta; } backColor = new Color(backColor.r, backColor.g, backColor.b, 0.1f); int width = 2; Handles.DrawBezier(startPos, endPos, startTan, endTan, activeColor, null, width); } else if (selectLink) { Event e = Event.current; startPos = new Vector2(windowRect.xMax, windowRect.y + windowRect.height / 2); endPos = e.mousePosition; Vector2 startTan = startPos + Vector2.right * 50; Vector2 endTan = endPos + Vector2.left * 50; Color activeColor = Color.yellow; Color backColor = Color.black; backColor = new Color(backColor.r, backColor.g, backColor.b, 0.1f); int width = 2; Handles.DrawBezier(startPos, endPos, startTan, endTan, activeColor, null, width); } } }
public override void DrawLinks() { WaitFunction waitFunction = logicFunction as WaitFunction; Vector2 startPos; Vector2 endPos; if (waitFunction.actionOutput != null) { startPos = new Vector2(waitFunction.GetWindowRect().xMax, waitFunction.GetWindowRect().y + 30); BaseLogicNode outputNode = null; foreach (BaseLogicNode node in LogicMapEditor.editor.nodes) { if (node is LogicFunctionNode && ((LogicFunctionNode)node).logicFunction == waitFunction.actionOutput) { outputNode = node; } } endPos = new Vector2(((LogicFunctionNode)outputNode).logicFunction.GetWindowRect().xMin, ((LogicFunctionNode)outputNode).logicFunction.GetWindowRect().y + 25); Vector2 startTan = startPos + Vector2.right * 50; Vector2 endTan = endPos + Vector2.left * 50; Color activeColor = Color.blue; Color backColor = Color.black; if (waitFunction.realize) { activeColor = Color.magenta; } backColor = new Color(backColor.r, backColor.g, backColor.b, 0.1f); int width = 2; Handles.DrawBezier(startPos, endPos, startTan, endTan, activeColor, null, width); } }
public override void DrawLinks() { LogicSplitter logicSplitter = logicFunction as LogicSplitter; for (int j = 0; j < logicSplitter.actionOutputs.Count; j++) { LogicFunction output = logicSplitter.actionOutputs[j]; Vector2 startPos; Vector2 endPos; Color activeColor = Color.blue; Color backColor = Color.black; startPos = new Vector2(logicSplitter.windowRect.xMax, logicSplitter.windowRect.y + 10 + (j + 1) * 20); if (output != null) { BaseLogicNode outputNode = null; foreach (BaseLogicNode node in LogicMapEditor.editor.nodes) { if (node is LogicFunctionNode && ((LogicFunctionNode)node).logicFunction == output) { outputNode = node; } } endPos = new Vector2(((LogicFunctionNode)outputNode).logicFunction.windowRect.xMin, ((LogicFunctionNode)outputNode).logicFunction.windowRect.y + 25); if (logicSplitter.realizeOutputs[j]) { activeColor = Color.magenta; } } else { endPos = LogicMapEditor.editor.mousePos; activeColor = Color.yellow; } Vector2 startTan = startPos + Vector2.right * 50; Vector2 endTan = endPos + Vector2.left * 50; backColor = new Color(backColor.r, backColor.g, backColor.b, 0.1f); int width = 2; Handles.DrawBezier(startPos, endPos, startTan, endTan, activeColor, null, width); } }
public override void DrawLinks() { DataVariable dataFunction = dataVariable as DataVariable; Vector2 startPos; Vector2 endPos = Vector2.zero; if (dataFunction.dataOutput != null) { startPos = new Vector2(dataFunction.GetWindowRect().xMax, dataFunction.GetWindowRect().y + 25); BaseLogicNode outputNode = null; foreach (BaseLogicNode node in LogicMapEditor.editor.nodes) { if (node is LogicDataFunctionNode && ((LogicDataFunctionNode)node).dataFunction == dataFunction.dataOutput) { outputNode = node; } else if (node is DataSplitterNode && ((DataSplitterNode)node).logicFunction == dataFunction.dataOutput) { outputNode = node; } else if (node is DataVariableNode && ((DataVariableNode)node).dataVariable == dataFunction.dataOutput) { outputNode = node; } } if (outputNode is LogicNotNode) { endPos = new Vector2(((LogicNotNode)outputNode).dataFunction.GetWindowRect().xMin, ((LogicNotNode)outputNode).dataFunction.GetWindowRect().y + 25); } else if (outputNode is DataSplitterNode) { endPos = new Vector2(((DataSplitterNode)outputNode).logicFunction.GetWindowRect().xMin, ((DataSplitterNode)outputNode).logicFunction.GetWindowRect().y + 40); } else if (outputNode is LogicAndNode) { if (((LogicAND)((LogicAndNode)outputNode).dataFunction).dataInputOne == dataVariable) { endPos = new Vector2(((LogicAndNode)outputNode).dataFunction.GetWindowRect().xMin, ((LogicAndNode)outputNode).dataFunction.GetWindowRect().y + 25); } else if (((LogicAND)((LogicAndNode)outputNode).dataFunction).dataInputTwo == dataVariable) { endPos = new Vector2(((LogicAndNode)outputNode).dataFunction.GetWindowRect().xMin, ((LogicAndNode)outputNode).dataFunction.GetWindowRect().y + 45); } } else if (outputNode is LogicOrNode) { if (((LogicOR)((LogicOrNode)outputNode).dataFunction).dataInputOne == dataVariable) { endPos = new Vector2(((LogicOrNode)outputNode).dataFunction.GetWindowRect().xMin, ((LogicOrNode)outputNode).dataFunction.GetWindowRect().y + 25); } else if (((LogicOR)((LogicOrNode)outputNode).dataFunction).dataInputTwo == dataVariable) { endPos = new Vector2(((LogicOrNode)outputNode).dataFunction.GetWindowRect().xMin, ((LogicOrNode)outputNode).dataFunction.GetWindowRect().y + 45); } } else if (outputNode is EffectNode) { endPos = new Vector2(((EffectNode)outputNode).logicFunction.GetWindowRect().xMin, ((EffectNode)outputNode).logicFunction.GetWindowRect().y + 25); } else if (outputNode is DataVariableNode) { endPos = new Vector2(((DataVariable)((DataVariableNode)outputNode).dataVariable).GetWindowRect().xMin, ((DataVariable)((DataVariableNode)outputNode).dataVariable).GetWindowRect().y + 25); } Vector2 startTan = startPos + Vector2.right * 50; Vector2 endTan = endPos + Vector2.left * 50; Color activeColor = Color.black; Color backColor = Color.black; if (dataFunction.checkNode && dataFunction.result) { activeColor = Color.green; } else if (dataFunction.checkNode && !dataFunction.result) { activeColor = Color.red; } backColor = new Color(backColor.r, backColor.g, backColor.b, 0.1f); int width = 2; Handles.DrawBezier(startPos, endPos, startTan, endTan, activeColor, null, width); } else if (selectDataLink) { Event e = Event.current; startPos = new Vector2(dataFunction.GetWindowRect().xMax, dataFunction.GetWindowRect().y + 25); endPos = e.mousePosition; Vector2 startTan = startPos + Vector2.right * 50; Vector2 endTan = endPos + Vector2.left * 50; Color activeColor = Color.yellow; Color backColor = Color.black; backColor = new Color(backColor.r, backColor.g, backColor.b, 0.1f); int width = 2; Handles.DrawBezier(startPos, endPos, startTan, endTan, activeColor, null, width); } }
public override void DrawLinks() { ChooseTemperFunction function = logicFunction as ChooseTemperFunction; Vector2 startPos; Vector2 endPos; if (function.rudeOutput != null) { startPos = new Vector2(function.GetWindowRect().xMax, function.GetWindowRect().y + 25); BaseLogicNode outputNode = null; foreach (BaseLogicNode node in LogicMapEditor.editor.nodes) { if (node is LogicFunctionNode && ((LogicFunctionNode)node).logicFunction == function.rudeOutput) { outputNode = node; } } endPos = new Vector2(((LogicFunctionNode)outputNode).logicFunction.GetWindowRect().xMin, ((LogicFunctionNode)outputNode).logicFunction.GetWindowRect().y + 25); Vector2 startTan = startPos + Vector2.right * 50; Vector2 endTan = endPos + Vector2.left * 50; Color activeColor = Color.blue; Color backColor = Color.black; if (function.realizeRude) { activeColor = Color.magenta; } backColor = new Color(backColor.r, backColor.g, backColor.b, 0.1f); int width = 2; Handles.DrawBezier(startPos, endPos, startTan, endTan, activeColor, null, width); } if (function.prudentOutput != null) { startPos = new Vector2(function.GetWindowRect().xMax, function.GetWindowRect().y + 50); BaseLogicNode outputNode = null; foreach (BaseLogicNode node in LogicMapEditor.editor.nodes) { if (node is LogicFunctionNode && ((LogicFunctionNode)node).logicFunction == function.prudentOutput) { outputNode = node; } } endPos = new Vector2(((LogicFunctionNode)outputNode).logicFunction.GetWindowRect().xMin, ((LogicFunctionNode)outputNode).logicFunction.GetWindowRect().y + 25); Vector2 startTan = startPos + Vector2.right * 50; Vector2 endTan = endPos + Vector2.left * 50; Color activeColor = Color.blue; Color backColor = Color.black; if (function.realizePrudent) { activeColor = Color.magenta; } backColor = new Color(backColor.r, backColor.g, backColor.b, 0.1f); int width = 2; Handles.DrawBezier(startPos, endPos, startTan, endTan, activeColor, null, width); } if (function.mercifulOutput != null) { startPos = new Vector2(function.GetWindowRect().xMax, function.GetWindowRect().y + 75); BaseLogicNode outputNode = null; foreach (BaseLogicNode node in LogicMapEditor.editor.nodes) { if (node is LogicFunctionNode && ((LogicFunctionNode)node).logicFunction == function.mercifulOutput) { outputNode = node; } } endPos = new Vector2(((LogicFunctionNode)outputNode).logicFunction.GetWindowRect().xMin, ((LogicFunctionNode)outputNode).logicFunction.GetWindowRect().y + 25); Vector2 startTan = startPos + Vector2.right * 50; Vector2 endTan = endPos + Vector2.left * 50; Color activeColor = Color.blue; Color backColor = Color.black; if (function.realizeMerciful) { activeColor = Color.magenta; } backColor = new Color(backColor.r, backColor.g, backColor.b, 0.1f); int width = 2; Handles.DrawBezier(startPos, endPos, startTan, endTan, activeColor, null, width); } if (function.cruelOutput != null) { startPos = new Vector2(function.GetWindowRect().xMax, function.GetWindowRect().y + 100); BaseLogicNode outputNode = null; foreach (BaseLogicNode node in LogicMapEditor.editor.nodes) { if (node is LogicFunctionNode && ((LogicFunctionNode)node).logicFunction == function.cruelOutput) { outputNode = node; } } endPos = new Vector2(((LogicFunctionNode)outputNode).logicFunction.GetWindowRect().xMin, ((LogicFunctionNode)outputNode).logicFunction.GetWindowRect().y + 25); Vector2 startTan = startPos + Vector2.right * 50; Vector2 endTan = endPos + Vector2.left * 50; Color activeColor = Color.blue; Color backColor = Color.black; if (function.realizeCruel) { activeColor = Color.magenta; } backColor = new Color(backColor.r, backColor.g, backColor.b, 0.1f); int width = 2; Handles.DrawBezier(startPos, endPos, startTan, endTan, activeColor, null, width); } if (function.mercantileOutput != null) { startPos = new Vector2(function.GetWindowRect().xMax, function.GetWindowRect().y + 125); BaseLogicNode outputNode = null; foreach (BaseLogicNode node in LogicMapEditor.editor.nodes) { if (node is LogicFunctionNode && ((LogicFunctionNode)node).logicFunction == function.mercantileOutput) { outputNode = node; } } endPos = new Vector2(((LogicFunctionNode)outputNode).logicFunction.GetWindowRect().xMin, ((LogicFunctionNode)outputNode).logicFunction.GetWindowRect().y + 25); Vector2 startTan = startPos + Vector2.right * 50; Vector2 endTan = endPos + Vector2.left * 50; Color activeColor = Color.blue; Color backColor = Color.black; if (function.realizeMercantile) { activeColor = Color.magenta; } backColor = new Color(backColor.r, backColor.g, backColor.b, 0.1f); int width = 2; Handles.DrawBezier(startPos, endPos, startTan, endTan, activeColor, null, width); } if (function.principledOutput != null) { startPos = new Vector2(function.GetWindowRect().xMax, function.GetWindowRect().y + 150); BaseLogicNode outputNode = null; foreach (BaseLogicNode node in LogicMapEditor.editor.nodes) { if (node is LogicFunctionNode && ((LogicFunctionNode)node).logicFunction == function.principledOutput) { outputNode = node; } } endPos = new Vector2(((LogicFunctionNode)outputNode).logicFunction.GetWindowRect().xMin, ((LogicFunctionNode)outputNode).logicFunction.GetWindowRect().y + 25); Vector2 startTan = startPos + Vector2.right * 50; Vector2 endTan = endPos + Vector2.left * 50; Color activeColor = Color.blue; Color backColor = Color.black; if (function.realizePrincipled) { activeColor = Color.magenta; } backColor = new Color(backColor.r, backColor.g, backColor.b, 0.1f); int width = 2; Handles.DrawBezier(startPos, endPos, startTan, endTan, activeColor, null, width); } for (int i = 0; i < function.dialogOutputs.Count; i++) { if (function.dialogOutputs[i] != null) { startPos = new Vector2(function.GetWindowRect().xMax, function.windowRect.yMax - 20 * (function.dialogOutputs.Count - i) + 5); BaseLogicNode outputNode = null; foreach (BaseLogicNode node in LogicMapEditor.editor.nodes) { if (node is LogicFunctionNode && ((LogicFunctionNode)node).logicFunction == function.dialogOutputs[i]) { outputNode = node; } } endPos = new Vector2(((LogicFunctionNode)outputNode).logicFunction.GetWindowRect().xMin, ((LogicFunctionNode)outputNode).logicFunction.GetWindowRect().y + 25); Vector2 startTan = startPos + Vector2.right * 50; Vector2 endTan = endPos + Vector2.left * 50; Color activeColor = Color.blue; Color backColor = Color.black; if (function.realizeDialogOutput[i]) { activeColor = Color.magenta; } backColor = new Color(backColor.r, backColor.g, backColor.b, 0.1f); int width = 2; Handles.DrawBezier(startPos, endPos, startTan, endTan, activeColor, null, width); } } if (!function.dialogOutputFlag) { if (selectActionLink && function.temper == 0) { Event e = Event.current; startPos = new Vector2(function.GetWindowRect().xMax, function.GetWindowRect().y + 25); endPos = e.mousePosition; Vector2 startTan = startPos + Vector2.right * 50; Vector2 endTan = endPos + Vector2.left * 50; Color activeColor = Color.yellow; Color backColor = Color.black; backColor = new Color(backColor.r, backColor.g, backColor.b, 0.1f); int width = 2; Handles.DrawBezier(startPos, endPos, startTan, endTan, activeColor, null, width); } else if (selectActionLink && function.temper == 1) { Event e = Event.current; startPos = new Vector2(function.GetWindowRect().xMax, function.GetWindowRect().y + 50); endPos = e.mousePosition; Vector2 startTan = startPos + Vector2.right * 50; Vector2 endTan = endPos + Vector2.left * 50; Color activeColor = Color.yellow; Color backColor = Color.black; backColor = new Color(backColor.r, backColor.g, backColor.b, 0.1f); int width = 2; Handles.DrawBezier(startPos, endPos, startTan, endTan, activeColor, null, width); } else if (selectActionLink && function.temper == 2) { Event e = Event.current; startPos = new Vector2(function.GetWindowRect().xMax, function.GetWindowRect().y + 75); endPos = e.mousePosition; Vector2 startTan = startPos + Vector2.right * 50; Vector2 endTan = endPos + Vector2.left * 50; Color activeColor = Color.yellow; Color backColor = Color.black; backColor = new Color(backColor.r, backColor.g, backColor.b, 0.1f); int width = 2; Handles.DrawBezier(startPos, endPos, startTan, endTan, activeColor, null, width); } else if (selectActionLink && function.temper == 3) { Event e = Event.current; startPos = new Vector2(function.GetWindowRect().xMax, function.GetWindowRect().y + 100); endPos = e.mousePosition; Vector2 startTan = startPos + Vector2.right * 50; Vector2 endTan = endPos + Vector2.left * 50; Color activeColor = Color.yellow; Color backColor = Color.black; backColor = new Color(backColor.r, backColor.g, backColor.b, 0.1f); int width = 2; Handles.DrawBezier(startPos, endPos, startTan, endTan, activeColor, null, width); } else if (selectActionLink && function.temper == 4) { Event e = Event.current; startPos = new Vector2(function.GetWindowRect().xMax, function.GetWindowRect().y + 125); endPos = e.mousePosition; Vector2 startTan = startPos + Vector2.right * 50; Vector2 endTan = endPos + Vector2.left * 50; Color activeColor = Color.yellow; Color backColor = Color.black; backColor = new Color(backColor.r, backColor.g, backColor.b, 0.1f); int width = 2; Handles.DrawBezier(startPos, endPos, startTan, endTan, activeColor, null, width); } else if (selectActionLink && function.temper == 5) { Event e = Event.current; startPos = new Vector2(function.GetWindowRect().xMax, function.GetWindowRect().y + 150); endPos = e.mousePosition; Vector2 startTan = startPos + Vector2.right * 50; Vector2 endTan = endPos + Vector2.left * 50; Color activeColor = Color.yellow; Color backColor = Color.black; backColor = new Color(backColor.r, backColor.g, backColor.b, 0.1f); int width = 2; Handles.DrawBezier(startPos, endPos, startTan, endTan, activeColor, null, width); } } else { if (selectActionLink) { Event e = Event.current; startPos = new Vector2(function.GetWindowRect().xMax, function.windowRect.yMax - 20 * (function.dialogOutputs.Count - function.dialogOutputNum) + 10); endPos = e.mousePosition; Vector2 startTan = startPos + Vector2.right * 50; Vector2 endTan = endPos + Vector2.left * 50; Color activeColor = Color.yellow; Color backColor = Color.black; backColor = new Color(backColor.r, backColor.g, backColor.b, 0.1f); int width = 2; Handles.DrawBezier(startPos, endPos, startTan, endTan, activeColor, null, width); } } }
public override void DrawLinks() { ChallengeFunction function = logicFunction as ChallengeFunction; Vector2 startPos; Vector2 endPos; if (function.trueOutput != null) { startPos = new Vector2(function.GetWindowRect().xMax, function.GetWindowRect().y + 30); BaseLogicNode outputNode = null; foreach (BaseLogicNode node in LogicMapEditor.editor.nodes) { if (node is LogicFunctionNode && ((LogicFunctionNode)node).logicFunction == function.trueOutput) { outputNode = node; } } endPos = new Vector2(((LogicFunctionNode)outputNode).logicFunction.GetWindowRect().xMin, ((LogicFunctionNode)outputNode).logicFunction.GetWindowRect().y + 25); Vector2 startTan = startPos + Vector2.right * 50; Vector2 endTan = endPos + Vector2.left * 50; Color activeColor = Color.blue; Color backColor = Color.black; if (function.realizeTrue) { activeColor = Color.magenta; } backColor = new Color(backColor.r, backColor.g, backColor.b, 0.1f); int width = 2; Handles.DrawBezier(startPos, endPos, startTan, endTan, activeColor, null, width); } if (function.falseOutput != null) { startPos = new Vector2(function.GetWindowRect().xMax, function.GetWindowRect().y + 50); BaseLogicNode outputNode = null; foreach (BaseLogicNode node in LogicMapEditor.editor.nodes) { if (node is LogicFunctionNode && ((LogicFunctionNode)node).logicFunction == function.falseOutput) { outputNode = node; } } endPos = new Vector2(((LogicFunctionNode)outputNode).logicFunction.GetWindowRect().xMin, ((LogicFunctionNode)outputNode).logicFunction.GetWindowRect().y + 25); Vector2 startTan = startPos + Vector2.right * 50; Vector2 endTan = endPos + Vector2.left * 50; Color activeColor = Color.blue; Color backColor = Color.black; if (function.realizeFalse) { activeColor = Color.magenta; } backColor = new Color(backColor.r, backColor.g, backColor.b, 0.1f); int width = 2; Handles.DrawBezier(startPos, endPos, startTan, endTan, activeColor, null, width); } if (selectActionLink && function.trueFlag) { Event e = Event.current; startPos = new Vector2(function.GetWindowRect().xMax, function.GetWindowRect().y + 30); endPos = e.mousePosition; Vector2 startTan = startPos + Vector2.right * 50; Vector2 endTan = endPos + Vector2.left * 50; Color activeColor = Color.yellow; Color backColor = Color.black; backColor = new Color(backColor.r, backColor.g, backColor.b, 0.1f); int width = 2; Handles.DrawBezier(startPos, endPos, startTan, endTan, activeColor, null, width); } else if (selectActionLink && !function.trueFlag) { Event e = Event.current; startPos = new Vector2(function.GetWindowRect().xMax, function.GetWindowRect().y + 45); endPos = e.mousePosition; Vector2 startTan = startPos + Vector2.right * 50; Vector2 endTan = endPos + Vector2.left * 50; Color activeColor = Color.yellow; Color backColor = Color.black; backColor = new Color(backColor.r, backColor.g, backColor.b, 0.1f); int width = 2; Handles.DrawBezier(startPos, endPos, startTan, endTan, activeColor, null, width); } }