private void initializeData() { if (!initialized) { setupTankList(false); weightList = BDAcTools.ParseDoubles(tankMass); tankCostList = BDAcTools.ParseDoubles(tankCost); if (HighLogic.LoadedSceneIsFlight) { hasLaunched = true; } if (hasGUI) { Events["nextTankSetupEvent"].guiActive = availableInFlight; Events["nextTankSetupEvent"].guiActiveEditor = availableInEditor; Events["previousTankSetupEvent"].guiActive = availableInFlight; Events["previousTankSetupEvent"].guiActiveEditor = availableInEditor; } else { Events["nextTankSetupEvent"].guiActive = false; Events["nextTankSetupEvent"].guiActiveEditor = false; Events["previousTankSetupEvent"].guiActive = false; Events["previousTankSetupEvent"].guiActiveEditor = false; } if (HighLogic.CurrentGame == null || HighLogic.CurrentGame.Mode == Game.Modes.CAREER) { Fields["addedCost"].guiActiveEditor = displayCurrentTankCost; } initialized = true; } }
private void assignResourcesToPart(bool calledByPlayer) { // destroying a resource messes up the gui in editor, but not in flight. setupTankInPart(part, calledByPlayer); if (HighLogic.LoadedSceneIsEditor) { for (int s = 0; s < part.symmetryCounterparts.Count; s++) { setupTankInPart(part.symmetryCounterparts[s], calledByPlayer); ModuleAmmoSwitch symSwitch = part.symmetryCounterparts[s].GetComponent <ModuleAmmoSwitch>(); if (symSwitch != null) { symSwitch.selectedTankSetup = selectedTankSetup; } } } //Debug.Log("refreshing UI"); if (tweakableUI == null) { tweakableUI = BDAcTools.FindActionWindow(part); } if (tweakableUI != null) { tweakableUI.displayDirty = true; } else { Debug.Log("no UI to refresh"); } }
public override string GetInfo() { if (showInfo) { List <string> resourceList = BDAcTools.ParseNames(resourceNames); StringBuilder info = new StringBuilder(); info.AppendLine("Ammo Box setups available:"); for (int i = 0; i < resourceList.Count; i++) { info.AppendLine(resourceList[i].Replace(",", ", ")); } return(info.ToString()); } else { return(string.Empty); } }
public void Open(ModuleWeapon weapon, Vector2 position) { open = true; selectedWeapon = weapon; windowLocation = position; AList = BDAcTools.ParseNames(weapon.bulletType); for (int a = 0; a < AList.Count; a++) { bulletInfo = BulletInfo.bullets[AList[a].ToString()]; guiAmmoTypeString = ""; if (bulletInfo.subProjectileCount > 1) { guiAmmoTypeString = Localizer.Format("#LOC_BDArmory_Ammo_Shot") + " "; } if (bulletInfo.apBulletMod >= 1.1) { guiAmmoTypeString += Localizer.Format("#LOC_BDArmory_Ammo_AP") + " "; } if (bulletInfo.apBulletMod < 1.1 && bulletInfo.apBulletMod > 0.8f) { guiAmmoTypeString += Localizer.Format("#LOC_BDArmory_Ammo_SAP") + " "; } if (bulletInfo.explosive) { if (bulletInfo.fuzeType.ToLower() != "none") { guiAmmoTypeString += Localizer.Format("#LOC_BDArmory_Ammo_Flak") + " "; } guiAmmoTypeString += Localizer.Format("#LOC_BDArmory_Ammo_Explosive") + " "; } if (bulletInfo.incendiary) { guiAmmoTypeString += Localizer.Format("#LOC_BDArmory_Ammo_Incendiary") + " "; } if (!bulletInfo.explosive && bulletInfo.apBulletMod <= 0.8) { guiAmmoTypeString += Localizer.Format("#LOC_BDArmory_Ammo_Slug"); } ammoDesc.Add(guiAmmoTypeString); } }