public Settings(RoomGraph graph) { // // Required for Windows Form Designer support // InitializeComponent(); m_graph = graph; m_startroom = null; m_type = Factory.ObjectType.Settings; m_startroomindex = -1; }
public override object visit(RoomGraph graph) { //flatten the graph for further processing m_flatter = new GraphFlattenVisitor(); m_graph.getVisited(m_flatter); //initialize tables m_cmd.CommandText = "CREATE TABLE characters (chid INTEGER PRIMARY KEY, name VARCHAR(50), curr_room INTEGER);"; m_cmd.ExecuteNonQuery(); m_cmd.CommandText = "CREATE TABLE rooms (rid INTEGER, chid INTEGER, name VARCHAR(50), PRIMARY KEY(rid,chid));"; m_cmd.ExecuteNonQuery(); m_cmd.CommandText = "CREATE TABLE room_connections (frm INTEGER, too INTEGER, chid INTEGER, type INTEGER(1), PRIMARY KEY (frm, too, chid));"; m_cmd.ExecuteNonQuery(); m_cmd.CommandText = "CREATE TABLE staticproperties (propid INTEGER PRIMARY KEY, rid INTEGER, objid INTEGER, property VARCHAR(50));"; m_cmd.ExecuteNonQuery(); m_cmd.CommandText = "CREATE TABLE properties (propid INTEGER, chid INTEGER, rid INTEGER, objid INTEGER, property VARCHAR(50), value INTEGER, PRIMARY KEY (propid, chid));"; m_cmd.ExecuteNonQuery(); m_cmd.CommandText = "CREATE TABLE responses (respid INTEGER PRIMARY KEY, propid INTEGER, value INTEGER, opcode INTEGER, argument1 TEXT, argument2 TEXT);"; m_cmd.ExecuteNonQuery(); //insert default character Room start = m_settings.StartRoom; if (start == null) { MessageBox.Show("Error: No starting room set!"); } else { int idx = m_flatter.Nodes.IndexOf(start); m_cmd.CommandText = "INSERT INTO characters (chid, name, curr_room) VALUES (0, 'Default', " + idx + ");"; m_cmd.ExecuteNonQuery(); } //visit graph foreach (GraphNode node in graph.Roots) { node.getVisited(this); } return(null); }
public override object visit(RoomGraph graph) { //flatten the graph for further processing m_flatter = new GraphFlattenVisitor(); m_graph.getVisited(m_flatter); //initialize tables m_cmd.CommandText = "CREATE TABLE characters (chid INTEGER PRIMARY KEY, name VARCHAR(50), curr_room INTEGER);"; m_cmd.ExecuteNonQuery(); m_cmd.CommandText = "CREATE TABLE rooms (rid INTEGER, chid INTEGER, name VARCHAR(50), PRIMARY KEY(rid,chid));"; m_cmd.ExecuteNonQuery(); m_cmd.CommandText = "CREATE TABLE room_connections (frm INTEGER, too INTEGER, chid INTEGER, type INTEGER(1), PRIMARY KEY (frm, too, chid));"; m_cmd.ExecuteNonQuery(); m_cmd.CommandText = "CREATE TABLE staticproperties (propid INTEGER PRIMARY KEY, rid INTEGER, objid INTEGER, property VARCHAR(50));"; m_cmd.ExecuteNonQuery(); m_cmd.CommandText = "CREATE TABLE properties (propid INTEGER, chid INTEGER, rid INTEGER, objid INTEGER, property VARCHAR(50), value INTEGER, PRIMARY KEY (propid, chid));"; m_cmd.ExecuteNonQuery(); m_cmd.CommandText = "CREATE TABLE responses (respid INTEGER PRIMARY KEY, propid INTEGER, value INTEGER, opcode INTEGER, argument1 TEXT, argument2 TEXT);"; m_cmd.ExecuteNonQuery(); //insert default character Room start = m_settings.StartRoom; if (start == null) MessageBox.Show("Error: No starting room set!"); else { int idx = m_flatter.Nodes.IndexOf(start); m_cmd.CommandText = "INSERT INTO characters (chid, name, curr_room) VALUES (0, 'Default', "+idx+");"; m_cmd.ExecuteNonQuery(); } //visit graph foreach (GraphNode node in graph.Roots) { node.getVisited(this); } return null; }
public abstract object visit(RoomGraph graph);