public void InitializeBuildPhase(EntityBlueprint blueprint, EntityBlueprint.PartInfo currentPart, DroneSpawnData data) { searcherString = ""; displayingTypes = new bool[] { true, false, true, true, true }; this.currentData = data; this.currentPart = currentPart; selectionPhaseParent.SetActive(false); buildPhaseParent.SetActive(true); LoadBlueprint(blueprint, data); builderPartDict = new Dictionary <EntityBlueprint.PartInfo, ShipBuilderInventoryScript>(); contentsArray = new Transform[] { smallBuilderContents, mediumBuilderContents, largeBuilderContents }; contentTexts = new GameObject[] { smallBuilderText, mediumBuilderText, largeBuilderText }; foreach (GameObject obj in contentTexts) { obj.SetActive(false); } foreach (EntityBlueprint.PartInfo part in player.GetInventory()) { if (part.abilityID != 10 && ResourceManager.GetAsset <PartBlueprint>(part.partID).size == 0) { AddPart(part); } } GetComponentInChildren <ShipBuilderPartDisplay>().Initialize(this); phase = DroneWorkshopPhase.BuildPhase; cursorScript.gameObject.SetActive(true); cursorScript.SetMode(BuilderMode.Workshop); }
public void InitializeSelectionPhase() { searcherString = ""; selectionPhaseParent.SetActive(true); buildPhaseParent.SetActive(false); //initialize window on screen if (initialized) { CloseUI(false); // prevent initializing twice by closing UI if already initialized } initialized = true; Activate(); cursorScript.gameObject.SetActive(false); cursorScript.SetBuilder(this); contentsArray = new Transform[] { smallContents, mediumContents, largeContents }; contentTexts = new GameObject[] { smallText, mediumText, largeText }; foreach (GameObject obj in contentTexts) { obj.SetActive(false); } GetComponentInChildren <ShipBuilderPartDisplay>().Initialize(this); player.SetIsInteracting(true); partDict = new Dictionary <DWInventoryButton, EntityBlueprint.PartInfo>(); // hide the buttons and yard tips if interacting with a trader List <EntityBlueprint.PartInfo> parts = player.GetInventory(); if (parts != null) { for (int i = 0; i < parts.Count; i++) { parts[i] = ShipBuilder.CullSpatialValues(parts[i]); } } foreach (EntityBlueprint.PartInfo part in parts) { if (part.abilityID == 10) { AddDronePart(part); } } foreach (EntityBlueprint.PartInfo part in player.blueprint.parts) { if (part.abilityID == 10) { AddDronePart(part); } } var partsToAdd = new List <ShellPart>(); foreach (Entity ent in player.GetUnitsCommanding()) { if (!((ent as Drone) && ent.GetComponentInChildren <TractorBeam>())) { continue; } var target = ent.GetComponentInChildren <TractorBeam>().GetTractorTarget(); if (target && target.GetComponent <ShellPart>()) { partsToAdd.Add(target.GetComponent <ShellPart>()); } } if (player.GetTractorTarget() && player.GetTractorTarget().GetComponent <ShellPart>()) { partsToAdd.Add(player.GetTractorTarget().GetComponent <ShellPart>()); } foreach (ShellPart part in partsToAdd) { var info = part.info; info = ShipBuilder.CullSpatialValues(info); if (info.abilityID == 10) { int size = ResourceManager.GetAsset <PartBlueprint>(info.partID).size; var button = Instantiate(displayButtonPrefab, contentsArray[size]).GetComponent <DWInventoryButton>(); button.handler = selectionDisplay; button.workshop = this; contentTexts[size].SetActive(true); button.part = info; partDict.Add(button, info); } player.cursave.partInventory.Add(info); Destroy(part.gameObject); } phase = DroneWorkshopPhase.SelectionPhase; // activate windows gameObject.SetActive(true); }