コード例 #1
0
ファイル: SquadBuilder.cs プロジェクト: xNyer/FlyCasual
        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);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        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);
        }
コード例 #5
0
        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);
        }
コード例 #6
0
        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++;
        }