void NodeSelected(Base control) { Alt.GUI.Temporary.Gwen.Control.TreeNode node = control as Alt.GUI.Temporary.Gwen.Control.TreeNode; if (node != null && node.UserData != null) { ExampleNode example = node.UserData as ExampleNode; if (example != null) { if (m_LastControl != null) { if (m_LastControl != null) { if (m_ExamplePanel != null) { m_ExamplePanel.RemoveChild(m_LastControl, false); } try { m_LastControl.Dispose(); m_LastControl = null; } catch { } } } m_LastControl = example.CreateExample(m_ExamplePanel); m_Caption.Text = TitlePrefix + (string.IsNullOrEmpty(example.m_Description) ? node.Text : example.m_Description); } } }
protected override void GenerateConstructor(Node node, StreamWriter stream, string indent, string className) { base.GenerateConstructor(node, stream, indent, className); ExampleNode wait = node as ExampleNode; Debug.Check(wait != null); stream.WriteLine("{0}\t\t\tm_ignoreTimeScale = {1};", indent, wait.IgnoreTimeScale ? "true" : "false"); }
public override Node Create(Vector2 pos) { ExampleNode node = CreateInstance <ExampleNode> (); node.rect = new Rect(pos.x, pos.y, 150, 60); node.name = "Example Node"; node.CreateInput("Value", "Float"); node.CreateOutput("Output val", "Float"); return(node); }
public void Shutdown() { foreach (Base b in m_ExamplesList.Children) { CollapsibleCategory cat = b as CollapsibleCategory; foreach (Base button in cat.Children) { ExampleNode node = button.UserData as ExampleNode; if (node != null && node.m_Example != null) { if (node.m_Example == m_LastControl) { node.m_Example = null; continue; } try { node.m_Example.Dispose(); node.m_Example = null; } catch { } } } } if (m_LastControl != null) { if (m_Center != null) { m_Center.RemoveChild(m_LastControl, false); } try { m_LastControl.Dispose(); m_LastControl = null; } catch { } } m_Center.Children.Clear(); }
private void WriteExample(ExampleNode node, int number, string category) { WriteMethodAttributes(number, category); _sb.Write("public void "); _sb.Write(string.Format(Definitions.TestMethodNameFormat, number)); _sb.WriteLine("()"); WriteOpenBracket(); //WriteComment("Example " + number); //WriteComment("Section: " + category); //WriteComment(null); WriteComment("Source:"); foreach (var s in node.MarkdownNodes) { WriteComment(s.Lexeme, true); } WriteComment(null); WriteComment("Expected result:"); foreach (var s in node.HtmlNodes) { WriteComment(s.Lexeme, true); } _sb.WriteLine(); _sb.Write(Definitions.HelperMethodName); _sb.Write("("); _sb.Write(number.ToString()); _sb.Write(", \""); _sb.Write(category); _sb.WriteLine("\","); _sb.IndentLevel++; _sb.Write("\""); _sb.Write(Excape(node.MarkdownNodes.Select(n => n.Lexeme))); _sb.WriteLine("\","); _sb.Write("\""); _sb.Write(Excape(node.HtmlNodes.Select(n => n.Lexeme))); _sb.WriteLine("\");"); _sb.IndentLevel--; WriteCloseBracket(); }
protected override void GenerateMethod(Node node, StreamWriter stream, string indent) { base.GenerateMethod(node, stream, indent); ExampleNode wait = node as ExampleNode; Debug.Check(wait != null); if (wait.Time != null) { stream.WriteLine("{0}\t\tvirtual float GetTime(Agent* pAgent) const", indent); stream.WriteLine("{0}\t\t{{", indent); stream.WriteLine("{0}\t\t\tBEHAVIAC_UNUSED_VAR(pAgent);", indent); string retStr = VariableCppExporter.GenerateCode(wait.Time, stream, indent + "\t\t\t", string.Empty, string.Empty, string.Empty); stream.WriteLine("{0}\t\t\treturn {1};", indent, retStr); stream.WriteLine("{0}\t\t}}", indent); } }
public void Part2Example() { Assert.AreEqual(66, ExampleNode.CalculateValue()); }