Exemple #1
0
    public void init(PlanetSurface planetSurface)
    {
        this.planetSurface = planetSurface;
        float   yPos       = Screen.height * screenTopOffsetRate;
        float   xPos       = Screen.width * screenLeftOffsetRate;
        Vector2 pos        = new Vector2(xPos, yPos);
        float   textWidth  = Screen.width * textAreaWidthRate;
        float   textHeight = Screen.height * textAreaHeightRate;
        Vector2 size       = new Vector2(textWidth, textHeight);

        msgRect        = new Rect(pos, size);
        btnRect        = new Rect(pos, size);
        scrollViewRect = new Rect(pos, size);
        btnRect.height = btnHeight;
        contentWidth   = size.x;
        msgToBtnOffset = textHeight * .03f;
        msgStartY      = msgRect.y;
        msgMaxY        = msgStartY;
        transform.Find("BG").gameObject.SetActive(true);
        appearMsgStyle = new GUIStyle(msgStyle);
        appearColor    = appearMsgStyle.normal.textColor;
        appearColor.a  = 0;
        btnLowerY      = Screen.height - (Screen.height * screenTopOffsetRate) - btnHeight;
        hideMessageBox();
    }
Exemple #2
0
    public EquipmentsMarket init(PlanetSurface planetSurface, Inventory playerInventory, ItemDescriptor itemDescriptor)
    {
        this.planetSurface   = planetSurface;
        this.playerInventory = playerInventory;
        this.itemDescriptor  = itemDescriptor;

        buyMarket  = transform.Find("Buy Market").GetComponent <Inventory>().init(Inventory.InventoryType.MARKET);
        sellMarket = transform.Find("Sell Market").GetComponent <Inventory>().init(Inventory.InventoryType.MARKET);

        bgRender = transform.Find("Background").GetComponent <SpriteRenderer>();

        buyBtn   = transform.Find("Buy Button").GetComponent <Button> ().init();
        sellBtn  = transform.Find("Sell Button").GetComponent <Button> ().init();
        closeBtn = transform.Find("Close Button").GetComponent <Button>().init();

        actionMsg = transform.Find("Action Description").GetComponent <TextMesh>();
        MeshRenderer mesh = actionMsg.GetComponent <MeshRenderer>();

        mesh.sortingOrder = 1;

        for (int i = 0; i < transform.childCount; i++)
        {
            transform.GetChild(i).gameObject.SetActive(true);
        }

        popup = transform.Find("Popup").GetComponent <QuantityPopup>().init(this);
        popup.adjustPosition(Vector3.zero);

        gameObject.SetActive(false);

        return(this);
    }
    public IndustrialScreen init(PlanetSurface planetSurface)
    {
        this.planetSurface = planetSurface;

        laboratoryBtn  = transform.Find("Laboratory Button").GetComponent <Button>().init();
        workshopBtn    = transform.Find("Workshop Button").GetComponent <Button>().init();
        factoryshopBtn = transform.Find("Factoryshop Button").GetComponent <Button>().init();
        closeBtn       = transform.Find("Close Button").GetComponent <Button>().init();

        gameObject.SetActive(false);

        return(this);
    }
Exemple #4
0
    // Create, initialize, and render the planet surfaces
    private void CreatePlanetSurface(PlanetFace planetFace)
    {
        // Calculate the max LOD based on the radius of the planet.
        lodMax = (int)Math.Log((float)((2.0f * Math.PI * radius) / 4.0f), 2);
        int cubeSize = lodMax * 2;

        GameObject go = new GameObject("Surface");

        go.transform.parent   = this.transform;
        go.transform.position = transform.position;
        PlanetSurface planetSurface = go.AddComponent <PlanetSurface>();

        planetSurface.InitializeRoot(this, planetFace, lodMax, cubeSize);
        //planetSurface.GenerateMesh(Spherized);
        planetSurfaces.Add(planetSurface);
    }
    public AnnouncementScreen init(PlanetSurface planetSurface, Cabin cabin)
    {
        this.planetSurface = planetSurface;

        cabin.announcementScreen = this;

        enemyImage = transform.Find("Enemy Image").GetComponent <SpriteRenderer> ();

        closeBtn    = transform.Find("Close Button").GetComponent <Button>().init();
        applyBtn    = transform.Find("Apply Button").GetComponent <Button>().init();
        previousBtn = transform.Find("Previous Button").GetComponent <Button> ().init();
        nextBtn     = transform.Find("Next Button").GetComponent <Button> ().init();

        nameText              = transform.Find("Name").GetComponent <StrokeText>().init("default", 5);
        rewardText            = transform.Find("Reward").GetComponent <StrokeText>().init("default", 5);
        planetOfLivingText    = transform.Find("Planet of Living").GetComponent <StrokeText>().init("default", 5);
        destinationPlanetText = transform.Find("Destination Planet").GetComponent <StrokeText> ().init("default", 5);
        appliedText           = transform.Find("Applied").GetComponent <StrokeText>().init("default", 5);

        applyBtn.gameObject.SetActive(true);
        closeBtn.gameObject.SetActive(true);
        previousBtn.gameObject.SetActive(true);
        nextBtn.gameObject.SetActive(true);
        transform.Find("Background").gameObject.SetActive(true);
        transform.Find("Foreground").gameObject.SetActive(true);
        transform.Find("Enemy Image").gameObject.SetActive(true);
        nameText.gameObject.SetActive(true);
        rewardText.gameObject.SetActive(true);
        planetOfLivingText.gameObject.SetActive(true);
        destinationPlanetText.gameObject.SetActive(true);

        randomizeAnnouncements();

        gameObject.SetActive(false);

        return(this);
    }