mirror of
https://github.com/AynaLivePlayer/AynaLivePlayer.git
synced 2025-12-13 05:28:16 +08:00
add enabled button
This commit is contained in:
@@ -568,6 +568,10 @@
|
||||
"en": "Admin only",
|
||||
"zh-CN": "仅房管可操作"
|
||||
},
|
||||
"plugin.yinliang.enabled": {
|
||||
"en": "Enabled volume control",
|
||||
"zh-CN": "启用弹幕音量控制"
|
||||
},
|
||||
"plugin.yinliang.volume_up_cmd": {
|
||||
"en": "Volume increase command",
|
||||
"zh-CN": "音量增加命令"
|
||||
|
||||
@@ -21,6 +21,7 @@ import (
|
||||
|
||||
type Yinliang struct {
|
||||
config.BaseConfig
|
||||
Enabled bool
|
||||
AdminPermission bool
|
||||
VolumeUpCMD string
|
||||
VolumeDownCMD string
|
||||
@@ -32,11 +33,12 @@ type Yinliang struct {
|
||||
|
||||
func NewYinliang() *Yinliang {
|
||||
return &Yinliang{
|
||||
Enabled: false,
|
||||
AdminPermission: true,
|
||||
VolumeUpCMD: "音量调大",
|
||||
VolumeDownCMD: "音量调小",
|
||||
VolumeStep: 5.0,
|
||||
MaxVolume: 50.0,
|
||||
MaxVolume: 75.0,
|
||||
currentVolume: 50.0,
|
||||
}
|
||||
}
|
||||
@@ -82,6 +84,9 @@ func (y *Yinliang) Disable() error {
|
||||
}
|
||||
|
||||
func (y *Yinliang) handleMessage(event *event.Event) {
|
||||
if !y.Enabled {
|
||||
return
|
||||
}
|
||||
message := event.Data.(events.LiveRoomMessageReceiveEvent).Message
|
||||
cmd := strings.TrimSpace(message.Message)
|
||||
|
||||
@@ -126,6 +131,10 @@ func (y *Yinliang) CreatePanel() fyne.CanvasObject {
|
||||
return y.panel
|
||||
}
|
||||
|
||||
enabledCheck := component.NewCheckOneWayBinding(i18n.T("plugin.yinliang.enabled"),
|
||||
&y.AdminPermission,
|
||||
y.AdminPermission)
|
||||
|
||||
permCheck := component.NewCheckOneWayBinding(
|
||||
i18n.T("plugin.yinliang.admin_permission"),
|
||||
&y.AdminPermission,
|
||||
@@ -174,6 +183,7 @@ func (y *Yinliang) CreatePanel() fyne.CanvasObject {
|
||||
)
|
||||
|
||||
y.panel = container.NewVBox(
|
||||
enabledCheck,
|
||||
permCheck,
|
||||
cmdConfig,
|
||||
volumeControlConfig,
|
||||
|
||||
Reference in New Issue
Block a user