/// <summary> /// Updates the controls when the selection is changed. /// </summary> protected override void OnSelectionChanged() { // Call the base method base.OnSelectionChanged(); if (SelectedObject == null) { return; } m_blueprint = SelectedObject as Blueprint; // Update Tabs UpdateTabs(); // Get the acitvity m_activity = GetActivity(); // Update Required Skills requiredSkillsControl.Object = SelectedObject; requiredSkillsControl.Activity = m_activity; // Update Facility Modifier UpdateFacilityModifier(); }
/// <summary> /// Gets the activity from the selected tab. /// </summary> /// <returns></returns> private BlueprintActivity GetActivity() { // Unsubscribe mouse handlers for the old properties list PropertiesList.MouseDown -= PropertiesList_MouseDown; PropertiesList.MouseMove -= PropertiesList_MouseMove; BlueprintActivity activity = BlueprintActivity.None; if (tabControl.SelectedTab == null) { return(activity); } switch (tabControl.SelectedTab.Text) { case "Manufacturing": PropertiesList = lvManufacturing; activity = BlueprintActivity.Manufacturing; break; case "Copying": PropertiesList = lvCopying; activity = BlueprintActivity.Copying; break; case "Researching Material Efficiency": PropertiesList = lvResearchME; activity = BlueprintActivity.ResearchingMaterialEfficiency; break; case "Researching Time Efficiency": PropertiesList = lvResearchTE; activity = BlueprintActivity.ResearchingTimeEfficiency; break; case "Invention": PropertiesList = lvInvention; activity = BlueprintActivity.Invention; break; case "Reactions": PropertiesList = lvReactions; activity = BlueprintActivity.Reactions; break; case "Simple Reactions": PropertiesList = lvReactions; activity = BlueprintActivity.SimpleReactions; break; default: throw new NotImplementedException(); } // Re-subscribe mouse handlers for the new properties list PropertiesList.MouseDown += PropertiesList_MouseDown; PropertiesList.MouseMove += PropertiesList_MouseMove; return(activity); }
/// <summary> /// Gets the research time multiplier of a facility. /// </summary> /// <param name="activity"></param> /// <returns></returns> private double GetFacilityResearchMultiplier(BlueprintActivity activity) { var text = cbFacility.Text; if (text.StartsWith("Mobile")) { switch (activity) { case BlueprintActivity.Invention: return(0.5d); default: return(0.75d); } } if (text.StartsWith("Advance Mobile")) { switch (activity) { case BlueprintActivity.ResearchingMaterialProductivity: return(0.75d); case BlueprintActivity.Copying: return(0.65d); case BlueprintActivity.Invention: return(0.5d); } } return(1.0d); }
/// <summary> /// Gets the research time multiplier of a facility by their activity. /// </summary> /// <param name="activity"></param> /// <returns></returns> private double GetFacilityResearchTimeMultiplier(BlueprintActivity activity) { string text = cbFacility.Text; if (text.StartsWith("Design", StringComparison.Ordinal)) { switch (activity) { case BlueprintActivity.Invention: return(0.5d); case BlueprintActivity.Copying: return(0.6d); default: return(1); } } if (!text.Contains("Research Laboratory")) { return(1.0d); } switch (activity) { case BlueprintActivity.ResearchingMaterialEfficiency: case BlueprintActivity.ResearchingTimeEfficiency: return(text.StartsWith("Hyasyoda", StringComparison.Ordinal) ? 0.65d : 0.70d); } return(1.0d); }
/// <summary> /// Occurs when a tab is selected. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> /// <remarks>Updates the required skills control according to the seleted tab</remarks> private void tabControl_SelectedIndexChanged(object sender, EventArgs e) { if (tabControl.SelectedIndex == -1) { return; } m_activity = GetActivity(); requiredSkillsControl.Activity = m_activity; UpdateFacilityModifier(); }
/// <summary> /// Constructor from the API. /// </summary> /// <param name="src"></param> internal IndustryJob(SerializableJobListItem src) { m_state = GetState(src); m_jobID = src.JobID; m_installedItemID = src.InstalledItemTypeID; m_installedItem = StaticBlueprints.GetBlueprintByID(src.InstalledItemTypeID); m_outputItemID = src.OutputTypeID; m_outputItem = GetOutputItem(src.OutputTypeID); m_runs = src.Runs; m_activity = (BlueprintActivity)Enum.ToObject(typeof(BlueprintActivity), src.ActivityID); m_blueprintType = (BlueprintType)Enum.ToObject(typeof(BlueprintType), src.InstalledItemCopy); m_installation = GetInstallation(src.OutputLocationID); m_solarSystem = StaticGeography.GetSystem(src.SolarSystemID); m_installedTime = src.InstallTime; m_installedItemME = src.InstalledItemMaterialLevel; m_installedItemPE = src.InstalledItemProductivityLevel; m_beginProductionTime = src.BeginProductionTime; m_endProductionTime = src.EndProductionTime; m_pauseProductionTime = src.PauseProductionTime; m_lastStateChange = DateTime.UtcNow; m_issuedFor = src.IssuedFor; m_activeJobState = GetActiveJobState(); }
/// <summary> /// Constructor from the API. /// </summary> /// <param name="src"></param> internal IndustryJob(SerializableJobListItem src) { m_state = GetState(src); m_jobID = src.JobID; m_installedItemID = src.InstalledItemTypeID; m_installedItem = StaticBlueprints.GetBlueprintByID(src.InstalledItemTypeID); m_outputItemID = src.OutputTypeID; m_outputItem = GetOutputItem(src.OutputTypeID); m_runs = src.Runs; m_activity = (BlueprintActivity) Enum.ToObject(typeof (BlueprintActivity), src.ActivityID); m_blueprintType = (BlueprintType) Enum.ToObject(typeof (BlueprintType), src.InstalledItemCopy); m_installation = GetInstallation(src.OutputLocationID); m_solarSystem = StaticGeography.GetSystem(src.SolarSystemID); m_installedTime = src.InstallTime; m_installedItemME = src.InstalledItemMaterialLevel; m_installedItemPE = src.InstalledItemProductivityLevel; m_beginProductionTime = src.BeginProductionTime; m_endProductionTime = src.EndProductionTime; m_pauseProductionTime = src.PauseProductionTime; m_lastStateChange = DateTime.UtcNow; m_issuedFor = src.IssuedFor; m_activeJobState = GetActiveJobState(); }
/// <summary> /// Constructor from an object deserialized from the settings file. /// </summary> /// <param name="src"></param> internal IndustryJob(SerializableJob src) { m_ignored = src.Ignored; m_jobID = src.JobID; m_state = src.State; m_installedItemID = src.InstalledItemID; m_installedItem = StaticBlueprints.GetBlueprintByID(src.InstalledItemID); m_outputItemID = src.OutputItemID; m_outputItem = GetOutputItem(src.OutputItemID); m_runs = src.Runs; m_activity = src.Activity; m_blueprintType = src.BlueprintType; m_installation = src.ItemLocation; m_solarSystem = StaticGeography.GetSystem(src.SolarSystemID); m_installedTime = src.InstalledTime; m_installedItemME = src.InstalledItemME; m_installedItemPE = src.InstalledItemPE; m_beginProductionTime = src.BeginProductionTime; m_endProductionTime = src.EndProductionTime; m_pauseProductionTime = src.PauseProductionTime; m_lastStateChange = src.LastStateChange; m_issuedFor = src.IssuedFor; m_activeJobState = GetActiveJobState(); }
/// <summary> /// Gets the time efficiency modifier. /// </summary> /// <param name="activity">The activity.</param> /// <returns></returns> private double GetTimeEfficiencyModifier(BlueprintActivity activity) { switch (activity) { case BlueprintActivity.Manufacturing: return(1d - (double)nudTE.Value / 100); case BlueprintActivity.ResearchingMaterialEfficiency: switch ((int)nudME.Value) { case 0: return(1d); case 1: return((250 - 105) / 105d); case 2: return((595d - 250d) / 105d); case 3: return((1414 - 595) / 105d); case 4: return((3360 - 1414) / 105d); case 5: return((8000 - 3360) / 105d); case 6: return((19000 - 8000) / 105d); case 7: return((45255 - 19000) / 105d); case 8: return((107700 - 45255) / 105d); case 9: case 10: return((256000 - 107700) / 105d); } break; } if (activity != BlueprintActivity.ResearchingTimeEfficiency) { return(1d); } switch ((int)nudTE.Value) { case 0: return(1d); case 2: return((250 - 105) / 105d); case 4: return((595d - 250d) / 105d); case 6: return((1414 - 595) / 105d); case 8: return((3360 - 1414) / 105d); case 10: return((8000 - 3360) / 105d); case 12: return((19000 - 8000) / 105d); case 14: return((45255 - 19000) / 105d); case 16: return((107700 - 45255) / 105d); case 18: case 20: return((256000 - 107700) / 105d); } return(1d); }
/// <summary> /// Occurs when a tab is selected. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> /// <remarks>Updates the required skills control according to the seleted tab</remarks> private void tabControl_SelectedIndexChanged(object sender, EventArgs e) { if (tabControl.SelectedIndex == -1) return; m_activity = GetActivity(); requiredSkillsControl.Activity = m_activity; UpdateFacilityModifier(); }
/// <summary> /// Gets the research time multiplier of a facility. /// </summary> /// <param name="activity"></param> /// <returns></returns> private double GetFacilityResearchMultiplier(BlueprintActivity activity) { var text = cbFacility.Text; if (text.StartsWith("Mobile")) { switch (activity) { case BlueprintActivity.Invention: return 0.5d; default: return 0.75d; } } if (text.StartsWith("Advance Mobile")) { switch (activity) { case BlueprintActivity.ResearchingMaterialProductivity: return 0.75d; case BlueprintActivity.Copying: return 0.65d; case BlueprintActivity.Invention: return 0.5d; } } return 1.0d; }
/// <summary> /// Updates the controls when the selection is changed. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected override void OnSelectionChanged(object sender, EventArgs e) { // Call the base method base.OnSelectionChanged(sender, e); if (SelectedObject == null) return; m_blueprint = SelectedObject as Blueprint; // Update Tabs UpdateTabs(); // Update Required Skills m_activity = GetActivity(); requiredSkillsControl.Object = SelectedObject; requiredSkillsControl.Activity = m_activity; // Update Facility Modifier UpdateFacilityModifier(); }
/// <summary> /// Gets the research time multiplier of a facility by their activity. /// </summary> /// <param name="activity"></param> /// <returns></returns> private double GetFacilityResearchTimeMultiplier(BlueprintActivity activity) { string text = cbFacility.Text; if (text.StartsWith("Design", StringComparison.Ordinal)) { switch (activity) { case BlueprintActivity.Invention: return 0.5d; case BlueprintActivity.Copying: return 0.6d; default: return 1; } } if (!text.Contains("Research Laboratory")) return 1.0d; switch (activity) { case BlueprintActivity.ResearchingMaterialEfficiency: case BlueprintActivity.ResearchingTimeEfficiency: return text.StartsWith("Hyasyoda", StringComparison.Ordinal) ? 0.65d : 0.70d; } return 1.0d; }
/// <summary> /// Gets the time efficiency modifier. /// </summary> /// <param name="activity">The activity.</param> /// <returns></returns> private double GetTimeEfficiencyModifier(BlueprintActivity activity) { switch (activity) { case BlueprintActivity.Manufacturing: return 1d - (double)nudTE.Value / 100; case BlueprintActivity.ResearchingMaterialEfficiency: switch ((int)nudME.Value) { case 0: return 1d; case 1: return (250 - 105) / 105d; case 2: return (595d - 250d) / 105d; case 3: return (1414 - 595) / 105d; case 4: return (3360 - 1414) / 105d; case 5: return (8000 - 3360) / 105d; case 6: return (19000 - 8000) / 105d; case 7: return (45255 - 19000) / 105d; case 8: return (107700 - 45255) / 105d; case 9: case 10: return (256000 - 107700) / 105d; } break; } if (activity != BlueprintActivity.ResearchingTimeEfficiency) return 1d; switch ((int)nudTE.Value) { case 0: return 1d; case 2: return (250 - 105) / 105d; case 4: return (595d - 250d) / 105d; case 6: return (1414 - 595) / 105d; case 8: return (3360 - 1414) / 105d; case 10: return (8000 - 3360) / 105d; case 12: return (19000 - 8000) / 105d; case 14: return (45255 - 19000) / 105d; case 16: return (107700 - 45255) / 105d; case 18: case 20: return (256000 - 107700) / 105d; } return 1d; }