1 Star 0 Fork 0

Ling_Boogie / mahjong-helper

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
majsoul_live.go 912 Bytes
一键复制 编辑 原始数据 按行查看 历史
18520664652 提交于 2021-12-31 10:06 . qwq
package main
import (
"fmt"
"gitee.com/ling_boogie/mahjong-helper/util"
"strconv"
"time"
)
// 观战基本信息
type majsoulLiveRecordBaseInfo struct {
UUID string `json:"uuid"`
StartTime int64 `json:"start_time"`
GameConfig *majsoulGameConfig `json:"game_config"`
Players []_majsoulRecordAccount `json:"players"`
SeatList []int `json:"seat_list"`
}
func (i *majsoulLiveRecordBaseInfo) String() string {
const timeFormat = "2006-01-02 15:04:05"
output := fmt.Sprintf("%s\n开始于 %s\n\n", i.UUID, time.Unix(i.StartTime, 0).Format(timeFormat))
maxAccountID := 0
for _, account := range i.Players {
maxAccountID = util.MaxInt(maxAccountID, account.AccountID)
}
accountShownWidth := len(strconv.Itoa(maxAccountID))
for _, account := range i.Players {
output += fmt.Sprintf("%*d %s\n", accountShownWidth, account.AccountID, account.Nickname)
}
return output
}
1
https://gitee.com/ling_boogie/mahjong-helper.git
git@gitee.com:ling_boogie/mahjong-helper.git
ling_boogie
mahjong-helper
mahjong-helper
v0.1.0

搜索帮助