本文整理匯總了Golang中casino/game.JsonString.GetTime方法的典型用法代碼示例。如果您正苦於以下問題:Golang JsonString.GetTime方法的具體用法?Golang JsonString.GetTime怎麽用?Golang JsonString.GetTime使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類casino/game.JsonString
的用法示例。
在下文中一共展示了JsonString.GetTime方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: OnLogin
func OnLogin(m game.JsonString, c net.Conn) {
fmt.Println("OnLogin")
uid, cid, t, name := m.GetUid(), m.GetCid(), m.GetTime(), m.GetName()
diff := time.Now().Unix() - t
if diff >= common.ENDURE_SEC || diff < 0 {
rep := game.LoginRep{common.RET_TME, uid, 0, 0, 0, "login"}
game.SendMsg(c, rep)
return
}
award, lost := TimeCheck(uid)
fmt.Println("time check", award, lost)
bal, _ := db.ModifyBalance(uid, int32(award-lost))
//bal := mod_ret.Balance
db.SetLoginTime(uid)
db.SetName(uid, name)
r, ok := m.GetRound(Casino)
if ok == false { // 創建
r = &game.Round{0, make(map[uint32]game.User, common.MAX_USER), make(map[uint32]game.Player, common.MAX_PLAYER), 0}
Casino[cid] = r
}
user := game.User{c, uid}
ret := r.Login(user, cid)
rep := game.LoginRep{ret, uid, award, lost, bal, "login"}
if ret == common.RET_OK {
r.Broadcast(rep)
} else {
game.SendMsg(c, rep)
}
fmt.Println("Login rep:", rep)
}