Exemplo n.º 1
0
        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 abstract object visit(Room room);
 public override object visit(Room room)
 {
     int rid = m_flatter.Nodes.IndexOf(room);
       String name = room.Name;
       m_cmd.CommandText = "INSERT INTO rooms (rid, chid, name) VALUES ("+rid+", 1,'"+name+"');";
       m_cmd.ExecuteNonQuery();
       foreach (ObjProperty prop in room.Properties)
       {
     //we have values, but no responses
     if (prop.Values.Count != 0 && ((ObjValue)prop.Values[0]).Responses.Count != 0)
     {
       //static property
       ++m_statpropid;
       m_cmd.CommandText = "INSERT INTO staticproperties (propid, rid, objid, property) VALUES ("+m_statpropid+", "+rid+", NULL, '"+prop.Name+"');";
       m_cmd.ExecuteNonQuery();
     }
     foreach (ObjValue val in prop.Values)
     {
       string value = Convert.ToString(val.Value);
       if (val.Responses.Count == 0)
       {
     //dynamic property
     ++m_propid;
     m_cmd.CommandText = "INSERT INTO properties (propid, chid, rid, objid, property, value) VALUES ("+m_propid+", 0, "+rid+", NULL, '"+prop.Name+"', "+value+");";
     m_cmd.ExecuteNonQuery();
       }
       foreach (ObjResponse resp in val.Responses)
       {
     m_cmd.CommandText = "INSERT INTO responses (respid, propid, value, opcode, argument1, argument2) VALUES ("+m_respid+", "+m_statpropid+", "+value+", "+Convert.ToString((int)resp.Operation)+", '"+(string)resp.Arguments[0]+"', '"+(string)resp.Arguments[1]+"');";
     m_cmd.ExecuteNonQuery();
     ++m_respid;
       }
     }
       }
       //visit edges
       foreach (GraphEdge edge in room.Successors)
       {
     edge.getVisited(this);
       }
       return null;
 }
Exemplo n.º 4
0
 private void startingroom_SelectedIndexChanged(object sender, EventArgs e)
 {
     m_startroom = (Room)((ComboBox)sender).SelectedItem;
 }