⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 intersection_edit.cs

📁 game implemented java
💻 CS
📖 第 1 页 / 共 2 页
字号:
			this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
			// 
			// offsetMenu
			// 
			this.offsetMenu.Enabled = false;
			this.offsetMenu.Location = new System.Drawing.Point(104, 168);
			this.offsetMenu.Name = "offsetMenu";
			this.offsetMenu.Size = new System.Drawing.Size(88, 20);
			this.offsetMenu.TabIndex = 17;
			// 
			// modMenu
			// 
			this.modMenu.Location = new System.Drawing.Point(104, 128);
			this.modMenu.Minimum = new System.Decimal(new int[] {
																	2,
																	0,
																	0,
																	0});
			this.modMenu.Name = "modMenu";
			this.modMenu.ReadOnly = true;
			this.modMenu.Size = new System.Drawing.Size(88, 20);
			this.modMenu.TabIndex = 15;
			this.modMenu.Value = new System.Decimal(new int[] {
																  100,
																  0,
																  0,
																  0});
			// 
			// LightRadio
			// 
			this.LightRadio.Location = new System.Drawing.Point(8, 88);
			this.LightRadio.Name = "LightRadio";
			this.LightRadio.Size = new System.Drawing.Size(208, 16);
			this.LightRadio.TabIndex = 14;
			this.LightRadio.Text = "Make Selected Street a Traffic Light";
			this.LightRadio.Click += new System.EventHandler(this.Radio_Click);
			this.LightRadio.Enter += new System.EventHandler(this.LightRadio_Enter);
			// 
			// StopRadio
			// 
			this.StopRadio.Checked = true;
			this.StopRadio.Location = new System.Drawing.Point(8, 40);
			this.StopRadio.Name = "StopRadio";
			this.StopRadio.Size = new System.Drawing.Size(200, 16);
			this.StopRadio.TabIndex = 13;
			this.StopRadio.TabStop = true;
			this.StopRadio.Text = "Make Selected Street a Stop Sign";
			this.StopRadio.Click += new System.EventHandler(this.Radio_Click);
			this.StopRadio.Enter += new System.EventHandler(this.LightRadio_Leave);
			// 
			// label2
			// 
			this.label2.Location = new System.Drawing.Point(0, 0);
			this.label2.Name = "label2";
			this.label2.Size = new System.Drawing.Size(208, 32);
			this.label2.TabIndex = 11;
			this.label2.Text = "Intersection Setting for Selected Thru Street";
			this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
			// 
			// label3
			// 
			this.label3.Location = new System.Drawing.Point(24, 48);
			this.label3.Name = "label3";
			this.label3.Size = new System.Drawing.Size(200, 24);
			this.label3.TabIndex = 16;
			this.label3.Text = "Intersections";
			this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
			// 
			// ThruListBox
			// 
			this.ThruListBox.Location = new System.Drawing.Point(24, 272);
			this.ThruListBox.Name = "ThruListBox";
			this.ThruListBox.Size = new System.Drawing.Size(200, 95);
			this.ThruListBox.TabIndex = 17;
			this.ThruListBox.SelectedValueChanged += new System.EventHandler(this.ThruListBox_SelectedValueChanged);
			// 
			// label6
			// 
			this.label6.Location = new System.Drawing.Point(24, 240);
			this.label6.Name = "label6";
			this.label6.Size = new System.Drawing.Size(200, 24);
			this.label6.TabIndex = 18;
			this.label6.Text = "Thru Streets in Selected Intersection";
			this.label6.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
			// 
			// Intersection_Edit
			// 
			this.AcceptButton = this.acceptor;
			this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
			this.CancelButton = this.canceler;
			this.ClientSize = new System.Drawing.Size(464, 430);
			this.Controls.Add(this.ThruListBox);
			this.Controls.Add(this.label6);
			this.Controls.Add(this.ToDo);
			this.Controls.Add(this.canceler);
			this.Controls.Add(this.remover);
			this.Controls.Add(this.label1);
			this.Controls.Add(this.InterListBox);
			this.Controls.Add(this.infoDisplay);
			this.Controls.Add(this.acceptor);
			this.Controls.Add(this.label3);
			this.Name = "Intersection_Edit";
			this.ShowInTaskbar = false;
			this.Text = "Change Intersection";
			this.ToDo.ResumeLayout(false);
			((System.ComponentModel.ISupportInitialize)(this.greenMenu)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.offsetMenu)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.modMenu)).EndInit();
			this.ResumeLayout(false);

		}
		#endregion

		private void acceptor_Click(object sender, System.EventArgs e)
		{
			this.Close();
		}

		private void remover_Click(object sender, System.EventArgs e)
		{
			try 
			{
				int idToFind = (int)InterListBox.SelectedItem;
				myInters.Remove(idToFind);
				InterListBox.Items.Clear();
				for (int i=0; i<myInters.Count;i++)
					InterListBox.Items.Add(myInters[i]);
			}
			catch{MessageBox.Show("You must select an Intersection to remove");}
		}

		private void canceler_Click(object sender, System.EventArgs e)
		{
			for (int i = undoSeg.Count-1; i>=0;i--)
			{
				((Intersection)myMap.getIntersectionList[(int)undoSeg[i]]).getThruSts[(int)undoStreet[i]]=undoData[i];
			}
			this.Close();
		}

		private void LightRadio_Enter(object sender, System.EventArgs e)
		{
			modMenu.Enabled = true;
			offsetMenu.Enabled = true;
			greenMenu.Enabled = true;
		}

		private void LightRadio_Leave(object sender, System.EventArgs e)
		{
			modMenu.Enabled = false;
			offsetMenu.Enabled = false;
			greenMenu.Enabled = false;
		}

		private void infoDisplay_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
		{
			if (InterListBox.SelectedItem == null)
			{
				e.Graphics.DrawString("No Intersection Selected", new Font("Times New Roman",12),
					new SolidBrush(Color.White),0.0f,0.0f);
			}
			else
			{
				int selected = (int)InterListBox.SelectedItem;
				Intersection toDraw = (Intersection)myMap.getIntersectionList[selected];
				Scaler temp = new Scaler();
				temp.Height = infoDisplay.Height;
				temp.Width = infoDisplay.Width;
				toDraw.drawIsolated(e.Graphics,myMap,temp);
			}
		}

		private void InterListBox_SelectedValueChanged(object sender, System.EventArgs e)
		{
			ThruListBox.Items.Clear();
			if (InterListBox.SelectedItem != null)
			{
				int selected = (int)InterListBox.SelectedItem;
				ArrayList thrus = ((Intersection)myMap.getIntersectionList[selected]).getThruSts;
				for (int i=0;i<thrus.Count;i++)
				{
					int segID = ((ThruStreet)thrus[i]).seg1;
					string single = ((ThruStreet)thrus[i]).seg2 == -1? " (One Block)" : "";
					try {ThruListBox.Items.Add(i+": "+myMap.getSegment(segID).StreetName+single);}
					catch {MessageBox.Show("This intersection is not correctly analyzed");}
				}
				ThruListBox.SelectedIndex = 0;
			}
			Invalidate(true);
		}

		private void ThruListBox_SelectedValueChanged(object sender, System.EventArgs e)
		{
			ToDo.Visible = true;
			int selected = (int)InterListBox.SelectedItem;
			Intersection toUse = (Intersection)myMap.getIntersectionList[selected];
			int state = ThruListBox.SelectedIndex;
			if (toUse.getState(state,0) == Intersection.IS_STOP)
				StopRadio.Select();
			else if (toUse.getState(state,0) == Intersection.UNCONTROLLED)
				UncontrolledRadio.Select();
			else if (toUse.getState(state,0) == Intersection.DEAD_END)
			{
				ToDo.Visible = false;
				MessageBox.Show("Can not change intersection information for Dead Ends");
			}
			else
			{
				LightRadio.Select();
				modMenu.Value = toUse.getCycle;
				offsetMenu.Value =((ThruStreet)toUse.getThruSts[state]).offset;
				greenMenu.Value = ((ThruStreet)toUse.getThruSts[state]).timeGreen;
			}
		}

		private void Radio_Click(object sender, System.EventArgs e)
		{
			int selected = (int)InterListBox.SelectedItem;
			Intersection toUse = (Intersection)myMap.getIntersectionList[selected];
			ThruStreet forUndo = (ThruStreet)toUse.getThruSts[ThruListBox.SelectedIndex];
			if (StopRadio.Checked)
				toUse.makeStop(ThruListBox.SelectedIndex);
			else if (UncontrolledRadio.Checked)
				toUse.makeUncontrolled(ThruListBox.SelectedIndex);
			else if (LightRadio.Checked)
				toUse.makeLight(ThruListBox.SelectedIndex,(int)offsetMenu.Value,(int)greenMenu.Value);
			undoSeg.Add(selected);
			undoStreet.Add(ThruListBox.SelectedIndex);
			undoData.Add(forUndo);
		}
	
		public CityMap getMap
		{
			get {return myMap;}
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -