Ejemplo n.º 1
0
    public void UpdateBodyToggleInfo(Toggle toggle)
    {
        BuildingObj nowBuilding = Buildings[selectFloor];
        CombineTing CT          = nowBuilding.transform.GetComponentInParent <CombineTing>();

        switch (toggle.name)
        {
        case BodyMenuHandler.GoldColToggle_NAME:
            if (CT)
            {
                CT.ResetGoldColumn(toggle.isOn);
                CT.ResetWindowAndDoorNum();
            }
            else
            {
                nowBuilding.ResetGoldColumn(toggle.isOn);
                nowBuilding.ResetWindowAndDoorNum();
            }
            break;

        case BodyMenuHandler.FriezeToggle_NAME:
            if (CT)
            {
                CT.ResetFrieze(toggle.isOn);
            }
            else
            {
                nowBuilding.ResetFrieze(toggle.isOn);
            }
            break;

        case BodyMenuHandler.BalustradeToggle_NAME:
            if (CT)
            {
                CT.ResetBalustrade(toggle.isOn);
            }
            else
            {
                nowBuilding.ResetBalustrade(toggle.isOn);
            }
            break;

        default:
            print("!!! Can't Find Toggle Name !!!");
            break;
        }
    }
Ejemplo n.º 2
0
    /**
     * 更新屋身
     */
    public void UpdateBodySliderInfo(Slider slider)
    {
        BuildingObj nowBuilding = Buildings[selectFloor];
        CombineTing CT          = nowBuilding.transform.GetComponentInParent <CombineTing>();

        switch (slider.name)
        {
        case BodyMenuHandler.ColumeHeightSlider_NAME:

            if (CT)
            {
                float moveOffset = slider.value - CT.bodyController.eaveColumnHeight;
                for (int i = 0; i < CT.BuildingsList.Count; i++)
                {
                    CT.BuildingsList[i].MoveBuildingRoof(new Vector3(0, moveOffset, 0));
                }
                CT.bodyController.eaveColumnHeight = slider.value;
                CT.bodyController.goldColumnHeight = slider.value;
                CT.UpdateBodyFunction();
            }
            else
            {
                float moveOffset = slider.value - nowBuilding.bodyController.eaveColumnHeight;
                nowBuilding.bodyController.eaveColumnHeight = slider.value;
                nowBuilding.bodyController.goldColumnHeight = slider.value;
                nowBuilding.MoveBuildingRoof(new Vector3(0, moveOffset, 0));
                nowBuilding.ResetBodyFunction();
            }
            break;

        case BodyMenuHandler.GoldColNumSlider_NAME:
            if (CT)
            {
                CT.bodyController.goldColumnbayNumber = (int)slider.value;
                CT.UpdateBodyFunction();
            }
            else
            {
                nowBuilding.bodyController.goldColumnbayNumber = (int)slider.value;
                nowBuilding.DeleteGoldColumn();
                nowBuilding.ResetGoldColumn(true);
                nowBuilding.ResetWindowAndDoorNum();
            }
            break;

        case BodyMenuHandler.UnitInBay_NAME:

            if (CT)
            {
                CT.bodyController.unitNumberInBay = (int)slider.value;
                CT.UpdateBodyFunction();
            }
            else
            {
                nowBuilding.bodyController.unitNumberInBay = (int)slider.value;
                nowBuilding.ResetWindowAndDoorNum();
            }
            break;

        case BodyMenuHandler.DoorNumSlider_NAME:

            if (CT)
            {
                CT.bodyController.doorNumber = (int)slider.value;
                CT.UpdateBodyFunction();
            }
            else
            {
                nowBuilding.bodyController.doorNumber = (int)slider.value;
                nowBuilding.ResetWindowAndDoorNum();
            }
            break;

        case BodyMenuHandler.BodyWidthSlider_NAME:

            if (CT)
            {
                nowBuilding.bodyController.bodyWidth = slider.value;
                nowBuilding.ResetBodyFunction();
                CT.UpdateBodyFunction();
                CT.UpdatePlatformFunction();
            }
            else
            {
                nowBuilding.bodyController.bodyWidth = slider.value;
                nowBuilding.ResetBodyFunction();
            }
            break;

        case BodyMenuHandler.BodyLengthSlider_NAME:

            if (CT)
            {
                nowBuilding.bodyController.bodyLength = slider.value;
                nowBuilding.ResetBodyFunction();
                CT.UpdateBodyFunction();
                CT.UpdatePlatformFunction();
            }
            else
            {
                nowBuilding.bodyController.bodyLength = slider.value;
                nowBuilding.ResetBodyFunction();
            }
            break;
        }
    }