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