网络游戏初步接入
This commit is contained in:
+12
-2
@@ -8,9 +8,9 @@ import (
|
||||
"fyne.io/fyne/v2/theme"
|
||||
"fyne.io/fyne/v2/widget"
|
||||
"time"
|
||||
"work_cation/cfg"
|
||||
"work_cation/global"
|
||||
"work_cation/models"
|
||||
"work_cation/pkg/utils"
|
||||
"work_cation/repo"
|
||||
"work_cation/service"
|
||||
)
|
||||
@@ -79,7 +79,7 @@ func OpenChat(user models.Users) {
|
||||
}
|
||||
online := service.Zeroconf.GetOnline(user.ID)
|
||||
if online == nil {
|
||||
online = &models.Online{ID: user.ID, Ip: user.Ip, Port: cfg.T.ServerAddr}
|
||||
online = &models.Online{ID: user.ID, Ip: user.Ip, Port: user.Port}
|
||||
}
|
||||
msg, err := service.Client.Chat(online, en.Text)
|
||||
if err != nil || msg != "ok" {
|
||||
@@ -101,6 +101,16 @@ func OpenChat(user models.Users) {
|
||||
dialog.ShowInformation("未开发", "分享脚本功能 尽请期待", w)
|
||||
}),
|
||||
widget.NewToolbarAction(theme.CancelIcon(), func() { w.Close() }),
|
||||
widget.NewToolbarAction(theme.MailForwardIcon(), func() {
|
||||
game := NewTenGame(nil)
|
||||
online := &models.Online{ID: user.ID, Ip: user.Ip, Port: user.Port}
|
||||
err := game.AddNet(utils.Uuid.CreateUUID(), 0, online, &user)
|
||||
if err != nil {
|
||||
dialog.ShowInformation("错误", err.Error(), w)
|
||||
return
|
||||
}
|
||||
game.StartShow()
|
||||
}),
|
||||
)
|
||||
button := widget.NewButton("", submit)
|
||||
button.SetIcon(theme.ConfirmIcon())
|
||||
|
||||
Reference in New Issue
Block a user