示例#1
0
    void Awake()
    {
        _creation = GetComponentInChildren <SettingCreation>(true);

        _creation.TryQualityForPlatform(out _quality, true, false);
        _creation.TryResolutionForPlatform(out _resolution, 800, 600, null, false, false);
        _creation.TryLanguageForPlatform(out _language, false, false);
        _creation.TryFullScreenForPlatform(out _fullScreen, false);
        _creation.TryVolumeForPlatform("Master Volume", out _master, 1, false, false);
        _creation.TryVolumeForPlatform("Music Volume", out _music, 1, false, false);
        _creation.TryVolumeForPlatform("SFX Volume", out _soundEffect, 1, false, false);

        var buttonLayout = _creation.HorizontalLayout("Buttons");

        if (_creation.TryForPlatform("Apply", true, out _apply))
        {
            _creation.AddToLayout(buttonLayout, _apply);
            _apply.onClick.AddListener(ApplyChanges);
        }

        if (_creation.TryForPlatform("Cancel", true, out _cancel))
        {
            _creation.AddToLayout(buttonLayout, _cancel);
        }
    }