Example #1
0
    // Use this for initialization
    void Start()
    {
        int id = 0;

        GameController gc = FindObjectOfType <GameController>();

        foreach (GameController.ShipList sl in gc.shipList)
        {
            GameObject g = Instantiate(prefab, contentviewer);

            ShipButton sb = g.GetComponent <ShipButton>();

            sb.Init(sl.picture, sl.title, sl.cost);
            sb.id = id;
            id++;
        }
    }
Example #2
0
        public void OnActivate()
        {
            // Store window
            window             = Root.Singleton.Window;
            rctScreen          = Util.ScreenRect(window.Size.X, window.Size.Y, 1.7778f);
            finishnow          = false;
            window.KeyPressed += window_KeyPressed;

            // Create UI
            pnObscure        = new Panel();
            pnObscure.Colour = new Color(0, 0, 0, 192);
            Util.LayoutControl(pnObscure, 0, 0, 1280, 720, rctScreen);
            pnObscure.Parent = Root.Singleton.Canvas;
            pnObscure.Init();

            pnWindow       = new ImagePanel();
            pnWindow.Image = Root.Singleton.Material("img/customizeUI/ship_list_main.png");
            Util.LayoutControl(pnWindow, (1280 / 2) - (647 / 2), (720 / 2) - (465 / 2), 647, 465, rctScreen);
            pnWindow.Parent = Root.Singleton.Canvas;
            pnWindow.Init();

            int shipX = 0;
            int shipY = 0;

            foreach (var gen in Root.Singleton.mgrState.Get <Library>().GetPlayerShipGenerators())
            {
                var btnShip = new ShipButton(gen);
                Util.LayoutControl(btnShip, 24 + 205 * shipX, 52 + 135 * shipY, 191, 121, rctScreen);
                btnShip.Parent = pnWindow;
                btnShip.Init();

                shipX++;
                if (shipX >= 3)
                {
                    shipX = 0;
                    shipY++;
                }
            }

            // Modal screen
            Root.Singleton.Canvas.ModalFocus = pnWindow;
        }
Example #3
0
        public void OnActivate()
        {
            // Store window
            window = Root.Singleton.Window;
            rctScreen = Util.ScreenRect(window.Size.X, window.Size.Y, 1.7778f);
            finishnow = false;
            window.KeyPressed += window_KeyPressed;

            // Create UI
            pnObscure = new Panel();
            pnObscure.Colour = new Color(0, 0, 0, 192);
            Util.LayoutControl(pnObscure, 0, 0, 1280, 720, rctScreen);
            pnObscure.Parent = Root.Singleton.Canvas;
            pnObscure.Init();

            pnWindow = new ImagePanel();
            pnWindow.Image = Root.Singleton.Material("img/customizeUI/ship_list_main.png");
            Util.LayoutControl(pnWindow, (1280 / 2) - (647 / 2), (720 / 2) - (465 / 2), 647, 465, rctScreen);
            pnWindow.Parent = Root.Singleton.Canvas;
            pnWindow.Init();

            int shipX = 0;
            int shipY = 0;
            foreach (var gen in Root.Singleton.mgrState.Get<Library>().GetPlayerShipGenerators())
            {
                var btnShip = new ShipButton(gen);
                Util.LayoutControl(btnShip, 24 + 205 * shipX, 52 + 135 * shipY, 191, 121, rctScreen);
                btnShip.Parent = pnWindow;
                btnShip.Init();

                shipX++;
                if (shipX >= 3)
                {
                    shipX = 0;
                    shipY++;
                }
            }

            // Modal screen
            Root.Singleton.Canvas.ModalFocus = pnWindow;
        }