示例#1
0
        private void __click()
        {
            if (sound != null)
            {
                Stage.inst.PlayOneShotSound(sound, soundVolumeScale);
            }

            // FairyGUI修改:添加按钮声音
            if (UIConfig.playSoundFunc != null)
            {
                if (_soundId == -1)
                {
                    UIConfig.playSoundFunc(UIConfig.defaultButtonSoundID, null, UIConfig.defaultButtonSoundVolume);
                }
                else if (_soundId != 0)
                {
                    UIConfig.playSoundFunc(_soundId, null, UIConfig.defaultButtonSoundVolume);
                }
            }

            if (_mode == ButtonMode.Check)
            {
                if (changeStateOnClick)
                {
                    this.selected = !_selected;
                    onChanged.Call();
                }
            }
            else if (_mode == ButtonMode.Radio)
            {
                if (changeStateOnClick && !_selected)
                {
                    this.selected = true;
                    onChanged.Call();
                }
            }
            else
            {
                if (_relatedController != null)
                {
                    _relatedController.selectedPageId = pageOption.id;
                }
            }
        }