diff --git a/battle_srv/api/v1/player.go b/battle_srv/api/v1/player.go index 2636826..180f62a 100644 --- a/battle_srv/api/v1/player.go +++ b/battle_srv/api/v1/player.go @@ -1,6 +1,11 @@ package v1 import ( + "battle_srv/api" + . "battle_srv/common" + "battle_srv/common/utils" + "battle_srv/models" + "battle_srv/storage" "bytes" "crypto/sha256" "encoding/hex" @@ -10,11 +15,6 @@ import ( "go.uber.org/zap" "io/ioutil" "net/http" - "server/api" - . "server/common" - "server/common/utils" - "server/models" - "server/storage" "strconv" . "dnmshared" @@ -79,7 +79,6 @@ func (p *playerController) SMSCaptchaGet(c *gin.Context) { c.Set(api.RET, Constants.RetCode.UnknownError) return } - // Redis剩余时长校验 if ttl >= ConstVals.Player.CaptchaMaxTTL { Logger.Info("There's an existing SmsCaptcha record in Redis-server: ", zap.String("key", redisKey), zap.Duration("ttl", ttl)) c.Set(api.RET, Constants.RetCode.SmsCaptchaRequestedTooFrequently) @@ -89,7 +88,6 @@ func (p *playerController) SMSCaptchaGet(c *gin.Context) { pass := false var succRet int if Conf.General.ServerEnv == SERVER_ENV_TEST { - // 测试环境,优先从数据库校验`player.name`,不通过再走机器人magic name校验 player, err := models.GetPlayerByName(req.Num) if nil == err && nil != player { pass = true @@ -98,7 +96,6 @@ func (p *playerController) SMSCaptchaGet(c *gin.Context) { } if !pass { - // 机器人magic name校验,不通过再走手机号校验 player, err := models.GetPlayerByName(req.Num) if nil == err && nil != player { pass = true @@ -111,7 +108,6 @@ func (p *playerController) SMSCaptchaGet(c *gin.Context) { succRet = Constants.RetCode.Ok pass = true } - // Hardecoded 只验证国内手机号格式 if req.CountryCode == "86" { if RE_CHINA_PHONE_NUM.MatchString(req.Num) { succRet = Constants.RetCode.Ok @@ -133,7 +129,6 @@ func (p *playerController) SMSCaptchaGet(c *gin.Context) { }{Ret: succRet} var captcha string if ttl >= 0 { - // 已有未过期的旧验证码记录,续验证码有效期。 storage.RedisManagerIns.Expire(redisKey, ConstVals.Player.CaptchaExpire) captcha = storage.RedisManagerIns.Get(redisKey).Val() if ttl >= ConstVals.Player.CaptchaExpire/4 { @@ -147,7 +142,6 @@ func (p *playerController) SMSCaptchaGet(c *gin.Context) { } Logger.Info("Extended ttl of existing SMSCaptcha record in Redis:", zap.String("key", redisKey), zap.String("captcha", captcha)) } else { - // 校验通过,进行验证码生成处理 captcha = strconv.Itoa(utils.Rand.Number(1000, 9999)) if succRet == Constants.RetCode.Ok { getSmsCaptchaRespErrorCode := sendSMSViaVendor(req.Num, req.CountryCode, captcha) @@ -234,7 +228,6 @@ func (p *playerController) WechatLogin(c *gin.Context) { return } - //baseInfo ResAccessToken 获取用户授权access_token的返回结果 baseInfo, err := utils.WechatIns.GetOauth2Basic(req.Authcode) if err != nil { @@ -250,7 +243,6 @@ func (p *playerController) WechatLogin(c *gin.Context) { c.Set(api.RET, Constants.RetCode.WechatServerError) return } - //fserver不会返回openId userInfo.OpenID = baseInfo.OpenID player, err := p.maybeCreatePlayerWechatAuthBinding(userInfo) @@ -316,7 +308,6 @@ func (p *playerController) WechatGameLogin(c *gin.Context) { return } - //baseInfo ResAccessToken 获取用户授权access_token的返回结果 baseInfo, err := utils.WechatGameIns.GetOauth2Basic(req.Authcode) if err != nil { @@ -337,7 +328,6 @@ func (p *playerController) WechatGameLogin(c *gin.Context) { c.Set(api.RET, Constants.RetCode.WechatServerError) return } - //fserver不会返回openId userInfo.OpenID = baseInfo.OpenID player, err := p.maybeCreatePlayerWechatGameAuthBinding(userInfo) @@ -395,7 +385,6 @@ func (p *playerController) IntAuthTokenLogin(c *gin.Context) { return } - //kobako: 从player获取display name等 player, err := models.GetPlayerById(playerLogin.PlayerID) if err != nil { Logger.Error("Get player by id in IntAuthTokenLogin function error: ", zap.Error(err)) @@ -479,7 +468,6 @@ func (p *playerController) TokenAuth(c *gin.Context) { c.Abort() } -// 以下是内部私有函数 func (p *playerController) maybeCreateNewPlayer(req smsCaptchaReq) (*models.Player, error) { extAuthID := req.extAuthID() if Conf.General.ServerEnv == SERVER_ENV_TEST { @@ -492,7 +480,7 @@ func (p *playerController) maybeCreateNewPlayer(req smsCaptchaReq) (*models.Play Logger.Info("Got a test env player:", zap.Any("phonenum", req.Num), zap.Any("playerId", player.Id)) return player, nil } - } else { //正式环境检查是否为bot用户 + } else { botPlayer, err := models.GetPlayerByName(req.Num) if err != nil { Logger.Error("Seeking bot player error:", zap.Error(err)) @@ -537,19 +525,17 @@ func (p *playerController) maybeCreatePlayerWechatAuthBinding(userInfo utils.Use return nil, err } if player != nil { - { //更新玩家姓名及头像 - updateInfo := models.Player{ - Avatar: userInfo.HeadImgURL, - DisplayName: userInfo.Nickname, - } - tx := storage.MySQLManagerIns.MustBegin() - defer tx.Rollback() - ok, err := models.Update(tx, player.Id, &updateInfo) - if err != nil && ok != true { - return nil, err - } else { - tx.Commit() - } + updateInfo := models.Player{ + Avatar: userInfo.HeadImgURL, + DisplayName: userInfo.Nickname, + } + tx := storage.MySQLManagerIns.MustBegin() + defer tx.Rollback() + ok, err := models.Update(tx, player.Id, &updateInfo) + if err != nil && ok != true { + return nil, err + } else { + tx.Commit() } return player, nil } @@ -575,19 +561,17 @@ func (p *playerController) maybeCreatePlayerWechatGameAuthBinding(userInfo utils return nil, err } if player != nil { - { //更新玩家姓名及头像 - updateInfo := models.Player{ - Avatar: userInfo.HeadImgURL, - DisplayName: userInfo.Nickname, - } - tx := storage.MySQLManagerIns.MustBegin() - defer tx.Rollback() - ok, err := models.Update(tx, player.Id, &updateInfo) - if err != nil && ok != true { - return nil, err - } else { - tx.Commit() - } + updateInfo := models.Player{ + Avatar: userInfo.HeadImgURL, + DisplayName: userInfo.Nickname, + } + tx := storage.MySQLManagerIns.MustBegin() + defer tx.Rollback() + ok, err := models.Update(tx, player.Id, &updateInfo) + if err != nil && ok != true { + return nil, err + } else { + tx.Commit() } return player, nil } @@ -672,15 +656,13 @@ func sendSMSViaVendor(mobile string, nationcode string, captchaCode string) int Nationcode: nationcode, } var captchaExpireMin string - //短信有效期hardcode if Conf.General.ServerEnv == SERVER_ENV_TEST { - //测试环境下有效期为20秒 先hardcode了 - captchaExpireMin = "0.5" + captchaExpireMin = "0.5" // Hardcoded } else { captchaExpireMin = strconv.Itoa(int(ConstVals.Player.CaptchaExpire) / 60000000000) } params := [2]string{captchaCode, captchaExpireMin} - appkey := "41a5142feff0b38ade02ea12deee9741" // TODO: Should read from config file! + appkey := "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" // TODO: Should read from config file! rand := strconv.Itoa(utils.Rand.Number(1000, 9999)) now := utils.UnixtimeSec() @@ -694,7 +676,7 @@ func sendSMSViaVendor(mobile string, nationcode string, captchaCode string) int Extend: "", Params: ¶ms, Sig: sig, - Sign: "洛克互娱", + Sign: "YYYYYYYYYYYYYYYYY", Tel: tel, Time: now, Tpl_id: 207399, @@ -705,7 +687,7 @@ func sendSMSViaVendor(mobile string, nationcode string, captchaCode string) int Logger.Info("json marshal", zap.Any("err:", err)) return -1 } - resp, err := http.Post("https://yun.tim.qq.com/v5/tlssmssvr/sendsms?sdkappid=1400150185&random="+rand, + resp, err := http.Post("https://yun.tim.qq.com/v5/tlssmssvr/sendsms?sdkappid=uuuuuuuuuuuuuuuuuuuuuuuu&random="+rand, "application/json", req) if err != nil { diff --git a/battle_srv/common/utils/wechat.go b/battle_srv/common/utils/wechat.go index fc72524..e8c59b6 100644 --- a/battle_srv/common/utils/wechat.go +++ b/battle_srv/common/utils/wechat.go @@ -1,6 +1,8 @@ package utils import ( + . "battle_srv/common" + . "battle_srv/configs" "bytes" "crypto/sha1" . "dnmshared" @@ -11,8 +13,6 @@ import ( "io/ioutil" "math/rand" "net/http" - . "server/common" - . "server/configs" "sort" "time" ) @@ -250,10 +250,6 @@ func (w *wechat) getTicketFromServer() (ticket resTicket, err error) { return } - //jsAPITicketCacheKey := fmt.Sprintf("jsapi_ticket_%s", w.config.AppID) - //expires := ticket.ExpiresIn - 1500 - //set - //err = js.Cache.Set(jsAPITicketCacheKey, ticket.Ticket, time.Duration(expires)*time.Second) return } @@ -276,9 +272,6 @@ func (w *wechat) getAccessTokenFromServer() (accessToken string, err error) { return } - //accessTokenCacheKey := fmt.Sprintf("access_token_%s", w.config.AppID) - //expires := r.ExpiresIn - 1500 - //set to redis err = ctx.Cache.Set(accessTokenCacheKey, r.AccessToken, time.Duration(expires)*time.Second) accessToken = r.AccessToken return } diff --git a/battle_srv/env_tools/load_pre_conf.go b/battle_srv/env_tools/load_pre_conf.go index f64b0a0..fec7eb7 100644 --- a/battle_srv/env_tools/load_pre_conf.go +++ b/battle_srv/env_tools/load_pre_conf.go @@ -1,15 +1,15 @@ package env_tools import ( + . "battle_srv/common" + "battle_srv/common/utils" + "battle_srv/models" + "battle_srv/storage" . "dnmshared" sq "github.com/Masterminds/squirrel" "github.com/jmoiron/sqlx" _ "github.com/mattn/go-sqlite3" "go.uber.org/zap" - . "server/common" - "server/common/utils" - "server/models" - "server/storage" ) func LoadPreConf() { diff --git a/battle_srv/env_tools/test_env_db.go b/battle_srv/env_tools/test_env_db.go index df1bcaf..152f244 100644 --- a/battle_srv/env_tools/test_env_db.go +++ b/battle_srv/env_tools/test_env_db.go @@ -1,11 +1,11 @@ package env_tools import ( + . "battle_srv/common" + "battle_srv/common/utils" + "battle_srv/models" + "battle_srv/storage" . "dnmshared" - . "server/common" - "server/common/utils" - "server/models" - "server/storage" "github.com/jmoiron/sqlx" _ "github.com/mattn/go-sqlite3" diff --git a/battle_srv/main.go b/battle_srv/main.go index c214e8c..25653ed 100644 --- a/battle_srv/main.go +++ b/battle_srv/main.go @@ -1,12 +1,6 @@ package main import ( - "context" - "fmt" - "net/http" - "os" - "os/signal" - "path/filepath" "battle_srv/api" "battle_srv/api/v1" . "battle_srv/common" @@ -14,6 +8,12 @@ import ( "battle_srv/models" "battle_srv/storage" "battle_srv/ws" + "context" + "fmt" + "net/http" + "os" + "os/signal" + "path/filepath" "syscall" "time" diff --git a/battle_srv/models/barrier.go b/battle_srv/models/barrier.go index 7df588e..ec3b062 100644 --- a/battle_srv/models/barrier.go +++ b/battle_srv/models/barrier.go @@ -1,7 +1,7 @@ package models import ( - . "dnmshared" + . "dnmshared/sharedprotos" ) type Barrier struct { diff --git a/battle_srv/models/pb_type_convert.go b/battle_srv/models/pb_type_convert.go index f273271..7686d81 100644 --- a/battle_srv/models/pb_type_convert.go +++ b/battle_srv/models/pb_type_convert.go @@ -1,77 +1,22 @@ package models import ( - . "dnmshared" - pb "server/pb_output" + . "battle_srv/protos" + . "dnmshared/sharedprotos" ) -func toPbVec2D(modelInstance *Vec2D) *pb.Vec2D { - toRet := &pb.Vec2D{ - X: modelInstance.X, - Y: modelInstance.Y, - } - return toRet -} - -func toPbPolygon2D(modelInstance *Polygon2D) *pb.Polygon2D { - toRet := &pb.Polygon2D{ - Anchor: toPbVec2D(modelInstance.Anchor), - Points: make([]*pb.Vec2D, len(modelInstance.Points)), - } - for index, p := range modelInstance.Points { - toRet.Points[index] = toPbVec2D(p) - } - return toRet -} - -func toPbVec2DList(modelInstance *Vec2DList) *pb.Vec2DList { - toRet := &pb.Vec2DList{ - Vec2DList: make([]*pb.Vec2D, len(*modelInstance)), - } - for k, v := range *modelInstance { - toRet.Vec2DList[k] = toPbVec2D(v) - } - return toRet -} - -func ToPbVec2DListMap(modelInstances map[string]*Vec2DList) map[string]*pb.Vec2DList { - toRet := make(map[string]*pb.Vec2DList, len(modelInstances)) - for k, v := range modelInstances { - toRet[k] = toPbVec2DList(v) - } - return toRet -} - -func toPbPolygon2DList(modelInstance *Polygon2DList) *pb.Polygon2DList { - toRet := &pb.Polygon2DList{ - Polygon2DList: make([]*pb.Polygon2D, len(*modelInstance)), - } - for k, v := range *modelInstance { - toRet.Polygon2DList[k] = toPbPolygon2D(v) - } - return toRet -} - -func ToPbPolygon2DListMap(modelInstances map[string]*Polygon2DList) map[string]*pb.Polygon2DList { - toRet := make(map[string]*pb.Polygon2DList, len(modelInstances)) - for k, v := range modelInstances { - toRet[k] = toPbPolygon2DList(v) - } - return toRet -} - -func toPbPlayers(modelInstances map[int32]*Player) map[int32]*pb.Player { - toRet := make(map[int32]*pb.Player, 0) +func toPbPlayers(modelInstances map[int32]*Player) map[int32]*PlayerDownsync { + toRet := make(map[int32]*PlayerDownsync, 0) if nil == modelInstances { return toRet } for k, last := range modelInstances { - toRet[k] = &pb.Player{ + toRet[k] = &PlayerDownsync{ Id: last.Id, VirtualGridX: last.VirtualGridX, VirtualGridY: last.VirtualGridY, - Dir: &pb.Direction{ + Dir: &Direction{ Dx: last.Dir.Dx, Dy: last.Dir.Dy, }, diff --git a/battle_srv/models/player.go b/battle_srv/models/player.go index b0943e6..5d89701 100644 --- a/battle_srv/models/player.go +++ b/battle_srv/models/player.go @@ -2,7 +2,7 @@ package models import ( "database/sql" - . "dnmshared" + . "dnmshared/sharedprotos" "fmt" sq "github.com/Masterminds/squirrel" "github.com/jmoiron/sqlx" diff --git a/battle_srv/models/player_dao_helper.go b/battle_srv/models/player_dao_helper.go index c09a257..ca3bbe1 100644 --- a/battle_srv/models/player_dao_helper.go +++ b/battle_srv/models/player_dao_helper.go @@ -1,9 +1,9 @@ package models import ( + "battle_srv/storage" "database/sql" . "dnmshared" - "server/storage" sq "github.com/Masterminds/squirrel" "github.com/jmoiron/sqlx" diff --git a/battle_srv/models/player_login.go b/battle_srv/models/player_login.go index 96f4ea8..1039a02 100644 --- a/battle_srv/models/player_login.go +++ b/battle_srv/models/player_login.go @@ -1,10 +1,10 @@ package models import ( + . "battle_srv/common" + "battle_srv/common/utils" + "battle_srv/storage" "database/sql" - . "server/common" - "server/common/utils" - "server/storage" sq "github.com/Masterminds/squirrel" ) diff --git a/battle_srv/models/player_wallet.go b/battle_srv/models/player_wallet.go index 48c3425..ca4cef0 100644 --- a/battle_srv/models/player_wallet.go +++ b/battle_srv/models/player_wallet.go @@ -1,11 +1,11 @@ package models import ( + . "battle_srv/common" + "battle_srv/common/utils" "database/sql" . "dnmshared" "errors" - . "server/common" - "server/common/utils" sq "github.com/Masterminds/squirrel" "github.com/jmoiron/sqlx" diff --git a/battle_srv/models/room.go b/battle_srv/models/room.go index 456ceb2..54f8744 100644 --- a/battle_srv/models/room.go +++ b/battle_srv/models/room.go @@ -1,6 +1,9 @@ package models import ( + . "battle_srv/common" + "battle_srv/common/utils" + . "battle_srv/protos" . "dnmshared" "encoding/xml" "fmt" @@ -13,9 +16,6 @@ import ( "math/rand" "os" "path/filepath" - . "battle_srv/common" - "battle_srv/common/utils" - pb "battle_srv/protos" "strings" "sync" "sync/atomic" @@ -328,7 +328,7 @@ func (pR *Room) ChooseStage() error { barrierPolygon2DList := *(toRetStrToPolygon2DListMap["Barrier"]) var barrierLocalIdInBattle int32 = 0 - for _, polygon2DUnaligned := range barrierPolygon2DList { + for _, polygon2DUnaligned := range barrierPolygon2DList.Eles { polygon2D := AlignPolygon2DToBoundingBox(polygon2DUnaligned) /* // For debug-printing only. @@ -361,7 +361,7 @@ func (pR *Room) ConvertToLastUsedRenderFrameId(inputFrameId int32, inputDelayFra return ((inputFrameId << pR.InputScaleFrames) + inputDelayFrames + (1 << pR.InputScaleFrames) - 1) } -func (pR *Room) EncodeUpsyncCmd(upsyncCmd *pb.InputFrameUpsync) uint64 { +func (pR *Room) EncodeUpsyncCmd(upsyncCmd *InputFrameUpsync) uint64 { var ret uint64 = 0 // There're 13 possible directions, occupying the first 4 bits, no need to shift ret += uint64(upsyncCmd.EncodedDir) @@ -385,7 +385,7 @@ func (pR *Room) InputsBufferString(allDetails bool) string { if nil == tmp { break } - f := tmp.(*pb.InputFrameDownsync) + f := tmp.(*InputFrameDownsync) s = append(s, fmt.Sprintf("{inputFrameId: %v, inputList: %v, confirmedList: %v}", f.InputFrameId, f.InputList, f.ConfirmedList)) } @@ -407,7 +407,7 @@ func (pR *Room) StartBattle() { // Initialize the "collisionSys" as well as "RenderFrameBuffer" pR.CurDynamicsRenderFrameId = 0 - kickoffFrame := &pb.RoomDownsyncFrame{ + kickoffFrame := &RoomDownsyncFrame{ Id: pR.RenderFrameId, Players: toPbPlayers(pR.Players), CountdownNanos: pR.BattleDurationNanos, @@ -508,11 +508,11 @@ func (pR *Room) StartBattle() { continue } if 0 == pR.RenderFrameId { - kickoffFrame := pR.RenderFrameBuffer.GetByFrameId(0).(*pb.RoomDownsyncFrame) + kickoffFrame := pR.RenderFrameBuffer.GetByFrameId(0).(*RoomDownsyncFrame) pR.sendSafely(kickoffFrame, nil, DOWNSYNC_MSG_ACT_BATTLE_START, playerId) } else { // [WARNING] Websocket is TCP-based, thus no need to re-send a previously sent inputFrame to a same player! - toSendInputFrames := make([]*pb.InputFrameDownsync, 0, pR.InputsBuffer.Cnt) + toSendInputFrames := make([]*InputFrameDownsync, 0, pR.InputsBuffer.Cnt) candidateToSendInputFrameId := pR.Players[playerId].LastSentInputFrameId + 1 if candidateToSendInputFrameId < pR.InputsBuffer.StFrameId { // [WARNING] As "player.LastSentInputFrameId <= lastAllConfirmedInputFrameIdWithChange" for each iteration, and "lastAllConfirmedInputFrameIdWithChange <= lastAllConfirmedInputFrameId" where the latter is used to "applyInputFrameDownsyncDynamics" and then evict "pR.InputsBuffer", thus there's a very high possibility that "player.LastSentInputFrameId" is already evicted. @@ -532,7 +532,7 @@ func (pR *Room) StartBattle() { if nil == tmp { panic(fmt.Sprintf("Required inputFrameId=%v for roomId=%v, playerId=%v doesn't exist! InputsBuffer=%v", candidateToSendInputFrameId, pR.Id, playerId, pR.InputsBufferString(false))) } - f := tmp.(*pb.InputFrameDownsync) + f := tmp.(*InputFrameDownsync) if pR.inputFrameIdDebuggable(candidateToSendInputFrameId) { Logger.Debug("inputFrame lifecycle#3[sending]:", zap.Any("roomId", pR.Id), zap.Any("playerId", playerId), zap.Any("playerAckingInputFrameId", player.AckingInputFrameId), zap.Any("inputFrameId", candidateToSendInputFrameId), zap.Any("inputFrameId-doublecheck", f.InputFrameId), zap.Any("InputsBuffer", pR.InputsBufferString(false)), zap.Any("ConfirmedList", f.ConfirmedList)) } @@ -557,7 +557,7 @@ func (pR *Room) StartBattle() { if nil == tmp { panic(fmt.Sprintf("Required refRenderFrameId=%v for roomId=%v, playerId=%v, candidateToSendInputFrameId=%v doesn't exist! InputsBuffer=%v, RenderFrameBuffer=%v", refRenderFrameId, pR.Id, playerId, candidateToSendInputFrameId, pR.InputsBufferString(false), pR.RenderFrameBufferString())) } - refRenderFrame := tmp.(*pb.RoomDownsyncFrame) + refRenderFrame := tmp.(*RoomDownsyncFrame) pR.sendSafely(refRenderFrame, toSendInputFrames, DOWNSYNC_MSG_ACT_FORCED_RESYNC, playerId) } else { pR.sendSafely(nil, toSendInputFrames, DOWNSYNC_MSG_ACT_INPUT_BATCH, playerId) @@ -584,7 +584,7 @@ func (pR *Room) StartBattle() { toApplyInputFrameId = minLastSentInputFrameId } for pR.InputsBuffer.N < pR.InputsBuffer.Cnt || (0 < pR.InputsBuffer.Cnt && pR.InputsBuffer.StFrameId < toApplyInputFrameId) { - f := pR.InputsBuffer.Pop().(*pb.InputFrameDownsync) + f := pR.InputsBuffer.Pop().(*InputFrameDownsync) if pR.inputFrameIdDebuggable(f.InputFrameId) { // Popping of an "inputFrame" would be AFTER its being all being confirmed, because it requires the "inputFrame" to be all acked Logger.Debug("inputFrame lifecycle#4[popped]:", zap.Any("roomId", pR.Id), zap.Any("inputFrameId", f.InputFrameId), zap.Any("InputsBuffer", pR.InputsBufferString(false))) @@ -610,7 +610,7 @@ func (pR *Room) toDiscreteInputsBufferIndex(inputFrameId int32, joinIndex int32) return (inputFrameId << 2) + joinIndex // allowing joinIndex upto 15 } -func (pR *Room) OnBattleCmdReceived(pReq *pb.WsReq) { +func (pR *Room) OnBattleCmdReceived(pReq *WsReq) { if swapped := atomic.CompareAndSwapInt32(&pR.State, RoomBattleStateIns.IN_BATTLE, RoomBattleStateIns.IN_BATTLE); !swapped { return } @@ -648,7 +648,7 @@ func (pR *Room) OnBattleCmdReceived(pReq *pb.WsReq) { } } -func (pR *Room) onInputFrameDownsyncAllConfirmed(inputFrameDownsync *pb.InputFrameDownsync, playerId int32) { +func (pR *Room) onInputFrameDownsyncAllConfirmed(inputFrameDownsync *InputFrameDownsync, playerId int32) { inputFrameId := inputFrameDownsync.InputFrameId if -1 == pR.LastAllConfirmedInputFrameIdWithChange || false == pR.equalInputLists(inputFrameDownsync.InputList, pR.LastAllConfirmedInputList) { if -1 == playerId { @@ -690,7 +690,7 @@ func (pR *Room) StopBattleForSettlement() { Logger.Info("Stopping the `battleMainLoop` for:", zap.Any("roomId", pR.Id)) pR.RenderFrameId++ for playerId, _ := range pR.Players { - assembledFrame := pb.RoomDownsyncFrame{ + assembledFrame := RoomDownsyncFrame{ Id: pR.RenderFrameId, Players: toPbPlayers(pR.Players), CountdownNanos: -1, // TODO: Replace this magic constant! @@ -716,9 +716,9 @@ func (pR *Room) onBattlePrepare(cb BattleStartCbType) { pR.State = RoomBattleStateIns.PREPARE Logger.Info("Battle state transitted to RoomBattleStateIns.PREPARE for:", zap.Any("roomId", pR.Id)) - playerMetas := make(map[int32]*pb.PlayerMeta, 0) + playerMetas := make(map[int32]*PlayerDownsyncMeta, 0) for _, player := range pR.Players { - playerMetas[player.Id] = &pb.PlayerMeta{ + playerMetas[player.Id] = &PlayerDownsyncMeta{ Id: player.Id, Name: player.Name, DisplayName: player.DisplayName, @@ -727,7 +727,7 @@ func (pR *Room) onBattlePrepare(cb BattleStartCbType) { } } - battleReadyToStartFrame := &pb.RoomDownsyncFrame{ + battleReadyToStartFrame := &RoomDownsyncFrame{ Id: DOWNSYNC_MSG_ACT_BATTLE_READY_TO_START, Players: toPbPlayers(pR.Players), PlayerMetas: playerMetas, @@ -940,10 +940,10 @@ func (pR *Room) onPlayerAdded(playerId int32) { // Lazily assign the initial position of "Player" for "RoomDownsyncFrame". playerPosList := *(pR.RawBattleStrToVec2DListMap["PlayerStartingPos"]) - if index > len(playerPosList) { + if index > len(playerPosList.Eles) { panic(fmt.Sprintf("onPlayerAdded error, index >= len(playerPosList), roomId=%v, playerId=%v, roomState=%v, roomEffectivePlayerCount=%v", pR.Id, playerId, pR.State, pR.EffectivePlayerCount)) } - playerPos := playerPosList[index] + playerPos := playerPosList.Eles[index] if nil == playerPos { panic(fmt.Sprintf("onPlayerAdded error, nil == playerPos, roomId=%v, playerId=%v, roomState=%v, roomEffectivePlayerCount=%v", pR.Id, playerId, pR.State, pR.EffectivePlayerCount)) @@ -976,9 +976,9 @@ func (pR *Room) OnPlayerBattleColliderAcked(playerId int32) bool { return false } - playerMetas := make(map[int32]*pb.PlayerMeta, 0) + playerMetas := make(map[int32]*PlayerDownsyncMeta, 0) for _, eachPlayer := range pR.Players { - playerMetas[eachPlayer.Id] = &pb.PlayerMeta{ + playerMetas[eachPlayer.Id] = &PlayerDownsyncMeta{ Id: eachPlayer.Id, Name: eachPlayer.Name, DisplayName: eachPlayer.DisplayName, @@ -999,14 +999,14 @@ func (pR *Room) OnPlayerBattleColliderAcked(playerId int32) bool { */ switch targetPlayer.BattleState { case PlayerBattleStateIns.ADDED_PENDING_BATTLE_COLLIDER_ACK: - playerAckedFrame := &pb.RoomDownsyncFrame{ + playerAckedFrame := &RoomDownsyncFrame{ Id: pR.RenderFrameId, Players: toPbPlayers(pR.Players), PlayerMetas: playerMetas, } pR.sendSafely(playerAckedFrame, nil, DOWNSYNC_MSG_ACT_PLAYER_ADDED_AND_ACKED, eachPlayer.Id) case PlayerBattleStateIns.READDED_PENDING_BATTLE_COLLIDER_ACK: - playerAckedFrame := &pb.RoomDownsyncFrame{ + playerAckedFrame := &RoomDownsyncFrame{ Id: pR.RenderFrameId, Players: toPbPlayers(pR.Players), PlayerMetas: playerMetas, @@ -1037,14 +1037,14 @@ func (pR *Room) OnPlayerBattleColliderAcked(playerId int32) bool { return true } -func (pR *Room) sendSafely(roomDownsyncFrame *pb.RoomDownsyncFrame, toSendFrames []*pb.InputFrameDownsync, act int32, playerId int32) { +func (pR *Room) sendSafely(roomDownsyncFrame *RoomDownsyncFrame, toSendFrames []*InputFrameDownsync, act int32, playerId int32) { defer func() { if r := recover(); r != nil { pR.PlayerSignalToCloseDict[playerId](Constants.RetCode.UnknownError, fmt.Sprintf("%v", r)) } }() - pResp := &pb.WsResp{ + pResp := &WsResp{ Ret: int32(Constants.RetCode.Ok), Act: act, Rdf: roomDownsyncFrame, @@ -1065,16 +1065,16 @@ func (pR *Room) shouldPrefabInputFrameDownsync(renderFrameId int32) bool { return ((renderFrameId & ((1 << pR.InputScaleFrames) - 1)) == 0) } -func (pR *Room) prefabInputFrameDownsync(inputFrameId int32) *pb.InputFrameDownsync { +func (pR *Room) prefabInputFrameDownsync(inputFrameId int32) *InputFrameDownsync { /* Kindly note that on backend the prefab is much simpler than its frontend counterpart, because frontend will upsync its latest command immediately if there's any change w.r.t. its own prev cmd, thus if no upsync received from a frontend, - EITHER it's due to local lag and bad network, - OR there's no change w.r.t. to its prev cmd. */ - var currInputFrameDownsync *pb.InputFrameDownsync = nil + var currInputFrameDownsync *InputFrameDownsync = nil if 0 == inputFrameId && 0 == pR.InputsBuffer.Cnt { - currInputFrameDownsync = &pb.InputFrameDownsync{ + currInputFrameDownsync = &InputFrameDownsync{ InputFrameId: 0, InputList: make([]uint64, pR.Capacity), ConfirmedList: uint64(0), @@ -1084,9 +1084,9 @@ func (pR *Room) prefabInputFrameDownsync(inputFrameId int32) *pb.InputFrameDowns if nil == tmp { panic(fmt.Sprintf("Error prefabbing inputFrameDownsync: roomId=%v, InputsBuffer=%v", pR.Id, pR.InputsBufferString(false))) } - prevInputFrameDownsync := tmp.(*pb.InputFrameDownsync) + prevInputFrameDownsync := tmp.(*InputFrameDownsync) currInputList := prevInputFrameDownsync.InputList // Would be a clone of the values - currInputFrameDownsync = &pb.InputFrameDownsync{ + currInputFrameDownsync = &InputFrameDownsync{ InputFrameId: inputFrameId, InputList: currInputList, ConfirmedList: uint64(0), @@ -1112,14 +1112,14 @@ func (pR *Room) markConfirmationIfApplicable() { if nil == tmp { panic(fmt.Sprintf("inputFrameId=%v doesn't exist for roomId=%v, this is abnormal because the server should prefab inputFrameDownsync in a most advanced pace, check the prefab logic! InputsBuffer=%v", inputFrameId, pR.Id, pR.InputsBufferString(false))) } - inputFrameDownsync := tmp.(*pb.InputFrameDownsync) + inputFrameDownsync := tmp.(*InputFrameDownsync) for _, player := range pR.Players { bufIndex := pR.toDiscreteInputsBufferIndex(inputFrameId, player.JoinIndex) tmp, loaded := pR.DiscreteInputsBuffer.LoadAndDelete(bufIndex) // It's safe to "LoadAndDelete" here because the "inputFrameUpsync" of this player is already remembered by the corresponding "inputFrameDown". if !loaded { continue } - inputFrameUpsync := tmp.(*pb.InputFrameUpsync) + inputFrameUpsync := tmp.(*InputFrameUpsync) indiceInJoinIndexBooleanArr := uint32(player.JoinIndex - 1) inputFrameDownsync.InputList[indiceInJoinIndexBooleanArr] = pR.EncodeUpsyncCmd(inputFrameUpsync) inputFrameDownsync.ConfirmedList |= (1 << indiceInJoinIndexBooleanArr) @@ -1156,7 +1156,7 @@ func (pR *Room) forceConfirmationIfApplicable() uint64 { if nil == tmp { panic(fmt.Sprintf("inputFrameId2=%v doesn't exist for roomId=%v, this is abnormal because the server should prefab inputFrameDownsync in a most advanced pace, check the prefab logic! InputsBuffer=%v", inputFrameId2, pR.Id, pR.InputsBufferString(false))) } - inputFrame2 := tmp.(*pb.InputFrameDownsync) + inputFrame2 := tmp.(*InputFrameDownsync) for _, player := range pR.Players { // Enrich by already arrived player upsync commands bufIndex := pR.toDiscreteInputsBufferIndex(inputFrame2.InputFrameId, player.JoinIndex) @@ -1164,7 +1164,7 @@ func (pR *Room) forceConfirmationIfApplicable() uint64 { if !loaded { continue } - inputFrameUpsync := tmp.(*pb.InputFrameUpsync) + inputFrameUpsync := tmp.(*InputFrameUpsync) indiceInJoinIndexBooleanArr := uint32(player.JoinIndex - 1) inputFrame2.InputList[indiceInJoinIndexBooleanArr] = pR.EncodeUpsyncCmd(inputFrameUpsync) inputFrame2.ConfirmedList |= (1 << indiceInJoinIndexBooleanArr) @@ -1201,7 +1201,7 @@ func (pR *Room) applyInputFrameDownsyncDynamics(fromRenderFrameId int32, toRende if nil == tmp { panic(fmt.Sprintf("delayedInputFrameId=%v doesn't exist for roomId=%v, this is abnormal because it's to be used for applying dynamics to [fromRenderFrameId:%v, toRenderFrameId:%v) @ collisionSysRenderFrameId=%v! InputsBuffer=%v", delayedInputFrameId, pR.Id, fromRenderFrameId, toRenderFrameId, collisionSysRenderFrameId, pR.InputsBufferString(false))) } - delayedInputFrame := tmp.(*pb.InputFrameDownsync) + delayedInputFrame := tmp.(*InputFrameDownsync) // [WARNING] It's possible that by now "allConfirmedMask != delayedInputFrame.ConfirmedList && delayedInputFrameId <= pR.LastAllConfirmedInputFrameId", we trust "pR.LastAllConfirmedInputFrameId" as the TOP AUTHORITY. atomic.StoreUint64(&(delayedInputFrame.ConfirmedList), allConfirmedMask) @@ -1249,7 +1249,7 @@ func (pR *Room) applyInputFrameDownsyncDynamics(fromRenderFrameId int32, toRende } } - newRenderFrame := pb.RoomDownsyncFrame{ + newRenderFrame := RoomDownsyncFrame{ Id: collisionSysRenderFrameId + 1, Players: toPbPlayers(pR.Players), CountdownNanos: (pR.BattleDurationNanos - int64(collisionSysRenderFrameId)*pR.RollbackEstimatedDtNanos), diff --git a/battle_srv/protos/room_downsync_frame.pb.go b/battle_srv/protos/room_downsync_frame.pb.go index bd540d9..eac5c86 100644 --- a/battle_srv/protos/room_downsync_frame.pb.go +++ b/battle_srv/protos/room_downsync_frame.pb.go @@ -1,13 +1,13 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.28.1 -// protoc v3.7.1 +// protoc v3.21.4 // source: room_downsync_frame.proto package protos import ( - protos "dnmshared/protos" + sharedprotos "dnmshared/sharedprotos" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -26,28 +26,28 @@ type BattleColliderInfo struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - StageName string `protobuf:"bytes,1,opt,name=stageName,proto3" json:"stageName,omitempty"` - StrToVec2DListMap map[string]*protos.Vec2DList `protobuf:"bytes,2,rep,name=strToVec2DListMap,proto3" json:"strToVec2DListMap,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - StrToPolygon2DListMap map[string]*protos.Polygon2DList `protobuf:"bytes,3,rep,name=strToPolygon2DListMap,proto3" json:"strToPolygon2DListMap,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - StageDiscreteW int32 `protobuf:"varint,4,opt,name=stageDiscreteW,proto3" json:"stageDiscreteW,omitempty"` - StageDiscreteH int32 `protobuf:"varint,5,opt,name=stageDiscreteH,proto3" json:"stageDiscreteH,omitempty"` - StageTileW int32 `protobuf:"varint,6,opt,name=stageTileW,proto3" json:"stageTileW,omitempty"` - StageTileH int32 `protobuf:"varint,7,opt,name=stageTileH,proto3" json:"stageTileH,omitempty"` - IntervalToPing int32 `protobuf:"varint,8,opt,name=intervalToPing,proto3" json:"intervalToPing,omitempty"` - WillKickIfInactiveFor int32 `protobuf:"varint,9,opt,name=willKickIfInactiveFor,proto3" json:"willKickIfInactiveFor,omitempty"` - BoundRoomId int32 `protobuf:"varint,10,opt,name=boundRoomId,proto3" json:"boundRoomId,omitempty"` - BattleDurationNanos int64 `protobuf:"varint,11,opt,name=battleDurationNanos,proto3" json:"battleDurationNanos,omitempty"` - ServerFps int32 `protobuf:"varint,12,opt,name=serverFps,proto3" json:"serverFps,omitempty"` - InputDelayFrames int32 `protobuf:"varint,13,opt,name=inputDelayFrames,proto3" json:"inputDelayFrames,omitempty"` - InputScaleFrames uint32 `protobuf:"varint,14,opt,name=inputScaleFrames,proto3" json:"inputScaleFrames,omitempty"` - NstDelayFrames int32 `protobuf:"varint,15,opt,name=nstDelayFrames,proto3" json:"nstDelayFrames,omitempty"` - InputFrameUpsyncDelayTolerance int32 `protobuf:"varint,16,opt,name=inputFrameUpsyncDelayTolerance,proto3" json:"inputFrameUpsyncDelayTolerance,omitempty"` - MaxChasingRenderFramesPerUpdate int32 `protobuf:"varint,17,opt,name=maxChasingRenderFramesPerUpdate,proto3" json:"maxChasingRenderFramesPerUpdate,omitempty"` - PlayerBattleState int32 `protobuf:"varint,18,opt,name=playerBattleState,proto3" json:"playerBattleState,omitempty"` - RollbackEstimatedDtMillis float64 `protobuf:"fixed64,19,opt,name=rollbackEstimatedDtMillis,proto3" json:"rollbackEstimatedDtMillis,omitempty"` - RollbackEstimatedDtNanos int64 `protobuf:"varint,20,opt,name=rollbackEstimatedDtNanos,proto3" json:"rollbackEstimatedDtNanos,omitempty"` - WorldToVirtualGridRatio float64 `protobuf:"fixed64,21,opt,name=worldToVirtualGridRatio,proto3" json:"worldToVirtualGridRatio,omitempty"` - VirtualGridToWorldRatio float64 `protobuf:"fixed64,22,opt,name=virtualGridToWorldRatio,proto3" json:"virtualGridToWorldRatio,omitempty"` + StageName string `protobuf:"bytes,1,opt,name=stageName,proto3" json:"stageName,omitempty"` + StrToVec2DListMap map[string]*sharedprotos.Vec2DList `protobuf:"bytes,2,rep,name=strToVec2DListMap,proto3" json:"strToVec2DListMap,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + StrToPolygon2DListMap map[string]*sharedprotos.Polygon2DList `protobuf:"bytes,3,rep,name=strToPolygon2DListMap,proto3" json:"strToPolygon2DListMap,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + StageDiscreteW int32 `protobuf:"varint,4,opt,name=stageDiscreteW,proto3" json:"stageDiscreteW,omitempty"` + StageDiscreteH int32 `protobuf:"varint,5,opt,name=stageDiscreteH,proto3" json:"stageDiscreteH,omitempty"` + StageTileW int32 `protobuf:"varint,6,opt,name=stageTileW,proto3" json:"stageTileW,omitempty"` + StageTileH int32 `protobuf:"varint,7,opt,name=stageTileH,proto3" json:"stageTileH,omitempty"` + IntervalToPing int32 `protobuf:"varint,8,opt,name=intervalToPing,proto3" json:"intervalToPing,omitempty"` + WillKickIfInactiveFor int32 `protobuf:"varint,9,opt,name=willKickIfInactiveFor,proto3" json:"willKickIfInactiveFor,omitempty"` + BoundRoomId int32 `protobuf:"varint,10,opt,name=boundRoomId,proto3" json:"boundRoomId,omitempty"` + BattleDurationNanos int64 `protobuf:"varint,11,opt,name=battleDurationNanos,proto3" json:"battleDurationNanos,omitempty"` + ServerFps int32 `protobuf:"varint,12,opt,name=serverFps,proto3" json:"serverFps,omitempty"` + InputDelayFrames int32 `protobuf:"varint,13,opt,name=inputDelayFrames,proto3" json:"inputDelayFrames,omitempty"` + InputScaleFrames uint32 `protobuf:"varint,14,opt,name=inputScaleFrames,proto3" json:"inputScaleFrames,omitempty"` + NstDelayFrames int32 `protobuf:"varint,15,opt,name=nstDelayFrames,proto3" json:"nstDelayFrames,omitempty"` + InputFrameUpsyncDelayTolerance int32 `protobuf:"varint,16,opt,name=inputFrameUpsyncDelayTolerance,proto3" json:"inputFrameUpsyncDelayTolerance,omitempty"` + MaxChasingRenderFramesPerUpdate int32 `protobuf:"varint,17,opt,name=maxChasingRenderFramesPerUpdate,proto3" json:"maxChasingRenderFramesPerUpdate,omitempty"` + PlayerBattleState int32 `protobuf:"varint,18,opt,name=playerBattleState,proto3" json:"playerBattleState,omitempty"` + RollbackEstimatedDtMillis float64 `protobuf:"fixed64,19,opt,name=rollbackEstimatedDtMillis,proto3" json:"rollbackEstimatedDtMillis,omitempty"` + RollbackEstimatedDtNanos int64 `protobuf:"varint,20,opt,name=rollbackEstimatedDtNanos,proto3" json:"rollbackEstimatedDtNanos,omitempty"` + WorldToVirtualGridRatio float64 `protobuf:"fixed64,21,opt,name=worldToVirtualGridRatio,proto3" json:"worldToVirtualGridRatio,omitempty"` + VirtualGridToWorldRatio float64 `protobuf:"fixed64,22,opt,name=virtualGridToWorldRatio,proto3" json:"virtualGridToWorldRatio,omitempty"` } func (x *BattleColliderInfo) Reset() { @@ -89,14 +89,14 @@ func (x *BattleColliderInfo) GetStageName() string { return "" } -func (x *BattleColliderInfo) GetStrToVec2DListMap() map[string]*protos.Vec2DList { +func (x *BattleColliderInfo) GetStrToVec2DListMap() map[string]*sharedprotos.Vec2DList { if x != nil { return x.StrToVec2DListMap } return nil } -func (x *BattleColliderInfo) GetStrToPolygon2DListMap() map[string]*protos.Polygon2DList { +func (x *BattleColliderInfo) GetStrToPolygon2DListMap() map[string]*sharedprotos.Polygon2DList { if x != nil { return x.StrToPolygon2DListMap } @@ -236,25 +236,25 @@ func (x *BattleColliderInfo) GetVirtualGridToWorldRatio() float64 { return 0 } -type Player struct { +type PlayerDownsync struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Id int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` - VirtualGridX int32 `protobuf:"varint,2,opt,name=virtualGridX,proto3" json:"virtualGridX,omitempty"` - VirtualGridY int32 `protobuf:"varint,3,opt,name=virtualGridY,proto3" json:"virtualGridY,omitempty"` - Dir *protos.Direction `protobuf:"bytes,4,opt,name=dir,proto3" json:"dir,omitempty"` - Speed int32 `protobuf:"varint,5,opt,name=speed,proto3" json:"speed,omitempty"` // in terms of virtual grid units - BattleState int32 `protobuf:"varint,6,opt,name=battleState,proto3" json:"battleState,omitempty"` - LastMoveGmtMillis int32 `protobuf:"varint,7,opt,name=lastMoveGmtMillis,proto3" json:"lastMoveGmtMillis,omitempty"` - Score int32 `protobuf:"varint,10,opt,name=score,proto3" json:"score,omitempty"` - Removed bool `protobuf:"varint,11,opt,name=removed,proto3" json:"removed,omitempty"` - JoinIndex int32 `protobuf:"varint,12,opt,name=joinIndex,proto3" json:"joinIndex,omitempty"` + Id int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + VirtualGridX int32 `protobuf:"varint,2,opt,name=virtualGridX,proto3" json:"virtualGridX,omitempty"` + VirtualGridY int32 `protobuf:"varint,3,opt,name=virtualGridY,proto3" json:"virtualGridY,omitempty"` + Dir *sharedprotos.Direction `protobuf:"bytes,4,opt,name=dir,proto3" json:"dir,omitempty"` + Speed int32 `protobuf:"varint,5,opt,name=speed,proto3" json:"speed,omitempty"` // in terms of virtual grid units + BattleState int32 `protobuf:"varint,6,opt,name=battleState,proto3" json:"battleState,omitempty"` + LastMoveGmtMillis int32 `protobuf:"varint,7,opt,name=lastMoveGmtMillis,proto3" json:"lastMoveGmtMillis,omitempty"` + Score int32 `protobuf:"varint,10,opt,name=score,proto3" json:"score,omitempty"` + Removed bool `protobuf:"varint,11,opt,name=removed,proto3" json:"removed,omitempty"` + JoinIndex int32 `protobuf:"varint,12,opt,name=joinIndex,proto3" json:"joinIndex,omitempty"` } -func (x *Player) Reset() { - *x = Player{} +func (x *PlayerDownsync) Reset() { + *x = PlayerDownsync{} if protoimpl.UnsafeEnabled { mi := &file_room_downsync_frame_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -262,13 +262,13 @@ func (x *Player) Reset() { } } -func (x *Player) String() string { +func (x *PlayerDownsync) String() string { return protoimpl.X.MessageStringOf(x) } -func (*Player) ProtoMessage() {} +func (*PlayerDownsync) ProtoMessage() {} -func (x *Player) ProtoReflect() protoreflect.Message { +func (x *PlayerDownsync) ProtoReflect() protoreflect.Message { mi := &file_room_downsync_frame_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -280,82 +280,82 @@ func (x *Player) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use Player.ProtoReflect.Descriptor instead. -func (*Player) Descriptor() ([]byte, []int) { +// Deprecated: Use PlayerDownsync.ProtoReflect.Descriptor instead. +func (*PlayerDownsync) Descriptor() ([]byte, []int) { return file_room_downsync_frame_proto_rawDescGZIP(), []int{1} } -func (x *Player) GetId() int32 { +func (x *PlayerDownsync) GetId() int32 { if x != nil { return x.Id } return 0 } -func (x *Player) GetVirtualGridX() int32 { +func (x *PlayerDownsync) GetVirtualGridX() int32 { if x != nil { return x.VirtualGridX } return 0 } -func (x *Player) GetVirtualGridY() int32 { +func (x *PlayerDownsync) GetVirtualGridY() int32 { if x != nil { return x.VirtualGridY } return 0 } -func (x *Player) GetDir() *protos.Direction { +func (x *PlayerDownsync) GetDir() *sharedprotos.Direction { if x != nil { return x.Dir } return nil } -func (x *Player) GetSpeed() int32 { +func (x *PlayerDownsync) GetSpeed() int32 { if x != nil { return x.Speed } return 0 } -func (x *Player) GetBattleState() int32 { +func (x *PlayerDownsync) GetBattleState() int32 { if x != nil { return x.BattleState } return 0 } -func (x *Player) GetLastMoveGmtMillis() int32 { +func (x *PlayerDownsync) GetLastMoveGmtMillis() int32 { if x != nil { return x.LastMoveGmtMillis } return 0 } -func (x *Player) GetScore() int32 { +func (x *PlayerDownsync) GetScore() int32 { if x != nil { return x.Score } return 0 } -func (x *Player) GetRemoved() bool { +func (x *PlayerDownsync) GetRemoved() bool { if x != nil { return x.Removed } return false } -func (x *Player) GetJoinIndex() int32 { +func (x *PlayerDownsync) GetJoinIndex() int32 { if x != nil { return x.JoinIndex } return 0 } -type PlayerMeta struct { +type PlayerDownsyncMeta struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields @@ -367,8 +367,8 @@ type PlayerMeta struct { JoinIndex int32 `protobuf:"varint,5,opt,name=joinIndex,proto3" json:"joinIndex,omitempty"` } -func (x *PlayerMeta) Reset() { - *x = PlayerMeta{} +func (x *PlayerDownsyncMeta) Reset() { + *x = PlayerDownsyncMeta{} if protoimpl.UnsafeEnabled { mi := &file_room_downsync_frame_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -376,13 +376,13 @@ func (x *PlayerMeta) Reset() { } } -func (x *PlayerMeta) String() string { +func (x *PlayerDownsyncMeta) String() string { return protoimpl.X.MessageStringOf(x) } -func (*PlayerMeta) ProtoMessage() {} +func (*PlayerDownsyncMeta) ProtoMessage() {} -func (x *PlayerMeta) ProtoReflect() protoreflect.Message { +func (x *PlayerDownsyncMeta) ProtoReflect() protoreflect.Message { mi := &file_room_downsync_frame_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -394,40 +394,40 @@ func (x *PlayerMeta) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use PlayerMeta.ProtoReflect.Descriptor instead. -func (*PlayerMeta) Descriptor() ([]byte, []int) { +// Deprecated: Use PlayerDownsyncMeta.ProtoReflect.Descriptor instead. +func (*PlayerDownsyncMeta) Descriptor() ([]byte, []int) { return file_room_downsync_frame_proto_rawDescGZIP(), []int{2} } -func (x *PlayerMeta) GetId() int32 { +func (x *PlayerDownsyncMeta) GetId() int32 { if x != nil { return x.Id } return 0 } -func (x *PlayerMeta) GetName() string { +func (x *PlayerDownsyncMeta) GetName() string { if x != nil { return x.Name } return "" } -func (x *PlayerMeta) GetDisplayName() string { +func (x *PlayerDownsyncMeta) GetDisplayName() string { if x != nil { return x.DisplayName } return "" } -func (x *PlayerMeta) GetAvatar() string { +func (x *PlayerDownsyncMeta) GetAvatar() string { if x != nil { return x.Avatar } return "" } -func (x *PlayerMeta) GetJoinIndex() int32 { +func (x *PlayerDownsyncMeta) GetJoinIndex() int32 { if x != nil { return x.JoinIndex } @@ -604,10 +604,10 @@ type RoomDownsyncFrame struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Id int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` - Players map[int32]*Player `protobuf:"bytes,2,rep,name=players,proto3" json:"players,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - CountdownNanos int64 `protobuf:"varint,3,opt,name=countdownNanos,proto3" json:"countdownNanos,omitempty"` - PlayerMetas map[int32]*PlayerMeta `protobuf:"bytes,4,rep,name=playerMetas,proto3" json:"playerMetas,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + Id int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + Players map[int32]*PlayerDownsync `protobuf:"bytes,2,rep,name=players,proto3" json:"players,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + CountdownNanos int64 `protobuf:"varint,3,opt,name=countdownNanos,proto3" json:"countdownNanos,omitempty"` + PlayerMetas map[int32]*PlayerDownsyncMeta `protobuf:"bytes,4,rep,name=playerMetas,proto3" json:"playerMetas,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` } func (x *RoomDownsyncFrame) Reset() { @@ -649,7 +649,7 @@ func (x *RoomDownsyncFrame) GetId() int32 { return 0 } -func (x *RoomDownsyncFrame) GetPlayers() map[int32]*Player { +func (x *RoomDownsyncFrame) GetPlayers() map[int32]*PlayerDownsync { if x != nil { return x.Players } @@ -663,7 +663,7 @@ func (x *RoomDownsyncFrame) GetCountdownNanos() int64 { return 0 } -func (x *RoomDownsyncFrame) GetPlayerMetas() map[int32]*PlayerMeta { +func (x *RoomDownsyncFrame) GetPlayerMetas() map[int32]*PlayerDownsyncMeta { if x != nil { return x.PlayerMetas } @@ -866,7 +866,7 @@ var file_room_downsync_frame_proto_rawDesc = []byte{ 0x0a, 0x19, 0x72, 0x6f, 0x6f, 0x6d, 0x5f, 0x64, 0x6f, 0x77, 0x6e, 0x73, 0x79, 0x6e, 0x63, 0x5f, 0x66, 0x72, 0x61, 0x6d, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x1a, 0x0e, 0x67, 0x65, 0x6f, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x22, 0xc8, 0x0a, 0x0a, 0x12, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x43, 0x6f, + 0x6f, 0x74, 0x6f, 0x22, 0xd4, 0x0a, 0x0a, 0x12, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x43, 0x6f, 0x6c, 0x6c, 0x69, 0x64, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x74, 0x61, 0x67, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x74, 0x61, 0x67, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x5f, 0x0a, 0x11, 0x73, 0x74, 0x72, 0x54, @@ -939,126 +939,129 @@ var file_room_downsync_frame_proto_rawDesc = []byte{ 0x72, 0x74, 0x75, 0x61, 0x6c, 0x47, 0x72, 0x69, 0x64, 0x54, 0x6f, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x52, 0x61, 0x74, 0x69, 0x6f, 0x18, 0x16, 0x20, 0x01, 0x28, 0x01, 0x52, 0x17, 0x76, 0x69, 0x72, 0x74, 0x75, 0x61, 0x6c, 0x47, 0x72, 0x69, 0x64, 0x54, 0x6f, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x52, - 0x61, 0x74, 0x69, 0x6f, 0x1a, 0x57, 0x0a, 0x16, 0x53, 0x74, 0x72, 0x54, 0x6f, 0x56, 0x65, 0x63, + 0x61, 0x74, 0x69, 0x6f, 0x1a, 0x5d, 0x0a, 0x16, 0x53, 0x74, 0x72, 0x54, 0x6f, 0x56, 0x65, 0x63, 0x32, 0x44, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x61, 0x70, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, - 0x12, 0x27, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x11, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x56, 0x65, 0x63, 0x32, 0x44, 0x4c, 0x69, - 0x73, 0x74, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x5f, 0x0a, - 0x1a, 0x53, 0x74, 0x72, 0x54, 0x6f, 0x50, 0x6f, 0x6c, 0x79, 0x67, 0x6f, 0x6e, 0x32, 0x44, 0x4c, - 0x69, 0x73, 0x74, 0x4d, 0x61, 0x70, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, - 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x2b, 0x0a, - 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x50, 0x6f, 0x6c, 0x79, 0x67, 0x6f, 0x6e, 0x32, 0x44, 0x4c, - 0x69, 0x73, 0x74, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0xb9, - 0x02, 0x0a, 0x06, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x69, 0x64, 0x12, 0x22, 0x0a, 0x0c, 0x76, 0x69, 0x72, - 0x74, 0x75, 0x61, 0x6c, 0x47, 0x72, 0x69, 0x64, 0x58, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, - 0x0c, 0x76, 0x69, 0x72, 0x74, 0x75, 0x61, 0x6c, 0x47, 0x72, 0x69, 0x64, 0x58, 0x12, 0x22, 0x0a, - 0x0c, 0x76, 0x69, 0x72, 0x74, 0x75, 0x61, 0x6c, 0x47, 0x72, 0x69, 0x64, 0x59, 0x18, 0x03, 0x20, + 0x12, 0x2d, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x17, 0x2e, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x56, + 0x65, 0x63, 0x32, 0x44, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, + 0x02, 0x38, 0x01, 0x1a, 0x65, 0x0a, 0x1a, 0x53, 0x74, 0x72, 0x54, 0x6f, 0x50, 0x6f, 0x6c, 0x79, + 0x67, 0x6f, 0x6e, 0x32, 0x44, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x61, 0x70, 0x45, 0x6e, 0x74, 0x72, + 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, + 0x6b, 0x65, 0x79, 0x12, 0x31, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x73, 0x2e, 0x50, 0x6f, 0x6c, 0x79, 0x67, 0x6f, 0x6e, 0x32, 0x44, 0x4c, 0x69, 0x73, 0x74, 0x52, + 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0xc7, 0x02, 0x0a, 0x0e, 0x50, + 0x6c, 0x61, 0x79, 0x65, 0x72, 0x44, 0x6f, 0x77, 0x6e, 0x73, 0x79, 0x6e, 0x63, 0x12, 0x0e, 0x0a, + 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x69, 0x64, 0x12, 0x22, 0x0a, + 0x0c, 0x76, 0x69, 0x72, 0x74, 0x75, 0x61, 0x6c, 0x47, 0x72, 0x69, 0x64, 0x58, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0c, 0x76, 0x69, 0x72, 0x74, 0x75, 0x61, 0x6c, 0x47, 0x72, 0x69, 0x64, - 0x59, 0x12, 0x23, 0x0a, 0x03, 0x64, 0x69, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, - 0x6e, 0x52, 0x03, 0x64, 0x69, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x70, 0x65, 0x65, 0x64, 0x18, - 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x73, 0x70, 0x65, 0x65, 0x64, 0x12, 0x20, 0x0a, 0x0b, - 0x62, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, - 0x05, 0x52, 0x0b, 0x62, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x2c, - 0x0a, 0x11, 0x6c, 0x61, 0x73, 0x74, 0x4d, 0x6f, 0x76, 0x65, 0x47, 0x6d, 0x74, 0x4d, 0x69, 0x6c, - 0x6c, 0x69, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x05, 0x52, 0x11, 0x6c, 0x61, 0x73, 0x74, 0x4d, - 0x6f, 0x76, 0x65, 0x47, 0x6d, 0x74, 0x4d, 0x69, 0x6c, 0x6c, 0x69, 0x73, 0x12, 0x14, 0x0a, 0x05, - 0x73, 0x63, 0x6f, 0x72, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x73, 0x63, 0x6f, - 0x72, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x64, 0x18, 0x0b, 0x20, - 0x01, 0x28, 0x08, 0x52, 0x07, 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x64, 0x12, 0x1c, 0x0a, 0x09, - 0x6a, 0x6f, 0x69, 0x6e, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x05, 0x52, - 0x09, 0x6a, 0x6f, 0x69, 0x6e, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x22, 0x88, 0x01, 0x0a, 0x0a, 0x50, - 0x6c, 0x61, 0x79, 0x65, 0x72, 0x4d, 0x65, 0x74, 0x61, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, - 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x20, 0x0a, - 0x0b, 0x64, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x0b, 0x64, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x12, - 0x16, 0x0a, 0x06, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x06, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x12, 0x1c, 0x0a, 0x09, 0x6a, 0x6f, 0x69, 0x6e, 0x49, - 0x6e, 0x64, 0x65, 0x78, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x6a, 0x6f, 0x69, 0x6e, - 0x49, 0x6e, 0x64, 0x65, 0x78, 0x22, 0x56, 0x0a, 0x10, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x46, 0x72, - 0x61, 0x6d, 0x65, 0x55, 0x70, 0x73, 0x79, 0x6e, 0x63, 0x12, 0x22, 0x0a, 0x0c, 0x69, 0x6e, 0x70, - 0x75, 0x74, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, - 0x0c, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x49, 0x64, 0x12, 0x1e, 0x0a, - 0x0a, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x64, 0x44, 0x69, 0x72, 0x18, 0x06, 0x20, 0x01, 0x28, - 0x05, 0x52, 0x0a, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x64, 0x44, 0x69, 0x72, 0x22, 0x7c, 0x0a, - 0x12, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x44, 0x6f, 0x77, 0x6e, 0x73, - 0x79, 0x6e, 0x63, 0x12, 0x22, 0x0a, 0x0c, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x46, 0x72, 0x61, 0x6d, - 0x65, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0c, 0x69, 0x6e, 0x70, 0x75, 0x74, - 0x46, 0x72, 0x61, 0x6d, 0x65, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x69, 0x6e, 0x70, 0x75, 0x74, - 0x4c, 0x69, 0x73, 0x74, 0x18, 0x02, 0x20, 0x03, 0x28, 0x04, 0x52, 0x09, 0x69, 0x6e, 0x70, 0x75, - 0x74, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x24, 0x0a, 0x0d, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, - 0x65, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0d, 0x63, 0x6f, - 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x65, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x22, 0x3b, 0x0a, 0x0f, 0x48, - 0x65, 0x61, 0x72, 0x74, 0x62, 0x65, 0x61, 0x74, 0x55, 0x70, 0x73, 0x79, 0x6e, 0x63, 0x12, 0x28, - 0x0a, 0x0f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, - 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x54, - 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x22, 0xfb, 0x02, 0x0a, 0x11, 0x52, 0x6f, 0x6f, - 0x6d, 0x44, 0x6f, 0x77, 0x6e, 0x73, 0x79, 0x6e, 0x63, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x12, 0x0e, - 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x69, 0x64, 0x12, 0x40, - 0x0a, 0x07, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x26, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x52, 0x6f, 0x6f, 0x6d, 0x44, 0x6f, 0x77, + 0x58, 0x12, 0x22, 0x0a, 0x0c, 0x76, 0x69, 0x72, 0x74, 0x75, 0x61, 0x6c, 0x47, 0x72, 0x69, 0x64, + 0x59, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0c, 0x76, 0x69, 0x72, 0x74, 0x75, 0x61, 0x6c, + 0x47, 0x72, 0x69, 0x64, 0x59, 0x12, 0x29, 0x0a, 0x03, 0x64, 0x69, 0x72, 0x18, 0x04, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x73, 0x2e, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x03, 0x64, 0x69, 0x72, + 0x12, 0x14, 0x0a, 0x05, 0x73, 0x70, 0x65, 0x65, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, + 0x05, 0x73, 0x70, 0x65, 0x65, 0x64, 0x12, 0x20, 0x0a, 0x0b, 0x62, 0x61, 0x74, 0x74, 0x6c, 0x65, + 0x53, 0x74, 0x61, 0x74, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0b, 0x62, 0x61, 0x74, + 0x74, 0x6c, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x2c, 0x0a, 0x11, 0x6c, 0x61, 0x73, 0x74, + 0x4d, 0x6f, 0x76, 0x65, 0x47, 0x6d, 0x74, 0x4d, 0x69, 0x6c, 0x6c, 0x69, 0x73, 0x18, 0x07, 0x20, + 0x01, 0x28, 0x05, 0x52, 0x11, 0x6c, 0x61, 0x73, 0x74, 0x4d, 0x6f, 0x76, 0x65, 0x47, 0x6d, 0x74, + 0x4d, 0x69, 0x6c, 0x6c, 0x69, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x18, + 0x0a, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x12, 0x18, 0x0a, 0x07, + 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x64, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x72, + 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x6a, 0x6f, 0x69, 0x6e, 0x49, 0x6e, + 0x64, 0x65, 0x78, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x6a, 0x6f, 0x69, 0x6e, 0x49, + 0x6e, 0x64, 0x65, 0x78, 0x22, 0x90, 0x01, 0x0a, 0x12, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x44, + 0x6f, 0x77, 0x6e, 0x73, 0x79, 0x6e, 0x63, 0x4d, 0x65, 0x74, 0x61, 0x12, 0x0e, 0x0a, 0x02, 0x69, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, + 0x20, 0x0a, 0x0b, 0x64, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x69, 0x73, 0x70, 0x6c, 0x61, 0x79, 0x4e, 0x61, 0x6d, + 0x65, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x06, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x12, 0x1c, 0x0a, 0x09, 0x6a, 0x6f, 0x69, + 0x6e, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x6a, 0x6f, + 0x69, 0x6e, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x22, 0x56, 0x0a, 0x10, 0x49, 0x6e, 0x70, 0x75, 0x74, + 0x46, 0x72, 0x61, 0x6d, 0x65, 0x55, 0x70, 0x73, 0x79, 0x6e, 0x63, 0x12, 0x22, 0x0a, 0x0c, 0x69, + 0x6e, 0x70, 0x75, 0x74, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x05, 0x52, 0x0c, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x49, 0x64, 0x12, + 0x1e, 0x0a, 0x0a, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x64, 0x44, 0x69, 0x72, 0x18, 0x06, 0x20, + 0x01, 0x28, 0x05, 0x52, 0x0a, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x64, 0x44, 0x69, 0x72, 0x22, + 0x7c, 0x0a, 0x12, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x44, 0x6f, 0x77, + 0x6e, 0x73, 0x79, 0x6e, 0x63, 0x12, 0x22, 0x0a, 0x0c, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x46, 0x72, + 0x61, 0x6d, 0x65, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0c, 0x69, 0x6e, 0x70, + 0x75, 0x74, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x69, 0x6e, 0x70, + 0x75, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x18, 0x02, 0x20, 0x03, 0x28, 0x04, 0x52, 0x09, 0x69, 0x6e, + 0x70, 0x75, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x24, 0x0a, 0x0d, 0x63, 0x6f, 0x6e, 0x66, 0x69, + 0x72, 0x6d, 0x65, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0d, + 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x72, 0x6d, 0x65, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x22, 0x3b, 0x0a, + 0x0f, 0x48, 0x65, 0x61, 0x72, 0x74, 0x62, 0x65, 0x61, 0x74, 0x55, 0x70, 0x73, 0x79, 0x6e, 0x63, + 0x12, 0x28, 0x0a, 0x0f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, + 0x61, 0x6d, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0f, 0x63, 0x6c, 0x69, 0x65, 0x6e, + 0x74, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x22, 0x8b, 0x03, 0x0a, 0x11, 0x52, + 0x6f, 0x6f, 0x6d, 0x44, 0x6f, 0x77, 0x6e, 0x73, 0x79, 0x6e, 0x63, 0x46, 0x72, 0x61, 0x6d, 0x65, + 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x69, 0x64, + 0x12, 0x40, 0x0a, 0x07, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x26, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x52, 0x6f, 0x6f, 0x6d, 0x44, + 0x6f, 0x77, 0x6e, 0x73, 0x79, 0x6e, 0x63, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x2e, 0x50, 0x6c, 0x61, + 0x79, 0x65, 0x72, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x07, 0x70, 0x6c, 0x61, 0x79, 0x65, + 0x72, 0x73, 0x12, 0x26, 0x0a, 0x0e, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x64, 0x6f, 0x77, 0x6e, 0x4e, + 0x61, 0x6e, 0x6f, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0e, 0x63, 0x6f, 0x75, 0x6e, + 0x74, 0x64, 0x6f, 0x77, 0x6e, 0x4e, 0x61, 0x6e, 0x6f, 0x73, 0x12, 0x4c, 0x0a, 0x0b, 0x70, 0x6c, + 0x61, 0x79, 0x65, 0x72, 0x4d, 0x65, 0x74, 0x61, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x2a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x52, 0x6f, 0x6f, 0x6d, 0x44, 0x6f, 0x77, 0x6e, 0x73, 0x79, 0x6e, 0x63, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x2e, 0x50, 0x6c, 0x61, 0x79, 0x65, - 0x72, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x07, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x73, - 0x12, 0x26, 0x0a, 0x0e, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x64, 0x6f, 0x77, 0x6e, 0x4e, 0x61, 0x6e, - 0x6f, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0e, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x64, - 0x6f, 0x77, 0x6e, 0x4e, 0x61, 0x6e, 0x6f, 0x73, 0x12, 0x4c, 0x0a, 0x0b, 0x70, 0x6c, 0x61, 0x79, - 0x65, 0x72, 0x4d, 0x65, 0x74, 0x61, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2a, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x52, 0x6f, 0x6f, 0x6d, 0x44, 0x6f, 0x77, 0x6e, 0x73, - 0x79, 0x6e, 0x63, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x2e, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x4d, - 0x65, 0x74, 0x61, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0b, 0x70, 0x6c, 0x61, 0x79, 0x65, - 0x72, 0x4d, 0x65, 0x74, 0x61, 0x73, 0x1a, 0x4a, 0x0a, 0x0c, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, - 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x24, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, - 0x2e, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, - 0x38, 0x01, 0x1a, 0x52, 0x0a, 0x10, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x4d, 0x65, 0x74, 0x61, - 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x28, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, - 0x2e, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x4d, 0x65, 0x74, 0x61, 0x52, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0xb8, 0x02, 0x0a, 0x05, 0x57, 0x73, 0x52, 0x65, 0x71, - 0x12, 0x14, 0x0a, 0x05, 0x6d, 0x73, 0x67, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, - 0x05, 0x6d, 0x73, 0x67, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, - 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x70, 0x6c, 0x61, 0x79, 0x65, 0x72, + 0x72, 0x4d, 0x65, 0x74, 0x61, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0b, 0x70, 0x6c, 0x61, + 0x79, 0x65, 0x72, 0x4d, 0x65, 0x74, 0x61, 0x73, 0x1a, 0x52, 0x0a, 0x0c, 0x50, 0x6c, 0x61, 0x79, + 0x65, 0x72, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x2c, 0x0a, 0x05, 0x76, 0x61, + 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x73, 0x2e, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x44, 0x6f, 0x77, 0x6e, 0x73, 0x79, 0x6e, + 0x63, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x5a, 0x0a, 0x10, + 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x4d, 0x65, 0x74, 0x61, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, + 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, + 0x65, 0x79, 0x12, 0x30, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x50, 0x6c, 0x61, 0x79, 0x65, + 0x72, 0x44, 0x6f, 0x77, 0x6e, 0x73, 0x79, 0x6e, 0x63, 0x4d, 0x65, 0x74, 0x61, 0x52, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0xb8, 0x02, 0x0a, 0x05, 0x57, 0x73, 0x52, + 0x65, 0x71, 0x12, 0x14, 0x0a, 0x05, 0x6d, 0x73, 0x67, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x05, 0x52, 0x05, 0x6d, 0x73, 0x67, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x6c, 0x61, 0x79, + 0x65, 0x72, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x70, 0x6c, 0x61, 0x79, + 0x65, 0x72, 0x49, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x61, 0x63, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x05, 0x52, 0x03, 0x61, 0x63, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x6a, 0x6f, 0x69, 0x6e, 0x49, 0x6e, + 0x64, 0x65, 0x78, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x6a, 0x6f, 0x69, 0x6e, 0x49, + 0x6e, 0x64, 0x65, 0x78, 0x12, 0x24, 0x0a, 0x0d, 0x61, 0x63, 0x6b, 0x69, 0x6e, 0x67, 0x46, 0x72, + 0x61, 0x6d, 0x65, 0x49, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0d, 0x61, 0x63, 0x6b, + 0x69, 0x6e, 0x67, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x49, 0x64, 0x12, 0x2e, 0x0a, 0x12, 0x61, 0x63, + 0x6b, 0x69, 0x6e, 0x67, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x49, 0x64, + 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x12, 0x61, 0x63, 0x6b, 0x69, 0x6e, 0x67, 0x49, 0x6e, + 0x70, 0x75, 0x74, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x49, 0x64, 0x12, 0x4e, 0x0a, 0x15, 0x69, 0x6e, + 0x70, 0x75, 0x74, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x55, 0x70, 0x73, 0x79, 0x6e, 0x63, 0x42, 0x61, + 0x74, 0x63, 0x68, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x73, 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x55, 0x70, 0x73, + 0x79, 0x6e, 0x63, 0x52, 0x15, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x55, + 0x70, 0x73, 0x79, 0x6e, 0x63, 0x42, 0x61, 0x74, 0x63, 0x68, 0x12, 0x27, 0x0a, 0x02, 0x68, 0x62, + 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, + 0x48, 0x65, 0x61, 0x72, 0x74, 0x62, 0x65, 0x61, 0x74, 0x55, 0x70, 0x73, 0x79, 0x6e, 0x63, 0x52, + 0x02, 0x68, 0x62, 0x22, 0x89, 0x02, 0x0a, 0x06, 0x57, 0x73, 0x52, 0x65, 0x73, 0x70, 0x12, 0x10, + 0x0a, 0x03, 0x72, 0x65, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x72, 0x65, 0x74, + 0x12, 0x20, 0x0a, 0x0b, 0x65, 0x63, 0x68, 0x6f, 0x65, 0x64, 0x4d, 0x73, 0x67, 0x49, 0x64, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0b, 0x65, 0x63, 0x68, 0x6f, 0x65, 0x64, 0x4d, 0x73, 0x67, 0x49, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x61, 0x63, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, - 0x03, 0x61, 0x63, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x6a, 0x6f, 0x69, 0x6e, 0x49, 0x6e, 0x64, 0x65, - 0x78, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x6a, 0x6f, 0x69, 0x6e, 0x49, 0x6e, 0x64, - 0x65, 0x78, 0x12, 0x24, 0x0a, 0x0d, 0x61, 0x63, 0x6b, 0x69, 0x6e, 0x67, 0x46, 0x72, 0x61, 0x6d, - 0x65, 0x49, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0d, 0x61, 0x63, 0x6b, 0x69, 0x6e, - 0x67, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x49, 0x64, 0x12, 0x2e, 0x0a, 0x12, 0x61, 0x63, 0x6b, 0x69, - 0x6e, 0x67, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x49, 0x64, 0x18, 0x06, - 0x20, 0x01, 0x28, 0x05, 0x52, 0x12, 0x61, 0x63, 0x6b, 0x69, 0x6e, 0x67, 0x49, 0x6e, 0x70, 0x75, - 0x74, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x49, 0x64, 0x12, 0x4e, 0x0a, 0x15, 0x69, 0x6e, 0x70, 0x75, - 0x74, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x55, 0x70, 0x73, 0x79, 0x6e, 0x63, 0x42, 0x61, 0x74, 0x63, - 0x68, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, - 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x55, 0x70, 0x73, 0x79, 0x6e, - 0x63, 0x52, 0x15, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x55, 0x70, 0x73, - 0x79, 0x6e, 0x63, 0x42, 0x61, 0x74, 0x63, 0x68, 0x12, 0x27, 0x0a, 0x02, 0x68, 0x62, 0x18, 0x08, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x48, 0x65, - 0x61, 0x72, 0x74, 0x62, 0x65, 0x61, 0x74, 0x55, 0x70, 0x73, 0x79, 0x6e, 0x63, 0x52, 0x02, 0x68, - 0x62, 0x22, 0x89, 0x02, 0x0a, 0x06, 0x57, 0x73, 0x52, 0x65, 0x73, 0x70, 0x12, 0x10, 0x0a, 0x03, - 0x72, 0x65, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x72, 0x65, 0x74, 0x12, 0x20, - 0x0a, 0x0b, 0x65, 0x63, 0x68, 0x6f, 0x65, 0x64, 0x4d, 0x73, 0x67, 0x49, 0x64, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x05, 0x52, 0x0b, 0x65, 0x63, 0x68, 0x6f, 0x65, 0x64, 0x4d, 0x73, 0x67, 0x49, 0x64, - 0x12, 0x10, 0x0a, 0x03, 0x61, 0x63, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x61, - 0x63, 0x74, 0x12, 0x2b, 0x0a, 0x03, 0x72, 0x64, 0x66, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x19, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x52, 0x6f, 0x6f, 0x6d, 0x44, 0x6f, 0x77, - 0x6e, 0x73, 0x79, 0x6e, 0x63, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x52, 0x03, 0x72, 0x64, 0x66, 0x12, - 0x54, 0x0a, 0x17, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x44, 0x6f, 0x77, - 0x6e, 0x73, 0x79, 0x6e, 0x63, 0x42, 0x61, 0x74, 0x63, 0x68, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x46, - 0x72, 0x61, 0x6d, 0x65, 0x44, 0x6f, 0x77, 0x6e, 0x73, 0x79, 0x6e, 0x63, 0x52, 0x17, 0x69, 0x6e, - 0x70, 0x75, 0x74, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x44, 0x6f, 0x77, 0x6e, 0x73, 0x79, 0x6e, 0x63, - 0x42, 0x61, 0x74, 0x63, 0x68, 0x12, 0x36, 0x0a, 0x08, 0x62, 0x63, 0x69, 0x46, 0x72, 0x61, 0x6d, - 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, - 0x2e, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x43, 0x6f, 0x6c, 0x6c, 0x69, 0x64, 0x65, 0x72, 0x49, - 0x6e, 0x66, 0x6f, 0x52, 0x08, 0x62, 0x63, 0x69, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x42, 0x13, 0x5a, - 0x11, 0x62, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x5f, 0x73, 0x72, 0x76, 0x2f, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x03, 0x61, 0x63, 0x74, 0x12, 0x2b, 0x0a, 0x03, 0x72, 0x64, 0x66, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x19, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x52, 0x6f, 0x6f, 0x6d, 0x44, + 0x6f, 0x77, 0x6e, 0x73, 0x79, 0x6e, 0x63, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x52, 0x03, 0x72, 0x64, + 0x66, 0x12, 0x54, 0x0a, 0x17, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x44, + 0x6f, 0x77, 0x6e, 0x73, 0x79, 0x6e, 0x63, 0x42, 0x61, 0x74, 0x63, 0x68, 0x18, 0x05, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x49, 0x6e, 0x70, 0x75, + 0x74, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x44, 0x6f, 0x77, 0x6e, 0x73, 0x79, 0x6e, 0x63, 0x52, 0x17, + 0x69, 0x6e, 0x70, 0x75, 0x74, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x44, 0x6f, 0x77, 0x6e, 0x73, 0x79, + 0x6e, 0x63, 0x42, 0x61, 0x74, 0x63, 0x68, 0x12, 0x36, 0x0a, 0x08, 0x62, 0x63, 0x69, 0x46, 0x72, + 0x61, 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x73, 0x2e, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x43, 0x6f, 0x6c, 0x6c, 0x69, 0x64, 0x65, + 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x08, 0x62, 0x63, 0x69, 0x46, 0x72, 0x61, 0x6d, 0x65, 0x42, + 0x13, 0x5a, 0x11, 0x62, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x5f, 0x73, 0x72, 0x76, 0x2f, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -1075,27 +1078,27 @@ func file_room_downsync_frame_proto_rawDescGZIP() []byte { var file_room_downsync_frame_proto_msgTypes = make([]protoimpl.MessageInfo, 13) var file_room_downsync_frame_proto_goTypes = []interface{}{ - (*BattleColliderInfo)(nil), // 0: protos.BattleColliderInfo - (*Player)(nil), // 1: protos.Player - (*PlayerMeta)(nil), // 2: protos.PlayerMeta - (*InputFrameUpsync)(nil), // 3: protos.InputFrameUpsync - (*InputFrameDownsync)(nil), // 4: protos.InputFrameDownsync - (*HeartbeatUpsync)(nil), // 5: protos.HeartbeatUpsync - (*RoomDownsyncFrame)(nil), // 6: protos.RoomDownsyncFrame - (*WsReq)(nil), // 7: protos.WsReq - (*WsResp)(nil), // 8: protos.WsResp - nil, // 9: protos.BattleColliderInfo.StrToVec2DListMapEntry - nil, // 10: protos.BattleColliderInfo.StrToPolygon2DListMapEntry - nil, // 11: protos.RoomDownsyncFrame.PlayersEntry - nil, // 12: protos.RoomDownsyncFrame.PlayerMetasEntry - (*protos.Direction)(nil), // 13: protos.Direction - (*protos.Vec2DList)(nil), // 14: protos.Vec2DList - (*protos.Polygon2DList)(nil), // 15: protos.Polygon2DList + (*BattleColliderInfo)(nil), // 0: protos.BattleColliderInfo + (*PlayerDownsync)(nil), // 1: protos.PlayerDownsync + (*PlayerDownsyncMeta)(nil), // 2: protos.PlayerDownsyncMeta + (*InputFrameUpsync)(nil), // 3: protos.InputFrameUpsync + (*InputFrameDownsync)(nil), // 4: protos.InputFrameDownsync + (*HeartbeatUpsync)(nil), // 5: protos.HeartbeatUpsync + (*RoomDownsyncFrame)(nil), // 6: protos.RoomDownsyncFrame + (*WsReq)(nil), // 7: protos.WsReq + (*WsResp)(nil), // 8: protos.WsResp + nil, // 9: protos.BattleColliderInfo.StrToVec2DListMapEntry + nil, // 10: protos.BattleColliderInfo.StrToPolygon2DListMapEntry + nil, // 11: protos.RoomDownsyncFrame.PlayersEntry + nil, // 12: protos.RoomDownsyncFrame.PlayerMetasEntry + (*sharedprotos.Direction)(nil), // 13: sharedprotos.Direction + (*sharedprotos.Vec2DList)(nil), // 14: sharedprotos.Vec2DList + (*sharedprotos.Polygon2DList)(nil), // 15: sharedprotos.Polygon2DList } var file_room_downsync_frame_proto_depIdxs = []int32{ 9, // 0: protos.BattleColliderInfo.strToVec2DListMap:type_name -> protos.BattleColliderInfo.StrToVec2DListMapEntry 10, // 1: protos.BattleColliderInfo.strToPolygon2DListMap:type_name -> protos.BattleColliderInfo.StrToPolygon2DListMapEntry - 13, // 2: protos.Player.dir:type_name -> protos.Direction + 13, // 2: protos.PlayerDownsync.dir:type_name -> sharedprotos.Direction 11, // 3: protos.RoomDownsyncFrame.players:type_name -> protos.RoomDownsyncFrame.PlayersEntry 12, // 4: protos.RoomDownsyncFrame.playerMetas:type_name -> protos.RoomDownsyncFrame.PlayerMetasEntry 3, // 5: protos.WsReq.inputFrameUpsyncBatch:type_name -> protos.InputFrameUpsync @@ -1103,10 +1106,10 @@ var file_room_downsync_frame_proto_depIdxs = []int32{ 6, // 7: protos.WsResp.rdf:type_name -> protos.RoomDownsyncFrame 4, // 8: protos.WsResp.inputFrameDownsyncBatch:type_name -> protos.InputFrameDownsync 0, // 9: protos.WsResp.bciFrame:type_name -> protos.BattleColliderInfo - 14, // 10: protos.BattleColliderInfo.StrToVec2DListMapEntry.value:type_name -> protos.Vec2DList - 15, // 11: protos.BattleColliderInfo.StrToPolygon2DListMapEntry.value:type_name -> protos.Polygon2DList - 1, // 12: protos.RoomDownsyncFrame.PlayersEntry.value:type_name -> protos.Player - 2, // 13: protos.RoomDownsyncFrame.PlayerMetasEntry.value:type_name -> protos.PlayerMeta + 14, // 10: protos.BattleColliderInfo.StrToVec2DListMapEntry.value:type_name -> sharedprotos.Vec2DList + 15, // 11: protos.BattleColliderInfo.StrToPolygon2DListMapEntry.value:type_name -> sharedprotos.Polygon2DList + 1, // 12: protos.RoomDownsyncFrame.PlayersEntry.value:type_name -> protos.PlayerDownsync + 2, // 13: protos.RoomDownsyncFrame.PlayerMetasEntry.value:type_name -> protos.PlayerDownsyncMeta 14, // [14:14] is the sub-list for method output_type 14, // [14:14] is the sub-list for method input_type 14, // [14:14] is the sub-list for extension type_name @@ -1133,7 +1136,7 @@ func file_room_downsync_frame_proto_init() { } } file_room_downsync_frame_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Player); i { + switch v := v.(*PlayerDownsync); i { case 0: return &v.state case 1: @@ -1145,7 +1148,7 @@ func file_room_downsync_frame_proto_init() { } } file_room_downsync_frame_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*PlayerMeta); i { + switch v := v.(*PlayerDownsyncMeta); i { case 0: return &v.state case 1: diff --git a/battle_srv/storage/mysql_manager.go b/battle_srv/storage/mysql_manager.go index bfc8175..fe64b62 100644 --- a/battle_srv/storage/mysql_manager.go +++ b/battle_srv/storage/mysql_manager.go @@ -1,7 +1,7 @@ package storage import ( - . "server/common" + . "battle_srv/common" _ "github.com/go-sql-driver/mysql" "github.com/jmoiron/sqlx" diff --git a/battle_srv/storage/redis_manager.go b/battle_srv/storage/redis_manager.go index b977abf..cc67b8b 100644 --- a/battle_srv/storage/redis_manager.go +++ b/battle_srv/storage/redis_manager.go @@ -1,8 +1,8 @@ package storage import ( + . "battle_srv/common" "fmt" - . "server/common" "github.com/go-redis/redis" _ "github.com/go-sql-driver/mysql" diff --git a/battle_srv/ws/serve.go b/battle_srv/ws/serve.go index 0c30f8d..9d7b0f9 100644 --- a/battle_srv/ws/serve.go +++ b/battle_srv/ws/serve.go @@ -1,6 +1,9 @@ package ws import ( + . "battle_srv/common" + "battle_srv/models" + pb "battle_srv/protos" "container/heap" "fmt" "github.com/gin-gonic/gin" @@ -8,9 +11,6 @@ import ( "github.com/gorilla/websocket" "go.uber.org/zap" "net/http" - . "battle_srv/common" - "battle_srv/models" - pb "battle_srv/protos" "strconv" "sync/atomic" "time" @@ -246,8 +246,8 @@ func Serve(c *gin.Context) { bciFrame := &pb.BattleColliderInfo{ BoundRoomId: pRoom.Id, StageName: pRoom.StageName, - StrToVec2DListMap: models.ToPbVec2DListMap(pRoom.RawBattleStrToVec2DListMap), - StrToPolygon2DListMap: models.ToPbPolygon2DListMap(pRoom.RawBattleStrToPolygon2DListMap), + StrToVec2DListMap: pRoom.RawBattleStrToVec2DListMap, + StrToPolygon2DListMap: pRoom.RawBattleStrToPolygon2DListMap, StageDiscreteW: pRoom.StageDiscreteW, StageDiscreteH: pRoom.StageDiscreteH, StageTileW: pRoom.StageTileW, diff --git a/collider_visualizer/worldColliderDisplay.go b/collider_visualizer/worldColliderDisplay.go index 21f301a..d1f4a40 100644 --- a/collider_visualizer/worldColliderDisplay.go +++ b/collider_visualizer/worldColliderDisplay.go @@ -19,7 +19,7 @@ func (world *WorldColliderDisplay) Init() { func NewWorldColliderDisplay(game *Game, stageDiscreteW, stageDiscreteH, stageTileW, stageTileH int32, playerPosMap StrToVec2DListMap, barrierMap StrToPolygon2DListMap) *WorldColliderDisplay { - playerList := *(playerPosMap["PlayerStartingPos"]) + playerPosList := *(playerPosMap["PlayerStartingPos"]) barrierList := *(barrierMap["Barrier"]) world := &WorldColliderDisplay{Game: game} @@ -33,17 +33,17 @@ func NewWorldColliderDisplay(game *Game, stageDiscreteW, stageDiscreteH, stageTi spaceOffsetY := float64(spaceH) * 0.5 playerColliderRadius := float64(32) - playerColliders := make([]*resolv.Object, len(playerList)) + playerColliders := make([]*resolv.Object, len(playerPosList.Eles)) space := resolv.NewSpace(int(spaceW), int(spaceH), 16, 16) - for i, player := range playerList { - playerCollider := GenerateRectCollider(player.X, player.Y, playerColliderRadius*2, playerColliderRadius*2, spaceOffsetX, spaceOffsetY, "Player") // [WARNING] Deliberately not using a circle because "resolv v0.5.1" doesn't yet align circle center with space cell center, regardless of the "specified within-object offset" - Logger.Info(fmt.Sprintf("Player Collider#%d: player.X=%v, player.Y=%v, radius=%v, spaceOffsetX=%v, spaceOffsetY=%v, shape=%v; calibrationCheckX=player.X-radius+spaceOffsetX=%v", i, player.X, player.Y, playerColliderRadius, spaceOffsetX, spaceOffsetY, playerCollider.Shape, player.X-playerColliderRadius+spaceOffsetX)) + for i, playerPos := range playerPosList.Eles { + playerCollider := GenerateRectCollider(playerPos.X, playerPos.Y, playerColliderRadius*2, playerColliderRadius*2, spaceOffsetX, spaceOffsetY, "Player") // [WARNING] Deliberately not using a circle because "resolv v0.5.1" doesn't yet align circle center with space cell center, regardless of the "specified within-object offset" + Logger.Info(fmt.Sprintf("Player Collider#%d: playerPos.X=%v, playerPos.Y=%v, radius=%v, spaceOffsetX=%v, spaceOffsetY=%v, shape=%v; calibrationCheckX=playerPos.X-radius+spaceOffsetX=%v", i, playerPos.X, playerPos.Y, playerColliderRadius, spaceOffsetX, spaceOffsetY, playerCollider.Shape, playerPos.X-playerColliderRadius+spaceOffsetX)) playerColliders[i] = playerCollider space.Add(playerCollider) } barrierLocalId := 0 - for _, barrierUnaligned := range barrierList { + for _, barrierUnaligned := range barrierList.Eles { barrierCollider := GenerateConvexPolygonCollider(barrierUnaligned, spaceOffsetX, spaceOffsetY, "Barrier") Logger.Info(fmt.Sprintf("Added barrier: shape=%v", barrierCollider.Shape)) space.Add(barrierCollider) diff --git a/dnmshared/geometry.go b/dnmshared/geometry.go index e4e0ef0..a084208 100644 --- a/dnmshared/geometry.go +++ b/dnmshared/geometry.go @@ -1,12 +1,12 @@ package dnmshared import ( + . "dnmshared/sharedprotos" "math" - . "dnmshared/protos" ) func NormVec2D(dx, dy float64) Vec2D { - return Vec2D{X: dy, Y:-dx} + return Vec2D{X: dy, Y: -dx} } func AlignPolygon2DToBoundingBox(input *Polygon2D) *Polygon2D { @@ -30,7 +30,7 @@ func AlignPolygon2DToBoundingBox(input *Polygon2D) *Polygon2D { X: input.Anchor.X + boundingBoxTL.X, Y: input.Anchor.Y + boundingBoxTL.Y, }, - Points: make([]*Vec2D, len(input.Points)), + Points: make([]*Vec2D, len(input.Points)), } for i, p := range input.Points { diff --git a/dnmshared/resolv_helper.go b/dnmshared/resolv_helper.go index fb0ae53..2a7b7fa 100644 --- a/dnmshared/resolv_helper.go +++ b/dnmshared/resolv_helper.go @@ -1,12 +1,12 @@ package dnmshared import ( + . "dnmshared/sharedprotos" "fmt" "github.com/kvartborg/vector" "github.com/solarlune/resolv" "math" "strings" - . "dnmshared/protos" ) func ConvexPolygonStr(body *resolv.ConvexPolygon) string { diff --git a/dnmshared/protos/geometry.pb.go b/dnmshared/sharedprotos/geometry.pb.go similarity index 78% rename from dnmshared/protos/geometry.pb.go rename to dnmshared/sharedprotos/geometry.pb.go index 4952826..b96f64b 100644 --- a/dnmshared/protos/geometry.pb.go +++ b/dnmshared/sharedprotos/geometry.pb.go @@ -1,10 +1,10 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.28.1 -// protoc v3.7.1 +// protoc v3.21.4 // source: geometry.proto -package protos +package sharedprotos import ( protoreflect "google.golang.org/protobuf/reflect/protoreflect" @@ -283,26 +283,28 @@ var File_geometry_proto protoreflect.FileDescriptor var file_geometry_proto_rawDesc = []byte{ 0x0a, 0x0e, 0x67, 0x65, 0x6f, 0x6d, 0x65, 0x74, 0x72, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x12, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x22, 0x2b, 0x0a, 0x09, 0x44, 0x69, 0x72, 0x65, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0e, 0x0a, 0x02, 0x64, 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x05, 0x52, 0x02, 0x64, 0x78, 0x12, 0x0e, 0x0a, 0x02, 0x64, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x05, 0x52, 0x02, 0x64, 0x79, 0x22, 0x23, 0x0a, 0x05, 0x56, 0x65, 0x63, 0x32, 0x44, 0x12, 0x0c, - 0x0a, 0x01, 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x01, 0x52, 0x01, 0x78, 0x12, 0x0c, 0x0a, 0x01, - 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x01, 0x52, 0x01, 0x79, 0x22, 0x59, 0x0a, 0x09, 0x50, 0x6f, - 0x6c, 0x79, 0x67, 0x6f, 0x6e, 0x32, 0x44, 0x12, 0x25, 0x0a, 0x06, 0x61, 0x6e, 0x63, 0x68, 0x6f, - 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, - 0x2e, 0x56, 0x65, 0x63, 0x32, 0x44, 0x52, 0x06, 0x61, 0x6e, 0x63, 0x68, 0x6f, 0x72, 0x12, 0x25, - 0x0a, 0x06, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x56, 0x65, 0x63, 0x32, 0x44, 0x52, 0x06, 0x70, - 0x6f, 0x69, 0x6e, 0x74, 0x73, 0x22, 0x2e, 0x0a, 0x09, 0x56, 0x65, 0x63, 0x32, 0x44, 0x4c, 0x69, - 0x73, 0x74, 0x12, 0x21, 0x0a, 0x04, 0x65, 0x6c, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x0d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x56, 0x65, 0x63, 0x32, 0x44, 0x52, - 0x04, 0x65, 0x6c, 0x65, 0x73, 0x22, 0x36, 0x0a, 0x0d, 0x50, 0x6f, 0x6c, 0x79, 0x67, 0x6f, 0x6e, - 0x32, 0x44, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x25, 0x0a, 0x04, 0x65, 0x6c, 0x65, 0x73, 0x18, 0x01, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x50, 0x6f, - 0x6c, 0x79, 0x67, 0x6f, 0x6e, 0x32, 0x44, 0x52, 0x04, 0x65, 0x6c, 0x65, 0x73, 0x42, 0x12, 0x5a, - 0x10, 0x64, 0x6e, 0x6d, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x12, 0x0c, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x22, 0x2b, + 0x0a, 0x09, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0e, 0x0a, 0x02, 0x64, + 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x64, 0x78, 0x12, 0x0e, 0x0a, 0x02, 0x64, + 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x64, 0x79, 0x22, 0x23, 0x0a, 0x05, 0x56, + 0x65, 0x63, 0x32, 0x44, 0x12, 0x0c, 0x0a, 0x01, 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x01, 0x52, + 0x01, 0x78, 0x12, 0x0c, 0x0a, 0x01, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x01, 0x52, 0x01, 0x79, + 0x22, 0x65, 0x0a, 0x09, 0x50, 0x6f, 0x6c, 0x79, 0x67, 0x6f, 0x6e, 0x32, 0x44, 0x12, 0x2b, 0x0a, + 0x06, 0x61, 0x6e, 0x63, 0x68, 0x6f, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, + 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x56, 0x65, 0x63, + 0x32, 0x44, 0x52, 0x06, 0x61, 0x6e, 0x63, 0x68, 0x6f, 0x72, 0x12, 0x2b, 0x0a, 0x06, 0x70, 0x6f, + 0x69, 0x6e, 0x74, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x73, 0x68, 0x61, + 0x72, 0x65, 0x64, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x56, 0x65, 0x63, 0x32, 0x44, 0x52, + 0x06, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x73, 0x22, 0x34, 0x0a, 0x09, 0x56, 0x65, 0x63, 0x32, 0x44, + 0x4c, 0x69, 0x73, 0x74, 0x12, 0x27, 0x0a, 0x04, 0x65, 0x6c, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x73, 0x2e, 0x56, 0x65, 0x63, 0x32, 0x44, 0x52, 0x04, 0x65, 0x6c, 0x65, 0x73, 0x22, 0x3c, 0x0a, + 0x0d, 0x50, 0x6f, 0x6c, 0x79, 0x67, 0x6f, 0x6e, 0x32, 0x44, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x2b, + 0x0a, 0x04, 0x65, 0x6c, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x73, + 0x68, 0x61, 0x72, 0x65, 0x64, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2e, 0x50, 0x6f, 0x6c, 0x79, + 0x67, 0x6f, 0x6e, 0x32, 0x44, 0x52, 0x04, 0x65, 0x6c, 0x65, 0x73, 0x42, 0x18, 0x5a, 0x16, 0x64, + 0x6e, 0x6d, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x2f, 0x73, 0x68, 0x61, 0x72, 0x65, 0x64, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -319,17 +321,17 @@ func file_geometry_proto_rawDescGZIP() []byte { var file_geometry_proto_msgTypes = make([]protoimpl.MessageInfo, 5) var file_geometry_proto_goTypes = []interface{}{ - (*Direction)(nil), // 0: protos.Direction - (*Vec2D)(nil), // 1: protos.Vec2D - (*Polygon2D)(nil), // 2: protos.Polygon2D - (*Vec2DList)(nil), // 3: protos.Vec2DList - (*Polygon2DList)(nil), // 4: protos.Polygon2DList + (*Direction)(nil), // 0: sharedprotos.Direction + (*Vec2D)(nil), // 1: sharedprotos.Vec2D + (*Polygon2D)(nil), // 2: sharedprotos.Polygon2D + (*Vec2DList)(nil), // 3: sharedprotos.Vec2DList + (*Polygon2DList)(nil), // 4: sharedprotos.Polygon2DList } var file_geometry_proto_depIdxs = []int32{ - 1, // 0: protos.Polygon2D.anchor:type_name -> protos.Vec2D - 1, // 1: protos.Polygon2D.points:type_name -> protos.Vec2D - 1, // 2: protos.Vec2DList.eles:type_name -> protos.Vec2D - 2, // 3: protos.Polygon2DList.eles:type_name -> protos.Polygon2D + 1, // 0: sharedprotos.Polygon2D.anchor:type_name -> sharedprotos.Vec2D + 1, // 1: sharedprotos.Polygon2D.points:type_name -> sharedprotos.Vec2D + 1, // 2: sharedprotos.Vec2DList.eles:type_name -> sharedprotos.Vec2D + 2, // 3: sharedprotos.Polygon2DList.eles:type_name -> sharedprotos.Polygon2D 4, // [4:4] is the sub-list for method output_type 4, // [4:4] is the sub-list for method input_type 4, // [4:4] is the sub-list for extension type_name diff --git a/dnmshared/tmx_parser.go b/dnmshared/tmx_parser.go index a495253..0477567 100644 --- a/dnmshared/tmx_parser.go +++ b/dnmshared/tmx_parser.go @@ -3,6 +3,7 @@ package dnmshared import ( "bytes" "compress/zlib" + . "dnmshared/sharedprotos" "encoding/base64" "encoding/xml" "errors" @@ -11,7 +12,6 @@ import ( "math" "strconv" "strings" - . "dnmshared/protos" ) const ( @@ -232,8 +232,8 @@ func tsxPolylineToOffsetsWrtTileCenter(pTmxMapIns *TmxMap, singleObjInTsxFile *T pointsCount := len(singleValueArray) thePolygon2DFromPolyline := &Polygon2D{ - Anchor: nil, - Points: make([]*Vec2D, pointsCount), + Anchor: nil, + Points: make([]*Vec2D, pointsCount), } /* @@ -324,16 +324,17 @@ func DeserializeTsxToColliderDict(pTmxMapIns *TmxMap, byteArrOfTsxFile []byte, f if _, ok := theStrToPolygon2DListMap[key]; ok { pThePolygon2DList = theStrToPolygon2DListMap[key] } else { - thePolygon2DListEles := make([]*Polygon2D, 0) - theStrToPolygon2DListMap[key] = &thePolygon2DList - pThePolygon2DList = theStrToPolygon2DListMap[key] + pThePolygon2DList = &Polygon2DList{ + Eles: make([]*Polygon2D, 0), + } + theStrToPolygon2DListMap[key] = pThePolygon2DList } thePolygon2DFromPolyline, err := tsxPolylineToOffsetsWrtTileCenter(pTmxMapIns, singleObj, singleObj.Polyline, pTsxIns) if nil != err { panic(err) } - *pThePolygon2DList = append(*pThePolygon2DList, thePolygon2DFromPolyline) + pThePolygon2DList.Eles = append(pThePolygon2DList.Eles, thePolygon2DFromPolyline) } } return nil @@ -349,8 +350,10 @@ func ParseTmxLayersAndGroups(pTmxMapIns *TmxMap, gidBoundariesMap map[int]StrToP var pTheVec2DListToCache *Vec2DList _, ok := toRetStrToVec2DListMap[objGroup.Name] if false == ok { - theVec2DListToCache := make(Vec2DList, 0) - toRetStrToVec2DListMap[objGroup.Name] = &theVec2DListToCache + pTheVec2DListToCache = &Vec2DList{ + Eles: make([]*Vec2D, 0), + } + toRetStrToVec2DListMap[objGroup.Name] = pTheVec2DListToCache } pTheVec2DListToCache = toRetStrToVec2DListMap[objGroup.Name] for _, singleObjInTmxFile := range objGroup.Objects { @@ -359,17 +362,18 @@ func ParseTmxLayersAndGroups(pTmxMapIns *TmxMap, gidBoundariesMap map[int]StrToP Y: singleObjInTmxFile.Y, } thePosInWorld := pTmxMapIns.continuousObjLayerOffsetToContinuousMapNodePos(theUntransformedPos) - *pTheVec2DListToCache = append(*pTheVec2DListToCache, &thePosInWorld) + pTheVec2DListToCache.Eles = append(pTheVec2DListToCache.Eles, &thePosInWorld) } case "Barrier": // Note that in this case, the "Polygon2D.Anchor" of each "TmxOrTsxObject" is exactly overlapping with "Polygon2D.Points[0]". var pThePolygon2DListToCache *Polygon2DList _, ok := toRetStrToPolygon2DListMap[objGroup.Name] if false == ok { - thePolygon2DListToCache := make(Polygon2DList, 0) - toRetStrToPolygon2DListMap[objGroup.Name] = &thePolygon2DListToCache + pThePolygon2DListToCache = &Polygon2DList{ + Eles: make([]*Polygon2D, 0), + } + toRetStrToPolygon2DListMap[objGroup.Name] = pThePolygon2DListToCache } - pThePolygon2DListToCache = toRetStrToPolygon2DListMap[objGroup.Name] for _, singleObjInTmxFile := range objGroup.Objects { if nil == singleObjInTmxFile.Polyline { @@ -383,7 +387,7 @@ func ParseTmxLayersAndGroups(pTmxMapIns *TmxMap, gidBoundariesMap map[int]StrToP if nil != err { panic(err) } - *pThePolygon2DListToCache = append(*pThePolygon2DListToCache, thePolygon2DInWorld) + pThePolygon2DListToCache.Eles = append(pThePolygon2DListToCache.Eles, thePolygon2DInWorld) } default: } diff --git a/frontend/assets/resources/pbfiles/geometry.proto b/frontend/assets/resources/pbfiles/geometry.proto index 46e64ce..bc0290b 100644 --- a/frontend/assets/resources/pbfiles/geometry.proto +++ b/frontend/assets/resources/pbfiles/geometry.proto @@ -1,7 +1,6 @@ syntax = "proto3"; -option go_package = "dnmshared/protos"; // here "./" corresponds to the "--go_out" value in "protoc" command - -package protos; +option go_package = "dnmshared/sharedprotos"; // here "./" corresponds to the "--go_out" value in "protoc" command +package sharedprotos; message Direction { int32 dx = 1; diff --git a/frontend/assets/resources/pbfiles/room_downsync_frame.proto b/frontend/assets/resources/pbfiles/room_downsync_frame.proto index 1222dd1..b3166c3 100644 --- a/frontend/assets/resources/pbfiles/room_downsync_frame.proto +++ b/frontend/assets/resources/pbfiles/room_downsync_frame.proto @@ -6,8 +6,8 @@ import "geometry.proto"; // The import path here is only w.r.t. the proto file, message BattleColliderInfo { string stageName = 1; - map strToVec2DListMap = 2; - map strToPolygon2DListMap = 3; + map strToVec2DListMap = 2; + map strToPolygon2DListMap = 3; int32 stageDiscreteW = 4; int32 stageDiscreteH = 5; int32 stageTileW = 6; @@ -31,11 +31,11 @@ message BattleColliderInfo { double virtualGridToWorldRatio = 22; } -message Player { +message PlayerDownsync { int32 id = 1; int32 virtualGridX = 2; int32 virtualGridY = 3; - Direction dir = 4; + sharedprotos.Direction dir = 4; int32 speed = 5; // in terms of virtual grid units int32 battleState = 6; int32 lastMoveGmtMillis = 7; @@ -44,7 +44,7 @@ message Player { int32 joinIndex = 12; } -message PlayerMeta { +message PlayerDownsyncMeta { int32 id = 1; string name = 2; string displayName = 3; @@ -69,9 +69,9 @@ message HeartbeatUpsync { message RoomDownsyncFrame { int32 id = 1; - map players = 2; + map players = 2; int64 countdownNanos = 3; - map playerMetas = 4; + map playerMetas = 4; } message WsReq { diff --git a/frontend/assets/scripts/modules/room_downsync_frame_proto_bundle.forcemsg.js b/frontend/assets/scripts/modules/room_downsync_frame_proto_bundle.forcemsg.js index f6b171b..467a698 100644 --- a/frontend/assets/scripts/modules/room_downsync_frame_proto_bundle.forcemsg.js +++ b/frontend/assets/scripts/modules/room_downsync_frame_proto_bundle.forcemsg.js @@ -25,8 +25,8 @@ $root.protos = (function() { * @memberof protos * @interface IBattleColliderInfo * @property {string|null} [stageName] BattleColliderInfo stageName - * @property {Object.|null} [strToVec2DListMap] BattleColliderInfo strToVec2DListMap - * @property {Object.|null} [strToPolygon2DListMap] BattleColliderInfo strToPolygon2DListMap + * @property {Object.|null} [strToVec2DListMap] BattleColliderInfo strToVec2DListMap + * @property {Object.|null} [strToPolygon2DListMap] BattleColliderInfo strToPolygon2DListMap * @property {number|null} [stageDiscreteW] BattleColliderInfo stageDiscreteW * @property {number|null} [stageDiscreteH] BattleColliderInfo stageDiscreteH * @property {number|null} [stageTileW] BattleColliderInfo stageTileW @@ -75,7 +75,7 @@ $root.protos = (function() { /** * BattleColliderInfo strToVec2DListMap. - * @member {Object.} strToVec2DListMap + * @member {Object.} strToVec2DListMap * @memberof protos.BattleColliderInfo * @instance */ @@ -83,7 +83,7 @@ $root.protos = (function() { /** * BattleColliderInfo strToPolygon2DListMap. - * @member {Object.} strToPolygon2DListMap + * @member {Object.} strToPolygon2DListMap * @memberof protos.BattleColliderInfo * @instance */ @@ -265,55 +265,55 @@ $root.protos = (function() { BattleColliderInfo.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.stageName != null && message.hasOwnProperty("stageName")) + if (message.stageName != null && Object.hasOwnProperty.call(message, "stageName")) writer.uint32(/* id 1, wireType 2 =*/10).string(message.stageName); - if (message.strToVec2DListMap != null && message.hasOwnProperty("strToVec2DListMap")) + if (message.strToVec2DListMap != null && Object.hasOwnProperty.call(message, "strToVec2DListMap")) for (var keys = Object.keys(message.strToVec2DListMap), i = 0; i < keys.length; ++i) { writer.uint32(/* id 2, wireType 2 =*/18).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); - $root.protos.Vec2DList.encode(message.strToVec2DListMap[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); + $root.sharedprotos.Vec2DList.encode(message.strToVec2DListMap[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); } - if (message.strToPolygon2DListMap != null && message.hasOwnProperty("strToPolygon2DListMap")) + if (message.strToPolygon2DListMap != null && Object.hasOwnProperty.call(message, "strToPolygon2DListMap")) for (var keys = Object.keys(message.strToPolygon2DListMap), i = 0; i < keys.length; ++i) { writer.uint32(/* id 3, wireType 2 =*/26).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); - $root.protos.Polygon2DList.encode(message.strToPolygon2DListMap[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); + $root.sharedprotos.Polygon2DList.encode(message.strToPolygon2DListMap[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); } - if (message.stageDiscreteW != null && message.hasOwnProperty("stageDiscreteW")) + if (message.stageDiscreteW != null && Object.hasOwnProperty.call(message, "stageDiscreteW")) writer.uint32(/* id 4, wireType 0 =*/32).int32(message.stageDiscreteW); - if (message.stageDiscreteH != null && message.hasOwnProperty("stageDiscreteH")) + if (message.stageDiscreteH != null && Object.hasOwnProperty.call(message, "stageDiscreteH")) writer.uint32(/* id 5, wireType 0 =*/40).int32(message.stageDiscreteH); - if (message.stageTileW != null && message.hasOwnProperty("stageTileW")) + if (message.stageTileW != null && Object.hasOwnProperty.call(message, "stageTileW")) writer.uint32(/* id 6, wireType 0 =*/48).int32(message.stageTileW); - if (message.stageTileH != null && message.hasOwnProperty("stageTileH")) + if (message.stageTileH != null && Object.hasOwnProperty.call(message, "stageTileH")) writer.uint32(/* id 7, wireType 0 =*/56).int32(message.stageTileH); - if (message.intervalToPing != null && message.hasOwnProperty("intervalToPing")) + if (message.intervalToPing != null && Object.hasOwnProperty.call(message, "intervalToPing")) writer.uint32(/* id 8, wireType 0 =*/64).int32(message.intervalToPing); - if (message.willKickIfInactiveFor != null && message.hasOwnProperty("willKickIfInactiveFor")) + if (message.willKickIfInactiveFor != null && Object.hasOwnProperty.call(message, "willKickIfInactiveFor")) writer.uint32(/* id 9, wireType 0 =*/72).int32(message.willKickIfInactiveFor); - if (message.boundRoomId != null && message.hasOwnProperty("boundRoomId")) + if (message.boundRoomId != null && Object.hasOwnProperty.call(message, "boundRoomId")) writer.uint32(/* id 10, wireType 0 =*/80).int32(message.boundRoomId); - if (message.battleDurationNanos != null && message.hasOwnProperty("battleDurationNanos")) + if (message.battleDurationNanos != null && Object.hasOwnProperty.call(message, "battleDurationNanos")) writer.uint32(/* id 11, wireType 0 =*/88).int64(message.battleDurationNanos); - if (message.serverFps != null && message.hasOwnProperty("serverFps")) + if (message.serverFps != null && Object.hasOwnProperty.call(message, "serverFps")) writer.uint32(/* id 12, wireType 0 =*/96).int32(message.serverFps); - if (message.inputDelayFrames != null && message.hasOwnProperty("inputDelayFrames")) + if (message.inputDelayFrames != null && Object.hasOwnProperty.call(message, "inputDelayFrames")) writer.uint32(/* id 13, wireType 0 =*/104).int32(message.inputDelayFrames); - if (message.inputScaleFrames != null && message.hasOwnProperty("inputScaleFrames")) + if (message.inputScaleFrames != null && Object.hasOwnProperty.call(message, "inputScaleFrames")) writer.uint32(/* id 14, wireType 0 =*/112).uint32(message.inputScaleFrames); - if (message.nstDelayFrames != null && message.hasOwnProperty("nstDelayFrames")) + if (message.nstDelayFrames != null && Object.hasOwnProperty.call(message, "nstDelayFrames")) writer.uint32(/* id 15, wireType 0 =*/120).int32(message.nstDelayFrames); - if (message.inputFrameUpsyncDelayTolerance != null && message.hasOwnProperty("inputFrameUpsyncDelayTolerance")) + if (message.inputFrameUpsyncDelayTolerance != null && Object.hasOwnProperty.call(message, "inputFrameUpsyncDelayTolerance")) writer.uint32(/* id 16, wireType 0 =*/128).int32(message.inputFrameUpsyncDelayTolerance); - if (message.maxChasingRenderFramesPerUpdate != null && message.hasOwnProperty("maxChasingRenderFramesPerUpdate")) + if (message.maxChasingRenderFramesPerUpdate != null && Object.hasOwnProperty.call(message, "maxChasingRenderFramesPerUpdate")) writer.uint32(/* id 17, wireType 0 =*/136).int32(message.maxChasingRenderFramesPerUpdate); - if (message.playerBattleState != null && message.hasOwnProperty("playerBattleState")) + if (message.playerBattleState != null && Object.hasOwnProperty.call(message, "playerBattleState")) writer.uint32(/* id 18, wireType 0 =*/144).int32(message.playerBattleState); - if (message.rollbackEstimatedDtMillis != null && message.hasOwnProperty("rollbackEstimatedDtMillis")) + if (message.rollbackEstimatedDtMillis != null && Object.hasOwnProperty.call(message, "rollbackEstimatedDtMillis")) writer.uint32(/* id 19, wireType 1 =*/153).double(message.rollbackEstimatedDtMillis); - if (message.rollbackEstimatedDtNanos != null && message.hasOwnProperty("rollbackEstimatedDtNanos")) + if (message.rollbackEstimatedDtNanos != null && Object.hasOwnProperty.call(message, "rollbackEstimatedDtNanos")) writer.uint32(/* id 20, wireType 0 =*/160).int64(message.rollbackEstimatedDtNanos); - if (message.worldToVirtualGridRatio != null && message.hasOwnProperty("worldToVirtualGridRatio")) + if (message.worldToVirtualGridRatio != null && Object.hasOwnProperty.call(message, "worldToVirtualGridRatio")) writer.uint32(/* id 21, wireType 1 =*/169).double(message.worldToVirtualGridRatio); - if (message.virtualGridToWorldRatio != null && message.hasOwnProperty("virtualGridToWorldRatio")) + if (message.virtualGridToWorldRatio != null && Object.hasOwnProperty.call(message, "virtualGridToWorldRatio")) writer.uint32(/* id 22, wireType 1 =*/177).double(message.virtualGridToWorldRatio); return writer; }; @@ -345,86 +345,136 @@ $root.protos = (function() { BattleColliderInfo.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.protos.BattleColliderInfo(), key; + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.protos.BattleColliderInfo(), key, value; while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.stageName = reader.string(); - break; - case 2: - reader.skip().pos++; - if (message.strToVec2DListMap === $util.emptyObject) - message.strToVec2DListMap = {}; - key = reader.string(); - reader.pos++; - message.strToVec2DListMap[key] = $root.protos.Vec2DList.decode(reader, reader.uint32()); - break; - case 3: - reader.skip().pos++; - if (message.strToPolygon2DListMap === $util.emptyObject) - message.strToPolygon2DListMap = {}; - key = reader.string(); - reader.pos++; - message.strToPolygon2DListMap[key] = $root.protos.Polygon2DList.decode(reader, reader.uint32()); - break; - case 4: - message.stageDiscreteW = reader.int32(); - break; - case 5: - message.stageDiscreteH = reader.int32(); - break; - case 6: - message.stageTileW = reader.int32(); - break; - case 7: - message.stageTileH = reader.int32(); - break; - case 8: - message.intervalToPing = reader.int32(); - break; - case 9: - message.willKickIfInactiveFor = reader.int32(); - break; - case 10: - message.boundRoomId = reader.int32(); - break; - case 11: - message.battleDurationNanos = reader.int64(); - break; - case 12: - message.serverFps = reader.int32(); - break; - case 13: - message.inputDelayFrames = reader.int32(); - break; - case 14: - message.inputScaleFrames = reader.uint32(); - break; - case 15: - message.nstDelayFrames = reader.int32(); - break; - case 16: - message.inputFrameUpsyncDelayTolerance = reader.int32(); - break; - case 17: - message.maxChasingRenderFramesPerUpdate = reader.int32(); - break; - case 18: - message.playerBattleState = reader.int32(); - break; - case 19: - message.rollbackEstimatedDtMillis = reader.double(); - break; - case 20: - message.rollbackEstimatedDtNanos = reader.int64(); - break; - case 21: - message.worldToVirtualGridRatio = reader.double(); - break; - case 22: - message.virtualGridToWorldRatio = reader.double(); - break; + case 1: { + message.stageName = reader.string(); + break; + } + case 2: { + if (message.strToVec2DListMap === $util.emptyObject) + message.strToVec2DListMap = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.sharedprotos.Vec2DList.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.strToVec2DListMap[key] = value; + break; + } + case 3: { + if (message.strToPolygon2DListMap === $util.emptyObject) + message.strToPolygon2DListMap = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.sharedprotos.Polygon2DList.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.strToPolygon2DListMap[key] = value; + break; + } + case 4: { + message.stageDiscreteW = reader.int32(); + break; + } + case 5: { + message.stageDiscreteH = reader.int32(); + break; + } + case 6: { + message.stageTileW = reader.int32(); + break; + } + case 7: { + message.stageTileH = reader.int32(); + break; + } + case 8: { + message.intervalToPing = reader.int32(); + break; + } + case 9: { + message.willKickIfInactiveFor = reader.int32(); + break; + } + case 10: { + message.boundRoomId = reader.int32(); + break; + } + case 11: { + message.battleDurationNanos = reader.int64(); + break; + } + case 12: { + message.serverFps = reader.int32(); + break; + } + case 13: { + message.inputDelayFrames = reader.int32(); + break; + } + case 14: { + message.inputScaleFrames = reader.uint32(); + break; + } + case 15: { + message.nstDelayFrames = reader.int32(); + break; + } + case 16: { + message.inputFrameUpsyncDelayTolerance = reader.int32(); + break; + } + case 17: { + message.maxChasingRenderFramesPerUpdate = reader.int32(); + break; + } + case 18: { + message.playerBattleState = reader.int32(); + break; + } + case 19: { + message.rollbackEstimatedDtMillis = reader.double(); + break; + } + case 20: { + message.rollbackEstimatedDtNanos = reader.int64(); + break; + } + case 21: { + message.worldToVirtualGridRatio = reader.double(); + break; + } + case 22: { + message.virtualGridToWorldRatio = reader.double(); + break; + } default: reader.skipType(tag & 7); break; @@ -468,7 +518,7 @@ $root.protos = (function() { return "strToVec2DListMap: object expected"; var key = Object.keys(message.strToVec2DListMap); for (var i = 0; i < key.length; ++i) { - var error = $root.protos.Vec2DList.verify(message.strToVec2DListMap[key[i]]); + var error = $root.sharedprotos.Vec2DList.verify(message.strToVec2DListMap[key[i]]); if (error) return "strToVec2DListMap." + error; } @@ -478,7 +528,7 @@ $root.protos = (function() { return "strToPolygon2DListMap: object expected"; var key = Object.keys(message.strToPolygon2DListMap); for (var i = 0; i < key.length; ++i) { - var error = $root.protos.Polygon2DList.verify(message.strToPolygon2DListMap[key[i]]); + var error = $root.sharedprotos.Polygon2DList.verify(message.strToPolygon2DListMap[key[i]]); if (error) return "strToPolygon2DListMap." + error; } @@ -564,7 +614,7 @@ $root.protos = (function() { for (var keys = Object.keys(object.strToVec2DListMap), i = 0; i < keys.length; ++i) { if (typeof object.strToVec2DListMap[keys[i]] !== "object") throw TypeError(".protos.BattleColliderInfo.strToVec2DListMap: object expected"); - message.strToVec2DListMap[keys[i]] = $root.protos.Vec2DList.fromObject(object.strToVec2DListMap[keys[i]]); + message.strToVec2DListMap[keys[i]] = $root.sharedprotos.Vec2DList.fromObject(object.strToVec2DListMap[keys[i]]); } } if (object.strToPolygon2DListMap) { @@ -574,7 +624,7 @@ $root.protos = (function() { for (var keys = Object.keys(object.strToPolygon2DListMap), i = 0; i < keys.length; ++i) { if (typeof object.strToPolygon2DListMap[keys[i]] !== "object") throw TypeError(".protos.BattleColliderInfo.strToPolygon2DListMap: object expected"); - message.strToPolygon2DListMap[keys[i]] = $root.protos.Polygon2DList.fromObject(object.strToPolygon2DListMap[keys[i]]); + message.strToPolygon2DListMap[keys[i]] = $root.sharedprotos.Polygon2DList.fromObject(object.strToPolygon2DListMap[keys[i]]); } } if (object.stageDiscreteW != null) @@ -685,12 +735,12 @@ $root.protos = (function() { if (message.strToVec2DListMap && (keys2 = Object.keys(message.strToVec2DListMap)).length) { object.strToVec2DListMap = {}; for (var j = 0; j < keys2.length; ++j) - object.strToVec2DListMap[keys2[j]] = $root.protos.Vec2DList.toObject(message.strToVec2DListMap[keys2[j]], options); + object.strToVec2DListMap[keys2[j]] = $root.sharedprotos.Vec2DList.toObject(message.strToVec2DListMap[keys2[j]], options); } if (message.strToPolygon2DListMap && (keys2 = Object.keys(message.strToPolygon2DListMap)).length) { object.strToPolygon2DListMap = {}; for (var j = 0; j < keys2.length; ++j) - object.strToPolygon2DListMap[keys2[j]] = $root.protos.Polygon2DList.toObject(message.strToPolygon2DListMap[keys2[j]], options); + object.strToPolygon2DListMap[keys2[j]] = $root.sharedprotos.Polygon2DList.toObject(message.strToPolygon2DListMap[keys2[j]], options); } if (message.stageDiscreteW != null && message.hasOwnProperty("stageDiscreteW")) object.stageDiscreteW = message.stageDiscreteW; @@ -750,36 +800,51 @@ $root.protos = (function() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for BattleColliderInfo + * @function getTypeUrl + * @memberof protos.BattleColliderInfo + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BattleColliderInfo.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/protos.BattleColliderInfo"; + }; + return BattleColliderInfo; })(); - protos.Player = (function() { + protos.PlayerDownsync = (function() { /** - * Properties of a Player. + * Properties of a PlayerDownsync. * @memberof protos - * @interface IPlayer - * @property {number|null} [id] Player id - * @property {number|null} [virtualGridX] Player virtualGridX - * @property {number|null} [virtualGridY] Player virtualGridY - * @property {protos.Direction|null} [dir] Player dir - * @property {number|null} [speed] Player speed - * @property {number|null} [battleState] Player battleState - * @property {number|null} [lastMoveGmtMillis] Player lastMoveGmtMillis - * @property {number|null} [score] Player score - * @property {boolean|null} [removed] Player removed - * @property {number|null} [joinIndex] Player joinIndex + * @interface IPlayerDownsync + * @property {number|null} [id] PlayerDownsync id + * @property {number|null} [virtualGridX] PlayerDownsync virtualGridX + * @property {number|null} [virtualGridY] PlayerDownsync virtualGridY + * @property {sharedprotos.Direction|null} [dir] PlayerDownsync dir + * @property {number|null} [speed] PlayerDownsync speed + * @property {number|null} [battleState] PlayerDownsync battleState + * @property {number|null} [lastMoveGmtMillis] PlayerDownsync lastMoveGmtMillis + * @property {number|null} [score] PlayerDownsync score + * @property {boolean|null} [removed] PlayerDownsync removed + * @property {number|null} [joinIndex] PlayerDownsync joinIndex */ /** - * Constructs a new Player. + * Constructs a new PlayerDownsync. * @memberof protos - * @classdesc Represents a Player. - * @implements IPlayer + * @classdesc Represents a PlayerDownsync. + * @implements IPlayerDownsync * @constructor - * @param {protos.IPlayer=} [properties] Properties to set + * @param {protos.IPlayerDownsync=} [properties] Properties to set */ - function Player(properties) { + function PlayerDownsync(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -787,193 +852,203 @@ $root.protos = (function() { } /** - * Player id. + * PlayerDownsync id. * @member {number} id - * @memberof protos.Player + * @memberof protos.PlayerDownsync * @instance */ - Player.prototype.id = 0; + PlayerDownsync.prototype.id = 0; /** - * Player virtualGridX. + * PlayerDownsync virtualGridX. * @member {number} virtualGridX - * @memberof protos.Player + * @memberof protos.PlayerDownsync * @instance */ - Player.prototype.virtualGridX = 0; + PlayerDownsync.prototype.virtualGridX = 0; /** - * Player virtualGridY. + * PlayerDownsync virtualGridY. * @member {number} virtualGridY - * @memberof protos.Player + * @memberof protos.PlayerDownsync * @instance */ - Player.prototype.virtualGridY = 0; + PlayerDownsync.prototype.virtualGridY = 0; /** - * Player dir. - * @member {protos.Direction|null|undefined} dir - * @memberof protos.Player + * PlayerDownsync dir. + * @member {sharedprotos.Direction|null|undefined} dir + * @memberof protos.PlayerDownsync * @instance */ - Player.prototype.dir = null; + PlayerDownsync.prototype.dir = null; /** - * Player speed. + * PlayerDownsync speed. * @member {number} speed - * @memberof protos.Player + * @memberof protos.PlayerDownsync * @instance */ - Player.prototype.speed = 0; + PlayerDownsync.prototype.speed = 0; /** - * Player battleState. + * PlayerDownsync battleState. * @member {number} battleState - * @memberof protos.Player + * @memberof protos.PlayerDownsync * @instance */ - Player.prototype.battleState = 0; + PlayerDownsync.prototype.battleState = 0; /** - * Player lastMoveGmtMillis. + * PlayerDownsync lastMoveGmtMillis. * @member {number} lastMoveGmtMillis - * @memberof protos.Player + * @memberof protos.PlayerDownsync * @instance */ - Player.prototype.lastMoveGmtMillis = 0; + PlayerDownsync.prototype.lastMoveGmtMillis = 0; /** - * Player score. + * PlayerDownsync score. * @member {number} score - * @memberof protos.Player + * @memberof protos.PlayerDownsync * @instance */ - Player.prototype.score = 0; + PlayerDownsync.prototype.score = 0; /** - * Player removed. + * PlayerDownsync removed. * @member {boolean} removed - * @memberof protos.Player + * @memberof protos.PlayerDownsync * @instance */ - Player.prototype.removed = false; + PlayerDownsync.prototype.removed = false; /** - * Player joinIndex. + * PlayerDownsync joinIndex. * @member {number} joinIndex - * @memberof protos.Player + * @memberof protos.PlayerDownsync * @instance */ - Player.prototype.joinIndex = 0; + PlayerDownsync.prototype.joinIndex = 0; /** - * Creates a new Player instance using the specified properties. + * Creates a new PlayerDownsync instance using the specified properties. * @function create - * @memberof protos.Player + * @memberof protos.PlayerDownsync * @static - * @param {protos.IPlayer=} [properties] Properties to set - * @returns {protos.Player} Player instance + * @param {protos.IPlayerDownsync=} [properties] Properties to set + * @returns {protos.PlayerDownsync} PlayerDownsync instance */ - Player.create = function create(properties) { - return new Player(properties); + PlayerDownsync.create = function create(properties) { + return new PlayerDownsync(properties); }; /** - * Encodes the specified Player message. Does not implicitly {@link protos.Player.verify|verify} messages. + * Encodes the specified PlayerDownsync message. Does not implicitly {@link protos.PlayerDownsync.verify|verify} messages. * @function encode - * @memberof protos.Player + * @memberof protos.PlayerDownsync * @static - * @param {protos.Player} message Player message or plain object to encode + * @param {protos.PlayerDownsync} message PlayerDownsync message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Player.encode = function encode(message, writer) { + PlayerDownsync.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.id != null && message.hasOwnProperty("id")) + if (message.id != null && Object.hasOwnProperty.call(message, "id")) writer.uint32(/* id 1, wireType 0 =*/8).int32(message.id); - if (message.virtualGridX != null && message.hasOwnProperty("virtualGridX")) + if (message.virtualGridX != null && Object.hasOwnProperty.call(message, "virtualGridX")) writer.uint32(/* id 2, wireType 0 =*/16).int32(message.virtualGridX); - if (message.virtualGridY != null && message.hasOwnProperty("virtualGridY")) + if (message.virtualGridY != null && Object.hasOwnProperty.call(message, "virtualGridY")) writer.uint32(/* id 3, wireType 0 =*/24).int32(message.virtualGridY); - if (message.dir != null && message.hasOwnProperty("dir")) - $root.protos.Direction.encode(message.dir, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.speed != null && message.hasOwnProperty("speed")) + if (message.dir != null && Object.hasOwnProperty.call(message, "dir")) + $root.sharedprotos.Direction.encode(message.dir, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.speed != null && Object.hasOwnProperty.call(message, "speed")) writer.uint32(/* id 5, wireType 0 =*/40).int32(message.speed); - if (message.battleState != null && message.hasOwnProperty("battleState")) + if (message.battleState != null && Object.hasOwnProperty.call(message, "battleState")) writer.uint32(/* id 6, wireType 0 =*/48).int32(message.battleState); - if (message.lastMoveGmtMillis != null && message.hasOwnProperty("lastMoveGmtMillis")) + if (message.lastMoveGmtMillis != null && Object.hasOwnProperty.call(message, "lastMoveGmtMillis")) writer.uint32(/* id 7, wireType 0 =*/56).int32(message.lastMoveGmtMillis); - if (message.score != null && message.hasOwnProperty("score")) + if (message.score != null && Object.hasOwnProperty.call(message, "score")) writer.uint32(/* id 10, wireType 0 =*/80).int32(message.score); - if (message.removed != null && message.hasOwnProperty("removed")) + if (message.removed != null && Object.hasOwnProperty.call(message, "removed")) writer.uint32(/* id 11, wireType 0 =*/88).bool(message.removed); - if (message.joinIndex != null && message.hasOwnProperty("joinIndex")) + if (message.joinIndex != null && Object.hasOwnProperty.call(message, "joinIndex")) writer.uint32(/* id 12, wireType 0 =*/96).int32(message.joinIndex); return writer; }; /** - * Encodes the specified Player message, length delimited. Does not implicitly {@link protos.Player.verify|verify} messages. + * Encodes the specified PlayerDownsync message, length delimited. Does not implicitly {@link protos.PlayerDownsync.verify|verify} messages. * @function encodeDelimited - * @memberof protos.Player + * @memberof protos.PlayerDownsync * @static - * @param {protos.Player} message Player message or plain object to encode + * @param {protos.PlayerDownsync} message PlayerDownsync message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Player.encodeDelimited = function encodeDelimited(message, writer) { + PlayerDownsync.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a Player message from the specified reader or buffer. + * Decodes a PlayerDownsync message from the specified reader or buffer. * @function decode - * @memberof protos.Player + * @memberof protos.PlayerDownsync * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {protos.Player} Player + * @returns {protos.PlayerDownsync} PlayerDownsync * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Player.decode = function decode(reader, length) { + PlayerDownsync.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.protos.Player(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.protos.PlayerDownsync(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.id = reader.int32(); - break; - case 2: - message.virtualGridX = reader.int32(); - break; - case 3: - message.virtualGridY = reader.int32(); - break; - case 4: - message.dir = $root.protos.Direction.decode(reader, reader.uint32()); - break; - case 5: - message.speed = reader.int32(); - break; - case 6: - message.battleState = reader.int32(); - break; - case 7: - message.lastMoveGmtMillis = reader.int32(); - break; - case 10: - message.score = reader.int32(); - break; - case 11: - message.removed = reader.bool(); - break; - case 12: - message.joinIndex = reader.int32(); - break; + case 1: { + message.id = reader.int32(); + break; + } + case 2: { + message.virtualGridX = reader.int32(); + break; + } + case 3: { + message.virtualGridY = reader.int32(); + break; + } + case 4: { + message.dir = $root.sharedprotos.Direction.decode(reader, reader.uint32()); + break; + } + case 5: { + message.speed = reader.int32(); + break; + } + case 6: { + message.battleState = reader.int32(); + break; + } + case 7: { + message.lastMoveGmtMillis = reader.int32(); + break; + } + case 10: { + message.score = reader.int32(); + break; + } + case 11: { + message.removed = reader.bool(); + break; + } + case 12: { + message.joinIndex = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -983,30 +1058,30 @@ $root.protos = (function() { }; /** - * Decodes a Player message from the specified reader or buffer, length delimited. + * Decodes a PlayerDownsync message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof protos.Player + * @memberof protos.PlayerDownsync * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {protos.Player} Player + * @returns {protos.PlayerDownsync} PlayerDownsync * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Player.decodeDelimited = function decodeDelimited(reader) { + PlayerDownsync.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a Player message. + * Verifies a PlayerDownsync message. * @function verify - * @memberof protos.Player + * @memberof protos.PlayerDownsync * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Player.verify = function verify(message) { + PlayerDownsync.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; if (message.id != null && message.hasOwnProperty("id")) @@ -1019,7 +1094,7 @@ $root.protos = (function() { if (!$util.isInteger(message.virtualGridY)) return "virtualGridY: integer expected"; if (message.dir != null && message.hasOwnProperty("dir")) { - var error = $root.protos.Direction.verify(message.dir); + var error = $root.sharedprotos.Direction.verify(message.dir); if (error) return "dir." + error; } @@ -1045,17 +1120,17 @@ $root.protos = (function() { }; /** - * Creates a Player message from a plain object. Also converts values to their respective internal types. + * Creates a PlayerDownsync message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof protos.Player + * @memberof protos.PlayerDownsync * @static * @param {Object.} object Plain object - * @returns {protos.Player} Player + * @returns {protos.PlayerDownsync} PlayerDownsync */ - Player.fromObject = function fromObject(object) { - if (object instanceof $root.protos.Player) + PlayerDownsync.fromObject = function fromObject(object) { + if (object instanceof $root.protos.PlayerDownsync) return object; - var message = new $root.protos.Player(); + var message = new $root.protos.PlayerDownsync(); if (object.id != null) message.id = object.id | 0; if (object.virtualGridX != null) @@ -1064,8 +1139,8 @@ $root.protos = (function() { message.virtualGridY = object.virtualGridY | 0; if (object.dir != null) { if (typeof object.dir !== "object") - throw TypeError(".protos.Player.dir: object expected"); - message.dir = $root.protos.Direction.fromObject(object.dir); + throw TypeError(".protos.PlayerDownsync.dir: object expected"); + message.dir = $root.sharedprotos.Direction.fromObject(object.dir); } if (object.speed != null) message.speed = object.speed | 0; @@ -1083,15 +1158,15 @@ $root.protos = (function() { }; /** - * Creates a plain object from a Player message. Also converts values to other types if specified. + * Creates a plain object from a PlayerDownsync message. Also converts values to other types if specified. * @function toObject - * @memberof protos.Player + * @memberof protos.PlayerDownsync * @static - * @param {protos.Player} message Player + * @param {protos.PlayerDownsync} message PlayerDownsync * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Player.toObject = function toObject(message, options) { + PlayerDownsync.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; @@ -1114,7 +1189,7 @@ $root.protos = (function() { if (message.virtualGridY != null && message.hasOwnProperty("virtualGridY")) object.virtualGridY = message.virtualGridY; if (message.dir != null && message.hasOwnProperty("dir")) - object.dir = $root.protos.Direction.toObject(message.dir, options); + object.dir = $root.sharedprotos.Direction.toObject(message.dir, options); if (message.speed != null && message.hasOwnProperty("speed")) object.speed = message.speed; if (message.battleState != null && message.hasOwnProperty("battleState")) @@ -1131,41 +1206,56 @@ $root.protos = (function() { }; /** - * Converts this Player to JSON. + * Converts this PlayerDownsync to JSON. * @function toJSON - * @memberof protos.Player + * @memberof protos.PlayerDownsync * @instance * @returns {Object.} JSON object */ - Player.prototype.toJSON = function toJSON() { + PlayerDownsync.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return Player; + /** + * Gets the default type url for PlayerDownsync + * @function getTypeUrl + * @memberof protos.PlayerDownsync + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PlayerDownsync.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/protos.PlayerDownsync"; + }; + + return PlayerDownsync; })(); - protos.PlayerMeta = (function() { + protos.PlayerDownsyncMeta = (function() { /** - * Properties of a PlayerMeta. + * Properties of a PlayerDownsyncMeta. * @memberof protos - * @interface IPlayerMeta - * @property {number|null} [id] PlayerMeta id - * @property {string|null} [name] PlayerMeta name - * @property {string|null} [displayName] PlayerMeta displayName - * @property {string|null} [avatar] PlayerMeta avatar - * @property {number|null} [joinIndex] PlayerMeta joinIndex + * @interface IPlayerDownsyncMeta + * @property {number|null} [id] PlayerDownsyncMeta id + * @property {string|null} [name] PlayerDownsyncMeta name + * @property {string|null} [displayName] PlayerDownsyncMeta displayName + * @property {string|null} [avatar] PlayerDownsyncMeta avatar + * @property {number|null} [joinIndex] PlayerDownsyncMeta joinIndex */ /** - * Constructs a new PlayerMeta. + * Constructs a new PlayerDownsyncMeta. * @memberof protos - * @classdesc Represents a PlayerMeta. - * @implements IPlayerMeta + * @classdesc Represents a PlayerDownsyncMeta. + * @implements IPlayerDownsyncMeta * @constructor - * @param {protos.IPlayerMeta=} [properties] Properties to set + * @param {protos.IPlayerDownsyncMeta=} [properties] Properties to set */ - function PlayerMeta(properties) { + function PlayerDownsyncMeta(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -1173,128 +1263,133 @@ $root.protos = (function() { } /** - * PlayerMeta id. + * PlayerDownsyncMeta id. * @member {number} id - * @memberof protos.PlayerMeta + * @memberof protos.PlayerDownsyncMeta * @instance */ - PlayerMeta.prototype.id = 0; + PlayerDownsyncMeta.prototype.id = 0; /** - * PlayerMeta name. + * PlayerDownsyncMeta name. * @member {string} name - * @memberof protos.PlayerMeta + * @memberof protos.PlayerDownsyncMeta * @instance */ - PlayerMeta.prototype.name = ""; + PlayerDownsyncMeta.prototype.name = ""; /** - * PlayerMeta displayName. + * PlayerDownsyncMeta displayName. * @member {string} displayName - * @memberof protos.PlayerMeta + * @memberof protos.PlayerDownsyncMeta * @instance */ - PlayerMeta.prototype.displayName = ""; + PlayerDownsyncMeta.prototype.displayName = ""; /** - * PlayerMeta avatar. + * PlayerDownsyncMeta avatar. * @member {string} avatar - * @memberof protos.PlayerMeta + * @memberof protos.PlayerDownsyncMeta * @instance */ - PlayerMeta.prototype.avatar = ""; + PlayerDownsyncMeta.prototype.avatar = ""; /** - * PlayerMeta joinIndex. + * PlayerDownsyncMeta joinIndex. * @member {number} joinIndex - * @memberof protos.PlayerMeta + * @memberof protos.PlayerDownsyncMeta * @instance */ - PlayerMeta.prototype.joinIndex = 0; + PlayerDownsyncMeta.prototype.joinIndex = 0; /** - * Creates a new PlayerMeta instance using the specified properties. + * Creates a new PlayerDownsyncMeta instance using the specified properties. * @function create - * @memberof protos.PlayerMeta + * @memberof protos.PlayerDownsyncMeta * @static - * @param {protos.IPlayerMeta=} [properties] Properties to set - * @returns {protos.PlayerMeta} PlayerMeta instance + * @param {protos.IPlayerDownsyncMeta=} [properties] Properties to set + * @returns {protos.PlayerDownsyncMeta} PlayerDownsyncMeta instance */ - PlayerMeta.create = function create(properties) { - return new PlayerMeta(properties); + PlayerDownsyncMeta.create = function create(properties) { + return new PlayerDownsyncMeta(properties); }; /** - * Encodes the specified PlayerMeta message. Does not implicitly {@link protos.PlayerMeta.verify|verify} messages. + * Encodes the specified PlayerDownsyncMeta message. Does not implicitly {@link protos.PlayerDownsyncMeta.verify|verify} messages. * @function encode - * @memberof protos.PlayerMeta + * @memberof protos.PlayerDownsyncMeta * @static - * @param {protos.PlayerMeta} message PlayerMeta message or plain object to encode + * @param {protos.PlayerDownsyncMeta} message PlayerDownsyncMeta message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PlayerMeta.encode = function encode(message, writer) { + PlayerDownsyncMeta.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.id != null && message.hasOwnProperty("id")) + if (message.id != null && Object.hasOwnProperty.call(message, "id")) writer.uint32(/* id 1, wireType 0 =*/8).int32(message.id); - if (message.name != null && message.hasOwnProperty("name")) + if (message.name != null && Object.hasOwnProperty.call(message, "name")) writer.uint32(/* id 2, wireType 2 =*/18).string(message.name); - if (message.displayName != null && message.hasOwnProperty("displayName")) + if (message.displayName != null && Object.hasOwnProperty.call(message, "displayName")) writer.uint32(/* id 3, wireType 2 =*/26).string(message.displayName); - if (message.avatar != null && message.hasOwnProperty("avatar")) + if (message.avatar != null && Object.hasOwnProperty.call(message, "avatar")) writer.uint32(/* id 4, wireType 2 =*/34).string(message.avatar); - if (message.joinIndex != null && message.hasOwnProperty("joinIndex")) + if (message.joinIndex != null && Object.hasOwnProperty.call(message, "joinIndex")) writer.uint32(/* id 5, wireType 0 =*/40).int32(message.joinIndex); return writer; }; /** - * Encodes the specified PlayerMeta message, length delimited. Does not implicitly {@link protos.PlayerMeta.verify|verify} messages. + * Encodes the specified PlayerDownsyncMeta message, length delimited. Does not implicitly {@link protos.PlayerDownsyncMeta.verify|verify} messages. * @function encodeDelimited - * @memberof protos.PlayerMeta + * @memberof protos.PlayerDownsyncMeta * @static - * @param {protos.PlayerMeta} message PlayerMeta message or plain object to encode + * @param {protos.PlayerDownsyncMeta} message PlayerDownsyncMeta message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - PlayerMeta.encodeDelimited = function encodeDelimited(message, writer) { + PlayerDownsyncMeta.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a PlayerMeta message from the specified reader or buffer. + * Decodes a PlayerDownsyncMeta message from the specified reader or buffer. * @function decode - * @memberof protos.PlayerMeta + * @memberof protos.PlayerDownsyncMeta * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {protos.PlayerMeta} PlayerMeta + * @returns {protos.PlayerDownsyncMeta} PlayerDownsyncMeta * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PlayerMeta.decode = function decode(reader, length) { + PlayerDownsyncMeta.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.protos.PlayerMeta(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.protos.PlayerDownsyncMeta(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.id = reader.int32(); - break; - case 2: - message.name = reader.string(); - break; - case 3: - message.displayName = reader.string(); - break; - case 4: - message.avatar = reader.string(); - break; - case 5: - message.joinIndex = reader.int32(); - break; + case 1: { + message.id = reader.int32(); + break; + } + case 2: { + message.name = reader.string(); + break; + } + case 3: { + message.displayName = reader.string(); + break; + } + case 4: { + message.avatar = reader.string(); + break; + } + case 5: { + message.joinIndex = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -1304,30 +1399,30 @@ $root.protos = (function() { }; /** - * Decodes a PlayerMeta message from the specified reader or buffer, length delimited. + * Decodes a PlayerDownsyncMeta message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof protos.PlayerMeta + * @memberof protos.PlayerDownsyncMeta * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {protos.PlayerMeta} PlayerMeta + * @returns {protos.PlayerDownsyncMeta} PlayerDownsyncMeta * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - PlayerMeta.decodeDelimited = function decodeDelimited(reader) { + PlayerDownsyncMeta.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a PlayerMeta message. + * Verifies a PlayerDownsyncMeta message. * @function verify - * @memberof protos.PlayerMeta + * @memberof protos.PlayerDownsyncMeta * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - PlayerMeta.verify = function verify(message) { + PlayerDownsyncMeta.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; if (message.id != null && message.hasOwnProperty("id")) @@ -1349,17 +1444,17 @@ $root.protos = (function() { }; /** - * Creates a PlayerMeta message from a plain object. Also converts values to their respective internal types. + * Creates a PlayerDownsyncMeta message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof protos.PlayerMeta + * @memberof protos.PlayerDownsyncMeta * @static * @param {Object.} object Plain object - * @returns {protos.PlayerMeta} PlayerMeta + * @returns {protos.PlayerDownsyncMeta} PlayerDownsyncMeta */ - PlayerMeta.fromObject = function fromObject(object) { - if (object instanceof $root.protos.PlayerMeta) + PlayerDownsyncMeta.fromObject = function fromObject(object) { + if (object instanceof $root.protos.PlayerDownsyncMeta) return object; - var message = new $root.protos.PlayerMeta(); + var message = new $root.protos.PlayerDownsyncMeta(); if (object.id != null) message.id = object.id | 0; if (object.name != null) @@ -1374,15 +1469,15 @@ $root.protos = (function() { }; /** - * Creates a plain object from a PlayerMeta message. Also converts values to other types if specified. + * Creates a plain object from a PlayerDownsyncMeta message. Also converts values to other types if specified. * @function toObject - * @memberof protos.PlayerMeta + * @memberof protos.PlayerDownsyncMeta * @static - * @param {protos.PlayerMeta} message PlayerMeta + * @param {protos.PlayerDownsyncMeta} message PlayerDownsyncMeta * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - PlayerMeta.toObject = function toObject(message, options) { + PlayerDownsyncMeta.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; @@ -1407,17 +1502,32 @@ $root.protos = (function() { }; /** - * Converts this PlayerMeta to JSON. + * Converts this PlayerDownsyncMeta to JSON. * @function toJSON - * @memberof protos.PlayerMeta + * @memberof protos.PlayerDownsyncMeta * @instance * @returns {Object.} JSON object */ - PlayerMeta.prototype.toJSON = function toJSON() { + PlayerDownsyncMeta.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; - return PlayerMeta; + /** + * Gets the default type url for PlayerDownsyncMeta + * @function getTypeUrl + * @memberof protos.PlayerDownsyncMeta + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PlayerDownsyncMeta.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/protos.PlayerDownsyncMeta"; + }; + + return PlayerDownsyncMeta; })(); protos.InputFrameUpsync = (function() { @@ -1485,9 +1595,9 @@ $root.protos = (function() { InputFrameUpsync.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.inputFrameId != null && message.hasOwnProperty("inputFrameId")) + if (message.inputFrameId != null && Object.hasOwnProperty.call(message, "inputFrameId")) writer.uint32(/* id 1, wireType 0 =*/8).int32(message.inputFrameId); - if (message.encodedDir != null && message.hasOwnProperty("encodedDir")) + if (message.encodedDir != null && Object.hasOwnProperty.call(message, "encodedDir")) writer.uint32(/* id 6, wireType 0 =*/48).int32(message.encodedDir); return writer; }; @@ -1523,12 +1633,14 @@ $root.protos = (function() { while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.inputFrameId = reader.int32(); - break; - case 6: - message.encodedDir = reader.int32(); - break; + case 1: { + message.inputFrameId = reader.int32(); + break; + } + case 6: { + message.encodedDir = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -1627,6 +1739,21 @@ $root.protos = (function() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for InputFrameUpsync + * @function getTypeUrl + * @memberof protos.InputFrameUpsync + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + InputFrameUpsync.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/protos.InputFrameUpsync"; + }; + return InputFrameUpsync; })(); @@ -1705,7 +1832,7 @@ $root.protos = (function() { InputFrameDownsync.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.inputFrameId != null && message.hasOwnProperty("inputFrameId")) + if (message.inputFrameId != null && Object.hasOwnProperty.call(message, "inputFrameId")) writer.uint32(/* id 1, wireType 0 =*/8).int32(message.inputFrameId); if (message.inputList != null && message.inputList.length) { writer.uint32(/* id 2, wireType 2 =*/18).fork(); @@ -1713,7 +1840,7 @@ $root.protos = (function() { writer.uint64(message.inputList[i]); writer.ldelim(); } - if (message.confirmedList != null && message.hasOwnProperty("confirmedList")) + if (message.confirmedList != null && Object.hasOwnProperty.call(message, "confirmedList")) writer.uint32(/* id 3, wireType 0 =*/24).uint64(message.confirmedList); return writer; }; @@ -1749,22 +1876,25 @@ $root.protos = (function() { while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.inputFrameId = reader.int32(); - break; - case 2: - if (!(message.inputList && message.inputList.length)) - message.inputList = []; - if ((tag & 7) === 2) { - var end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) + case 1: { + message.inputFrameId = reader.int32(); + break; + } + case 2: { + if (!(message.inputList && message.inputList.length)) + message.inputList = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.inputList.push(reader.uint64()); + } else message.inputList.push(reader.uint64()); - } else - message.inputList.push(reader.uint64()); - break; - case 3: - message.confirmedList = reader.uint64(); - break; + break; + } + case 3: { + message.confirmedList = reader.uint64(); + break; + } default: reader.skipType(tag & 7); break; @@ -1908,6 +2038,21 @@ $root.protos = (function() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for InputFrameDownsync + * @function getTypeUrl + * @memberof protos.InputFrameDownsync + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + InputFrameDownsync.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/protos.InputFrameDownsync"; + }; + return InputFrameDownsync; })(); @@ -1967,7 +2112,7 @@ $root.protos = (function() { HeartbeatUpsync.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.clientTimestamp != null && message.hasOwnProperty("clientTimestamp")) + if (message.clientTimestamp != null && Object.hasOwnProperty.call(message, "clientTimestamp")) writer.uint32(/* id 1, wireType 0 =*/8).int64(message.clientTimestamp); return writer; }; @@ -2003,9 +2148,10 @@ $root.protos = (function() { while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.clientTimestamp = reader.int64(); - break; + case 1: { + message.clientTimestamp = reader.int64(); + break; + } default: reader.skipType(tag & 7); break; @@ -2109,6 +2255,21 @@ $root.protos = (function() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for HeartbeatUpsync + * @function getTypeUrl + * @memberof protos.HeartbeatUpsync + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + HeartbeatUpsync.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/protos.HeartbeatUpsync"; + }; + return HeartbeatUpsync; })(); @@ -2119,9 +2280,9 @@ $root.protos = (function() { * @memberof protos * @interface IRoomDownsyncFrame * @property {number|null} [id] RoomDownsyncFrame id - * @property {Object.|null} [players] RoomDownsyncFrame players + * @property {Object.|null} [players] RoomDownsyncFrame players * @property {number|Long|null} [countdownNanos] RoomDownsyncFrame countdownNanos - * @property {Object.|null} [playerMetas] RoomDownsyncFrame playerMetas + * @property {Object.|null} [playerMetas] RoomDownsyncFrame playerMetas */ /** @@ -2151,7 +2312,7 @@ $root.protos = (function() { /** * RoomDownsyncFrame players. - * @member {Object.} players + * @member {Object.} players * @memberof protos.RoomDownsyncFrame * @instance */ @@ -2167,7 +2328,7 @@ $root.protos = (function() { /** * RoomDownsyncFrame playerMetas. - * @member {Object.} playerMetas + * @member {Object.} playerMetas * @memberof protos.RoomDownsyncFrame * @instance */ @@ -2197,19 +2358,19 @@ $root.protos = (function() { RoomDownsyncFrame.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.id != null && message.hasOwnProperty("id")) + if (message.id != null && Object.hasOwnProperty.call(message, "id")) writer.uint32(/* id 1, wireType 0 =*/8).int32(message.id); - if (message.players != null && message.hasOwnProperty("players")) + if (message.players != null && Object.hasOwnProperty.call(message, "players")) for (var keys = Object.keys(message.players), i = 0; i < keys.length; ++i) { writer.uint32(/* id 2, wireType 2 =*/18).fork().uint32(/* id 1, wireType 0 =*/8).int32(keys[i]); - $root.protos.Player.encode(message.players[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); + $root.protos.PlayerDownsync.encode(message.players[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); } - if (message.countdownNanos != null && message.hasOwnProperty("countdownNanos")) + if (message.countdownNanos != null && Object.hasOwnProperty.call(message, "countdownNanos")) writer.uint32(/* id 3, wireType 0 =*/24).int64(message.countdownNanos); - if (message.playerMetas != null && message.hasOwnProperty("playerMetas")) + if (message.playerMetas != null && Object.hasOwnProperty.call(message, "playerMetas")) for (var keys = Object.keys(message.playerMetas), i = 0; i < keys.length; ++i) { writer.uint32(/* id 4, wireType 2 =*/34).fork().uint32(/* id 1, wireType 0 =*/8).int32(keys[i]); - $root.protos.PlayerMeta.encode(message.playerMetas[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); + $root.protos.PlayerDownsyncMeta.encode(message.playerMetas[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); } return writer; }; @@ -2241,32 +2402,64 @@ $root.protos = (function() { RoomDownsyncFrame.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.protos.RoomDownsyncFrame(), key; + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.protos.RoomDownsyncFrame(), key, value; while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.id = reader.int32(); - break; - case 2: - reader.skip().pos++; - if (message.players === $util.emptyObject) - message.players = {}; - key = reader.int32(); - reader.pos++; - message.players[key] = $root.protos.Player.decode(reader, reader.uint32()); - break; - case 3: - message.countdownNanos = reader.int64(); - break; - case 4: - reader.skip().pos++; - if (message.playerMetas === $util.emptyObject) - message.playerMetas = {}; - key = reader.int32(); - reader.pos++; - message.playerMetas[key] = $root.protos.PlayerMeta.decode(reader, reader.uint32()); - break; + case 1: { + message.id = reader.int32(); + break; + } + case 2: { + if (message.players === $util.emptyObject) + message.players = {}; + var end2 = reader.uint32() + reader.pos; + key = 0; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.int32(); + break; + case 2: + value = $root.protos.PlayerDownsync.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.players[key] = value; + break; + } + case 3: { + message.countdownNanos = reader.int64(); + break; + } + case 4: { + if (message.playerMetas === $util.emptyObject) + message.playerMetas = {}; + var end2 = reader.uint32() + reader.pos; + key = 0; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.int32(); + break; + case 2: + value = $root.protos.PlayerDownsyncMeta.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.playerMetas[key] = value; + break; + } default: reader.skipType(tag & 7); break; @@ -2313,7 +2506,7 @@ $root.protos = (function() { if (!$util.key32Re.test(key[i])) return "players: integer key{k:int32} expected"; { - var error = $root.protos.Player.verify(message.players[key[i]]); + var error = $root.protos.PlayerDownsync.verify(message.players[key[i]]); if (error) return "players." + error; } @@ -2330,7 +2523,7 @@ $root.protos = (function() { if (!$util.key32Re.test(key[i])) return "playerMetas: integer key{k:int32} expected"; { - var error = $root.protos.PlayerMeta.verify(message.playerMetas[key[i]]); + var error = $root.protos.PlayerDownsyncMeta.verify(message.playerMetas[key[i]]); if (error) return "playerMetas." + error; } @@ -2360,7 +2553,7 @@ $root.protos = (function() { for (var keys = Object.keys(object.players), i = 0; i < keys.length; ++i) { if (typeof object.players[keys[i]] !== "object") throw TypeError(".protos.RoomDownsyncFrame.players: object expected"); - message.players[keys[i]] = $root.protos.Player.fromObject(object.players[keys[i]]); + message.players[keys[i]] = $root.protos.PlayerDownsync.fromObject(object.players[keys[i]]); } } if (object.countdownNanos != null) @@ -2379,7 +2572,7 @@ $root.protos = (function() { for (var keys = Object.keys(object.playerMetas), i = 0; i < keys.length; ++i) { if (typeof object.playerMetas[keys[i]] !== "object") throw TypeError(".protos.RoomDownsyncFrame.playerMetas: object expected"); - message.playerMetas[keys[i]] = $root.protos.PlayerMeta.fromObject(object.playerMetas[keys[i]]); + message.playerMetas[keys[i]] = $root.protos.PlayerDownsyncMeta.fromObject(object.playerMetas[keys[i]]); } } return message; @@ -2416,7 +2609,7 @@ $root.protos = (function() { if (message.players && (keys2 = Object.keys(message.players)).length) { object.players = {}; for (var j = 0; j < keys2.length; ++j) - object.players[keys2[j]] = $root.protos.Player.toObject(message.players[keys2[j]], options); + object.players[keys2[j]] = $root.protos.PlayerDownsync.toObject(message.players[keys2[j]], options); } if (message.countdownNanos != null && message.hasOwnProperty("countdownNanos")) if (typeof message.countdownNanos === "number") @@ -2426,7 +2619,7 @@ $root.protos = (function() { if (message.playerMetas && (keys2 = Object.keys(message.playerMetas)).length) { object.playerMetas = {}; for (var j = 0; j < keys2.length; ++j) - object.playerMetas[keys2[j]] = $root.protos.PlayerMeta.toObject(message.playerMetas[keys2[j]], options); + object.playerMetas[keys2[j]] = $root.protos.PlayerDownsyncMeta.toObject(message.playerMetas[keys2[j]], options); } return object; }; @@ -2442,6 +2635,21 @@ $root.protos = (function() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for RoomDownsyncFrame + * @function getTypeUrl + * @memberof protos.RoomDownsyncFrame + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + RoomDownsyncFrame.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/protos.RoomDownsyncFrame"; + }; + return RoomDownsyncFrame; })(); @@ -2565,22 +2773,22 @@ $root.protos = (function() { WsReq.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.msgId != null && message.hasOwnProperty("msgId")) + if (message.msgId != null && Object.hasOwnProperty.call(message, "msgId")) writer.uint32(/* id 1, wireType 0 =*/8).int32(message.msgId); - if (message.playerId != null && message.hasOwnProperty("playerId")) + if (message.playerId != null && Object.hasOwnProperty.call(message, "playerId")) writer.uint32(/* id 2, wireType 0 =*/16).int32(message.playerId); - if (message.act != null && message.hasOwnProperty("act")) + if (message.act != null && Object.hasOwnProperty.call(message, "act")) writer.uint32(/* id 3, wireType 0 =*/24).int32(message.act); - if (message.joinIndex != null && message.hasOwnProperty("joinIndex")) + if (message.joinIndex != null && Object.hasOwnProperty.call(message, "joinIndex")) writer.uint32(/* id 4, wireType 0 =*/32).int32(message.joinIndex); - if (message.ackingFrameId != null && message.hasOwnProperty("ackingFrameId")) + if (message.ackingFrameId != null && Object.hasOwnProperty.call(message, "ackingFrameId")) writer.uint32(/* id 5, wireType 0 =*/40).int32(message.ackingFrameId); - if (message.ackingInputFrameId != null && message.hasOwnProperty("ackingInputFrameId")) + if (message.ackingInputFrameId != null && Object.hasOwnProperty.call(message, "ackingInputFrameId")) writer.uint32(/* id 6, wireType 0 =*/48).int32(message.ackingInputFrameId); if (message.inputFrameUpsyncBatch != null && message.inputFrameUpsyncBatch.length) for (var i = 0; i < message.inputFrameUpsyncBatch.length; ++i) $root.protos.InputFrameUpsync.encode(message.inputFrameUpsyncBatch[i], writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); - if (message.hb != null && message.hasOwnProperty("hb")) + if (message.hb != null && Object.hasOwnProperty.call(message, "hb")) $root.protos.HeartbeatUpsync.encode(message.hb, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); return writer; }; @@ -2616,32 +2824,40 @@ $root.protos = (function() { while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.msgId = reader.int32(); - break; - case 2: - message.playerId = reader.int32(); - break; - case 3: - message.act = reader.int32(); - break; - case 4: - message.joinIndex = reader.int32(); - break; - case 5: - message.ackingFrameId = reader.int32(); - break; - case 6: - message.ackingInputFrameId = reader.int32(); - break; - case 7: - if (!(message.inputFrameUpsyncBatch && message.inputFrameUpsyncBatch.length)) - message.inputFrameUpsyncBatch = []; - message.inputFrameUpsyncBatch.push($root.protos.InputFrameUpsync.decode(reader, reader.uint32())); - break; - case 8: - message.hb = $root.protos.HeartbeatUpsync.decode(reader, reader.uint32()); - break; + case 1: { + message.msgId = reader.int32(); + break; + } + case 2: { + message.playerId = reader.int32(); + break; + } + case 3: { + message.act = reader.int32(); + break; + } + case 4: { + message.joinIndex = reader.int32(); + break; + } + case 5: { + message.ackingFrameId = reader.int32(); + break; + } + case 6: { + message.ackingInputFrameId = reader.int32(); + break; + } + case 7: { + if (!(message.inputFrameUpsyncBatch && message.inputFrameUpsyncBatch.length)) + message.inputFrameUpsyncBatch = []; + message.inputFrameUpsyncBatch.push($root.protos.InputFrameUpsync.decode(reader, reader.uint32())); + break; + } + case 8: { + message.hb = $root.protos.HeartbeatUpsync.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -2811,6 +3027,21 @@ $root.protos = (function() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for WsReq + * @function getTypeUrl + * @memberof protos.WsReq + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + WsReq.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/protos.WsReq"; + }; + return WsReq; })(); @@ -2916,18 +3147,18 @@ $root.protos = (function() { WsResp.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.ret != null && message.hasOwnProperty("ret")) + if (message.ret != null && Object.hasOwnProperty.call(message, "ret")) writer.uint32(/* id 1, wireType 0 =*/8).int32(message.ret); - if (message.echoedMsgId != null && message.hasOwnProperty("echoedMsgId")) + if (message.echoedMsgId != null && Object.hasOwnProperty.call(message, "echoedMsgId")) writer.uint32(/* id 2, wireType 0 =*/16).int32(message.echoedMsgId); - if (message.act != null && message.hasOwnProperty("act")) + if (message.act != null && Object.hasOwnProperty.call(message, "act")) writer.uint32(/* id 3, wireType 0 =*/24).int32(message.act); - if (message.rdf != null && message.hasOwnProperty("rdf")) + if (message.rdf != null && Object.hasOwnProperty.call(message, "rdf")) $root.protos.RoomDownsyncFrame.encode(message.rdf, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); if (message.inputFrameDownsyncBatch != null && message.inputFrameDownsyncBatch.length) for (var i = 0; i < message.inputFrameDownsyncBatch.length; ++i) $root.protos.InputFrameDownsync.encode(message.inputFrameDownsyncBatch[i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - if (message.bciFrame != null && message.hasOwnProperty("bciFrame")) + if (message.bciFrame != null && Object.hasOwnProperty.call(message, "bciFrame")) $root.protos.BattleColliderInfo.encode(message.bciFrame, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); return writer; }; @@ -2963,26 +3194,32 @@ $root.protos = (function() { while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.ret = reader.int32(); - break; - case 2: - message.echoedMsgId = reader.int32(); - break; - case 3: - message.act = reader.int32(); - break; - case 4: - message.rdf = $root.protos.RoomDownsyncFrame.decode(reader, reader.uint32()); - break; - case 5: - if (!(message.inputFrameDownsyncBatch && message.inputFrameDownsyncBatch.length)) - message.inputFrameDownsyncBatch = []; - message.inputFrameDownsyncBatch.push($root.protos.InputFrameDownsync.decode(reader, reader.uint32())); - break; - case 6: - message.bciFrame = $root.protos.BattleColliderInfo.decode(reader, reader.uint32()); - break; + case 1: { + message.ret = reader.int32(); + break; + } + case 2: { + message.echoedMsgId = reader.int32(); + break; + } + case 3: { + message.act = reader.int32(); + break; + } + case 4: { + message.rdf = $root.protos.RoomDownsyncFrame.decode(reader, reader.uint32()); + break; + } + case 5: { + if (!(message.inputFrameDownsyncBatch && message.inputFrameDownsyncBatch.length)) + message.inputFrameDownsyncBatch = []; + message.inputFrameDownsyncBatch.push($root.protos.InputFrameDownsync.decode(reader, reader.uint32())); + break; + } + case 6: { + message.bciFrame = $root.protos.BattleColliderInfo.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -3141,14 +3378,41 @@ $root.protos = (function() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for WsResp + * @function getTypeUrl + * @memberof protos.WsResp + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + WsResp.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/protos.WsResp"; + }; + return WsResp; })(); - protos.Direction = (function() { + return protos; +})(); + +$root.sharedprotos = (function() { + + /** + * Namespace sharedprotos. + * @exports sharedprotos + * @namespace + */ + var sharedprotos = {}; + + sharedprotos.Direction = (function() { /** * Properties of a Direction. - * @memberof protos + * @memberof sharedprotos * @interface IDirection * @property {number|null} [dx] Direction dx * @property {number|null} [dy] Direction dy @@ -3156,11 +3420,11 @@ $root.protos = (function() { /** * Constructs a new Direction. - * @memberof protos + * @memberof sharedprotos * @classdesc Represents a Direction. * @implements IDirection * @constructor - * @param {protos.IDirection=} [properties] Properties to set + * @param {sharedprotos.IDirection=} [properties] Properties to set */ function Direction(properties) { if (properties) @@ -3172,7 +3436,7 @@ $root.protos = (function() { /** * Direction dx. * @member {number} dx - * @memberof protos.Direction + * @memberof sharedprotos.Direction * @instance */ Direction.prototype.dx = 0; @@ -3180,7 +3444,7 @@ $root.protos = (function() { /** * Direction dy. * @member {number} dy - * @memberof protos.Direction + * @memberof sharedprotos.Direction * @instance */ Direction.prototype.dy = 0; @@ -3188,40 +3452,40 @@ $root.protos = (function() { /** * Creates a new Direction instance using the specified properties. * @function create - * @memberof protos.Direction + * @memberof sharedprotos.Direction * @static - * @param {protos.IDirection=} [properties] Properties to set - * @returns {protos.Direction} Direction instance + * @param {sharedprotos.IDirection=} [properties] Properties to set + * @returns {sharedprotos.Direction} Direction instance */ Direction.create = function create(properties) { return new Direction(properties); }; /** - * Encodes the specified Direction message. Does not implicitly {@link protos.Direction.verify|verify} messages. + * Encodes the specified Direction message. Does not implicitly {@link sharedprotos.Direction.verify|verify} messages. * @function encode - * @memberof protos.Direction + * @memberof sharedprotos.Direction * @static - * @param {protos.Direction} message Direction message or plain object to encode + * @param {sharedprotos.Direction} message Direction message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ Direction.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.dx != null && message.hasOwnProperty("dx")) + if (message.dx != null && Object.hasOwnProperty.call(message, "dx")) writer.uint32(/* id 1, wireType 0 =*/8).int32(message.dx); - if (message.dy != null && message.hasOwnProperty("dy")) + if (message.dy != null && Object.hasOwnProperty.call(message, "dy")) writer.uint32(/* id 2, wireType 0 =*/16).int32(message.dy); return writer; }; /** - * Encodes the specified Direction message, length delimited. Does not implicitly {@link protos.Direction.verify|verify} messages. + * Encodes the specified Direction message, length delimited. Does not implicitly {@link sharedprotos.Direction.verify|verify} messages. * @function encodeDelimited - * @memberof protos.Direction + * @memberof sharedprotos.Direction * @static - * @param {protos.Direction} message Direction message or plain object to encode + * @param {sharedprotos.Direction} message Direction message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ @@ -3232,27 +3496,29 @@ $root.protos = (function() { /** * Decodes a Direction message from the specified reader or buffer. * @function decode - * @memberof protos.Direction + * @memberof sharedprotos.Direction * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {protos.Direction} Direction + * @returns {sharedprotos.Direction} Direction * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ Direction.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.protos.Direction(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.sharedprotos.Direction(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.dx = reader.int32(); - break; - case 2: - message.dy = reader.int32(); - break; + case 1: { + message.dx = reader.int32(); + break; + } + case 2: { + message.dy = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -3264,10 +3530,10 @@ $root.protos = (function() { /** * Decodes a Direction message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof protos.Direction + * @memberof sharedprotos.Direction * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {protos.Direction} Direction + * @returns {sharedprotos.Direction} Direction * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ @@ -3280,7 +3546,7 @@ $root.protos = (function() { /** * Verifies a Direction message. * @function verify - * @memberof protos.Direction + * @memberof sharedprotos.Direction * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not @@ -3300,15 +3566,15 @@ $root.protos = (function() { /** * Creates a Direction message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof protos.Direction + * @memberof sharedprotos.Direction * @static * @param {Object.} object Plain object - * @returns {protos.Direction} Direction + * @returns {sharedprotos.Direction} Direction */ Direction.fromObject = function fromObject(object) { - if (object instanceof $root.protos.Direction) + if (object instanceof $root.sharedprotos.Direction) return object; - var message = new $root.protos.Direction(); + var message = new $root.sharedprotos.Direction(); if (object.dx != null) message.dx = object.dx | 0; if (object.dy != null) @@ -3319,9 +3585,9 @@ $root.protos = (function() { /** * Creates a plain object from a Direction message. Also converts values to other types if specified. * @function toObject - * @memberof protos.Direction + * @memberof sharedprotos.Direction * @static - * @param {protos.Direction} message Direction + * @param {sharedprotos.Direction} message Direction * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ @@ -3343,7 +3609,7 @@ $root.protos = (function() { /** * Converts this Direction to JSON. * @function toJSON - * @memberof protos.Direction + * @memberof sharedprotos.Direction * @instance * @returns {Object.} JSON object */ @@ -3351,14 +3617,29 @@ $root.protos = (function() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Direction + * @function getTypeUrl + * @memberof sharedprotos.Direction + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Direction.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/sharedprotos.Direction"; + }; + return Direction; })(); - protos.Vec2D = (function() { + sharedprotos.Vec2D = (function() { /** * Properties of a Vec2D. - * @memberof protos + * @memberof sharedprotos * @interface IVec2D * @property {number|null} [x] Vec2D x * @property {number|null} [y] Vec2D y @@ -3366,11 +3647,11 @@ $root.protos = (function() { /** * Constructs a new Vec2D. - * @memberof protos + * @memberof sharedprotos * @classdesc Represents a Vec2D. * @implements IVec2D * @constructor - * @param {protos.IVec2D=} [properties] Properties to set + * @param {sharedprotos.IVec2D=} [properties] Properties to set */ function Vec2D(properties) { if (properties) @@ -3382,7 +3663,7 @@ $root.protos = (function() { /** * Vec2D x. * @member {number} x - * @memberof protos.Vec2D + * @memberof sharedprotos.Vec2D * @instance */ Vec2D.prototype.x = 0; @@ -3390,7 +3671,7 @@ $root.protos = (function() { /** * Vec2D y. * @member {number} y - * @memberof protos.Vec2D + * @memberof sharedprotos.Vec2D * @instance */ Vec2D.prototype.y = 0; @@ -3398,40 +3679,40 @@ $root.protos = (function() { /** * Creates a new Vec2D instance using the specified properties. * @function create - * @memberof protos.Vec2D + * @memberof sharedprotos.Vec2D * @static - * @param {protos.IVec2D=} [properties] Properties to set - * @returns {protos.Vec2D} Vec2D instance + * @param {sharedprotos.IVec2D=} [properties] Properties to set + * @returns {sharedprotos.Vec2D} Vec2D instance */ Vec2D.create = function create(properties) { return new Vec2D(properties); }; /** - * Encodes the specified Vec2D message. Does not implicitly {@link protos.Vec2D.verify|verify} messages. + * Encodes the specified Vec2D message. Does not implicitly {@link sharedprotos.Vec2D.verify|verify} messages. * @function encode - * @memberof protos.Vec2D + * @memberof sharedprotos.Vec2D * @static - * @param {protos.Vec2D} message Vec2D message or plain object to encode + * @param {sharedprotos.Vec2D} message Vec2D message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ Vec2D.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.x != null && message.hasOwnProperty("x")) + if (message.x != null && Object.hasOwnProperty.call(message, "x")) writer.uint32(/* id 1, wireType 1 =*/9).double(message.x); - if (message.y != null && message.hasOwnProperty("y")) + if (message.y != null && Object.hasOwnProperty.call(message, "y")) writer.uint32(/* id 2, wireType 1 =*/17).double(message.y); return writer; }; /** - * Encodes the specified Vec2D message, length delimited. Does not implicitly {@link protos.Vec2D.verify|verify} messages. + * Encodes the specified Vec2D message, length delimited. Does not implicitly {@link sharedprotos.Vec2D.verify|verify} messages. * @function encodeDelimited - * @memberof protos.Vec2D + * @memberof sharedprotos.Vec2D * @static - * @param {protos.Vec2D} message Vec2D message or plain object to encode + * @param {sharedprotos.Vec2D} message Vec2D message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ @@ -3442,27 +3723,29 @@ $root.protos = (function() { /** * Decodes a Vec2D message from the specified reader or buffer. * @function decode - * @memberof protos.Vec2D + * @memberof sharedprotos.Vec2D * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {protos.Vec2D} Vec2D + * @returns {sharedprotos.Vec2D} Vec2D * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ Vec2D.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.protos.Vec2D(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.sharedprotos.Vec2D(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.x = reader.double(); - break; - case 2: - message.y = reader.double(); - break; + case 1: { + message.x = reader.double(); + break; + } + case 2: { + message.y = reader.double(); + break; + } default: reader.skipType(tag & 7); break; @@ -3474,10 +3757,10 @@ $root.protos = (function() { /** * Decodes a Vec2D message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof protos.Vec2D + * @memberof sharedprotos.Vec2D * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {protos.Vec2D} Vec2D + * @returns {sharedprotos.Vec2D} Vec2D * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ @@ -3490,7 +3773,7 @@ $root.protos = (function() { /** * Verifies a Vec2D message. * @function verify - * @memberof protos.Vec2D + * @memberof sharedprotos.Vec2D * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not @@ -3510,15 +3793,15 @@ $root.protos = (function() { /** * Creates a Vec2D message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof protos.Vec2D + * @memberof sharedprotos.Vec2D * @static * @param {Object.} object Plain object - * @returns {protos.Vec2D} Vec2D + * @returns {sharedprotos.Vec2D} Vec2D */ Vec2D.fromObject = function fromObject(object) { - if (object instanceof $root.protos.Vec2D) + if (object instanceof $root.sharedprotos.Vec2D) return object; - var message = new $root.protos.Vec2D(); + var message = new $root.sharedprotos.Vec2D(); if (object.x != null) message.x = Number(object.x); if (object.y != null) @@ -3529,9 +3812,9 @@ $root.protos = (function() { /** * Creates a plain object from a Vec2D message. Also converts values to other types if specified. * @function toObject - * @memberof protos.Vec2D + * @memberof sharedprotos.Vec2D * @static - * @param {protos.Vec2D} message Vec2D + * @param {sharedprotos.Vec2D} message Vec2D * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ @@ -3553,7 +3836,7 @@ $root.protos = (function() { /** * Converts this Vec2D to JSON. * @function toJSON - * @memberof protos.Vec2D + * @memberof sharedprotos.Vec2D * @instance * @returns {Object.} JSON object */ @@ -3561,26 +3844,41 @@ $root.protos = (function() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Vec2D + * @function getTypeUrl + * @memberof sharedprotos.Vec2D + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Vec2D.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/sharedprotos.Vec2D"; + }; + return Vec2D; })(); - protos.Polygon2D = (function() { + sharedprotos.Polygon2D = (function() { /** * Properties of a Polygon2D. - * @memberof protos + * @memberof sharedprotos * @interface IPolygon2D - * @property {protos.Vec2D|null} [anchor] Polygon2D anchor - * @property {Array.|null} [points] Polygon2D points + * @property {sharedprotos.Vec2D|null} [anchor] Polygon2D anchor + * @property {Array.|null} [points] Polygon2D points */ /** * Constructs a new Polygon2D. - * @memberof protos + * @memberof sharedprotos * @classdesc Represents a Polygon2D. * @implements IPolygon2D * @constructor - * @param {protos.IPolygon2D=} [properties] Properties to set + * @param {sharedprotos.IPolygon2D=} [properties] Properties to set */ function Polygon2D(properties) { this.points = []; @@ -3592,16 +3890,16 @@ $root.protos = (function() { /** * Polygon2D anchor. - * @member {protos.Vec2D|null|undefined} anchor - * @memberof protos.Polygon2D + * @member {sharedprotos.Vec2D|null|undefined} anchor + * @memberof sharedprotos.Polygon2D * @instance */ Polygon2D.prototype.anchor = null; /** * Polygon2D points. - * @member {Array.} points - * @memberof protos.Polygon2D + * @member {Array.} points + * @memberof sharedprotos.Polygon2D * @instance */ Polygon2D.prototype.points = $util.emptyArray; @@ -3609,41 +3907,41 @@ $root.protos = (function() { /** * Creates a new Polygon2D instance using the specified properties. * @function create - * @memberof protos.Polygon2D + * @memberof sharedprotos.Polygon2D * @static - * @param {protos.IPolygon2D=} [properties] Properties to set - * @returns {protos.Polygon2D} Polygon2D instance + * @param {sharedprotos.IPolygon2D=} [properties] Properties to set + * @returns {sharedprotos.Polygon2D} Polygon2D instance */ Polygon2D.create = function create(properties) { return new Polygon2D(properties); }; /** - * Encodes the specified Polygon2D message. Does not implicitly {@link protos.Polygon2D.verify|verify} messages. + * Encodes the specified Polygon2D message. Does not implicitly {@link sharedprotos.Polygon2D.verify|verify} messages. * @function encode - * @memberof protos.Polygon2D + * @memberof sharedprotos.Polygon2D * @static - * @param {protos.Polygon2D} message Polygon2D message or plain object to encode + * @param {sharedprotos.Polygon2D} message Polygon2D message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ Polygon2D.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.anchor != null && message.hasOwnProperty("anchor")) - $root.protos.Vec2D.encode(message.anchor, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.anchor != null && Object.hasOwnProperty.call(message, "anchor")) + $root.sharedprotos.Vec2D.encode(message.anchor, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); if (message.points != null && message.points.length) for (var i = 0; i < message.points.length; ++i) - $root.protos.Vec2D.encode(message.points[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + $root.sharedprotos.Vec2D.encode(message.points[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); return writer; }; /** - * Encodes the specified Polygon2D message, length delimited. Does not implicitly {@link protos.Polygon2D.verify|verify} messages. + * Encodes the specified Polygon2D message, length delimited. Does not implicitly {@link sharedprotos.Polygon2D.verify|verify} messages. * @function encodeDelimited - * @memberof protos.Polygon2D + * @memberof sharedprotos.Polygon2D * @static - * @param {protos.Polygon2D} message Polygon2D message or plain object to encode + * @param {sharedprotos.Polygon2D} message Polygon2D message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ @@ -3654,29 +3952,31 @@ $root.protos = (function() { /** * Decodes a Polygon2D message from the specified reader or buffer. * @function decode - * @memberof protos.Polygon2D + * @memberof sharedprotos.Polygon2D * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {protos.Polygon2D} Polygon2D + * @returns {sharedprotos.Polygon2D} Polygon2D * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ Polygon2D.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.protos.Polygon2D(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.sharedprotos.Polygon2D(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - message.anchor = $root.protos.Vec2D.decode(reader, reader.uint32()); - break; - case 2: - if (!(message.points && message.points.length)) - message.points = []; - message.points.push($root.protos.Vec2D.decode(reader, reader.uint32())); - break; + case 1: { + message.anchor = $root.sharedprotos.Vec2D.decode(reader, reader.uint32()); + break; + } + case 2: { + if (!(message.points && message.points.length)) + message.points = []; + message.points.push($root.sharedprotos.Vec2D.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -3688,10 +3988,10 @@ $root.protos = (function() { /** * Decodes a Polygon2D message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof protos.Polygon2D + * @memberof sharedprotos.Polygon2D * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {protos.Polygon2D} Polygon2D + * @returns {sharedprotos.Polygon2D} Polygon2D * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ @@ -3704,7 +4004,7 @@ $root.protos = (function() { /** * Verifies a Polygon2D message. * @function verify - * @memberof protos.Polygon2D + * @memberof sharedprotos.Polygon2D * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not @@ -3713,7 +4013,7 @@ $root.protos = (function() { if (typeof message !== "object" || message === null) return "object expected"; if (message.anchor != null && message.hasOwnProperty("anchor")) { - var error = $root.protos.Vec2D.verify(message.anchor); + var error = $root.sharedprotos.Vec2D.verify(message.anchor); if (error) return "anchor." + error; } @@ -3721,7 +4021,7 @@ $root.protos = (function() { if (!Array.isArray(message.points)) return "points: array expected"; for (var i = 0; i < message.points.length; ++i) { - var error = $root.protos.Vec2D.verify(message.points[i]); + var error = $root.sharedprotos.Vec2D.verify(message.points[i]); if (error) return "points." + error; } @@ -3732,28 +4032,28 @@ $root.protos = (function() { /** * Creates a Polygon2D message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof protos.Polygon2D + * @memberof sharedprotos.Polygon2D * @static * @param {Object.} object Plain object - * @returns {protos.Polygon2D} Polygon2D + * @returns {sharedprotos.Polygon2D} Polygon2D */ Polygon2D.fromObject = function fromObject(object) { - if (object instanceof $root.protos.Polygon2D) + if (object instanceof $root.sharedprotos.Polygon2D) return object; - var message = new $root.protos.Polygon2D(); + var message = new $root.sharedprotos.Polygon2D(); if (object.anchor != null) { if (typeof object.anchor !== "object") - throw TypeError(".protos.Polygon2D.anchor: object expected"); - message.anchor = $root.protos.Vec2D.fromObject(object.anchor); + throw TypeError(".sharedprotos.Polygon2D.anchor: object expected"); + message.anchor = $root.sharedprotos.Vec2D.fromObject(object.anchor); } if (object.points) { if (!Array.isArray(object.points)) - throw TypeError(".protos.Polygon2D.points: array expected"); + throw TypeError(".sharedprotos.Polygon2D.points: array expected"); message.points = []; for (var i = 0; i < object.points.length; ++i) { if (typeof object.points[i] !== "object") - throw TypeError(".protos.Polygon2D.points: object expected"); - message.points[i] = $root.protos.Vec2D.fromObject(object.points[i]); + throw TypeError(".sharedprotos.Polygon2D.points: object expected"); + message.points[i] = $root.sharedprotos.Vec2D.fromObject(object.points[i]); } } return message; @@ -3762,9 +4062,9 @@ $root.protos = (function() { /** * Creates a plain object from a Polygon2D message. Also converts values to other types if specified. * @function toObject - * @memberof protos.Polygon2D + * @memberof sharedprotos.Polygon2D * @static - * @param {protos.Polygon2D} message Polygon2D + * @param {sharedprotos.Polygon2D} message Polygon2D * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ @@ -3777,11 +4077,11 @@ $root.protos = (function() { if (options.defaults) object.anchor = null; if (message.anchor != null && message.hasOwnProperty("anchor")) - object.anchor = $root.protos.Vec2D.toObject(message.anchor, options); + object.anchor = $root.sharedprotos.Vec2D.toObject(message.anchor, options); if (message.points && message.points.length) { object.points = []; for (var j = 0; j < message.points.length; ++j) - object.points[j] = $root.protos.Vec2D.toObject(message.points[j], options); + object.points[j] = $root.sharedprotos.Vec2D.toObject(message.points[j], options); } return object; }; @@ -3789,7 +4089,7 @@ $root.protos = (function() { /** * Converts this Polygon2D to JSON. * @function toJSON - * @memberof protos.Polygon2D + * @memberof sharedprotos.Polygon2D * @instance * @returns {Object.} JSON object */ @@ -3797,25 +4097,40 @@ $root.protos = (function() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Polygon2D + * @function getTypeUrl + * @memberof sharedprotos.Polygon2D + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Polygon2D.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/sharedprotos.Polygon2D"; + }; + return Polygon2D; })(); - protos.Vec2DList = (function() { + sharedprotos.Vec2DList = (function() { /** * Properties of a Vec2DList. - * @memberof protos + * @memberof sharedprotos * @interface IVec2DList - * @property {Array.|null} [eles] Vec2DList eles + * @property {Array.|null} [eles] Vec2DList eles */ /** * Constructs a new Vec2DList. - * @memberof protos + * @memberof sharedprotos * @classdesc Represents a Vec2DList. * @implements IVec2DList * @constructor - * @param {protos.IVec2DList=} [properties] Properties to set + * @param {sharedprotos.IVec2DList=} [properties] Properties to set */ function Vec2DList(properties) { this.eles = []; @@ -3827,8 +4142,8 @@ $root.protos = (function() { /** * Vec2DList eles. - * @member {Array.} eles - * @memberof protos.Vec2DList + * @member {Array.} eles + * @memberof sharedprotos.Vec2DList * @instance */ Vec2DList.prototype.eles = $util.emptyArray; @@ -3836,21 +4151,21 @@ $root.protos = (function() { /** * Creates a new Vec2DList instance using the specified properties. * @function create - * @memberof protos.Vec2DList + * @memberof sharedprotos.Vec2DList * @static - * @param {protos.IVec2DList=} [properties] Properties to set - * @returns {protos.Vec2DList} Vec2DList instance + * @param {sharedprotos.IVec2DList=} [properties] Properties to set + * @returns {sharedprotos.Vec2DList} Vec2DList instance */ Vec2DList.create = function create(properties) { return new Vec2DList(properties); }; /** - * Encodes the specified Vec2DList message. Does not implicitly {@link protos.Vec2DList.verify|verify} messages. + * Encodes the specified Vec2DList message. Does not implicitly {@link sharedprotos.Vec2DList.verify|verify} messages. * @function encode - * @memberof protos.Vec2DList + * @memberof sharedprotos.Vec2DList * @static - * @param {protos.Vec2DList} message Vec2DList message or plain object to encode + * @param {sharedprotos.Vec2DList} message Vec2DList message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ @@ -3859,16 +4174,16 @@ $root.protos = (function() { writer = $Writer.create(); if (message.eles != null && message.eles.length) for (var i = 0; i < message.eles.length; ++i) - $root.protos.Vec2D.encode(message.eles[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + $root.sharedprotos.Vec2D.encode(message.eles[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified Vec2DList message, length delimited. Does not implicitly {@link protos.Vec2DList.verify|verify} messages. + * Encodes the specified Vec2DList message, length delimited. Does not implicitly {@link sharedprotos.Vec2DList.verify|verify} messages. * @function encodeDelimited - * @memberof protos.Vec2DList + * @memberof sharedprotos.Vec2DList * @static - * @param {protos.Vec2DList} message Vec2DList message or plain object to encode + * @param {sharedprotos.Vec2DList} message Vec2DList message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ @@ -3879,26 +4194,27 @@ $root.protos = (function() { /** * Decodes a Vec2DList message from the specified reader or buffer. * @function decode - * @memberof protos.Vec2DList + * @memberof sharedprotos.Vec2DList * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {protos.Vec2DList} Vec2DList + * @returns {sharedprotos.Vec2DList} Vec2DList * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ Vec2DList.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.protos.Vec2DList(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.sharedprotos.Vec2DList(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.eles && message.eles.length)) - message.eles = []; - message.eles.push($root.protos.Vec2D.decode(reader, reader.uint32())); - break; + case 1: { + if (!(message.eles && message.eles.length)) + message.eles = []; + message.eles.push($root.sharedprotos.Vec2D.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -3910,10 +4226,10 @@ $root.protos = (function() { /** * Decodes a Vec2DList message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof protos.Vec2DList + * @memberof sharedprotos.Vec2DList * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {protos.Vec2DList} Vec2DList + * @returns {sharedprotos.Vec2DList} Vec2DList * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ @@ -3926,7 +4242,7 @@ $root.protos = (function() { /** * Verifies a Vec2DList message. * @function verify - * @memberof protos.Vec2DList + * @memberof sharedprotos.Vec2DList * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not @@ -3938,7 +4254,7 @@ $root.protos = (function() { if (!Array.isArray(message.eles)) return "eles: array expected"; for (var i = 0; i < message.eles.length; ++i) { - var error = $root.protos.Vec2D.verify(message.eles[i]); + var error = $root.sharedprotos.Vec2D.verify(message.eles[i]); if (error) return "eles." + error; } @@ -3949,23 +4265,23 @@ $root.protos = (function() { /** * Creates a Vec2DList message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof protos.Vec2DList + * @memberof sharedprotos.Vec2DList * @static * @param {Object.} object Plain object - * @returns {protos.Vec2DList} Vec2DList + * @returns {sharedprotos.Vec2DList} Vec2DList */ Vec2DList.fromObject = function fromObject(object) { - if (object instanceof $root.protos.Vec2DList) + if (object instanceof $root.sharedprotos.Vec2DList) return object; - var message = new $root.protos.Vec2DList(); + var message = new $root.sharedprotos.Vec2DList(); if (object.eles) { if (!Array.isArray(object.eles)) - throw TypeError(".protos.Vec2DList.eles: array expected"); + throw TypeError(".sharedprotos.Vec2DList.eles: array expected"); message.eles = []; for (var i = 0; i < object.eles.length; ++i) { if (typeof object.eles[i] !== "object") - throw TypeError(".protos.Vec2DList.eles: object expected"); - message.eles[i] = $root.protos.Vec2D.fromObject(object.eles[i]); + throw TypeError(".sharedprotos.Vec2DList.eles: object expected"); + message.eles[i] = $root.sharedprotos.Vec2D.fromObject(object.eles[i]); } } return message; @@ -3974,9 +4290,9 @@ $root.protos = (function() { /** * Creates a plain object from a Vec2DList message. Also converts values to other types if specified. * @function toObject - * @memberof protos.Vec2DList + * @memberof sharedprotos.Vec2DList * @static - * @param {protos.Vec2DList} message Vec2DList + * @param {sharedprotos.Vec2DList} message Vec2DList * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ @@ -3989,7 +4305,7 @@ $root.protos = (function() { if (message.eles && message.eles.length) { object.eles = []; for (var j = 0; j < message.eles.length; ++j) - object.eles[j] = $root.protos.Vec2D.toObject(message.eles[j], options); + object.eles[j] = $root.sharedprotos.Vec2D.toObject(message.eles[j], options); } return object; }; @@ -3997,7 +4313,7 @@ $root.protos = (function() { /** * Converts this Vec2DList to JSON. * @function toJSON - * @memberof protos.Vec2DList + * @memberof sharedprotos.Vec2DList * @instance * @returns {Object.} JSON object */ @@ -4005,25 +4321,40 @@ $root.protos = (function() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Vec2DList + * @function getTypeUrl + * @memberof sharedprotos.Vec2DList + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Vec2DList.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/sharedprotos.Vec2DList"; + }; + return Vec2DList; })(); - protos.Polygon2DList = (function() { + sharedprotos.Polygon2DList = (function() { /** * Properties of a Polygon2DList. - * @memberof protos + * @memberof sharedprotos * @interface IPolygon2DList - * @property {Array.|null} [eles] Polygon2DList eles + * @property {Array.|null} [eles] Polygon2DList eles */ /** * Constructs a new Polygon2DList. - * @memberof protos + * @memberof sharedprotos * @classdesc Represents a Polygon2DList. * @implements IPolygon2DList * @constructor - * @param {protos.IPolygon2DList=} [properties] Properties to set + * @param {sharedprotos.IPolygon2DList=} [properties] Properties to set */ function Polygon2DList(properties) { this.eles = []; @@ -4035,8 +4366,8 @@ $root.protos = (function() { /** * Polygon2DList eles. - * @member {Array.} eles - * @memberof protos.Polygon2DList + * @member {Array.} eles + * @memberof sharedprotos.Polygon2DList * @instance */ Polygon2DList.prototype.eles = $util.emptyArray; @@ -4044,21 +4375,21 @@ $root.protos = (function() { /** * Creates a new Polygon2DList instance using the specified properties. * @function create - * @memberof protos.Polygon2DList + * @memberof sharedprotos.Polygon2DList * @static - * @param {protos.IPolygon2DList=} [properties] Properties to set - * @returns {protos.Polygon2DList} Polygon2DList instance + * @param {sharedprotos.IPolygon2DList=} [properties] Properties to set + * @returns {sharedprotos.Polygon2DList} Polygon2DList instance */ Polygon2DList.create = function create(properties) { return new Polygon2DList(properties); }; /** - * Encodes the specified Polygon2DList message. Does not implicitly {@link protos.Polygon2DList.verify|verify} messages. + * Encodes the specified Polygon2DList message. Does not implicitly {@link sharedprotos.Polygon2DList.verify|verify} messages. * @function encode - * @memberof protos.Polygon2DList + * @memberof sharedprotos.Polygon2DList * @static - * @param {protos.Polygon2DList} message Polygon2DList message or plain object to encode + * @param {sharedprotos.Polygon2DList} message Polygon2DList message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ @@ -4067,16 +4398,16 @@ $root.protos = (function() { writer = $Writer.create(); if (message.eles != null && message.eles.length) for (var i = 0; i < message.eles.length; ++i) - $root.protos.Polygon2D.encode(message.eles[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + $root.sharedprotos.Polygon2D.encode(message.eles[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); return writer; }; /** - * Encodes the specified Polygon2DList message, length delimited. Does not implicitly {@link protos.Polygon2DList.verify|verify} messages. + * Encodes the specified Polygon2DList message, length delimited. Does not implicitly {@link sharedprotos.Polygon2DList.verify|verify} messages. * @function encodeDelimited - * @memberof protos.Polygon2DList + * @memberof sharedprotos.Polygon2DList * @static - * @param {protos.Polygon2DList} message Polygon2DList message or plain object to encode + * @param {sharedprotos.Polygon2DList} message Polygon2DList message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ @@ -4087,26 +4418,27 @@ $root.protos = (function() { /** * Decodes a Polygon2DList message from the specified reader or buffer. * @function decode - * @memberof protos.Polygon2DList + * @memberof sharedprotos.Polygon2DList * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {protos.Polygon2DList} Polygon2DList + * @returns {sharedprotos.Polygon2DList} Polygon2DList * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ Polygon2DList.decode = function decode(reader, length) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.protos.Polygon2DList(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.sharedprotos.Polygon2DList(); while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { - case 1: - if (!(message.eles && message.eles.length)) - message.eles = []; - message.eles.push($root.protos.Polygon2D.decode(reader, reader.uint32())); - break; + case 1: { + if (!(message.eles && message.eles.length)) + message.eles = []; + message.eles.push($root.sharedprotos.Polygon2D.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -4118,10 +4450,10 @@ $root.protos = (function() { /** * Decodes a Polygon2DList message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof protos.Polygon2DList + * @memberof sharedprotos.Polygon2DList * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {protos.Polygon2DList} Polygon2DList + * @returns {sharedprotos.Polygon2DList} Polygon2DList * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ @@ -4134,7 +4466,7 @@ $root.protos = (function() { /** * Verifies a Polygon2DList message. * @function verify - * @memberof protos.Polygon2DList + * @memberof sharedprotos.Polygon2DList * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not @@ -4146,7 +4478,7 @@ $root.protos = (function() { if (!Array.isArray(message.eles)) return "eles: array expected"; for (var i = 0; i < message.eles.length; ++i) { - var error = $root.protos.Polygon2D.verify(message.eles[i]); + var error = $root.sharedprotos.Polygon2D.verify(message.eles[i]); if (error) return "eles." + error; } @@ -4157,23 +4489,23 @@ $root.protos = (function() { /** * Creates a Polygon2DList message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof protos.Polygon2DList + * @memberof sharedprotos.Polygon2DList * @static * @param {Object.} object Plain object - * @returns {protos.Polygon2DList} Polygon2DList + * @returns {sharedprotos.Polygon2DList} Polygon2DList */ Polygon2DList.fromObject = function fromObject(object) { - if (object instanceof $root.protos.Polygon2DList) + if (object instanceof $root.sharedprotos.Polygon2DList) return object; - var message = new $root.protos.Polygon2DList(); + var message = new $root.sharedprotos.Polygon2DList(); if (object.eles) { if (!Array.isArray(object.eles)) - throw TypeError(".protos.Polygon2DList.eles: array expected"); + throw TypeError(".sharedprotos.Polygon2DList.eles: array expected"); message.eles = []; for (var i = 0; i < object.eles.length; ++i) { if (typeof object.eles[i] !== "object") - throw TypeError(".protos.Polygon2DList.eles: object expected"); - message.eles[i] = $root.protos.Polygon2D.fromObject(object.eles[i]); + throw TypeError(".sharedprotos.Polygon2DList.eles: object expected"); + message.eles[i] = $root.sharedprotos.Polygon2D.fromObject(object.eles[i]); } } return message; @@ -4182,9 +4514,9 @@ $root.protos = (function() { /** * Creates a plain object from a Polygon2DList message. Also converts values to other types if specified. * @function toObject - * @memberof protos.Polygon2DList + * @memberof sharedprotos.Polygon2DList * @static - * @param {protos.Polygon2DList} message Polygon2DList + * @param {sharedprotos.Polygon2DList} message Polygon2DList * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ @@ -4197,7 +4529,7 @@ $root.protos = (function() { if (message.eles && message.eles.length) { object.eles = []; for (var j = 0; j < message.eles.length; ++j) - object.eles[j] = $root.protos.Polygon2D.toObject(message.eles[j], options); + object.eles[j] = $root.sharedprotos.Polygon2D.toObject(message.eles[j], options); } return object; }; @@ -4205,7 +4537,7 @@ $root.protos = (function() { /** * Converts this Polygon2DList to JSON. * @function toJSON - * @memberof protos.Polygon2DList + * @memberof sharedprotos.Polygon2DList * @instance * @returns {Object.} JSON object */ @@ -4213,10 +4545,25 @@ $root.protos = (function() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; + /** + * Gets the default type url for Polygon2DList + * @function getTypeUrl + * @memberof sharedprotos.Polygon2DList + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Polygon2DList.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/sharedprotos.Polygon2DList"; + }; + return Polygon2DList; })(); - return protos; + return sharedprotos; })(); module.exports = $root;