protected override void OnMouseUp(MouseEventArgs e) { Tuple <int, int> cellCoords = ConvertCellCoordinates(e); cellX = cellCoords.Item1; cellZ = cellCoords.Item2; Reactor.UpdateStats(); Reactor.UI.RefreshStats(); Vector3 position = new Vector3(cellX, Y, cellZ); PlannerUI.gridToolTip.Show(Reactor.BlockAt(position).GetToolTip(), this, cellX * PlannerUI.blockSize + 16, menu.Height + cellZ * PlannerUI.blockSize + 16); Reactor.Redraw(); base.OnMouseUp(e); }
private bool ApplyAndReload() { try { ApplyConfiguration(); ReloadTabs(); Reactor.ReloadValuesFromConfig(); Reactor.UI.fuelSelector_SelectedIndexChanged(null, null); Reactor.UpdateStats(); return(true); } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\nCould not apply configuration, resetting to defaults!"); Configuration.ResetToDefaults(); ReloadTabs(); Reactor.ReloadValuesFromConfig(); Reactor.UI.fuelSelector_SelectedIndexChanged(null, null); Reactor.UpdateStats(); return(false); } }
//private void ReloadResourceCostTab() //{ // blockSelector.Items.Add(new ResourceCostComboboxItem("Fuel cell", Configuration.ResourceCosts.FuelCellCosts)); // blockSelector.Items.Add(new ResourceCostComboboxItem("Casing", Configuration.ResourceCosts.CasingCosts)); // foreach (KeyValuePair<string, Dictionary<string, int>> kvp in Configuration.ResourceCosts.HeatSinkCosts) // { // blockSelector.Items.Add(new ResourceCostComboboxItem(kvp.Key + " HeatSink", kvp.Value)); // } // foreach (KeyValuePair<string, Dictionary<string, int>> kvp in Configuration.ResourceCosts.ModeratorCosts) // { // blockSelector.Items.Add(new ResourceCostComboboxItem(kvp.Key + " Moderator", kvp.Value)); // } //} //private void SelectedBlockChanged(object sender, EventArgs e) //{ // if (rDC != null) // { // foreach (KeyValuePair<string, List<Control>> kvp in rDC) // foreach (Control c in kvp.Value) // { // c.Dispose(); // resourceCostsPage.Controls.Remove(c); // } // } // rDC = new Dictionary<string, List<Control>>(); // int row = 1; // foreach(KeyValuePair<string, int> resource in ((ResourceCostComboboxItem)blockSelector.SelectedItem).Resources) // { // rDC[resource.Key] = new List<Control>(); // rDC[resource.Key].Add(new TextBox { Text = resource.Key, Location = new Point(10, row * 30) }); // rDC[resource.Key].Add(new NumericUpDown { Value = resource.Value, Location = new Point(130, row * 30) }); // row++; // //rDC.Add(new Button { Text = resource.Key, Location = new Point(10, row++ * 20) }); // resourceCostsPage.Controls.AddRange(rDC[resource.Key].ToArray()); // } //} private void Load_Click(object sender, EventArgs e) { using (OpenFileDialog fileDialog = new OpenFileDialog { Filter = "JSON config files(*.json)|*.json" }) { if (fileDialog.ShowDialog() == DialogResult.OK) { if (Configuration.Load(new FileInfo(fileDialog.FileName))) { ReloadTabs(); Reactor.ReloadValuesFromConfig(); Reactor.UpdateStats(); Reactor.UI.fuelSelector_SelectedIndexChanged(null, null); MessageBox.Show("Loaded and applied!"); Close(); } } else { return; } } }