public static void ShowAreaTerrainDescriptionSelectionForm() { SelectionForm selectionForm = new SelectionForm(); selectionForm.Initialize( "Select a Terrain Type", "Set Terrain Type", AreaUtilities.GetDescriptions(), terrainTypeDescription => { short?terrainType = AreaUtilities.GetTerrainType(terrainTypeDescription); if (terrainType.HasValue) { Config.Stream.SetValue( terrainType.Value, Config.AreaManager.SelectedAreaAddress + AreaConfig.TerrainTypeOffset); } }); selectionForm.Show(); }
public override void Update(bool updateView) { if (_selectCurrentAreaCheckbox.Checked) { _selectedAreaAddress = Config.Stream.GetUInt(MarioConfig.StructAddress + MarioConfig.AreaPointerOffset); } if (!updateView) { return; } base.Update(updateView); int?currentAreaIndex = AreaUtilities.GetAreaIndex(_selectedAreaAddress); for (int i = 0; i < _selectedAreaRadioButtons.Count; i++) { _selectedAreaRadioButtons[i].Checked = i == currentAreaIndex; } }
public override void InitializeTab() { base.InitializeTab(); SelectedAreaAddress = AreaUtilities.GetAreaAddress(0); _selectedAreaRadioButtons = new List <RadioButton>(); for (int i = 0; i < 8; i++) { _selectedAreaRadioButtons.Add(splitContainerArea.Panel1.Controls["radioButtonArea" + i] as RadioButton); } for (int i = 0; i < _selectedAreaRadioButtons.Count; i++) { int index = i; _selectedAreaRadioButtons[i].Click += (sender, e) => { checkBoxSelectCurrentArea.Checked = false; SelectedAreaAddress = AreaUtilities.GetAreaAddress(index); }; } }
public AreaManager(Control tabControl, string varFilePath, WatchVariableFlowLayoutPanel watchVariableLayoutPanel) : base(varFilePath, watchVariableLayoutPanel) { _selectedAreaAddress = AreaUtilities.GetAreaAddress(0); SplitContainer splitContainerArea = tabControl.Controls["splitContainerArea"] as SplitContainer; _selectedAreaRadioButtons = new List <RadioButton>(); for (int i = 0; i < 8; i++) { _selectedAreaRadioButtons.Add(splitContainerArea.Panel1.Controls["radioButtonArea" + i] as RadioButton); } _selectCurrentAreaCheckbox = splitContainerArea.Panel1.Controls["checkBoxSelectCurrentArea"] as CheckBox; for (int i = 0; i < _selectedAreaRadioButtons.Count; i++) { int index = i; _selectedAreaRadioButtons[i].Click += (sender, e) => { _selectCurrentAreaCheckbox.Checked = false; _selectedAreaAddress = AreaUtilities.GetAreaAddress(index); }; } }