protobuf 按照最新文档更新

main
Wesley Wu 2023-08-14 22:12:29 +08:00
parent 7aa4aee2b9
commit 0335c9b918
10 changed files with 1343 additions and 1278 deletions

40
.gitignore vendored Normal file
View File

@ -0,0 +1,40 @@
# Copyright 2017 Google LLC All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
.idea
!.gitignore
!.helmignore
!.gitattributes
!.dockerignore
!.golangci.yml
!.gcloudignore
!.eslintrc.*
!.nycrc
!.clang-format
!.github
*.iml
bin
*.o
tmp
terraform.tfvars
terraform.tfstate*
kubeconfig
build/local-includes/*
build/allocation
!build/local-includes/README.md
/release
debug.test
obj
test/sdk/cpp/sdk/

8
buf.yaml Normal file
View File

@ -0,0 +1,8 @@
version: v1
deps:
breaking:
use:
- FILE
lint:
use:
- DEFAULT

2
dof/Makefile Normal file
View File

@ -0,0 +1,2 @@
dof-gen:
buf generate messages.proto

5
dof/README.md Normal file
View File

@ -0,0 +1,5 @@
# dof-gve 玩法数据交互 protobuf
参考文档:
https://docs.google.com/document/d/1HqIjaiMRcVs-JIzqhluMm2eLnmQ2FCs1MCw5s9nEkjs

4
dof/buf.gen.yaml Normal file
View File

@ -0,0 +1,4 @@
version: v1
plugins:
- plugin: buf.build/protocolbuffers/go
out: go

1234
dof/go/messages.pb.go Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,78 +1,62 @@
// Copyright 2019 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package dofagon;
option go_package = "github.com/castbox/guru-proto/dof/pb";
package dof;
option go_package = "./;pb";
// ClientInitialize PlayerEnter
message ClientInitialize {
int64 cid = 1;
string uid = 2;
}
message Memos {
repeated Memo memos = 1;
}
message Memo {
oneof recipient {
int64 to = 1;
int64 everyone_but = 2;
bool everyone = 3;
}
// ClientMessage
message ClientMessage {
oneof actual {
PlayerEnter player_enter = 10;
DownloadResource download_resource = 11;
LevelPrepared level_prepared = 12;
GameStart game_start = 13;
PointFound point_found = 14;
LevelEnd level_end = 15;
AllLevelEnd all_level_end = 16;
ScoreSettlement score_settlement = 17;
PlayerLeave player_leave = 18;
PlayerEnter player_enter = 1;
LevelPrepared level_prepared = 2;
PointFound point_found = 3;
LevelEnd level_end = 4;
AllLevelEnd all_level_end = 5;
PlayerLeave player_leave = 6;
}
}
//
// ServerMessage
message ServerMessage {
oneof actual {
GameStart game_start = 1;
LevalStart leval_start = 2;
PointFound point_found = 3;
GameFinish game_finish = 4;
}
}
// PlayerEnter
message PlayerEnter {
int64 cid = 1;
string nick_name = 2;
string country = 3;
string room_id = 1;
string uid = 2;
string nick_name = 3;
string country = 4;
}
message LevelResource {
string level = 1;
}
message DownloadResource {
message GameStart {
repeated LevelResource level_resource = 1;
}
message LevelPrepared {
int64 cid = 1;
message LevelPrepared {
int64 cid = 1;
}
message GameStart {
int64 cid = 1;
message LevalStart {
string level = 1;
}
message PointFound {
int64 cid = 1;
int64 point_id = 2;
string level = 3;
string level = 2;
int64 point_id = 3;
}
message LevelEnd {
@ -84,13 +68,15 @@ message AllLevelEnd {
int64 cid = 1;
}
// settlement
message ScoreSettlement {
int64 cid = 1;
message GameScore {
string uid = 1;
int64 score = 2;
}
message GameFinish {
repeated GameScore scores = 1;
}
message PlayerLeave {
int64 cid = 1;
}
}

5
go.mod Normal file
View File

@ -0,0 +1,5 @@
module github.com/guru-proto
go 1.20
require google.golang.org/protobuf v1.31.0 // indirect

6
go.sum Normal file
View File

@ -0,0 +1,6 @@
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8=
google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=