示例#1
0
    public void AddBuilding(BuildingInfo bi)
    {
        if (bi.type == 0)
        {
            dfButton button     = (dfButton)Instantiate(prefabBuildingButton);
            dfButton helpButton = (dfButton)Instantiate(prefabHelpButton);

            button.Text = bi.ButtonText();

            BuildingInfoContainer container = button.GetComponent <BuildingInfoContainer>();
            container.bi = bi;

            buildingBackButton.ZOrder = 0;
            button.ZOrder             = -1;
            buildButtonPanel.AddControl(button);
            button.AddControl(helpButton);



            HelpButton helpScript = helpButton.GetComponent <HelpButton>();
            helpScript.bi = bi;

            helpButton.RelativePosition = new Vector3(button.Width - helpButton.Width - 8, button.Height - helpButton.Height - 2, 0);
            helpButton.BringToFront();
        }
    }