Пример #1
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;
        }
    }
Пример #2
0
    /**
     * 更新基座
     */
    public void UpdatePlameSliderInfo(Slider slider)
    {
        PlatformController platform    = Buildings[selectFloor].platformController;
        BuildingObj        nowBuilding = Buildings[selectFloor];
        CombineTing        CT          = nowBuilding.transform.GetComponentInParent <CombineTing>();

        switch (slider.name)
        {
        case PlamformMenuHandler.WidthSlider_NAME:
            if (CT)
            {
                CT.platformController.platWidth = slider.value;
                CT.UpdatePlatformFunction();
            }
            else
            {
                nowBuilding.ResetPlatformFunction(platform.platLength, slider.value, platform.platHeight, platform.isStair);
            }
            break;

        case PlamformMenuHandler.DepthSlider_NAME:
            nowBuilding.ResetPlatformFunction(slider.value, platform.platWidth, platform.platHeight, platform.isStair);
            break;

        case PlamformMenuHandler.HeightSlider_NAME:

            if (CT)
            {
                float moveOffset = (slider.value - CT.platformController.platHeight) / 2;
                CT.MoveBuildingBody(new Vector3(0, moveOffset, 0));
                for (int i = 0; i < CT.BuildingsList.Count; i++)
                {
                    CT.BuildingsList[i].MoveBuildingRoof(new Vector3(0, moveOffset, 0));
                }
                CT.platformController.platHeight = slider.value;
                CT.UpdatePlatformFunction();
            }
            else
            {
                float moveOffset = (slider.value - nowBuilding.platformController.platHeight) / 2;
                nowBuilding.MoveBuildingBody(new Vector3(0, moveOffset, 0));
                nowBuilding.MoveBuildingRoof(new Vector3(0, moveOffset, 0));
                nowBuilding.ResetPlatformFunction(platform.platLength, platform.platWidth, slider.value, platform.isStair);
            }
            break;

        case PlamformMenuHandler.StairNumSlider_NAME:

            break;

        case PlamformMenuHandler.StairLengthSlider_NAME:
            nowBuilding.ResetStair(slider.value, platform.stairWidth);                      //***參數未設定好
            break;

        case PlamformMenuHandler.StairWidthSlider_NAME:
            nowBuilding.ResetStair(platform.stairLength, slider.value);                      //***參數未設定好
            break;

        default:
            print("!!! Can't Find Slider Name !!!");
            break;
        }
    }