private static void AddShipWithUpgradesPanel(SquadBuilderShip ship) { GameObject prefab = (GameObject)Resources.Load("Prefabs/SquadBuilder/ShipWithUpgradesPanel", typeof(GameObject)); GameObject shipWithUpgradesPanelGO = MonoBehaviour.Instantiate(prefab, GameObject.Find("UI/Panels/SquadBuilderPanel/Panel/Centered/SquadListPanel").transform); ShipWithUpgradesPanel shipWithUpgradesPanel = new ShipWithUpgradesPanel(ship, shipWithUpgradesPanelGO); ShipWithUpgradesPanels.Add(shipWithUpgradesPanel); ship.Panel = shipWithUpgradesPanel; Transform contentTransform = ship.Panel.Panel.transform; RectTransform contentRect = contentTransform.GetComponent <RectTransform>(); int installedUpgradesCount = ship.Instance.UpgradeBar.GetUpgradesAll().Count; contentRect.sizeDelta = new Vector2(PILOT_CARD_WIDTH + (RuleSet.Instance.UpgradeCardCompactSize.x + DISTANCE_SMALL) * installedUpgradesCount, contentRect.sizeDelta.y); prefab = (GameObject)Resources.Load("Prefabs/SquadBuilder/PilotPanel", typeof(GameObject)); GameObject pilotPanel = MonoBehaviour.Instantiate(prefab, shipWithUpgradesPanelGO.transform); pilotPanel.transform.localPosition = Vector3.zero; PilotPanelSquadBuilder script = pilotPanel.GetComponent <PilotPanelSquadBuilder>(); script.Initialize(ship.Instance, OpenShipInfo); ShowUpgradesOfPilot(ship); }
private void ShowPilot(SquadListShip ship) { GameObject prefab = (GameObject)Resources.Load("Prefabs/SquadBuilder/PilotPanel", typeof(GameObject)); PilotPanel = MonoBehaviour.Instantiate(prefab, Panel.transform); PilotPanel.transform.localPosition = Vector3.zero; PilotPanelSquadBuilder script = PilotPanel.GetComponent <PilotPanelSquadBuilder>(); script.Initialize(ship.Instance, Global.SquadBuilder.View.OpenShipInfo); }
private static void CreatePilotPanel() { GameObject prefab = (GameObject)Resources.Load("Prefabs/SquadBuilder/PilotPanel", typeof(GameObject)); Transform contentTransform = GameObject.Find("UI/Panels/ShipSlotsPanel/Panel/Centered/ShipWithSlotsHolderPanel/").transform; GameObject newPilotPanel = MonoBehaviour.Instantiate(prefab, contentTransform); newPilotPanel.transform.localPosition = Vector3.zero; PilotPanelSquadBuilder script = newPilotPanel.GetComponent <PilotPanelSquadBuilder>(); script.Initialize(CurrentSquadBuilderShip.Instance); }
private void CreatePilotPanel() { PilotPanelSquadBuilder.WaitingToLoad = 0; GameObject prefab = (GameObject)Resources.Load("Prefabs/SquadBuilder/PilotPanel", typeof(GameObject)); Transform contentTransform = GameObject.Find("UI/Panels/ShipSlotsPanel/Panel/ShipWithSlotsHolderPanel/").transform; GameObject newPilotPanel = MonoBehaviour.Instantiate(prefab, contentTransform); newPilotPanel.transform.localPosition = new Vector3(SquadBuilderView.DISTANCE_MEDIUM, -SquadBuilderView.DISTANCE_MEDIUM, 0); PilotPanelSquadBuilder script = newPilotPanel.GetComponent <PilotPanelSquadBuilder>(); script.Initialize(Global.SquadBuilder.CurrentShip.Instance); }
private void ShowAvailablePilot(PilotRecord pilotRecord) { GameObject prefab = (GameObject)Resources.Load("Prefabs/SquadBuilder/PilotPanel", typeof(GameObject)); Transform contentTransform = GameObject.Find("UI/Panels/SelectPilotPanel/Panel/Scroll View/Viewport/Content").transform; GameObject newPilotPanel = MonoBehaviour.Instantiate(prefab, contentTransform); GenericShip newShip = (GenericShip)Activator.CreateInstance(Type.GetType(pilotRecord.PilotTypeName)); Edition.Current.AdaptShipToRules(newShip); Edition.Current.AdaptPilotToRules(newShip); PilotPanelSquadBuilder script = newPilotPanel.GetComponent <PilotPanelSquadBuilder>(); script.Initialize(newShip, PilotSelectedIsClicked, true); }
private static void ShowAvailablePilot(PilotRecord pilotRecord) { GameObject prefab = (GameObject)Resources.Load("Prefabs/SquadBuilder/PilotPanel", typeof(GameObject)); Transform contentTransform = GameObject.Find("UI/Panels/SelectPilotPanel/Panel/Scroll View/Viewport/Content").transform; GameObject newPilotPanel = MonoBehaviour.Instantiate(prefab, contentTransform); GenericShip newShip = (GenericShip)Activator.CreateInstance(Type.GetType(pilotRecord.PilotTypeName)); PilotPanelSquadBuilder script = newPilotPanel.GetComponent <PilotPanelSquadBuilder>(); script.Initialize(newShip, PilotSelectedIsClicked, true); int column = availablePilotsCounter; newPilotPanel.transform.localPosition = new Vector3(DISTANCE_MEDIUM + (PILOT_CARD_WIDTH + DISTANCE_MEDIUM) * column, PILOT_CARD_HEIGHT / 2, 0); availablePilotsCounter++; }