home *** CD-ROM | disk | FTP | other *** search
/ PC Plus SuperCD (UK) 2002 September / PCPlus_193_Laplink2000.iso / Prog / c# / wombat / MainForm.cs < prev    next >
Encoding:
Text File  |  2002-05-07  |  7.2 KB  |  249 lines

  1. using System;
  2. using System.Drawing;
  3. using System.Collections;
  4. using System.ComponentModel;
  5. using System.Windows.Forms;
  6. using System.Data;
  7.  
  8. namespace wombat
  9. {
  10.     /*
  11.      * TO DO:
  12.      * 
  13.      */
  14.  
  15.     /// <summary>
  16.     /// Summary description for Form1.
  17.     /// </summary>
  18.     public class MainForm : System.Windows.Forms.Form
  19.     {
  20.         private System.Windows.Forms.Panel panel1;
  21.         private System.Windows.Forms.TextBox inputTB;
  22.         private System.Windows.Forms.TextBox displayTB;
  23.         private System.Windows.Forms.Button takeBtn;
  24.         private System.Windows.Forms.Button dropBtn;
  25.         private System.Windows.Forms.Button lookBtn;
  26.         private System.Windows.Forms.Button northBtn;
  27.         private System.Windows.Forms.Button westBtn;
  28.         private System.Windows.Forms.Button southBtn;
  29.         private System.Windows.Forms.Button eastBtn;
  30.         private System.Windows.Forms.Button testBtn;
  31.         private System.Windows.Forms.Button testBtn2;
  32.         /// <summary>
  33.         /// Required designer variable.
  34.         /// </summary>
  35.         private System.ComponentModel.Container components = null;
  36.  
  37.         public MainForm()
  38.         {
  39.             //
  40.             // Required for Windows Form Designer support
  41.             //
  42.             InitializeComponent();
  43.  
  44.             //
  45.             // TODO: Add any constructor code after InitializeComponent call
  46.             //
  47.         }
  48.  
  49.         /// <summary>
  50.         /// Clean up any resources being used.
  51.         /// </summary>
  52.         protected override void Dispose( bool disposing )
  53.         {
  54.             if( disposing )
  55.             {
  56.                 if (components != null) 
  57.                 {
  58.                     components.Dispose();
  59.                 }
  60.             }
  61.             base.Dispose( disposing );
  62.         }
  63.  
  64.         #region Windows Form Designer generated code
  65.         /// <summary>
  66.         /// Required method for Designer support - do not modify
  67.         /// the contents of this method with the code editor.
  68.         /// </summary>
  69.         private void InitializeComponent()
  70.         {
  71.             this.displayTB = new System.Windows.Forms.TextBox();
  72.             this.panel1 = new System.Windows.Forms.Panel();
  73.             this.testBtn2 = new System.Windows.Forms.Button();
  74.             this.testBtn = new System.Windows.Forms.Button();
  75.             this.southBtn = new System.Windows.Forms.Button();
  76.             this.eastBtn = new System.Windows.Forms.Button();
  77.             this.westBtn = new System.Windows.Forms.Button();
  78.             this.northBtn = new System.Windows.Forms.Button();
  79.             this.lookBtn = new System.Windows.Forms.Button();
  80.             this.dropBtn = new System.Windows.Forms.Button();
  81.             this.takeBtn = new System.Windows.Forms.Button();
  82.             this.inputTB = new System.Windows.Forms.TextBox();
  83.             this.panel1.SuspendLayout();
  84.             this.SuspendLayout();
  85.             // 
  86.             // displayTB
  87.             // 
  88.             this.displayTB.Dock = System.Windows.Forms.DockStyle.Top;
  89.             this.displayTB.Multiline = true;
  90.             this.displayTB.Name = "displayTB";
  91.             this.displayTB.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
  92.             this.displayTB.Size = new System.Drawing.Size(512, 232);
  93.             this.displayTB.TabIndex = 0;
  94.             this.displayTB.Text = "";
  95.             // 
  96.             // panel1
  97.             // 
  98.             this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
  99.             this.panel1.Controls.AddRange(new System.Windows.Forms.Control[] {
  100.                                                                                  this.testBtn2,
  101.                                                                                  this.testBtn,
  102.                                                                                  this.southBtn,
  103.                                                                                  this.eastBtn,
  104.                                                                                  this.westBtn,
  105.                                                                                  this.northBtn,
  106.                                                                                  this.lookBtn,
  107.                                                                                  this.dropBtn,
  108.                                                                                  this.takeBtn,
  109.                                                                                  this.inputTB});
  110.             this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
  111.             this.panel1.Location = new System.Drawing.Point(0, 232);
  112.             this.panel1.Name = "panel1";
  113.             this.panel1.Size = new System.Drawing.Size(512, 125);
  114.             this.panel1.TabIndex = 1;
  115.             // 
  116.             // testBtn2
  117.             // 
  118.             this.testBtn2.Location = new System.Drawing.Point(232, 80);
  119.             this.testBtn2.Name = "testBtn2";
  120.             this.testBtn2.TabIndex = 9;
  121.             this.testBtn2.Text = "Test 2";
  122.             this.testBtn2.Click += new System.EventHandler(this.testBtn2_Click);
  123.             // 
  124.             // testBtn
  125.             // 
  126.             this.testBtn.Location = new System.Drawing.Point(232, 40);
  127.             this.testBtn.Name = "testBtn";
  128.             this.testBtn.TabIndex = 8;
  129.             this.testBtn.Text = "Test";
  130.             this.testBtn.Click += new System.EventHandler(this.testBtn_Click);
  131.             // 
  132.             // southBtn
  133.             // 
  134.             this.southBtn.Location = new System.Drawing.Point(384, 80);
  135.             this.southBtn.Name = "southBtn";
  136.             this.southBtn.Size = new System.Drawing.Size(48, 24);
  137.             this.southBtn.TabIndex = 7;
  138.             this.southBtn.Text = "S";
  139.             // 
  140.             // eastBtn
  141.             // 
  142.             this.eastBtn.Location = new System.Drawing.Point(416, 48);
  143.             this.eastBtn.Name = "eastBtn";
  144.             this.eastBtn.Size = new System.Drawing.Size(48, 24);
  145.             this.eastBtn.TabIndex = 6;
  146.             this.eastBtn.Text = "E";
  147.             // 
  148.             // westBtn
  149.             // 
  150.             this.westBtn.Location = new System.Drawing.Point(352, 48);
  151.             this.westBtn.Name = "westBtn";
  152.             this.westBtn.Size = new System.Drawing.Size(48, 24);
  153.             this.westBtn.TabIndex = 5;
  154.             this.westBtn.Text = "W";
  155.             // 
  156.             // northBtn
  157.             // 
  158.             this.northBtn.Location = new System.Drawing.Point(384, 16);
  159.             this.northBtn.Name = "northBtn";
  160.             this.northBtn.Size = new System.Drawing.Size(48, 24);
  161.             this.northBtn.TabIndex = 4;
  162.             this.northBtn.Text = "N";
  163.             this.northBtn.Click += new System.EventHandler(this.northBtn_Click);
  164.             // 
  165.             // lookBtn
  166.             // 
  167.             this.lookBtn.Location = new System.Drawing.Point(16, 88);
  168.             this.lookBtn.Name = "lookBtn";
  169.             this.lookBtn.TabIndex = 3;
  170.             this.lookBtn.Text = "Look";
  171.             // 
  172.             // dropBtn
  173.             // 
  174.             this.dropBtn.Location = new System.Drawing.Point(112, 40);
  175.             this.dropBtn.Name = "dropBtn";
  176.             this.dropBtn.TabIndex = 2;
  177.             this.dropBtn.Text = "Drop";
  178.             // 
  179.             // takeBtn
  180.             // 
  181.             this.takeBtn.Location = new System.Drawing.Point(16, 40);
  182.             this.takeBtn.Name = "takeBtn";
  183.             this.takeBtn.TabIndex = 1;
  184.             this.takeBtn.Text = "Take";
  185.             // 
  186.             // inputTB
  187.             // 
  188.             this.inputTB.Location = new System.Drawing.Point(16, 8);
  189.             this.inputTB.Name = "inputTB";
  190.             this.inputTB.Size = new System.Drawing.Size(176, 20);
  191.             this.inputTB.TabIndex = 0;
  192.             this.inputTB.Text = "";
  193.             // 
  194.             // MainForm
  195.             // 
  196.             this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
  197.             this.ClientSize = new System.Drawing.Size(512, 357);
  198.             this.Controls.AddRange(new System.Windows.Forms.Control[] {
  199.                                                                           this.panel1,
  200.                                                                           this.displayTB});
  201.             this.Name = "MainForm";
  202.             this.Text = "Form1";
  203.             this.panel1.ResumeLayout(false);
  204.             this.ResumeLayout(false);
  205.  
  206.         }
  207.         #endregion
  208.  
  209.         /// <summary>
  210.         /// The main entry point for the application.
  211.         /// </summary>
  212.         [STAThread]
  213.         static void Main() 
  214.         {
  215.             Application.Run(new MainForm());
  216.         }
  217.  
  218.         
  219.         
  220.         private void testBtn_Click(object sender, System.EventArgs e)        
  221.         {        
  222.             Adventure adv = new Adventure();
  223.             
  224.             // display all rooms and contents in the map
  225.             displayTB.Text = adv.Map.describe();
  226.  
  227.             // just for testing, also describe the player
  228.             displayTB.AppendText(adv.Player.Name);
  229.             displayTB.AppendText(" are currently in this room ->");
  230.             displayTB.AppendText(adv.Player.CurrentRoom.describe());            
  231.         }
  232.  
  233.         private void testBtn2_Click(object sender, System.EventArgs e)
  234.         {
  235.             /*
  236.             Nothing to test at the moment!
  237.             */
  238.         
  239.         }
  240.  
  241.         private void northBtn_Click(object sender, System.EventArgs e)
  242.         {
  243.           // yet to be implemented
  244.         }
  245.  
  246.         
  247.     }
  248. }
  249.