完善小游戏逻辑
This commit is contained in:
+23
-9
@@ -7,10 +7,10 @@ import (
|
||||
"fyne.io/fyne/v2/dialog"
|
||||
"fyne.io/fyne/v2/theme"
|
||||
"fyne.io/fyne/v2/widget"
|
||||
"github.com/gin-gonic/gin"
|
||||
"time"
|
||||
"work_cation/global"
|
||||
"work_cation/models"
|
||||
"work_cation/pkg/utils"
|
||||
"work_cation/repo"
|
||||
"work_cation/service"
|
||||
)
|
||||
@@ -95,21 +95,35 @@ func OpenChat(user models.Users) {
|
||||
scroll.ScrollToBottom()
|
||||
}
|
||||
|
||||
online := &models.Online{ID: user.ID, Ip: user.Ip, Port: user.Port}
|
||||
// 分享
|
||||
toolBar := widget.NewToolbar(
|
||||
widget.NewToolbarAction(theme.ContentAddIcon(), func() {
|
||||
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
|
||||
widget.NewToolbarAction(theme.WarningIcon(), func() {
|
||||
var ilo *dialog.CustomDialog
|
||||
box := container.NewVBox()
|
||||
for _, item := range GameConfigList {
|
||||
var itemCopy = item
|
||||
box.Add(widget.NewButton(itemCopy.Name, func() {
|
||||
req := gin.H{
|
||||
"name": itemCopy.Name,
|
||||
"x": itemCopy.X,
|
||||
"y": itemCopy.Y,
|
||||
"win": itemCopy.Win}
|
||||
_, err := service.PostSend("/send_game", online, req)
|
||||
if err != nil {
|
||||
dialog.ShowError(err, w)
|
||||
}
|
||||
ilo.Hide()
|
||||
}))
|
||||
|
||||
}
|
||||
game.StartShow()
|
||||
ilo = dialog.NewCustomWithoutButtons("选择", box, w)
|
||||
ilo.Show()
|
||||
|
||||
}),
|
||||
)
|
||||
button := widget.NewButton("", submit)
|
||||
|
||||
Reference in New Issue
Block a user