├── LICENSE ├── README.md ├── lib ├── ng_conn.go ├── ng_heap.go ├── ng_protocol.go ├── ng_server.go ├── ng_stack.go └── ng_utils.go ├── logger └── ng_log.go ├── main.go └── server ├── ng_app_protocol.go ├── ng_game_server.go ├── ng_lobby_server.go ├── ng_master_server.go ├── ng_message.pb.go ├── ng_message.proto ├── ng_network.go └── ng_peer.go /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 netgo-framework 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # NetGo 2 | 3 | 4 | [![Go Report Card][3]][4] 5 | 6 | 7 | [3]: https://goreportcard.com/badge/github.com/netgo-framework/netgo 8 | [4]: https://goreportcard.com/report/github.com/netgo-framework/netgo 9 | 10 | 11 | Netgo is a Flexible,Powerful,Friendly network synchronization engine,it can be used for VR Application.And new features are under development.. 12 | 13 | 14 | 15 | ## FeatureList 16 | 17 | - [x] Support Room concept 18 | - [x] Support multiple synchronization ways,including RPC and view sync 19 | - [x] Support custom event 20 | - [ ] Support Lobby concept 21 | - [ ] Support Load Balance 22 | - [ ] ... 23 | 24 | ## Start Server 25 | 26 | ### Environment 27 | 28 | Netgo can be run under MacOS/Ubuntu/Centos. 29 | 30 | ### Clone 31 | 32 | Issue the following command to clone the server codes to local: 33 | 34 | git clone https://github.com/netgo-framework/netgo.git 35 | 36 | ### Get dependencies 37 | 38 | Go to the netgo root folder and issue the following commad: 39 | 40 | go get -d ./... 41 | 42 | ### Change port 43 | Open [main.go](https://github.com/netgo-framework/netgo/blob/master/main.go) and update the ip and port: 44 | 45 | tcpAddr, err := net.ResolveTCPAddr("tcp", "0.0.0.0:8686") 46 | 47 | 48 | ### Start Netgo 49 | 50 | go run main.go 51 | 52 | ## How to Run Client Demo 53 | 54 | Following the netgo-unity-client [README](https://github.com/netgo-framework/netgo-unity-client) to run the client Demo. 55 | 56 | 57 | 58 | ## Third Party Packages 59 | 60 | - [protobuf](https://github.com/golang/protobuf) 61 | 62 | 63 | -------------------------------------------------------------------------------- /lib/ng_conn.go: -------------------------------------------------------------------------------- 1 | package lib 2 | 3 | import ( 4 | "errors" 5 | "net" 6 | "sync" 7 | "sync/atomic" 8 | "time" 9 | 10 | "github.com/harlanc/netgo/logger" 11 | ) 12 | 13 | // Error type 14 | var ( 15 | ErrConnClosing = errors.New("use of closed network connection") 16 | ErrWriteBlocking = errors.New("write packet was blocking") 17 | ErrReadBlocking = errors.New("read packet was blocking") 18 | ) 19 | 20 | // Conn exposes a set of callbacks for the various events that occur on a connection 21 | type Conn struct { 22 | srv *Server 23 | conn *net.TCPConn // the raw connection 24 | extraData interface{} // to save extra data 25 | closeOnce sync.Once // close the conn, once, per instance 26 | closeFlag int32 // close flag 27 | closeChan chan struct{} // close chanel 28 | packetSendChan chan Packet // packet send chanel 29 | packetReceiveChan chan Packet // packeet receive chanel 30 | PeerID uint32 31 | RoomID string 32 | } 33 | 34 | // ConnCallback is an interface of methods that are used as callbacks on a connection 35 | type ConnCallback interface { 36 | // OnConnect is called when the connection was accepted, 37 | // If the return value of false is closed 38 | OnConnect(*Conn) bool 39 | 40 | // OnMessage is called when the connection receives a packet, 41 | // If the return value of false is closed 42 | OnMessage(*Conn, Packet) bool 43 | 44 | // OnClose is called when the connection closed 45 | OnClose(*Conn) 46 | } 47 | 48 | // newConn returns a wrapper of raw conn 49 | func newConn(conn *net.TCPConn, srv *Server) *Conn { 50 | return &Conn{ 51 | srv: srv, 52 | conn: conn, 53 | closeChan: make(chan struct{}), 54 | packetSendChan: make(chan Packet, srv.config.PacketSendChanLimit), 55 | packetReceiveChan: make(chan Packet, srv.config.PacketReceiveChanLimit), 56 | PeerID: 0, 57 | } 58 | } 59 | 60 | // GetExtraData gets the extra data from the Conn 61 | func (c *Conn) GetExtraData() interface{} { 62 | return c.extraData 63 | } 64 | 65 | // PutExtraData puts the extra data with the Conn 66 | func (c *Conn) PutExtraData(data interface{}) { 67 | c.extraData = data 68 | } 69 | 70 | // GetRawConn returns the raw net.TCPConn from the Conn 71 | func (c *Conn) GetRawConn() *net.TCPConn { 72 | return c.conn 73 | } 74 | 75 | // Close closes the connection 76 | func (c *Conn) Close() { 77 | c.closeOnce.Do(func() { 78 | atomic.StoreInt32(&c.closeFlag, 1) 79 | close(c.closeChan) 80 | close(c.packetSendChan) 81 | close(c.packetReceiveChan) 82 | c.conn.Close() 83 | c.srv.callback.OnClose(c) 84 | }) 85 | } 86 | 87 | // IsClosed indicates whether or not the connection is closed 88 | func (c *Conn) IsClosed() bool { 89 | 90 | //fmt.Println("IsClosed:", c) 91 | return atomic.LoadInt32(&c.closeFlag) == 1 92 | } 93 | 94 | // AsyncWritePacket async writes a packet, this method will never block 95 | func (c *Conn) AsyncWritePacket(p Packet, timeout time.Duration) (err error) { 96 | if c.IsClosed() { 97 | return ErrConnClosing 98 | } 99 | 100 | defer func() { 101 | if e := recover(); e != nil { 102 | err = ErrConnClosing 103 | } 104 | }() 105 | 106 | if timeout == 0 { 107 | select { 108 | case c.packetSendChan <- p: 109 | return nil 110 | 111 | default: 112 | return ErrWriteBlocking 113 | } 114 | 115 | } else { 116 | select { 117 | case c.packetSendChan <- p: 118 | return nil 119 | 120 | case <-c.closeChan: 121 | return ErrConnClosing 122 | 123 | case <-time.After(timeout): 124 | return ErrWriteBlocking 125 | } 126 | } 127 | } 128 | 129 | // Do it 130 | func (c *Conn) Do() { 131 | if !c.srv.callback.OnConnect(c) { 132 | return 133 | } 134 | 135 | asyncDo(c.handleLoop, c.srv.waitGroup) 136 | asyncDo(c.readLoop, c.srv.waitGroup) 137 | asyncDo(c.writeLoop, c.srv.waitGroup) 138 | } 139 | 140 | func (c *Conn) readLoop() { 141 | defer func() { 142 | recover() 143 | c.Close() 144 | }() 145 | 146 | for { 147 | select { 148 | case <-c.srv.exitChan: 149 | return 150 | 151 | case <-c.closeChan: 152 | return 153 | 154 | default: 155 | } 156 | 157 | p, err := c.srv.protocol.ReadPacket(c.conn) 158 | if err != nil { 159 | 160 | logger.LogError("Packet Error:" + err.Error()) 161 | return 162 | } 163 | 164 | c.packetReceiveChan <- p 165 | } 166 | } 167 | 168 | func (c *Conn) writeLoop() { 169 | defer func() { 170 | recover() 171 | c.Close() 172 | }() 173 | 174 | for { 175 | select { 176 | case <-c.srv.exitChan: 177 | return 178 | 179 | case <-c.closeChan: 180 | return 181 | 182 | case p := <-c.packetSendChan: 183 | if c.IsClosed() { 184 | return 185 | } 186 | 187 | if _, err := c.conn.Write(p.Serialize()); err != nil { 188 | logger.LogError("WriteLoop Error" + err.Error()) 189 | return 190 | } 191 | //logger.LogDebug("send a string" + c.conn.RemoteAddr().String()) 192 | } 193 | } 194 | } 195 | 196 | func (c *Conn) handleLoop() { 197 | defer func() { 198 | recover() 199 | c.Close() 200 | }() 201 | 202 | for { 203 | select { 204 | case <-c.srv.exitChan: 205 | return 206 | 207 | case <-c.closeChan: 208 | return 209 | 210 | case p := <-c.packetReceiveChan: 211 | if c.IsClosed() { 212 | return 213 | } 214 | if !c.srv.callback.OnMessage(c, p) { 215 | return 216 | } 217 | } 218 | } 219 | } 220 | 221 | func asyncDo(fn func(), wg *sync.WaitGroup) { 222 | wg.Add(1) 223 | go func() { 224 | fn() 225 | wg.Done() 226 | }() 227 | } 228 | -------------------------------------------------------------------------------- /lib/ng_heap.go: -------------------------------------------------------------------------------- 1 | package lib 2 | 3 | // An IntHeap is a min-heap of ints. 4 | type IntHeap []uint32 5 | 6 | func (h IntHeap) Len() int { return len(h) } 7 | func (h IntHeap) Less(i, j int) bool { return h[i] < h[j] } 8 | func (h IntHeap) Swap(i, j int) { h[i], h[j] = h[j], h[i] } 9 | 10 | //Push push a int element 11 | func (h *IntHeap) Push(x interface{}) { 12 | // Push and Pop use pointer receivers because they modify the slice's length, 13 | // not just its contents. 14 | *h = append(*h, x.(uint32)) 15 | } 16 | 17 | //Pop pop a int element 18 | func (h *IntHeap) Pop() interface{} { 19 | old := *h 20 | n := len(old) 21 | x := old[n-1] 22 | *h = old[0 : n-1] 23 | return x 24 | } 25 | -------------------------------------------------------------------------------- /lib/ng_protocol.go: -------------------------------------------------------------------------------- 1 | package lib 2 | 3 | import ( 4 | "net" 5 | ) 6 | 7 | //Packet interface 8 | type Packet interface { 9 | Serialize() []byte 10 | } 11 | 12 | //Protocol interface 13 | type Protocol interface { 14 | ReadPacket(conn *net.TCPConn) (Packet, error) 15 | } 16 | -------------------------------------------------------------------------------- /lib/ng_server.go: -------------------------------------------------------------------------------- 1 | package lib 2 | 3 | import ( 4 | "net" 5 | "sync" 6 | "time" 7 | ) 8 | 9 | //Config struct 10 | type Config struct { 11 | PacketSendChanLimit uint32 // the limit of packet send channel 12 | PacketReceiveChanLimit uint32 // the limit of packet receive channel 13 | } 14 | 15 | //Server struct 16 | type Server struct { 17 | config *Config // server configuration 18 | callback ConnCallback // message callbacks in connection 19 | protocol Protocol // customize packet protocol 20 | exitChan chan struct{} // notify all goroutines to shutdown 21 | waitGroup *sync.WaitGroup // wait for all goroutines 22 | } 23 | 24 | // NewServer creates a server 25 | func NewServer(config *Config, callback ConnCallback, protocol Protocol) *Server { 26 | return &Server{ 27 | config: config, 28 | callback: callback, 29 | protocol: protocol, 30 | exitChan: make(chan struct{}), 31 | waitGroup: &sync.WaitGroup{}, 32 | } 33 | } 34 | 35 | // Start starts service 36 | func (s *Server) Start(listener *net.TCPListener, acceptTimeout time.Duration) { 37 | s.waitGroup.Add(1) 38 | defer func() { 39 | listener.Close() 40 | s.waitGroup.Done() 41 | }() 42 | 43 | for { 44 | select { 45 | case <-s.exitChan: 46 | return 47 | 48 | default: 49 | } 50 | 51 | listener.SetDeadline(time.Now().Add(acceptTimeout)) 52 | 53 | conn, err := listener.AcceptTCP() 54 | if err != nil { 55 | continue 56 | } 57 | 58 | s.waitGroup.Add(1) 59 | go func() { 60 | 61 | newConn(conn, s).Do() 62 | s.waitGroup.Done() 63 | }() 64 | } 65 | } 66 | 67 | // Stop stops service 68 | func (s *Server) Stop() { 69 | close(s.exitChan) 70 | s.waitGroup.Wait() 71 | } 72 | -------------------------------------------------------------------------------- /lib/ng_stack.go: -------------------------------------------------------------------------------- 1 | package lib 2 | 3 | import "errors" 4 | 5 | //Stack can save any types 6 | type Stack []interface{} 7 | 8 | //Length get the length of Stack 9 | func (stack *Stack) Length() int { 10 | return len(*stack) 11 | } 12 | 13 | //IsEmpty judge if the stack is empty 14 | func (stack *Stack) IsEmpty() bool { 15 | return len(*stack) == 0 16 | } 17 | 18 | //Cap get the cap of stack 19 | func (stack *Stack) Cap() int { 20 | return cap(*stack) 21 | } 22 | 23 | //Push push a element to Stack 24 | func (stack *Stack) Push(value interface{}) { 25 | *stack = append(*stack, value) 26 | } 27 | 28 | //Top get the top element of the Stack 29 | func (stack *Stack) Top() (interface{}, error) { 30 | if len(*stack) == 0 { 31 | return nil, errors.New("Out of index, len is 0") 32 | } 33 | return (*stack)[len(*stack)-1], nil 34 | } 35 | 36 | //Pop pop a element from Stack 37 | func (stack *Stack) Pop() (interface{}, error) { 38 | theStack := *stack 39 | if len(theStack) == 0 { 40 | return nil, errors.New("Out of index, len is 0") 41 | } 42 | value := theStack[len(theStack)-1] 43 | *stack = theStack[:len(theStack)-1] 44 | return value, nil 45 | } 46 | -------------------------------------------------------------------------------- /lib/ng_utils.go: -------------------------------------------------------------------------------- 1 | package lib 2 | 3 | import ( 4 | "encoding/binary" 5 | "strconv" 6 | 7 | uuid "github.com/satori/go.uuid" 8 | ) 9 | 10 | //String2Int convert from string to int 11 | func String2Int(val string) int { 12 | 13 | goodsIDInt, err := strconv.Atoi(val) 14 | if err != nil { 15 | return -1 16 | } 17 | return goodsIDInt 18 | } 19 | 20 | //Int2String convert from int to string 21 | func Int2String(val int) string { 22 | return strconv.Itoa(val) 23 | } 24 | 25 | //Int642String convert from int64 to string 26 | func Int642String(val int64) string { 27 | return strconv.FormatInt(val, 10) 28 | } 29 | 30 | //Uint322String convert from uint32 to string 31 | func Uint322String(val uint32) string { 32 | return strconv.FormatUint(uint64(val), 10) 33 | } 34 | 35 | //Float642String convert from int to string 36 | func Float642String(val float64) string { 37 | return strconv.FormatFloat(val, 'E', -1, 64) 38 | } 39 | 40 | //Uint322ByteArray uint32 to byte array 41 | func Uint322ByteArray(val uint32) []byte { 42 | 43 | b := make([]byte, 4) 44 | binary.LittleEndian.PutUint32(b, val) 45 | return b 46 | } 47 | 48 | //NewUUID get a new UUID 49 | func NewUUID() string { 50 | uuid, err := uuid.NewV4() 51 | if err != nil { 52 | return "" 53 | } 54 | return uuid.String() 55 | 56 | } 57 | -------------------------------------------------------------------------------- /logger/ng_log.go: -------------------------------------------------------------------------------- 1 | package logger 2 | 3 | import ( 4 | "fmt" 5 | ) 6 | 7 | //LogInfo log info 8 | func LogInfo(msg string) { 9 | 10 | fmt.Println("Info:" + msg) 11 | //log.Printf() 12 | } 13 | 14 | //LogError log error 15 | func LogError(msg string) { 16 | 17 | fmt.Println("Error:" + msg) 18 | //log.Printf() 19 | } 20 | 21 | //LogDebug log debug info 22 | func LogDebug(msg string) { 23 | fmt.Println("Debug:" + msg) 24 | } 25 | -------------------------------------------------------------------------------- /main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "log" 6 | "net" 7 | "os" 8 | "os/signal" 9 | "runtime" 10 | "syscall" 11 | "time" 12 | 13 | "github.com/harlanc/netgo/lib" 14 | "github.com/harlanc/netgo/server" 15 | ) 16 | 17 | type Callback struct{} 18 | 19 | func main() { 20 | runtime.GOMAXPROCS(runtime.NumCPU()) 21 | 22 | // creates a tcp listener 23 | tcpAddr, err := net.ResolveTCPAddr("tcp", "0.0.0.0:8686") 24 | //tcpAddr, err := net.ResolveTCPAddr("tcp", "192.168.50.236:8686") 25 | //tcpAddr, err := net.ResolveTCPAddr("tcp", "192.168.43.189:8686") 26 | checkError(err) 27 | listener, err := net.ListenTCP("tcp", tcpAddr) 28 | checkError(err) 29 | 30 | // creates a server 31 | config := &lib.Config{ 32 | PacketSendChanLimit: 2048, 33 | PacketReceiveChanLimit: 2048, 34 | } 35 | srv := lib.NewServer(config, &server.NetgoCallback{}, &server.NetgoProtocol{}) 36 | 37 | // starts service 38 | go srv.Start(listener, time.Second) 39 | fmt.Println("listening:", listener.Addr()) 40 | 41 | // catchs system signal 42 | chSig := make(chan os.Signal) 43 | signal.Notify(chSig, syscall.SIGINT, syscall.SIGTERM) 44 | fmt.Println("Signal: ", <-chSig) 45 | 46 | // stops service 47 | srv.Stop() 48 | } 49 | 50 | func checkError(err error) { 51 | if err != nil { 52 | log.Fatal(err) 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /server/ng_app_protocol.go: -------------------------------------------------------------------------------- 1 | package server 2 | 3 | import ( 4 | "encoding/binary" 5 | "errors" 6 | "fmt" 7 | "io" 8 | "net" 9 | "time" 10 | 11 | "github.com/harlanc/netgo/lib" 12 | "github.com/harlanc/netgo/logger" 13 | ) 14 | 15 | type NetgoPacket struct { 16 | length uint32 17 | body []byte 18 | } 19 | 20 | func (this *NetgoPacket) Serialize() []byte { 21 | 22 | // logger.LogInfo(lib.Uint322String(this.length)) 23 | // logger.LogInfo(string(this.body[:])) 24 | rv := make([]byte, 4+len(this.body)) 25 | copy(rv, lib.Uint322ByteArray(this.length)) 26 | 27 | //https://www.golangprograms.com/different-ways-to-convert-byte-array-into-string.html 28 | //logger.LogInfo(string(rv[:])) 29 | copy(rv[4:], this.body) 30 | //logger.LogInfo(string(rv[:])) 31 | return rv 32 | } 33 | 34 | // func (this *NetgoPacket) GetLength() uint32 { 35 | // return binary.BigEndian.Uint32(this.buff[0:4]) 36 | // } 37 | 38 | func (this *NetgoPacket) GetBody() []byte { 39 | return this.body 40 | } 41 | 42 | func NewNetgoPacket(len uint32, buff []byte) *NetgoPacket { 43 | p := &NetgoPacket{} 44 | 45 | p.length = len 46 | p.body = make([]byte, len) 47 | copy(p.body, buff) 48 | return p 49 | } 50 | 51 | type NetgoProtocol struct { 52 | } 53 | 54 | //ReadPacket read the packet from network 55 | func (protocol *NetgoProtocol) ReadPacket(conn *net.TCPConn) (lib.Packet, error) { 56 | var ( 57 | lengthBytes []byte = make([]byte, 4) 58 | length uint32 59 | ) 60 | 61 | // read length 62 | 63 | conn.SetReadDeadline(time.Now().Add(120 * time.Second)) 64 | 65 | if _, err := io.ReadFull(conn, lengthBytes); err != nil { 66 | return nil, err 67 | } 68 | 69 | if length = binary.LittleEndian.Uint32(lengthBytes); length > 2048 { 70 | return nil, errors.New("the size of packet is larger than the limit" + lib.Uint322String(length)) 71 | } 72 | 73 | body := make([]byte, length) 74 | // copy(buff[0:4], lengthBytes) 75 | 76 | // read body ( buff = lengthBytes + body ) 77 | if _, err := io.ReadFull(conn, body); err != nil { 78 | return nil, err 79 | } 80 | 81 | return NewNetgoPacket(length, body), nil 82 | } 83 | 84 | //NetgoCallback struct 85 | type NetgoCallback struct { 86 | } 87 | 88 | //OnConnect connect 89 | func (callback *NetgoCallback) OnConnect(c *lib.Conn) bool { 90 | addr := c.GetRawConn().RemoteAddr() 91 | c.PutExtraData(addr) 92 | fmt.Println("OnConnect:", addr) 93 | peer := &Peer{Conn: c} 94 | var resssmsg ResponseSocketStatusMessage = ResponseSocketStatusMessage{} 95 | resssmsg.SStatus = SocketStatus_Connected 96 | 97 | var receivemsg ReceiveMessage = ReceiveMessage{} 98 | receivemsg.ReceiveMsgType = ReceiveMessageType_ResponseSocketStatus 99 | receivemsg.RssMsg = &resssmsg 100 | peer.AsyncWriteMessage(&receivemsg) 101 | //c.AsyncWritePacket(NewTelnetPacket("unknow", []byte("Welcome to this Telnet Server")), 0) 102 | return true 103 | } 104 | 105 | //OnMessage on message 106 | func (callback *NetgoCallback) OnMessage(c *lib.Conn, p lib.Packet) bool { 107 | packet := p.(*NetgoPacket) 108 | 109 | var peer *Peer 110 | if c.PeerID == 0 { 111 | peer = &Peer{Conn: c} 112 | } else { 113 | 114 | var err error 115 | 116 | err, peer = _server.GetPeer(c.RoomID, c.PeerID) 117 | if err != nil { 118 | logger.LogError(err.Error()) 119 | return false 120 | } 121 | 122 | } 123 | 124 | status := peer.HandMessage(packet) 125 | 126 | var resmsg ResponseOperationMessage 127 | 128 | switch status { 129 | case CreateRoomSuccess: 130 | params := CreateRoomResponseParams{ReturnValue: uint32(CreateRoomSuccess), PeerId: peer.ID} 131 | resmsg = ResponseOperationMessage{MsgType: MessageType_CreateRoom, CrrParams: ¶ms} 132 | case CreateRoomAlreadyExist: 133 | params := CreateRoomResponseParams{ReturnValue: uint32(CreateRoomAlreadyExist)} 134 | resmsg = ResponseOperationMessage{MsgType: MessageType_CreateRoom, CrrParams: ¶ms} 135 | case JoinRoomAlreadyInRoom: 136 | params := JoinRoomResponseParams{ReturnValue: uint32(JoinRoomAlreadyInRoom)} 137 | resmsg = ResponseOperationMessage{MsgType: MessageType_JoinRoom, JrrParams: ¶ms} 138 | case JoinRoomFull: 139 | params := JoinRoomResponseParams{ReturnValue: uint32(JoinRoomFull)} 140 | resmsg = ResponseOperationMessage{MsgType: MessageType_JoinRoom, JrrParams: ¶ms} 141 | case JoinRoomNotExist: 142 | params := JoinRoomResponseParams{ReturnValue: uint32(JoinRoomNotExist)} 143 | resmsg = ResponseOperationMessage{MsgType: MessageType_JoinRoom, JrrParams: ¶ms} 144 | case JoinRoomSuccess: 145 | params := JoinRoomResponseParams{ReturnValue: uint32(JoinRoomSuccess), PeerId: peer.ID} 146 | resmsg = ResponseOperationMessage{MsgType: MessageType_JoinRoom, JrrParams: ¶ms} 147 | case LeaveRoomSuccess: 148 | params := LeaveRoomResponseParams{ReturnValue: uint32(LeaveRoomSuccess), PeerId: peer.ID} 149 | resmsg = ResponseOperationMessage{MsgType: MessageType_LeaveRoom, LrrParams: ¶ms} 150 | 151 | default: 152 | return true 153 | 154 | } 155 | 156 | var receivemsg ReceiveMessage = ReceiveMessage{} 157 | receivemsg.ReceiveMsgType = ReceiveMessageType_ResponseOperation 158 | receivemsg.RoMsg = &resmsg 159 | 160 | var rv = peer.AsyncWriteMessage(&receivemsg) 161 | if rv != nil { 162 | logger.LogError("AsyncWriteMessage error" + rv.Error()) 163 | return false 164 | } 165 | 166 | return true 167 | } 168 | 169 | //OnClose on close 170 | func (callback *NetgoCallback) OnClose(c *lib.Conn) { 171 | 172 | room, err := _server.GetRoom(c.RoomID) 173 | if err == nil { 174 | err, peer := room.GetPeer(c.PeerID) 175 | if err != nil { 176 | logger.LogError(err.Error()) 177 | //return 178 | } 179 | peer.LeaveRoom() 180 | } else { 181 | logger.LogError(err.Error()) 182 | //return 183 | } 184 | 185 | fmt.Println("OnClose:", c.GetExtraData()) 186 | } 187 | -------------------------------------------------------------------------------- /server/ng_game_server.go: -------------------------------------------------------------------------------- 1 | package server 2 | 3 | import ( 4 | "container/heap" 5 | "errors" 6 | "strings" 7 | "sync" 8 | 9 | "github.com/harlanc/netgo/lib" 10 | ) 11 | 12 | //MsgChannel message channels 13 | type MsgChannel struct { 14 | ID uint32 15 | //peer ids that the current channel is subscribed 16 | PeerIds map[uint32]struct{} 17 | //test sync.Map[int]string 18 | } 19 | 20 | //NewMsgChannel new a MsgChannel 21 | func NewMsgChannel(id uint32) *MsgChannel { 22 | channel := MsgChannel{ID: id, PeerIds: make(map[uint32]struct{})} 23 | return &channel 24 | } 25 | 26 | //GameServer struct 27 | type GameServer struct { 28 | ID string 29 | PeerCount int 30 | //A map from Room Id to Room 31 | ID2Room map[string]*Room 32 | //add mux for server 33 | RoomIDMux sync.RWMutex 34 | } 35 | 36 | //GetRoom get room from server 37 | func (server *GameServer) GetRoom(roomid string) (*Room, error) { 38 | 39 | server.RoomIDMux.RLock() 40 | defer func() { 41 | server.RoomIDMux.RUnlock() 42 | }() 43 | 44 | if server.ID2Room != nil { 45 | if room, ok := server.ID2Room[roomid]; ok { 46 | return room, nil 47 | } 48 | 49 | } 50 | 51 | return nil, errors.New("No room with ID" + roomid + " exists!") 52 | 53 | } 54 | 55 | func (server *GameServer) IsRoomExist(roomid string) bool { 56 | 57 | server.RoomIDMux.RLock() 58 | defer func() { 59 | server.RoomIDMux.RUnlock() 60 | }() 61 | 62 | if _, ok := server.ID2Room[roomid]; ok { 63 | return true 64 | } 65 | 66 | return false 67 | 68 | } 69 | 70 | func (server *GameServer) AddRoom(room *Room) { 71 | 72 | server.RoomIDMux.Lock() 73 | defer func() { 74 | server.RoomIDMux.Unlock() 75 | }() 76 | 77 | server.ID2Room[room.ID] = room 78 | 79 | } 80 | 81 | func (server *GameServer) DeleteRoom(roomid string) { 82 | 83 | server.RoomIDMux.Lock() 84 | defer func() { 85 | server.RoomIDMux.Unlock() 86 | }() 87 | 88 | delete(server.ID2Room, roomid) 89 | } 90 | 91 | func (server *GameServer) GetPeer(roomid string, peerid uint32) (error, *Peer) { 92 | room, err := server.GetRoom(roomid) 93 | if err != nil { 94 | return err, nil 95 | } 96 | 97 | err, peer := room.GetPeer(peerid) 98 | if err != nil { 99 | return err, nil 100 | } 101 | return nil, peer 102 | 103 | } 104 | 105 | var _server GameServer = GameServer{ID: "test", RoomIDMux: sync.RWMutex{}, ID2Room: map[string]*Room{}} 106 | 107 | //Room Struct 108 | type Room struct { 109 | ID string 110 | MaxNumber uint32 111 | // A room can contain serval channels,and a client can listen to these channels,then it will 112 | // receive messages from these listened channels,channel 0 is a default channel which all the clients will 113 | // listen to. 114 | ID2MsgChannel map[uint32]*MsgChannel 115 | //Protect MsgChannel 116 | MsgChannelMux sync.RWMutex 117 | //A map from Peer Id to Peer 118 | ID2Peer map[uint32]*Peer 119 | //PeerMux protect the PeerIDPool 120 | PeerMux sync.RWMutex 121 | //PeerIDPool here we use a heap to store all the peer ids for a room, 122 | //we can get the smallest peer id when a new peer joins the room by 123 | //calling the func GetPeerID. 124 | PeerIDPool *lib.IntHeap 125 | } 126 | 127 | //GetAllSubscribePeers get all the subscribe peers 128 | func (room *Room) GetAllSubscribePeers(sendToChannelsIds []uint32) []*Peer { 129 | 130 | var peers []*Peer 131 | 132 | if len(sendToChannelsIds) == 0 { 133 | return room.GetAllPeers() 134 | } 135 | 136 | room.MsgChannelMux.RLock() 137 | defer func() { 138 | room.MsgChannelMux.RUnlock() 139 | }() 140 | 141 | var peerids map[uint32]struct{} = make(map[uint32]struct{}) 142 | 143 | for _, i := range sendToChannelsIds { 144 | for v := range room.ID2MsgChannel[i].PeerIds { 145 | if _, ok := peerids[v]; !ok { 146 | peerids[v] = struct{}{} 147 | _, peer := room.GetPeer(v) 148 | peers = append(peers, peer) 149 | } 150 | } 151 | } 152 | 153 | return peers 154 | } 155 | 156 | //SubscribeChannel a peer subscribe a channel 157 | func (room *Room) SubscribeChannel(channelid uint32, peerid uint32) { 158 | 159 | room.MsgChannelMux.Lock() 160 | defer func() { 161 | room.MsgChannelMux.Unlock() 162 | }() 163 | 164 | if channel, ok := room.ID2MsgChannel[channelid]; ok { 165 | channel.PeerIds[peerid] = struct{}{} 166 | } else { 167 | //create a new channel and subscribe 168 | newchannel := NewMsgChannel(channelid) 169 | newchannel.PeerIds[peerid] = struct{}{} 170 | room.ID2MsgChannel[channelid] = newchannel 171 | } 172 | } 173 | 174 | //UnSubscribeChannel a peer unsubscribe a channel 175 | func (room *Room) UnSubscribeChannel(channelid uint32, peerid uint32) { 176 | 177 | room.MsgChannelMux.Lock() 178 | defer func() { 179 | room.MsgChannelMux.Unlock() 180 | }() 181 | 182 | if channel, ok := room.ID2MsgChannel[channelid]; ok { 183 | delete(channel.PeerIds, peerid) 184 | } 185 | } 186 | 187 | //UnSubscribeAllChannels when a peer left room,this operation will be called 188 | func (room *Room) UnSubscribeAllChannels(peerid uint32) { 189 | 190 | room.MsgChannelMux.Lock() 191 | defer func() { 192 | room.MsgChannelMux.Unlock() 193 | }() 194 | 195 | for _, v := range room.ID2MsgChannel { 196 | if _, ok := v.PeerIds[peerid]; ok { 197 | delete(v.PeerIds, peerid) 198 | } 199 | } 200 | } 201 | 202 | //GetPeersCount get the peer count in the room 203 | func (room *Room) GetPeersCount() int { 204 | 205 | room.MsgChannelMux.RLock() 206 | defer func() { 207 | room.MsgChannelMux.RUnlock() 208 | }() 209 | 210 | return len(room.ID2Peer) 211 | } 212 | 213 | //GetAllPeers get all the peers from the specified room 214 | func (room *Room) GetAllPeers() []*Peer { 215 | 216 | room.PeerMux.RLock() 217 | defer func() { 218 | room.PeerMux.RUnlock() 219 | }() 220 | 221 | var peers []*Peer 222 | 223 | for _, v := range room.ID2Peer { 224 | peers = append(peers, v) 225 | } 226 | return peers 227 | 228 | } 229 | 230 | //GetPeer get a specified peer 231 | func (room *Room) GetPeer(peerid uint32) (error, *Peer) { 232 | 233 | room.PeerMux.RLock() 234 | defer func() { 235 | room.PeerMux.RUnlock() 236 | }() 237 | 238 | if peer, ok := room.ID2Peer[peerid]; ok { 239 | return nil, peer 240 | } 241 | 242 | return errors.New("No peer with ID" + lib.Uint322String(peerid) + " exists!"), nil 243 | 244 | } 245 | 246 | //AddPeer return the smallest peer id from the heap and then re-establish the heap. 247 | func (room *Room) AddPeer(peer *Peer) { 248 | 249 | room.PeerMux.Lock() 250 | defer func() { 251 | room.PeerMux.Unlock() 252 | }() 253 | peerid := room.PeerIDPool.Pop() 254 | peer.ID = peerid.(uint32) 255 | 256 | room.ID2Peer[peer.ID] = peer 257 | peer.RoomID = room.ID 258 | peer.Conn.RoomID = room.ID 259 | peer.Conn.PeerID = peer.ID 260 | } 261 | 262 | //DeletePeer release the peer ID when someone leaves the room. 263 | //push the peerid back to the heap. 264 | func (room *Room) DeletePeer(peer *Peer) { 265 | 266 | room.PeerMux.Lock() 267 | defer func() { 268 | room.PeerMux.Unlock() 269 | }() 270 | peer.Conn.PeerID = 0 271 | heap.Push(room.PeerIDPool, peer.ID) 272 | delete(room.ID2Peer, peer.ID) 273 | } 274 | 275 | //NewRoom instantiation a room 276 | func NewRoom(id string, maxnumber uint32) *Room { 277 | 278 | idPool := &lib.IntHeap{} 279 | for i := uint32(1); i <= maxnumber; i++ { 280 | idPool.Push(i) 281 | } 282 | heap.Init(idPool) 283 | 284 | room := Room{ID: id, MaxNumber: maxnumber, PeerMux: sync.RWMutex{}, PeerIDPool: idPool, ID2Peer: map[uint32]*Peer{}, MsgChannelMux: sync.RWMutex{}} 285 | return &room 286 | } 287 | 288 | //EmptyString a empty string 289 | const EmptyString string = "" 290 | 291 | //GetPeerWorldID Peer world id equals gameid + Peerid,used for communication between 292 | //rooms from different game servers 293 | func (game *GameServer) GetPeerWorldID(peer Peer) string { 294 | return strings.Join([]string{game.ID}, lib.Uint322String(peer.ID)) 295 | } 296 | -------------------------------------------------------------------------------- /server/ng_lobby_server.go: -------------------------------------------------------------------------------- 1 | package server 2 | 3 | type Lobby struct { 4 | Lobbyname string 5 | Gamelist []GameServer 6 | } 7 | 8 | type LobbyOperations interface { 9 | JoinLobby() 10 | GetGameServers() []GameServer 11 | } 12 | 13 | //join a lobby 14 | func (lobby *Lobby) JoinLobby() { 15 | 16 | } 17 | 18 | func (lobby *Lobby) GetGameServers() []GameServer { 19 | 20 | return lobby.Gamelist 21 | 22 | } 23 | -------------------------------------------------------------------------------- /server/ng_master_server.go: -------------------------------------------------------------------------------- 1 | package server 2 | -------------------------------------------------------------------------------- /server/ng_message.pb.go: -------------------------------------------------------------------------------- 1 | // Code generated by protoc-gen-go. DO NOT EDIT. 2 | // source: ng_message.proto 3 | 4 | //package Netgo.Library; 5 | 6 | package server 7 | 8 | import ( 9 | fmt "fmt" 10 | proto "github.com/golang/protobuf/proto" 11 | math "math" 12 | ) 13 | 14 | // Reference imports to suppress errors if they are not otherwise used. 15 | var _ = proto.Marshal 16 | var _ = fmt.Errorf 17 | var _ = math.Inf 18 | 19 | // This is a compile-time assertion to ensure that this generated file 20 | // is compatible with the proto package it is being compiled against. 21 | // A compilation error at this line likely means your copy of the 22 | // proto package needs to be updated. 23 | const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package 24 | 25 | type MessageType int32 26 | 27 | const ( 28 | MessageType_JoinLobby MessageType = 0 29 | MessageType_LeaveLobby MessageType = 1 30 | MessageType_CreateRoom MessageType = 2 31 | MessageType_JoinRoom MessageType = 3 32 | MessageType_JoinOrCreateRoom MessageType = 4 33 | MessageType_LeaveRoom MessageType = 5 34 | MessageType_RPC MessageType = 6 35 | MessageType_Instantiation MessageType = 7 36 | MessageType_ViewSync MessageType = 8 37 | MessageType_CustomEvent MessageType = 9 38 | MessageType_SubscribeMsgChannels MessageType = 10 39 | MessageType_UnSubscribeMsgChannels MessageType = 11 40 | ) 41 | 42 | var MessageType_name = map[int32]string{ 43 | 0: "JoinLobby", 44 | 1: "LeaveLobby", 45 | 2: "CreateRoom", 46 | 3: "JoinRoom", 47 | 4: "JoinOrCreateRoom", 48 | 5: "LeaveRoom", 49 | 6: "RPC", 50 | 7: "Instantiation", 51 | 8: "ViewSync", 52 | 9: "CustomEvent", 53 | 10: "SubscribeMsgChannels", 54 | 11: "UnSubscribeMsgChannels", 55 | } 56 | 57 | var MessageType_value = map[string]int32{ 58 | "JoinLobby": 0, 59 | "LeaveLobby": 1, 60 | "CreateRoom": 2, 61 | "JoinRoom": 3, 62 | "JoinOrCreateRoom": 4, 63 | "LeaveRoom": 5, 64 | "RPC": 6, 65 | "Instantiation": 7, 66 | "ViewSync": 8, 67 | "CustomEvent": 9, 68 | "SubscribeMsgChannels": 10, 69 | "UnSubscribeMsgChannels": 11, 70 | } 71 | 72 | func (x MessageType) String() string { 73 | return proto.EnumName(MessageType_name, int32(x)) 74 | } 75 | 76 | func (MessageType) EnumDescriptor() ([]byte, []int) { 77 | return fileDescriptor_ff7f458fcc31b586, []int{0} 78 | } 79 | 80 | type CacheOptions int32 81 | 82 | const ( 83 | CacheOptions_AddToRoomCache CacheOptions = 0 84 | CacheOptions_RemoveFromRoomCache CacheOptions = 1 85 | ) 86 | 87 | var CacheOptions_name = map[int32]string{ 88 | 0: "AddToRoomCache", 89 | 1: "RemoveFromRoomCache", 90 | } 91 | 92 | var CacheOptions_value = map[string]int32{ 93 | "AddToRoomCache": 0, 94 | "RemoveFromRoomCache": 1, 95 | } 96 | 97 | func (x CacheOptions) String() string { 98 | return proto.EnumName(CacheOptions_name, int32(x)) 99 | } 100 | 101 | func (CacheOptions) EnumDescriptor() ([]byte, []int) { 102 | return fileDescriptor_ff7f458fcc31b586, []int{1} 103 | } 104 | 105 | //event relvelant structs 106 | type RPCTarget int32 107 | 108 | const ( 109 | RPCTarget_All RPCTarget = 0 110 | RPCTarget_Others RPCTarget = 1 111 | ) 112 | 113 | var RPCTarget_name = map[int32]string{ 114 | 0: "All", 115 | 1: "Others", 116 | } 117 | 118 | var RPCTarget_value = map[string]int32{ 119 | "All": 0, 120 | "Others": 1, 121 | } 122 | 123 | func (x RPCTarget) String() string { 124 | return proto.EnumName(RPCTarget_name, int32(x)) 125 | } 126 | 127 | func (RPCTarget) EnumDescriptor() ([]byte, []int) { 128 | return fileDescriptor_ff7f458fcc31b586, []int{2} 129 | } 130 | 131 | type SocketStatus int32 132 | 133 | const ( 134 | SocketStatus_Disconnected SocketStatus = 0 135 | SocketStatus_Connected SocketStatus = 1 136 | ) 137 | 138 | var SocketStatus_name = map[int32]string{ 139 | 0: "Disconnected", 140 | 1: "Connected", 141 | } 142 | 143 | var SocketStatus_value = map[string]int32{ 144 | "Disconnected": 0, 145 | "Connected": 1, 146 | } 147 | 148 | func (x SocketStatus) String() string { 149 | return proto.EnumName(SocketStatus_name, int32(x)) 150 | } 151 | 152 | func (SocketStatus) EnumDescriptor() ([]byte, []int) { 153 | return fileDescriptor_ff7f458fcc31b586, []int{3} 154 | } 155 | 156 | type ReceiveMessageType int32 157 | 158 | const ( 159 | ReceiveMessageType_ResponseSocketStatus ReceiveMessageType = 0 160 | ReceiveMessageType_ResponseOperation ReceiveMessageType = 1 161 | ReceiveMessageType_Forward ReceiveMessageType = 2 162 | ) 163 | 164 | var ReceiveMessageType_name = map[int32]string{ 165 | 0: "ResponseSocketStatus", 166 | 1: "ResponseOperation", 167 | 2: "Forward", 168 | } 169 | 170 | var ReceiveMessageType_value = map[string]int32{ 171 | "ResponseSocketStatus": 0, 172 | "ResponseOperation": 1, 173 | "Forward": 2, 174 | } 175 | 176 | func (x ReceiveMessageType) String() string { 177 | return proto.EnumName(ReceiveMessageType_name, int32(x)) 178 | } 179 | 180 | func (ReceiveMessageType) EnumDescriptor() ([]byte, []int) { 181 | return fileDescriptor_ff7f458fcc31b586, []int{4} 182 | } 183 | 184 | //the NGAny is a union,only one type is set 185 | type NGAny struct { 186 | // Types that are valid to be assigned to NgType: 187 | // *NGAny_NgDouble 188 | // *NGAny_NgFloat 189 | // *NGAny_NgInt32 190 | // *NGAny_NgInt64 191 | // *NGAny_NgUint32 192 | // *NGAny_NgUint64 193 | // *NGAny_NgSint32 194 | // *NGAny_NgSint64 195 | // *NGAny_NgFixed32 196 | // *NGAny_NgFixed64 197 | // *NGAny_NgSfixed32 198 | // *NGAny_NgSfixed64 199 | // *NGAny_NgBool 200 | // *NGAny_NgString 201 | // *NGAny_NgBytes 202 | // *NGAny_NgVector3 203 | // *NGAny_NgQuaternion 204 | // *NGAny_NgColor 205 | NgType isNGAny_NgType `protobuf_oneof:"ngType"` 206 | XXX_NoUnkeyedLiteral struct{} `json:"-"` 207 | XXX_unrecognized []byte `json:"-"` 208 | XXX_sizecache int32 `json:"-"` 209 | } 210 | 211 | func (m *NGAny) Reset() { *m = NGAny{} } 212 | func (m *NGAny) String() string { return proto.CompactTextString(m) } 213 | func (*NGAny) ProtoMessage() {} 214 | func (*NGAny) Descriptor() ([]byte, []int) { 215 | return fileDescriptor_ff7f458fcc31b586, []int{0} 216 | } 217 | 218 | func (m *NGAny) XXX_Unmarshal(b []byte) error { 219 | return xxx_messageInfo_NGAny.Unmarshal(m, b) 220 | } 221 | func (m *NGAny) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 222 | return xxx_messageInfo_NGAny.Marshal(b, m, deterministic) 223 | } 224 | func (m *NGAny) XXX_Merge(src proto.Message) { 225 | xxx_messageInfo_NGAny.Merge(m, src) 226 | } 227 | func (m *NGAny) XXX_Size() int { 228 | return xxx_messageInfo_NGAny.Size(m) 229 | } 230 | func (m *NGAny) XXX_DiscardUnknown() { 231 | xxx_messageInfo_NGAny.DiscardUnknown(m) 232 | } 233 | 234 | var xxx_messageInfo_NGAny proto.InternalMessageInfo 235 | 236 | type isNGAny_NgType interface { 237 | isNGAny_NgType() 238 | } 239 | 240 | type NGAny_NgDouble struct { 241 | NgDouble float64 `protobuf:"fixed64,11,opt,name=ngDouble,proto3,oneof"` 242 | } 243 | 244 | type NGAny_NgFloat struct { 245 | NgFloat float32 `protobuf:"fixed32,12,opt,name=ngFloat,proto3,oneof"` 246 | } 247 | 248 | type NGAny_NgInt32 struct { 249 | NgInt32 int32 `protobuf:"varint,13,opt,name=ngInt32,proto3,oneof"` 250 | } 251 | 252 | type NGAny_NgInt64 struct { 253 | NgInt64 int64 `protobuf:"varint,14,opt,name=ngInt64,proto3,oneof"` 254 | } 255 | 256 | type NGAny_NgUint32 struct { 257 | NgUint32 uint32 `protobuf:"varint,15,opt,name=ngUint32,proto3,oneof"` 258 | } 259 | 260 | type NGAny_NgUint64 struct { 261 | NgUint64 uint64 `protobuf:"varint,16,opt,name=ngUint64,proto3,oneof"` 262 | } 263 | 264 | type NGAny_NgSint32 struct { 265 | NgSint32 int32 `protobuf:"zigzag32,17,opt,name=ngSint32,proto3,oneof"` 266 | } 267 | 268 | type NGAny_NgSint64 struct { 269 | NgSint64 int64 `protobuf:"zigzag64,18,opt,name=ngSint64,proto3,oneof"` 270 | } 271 | 272 | type NGAny_NgFixed32 struct { 273 | NgFixed32 uint32 `protobuf:"fixed32,19,opt,name=ngFixed32,proto3,oneof"` 274 | } 275 | 276 | type NGAny_NgFixed64 struct { 277 | NgFixed64 uint64 `protobuf:"fixed64,20,opt,name=ngFixed64,proto3,oneof"` 278 | } 279 | 280 | type NGAny_NgSfixed32 struct { 281 | NgSfixed32 int32 `protobuf:"fixed32,21,opt,name=ngSfixed32,proto3,oneof"` 282 | } 283 | 284 | type NGAny_NgSfixed64 struct { 285 | NgSfixed64 int64 `protobuf:"fixed64,22,opt,name=ngSfixed64,proto3,oneof"` 286 | } 287 | 288 | type NGAny_NgBool struct { 289 | NgBool bool `protobuf:"varint,23,opt,name=ngBool,proto3,oneof"` 290 | } 291 | 292 | type NGAny_NgString struct { 293 | NgString string `protobuf:"bytes,24,opt,name=ngString,proto3,oneof"` 294 | } 295 | 296 | type NGAny_NgBytes struct { 297 | NgBytes []byte `protobuf:"bytes,25,opt,name=ngBytes,proto3,oneof"` 298 | } 299 | 300 | type NGAny_NgVector3 struct { 301 | NgVector3 *NGVector3 `protobuf:"bytes,31,opt,name=ngVector3,proto3,oneof"` 302 | } 303 | 304 | type NGAny_NgQuaternion struct { 305 | NgQuaternion *NGQuaternion `protobuf:"bytes,32,opt,name=ngQuaternion,proto3,oneof"` 306 | } 307 | 308 | type NGAny_NgColor struct { 309 | NgColor *NGColor `protobuf:"bytes,33,opt,name=ngColor,proto3,oneof"` 310 | } 311 | 312 | func (*NGAny_NgDouble) isNGAny_NgType() {} 313 | 314 | func (*NGAny_NgFloat) isNGAny_NgType() {} 315 | 316 | func (*NGAny_NgInt32) isNGAny_NgType() {} 317 | 318 | func (*NGAny_NgInt64) isNGAny_NgType() {} 319 | 320 | func (*NGAny_NgUint32) isNGAny_NgType() {} 321 | 322 | func (*NGAny_NgUint64) isNGAny_NgType() {} 323 | 324 | func (*NGAny_NgSint32) isNGAny_NgType() {} 325 | 326 | func (*NGAny_NgSint64) isNGAny_NgType() {} 327 | 328 | func (*NGAny_NgFixed32) isNGAny_NgType() {} 329 | 330 | func (*NGAny_NgFixed64) isNGAny_NgType() {} 331 | 332 | func (*NGAny_NgSfixed32) isNGAny_NgType() {} 333 | 334 | func (*NGAny_NgSfixed64) isNGAny_NgType() {} 335 | 336 | func (*NGAny_NgBool) isNGAny_NgType() {} 337 | 338 | func (*NGAny_NgString) isNGAny_NgType() {} 339 | 340 | func (*NGAny_NgBytes) isNGAny_NgType() {} 341 | 342 | func (*NGAny_NgVector3) isNGAny_NgType() {} 343 | 344 | func (*NGAny_NgQuaternion) isNGAny_NgType() {} 345 | 346 | func (*NGAny_NgColor) isNGAny_NgType() {} 347 | 348 | func (m *NGAny) GetNgType() isNGAny_NgType { 349 | if m != nil { 350 | return m.NgType 351 | } 352 | return nil 353 | } 354 | 355 | func (m *NGAny) GetNgDouble() float64 { 356 | if x, ok := m.GetNgType().(*NGAny_NgDouble); ok { 357 | return x.NgDouble 358 | } 359 | return 0 360 | } 361 | 362 | func (m *NGAny) GetNgFloat() float32 { 363 | if x, ok := m.GetNgType().(*NGAny_NgFloat); ok { 364 | return x.NgFloat 365 | } 366 | return 0 367 | } 368 | 369 | func (m *NGAny) GetNgInt32() int32 { 370 | if x, ok := m.GetNgType().(*NGAny_NgInt32); ok { 371 | return x.NgInt32 372 | } 373 | return 0 374 | } 375 | 376 | func (m *NGAny) GetNgInt64() int64 { 377 | if x, ok := m.GetNgType().(*NGAny_NgInt64); ok { 378 | return x.NgInt64 379 | } 380 | return 0 381 | } 382 | 383 | func (m *NGAny) GetNgUint32() uint32 { 384 | if x, ok := m.GetNgType().(*NGAny_NgUint32); ok { 385 | return x.NgUint32 386 | } 387 | return 0 388 | } 389 | 390 | func (m *NGAny) GetNgUint64() uint64 { 391 | if x, ok := m.GetNgType().(*NGAny_NgUint64); ok { 392 | return x.NgUint64 393 | } 394 | return 0 395 | } 396 | 397 | func (m *NGAny) GetNgSint32() int32 { 398 | if x, ok := m.GetNgType().(*NGAny_NgSint32); ok { 399 | return x.NgSint32 400 | } 401 | return 0 402 | } 403 | 404 | func (m *NGAny) GetNgSint64() int64 { 405 | if x, ok := m.GetNgType().(*NGAny_NgSint64); ok { 406 | return x.NgSint64 407 | } 408 | return 0 409 | } 410 | 411 | func (m *NGAny) GetNgFixed32() uint32 { 412 | if x, ok := m.GetNgType().(*NGAny_NgFixed32); ok { 413 | return x.NgFixed32 414 | } 415 | return 0 416 | } 417 | 418 | func (m *NGAny) GetNgFixed64() uint64 { 419 | if x, ok := m.GetNgType().(*NGAny_NgFixed64); ok { 420 | return x.NgFixed64 421 | } 422 | return 0 423 | } 424 | 425 | func (m *NGAny) GetNgSfixed32() int32 { 426 | if x, ok := m.GetNgType().(*NGAny_NgSfixed32); ok { 427 | return x.NgSfixed32 428 | } 429 | return 0 430 | } 431 | 432 | func (m *NGAny) GetNgSfixed64() int64 { 433 | if x, ok := m.GetNgType().(*NGAny_NgSfixed64); ok { 434 | return x.NgSfixed64 435 | } 436 | return 0 437 | } 438 | 439 | func (m *NGAny) GetNgBool() bool { 440 | if x, ok := m.GetNgType().(*NGAny_NgBool); ok { 441 | return x.NgBool 442 | } 443 | return false 444 | } 445 | 446 | func (m *NGAny) GetNgString() string { 447 | if x, ok := m.GetNgType().(*NGAny_NgString); ok { 448 | return x.NgString 449 | } 450 | return "" 451 | } 452 | 453 | func (m *NGAny) GetNgBytes() []byte { 454 | if x, ok := m.GetNgType().(*NGAny_NgBytes); ok { 455 | return x.NgBytes 456 | } 457 | return nil 458 | } 459 | 460 | func (m *NGAny) GetNgVector3() *NGVector3 { 461 | if x, ok := m.GetNgType().(*NGAny_NgVector3); ok { 462 | return x.NgVector3 463 | } 464 | return nil 465 | } 466 | 467 | func (m *NGAny) GetNgQuaternion() *NGQuaternion { 468 | if x, ok := m.GetNgType().(*NGAny_NgQuaternion); ok { 469 | return x.NgQuaternion 470 | } 471 | return nil 472 | } 473 | 474 | func (m *NGAny) GetNgColor() *NGColor { 475 | if x, ok := m.GetNgType().(*NGAny_NgColor); ok { 476 | return x.NgColor 477 | } 478 | return nil 479 | } 480 | 481 | // XXX_OneofWrappers is for the internal use of the proto package. 482 | func (*NGAny) XXX_OneofWrappers() []interface{} { 483 | return []interface{}{ 484 | (*NGAny_NgDouble)(nil), 485 | (*NGAny_NgFloat)(nil), 486 | (*NGAny_NgInt32)(nil), 487 | (*NGAny_NgInt64)(nil), 488 | (*NGAny_NgUint32)(nil), 489 | (*NGAny_NgUint64)(nil), 490 | (*NGAny_NgSint32)(nil), 491 | (*NGAny_NgSint64)(nil), 492 | (*NGAny_NgFixed32)(nil), 493 | (*NGAny_NgFixed64)(nil), 494 | (*NGAny_NgSfixed32)(nil), 495 | (*NGAny_NgSfixed64)(nil), 496 | (*NGAny_NgBool)(nil), 497 | (*NGAny_NgString)(nil), 498 | (*NGAny_NgBytes)(nil), 499 | (*NGAny_NgVector3)(nil), 500 | (*NGAny_NgQuaternion)(nil), 501 | (*NGAny_NgColor)(nil), 502 | } 503 | } 504 | 505 | type CommonOptions struct { 506 | SendToChannelIds []uint32 `protobuf:"varint,1,rep,packed,name=sendToChannelIds,proto3" json:"sendToChannelIds,omitempty"` 507 | CacheOptions CacheOptions `protobuf:"varint,2,opt,name=cacheOptions,proto3,enum=server.CacheOptions" json:"cacheOptions,omitempty"` 508 | XXX_NoUnkeyedLiteral struct{} `json:"-"` 509 | XXX_unrecognized []byte `json:"-"` 510 | XXX_sizecache int32 `json:"-"` 511 | } 512 | 513 | func (m *CommonOptions) Reset() { *m = CommonOptions{} } 514 | func (m *CommonOptions) String() string { return proto.CompactTextString(m) } 515 | func (*CommonOptions) ProtoMessage() {} 516 | func (*CommonOptions) Descriptor() ([]byte, []int) { 517 | return fileDescriptor_ff7f458fcc31b586, []int{1} 518 | } 519 | 520 | func (m *CommonOptions) XXX_Unmarshal(b []byte) error { 521 | return xxx_messageInfo_CommonOptions.Unmarshal(m, b) 522 | } 523 | func (m *CommonOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 524 | return xxx_messageInfo_CommonOptions.Marshal(b, m, deterministic) 525 | } 526 | func (m *CommonOptions) XXX_Merge(src proto.Message) { 527 | xxx_messageInfo_CommonOptions.Merge(m, src) 528 | } 529 | func (m *CommonOptions) XXX_Size() int { 530 | return xxx_messageInfo_CommonOptions.Size(m) 531 | } 532 | func (m *CommonOptions) XXX_DiscardUnknown() { 533 | xxx_messageInfo_CommonOptions.DiscardUnknown(m) 534 | } 535 | 536 | var xxx_messageInfo_CommonOptions proto.InternalMessageInfo 537 | 538 | func (m *CommonOptions) GetSendToChannelIds() []uint32 { 539 | if m != nil { 540 | return m.SendToChannelIds 541 | } 542 | return nil 543 | } 544 | 545 | func (m *CommonOptions) GetCacheOptions() CacheOptions { 546 | if m != nil { 547 | return m.CacheOptions 548 | } 549 | return CacheOptions_AddToRoomCache 550 | } 551 | 552 | type CreateRoomParams struct { 553 | RoomId string `protobuf:"bytes,1,opt,name=roomId,proto3" json:"roomId,omitempty"` 554 | MaxNumber uint32 `protobuf:"varint,2,opt,name=maxNumber,proto3" json:"maxNumber,omitempty"` 555 | XXX_NoUnkeyedLiteral struct{} `json:"-"` 556 | XXX_unrecognized []byte `json:"-"` 557 | XXX_sizecache int32 `json:"-"` 558 | } 559 | 560 | func (m *CreateRoomParams) Reset() { *m = CreateRoomParams{} } 561 | func (m *CreateRoomParams) String() string { return proto.CompactTextString(m) } 562 | func (*CreateRoomParams) ProtoMessage() {} 563 | func (*CreateRoomParams) Descriptor() ([]byte, []int) { 564 | return fileDescriptor_ff7f458fcc31b586, []int{2} 565 | } 566 | 567 | func (m *CreateRoomParams) XXX_Unmarshal(b []byte) error { 568 | return xxx_messageInfo_CreateRoomParams.Unmarshal(m, b) 569 | } 570 | func (m *CreateRoomParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 571 | return xxx_messageInfo_CreateRoomParams.Marshal(b, m, deterministic) 572 | } 573 | func (m *CreateRoomParams) XXX_Merge(src proto.Message) { 574 | xxx_messageInfo_CreateRoomParams.Merge(m, src) 575 | } 576 | func (m *CreateRoomParams) XXX_Size() int { 577 | return xxx_messageInfo_CreateRoomParams.Size(m) 578 | } 579 | func (m *CreateRoomParams) XXX_DiscardUnknown() { 580 | xxx_messageInfo_CreateRoomParams.DiscardUnknown(m) 581 | } 582 | 583 | var xxx_messageInfo_CreateRoomParams proto.InternalMessageInfo 584 | 585 | func (m *CreateRoomParams) GetRoomId() string { 586 | if m != nil { 587 | return m.RoomId 588 | } 589 | return "" 590 | } 591 | 592 | func (m *CreateRoomParams) GetMaxNumber() uint32 { 593 | if m != nil { 594 | return m.MaxNumber 595 | } 596 | return 0 597 | } 598 | 599 | type CreateRoomResponseParams struct { 600 | ReturnValue uint32 `protobuf:"varint,1,opt,name=returnValue,proto3" json:"returnValue,omitempty"` 601 | Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` 602 | PeerId uint32 `protobuf:"varint,3,opt,name=peerId,proto3" json:"peerId,omitempty"` 603 | XXX_NoUnkeyedLiteral struct{} `json:"-"` 604 | XXX_unrecognized []byte `json:"-"` 605 | XXX_sizecache int32 `json:"-"` 606 | } 607 | 608 | func (m *CreateRoomResponseParams) Reset() { *m = CreateRoomResponseParams{} } 609 | func (m *CreateRoomResponseParams) String() string { return proto.CompactTextString(m) } 610 | func (*CreateRoomResponseParams) ProtoMessage() {} 611 | func (*CreateRoomResponseParams) Descriptor() ([]byte, []int) { 612 | return fileDescriptor_ff7f458fcc31b586, []int{3} 613 | } 614 | 615 | func (m *CreateRoomResponseParams) XXX_Unmarshal(b []byte) error { 616 | return xxx_messageInfo_CreateRoomResponseParams.Unmarshal(m, b) 617 | } 618 | func (m *CreateRoomResponseParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 619 | return xxx_messageInfo_CreateRoomResponseParams.Marshal(b, m, deterministic) 620 | } 621 | func (m *CreateRoomResponseParams) XXX_Merge(src proto.Message) { 622 | xxx_messageInfo_CreateRoomResponseParams.Merge(m, src) 623 | } 624 | func (m *CreateRoomResponseParams) XXX_Size() int { 625 | return xxx_messageInfo_CreateRoomResponseParams.Size(m) 626 | } 627 | func (m *CreateRoomResponseParams) XXX_DiscardUnknown() { 628 | xxx_messageInfo_CreateRoomResponseParams.DiscardUnknown(m) 629 | } 630 | 631 | var xxx_messageInfo_CreateRoomResponseParams proto.InternalMessageInfo 632 | 633 | func (m *CreateRoomResponseParams) GetReturnValue() uint32 { 634 | if m != nil { 635 | return m.ReturnValue 636 | } 637 | return 0 638 | } 639 | 640 | func (m *CreateRoomResponseParams) GetMessage() string { 641 | if m != nil { 642 | return m.Message 643 | } 644 | return "" 645 | } 646 | 647 | func (m *CreateRoomResponseParams) GetPeerId() uint32 { 648 | if m != nil { 649 | return m.PeerId 650 | } 651 | return 0 652 | } 653 | 654 | type JoinRoomParams struct { 655 | RoomId string `protobuf:"bytes,1,opt,name=roomId,proto3" json:"roomId,omitempty"` 656 | XXX_NoUnkeyedLiteral struct{} `json:"-"` 657 | XXX_unrecognized []byte `json:"-"` 658 | XXX_sizecache int32 `json:"-"` 659 | } 660 | 661 | func (m *JoinRoomParams) Reset() { *m = JoinRoomParams{} } 662 | func (m *JoinRoomParams) String() string { return proto.CompactTextString(m) } 663 | func (*JoinRoomParams) ProtoMessage() {} 664 | func (*JoinRoomParams) Descriptor() ([]byte, []int) { 665 | return fileDescriptor_ff7f458fcc31b586, []int{4} 666 | } 667 | 668 | func (m *JoinRoomParams) XXX_Unmarshal(b []byte) error { 669 | return xxx_messageInfo_JoinRoomParams.Unmarshal(m, b) 670 | } 671 | func (m *JoinRoomParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 672 | return xxx_messageInfo_JoinRoomParams.Marshal(b, m, deterministic) 673 | } 674 | func (m *JoinRoomParams) XXX_Merge(src proto.Message) { 675 | xxx_messageInfo_JoinRoomParams.Merge(m, src) 676 | } 677 | func (m *JoinRoomParams) XXX_Size() int { 678 | return xxx_messageInfo_JoinRoomParams.Size(m) 679 | } 680 | func (m *JoinRoomParams) XXX_DiscardUnknown() { 681 | xxx_messageInfo_JoinRoomParams.DiscardUnknown(m) 682 | } 683 | 684 | var xxx_messageInfo_JoinRoomParams proto.InternalMessageInfo 685 | 686 | func (m *JoinRoomParams) GetRoomId() string { 687 | if m != nil { 688 | return m.RoomId 689 | } 690 | return "" 691 | } 692 | 693 | type JoinRoomResponseParams struct { 694 | ReturnValue uint32 `protobuf:"varint,1,opt,name=returnValue,proto3" json:"returnValue,omitempty"` 695 | Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` 696 | PeerId uint32 `protobuf:"varint,3,opt,name=peerId,proto3" json:"peerId,omitempty"` 697 | XXX_NoUnkeyedLiteral struct{} `json:"-"` 698 | XXX_unrecognized []byte `json:"-"` 699 | XXX_sizecache int32 `json:"-"` 700 | } 701 | 702 | func (m *JoinRoomResponseParams) Reset() { *m = JoinRoomResponseParams{} } 703 | func (m *JoinRoomResponseParams) String() string { return proto.CompactTextString(m) } 704 | func (*JoinRoomResponseParams) ProtoMessage() {} 705 | func (*JoinRoomResponseParams) Descriptor() ([]byte, []int) { 706 | return fileDescriptor_ff7f458fcc31b586, []int{5} 707 | } 708 | 709 | func (m *JoinRoomResponseParams) XXX_Unmarshal(b []byte) error { 710 | return xxx_messageInfo_JoinRoomResponseParams.Unmarshal(m, b) 711 | } 712 | func (m *JoinRoomResponseParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 713 | return xxx_messageInfo_JoinRoomResponseParams.Marshal(b, m, deterministic) 714 | } 715 | func (m *JoinRoomResponseParams) XXX_Merge(src proto.Message) { 716 | xxx_messageInfo_JoinRoomResponseParams.Merge(m, src) 717 | } 718 | func (m *JoinRoomResponseParams) XXX_Size() int { 719 | return xxx_messageInfo_JoinRoomResponseParams.Size(m) 720 | } 721 | func (m *JoinRoomResponseParams) XXX_DiscardUnknown() { 722 | xxx_messageInfo_JoinRoomResponseParams.DiscardUnknown(m) 723 | } 724 | 725 | var xxx_messageInfo_JoinRoomResponseParams proto.InternalMessageInfo 726 | 727 | func (m *JoinRoomResponseParams) GetReturnValue() uint32 { 728 | if m != nil { 729 | return m.ReturnValue 730 | } 731 | return 0 732 | } 733 | 734 | func (m *JoinRoomResponseParams) GetMessage() string { 735 | if m != nil { 736 | return m.Message 737 | } 738 | return "" 739 | } 740 | 741 | func (m *JoinRoomResponseParams) GetPeerId() uint32 { 742 | if m != nil { 743 | return m.PeerId 744 | } 745 | return 0 746 | } 747 | 748 | type JoinRoomForwardParams struct { 749 | XXX_NoUnkeyedLiteral struct{} `json:"-"` 750 | XXX_unrecognized []byte `json:"-"` 751 | XXX_sizecache int32 `json:"-"` 752 | } 753 | 754 | func (m *JoinRoomForwardParams) Reset() { *m = JoinRoomForwardParams{} } 755 | func (m *JoinRoomForwardParams) String() string { return proto.CompactTextString(m) } 756 | func (*JoinRoomForwardParams) ProtoMessage() {} 757 | func (*JoinRoomForwardParams) Descriptor() ([]byte, []int) { 758 | return fileDescriptor_ff7f458fcc31b586, []int{6} 759 | } 760 | 761 | func (m *JoinRoomForwardParams) XXX_Unmarshal(b []byte) error { 762 | return xxx_messageInfo_JoinRoomForwardParams.Unmarshal(m, b) 763 | } 764 | func (m *JoinRoomForwardParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 765 | return xxx_messageInfo_JoinRoomForwardParams.Marshal(b, m, deterministic) 766 | } 767 | func (m *JoinRoomForwardParams) XXX_Merge(src proto.Message) { 768 | xxx_messageInfo_JoinRoomForwardParams.Merge(m, src) 769 | } 770 | func (m *JoinRoomForwardParams) XXX_Size() int { 771 | return xxx_messageInfo_JoinRoomForwardParams.Size(m) 772 | } 773 | func (m *JoinRoomForwardParams) XXX_DiscardUnknown() { 774 | xxx_messageInfo_JoinRoomForwardParams.DiscardUnknown(m) 775 | } 776 | 777 | var xxx_messageInfo_JoinRoomForwardParams proto.InternalMessageInfo 778 | 779 | type JoinOrCreateRoomParams struct { 780 | RoomId string `protobuf:"bytes,1,opt,name=roomId,proto3" json:"roomId,omitempty"` 781 | MaxNumber uint32 `protobuf:"varint,2,opt,name=maxNumber,proto3" json:"maxNumber,omitempty"` 782 | XXX_NoUnkeyedLiteral struct{} `json:"-"` 783 | XXX_unrecognized []byte `json:"-"` 784 | XXX_sizecache int32 `json:"-"` 785 | } 786 | 787 | func (m *JoinOrCreateRoomParams) Reset() { *m = JoinOrCreateRoomParams{} } 788 | func (m *JoinOrCreateRoomParams) String() string { return proto.CompactTextString(m) } 789 | func (*JoinOrCreateRoomParams) ProtoMessage() {} 790 | func (*JoinOrCreateRoomParams) Descriptor() ([]byte, []int) { 791 | return fileDescriptor_ff7f458fcc31b586, []int{7} 792 | } 793 | 794 | func (m *JoinOrCreateRoomParams) XXX_Unmarshal(b []byte) error { 795 | return xxx_messageInfo_JoinOrCreateRoomParams.Unmarshal(m, b) 796 | } 797 | func (m *JoinOrCreateRoomParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 798 | return xxx_messageInfo_JoinOrCreateRoomParams.Marshal(b, m, deterministic) 799 | } 800 | func (m *JoinOrCreateRoomParams) XXX_Merge(src proto.Message) { 801 | xxx_messageInfo_JoinOrCreateRoomParams.Merge(m, src) 802 | } 803 | func (m *JoinOrCreateRoomParams) XXX_Size() int { 804 | return xxx_messageInfo_JoinOrCreateRoomParams.Size(m) 805 | } 806 | func (m *JoinOrCreateRoomParams) XXX_DiscardUnknown() { 807 | xxx_messageInfo_JoinOrCreateRoomParams.DiscardUnknown(m) 808 | } 809 | 810 | var xxx_messageInfo_JoinOrCreateRoomParams proto.InternalMessageInfo 811 | 812 | func (m *JoinOrCreateRoomParams) GetRoomId() string { 813 | if m != nil { 814 | return m.RoomId 815 | } 816 | return "" 817 | } 818 | 819 | func (m *JoinOrCreateRoomParams) GetMaxNumber() uint32 { 820 | if m != nil { 821 | return m.MaxNumber 822 | } 823 | return 0 824 | } 825 | 826 | type JoinOrCreateRoomResponseParams struct { 827 | ReturnValue uint32 `protobuf:"varint,1,opt,name=returnValue,proto3" json:"returnValue,omitempty"` 828 | Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` 829 | PeerId uint32 `protobuf:"varint,3,opt,name=peerId,proto3" json:"peerId,omitempty"` 830 | XXX_NoUnkeyedLiteral struct{} `json:"-"` 831 | XXX_unrecognized []byte `json:"-"` 832 | XXX_sizecache int32 `json:"-"` 833 | } 834 | 835 | func (m *JoinOrCreateRoomResponseParams) Reset() { *m = JoinOrCreateRoomResponseParams{} } 836 | func (m *JoinOrCreateRoomResponseParams) String() string { return proto.CompactTextString(m) } 837 | func (*JoinOrCreateRoomResponseParams) ProtoMessage() {} 838 | func (*JoinOrCreateRoomResponseParams) Descriptor() ([]byte, []int) { 839 | return fileDescriptor_ff7f458fcc31b586, []int{8} 840 | } 841 | 842 | func (m *JoinOrCreateRoomResponseParams) XXX_Unmarshal(b []byte) error { 843 | return xxx_messageInfo_JoinOrCreateRoomResponseParams.Unmarshal(m, b) 844 | } 845 | func (m *JoinOrCreateRoomResponseParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 846 | return xxx_messageInfo_JoinOrCreateRoomResponseParams.Marshal(b, m, deterministic) 847 | } 848 | func (m *JoinOrCreateRoomResponseParams) XXX_Merge(src proto.Message) { 849 | xxx_messageInfo_JoinOrCreateRoomResponseParams.Merge(m, src) 850 | } 851 | func (m *JoinOrCreateRoomResponseParams) XXX_Size() int { 852 | return xxx_messageInfo_JoinOrCreateRoomResponseParams.Size(m) 853 | } 854 | func (m *JoinOrCreateRoomResponseParams) XXX_DiscardUnknown() { 855 | xxx_messageInfo_JoinOrCreateRoomResponseParams.DiscardUnknown(m) 856 | } 857 | 858 | var xxx_messageInfo_JoinOrCreateRoomResponseParams proto.InternalMessageInfo 859 | 860 | func (m *JoinOrCreateRoomResponseParams) GetReturnValue() uint32 { 861 | if m != nil { 862 | return m.ReturnValue 863 | } 864 | return 0 865 | } 866 | 867 | func (m *JoinOrCreateRoomResponseParams) GetMessage() string { 868 | if m != nil { 869 | return m.Message 870 | } 871 | return "" 872 | } 873 | 874 | func (m *JoinOrCreateRoomResponseParams) GetPeerId() uint32 { 875 | if m != nil { 876 | return m.PeerId 877 | } 878 | return 0 879 | } 880 | 881 | type JoinOrCreateRoomForwardParams struct { 882 | XXX_NoUnkeyedLiteral struct{} `json:"-"` 883 | XXX_unrecognized []byte `json:"-"` 884 | XXX_sizecache int32 `json:"-"` 885 | } 886 | 887 | func (m *JoinOrCreateRoomForwardParams) Reset() { *m = JoinOrCreateRoomForwardParams{} } 888 | func (m *JoinOrCreateRoomForwardParams) String() string { return proto.CompactTextString(m) } 889 | func (*JoinOrCreateRoomForwardParams) ProtoMessage() {} 890 | func (*JoinOrCreateRoomForwardParams) Descriptor() ([]byte, []int) { 891 | return fileDescriptor_ff7f458fcc31b586, []int{9} 892 | } 893 | 894 | func (m *JoinOrCreateRoomForwardParams) XXX_Unmarshal(b []byte) error { 895 | return xxx_messageInfo_JoinOrCreateRoomForwardParams.Unmarshal(m, b) 896 | } 897 | func (m *JoinOrCreateRoomForwardParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 898 | return xxx_messageInfo_JoinOrCreateRoomForwardParams.Marshal(b, m, deterministic) 899 | } 900 | func (m *JoinOrCreateRoomForwardParams) XXX_Merge(src proto.Message) { 901 | xxx_messageInfo_JoinOrCreateRoomForwardParams.Merge(m, src) 902 | } 903 | func (m *JoinOrCreateRoomForwardParams) XXX_Size() int { 904 | return xxx_messageInfo_JoinOrCreateRoomForwardParams.Size(m) 905 | } 906 | func (m *JoinOrCreateRoomForwardParams) XXX_DiscardUnknown() { 907 | xxx_messageInfo_JoinOrCreateRoomForwardParams.DiscardUnknown(m) 908 | } 909 | 910 | var xxx_messageInfo_JoinOrCreateRoomForwardParams proto.InternalMessageInfo 911 | 912 | type LeaveRoomParams struct { 913 | RoomId string `protobuf:"bytes,1,opt,name=roomId,proto3" json:"roomId,omitempty"` 914 | XXX_NoUnkeyedLiteral struct{} `json:"-"` 915 | XXX_unrecognized []byte `json:"-"` 916 | XXX_sizecache int32 `json:"-"` 917 | } 918 | 919 | func (m *LeaveRoomParams) Reset() { *m = LeaveRoomParams{} } 920 | func (m *LeaveRoomParams) String() string { return proto.CompactTextString(m) } 921 | func (*LeaveRoomParams) ProtoMessage() {} 922 | func (*LeaveRoomParams) Descriptor() ([]byte, []int) { 923 | return fileDescriptor_ff7f458fcc31b586, []int{10} 924 | } 925 | 926 | func (m *LeaveRoomParams) XXX_Unmarshal(b []byte) error { 927 | return xxx_messageInfo_LeaveRoomParams.Unmarshal(m, b) 928 | } 929 | func (m *LeaveRoomParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 930 | return xxx_messageInfo_LeaveRoomParams.Marshal(b, m, deterministic) 931 | } 932 | func (m *LeaveRoomParams) XXX_Merge(src proto.Message) { 933 | xxx_messageInfo_LeaveRoomParams.Merge(m, src) 934 | } 935 | func (m *LeaveRoomParams) XXX_Size() int { 936 | return xxx_messageInfo_LeaveRoomParams.Size(m) 937 | } 938 | func (m *LeaveRoomParams) XXX_DiscardUnknown() { 939 | xxx_messageInfo_LeaveRoomParams.DiscardUnknown(m) 940 | } 941 | 942 | var xxx_messageInfo_LeaveRoomParams proto.InternalMessageInfo 943 | 944 | func (m *LeaveRoomParams) GetRoomId() string { 945 | if m != nil { 946 | return m.RoomId 947 | } 948 | return "" 949 | } 950 | 951 | type LeaveRoomResponseParams struct { 952 | ReturnValue uint32 `protobuf:"varint,1,opt,name=returnValue,proto3" json:"returnValue,omitempty"` 953 | Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` 954 | PeerId uint32 `protobuf:"varint,3,opt,name=peerId,proto3" json:"peerId,omitempty"` 955 | XXX_NoUnkeyedLiteral struct{} `json:"-"` 956 | XXX_unrecognized []byte `json:"-"` 957 | XXX_sizecache int32 `json:"-"` 958 | } 959 | 960 | func (m *LeaveRoomResponseParams) Reset() { *m = LeaveRoomResponseParams{} } 961 | func (m *LeaveRoomResponseParams) String() string { return proto.CompactTextString(m) } 962 | func (*LeaveRoomResponseParams) ProtoMessage() {} 963 | func (*LeaveRoomResponseParams) Descriptor() ([]byte, []int) { 964 | return fileDescriptor_ff7f458fcc31b586, []int{11} 965 | } 966 | 967 | func (m *LeaveRoomResponseParams) XXX_Unmarshal(b []byte) error { 968 | return xxx_messageInfo_LeaveRoomResponseParams.Unmarshal(m, b) 969 | } 970 | func (m *LeaveRoomResponseParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 971 | return xxx_messageInfo_LeaveRoomResponseParams.Marshal(b, m, deterministic) 972 | } 973 | func (m *LeaveRoomResponseParams) XXX_Merge(src proto.Message) { 974 | xxx_messageInfo_LeaveRoomResponseParams.Merge(m, src) 975 | } 976 | func (m *LeaveRoomResponseParams) XXX_Size() int { 977 | return xxx_messageInfo_LeaveRoomResponseParams.Size(m) 978 | } 979 | func (m *LeaveRoomResponseParams) XXX_DiscardUnknown() { 980 | xxx_messageInfo_LeaveRoomResponseParams.DiscardUnknown(m) 981 | } 982 | 983 | var xxx_messageInfo_LeaveRoomResponseParams proto.InternalMessageInfo 984 | 985 | func (m *LeaveRoomResponseParams) GetReturnValue() uint32 { 986 | if m != nil { 987 | return m.ReturnValue 988 | } 989 | return 0 990 | } 991 | 992 | func (m *LeaveRoomResponseParams) GetMessage() string { 993 | if m != nil { 994 | return m.Message 995 | } 996 | return "" 997 | } 998 | 999 | func (m *LeaveRoomResponseParams) GetPeerId() uint32 { 1000 | if m != nil { 1001 | return m.PeerId 1002 | } 1003 | return 0 1004 | } 1005 | 1006 | type LeaveRoomForwardParams struct { 1007 | XXX_NoUnkeyedLiteral struct{} `json:"-"` 1008 | XXX_unrecognized []byte `json:"-"` 1009 | XXX_sizecache int32 `json:"-"` 1010 | } 1011 | 1012 | func (m *LeaveRoomForwardParams) Reset() { *m = LeaveRoomForwardParams{} } 1013 | func (m *LeaveRoomForwardParams) String() string { return proto.CompactTextString(m) } 1014 | func (*LeaveRoomForwardParams) ProtoMessage() {} 1015 | func (*LeaveRoomForwardParams) Descriptor() ([]byte, []int) { 1016 | return fileDescriptor_ff7f458fcc31b586, []int{12} 1017 | } 1018 | 1019 | func (m *LeaveRoomForwardParams) XXX_Unmarshal(b []byte) error { 1020 | return xxx_messageInfo_LeaveRoomForwardParams.Unmarshal(m, b) 1021 | } 1022 | func (m *LeaveRoomForwardParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 1023 | return xxx_messageInfo_LeaveRoomForwardParams.Marshal(b, m, deterministic) 1024 | } 1025 | func (m *LeaveRoomForwardParams) XXX_Merge(src proto.Message) { 1026 | xxx_messageInfo_LeaveRoomForwardParams.Merge(m, src) 1027 | } 1028 | func (m *LeaveRoomForwardParams) XXX_Size() int { 1029 | return xxx_messageInfo_LeaveRoomForwardParams.Size(m) 1030 | } 1031 | func (m *LeaveRoomForwardParams) XXX_DiscardUnknown() { 1032 | xxx_messageInfo_LeaveRoomForwardParams.DiscardUnknown(m) 1033 | } 1034 | 1035 | var xxx_messageInfo_LeaveRoomForwardParams proto.InternalMessageInfo 1036 | 1037 | //RPC parameters send from client to server 1038 | type RPCParams struct { 1039 | Options *CommonOptions `protobuf:"bytes,1,opt,name=options,proto3" json:"options,omitempty"` 1040 | Target RPCTarget `protobuf:"varint,2,opt,name=target,proto3,enum=server.RPCTarget" json:"target,omitempty"` 1041 | ViewID uint32 `protobuf:"varint,3,opt,name=viewID,proto3" json:"viewID,omitempty"` 1042 | MethodName string `protobuf:"bytes,4,opt,name=methodName,proto3" json:"methodName,omitempty"` 1043 | Parameters []*NGAny `protobuf:"bytes,5,rep,name=parameters,proto3" json:"parameters,omitempty"` 1044 | XXX_NoUnkeyedLiteral struct{} `json:"-"` 1045 | XXX_unrecognized []byte `json:"-"` 1046 | XXX_sizecache int32 `json:"-"` 1047 | } 1048 | 1049 | func (m *RPCParams) Reset() { *m = RPCParams{} } 1050 | func (m *RPCParams) String() string { return proto.CompactTextString(m) } 1051 | func (*RPCParams) ProtoMessage() {} 1052 | func (*RPCParams) Descriptor() ([]byte, []int) { 1053 | return fileDescriptor_ff7f458fcc31b586, []int{13} 1054 | } 1055 | 1056 | func (m *RPCParams) XXX_Unmarshal(b []byte) error { 1057 | return xxx_messageInfo_RPCParams.Unmarshal(m, b) 1058 | } 1059 | func (m *RPCParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 1060 | return xxx_messageInfo_RPCParams.Marshal(b, m, deterministic) 1061 | } 1062 | func (m *RPCParams) XXX_Merge(src proto.Message) { 1063 | xxx_messageInfo_RPCParams.Merge(m, src) 1064 | } 1065 | func (m *RPCParams) XXX_Size() int { 1066 | return xxx_messageInfo_RPCParams.Size(m) 1067 | } 1068 | func (m *RPCParams) XXX_DiscardUnknown() { 1069 | xxx_messageInfo_RPCParams.DiscardUnknown(m) 1070 | } 1071 | 1072 | var xxx_messageInfo_RPCParams proto.InternalMessageInfo 1073 | 1074 | func (m *RPCParams) GetOptions() *CommonOptions { 1075 | if m != nil { 1076 | return m.Options 1077 | } 1078 | return nil 1079 | } 1080 | 1081 | func (m *RPCParams) GetTarget() RPCTarget { 1082 | if m != nil { 1083 | return m.Target 1084 | } 1085 | return RPCTarget_All 1086 | } 1087 | 1088 | func (m *RPCParams) GetViewID() uint32 { 1089 | if m != nil { 1090 | return m.ViewID 1091 | } 1092 | return 0 1093 | } 1094 | 1095 | func (m *RPCParams) GetMethodName() string { 1096 | if m != nil { 1097 | return m.MethodName 1098 | } 1099 | return "" 1100 | } 1101 | 1102 | func (m *RPCParams) GetParameters() []*NGAny { 1103 | if m != nil { 1104 | return m.Parameters 1105 | } 1106 | return nil 1107 | } 1108 | 1109 | type RPCForwardParams struct { 1110 | ViewID uint32 `protobuf:"varint,1,opt,name=viewID,proto3" json:"viewID,omitempty"` 1111 | MethodName string `protobuf:"bytes,2,opt,name=methodName,proto3" json:"methodName,omitempty"` 1112 | Parameters []*NGAny `protobuf:"bytes,3,rep,name=parameters,proto3" json:"parameters,omitempty"` 1113 | XXX_NoUnkeyedLiteral struct{} `json:"-"` 1114 | XXX_unrecognized []byte `json:"-"` 1115 | XXX_sizecache int32 `json:"-"` 1116 | } 1117 | 1118 | func (m *RPCForwardParams) Reset() { *m = RPCForwardParams{} } 1119 | func (m *RPCForwardParams) String() string { return proto.CompactTextString(m) } 1120 | func (*RPCForwardParams) ProtoMessage() {} 1121 | func (*RPCForwardParams) Descriptor() ([]byte, []int) { 1122 | return fileDescriptor_ff7f458fcc31b586, []int{14} 1123 | } 1124 | 1125 | func (m *RPCForwardParams) XXX_Unmarshal(b []byte) error { 1126 | return xxx_messageInfo_RPCForwardParams.Unmarshal(m, b) 1127 | } 1128 | func (m *RPCForwardParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 1129 | return xxx_messageInfo_RPCForwardParams.Marshal(b, m, deterministic) 1130 | } 1131 | func (m *RPCForwardParams) XXX_Merge(src proto.Message) { 1132 | xxx_messageInfo_RPCForwardParams.Merge(m, src) 1133 | } 1134 | func (m *RPCForwardParams) XXX_Size() int { 1135 | return xxx_messageInfo_RPCForwardParams.Size(m) 1136 | } 1137 | func (m *RPCForwardParams) XXX_DiscardUnknown() { 1138 | xxx_messageInfo_RPCForwardParams.DiscardUnknown(m) 1139 | } 1140 | 1141 | var xxx_messageInfo_RPCForwardParams proto.InternalMessageInfo 1142 | 1143 | func (m *RPCForwardParams) GetViewID() uint32 { 1144 | if m != nil { 1145 | return m.ViewID 1146 | } 1147 | return 0 1148 | } 1149 | 1150 | func (m *RPCForwardParams) GetMethodName() string { 1151 | if m != nil { 1152 | return m.MethodName 1153 | } 1154 | return "" 1155 | } 1156 | 1157 | func (m *RPCForwardParams) GetParameters() []*NGAny { 1158 | if m != nil { 1159 | return m.Parameters 1160 | } 1161 | return nil 1162 | } 1163 | 1164 | type NGVector3 struct { 1165 | X float32 `protobuf:"fixed32,1,opt,name=x,proto3" json:"x,omitempty"` 1166 | Y float32 `protobuf:"fixed32,2,opt,name=y,proto3" json:"y,omitempty"` 1167 | Z float32 `protobuf:"fixed32,3,opt,name=z,proto3" json:"z,omitempty"` 1168 | XXX_NoUnkeyedLiteral struct{} `json:"-"` 1169 | XXX_unrecognized []byte `json:"-"` 1170 | XXX_sizecache int32 `json:"-"` 1171 | } 1172 | 1173 | func (m *NGVector3) Reset() { *m = NGVector3{} } 1174 | func (m *NGVector3) String() string { return proto.CompactTextString(m) } 1175 | func (*NGVector3) ProtoMessage() {} 1176 | func (*NGVector3) Descriptor() ([]byte, []int) { 1177 | return fileDescriptor_ff7f458fcc31b586, []int{15} 1178 | } 1179 | 1180 | func (m *NGVector3) XXX_Unmarshal(b []byte) error { 1181 | return xxx_messageInfo_NGVector3.Unmarshal(m, b) 1182 | } 1183 | func (m *NGVector3) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 1184 | return xxx_messageInfo_NGVector3.Marshal(b, m, deterministic) 1185 | } 1186 | func (m *NGVector3) XXX_Merge(src proto.Message) { 1187 | xxx_messageInfo_NGVector3.Merge(m, src) 1188 | } 1189 | func (m *NGVector3) XXX_Size() int { 1190 | return xxx_messageInfo_NGVector3.Size(m) 1191 | } 1192 | func (m *NGVector3) XXX_DiscardUnknown() { 1193 | xxx_messageInfo_NGVector3.DiscardUnknown(m) 1194 | } 1195 | 1196 | var xxx_messageInfo_NGVector3 proto.InternalMessageInfo 1197 | 1198 | func (m *NGVector3) GetX() float32 { 1199 | if m != nil { 1200 | return m.X 1201 | } 1202 | return 0 1203 | } 1204 | 1205 | func (m *NGVector3) GetY() float32 { 1206 | if m != nil { 1207 | return m.Y 1208 | } 1209 | return 0 1210 | } 1211 | 1212 | func (m *NGVector3) GetZ() float32 { 1213 | if m != nil { 1214 | return m.Z 1215 | } 1216 | return 0 1217 | } 1218 | 1219 | type NGQuaternion struct { 1220 | X float32 `protobuf:"fixed32,1,opt,name=x,proto3" json:"x,omitempty"` 1221 | Y float32 `protobuf:"fixed32,2,opt,name=y,proto3" json:"y,omitempty"` 1222 | Z float32 `protobuf:"fixed32,3,opt,name=z,proto3" json:"z,omitempty"` 1223 | W float32 `protobuf:"fixed32,4,opt,name=w,proto3" json:"w,omitempty"` 1224 | XXX_NoUnkeyedLiteral struct{} `json:"-"` 1225 | XXX_unrecognized []byte `json:"-"` 1226 | XXX_sizecache int32 `json:"-"` 1227 | } 1228 | 1229 | func (m *NGQuaternion) Reset() { *m = NGQuaternion{} } 1230 | func (m *NGQuaternion) String() string { return proto.CompactTextString(m) } 1231 | func (*NGQuaternion) ProtoMessage() {} 1232 | func (*NGQuaternion) Descriptor() ([]byte, []int) { 1233 | return fileDescriptor_ff7f458fcc31b586, []int{16} 1234 | } 1235 | 1236 | func (m *NGQuaternion) XXX_Unmarshal(b []byte) error { 1237 | return xxx_messageInfo_NGQuaternion.Unmarshal(m, b) 1238 | } 1239 | func (m *NGQuaternion) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 1240 | return xxx_messageInfo_NGQuaternion.Marshal(b, m, deterministic) 1241 | } 1242 | func (m *NGQuaternion) XXX_Merge(src proto.Message) { 1243 | xxx_messageInfo_NGQuaternion.Merge(m, src) 1244 | } 1245 | func (m *NGQuaternion) XXX_Size() int { 1246 | return xxx_messageInfo_NGQuaternion.Size(m) 1247 | } 1248 | func (m *NGQuaternion) XXX_DiscardUnknown() { 1249 | xxx_messageInfo_NGQuaternion.DiscardUnknown(m) 1250 | } 1251 | 1252 | var xxx_messageInfo_NGQuaternion proto.InternalMessageInfo 1253 | 1254 | func (m *NGQuaternion) GetX() float32 { 1255 | if m != nil { 1256 | return m.X 1257 | } 1258 | return 0 1259 | } 1260 | 1261 | func (m *NGQuaternion) GetY() float32 { 1262 | if m != nil { 1263 | return m.Y 1264 | } 1265 | return 0 1266 | } 1267 | 1268 | func (m *NGQuaternion) GetZ() float32 { 1269 | if m != nil { 1270 | return m.Z 1271 | } 1272 | return 0 1273 | } 1274 | 1275 | func (m *NGQuaternion) GetW() float32 { 1276 | if m != nil { 1277 | return m.W 1278 | } 1279 | return 0 1280 | } 1281 | 1282 | type NGColor struct { 1283 | R float32 `protobuf:"fixed32,1,opt,name=r,proto3" json:"r,omitempty"` 1284 | G float32 `protobuf:"fixed32,2,opt,name=g,proto3" json:"g,omitempty"` 1285 | B float32 `protobuf:"fixed32,3,opt,name=b,proto3" json:"b,omitempty"` 1286 | A float32 `protobuf:"fixed32,4,opt,name=a,proto3" json:"a,omitempty"` 1287 | XXX_NoUnkeyedLiteral struct{} `json:"-"` 1288 | XXX_unrecognized []byte `json:"-"` 1289 | XXX_sizecache int32 `json:"-"` 1290 | } 1291 | 1292 | func (m *NGColor) Reset() { *m = NGColor{} } 1293 | func (m *NGColor) String() string { return proto.CompactTextString(m) } 1294 | func (*NGColor) ProtoMessage() {} 1295 | func (*NGColor) Descriptor() ([]byte, []int) { 1296 | return fileDescriptor_ff7f458fcc31b586, []int{17} 1297 | } 1298 | 1299 | func (m *NGColor) XXX_Unmarshal(b []byte) error { 1300 | return xxx_messageInfo_NGColor.Unmarshal(m, b) 1301 | } 1302 | func (m *NGColor) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 1303 | return xxx_messageInfo_NGColor.Marshal(b, m, deterministic) 1304 | } 1305 | func (m *NGColor) XXX_Merge(src proto.Message) { 1306 | xxx_messageInfo_NGColor.Merge(m, src) 1307 | } 1308 | func (m *NGColor) XXX_Size() int { 1309 | return xxx_messageInfo_NGColor.Size(m) 1310 | } 1311 | func (m *NGColor) XXX_DiscardUnknown() { 1312 | xxx_messageInfo_NGColor.DiscardUnknown(m) 1313 | } 1314 | 1315 | var xxx_messageInfo_NGColor proto.InternalMessageInfo 1316 | 1317 | func (m *NGColor) GetR() float32 { 1318 | if m != nil { 1319 | return m.R 1320 | } 1321 | return 0 1322 | } 1323 | 1324 | func (m *NGColor) GetG() float32 { 1325 | if m != nil { 1326 | return m.G 1327 | } 1328 | return 0 1329 | } 1330 | 1331 | func (m *NGColor) GetB() float32 { 1332 | if m != nil { 1333 | return m.B 1334 | } 1335 | return 0 1336 | } 1337 | 1338 | func (m *NGColor) GetA() float32 { 1339 | if m != nil { 1340 | return m.A 1341 | } 1342 | return 0 1343 | } 1344 | 1345 | //LaunchEventParams and LaunchEventForwardParams all use this message body 1346 | type InstantiationParams struct { 1347 | Options *CommonOptions `protobuf:"bytes,1,opt,name=options,proto3" json:"options,omitempty"` 1348 | PrefabName string `protobuf:"bytes,2,opt,name=prefabName,proto3" json:"prefabName,omitempty"` 1349 | Position *NGVector3 `protobuf:"bytes,3,opt,name=position,proto3" json:"position,omitempty"` 1350 | Rotation *NGQuaternion `protobuf:"bytes,4,opt,name=rotation,proto3" json:"rotation,omitempty"` 1351 | ViewIDs []uint32 `protobuf:"varint,5,rep,packed,name=viewIDs,proto3" json:"viewIDs,omitempty"` 1352 | XXX_NoUnkeyedLiteral struct{} `json:"-"` 1353 | XXX_unrecognized []byte `json:"-"` 1354 | XXX_sizecache int32 `json:"-"` 1355 | } 1356 | 1357 | func (m *InstantiationParams) Reset() { *m = InstantiationParams{} } 1358 | func (m *InstantiationParams) String() string { return proto.CompactTextString(m) } 1359 | func (*InstantiationParams) ProtoMessage() {} 1360 | func (*InstantiationParams) Descriptor() ([]byte, []int) { 1361 | return fileDescriptor_ff7f458fcc31b586, []int{18} 1362 | } 1363 | 1364 | func (m *InstantiationParams) XXX_Unmarshal(b []byte) error { 1365 | return xxx_messageInfo_InstantiationParams.Unmarshal(m, b) 1366 | } 1367 | func (m *InstantiationParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 1368 | return xxx_messageInfo_InstantiationParams.Marshal(b, m, deterministic) 1369 | } 1370 | func (m *InstantiationParams) XXX_Merge(src proto.Message) { 1371 | xxx_messageInfo_InstantiationParams.Merge(m, src) 1372 | } 1373 | func (m *InstantiationParams) XXX_Size() int { 1374 | return xxx_messageInfo_InstantiationParams.Size(m) 1375 | } 1376 | func (m *InstantiationParams) XXX_DiscardUnknown() { 1377 | xxx_messageInfo_InstantiationParams.DiscardUnknown(m) 1378 | } 1379 | 1380 | var xxx_messageInfo_InstantiationParams proto.InternalMessageInfo 1381 | 1382 | func (m *InstantiationParams) GetOptions() *CommonOptions { 1383 | if m != nil { 1384 | return m.Options 1385 | } 1386 | return nil 1387 | } 1388 | 1389 | func (m *InstantiationParams) GetPrefabName() string { 1390 | if m != nil { 1391 | return m.PrefabName 1392 | } 1393 | return "" 1394 | } 1395 | 1396 | func (m *InstantiationParams) GetPosition() *NGVector3 { 1397 | if m != nil { 1398 | return m.Position 1399 | } 1400 | return nil 1401 | } 1402 | 1403 | func (m *InstantiationParams) GetRotation() *NGQuaternion { 1404 | if m != nil { 1405 | return m.Rotation 1406 | } 1407 | return nil 1408 | } 1409 | 1410 | func (m *InstantiationParams) GetViewIDs() []uint32 { 1411 | if m != nil { 1412 | return m.ViewIDs 1413 | } 1414 | return nil 1415 | } 1416 | 1417 | type InstantiationForwardParams struct { 1418 | PrefabName string `protobuf:"bytes,1,opt,name=prefabName,proto3" json:"prefabName,omitempty"` 1419 | Position *NGVector3 `protobuf:"bytes,2,opt,name=position,proto3" json:"position,omitempty"` 1420 | Rotation *NGQuaternion `protobuf:"bytes,3,opt,name=rotation,proto3" json:"rotation,omitempty"` 1421 | ViewIDs []uint32 `protobuf:"varint,4,rep,packed,name=viewIDs,proto3" json:"viewIDs,omitempty"` 1422 | XXX_NoUnkeyedLiteral struct{} `json:"-"` 1423 | XXX_unrecognized []byte `json:"-"` 1424 | XXX_sizecache int32 `json:"-"` 1425 | } 1426 | 1427 | func (m *InstantiationForwardParams) Reset() { *m = InstantiationForwardParams{} } 1428 | func (m *InstantiationForwardParams) String() string { return proto.CompactTextString(m) } 1429 | func (*InstantiationForwardParams) ProtoMessage() {} 1430 | func (*InstantiationForwardParams) Descriptor() ([]byte, []int) { 1431 | return fileDescriptor_ff7f458fcc31b586, []int{19} 1432 | } 1433 | 1434 | func (m *InstantiationForwardParams) XXX_Unmarshal(b []byte) error { 1435 | return xxx_messageInfo_InstantiationForwardParams.Unmarshal(m, b) 1436 | } 1437 | func (m *InstantiationForwardParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 1438 | return xxx_messageInfo_InstantiationForwardParams.Marshal(b, m, deterministic) 1439 | } 1440 | func (m *InstantiationForwardParams) XXX_Merge(src proto.Message) { 1441 | xxx_messageInfo_InstantiationForwardParams.Merge(m, src) 1442 | } 1443 | func (m *InstantiationForwardParams) XXX_Size() int { 1444 | return xxx_messageInfo_InstantiationForwardParams.Size(m) 1445 | } 1446 | func (m *InstantiationForwardParams) XXX_DiscardUnknown() { 1447 | xxx_messageInfo_InstantiationForwardParams.DiscardUnknown(m) 1448 | } 1449 | 1450 | var xxx_messageInfo_InstantiationForwardParams proto.InternalMessageInfo 1451 | 1452 | func (m *InstantiationForwardParams) GetPrefabName() string { 1453 | if m != nil { 1454 | return m.PrefabName 1455 | } 1456 | return "" 1457 | } 1458 | 1459 | func (m *InstantiationForwardParams) GetPosition() *NGVector3 { 1460 | if m != nil { 1461 | return m.Position 1462 | } 1463 | return nil 1464 | } 1465 | 1466 | func (m *InstantiationForwardParams) GetRotation() *NGQuaternion { 1467 | if m != nil { 1468 | return m.Rotation 1469 | } 1470 | return nil 1471 | } 1472 | 1473 | func (m *InstantiationForwardParams) GetViewIDs() []uint32 { 1474 | if m != nil { 1475 | return m.ViewIDs 1476 | } 1477 | return nil 1478 | } 1479 | 1480 | //LaunchEventParams and LaunchEventForwardParams all use this message body 1481 | type ViewSyncDataParams struct { 1482 | ViewID uint32 `protobuf:"varint,1,opt,name=viewID,proto3" json:"viewID,omitempty"` 1483 | ViewSyncData []*NGAny `protobuf:"bytes,2,rep,name=viewSyncData,proto3" json:"viewSyncData,omitempty"` 1484 | XXX_NoUnkeyedLiteral struct{} `json:"-"` 1485 | XXX_unrecognized []byte `json:"-"` 1486 | XXX_sizecache int32 `json:"-"` 1487 | } 1488 | 1489 | func (m *ViewSyncDataParams) Reset() { *m = ViewSyncDataParams{} } 1490 | func (m *ViewSyncDataParams) String() string { return proto.CompactTextString(m) } 1491 | func (*ViewSyncDataParams) ProtoMessage() {} 1492 | func (*ViewSyncDataParams) Descriptor() ([]byte, []int) { 1493 | return fileDescriptor_ff7f458fcc31b586, []int{20} 1494 | } 1495 | 1496 | func (m *ViewSyncDataParams) XXX_Unmarshal(b []byte) error { 1497 | return xxx_messageInfo_ViewSyncDataParams.Unmarshal(m, b) 1498 | } 1499 | func (m *ViewSyncDataParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 1500 | return xxx_messageInfo_ViewSyncDataParams.Marshal(b, m, deterministic) 1501 | } 1502 | func (m *ViewSyncDataParams) XXX_Merge(src proto.Message) { 1503 | xxx_messageInfo_ViewSyncDataParams.Merge(m, src) 1504 | } 1505 | func (m *ViewSyncDataParams) XXX_Size() int { 1506 | return xxx_messageInfo_ViewSyncDataParams.Size(m) 1507 | } 1508 | func (m *ViewSyncDataParams) XXX_DiscardUnknown() { 1509 | xxx_messageInfo_ViewSyncDataParams.DiscardUnknown(m) 1510 | } 1511 | 1512 | var xxx_messageInfo_ViewSyncDataParams proto.InternalMessageInfo 1513 | 1514 | func (m *ViewSyncDataParams) GetViewID() uint32 { 1515 | if m != nil { 1516 | return m.ViewID 1517 | } 1518 | return 0 1519 | } 1520 | 1521 | func (m *ViewSyncDataParams) GetViewSyncData() []*NGAny { 1522 | if m != nil { 1523 | return m.ViewSyncData 1524 | } 1525 | return nil 1526 | } 1527 | 1528 | type ViewSyncParams struct { 1529 | Options *CommonOptions `protobuf:"bytes,1,opt,name=options,proto3" json:"options,omitempty"` 1530 | VsdParams []*ViewSyncDataParams `protobuf:"bytes,2,rep,name=vsdParams,proto3" json:"vsdParams,omitempty"` 1531 | XXX_NoUnkeyedLiteral struct{} `json:"-"` 1532 | XXX_unrecognized []byte `json:"-"` 1533 | XXX_sizecache int32 `json:"-"` 1534 | } 1535 | 1536 | func (m *ViewSyncParams) Reset() { *m = ViewSyncParams{} } 1537 | func (m *ViewSyncParams) String() string { return proto.CompactTextString(m) } 1538 | func (*ViewSyncParams) ProtoMessage() {} 1539 | func (*ViewSyncParams) Descriptor() ([]byte, []int) { 1540 | return fileDescriptor_ff7f458fcc31b586, []int{21} 1541 | } 1542 | 1543 | func (m *ViewSyncParams) XXX_Unmarshal(b []byte) error { 1544 | return xxx_messageInfo_ViewSyncParams.Unmarshal(m, b) 1545 | } 1546 | func (m *ViewSyncParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 1547 | return xxx_messageInfo_ViewSyncParams.Marshal(b, m, deterministic) 1548 | } 1549 | func (m *ViewSyncParams) XXX_Merge(src proto.Message) { 1550 | xxx_messageInfo_ViewSyncParams.Merge(m, src) 1551 | } 1552 | func (m *ViewSyncParams) XXX_Size() int { 1553 | return xxx_messageInfo_ViewSyncParams.Size(m) 1554 | } 1555 | func (m *ViewSyncParams) XXX_DiscardUnknown() { 1556 | xxx_messageInfo_ViewSyncParams.DiscardUnknown(m) 1557 | } 1558 | 1559 | var xxx_messageInfo_ViewSyncParams proto.InternalMessageInfo 1560 | 1561 | func (m *ViewSyncParams) GetOptions() *CommonOptions { 1562 | if m != nil { 1563 | return m.Options 1564 | } 1565 | return nil 1566 | } 1567 | 1568 | func (m *ViewSyncParams) GetVsdParams() []*ViewSyncDataParams { 1569 | if m != nil { 1570 | return m.VsdParams 1571 | } 1572 | return nil 1573 | } 1574 | 1575 | type ViewSyncForwardParams struct { 1576 | VsdParams []*ViewSyncDataParams `protobuf:"bytes,1,rep,name=vsdParams,proto3" json:"vsdParams,omitempty"` 1577 | XXX_NoUnkeyedLiteral struct{} `json:"-"` 1578 | XXX_unrecognized []byte `json:"-"` 1579 | XXX_sizecache int32 `json:"-"` 1580 | } 1581 | 1582 | func (m *ViewSyncForwardParams) Reset() { *m = ViewSyncForwardParams{} } 1583 | func (m *ViewSyncForwardParams) String() string { return proto.CompactTextString(m) } 1584 | func (*ViewSyncForwardParams) ProtoMessage() {} 1585 | func (*ViewSyncForwardParams) Descriptor() ([]byte, []int) { 1586 | return fileDescriptor_ff7f458fcc31b586, []int{22} 1587 | } 1588 | 1589 | func (m *ViewSyncForwardParams) XXX_Unmarshal(b []byte) error { 1590 | return xxx_messageInfo_ViewSyncForwardParams.Unmarshal(m, b) 1591 | } 1592 | func (m *ViewSyncForwardParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 1593 | return xxx_messageInfo_ViewSyncForwardParams.Marshal(b, m, deterministic) 1594 | } 1595 | func (m *ViewSyncForwardParams) XXX_Merge(src proto.Message) { 1596 | xxx_messageInfo_ViewSyncForwardParams.Merge(m, src) 1597 | } 1598 | func (m *ViewSyncForwardParams) XXX_Size() int { 1599 | return xxx_messageInfo_ViewSyncForwardParams.Size(m) 1600 | } 1601 | func (m *ViewSyncForwardParams) XXX_DiscardUnknown() { 1602 | xxx_messageInfo_ViewSyncForwardParams.DiscardUnknown(m) 1603 | } 1604 | 1605 | var xxx_messageInfo_ViewSyncForwardParams proto.InternalMessageInfo 1606 | 1607 | func (m *ViewSyncForwardParams) GetVsdParams() []*ViewSyncDataParams { 1608 | if m != nil { 1609 | return m.VsdParams 1610 | } 1611 | return nil 1612 | } 1613 | 1614 | type CustomEventParams struct { 1615 | Options *CommonOptions `protobuf:"bytes,1,opt,name=options,proto3" json:"options,omitempty"` 1616 | EventID uint32 `protobuf:"varint,2,opt,name=eventID,proto3" json:"eventID,omitempty"` 1617 | TargetPeerIds []uint32 `protobuf:"varint,3,rep,packed,name=targetPeerIds,proto3" json:"targetPeerIds,omitempty"` 1618 | CustomData []*NGAny `protobuf:"bytes,4,rep,name=customData,proto3" json:"customData,omitempty"` 1619 | XXX_NoUnkeyedLiteral struct{} `json:"-"` 1620 | XXX_unrecognized []byte `json:"-"` 1621 | XXX_sizecache int32 `json:"-"` 1622 | } 1623 | 1624 | func (m *CustomEventParams) Reset() { *m = CustomEventParams{} } 1625 | func (m *CustomEventParams) String() string { return proto.CompactTextString(m) } 1626 | func (*CustomEventParams) ProtoMessage() {} 1627 | func (*CustomEventParams) Descriptor() ([]byte, []int) { 1628 | return fileDescriptor_ff7f458fcc31b586, []int{23} 1629 | } 1630 | 1631 | func (m *CustomEventParams) XXX_Unmarshal(b []byte) error { 1632 | return xxx_messageInfo_CustomEventParams.Unmarshal(m, b) 1633 | } 1634 | func (m *CustomEventParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 1635 | return xxx_messageInfo_CustomEventParams.Marshal(b, m, deterministic) 1636 | } 1637 | func (m *CustomEventParams) XXX_Merge(src proto.Message) { 1638 | xxx_messageInfo_CustomEventParams.Merge(m, src) 1639 | } 1640 | func (m *CustomEventParams) XXX_Size() int { 1641 | return xxx_messageInfo_CustomEventParams.Size(m) 1642 | } 1643 | func (m *CustomEventParams) XXX_DiscardUnknown() { 1644 | xxx_messageInfo_CustomEventParams.DiscardUnknown(m) 1645 | } 1646 | 1647 | var xxx_messageInfo_CustomEventParams proto.InternalMessageInfo 1648 | 1649 | func (m *CustomEventParams) GetOptions() *CommonOptions { 1650 | if m != nil { 1651 | return m.Options 1652 | } 1653 | return nil 1654 | } 1655 | 1656 | func (m *CustomEventParams) GetEventID() uint32 { 1657 | if m != nil { 1658 | return m.EventID 1659 | } 1660 | return 0 1661 | } 1662 | 1663 | func (m *CustomEventParams) GetTargetPeerIds() []uint32 { 1664 | if m != nil { 1665 | return m.TargetPeerIds 1666 | } 1667 | return nil 1668 | } 1669 | 1670 | func (m *CustomEventParams) GetCustomData() []*NGAny { 1671 | if m != nil { 1672 | return m.CustomData 1673 | } 1674 | return nil 1675 | } 1676 | 1677 | //Launch Event only has Forward params 1678 | type CustomEventForwardParams struct { 1679 | EventID uint32 `protobuf:"varint,1,opt,name=eventID,proto3" json:"eventID,omitempty"` 1680 | CustomData []*NGAny `protobuf:"bytes,2,rep,name=customData,proto3" json:"customData,omitempty"` 1681 | XXX_NoUnkeyedLiteral struct{} `json:"-"` 1682 | XXX_unrecognized []byte `json:"-"` 1683 | XXX_sizecache int32 `json:"-"` 1684 | } 1685 | 1686 | func (m *CustomEventForwardParams) Reset() { *m = CustomEventForwardParams{} } 1687 | func (m *CustomEventForwardParams) String() string { return proto.CompactTextString(m) } 1688 | func (*CustomEventForwardParams) ProtoMessage() {} 1689 | func (*CustomEventForwardParams) Descriptor() ([]byte, []int) { 1690 | return fileDescriptor_ff7f458fcc31b586, []int{24} 1691 | } 1692 | 1693 | func (m *CustomEventForwardParams) XXX_Unmarshal(b []byte) error { 1694 | return xxx_messageInfo_CustomEventForwardParams.Unmarshal(m, b) 1695 | } 1696 | func (m *CustomEventForwardParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 1697 | return xxx_messageInfo_CustomEventForwardParams.Marshal(b, m, deterministic) 1698 | } 1699 | func (m *CustomEventForwardParams) XXX_Merge(src proto.Message) { 1700 | xxx_messageInfo_CustomEventForwardParams.Merge(m, src) 1701 | } 1702 | func (m *CustomEventForwardParams) XXX_Size() int { 1703 | return xxx_messageInfo_CustomEventForwardParams.Size(m) 1704 | } 1705 | func (m *CustomEventForwardParams) XXX_DiscardUnknown() { 1706 | xxx_messageInfo_CustomEventForwardParams.DiscardUnknown(m) 1707 | } 1708 | 1709 | var xxx_messageInfo_CustomEventForwardParams proto.InternalMessageInfo 1710 | 1711 | func (m *CustomEventForwardParams) GetEventID() uint32 { 1712 | if m != nil { 1713 | return m.EventID 1714 | } 1715 | return 0 1716 | } 1717 | 1718 | func (m *CustomEventForwardParams) GetCustomData() []*NGAny { 1719 | if m != nil { 1720 | return m.CustomData 1721 | } 1722 | return nil 1723 | } 1724 | 1725 | type SubscribeMsgChannelsParams struct { 1726 | Channelids []uint32 `protobuf:"varint,1,rep,packed,name=channelids,proto3" json:"channelids,omitempty"` 1727 | XXX_NoUnkeyedLiteral struct{} `json:"-"` 1728 | XXX_unrecognized []byte `json:"-"` 1729 | XXX_sizecache int32 `json:"-"` 1730 | } 1731 | 1732 | func (m *SubscribeMsgChannelsParams) Reset() { *m = SubscribeMsgChannelsParams{} } 1733 | func (m *SubscribeMsgChannelsParams) String() string { return proto.CompactTextString(m) } 1734 | func (*SubscribeMsgChannelsParams) ProtoMessage() {} 1735 | func (*SubscribeMsgChannelsParams) Descriptor() ([]byte, []int) { 1736 | return fileDescriptor_ff7f458fcc31b586, []int{25} 1737 | } 1738 | 1739 | func (m *SubscribeMsgChannelsParams) XXX_Unmarshal(b []byte) error { 1740 | return xxx_messageInfo_SubscribeMsgChannelsParams.Unmarshal(m, b) 1741 | } 1742 | func (m *SubscribeMsgChannelsParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 1743 | return xxx_messageInfo_SubscribeMsgChannelsParams.Marshal(b, m, deterministic) 1744 | } 1745 | func (m *SubscribeMsgChannelsParams) XXX_Merge(src proto.Message) { 1746 | xxx_messageInfo_SubscribeMsgChannelsParams.Merge(m, src) 1747 | } 1748 | func (m *SubscribeMsgChannelsParams) XXX_Size() int { 1749 | return xxx_messageInfo_SubscribeMsgChannelsParams.Size(m) 1750 | } 1751 | func (m *SubscribeMsgChannelsParams) XXX_DiscardUnknown() { 1752 | xxx_messageInfo_SubscribeMsgChannelsParams.DiscardUnknown(m) 1753 | } 1754 | 1755 | var xxx_messageInfo_SubscribeMsgChannelsParams proto.InternalMessageInfo 1756 | 1757 | func (m *SubscribeMsgChannelsParams) GetChannelids() []uint32 { 1758 | if m != nil { 1759 | return m.Channelids 1760 | } 1761 | return nil 1762 | } 1763 | 1764 | type UnSubscribeMsgChannelsParams struct { 1765 | Channelids []uint32 `protobuf:"varint,1,rep,packed,name=channelids,proto3" json:"channelids,omitempty"` 1766 | XXX_NoUnkeyedLiteral struct{} `json:"-"` 1767 | XXX_unrecognized []byte `json:"-"` 1768 | XXX_sizecache int32 `json:"-"` 1769 | } 1770 | 1771 | func (m *UnSubscribeMsgChannelsParams) Reset() { *m = UnSubscribeMsgChannelsParams{} } 1772 | func (m *UnSubscribeMsgChannelsParams) String() string { return proto.CompactTextString(m) } 1773 | func (*UnSubscribeMsgChannelsParams) ProtoMessage() {} 1774 | func (*UnSubscribeMsgChannelsParams) Descriptor() ([]byte, []int) { 1775 | return fileDescriptor_ff7f458fcc31b586, []int{26} 1776 | } 1777 | 1778 | func (m *UnSubscribeMsgChannelsParams) XXX_Unmarshal(b []byte) error { 1779 | return xxx_messageInfo_UnSubscribeMsgChannelsParams.Unmarshal(m, b) 1780 | } 1781 | func (m *UnSubscribeMsgChannelsParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 1782 | return xxx_messageInfo_UnSubscribeMsgChannelsParams.Marshal(b, m, deterministic) 1783 | } 1784 | func (m *UnSubscribeMsgChannelsParams) XXX_Merge(src proto.Message) { 1785 | xxx_messageInfo_UnSubscribeMsgChannelsParams.Merge(m, src) 1786 | } 1787 | func (m *UnSubscribeMsgChannelsParams) XXX_Size() int { 1788 | return xxx_messageInfo_UnSubscribeMsgChannelsParams.Size(m) 1789 | } 1790 | func (m *UnSubscribeMsgChannelsParams) XXX_DiscardUnknown() { 1791 | xxx_messageInfo_UnSubscribeMsgChannelsParams.DiscardUnknown(m) 1792 | } 1793 | 1794 | var xxx_messageInfo_UnSubscribeMsgChannelsParams proto.InternalMessageInfo 1795 | 1796 | func (m *UnSubscribeMsgChannelsParams) GetChannelids() []uint32 { 1797 | if m != nil { 1798 | return m.Channelids 1799 | } 1800 | return nil 1801 | } 1802 | 1803 | //send from client to server 1804 | type SendMessage struct { 1805 | MsgType MessageType `protobuf:"varint,1,opt,name=msgType,proto3,enum=server.MessageType" json:"msgType,omitempty"` 1806 | CrParams *CreateRoomParams `protobuf:"bytes,2,opt,name=crParams,proto3" json:"crParams,omitempty"` 1807 | JrParams *JoinRoomParams `protobuf:"bytes,3,opt,name=jrParams,proto3" json:"jrParams,omitempty"` 1808 | JocrParams *JoinOrCreateRoomParams `protobuf:"bytes,4,opt,name=jocrParams,proto3" json:"jocrParams,omitempty"` 1809 | LrParams *LeaveRoomParams `protobuf:"bytes,5,opt,name=lrParams,proto3" json:"lrParams,omitempty"` 1810 | RpcParams *RPCParams `protobuf:"bytes,6,opt,name=rpcParams,proto3" json:"rpcParams,omitempty"` 1811 | IParams *InstantiationParams `protobuf:"bytes,7,opt,name=iParams,proto3" json:"iParams,omitempty"` 1812 | VsParams *ViewSyncParams `protobuf:"bytes,8,opt,name=vsParams,proto3" json:"vsParams,omitempty"` 1813 | CeParams *CustomEventParams `protobuf:"bytes,9,opt,name=ceParams,proto3" json:"ceParams,omitempty"` 1814 | SmcParams *SubscribeMsgChannelsParams `protobuf:"bytes,10,opt,name=smcParams,proto3" json:"smcParams,omitempty"` 1815 | UsmcParams *UnSubscribeMsgChannelsParams `protobuf:"bytes,11,opt,name=usmcParams,proto3" json:"usmcParams,omitempty"` 1816 | XXX_NoUnkeyedLiteral struct{} `json:"-"` 1817 | XXX_unrecognized []byte `json:"-"` 1818 | XXX_sizecache int32 `json:"-"` 1819 | } 1820 | 1821 | func (m *SendMessage) Reset() { *m = SendMessage{} } 1822 | func (m *SendMessage) String() string { return proto.CompactTextString(m) } 1823 | func (*SendMessage) ProtoMessage() {} 1824 | func (*SendMessage) Descriptor() ([]byte, []int) { 1825 | return fileDescriptor_ff7f458fcc31b586, []int{27} 1826 | } 1827 | 1828 | func (m *SendMessage) XXX_Unmarshal(b []byte) error { 1829 | return xxx_messageInfo_SendMessage.Unmarshal(m, b) 1830 | } 1831 | func (m *SendMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 1832 | return xxx_messageInfo_SendMessage.Marshal(b, m, deterministic) 1833 | } 1834 | func (m *SendMessage) XXX_Merge(src proto.Message) { 1835 | xxx_messageInfo_SendMessage.Merge(m, src) 1836 | } 1837 | func (m *SendMessage) XXX_Size() int { 1838 | return xxx_messageInfo_SendMessage.Size(m) 1839 | } 1840 | func (m *SendMessage) XXX_DiscardUnknown() { 1841 | xxx_messageInfo_SendMessage.DiscardUnknown(m) 1842 | } 1843 | 1844 | var xxx_messageInfo_SendMessage proto.InternalMessageInfo 1845 | 1846 | func (m *SendMessage) GetMsgType() MessageType { 1847 | if m != nil { 1848 | return m.MsgType 1849 | } 1850 | return MessageType_JoinLobby 1851 | } 1852 | 1853 | func (m *SendMessage) GetCrParams() *CreateRoomParams { 1854 | if m != nil { 1855 | return m.CrParams 1856 | } 1857 | return nil 1858 | } 1859 | 1860 | func (m *SendMessage) GetJrParams() *JoinRoomParams { 1861 | if m != nil { 1862 | return m.JrParams 1863 | } 1864 | return nil 1865 | } 1866 | 1867 | func (m *SendMessage) GetJocrParams() *JoinOrCreateRoomParams { 1868 | if m != nil { 1869 | return m.JocrParams 1870 | } 1871 | return nil 1872 | } 1873 | 1874 | func (m *SendMessage) GetLrParams() *LeaveRoomParams { 1875 | if m != nil { 1876 | return m.LrParams 1877 | } 1878 | return nil 1879 | } 1880 | 1881 | func (m *SendMessage) GetRpcParams() *RPCParams { 1882 | if m != nil { 1883 | return m.RpcParams 1884 | } 1885 | return nil 1886 | } 1887 | 1888 | func (m *SendMessage) GetIParams() *InstantiationParams { 1889 | if m != nil { 1890 | return m.IParams 1891 | } 1892 | return nil 1893 | } 1894 | 1895 | func (m *SendMessage) GetVsParams() *ViewSyncParams { 1896 | if m != nil { 1897 | return m.VsParams 1898 | } 1899 | return nil 1900 | } 1901 | 1902 | func (m *SendMessage) GetCeParams() *CustomEventParams { 1903 | if m != nil { 1904 | return m.CeParams 1905 | } 1906 | return nil 1907 | } 1908 | 1909 | func (m *SendMessage) GetSmcParams() *SubscribeMsgChannelsParams { 1910 | if m != nil { 1911 | return m.SmcParams 1912 | } 1913 | return nil 1914 | } 1915 | 1916 | func (m *SendMessage) GetUsmcParams() *UnSubscribeMsgChannelsParams { 1917 | if m != nil { 1918 | return m.UsmcParams 1919 | } 1920 | return nil 1921 | } 1922 | 1923 | type ResponseSocketStatusMessage struct { 1924 | SStatus SocketStatus `protobuf:"varint,1,opt,name=sStatus,proto3,enum=server.SocketStatus" json:"sStatus,omitempty"` 1925 | XXX_NoUnkeyedLiteral struct{} `json:"-"` 1926 | XXX_unrecognized []byte `json:"-"` 1927 | XXX_sizecache int32 `json:"-"` 1928 | } 1929 | 1930 | func (m *ResponseSocketStatusMessage) Reset() { *m = ResponseSocketStatusMessage{} } 1931 | func (m *ResponseSocketStatusMessage) String() string { return proto.CompactTextString(m) } 1932 | func (*ResponseSocketStatusMessage) ProtoMessage() {} 1933 | func (*ResponseSocketStatusMessage) Descriptor() ([]byte, []int) { 1934 | return fileDescriptor_ff7f458fcc31b586, []int{28} 1935 | } 1936 | 1937 | func (m *ResponseSocketStatusMessage) XXX_Unmarshal(b []byte) error { 1938 | return xxx_messageInfo_ResponseSocketStatusMessage.Unmarshal(m, b) 1939 | } 1940 | func (m *ResponseSocketStatusMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 1941 | return xxx_messageInfo_ResponseSocketStatusMessage.Marshal(b, m, deterministic) 1942 | } 1943 | func (m *ResponseSocketStatusMessage) XXX_Merge(src proto.Message) { 1944 | xxx_messageInfo_ResponseSocketStatusMessage.Merge(m, src) 1945 | } 1946 | func (m *ResponseSocketStatusMessage) XXX_Size() int { 1947 | return xxx_messageInfo_ResponseSocketStatusMessage.Size(m) 1948 | } 1949 | func (m *ResponseSocketStatusMessage) XXX_DiscardUnknown() { 1950 | xxx_messageInfo_ResponseSocketStatusMessage.DiscardUnknown(m) 1951 | } 1952 | 1953 | var xxx_messageInfo_ResponseSocketStatusMessage proto.InternalMessageInfo 1954 | 1955 | func (m *ResponseSocketStatusMessage) GetSStatus() SocketStatus { 1956 | if m != nil { 1957 | return m.SStatus 1958 | } 1959 | return SocketStatus_Disconnected 1960 | } 1961 | 1962 | //send from server to client 1963 | type ResponseOperationMessage struct { 1964 | MsgType MessageType `protobuf:"varint,1,opt,name=msgType,proto3,enum=server.MessageType" json:"msgType,omitempty"` 1965 | CrrParams *CreateRoomResponseParams `protobuf:"bytes,2,opt,name=crrParams,proto3" json:"crrParams,omitempty"` 1966 | JrrParams *JoinRoomResponseParams `protobuf:"bytes,3,opt,name=jrrParams,proto3" json:"jrrParams,omitempty"` 1967 | JocrrParams *JoinOrCreateRoomResponseParams `protobuf:"bytes,4,opt,name=jocrrParams,proto3" json:"jocrrParams,omitempty"` 1968 | LrrParams *LeaveRoomResponseParams `protobuf:"bytes,5,opt,name=lrrParams,proto3" json:"lrrParams,omitempty"` 1969 | XXX_NoUnkeyedLiteral struct{} `json:"-"` 1970 | XXX_unrecognized []byte `json:"-"` 1971 | XXX_sizecache int32 `json:"-"` 1972 | } 1973 | 1974 | func (m *ResponseOperationMessage) Reset() { *m = ResponseOperationMessage{} } 1975 | func (m *ResponseOperationMessage) String() string { return proto.CompactTextString(m) } 1976 | func (*ResponseOperationMessage) ProtoMessage() {} 1977 | func (*ResponseOperationMessage) Descriptor() ([]byte, []int) { 1978 | return fileDescriptor_ff7f458fcc31b586, []int{29} 1979 | } 1980 | 1981 | func (m *ResponseOperationMessage) XXX_Unmarshal(b []byte) error { 1982 | return xxx_messageInfo_ResponseOperationMessage.Unmarshal(m, b) 1983 | } 1984 | func (m *ResponseOperationMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 1985 | return xxx_messageInfo_ResponseOperationMessage.Marshal(b, m, deterministic) 1986 | } 1987 | func (m *ResponseOperationMessage) XXX_Merge(src proto.Message) { 1988 | xxx_messageInfo_ResponseOperationMessage.Merge(m, src) 1989 | } 1990 | func (m *ResponseOperationMessage) XXX_Size() int { 1991 | return xxx_messageInfo_ResponseOperationMessage.Size(m) 1992 | } 1993 | func (m *ResponseOperationMessage) XXX_DiscardUnknown() { 1994 | xxx_messageInfo_ResponseOperationMessage.DiscardUnknown(m) 1995 | } 1996 | 1997 | var xxx_messageInfo_ResponseOperationMessage proto.InternalMessageInfo 1998 | 1999 | func (m *ResponseOperationMessage) GetMsgType() MessageType { 2000 | if m != nil { 2001 | return m.MsgType 2002 | } 2003 | return MessageType_JoinLobby 2004 | } 2005 | 2006 | func (m *ResponseOperationMessage) GetCrrParams() *CreateRoomResponseParams { 2007 | if m != nil { 2008 | return m.CrrParams 2009 | } 2010 | return nil 2011 | } 2012 | 2013 | func (m *ResponseOperationMessage) GetJrrParams() *JoinRoomResponseParams { 2014 | if m != nil { 2015 | return m.JrrParams 2016 | } 2017 | return nil 2018 | } 2019 | 2020 | func (m *ResponseOperationMessage) GetJocrrParams() *JoinOrCreateRoomResponseParams { 2021 | if m != nil { 2022 | return m.JocrrParams 2023 | } 2024 | return nil 2025 | } 2026 | 2027 | func (m *ResponseOperationMessage) GetLrrParams() *LeaveRoomResponseParams { 2028 | if m != nil { 2029 | return m.LrrParams 2030 | } 2031 | return nil 2032 | } 2033 | 2034 | //need to notifiy others in the room. 2035 | type ForwardMessage struct { 2036 | MsgType MessageType `protobuf:"varint,1,opt,name=msgType,proto3,enum=server.MessageType" json:"msgType,omitempty"` 2037 | PeerId uint32 `protobuf:"varint,2,opt,name=peerId,proto3" json:"peerId,omitempty"` 2038 | JrfParams *JoinRoomForwardParams `protobuf:"bytes,3,opt,name=jrfParams,proto3" json:"jrfParams,omitempty"` 2039 | JocrfParams *JoinOrCreateRoomForwardParams `protobuf:"bytes,4,opt,name=jocrfParams,proto3" json:"jocrfParams,omitempty"` 2040 | LrfParams *LeaveRoomForwardParams `protobuf:"bytes,5,opt,name=lrfParams,proto3" json:"lrfParams,omitempty"` 2041 | RfParams *RPCForwardParams `protobuf:"bytes,6,opt,name=rfParams,proto3" json:"rfParams,omitempty"` 2042 | IfParams *InstantiationForwardParams `protobuf:"bytes,7,opt,name=ifParams,proto3" json:"ifParams,omitempty"` 2043 | VsfParams *ViewSyncForwardParams `protobuf:"bytes,8,opt,name=vsfParams,proto3" json:"vsfParams,omitempty"` 2044 | CeParams *CustomEventForwardParams `protobuf:"bytes,9,opt,name=ceParams,proto3" json:"ceParams,omitempty"` 2045 | XXX_NoUnkeyedLiteral struct{} `json:"-"` 2046 | XXX_unrecognized []byte `json:"-"` 2047 | XXX_sizecache int32 `json:"-"` 2048 | } 2049 | 2050 | func (m *ForwardMessage) Reset() { *m = ForwardMessage{} } 2051 | func (m *ForwardMessage) String() string { return proto.CompactTextString(m) } 2052 | func (*ForwardMessage) ProtoMessage() {} 2053 | func (*ForwardMessage) Descriptor() ([]byte, []int) { 2054 | return fileDescriptor_ff7f458fcc31b586, []int{30} 2055 | } 2056 | 2057 | func (m *ForwardMessage) XXX_Unmarshal(b []byte) error { 2058 | return xxx_messageInfo_ForwardMessage.Unmarshal(m, b) 2059 | } 2060 | func (m *ForwardMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 2061 | return xxx_messageInfo_ForwardMessage.Marshal(b, m, deterministic) 2062 | } 2063 | func (m *ForwardMessage) XXX_Merge(src proto.Message) { 2064 | xxx_messageInfo_ForwardMessage.Merge(m, src) 2065 | } 2066 | func (m *ForwardMessage) XXX_Size() int { 2067 | return xxx_messageInfo_ForwardMessage.Size(m) 2068 | } 2069 | func (m *ForwardMessage) XXX_DiscardUnknown() { 2070 | xxx_messageInfo_ForwardMessage.DiscardUnknown(m) 2071 | } 2072 | 2073 | var xxx_messageInfo_ForwardMessage proto.InternalMessageInfo 2074 | 2075 | func (m *ForwardMessage) GetMsgType() MessageType { 2076 | if m != nil { 2077 | return m.MsgType 2078 | } 2079 | return MessageType_JoinLobby 2080 | } 2081 | 2082 | func (m *ForwardMessage) GetPeerId() uint32 { 2083 | if m != nil { 2084 | return m.PeerId 2085 | } 2086 | return 0 2087 | } 2088 | 2089 | func (m *ForwardMessage) GetJrfParams() *JoinRoomForwardParams { 2090 | if m != nil { 2091 | return m.JrfParams 2092 | } 2093 | return nil 2094 | } 2095 | 2096 | func (m *ForwardMessage) GetJocrfParams() *JoinOrCreateRoomForwardParams { 2097 | if m != nil { 2098 | return m.JocrfParams 2099 | } 2100 | return nil 2101 | } 2102 | 2103 | func (m *ForwardMessage) GetLrfParams() *LeaveRoomForwardParams { 2104 | if m != nil { 2105 | return m.LrfParams 2106 | } 2107 | return nil 2108 | } 2109 | 2110 | func (m *ForwardMessage) GetRfParams() *RPCForwardParams { 2111 | if m != nil { 2112 | return m.RfParams 2113 | } 2114 | return nil 2115 | } 2116 | 2117 | func (m *ForwardMessage) GetIfParams() *InstantiationForwardParams { 2118 | if m != nil { 2119 | return m.IfParams 2120 | } 2121 | return nil 2122 | } 2123 | 2124 | func (m *ForwardMessage) GetVsfParams() *ViewSyncForwardParams { 2125 | if m != nil { 2126 | return m.VsfParams 2127 | } 2128 | return nil 2129 | } 2130 | 2131 | func (m *ForwardMessage) GetCeParams() *CustomEventForwardParams { 2132 | if m != nil { 2133 | return m.CeParams 2134 | } 2135 | return nil 2136 | } 2137 | 2138 | //send from server to client 2139 | type ReceiveMessage struct { 2140 | ReceiveMsgType ReceiveMessageType `protobuf:"varint,1,opt,name=receiveMsgType,proto3,enum=server.ReceiveMessageType" json:"receiveMsgType,omitempty"` 2141 | RssMsg *ResponseSocketStatusMessage `protobuf:"bytes,2,opt,name=rssMsg,proto3" json:"rssMsg,omitempty"` 2142 | RoMsg *ResponseOperationMessage `protobuf:"bytes,3,opt,name=roMsg,proto3" json:"roMsg,omitempty"` 2143 | FMsg *ForwardMessage `protobuf:"bytes,4,opt,name=fMsg,proto3" json:"fMsg,omitempty"` 2144 | XXX_NoUnkeyedLiteral struct{} `json:"-"` 2145 | XXX_unrecognized []byte `json:"-"` 2146 | XXX_sizecache int32 `json:"-"` 2147 | } 2148 | 2149 | func (m *ReceiveMessage) Reset() { *m = ReceiveMessage{} } 2150 | func (m *ReceiveMessage) String() string { return proto.CompactTextString(m) } 2151 | func (*ReceiveMessage) ProtoMessage() {} 2152 | func (*ReceiveMessage) Descriptor() ([]byte, []int) { 2153 | return fileDescriptor_ff7f458fcc31b586, []int{31} 2154 | } 2155 | 2156 | func (m *ReceiveMessage) XXX_Unmarshal(b []byte) error { 2157 | return xxx_messageInfo_ReceiveMessage.Unmarshal(m, b) 2158 | } 2159 | func (m *ReceiveMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 2160 | return xxx_messageInfo_ReceiveMessage.Marshal(b, m, deterministic) 2161 | } 2162 | func (m *ReceiveMessage) XXX_Merge(src proto.Message) { 2163 | xxx_messageInfo_ReceiveMessage.Merge(m, src) 2164 | } 2165 | func (m *ReceiveMessage) XXX_Size() int { 2166 | return xxx_messageInfo_ReceiveMessage.Size(m) 2167 | } 2168 | func (m *ReceiveMessage) XXX_DiscardUnknown() { 2169 | xxx_messageInfo_ReceiveMessage.DiscardUnknown(m) 2170 | } 2171 | 2172 | var xxx_messageInfo_ReceiveMessage proto.InternalMessageInfo 2173 | 2174 | func (m *ReceiveMessage) GetReceiveMsgType() ReceiveMessageType { 2175 | if m != nil { 2176 | return m.ReceiveMsgType 2177 | } 2178 | return ReceiveMessageType_ResponseSocketStatus 2179 | } 2180 | 2181 | func (m *ReceiveMessage) GetRssMsg() *ResponseSocketStatusMessage { 2182 | if m != nil { 2183 | return m.RssMsg 2184 | } 2185 | return nil 2186 | } 2187 | 2188 | func (m *ReceiveMessage) GetRoMsg() *ResponseOperationMessage { 2189 | if m != nil { 2190 | return m.RoMsg 2191 | } 2192 | return nil 2193 | } 2194 | 2195 | func (m *ReceiveMessage) GetFMsg() *ForwardMessage { 2196 | if m != nil { 2197 | return m.FMsg 2198 | } 2199 | return nil 2200 | } 2201 | 2202 | func init() { 2203 | proto.RegisterEnum("server.MessageType", MessageType_name, MessageType_value) 2204 | proto.RegisterEnum("server.CacheOptions", CacheOptions_name, CacheOptions_value) 2205 | proto.RegisterEnum("server.RPCTarget", RPCTarget_name, RPCTarget_value) 2206 | proto.RegisterEnum("server.SocketStatus", SocketStatus_name, SocketStatus_value) 2207 | proto.RegisterEnum("server.ReceiveMessageType", ReceiveMessageType_name, ReceiveMessageType_value) 2208 | proto.RegisterType((*NGAny)(nil), "server.NGAny") 2209 | proto.RegisterType((*CommonOptions)(nil), "server.CommonOptions") 2210 | proto.RegisterType((*CreateRoomParams)(nil), "server.CreateRoomParams") 2211 | proto.RegisterType((*CreateRoomResponseParams)(nil), "server.CreateRoomResponseParams") 2212 | proto.RegisterType((*JoinRoomParams)(nil), "server.JoinRoomParams") 2213 | proto.RegisterType((*JoinRoomResponseParams)(nil), "server.JoinRoomResponseParams") 2214 | proto.RegisterType((*JoinRoomForwardParams)(nil), "server.JoinRoomForwardParams") 2215 | proto.RegisterType((*JoinOrCreateRoomParams)(nil), "server.JoinOrCreateRoomParams") 2216 | proto.RegisterType((*JoinOrCreateRoomResponseParams)(nil), "server.JoinOrCreateRoomResponseParams") 2217 | proto.RegisterType((*JoinOrCreateRoomForwardParams)(nil), "server.JoinOrCreateRoomForwardParams") 2218 | proto.RegisterType((*LeaveRoomParams)(nil), "server.LeaveRoomParams") 2219 | proto.RegisterType((*LeaveRoomResponseParams)(nil), "server.LeaveRoomResponseParams") 2220 | proto.RegisterType((*LeaveRoomForwardParams)(nil), "server.LeaveRoomForwardParams") 2221 | proto.RegisterType((*RPCParams)(nil), "server.RPCParams") 2222 | proto.RegisterType((*RPCForwardParams)(nil), "server.RPCForwardParams") 2223 | proto.RegisterType((*NGVector3)(nil), "server.NGVector3") 2224 | proto.RegisterType((*NGQuaternion)(nil), "server.NGQuaternion") 2225 | proto.RegisterType((*NGColor)(nil), "server.NGColor") 2226 | proto.RegisterType((*InstantiationParams)(nil), "server.InstantiationParams") 2227 | proto.RegisterType((*InstantiationForwardParams)(nil), "server.InstantiationForwardParams") 2228 | proto.RegisterType((*ViewSyncDataParams)(nil), "server.ViewSyncDataParams") 2229 | proto.RegisterType((*ViewSyncParams)(nil), "server.ViewSyncParams") 2230 | proto.RegisterType((*ViewSyncForwardParams)(nil), "server.ViewSyncForwardParams") 2231 | proto.RegisterType((*CustomEventParams)(nil), "server.CustomEventParams") 2232 | proto.RegisterType((*CustomEventForwardParams)(nil), "server.CustomEventForwardParams") 2233 | proto.RegisterType((*SubscribeMsgChannelsParams)(nil), "server.SubscribeMsgChannelsParams") 2234 | proto.RegisterType((*UnSubscribeMsgChannelsParams)(nil), "server.UnSubscribeMsgChannelsParams") 2235 | proto.RegisterType((*SendMessage)(nil), "server.SendMessage") 2236 | proto.RegisterType((*ResponseSocketStatusMessage)(nil), "server.ResponseSocketStatusMessage") 2237 | proto.RegisterType((*ResponseOperationMessage)(nil), "server.ResponseOperationMessage") 2238 | proto.RegisterType((*ForwardMessage)(nil), "server.ForwardMessage") 2239 | proto.RegisterType((*ReceiveMessage)(nil), "server.ReceiveMessage") 2240 | } 2241 | 2242 | func init() { proto.RegisterFile("ng_message.proto", fileDescriptor_ff7f458fcc31b586) } 2243 | 2244 | var fileDescriptor_ff7f458fcc31b586 = []byte{ 2245 | // 1764 bytes of a gzipped FileDescriptorProto 2246 | 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x58, 0xdd, 0x72, 0xdb, 0xb8, 2247 | 0x15, 0x16, 0x24, 0x59, 0x3f, 0x47, 0x3f, 0xa6, 0x91, 0xd8, 0xc6, 0x7a, 0x37, 0x0e, 0xcb, 0x6e, 2248 | 0x3b, 0x5c, 0x77, 0x92, 0x74, 0x6d, 0x45, 0xb3, 0xd3, 0xa4, 0x99, 0x3a, 0x72, 0x1d, 0xbb, 0xb3, 2249 | 0x71, 0xbc, 0x50, 0x36, 0xb7, 0x3b, 0x94, 0x04, 0x2b, 0x4a, 0x25, 0x42, 0x03, 0x52, 0x72, 0xb4, 2250 | 0x7d, 0x85, 0xbe, 0x4d, 0x2f, 0xfa, 0x16, 0x9d, 0x3e, 0x42, 0xfb, 0x04, 0xbd, 0x6a, 0xaf, 0x3b, 2251 | 0x00, 0x09, 0x92, 0x90, 0xe5, 0x78, 0xe3, 0x76, 0x72, 0x67, 0x9c, 0xf3, 0x7d, 0xe7, 0x1c, 0x1c, 2252 | 0x7c, 0x38, 0x84, 0x05, 0x96, 0x3f, 0xfc, 0x61, 0xc2, 0x82, 0xc0, 0x1b, 0xb2, 0x87, 0x53, 0xc1, 2253 | 0x43, 0x8e, 0x4b, 0x01, 0x13, 0x73, 0x26, 0x9c, 0x7f, 0x15, 0x61, 0xed, 0xec, 0xc5, 0xa1, 0xbf, 2254 | 0xc0, 0x5f, 0x40, 0xc5, 0x1f, 0x1e, 0xf1, 0x59, 0x6f, 0xcc, 0x48, 0xcd, 0x46, 0x2e, 0x3a, 0xc9, 2255 | 0xd1, 0xc4, 0x82, 0x77, 0xa0, 0xec, 0x0f, 0x8f, 0xc7, 0xdc, 0x0b, 0x49, 0xdd, 0x46, 0x6e, 0xfe, 2256 | 0x24, 0x47, 0xb5, 0x21, 0xf2, 0x9d, 0xfa, 0xe1, 0xc1, 0x3e, 0x69, 0xd8, 0xc8, 0x5d, 0x8b, 0x7c, 2257 | 0xca, 0x90, 0xf8, 0xda, 0x2d, 0xd2, 0xb4, 0x91, 0x5b, 0x48, 0x7c, 0xed, 0x56, 0x94, 0xf1, 0xfb, 2258 | 0x91, 0x22, 0xae, 0xdb, 0xc8, 0x6d, 0x44, 0x19, 0x23, 0x4b, 0xea, 0x6d, 0xb7, 0x88, 0x65, 0x23, 2259 | 0xb7, 0x98, 0x7a, 0x35, 0xb7, 0x1b, 0x71, 0x37, 0x6c, 0xe4, 0x6e, 0x44, 0xde, 0x6e, 0x86, 0xdb, 2260 | 0x8d, 0xb8, 0xd8, 0x46, 0x2e, 0x4e, 0xbd, 0xed, 0x16, 0xde, 0x85, 0xaa, 0x3f, 0x3c, 0x1e, 0xbd, 2261 | 0x67, 0x83, 0x83, 0x7d, 0x72, 0xc7, 0x46, 0x6e, 0xf9, 0x24, 0x47, 0x53, 0x53, 0xc6, 0xdf, 0x6e, 2262 | 0x91, 0xbb, 0x36, 0x72, 0x4b, 0x19, 0x7f, 0xbb, 0x85, 0x6d, 0x00, 0x7f, 0xd8, 0xbd, 0x88, 0x03, 2263 | 0x6c, 0xda, 0xc8, 0x5d, 0x3f, 0xc9, 0xd1, 0x8c, 0x2d, 0x8b, 0x68, 0xb7, 0xc8, 0x96, 0x8d, 0x5c, 2264 | 0x2b, 0x8b, 0x68, 0xb7, 0x30, 0x81, 0x92, 0x3f, 0x7c, 0xce, 0xf9, 0x98, 0x6c, 0xdb, 0xc8, 0xad, 2265 | 0x9c, 0xe4, 0x68, 0xbc, 0x8e, 0x6b, 0x0f, 0xc5, 0xc8, 0x1f, 0x12, 0x62, 0x23, 0xb7, 0x1a, 0xd7, 2266 | 0xae, 0x2c, 0x51, 0x3f, 0x9f, 0x2f, 0x42, 0x16, 0x90, 0xcf, 0x6c, 0xe4, 0xd6, 0xa3, 0x7e, 0x2a, 2267 | 0x03, 0xfe, 0x5a, 0xd6, 0xfd, 0x86, 0xf5, 0x43, 0x2e, 0x0e, 0xc8, 0x7d, 0x1b, 0xb9, 0xb5, 0xfd, 2268 | 0x8d, 0x87, 0xd1, 0x39, 0x3f, 0x3c, 0x7b, 0x11, 0x3b, 0xa2, 0xad, 0xc4, 0x0b, 0xfc, 0x1b, 0xa8, 2269 | 0xfb, 0xc3, 0xef, 0x66, 0x5e, 0xc8, 0x84, 0x3f, 0xe2, 0x3e, 0xb1, 0x15, 0xeb, 0x6e, 0xca, 0x4a, 2270 | 0x7d, 0x27, 0x39, 0x6a, 0x60, 0xf1, 0xaf, 0x64, 0x29, 0x1d, 0x3e, 0xe6, 0x82, 0xfc, 0x4c, 0xd1, 2271 | 0xd6, 0x53, 0x9a, 0x32, 0x47, 0xb5, 0xa9, 0x3f, 0x9f, 0x57, 0xe4, 0x7e, 0x5f, 0x2f, 0xa6, 0xcc, 2272 | 0x99, 0x41, 0xa3, 0xc3, 0x27, 0x13, 0xee, 0xbf, 0x9a, 0x86, 0x23, 0xee, 0x07, 0x78, 0x0f, 0xac, 2273 | 0x80, 0xf9, 0x83, 0xd7, 0xbc, 0xf3, 0xd6, 0xf3, 0x7d, 0x36, 0x3e, 0x1d, 0x04, 0x04, 0xd9, 0x05, 2274 | 0xb7, 0x41, 0xaf, 0xd8, 0xf1, 0x37, 0x50, 0xef, 0x7b, 0xfd, 0xb7, 0x2c, 0xe6, 0x92, 0xbc, 0x8d, 2275 | 0xdc, 0x66, 0x5a, 0x6f, 0x27, 0xe3, 0xa3, 0x06, 0xd2, 0x39, 0x01, 0xab, 0x23, 0x98, 0x17, 0x32, 2276 | 0xca, 0xf9, 0xe4, 0xdc, 0x13, 0xde, 0x24, 0xc0, 0x5b, 0x50, 0x12, 0x9c, 0x4f, 0x4e, 0x07, 0x04, 2277 | 0xc9, 0x46, 0xd3, 0x78, 0x85, 0xbf, 0x80, 0xea, 0xc4, 0x7b, 0x7f, 0x36, 0x9b, 0xf4, 0x98, 0x50, 2278 | 0x29, 0x1a, 0x34, 0x35, 0x38, 0x3e, 0x90, 0x34, 0x12, 0x65, 0xc1, 0x94, 0xfb, 0x01, 0x8b, 0x23, 2279 | 0xda, 0x50, 0x13, 0x2c, 0x9c, 0x09, 0xff, 0x8d, 0x37, 0x9e, 0x31, 0x15, 0xb6, 0x41, 0xb3, 0x26, 2280 | 0x4c, 0xa0, 0x1c, 0xdf, 0x44, 0x15, 0xb9, 0x4a, 0xf5, 0x52, 0x56, 0x33, 0x65, 0x4c, 0x9c, 0x0e, 2281 | 0x48, 0x41, 0xd1, 0xe2, 0x95, 0xe3, 0x42, 0xf3, 0x0f, 0x7c, 0xe4, 0xdf, 0x5c, 0xb7, 0x33, 0x86, 2282 | 0x2d, 0x8d, 0xfc, 0x04, 0x75, 0x6d, 0xc3, 0xa6, 0xce, 0x76, 0xcc, 0xc5, 0xa5, 0x27, 0x06, 0x51, 2283 | 0x32, 0xe7, 0x2c, 0x2a, 0xe3, 0x95, 0xf8, 0x3f, 0x35, 0x3c, 0x84, 0xdd, 0xe5, 0x78, 0x9f, 0x60, 2284 | 0x7b, 0xf7, 0xe1, 0xde, 0x72, 0x56, 0x73, 0x9b, 0x5f, 0xc1, 0xfa, 0xb7, 0xcc, 0x9b, 0xff, 0x84, 2285 | 0xfd, 0x39, 0x13, 0xd8, 0x4e, 0xa0, 0x9f, 0xa0, 0x74, 0x02, 0x5b, 0x49, 0x3a, 0xb3, 0xe6, 0xbf, 2286 | 0x21, 0xa8, 0xd2, 0xf3, 0x4e, 0x9c, 0xfb, 0x11, 0x94, 0x79, 0x7c, 0x91, 0x90, 0xba, 0xc1, 0x9b, 2287 | 0xc9, 0x45, 0xca, 0xde, 0x50, 0xaa, 0x51, 0xf8, 0x2b, 0x28, 0x85, 0x9e, 0x18, 0xb2, 0x30, 0xbe, 2288 | 0x78, 0xc9, 0x78, 0xa1, 0xe7, 0x9d, 0xd7, 0xca, 0x41, 0x63, 0x80, 0xac, 0x6d, 0x3e, 0x62, 0x97, 2289 | 0xa7, 0x47, 0xba, 0xb6, 0x68, 0x85, 0x77, 0x01, 0x26, 0x2c, 0x7c, 0xcb, 0x07, 0x67, 0xde, 0x84, 2290 | 0x91, 0xa2, 0xda, 0x50, 0xc6, 0x82, 0x1f, 0x00, 0x4c, 0x65, 0x75, 0x2c, 0x64, 0x22, 0x20, 0x6b, 2291 | 0x76, 0xc1, 0xad, 0xed, 0x37, 0xd2, 0xc1, 0x72, 0xe8, 0x2f, 0x68, 0x06, 0xe0, 0x2c, 0xc0, 0xa2, 2292 | 0xe7, 0x1d, 0x63, 0x93, 0x99, 0xd4, 0xe8, 0x03, 0xa9, 0xf3, 0x37, 0xa4, 0x2e, 0xdc, 0x94, 0xfa, 2293 | 0x31, 0x54, 0x93, 0xa9, 0x8a, 0xeb, 0x80, 0xde, 0xab, 0x74, 0x79, 0x8a, 0xde, 0xcb, 0xd5, 0x42, 2294 | 0x25, 0xc8, 0x53, 0xb4, 0x90, 0xab, 0x1f, 0x55, 0x17, 0xf2, 0x14, 0xfd, 0xe8, 0x1c, 0x43, 0x3d, 2295 | 0x3b, 0x56, 0x7f, 0x3a, 0x53, 0xae, 0x2e, 0x55, 0xc7, 0xf2, 0x14, 0x5d, 0x3a, 0x87, 0x50, 0x8e, 2296 | 0xe7, 0xac, 0x74, 0x08, 0x1d, 0x42, 0xad, 0x86, 0x3a, 0xc4, 0x50, 0xae, 0x7a, 0x3a, 0x44, 0x4f, 2297 | 0xae, 0x3c, 0x1d, 0xc2, 0x73, 0xfe, 0x89, 0xe0, 0xce, 0xa9, 0x1f, 0x84, 0x9e, 0x1f, 0x8e, 0x3c, 2298 | 0x79, 0xc2, 0xb7, 0xd5, 0xc5, 0x2e, 0xc0, 0x54, 0xb0, 0x0b, 0xaf, 0x97, 0xed, 0x6c, 0x6a, 0xc1, 2299 | 0x0f, 0xa0, 0x32, 0xe5, 0xc1, 0x48, 0x82, 0x55, 0x2d, 0xab, 0x3e, 0x4c, 0x34, 0x81, 0xe0, 0x5f, 2300 | 0x43, 0x45, 0xf0, 0x50, 0x55, 0xa4, 0x8a, 0xbd, 0xe6, 0x8b, 0x44, 0x13, 0x94, 0xbc, 0x23, 0xd1, 2301 | 0x21, 0x47, 0x92, 0x69, 0x50, 0xbd, 0x74, 0xfe, 0x8a, 0x60, 0xc7, 0xd8, 0xa3, 0xa9, 0x15, 0xb3, 2302 | 0x72, 0xf4, 0xc1, 0xca, 0xf3, 0x1f, 0x57, 0x79, 0xe1, 0x63, 0x2b, 0x2f, 0x9a, 0x95, 0xff, 0x00, 2303 | 0xf8, 0xcd, 0x88, 0x5d, 0x76, 0x17, 0x7e, 0xff, 0xc8, 0x0b, 0xbd, 0x1b, 0xc4, 0xfd, 0x35, 0xd4, 2304 | 0xe7, 0x19, 0x34, 0xc9, 0xaf, 0x92, 0xaf, 0x01, 0x71, 0xfe, 0x04, 0x4d, 0x9d, 0xe0, 0xb6, 0x07, 2305 | 0xff, 0x0d, 0x54, 0xe7, 0x41, 0xdc, 0xcb, 0x38, 0xe5, 0x8e, 0xa6, 0x5c, 0x2d, 0x9e, 0xa6, 0x60, 2306 | 0xe7, 0x3b, 0xd8, 0xd4, 0x00, 0xf3, 0x44, 0x8c, 0x90, 0xe8, 0x63, 0x42, 0xfe, 0x05, 0xc1, 0x46, 2307 | 0x67, 0x16, 0x84, 0x7c, 0xf2, 0xfb, 0x39, 0xf3, 0xc3, 0xdb, 0xee, 0x89, 0x40, 0x99, 0x49, 0xfe, 2308 | 0xe9, 0x51, 0xfc, 0x29, 0xd2, 0x4b, 0xfc, 0x25, 0x34, 0xa2, 0xe9, 0x76, 0xae, 0xe6, 0x6c, 0x34, 2309 | 0x23, 0x1a, 0xd4, 0x34, 0xca, 0x31, 0xd2, 0x57, 0x55, 0xa8, 0x73, 0x28, 0xae, 0x1c, 0x23, 0x29, 2310 | 0xc0, 0xe9, 0x03, 0xc9, 0x14, 0x6d, 0xf6, 0x22, 0x53, 0x0a, 0x32, 0x4b, 0x31, 0x93, 0xe4, 0x6f, 2311 | 0x4a, 0xf2, 0x14, 0x76, 0xba, 0xb3, 0x5e, 0xd0, 0x17, 0xa3, 0x1e, 0x7b, 0x19, 0x0c, 0xe3, 0x17, 2312 | 0x55, 0x90, 0x5e, 0x82, 0x7e, 0x64, 0x19, 0x25, 0x6f, 0xaf, 0x8c, 0xc5, 0x79, 0x06, 0x5f, 0x7c, 2313 | 0xef, 0xff, 0x0f, 0xfc, 0xff, 0x14, 0xa1, 0xd6, 0x65, 0xfe, 0xe0, 0x65, 0xfc, 0xdd, 0x7a, 0x00, 2314 | 0xe5, 0x49, 0xa0, 0x5e, 0x83, 0x6a, 0x5b, 0xcd, 0xfd, 0x3b, 0xba, 0xf2, 0x18, 0x21, 0x5d, 0x54, 2315 | 0x63, 0x70, 0x0b, 0x2a, 0x7d, 0x91, 0x68, 0x4c, 0x1e, 0x21, 0x49, 0x8e, 0x70, 0xe9, 0x85, 0x41, 2316 | 0x13, 0x24, 0xde, 0x87, 0xca, 0x3b, 0xcd, 0x8a, 0xae, 0xe2, 0x96, 0x66, 0x99, 0xcf, 0x29, 0x9a, 2317 | 0xe0, 0xf0, 0x33, 0x80, 0x77, 0x3c, 0xc9, 0x15, 0x8d, 0x9e, 0xdd, 0x2c, 0xeb, 0xea, 0x9b, 0x86, 2318 | 0x66, 0x18, 0xf8, 0x00, 0x2a, 0x63, 0xcd, 0x5e, 0x53, 0xec, 0x6d, 0xcd, 0x5e, 0x7a, 0x2a, 0xd0, 2319 | 0x04, 0x88, 0x1f, 0x41, 0x55, 0x4c, 0xe3, 0x1b, 0x48, 0x4a, 0xe6, 0x8c, 0x49, 0xbe, 0xd5, 0x34, 2320 | 0xc5, 0xe0, 0xc7, 0x50, 0x1e, 0xc5, 0xf0, 0xb2, 0x82, 0x7f, 0xae, 0xe1, 0x2b, 0x86, 0x39, 0xd5, 2321 | 0x58, 0xd9, 0x90, 0x79, 0x7c, 0x62, 0xa4, 0x62, 0x36, 0xc4, 0x1c, 0x03, 0x34, 0xc1, 0xe1, 0xc7, 2322 | 0x50, 0xe9, 0xc7, 0x2f, 0x15, 0x52, 0x55, 0x9c, 0xcf, 0x92, 0xd6, 0x2f, 0xdf, 0x34, 0x9a, 0x40, 2323 | 0xf1, 0xef, 0xa0, 0x1a, 0x4c, 0xf4, 0x96, 0x40, 0xf1, 0x1c, 0xcd, 0xbb, 0x5e, 0x47, 0x34, 0x25, 2324 | 0xe1, 0x23, 0x80, 0x59, 0x1a, 0xa2, 0xa6, 0x42, 0x7c, 0xa9, 0x43, 0x7c, 0x48, 0x8c, 0x34, 0xc3, 2325 | 0x73, 0x5e, 0xc2, 0xe7, 0xfa, 0xb9, 0xd5, 0xe5, 0xfd, 0x3f, 0xb2, 0xb0, 0x1b, 0x7a, 0xe1, 0x2c, 2326 | 0xd0, 0x3a, 0x7c, 0x08, 0xe5, 0x20, 0xb2, 0xc4, 0x3a, 0x4c, 0x86, 0x75, 0x16, 0x4d, 0x35, 0xc8, 2327 | 0xf9, 0x7b, 0x1e, 0x88, 0x8e, 0xf7, 0x6a, 0xca, 0x84, 0x6a, 0xf3, 0x2d, 0x45, 0xfd, 0x0c, 0xaa, 2328 | 0x7d, 0x61, 0xaa, 0xda, 0xbe, 0xaa, 0x6a, 0xf3, 0xb1, 0x48, 0x53, 0x0a, 0x7e, 0x0a, 0xd5, 0x77, 2329 | 0xc2, 0xd4, 0xf7, 0xee, 0xb2, 0xbe, 0x97, 0xd9, 0x09, 0x01, 0x9f, 0x40, 0x4d, 0xca, 0xd6, 0x54, 2330 | 0xfa, 0x2f, 0xaf, 0x53, 0xfa, 0x52, 0x9c, 0x2c, 0x15, 0xff, 0x16, 0xaa, 0x63, 0x61, 0x6a, 0xfe, 2331 | 0xfe, 0x15, 0xcd, 0x2f, 0x17, 0x92, 0x30, 0x9c, 0x3f, 0x17, 0xa1, 0x19, 0xcf, 0xbc, 0x5b, 0x36, 2332 | 0x32, 0x7d, 0x04, 0xe7, 0xb3, 0x8f, 0x60, 0xfc, 0x44, 0x36, 0xe8, 0xc2, 0x68, 0xd0, 0xbd, 0xe5, 2333 | 0x06, 0x19, 0xd3, 0x96, 0xa6, 0x78, 0xfc, 0x22, 0xea, 0xcf, 0x85, 0xd1, 0x9f, 0x5f, 0x5c, 0xd7, 2334 | 0x1f, 0x33, 0x4c, 0x96, 0x29, 0x8f, 0x69, 0x9c, 0x84, 0x59, 0x33, 0x8f, 0x69, 0xf5, 0x1b, 0x9d, 2335 | 0xa6, 0x04, 0x39, 0xf9, 0x12, 0x72, 0xc9, 0x9c, 0x7c, 0xcb, 0xaf, 0x5e, 0x9a, 0x20, 0xf1, 0x33, 2336 | 0xa8, 0x8c, 0x2e, 0x8c, 0x01, 0xe1, 0xac, 0x1c, 0x10, 0x4b, 0x7c, 0xcd, 0x91, 0x9d, 0x9b, 0x07, 2337 | 0x17, 0xc6, 0xa4, 0xb8, 0xb7, 0x3c, 0x29, 0x96, 0x4a, 0x4e, 0xf0, 0xf8, 0xe9, 0x95, 0x89, 0x61, 2338 | 0xaf, 0x98, 0x18, 0x4b, 0xa9, 0x35, 0xc3, 0xf9, 0x37, 0x82, 0x26, 0x65, 0x7d, 0x36, 0x9a, 0x33, 2339 | 0x2d, 0x87, 0xe7, 0xd0, 0x14, 0xb1, 0xc5, 0x50, 0x45, 0xf2, 0x28, 0x30, 0xf1, 0x4a, 0x1c, 0x4b, 2340 | 0x0c, 0xfc, 0x04, 0x4a, 0x22, 0x08, 0x5e, 0x06, 0xc3, 0xf8, 0xa6, 0xfd, 0x3c, 0xe5, 0x5e, 0x3b, 2341 | 0x1d, 0x68, 0x4c, 0xc1, 0x6d, 0x58, 0x13, 0x5c, 0x72, 0x0b, 0xe6, 0x76, 0xae, 0x9b, 0x04, 0x34, 2342 | 0x82, 0xe3, 0x3d, 0x28, 0x5e, 0x48, 0x5a, 0xd1, 0x9c, 0xb5, 0xa6, 0xda, 0xa9, 0xc2, 0xec, 0xfd, 2343 | 0x03, 0x41, 0x2d, 0xb3, 0x01, 0xdc, 0x80, 0xaa, 0x14, 0xd9, 0xb7, 0xbc, 0xd7, 0x5b, 0x58, 0x39, 2344 | 0xdc, 0x04, 0x50, 0x62, 0x89, 0xd6, 0x48, 0xae, 0x53, 0xf5, 0x59, 0x79, 0x5c, 0x87, 0x8a, 0x96, 2345 | 0xb4, 0x55, 0xc0, 0x77, 0xc1, 0x5a, 0x56, 0xa8, 0x55, 0x94, 0x21, 0x13, 0xc1, 0x59, 0x6b, 0xb8, 2346 | 0x0c, 0x05, 0x7a, 0xde, 0xb1, 0x4a, 0x78, 0x03, 0x1a, 0x86, 0x2a, 0xac, 0xb2, 0x0c, 0xa7, 0xcf, 2347 | 0xd9, 0xaa, 0xe0, 0x75, 0xa8, 0x65, 0x4e, 0xce, 0xaa, 0x62, 0x02, 0x77, 0x57, 0xcd, 0x5f, 0x0b, 2348 | 0xf0, 0x0e, 0x6c, 0xad, 0x9e, 0xcd, 0x56, 0x6d, 0xef, 0x09, 0xd4, 0xb3, 0x3f, 0xcf, 0x60, 0x0c, 2349 | 0xcd, 0xc3, 0xc1, 0xe0, 0x35, 0x97, 0xf5, 0x28, 0x87, 0x95, 0xc3, 0xdb, 0x70, 0x87, 0xb2, 0x09, 2350 | 0x9f, 0xb3, 0x63, 0xc1, 0x27, 0xa9, 0x03, 0xed, 0xd9, 0xea, 0xdf, 0xd6, 0xe8, 0x5f, 0x4c, 0x59, 2351 | 0xfa, 0xe1, 0x78, 0x6c, 0xe5, 0x30, 0x40, 0xe9, 0x55, 0xf8, 0x96, 0x89, 0xc0, 0x42, 0x7b, 0x8f, 2352 | 0xa0, 0x9e, 0x3d, 0x44, 0x6c, 0x41, 0xfd, 0x68, 0x14, 0xf4, 0xb9, 0xef, 0xb3, 0x7e, 0xc8, 0x06, 2353 | 0x56, 0x4e, 0x36, 0xa0, 0x93, 0x2c, 0xd1, 0x1e, 0x05, 0x7c, 0x55, 0x39, 0x72, 0x6f, 0xab, 0x34, 2354 | 0x61, 0xe5, 0xf0, 0x26, 0x6c, 0x5c, 0x39, 0x71, 0x0b, 0xe1, 0x1a, 0x94, 0xe3, 0x13, 0xb5, 0xf2, 2355 | 0xbd, 0x92, 0xfa, 0x71, 0xf5, 0xe0, 0xbf, 0x01, 0x00, 0x00, 0xff, 0xff, 0xb6, 0xcd, 0xf4, 0x84, 2356 | 0x70, 0x15, 0x00, 0x00, 2357 | } 2358 | -------------------------------------------------------------------------------- /server/ng_message.proto: -------------------------------------------------------------------------------- 1 | //protoc --go_out=. *.proto 2 | syntax = "proto3"; 3 | //package Netgo.Library; 4 | package server; 5 | 6 | enum MessageType{ 7 | 8 | JoinLobby = 0; 9 | LeaveLobby = 1; 10 | CreateRoom = 2; 11 | JoinRoom = 3; 12 | JoinOrCreateRoom = 4; 13 | LeaveRoom = 5; 14 | RPC = 6; 15 | Instantiation = 7; 16 | ViewSync = 8; 17 | CustomEvent = 9; 18 | SubscribeMsgChannels = 10; 19 | UnSubscribeMsgChannels = 11; 20 | } 21 | 22 | enum CacheOptions{ 23 | 24 | AddToRoomCache = 0; 25 | RemoveFromRoomCache = 1; 26 | } 27 | //the NGAny is a union,only one type is set 28 | message NGAny{ 29 | 30 | oneof ngType{ 31 | 32 | double ngDouble = 11; 33 | float ngFloat = 12; 34 | int32 ngInt32 = 13; 35 | int64 ngInt64 = 14; 36 | uint32 ngUint32 = 15; 37 | uint64 ngUint64 = 16; 38 | sint32 ngSint32 = 17; 39 | sint64 ngSint64 = 18; 40 | fixed32 ngFixed32 = 19; 41 | fixed64 ngFixed64 = 20; 42 | sfixed32 ngSfixed32 = 21; 43 | sfixed64 ngSfixed64 = 22; 44 | bool ngBool = 23; 45 | string ngString = 24; 46 | bytes ngBytes = 25; 47 | 48 | NGVector3 ngVector3 = 31; 49 | NGQuaternion ngQuaternion = 32; 50 | NGColor ngColor = 33; 51 | 52 | } 53 | } 54 | 55 | message CommonOptions{ 56 | 57 | repeated uint32 sendToChannelIds = 1; 58 | CacheOptions cacheOptions = 2; 59 | } 60 | 61 | message CreateRoomParams{ 62 | 63 | string roomId = 1; 64 | uint32 maxNumber = 2; 65 | } 66 | 67 | message CreateRoomResponseParams{ 68 | 69 | uint32 returnValue = 1; 70 | string message = 2; 71 | uint32 peerId = 3; 72 | } 73 | 74 | message JoinRoomParams{ 75 | 76 | string roomId = 1; 77 | } 78 | 79 | message JoinRoomResponseParams{ 80 | 81 | uint32 returnValue = 1; 82 | string message = 2; 83 | uint32 peerId = 3; 84 | } 85 | 86 | message JoinRoomForwardParams{ 87 | 88 | 89 | } 90 | 91 | message JoinOrCreateRoomParams{ 92 | 93 | string roomId = 1; 94 | uint32 maxNumber = 2; 95 | } 96 | 97 | message JoinOrCreateRoomResponseParams{ 98 | 99 | uint32 returnValue = 1; 100 | string message = 2; 101 | uint32 peerId = 3; 102 | } 103 | 104 | message JoinOrCreateRoomForwardParams{ 105 | 106 | 107 | } 108 | 109 | message LeaveRoomParams{ 110 | 111 | string roomId = 1; 112 | } 113 | 114 | message LeaveRoomResponseParams{ 115 | 116 | uint32 returnValue = 1; 117 | string message = 2; 118 | uint32 peerId = 3; 119 | } 120 | 121 | message LeaveRoomForwardParams{ 122 | 123 | 124 | } 125 | //event relvelant structs 126 | enum RPCTarget{ 127 | 128 | All = 0; 129 | Others = 1; 130 | 131 | } 132 | 133 | //RPC parameters send from client to server 134 | message RPCParams{ 135 | 136 | CommonOptions options = 1; 137 | RPCTarget target = 2; 138 | uint32 viewID = 3; 139 | string methodName = 4; 140 | repeated NGAny parameters = 5; 141 | } 142 | 143 | message RPCForwardParams{ 144 | 145 | uint32 viewID = 1; 146 | string methodName = 2; 147 | repeated NGAny parameters = 3; 148 | } 149 | 150 | message NGVector3{ 151 | 152 | float x = 1; 153 | float y = 2; 154 | float z = 3; 155 | } 156 | 157 | message NGQuaternion{ 158 | 159 | float x = 1; 160 | float y = 2; 161 | float z = 3; 162 | float w = 4; 163 | } 164 | 165 | message NGColor{ 166 | 167 | float r = 1; 168 | float g = 2; 169 | float b = 3; 170 | float a = 4; 171 | } 172 | 173 | //LaunchEventParams and LaunchEventForwardParams all use this message body 174 | message InstantiationParams{ 175 | 176 | CommonOptions options = 1; 177 | string prefabName = 2; 178 | NGVector3 position = 3; 179 | NGQuaternion rotation = 4; 180 | repeated uint32 viewIDs = 5; 181 | } 182 | 183 | message InstantiationForwardParams{ 184 | 185 | string prefabName = 1; 186 | NGVector3 position = 2; 187 | NGQuaternion rotation = 3; 188 | repeated uint32 viewIDs = 4; 189 | } 190 | 191 | //LaunchEventParams and LaunchEventForwardParams all use this message body 192 | message ViewSyncDataParams{ 193 | 194 | uint32 viewID = 1; 195 | repeated NGAny viewSyncData = 2; 196 | } 197 | 198 | message ViewSyncParams{ 199 | 200 | CommonOptions options = 1; 201 | repeated ViewSyncDataParams vsdParams = 2; 202 | } 203 | 204 | message ViewSyncForwardParams{ 205 | 206 | repeated ViewSyncDataParams vsdParams = 1; 207 | } 208 | 209 | message CustomEventParams{ 210 | 211 | CommonOptions options = 1; 212 | uint32 eventID = 2; 213 | repeated uint32 targetPeerIds = 3; 214 | repeated NGAny customData = 4; 215 | } 216 | 217 | //Launch Event only has Forward params 218 | message CustomEventForwardParams { 219 | 220 | uint32 eventID = 1; 221 | repeated NGAny customData = 2; 222 | } 223 | 224 | message SubscribeMsgChannelsParams{ 225 | 226 | repeated uint32 channelids = 1; 227 | } 228 | 229 | message UnSubscribeMsgChannelsParams{ 230 | 231 | repeated uint32 channelids = 1; 232 | } 233 | //send from client to server 234 | message SendMessage{ 235 | 236 | MessageType msgType = 1; 237 | CreateRoomParams crParams = 2; 238 | JoinRoomParams jrParams = 3; 239 | JoinOrCreateRoomParams jocrParams = 4; 240 | LeaveRoomParams lrParams = 5; 241 | RPCParams rpcParams = 6; 242 | InstantiationParams iParams = 7; 243 | ViewSyncParams vsParams= 8; 244 | CustomEventParams ceParams = 9; 245 | SubscribeMsgChannelsParams smcParams = 10; 246 | UnSubscribeMsgChannelsParams usmcParams = 11; 247 | } 248 | 249 | enum SocketStatus{ 250 | Disconnected = 0; 251 | Connected = 1; 252 | 253 | } 254 | 255 | message ResponseSocketStatusMessage{ 256 | SocketStatus sStatus = 1; 257 | } 258 | 259 | //send from server to client 260 | message ResponseOperationMessage{ 261 | 262 | MessageType msgType = 1; 263 | CreateRoomResponseParams crrParams = 2; 264 | JoinRoomResponseParams jrrParams = 3; 265 | JoinOrCreateRoomResponseParams jocrrParams = 4; 266 | LeaveRoomResponseParams lrrParams = 5; 267 | } 268 | //need to notifiy others in the room. 269 | message ForwardMessage{ 270 | 271 | MessageType msgType = 1; 272 | uint32 peerId = 2; 273 | JoinRoomForwardParams jrfParams = 3; 274 | JoinOrCreateRoomForwardParams jocrfParams = 4; 275 | LeaveRoomForwardParams lrfParams = 5; 276 | RPCForwardParams rfParams = 6; 277 | InstantiationForwardParams ifParams = 7; 278 | ViewSyncForwardParams vsfParams = 8; 279 | CustomEventForwardParams ceParams = 9; 280 | } 281 | enum ReceiveMessageType{ 282 | 283 | ResponseSocketStatus = 0; 284 | ResponseOperation = 1; 285 | Forward = 2; 286 | } 287 | //send from server to client 288 | message ReceiveMessage{ 289 | 290 | ReceiveMessageType receiveMsgType = 1; 291 | ResponseSocketStatusMessage rssMsg = 2; 292 | ResponseOperationMessage roMsg = 3; 293 | ForwardMessage fMsg = 4; 294 | } 295 | -------------------------------------------------------------------------------- /server/ng_network.go: -------------------------------------------------------------------------------- 1 | package server 2 | 3 | import ( 4 | "fmt" 5 | "net" 6 | ) 7 | 8 | const ReadBufferSize int = 1024 9 | 10 | func Listen(network, address string) { 11 | 12 | var tcpAddr *net.TCPAddr 13 | 14 | tcpAddr, _ = net.ResolveTCPAddr(network, address) 15 | 16 | tcpListener, _ := net.ListenTCP(network, tcpAddr) 17 | defer tcpListener.Close() 18 | fmt.Println("Server ready to read ...") 19 | 20 | for { 21 | tcpConn, err := tcpListener.AcceptTCP() 22 | peer := Peer{Conn: nil} 23 | if err != nil { 24 | fmt.Println(err) 25 | continue 26 | } 27 | fmt.Println("A client connected :" + tcpConn.RemoteAddr().String()) 28 | go peer.HandRequest() 29 | } 30 | } 31 | 32 | func ListenU(network, address string) { 33 | 34 | var udpAddr *net.UDPAddr 35 | udpAddr, _ = net.ResolveUDPAddr(network, address) 36 | 37 | udpSocket, err := net.ListenUDP(network, udpAddr) 38 | 39 | if err != nil { 40 | fmt.Println("Listen UDP failed") 41 | return 42 | } 43 | 44 | defer udpSocket.Close() 45 | } 46 | -------------------------------------------------------------------------------- /server/ng_peer.go: -------------------------------------------------------------------------------- 1 | package server 2 | 3 | import ( 4 | fmt "fmt" 5 | 6 | //"github.com/gogo/protobuf/proto" 7 | "github.com/golang/protobuf/proto" 8 | "github.com/harlanc/netgo/lib" 9 | ) 10 | 11 | //PeerStatus status of Peer 12 | type PeerStatus uint32 13 | 14 | const ( 15 | _ PeerStatus = iota 16 | //Success status 1 17 | Success 18 | //CreateRoomSuccess status 2 19 | CreateRoomSuccess 20 | //CreateRoomAlreadyExist the room is exist already. 3 21 | CreateRoomAlreadyExist 22 | //JoinRoomSuccess status 4 23 | JoinRoomSuccess 24 | //JoinRoomNotExist the room is not exist. 5 25 | JoinRoomNotExist 26 | //JoinRoomAlreadyInRoom already in the room. 6 27 | JoinRoomAlreadyInRoom 28 | //JoinRoomFull the room is full already. 7 29 | JoinRoomFull 30 | //LeaveRoomSuccess leave a room success. 8 31 | LeaveRoomSuccess 32 | ) 33 | 34 | //Peer struct 35 | type Peer struct { 36 | //peer name 37 | Name string 38 | //peer ID ,it must be unique in a room 39 | ID uint32 40 | //the id of room in which current peer is 41 | RoomID string 42 | 43 | // //store the channel ids to which current peer send msg to . 44 | // //If it has no items,means that all the channels will receice 45 | // //it's messages.If the size is bigger than 0,only the channels in 46 | // //SendToMsgChannelsIds can receive the messages.All the channel ids 47 | // //in SendToMsgChannelsIds should be bigger than 0. 48 | // SendToMsgChannelsIds map[uint32]struct{} 49 | Conn *lib.Conn 50 | 51 | CachedInstantiationParams *InstantiationForwardParams 52 | CachedJoinRoomParams *JoinRoomForwardParams 53 | //Map from unitID_methodname to *RPCForwardParams 54 | CachedRPCsMap map[string]*RPCForwardParams 55 | } 56 | 57 | //AsyncWriteMessage write message 58 | func (peer *Peer) AsyncWriteMessage(msg proto.Message) error { 59 | 60 | responsemsg := msg 61 | if responsemsg == nil { 62 | fmt.Println("the response message should not be empty!") 63 | } 64 | 65 | bytes, err := proto.Marshal(responsemsg) 66 | //logger.LogInfo("first" + string(bytes[:])) 67 | if err != nil { 68 | fmt.Println(err) 69 | } 70 | 71 | //logger.LogInfo(lib.Int2String(len(bytes))) 72 | 73 | writepacket := NewNetgoPacket(uint32(len(bytes)), bytes) 74 | return peer.Conn.AsyncWritePacket(writepacket, 0) 75 | 76 | } 77 | 78 | //HandRequest hand a request 79 | func (peer *Peer) HandRequest() { 80 | 81 | } 82 | 83 | //HandMessage hand a message from client 84 | func (peer *Peer) HandMessage(packet lib.Packet) PeerStatus { 85 | // ipStr := peer.Conn.RemoteAddr().String() 86 | 87 | // defer func() { 88 | // fmt.Println(" Disconnected : " + ipStr) 89 | // peer.Conn.Close() 90 | // }() 91 | 92 | // buf := make([]byte, 4096, 4096) 93 | // for { 94 | // cnt, err := peer.Conn.Read(buf) 95 | // if err != nil { 96 | // panic(err) 97 | // } 98 | p := packet.(*NetgoPacket) 99 | stReceive := &SendMessage{} 100 | 101 | body := p.GetBody() 102 | 103 | err := proto.Unmarshal(body, stReceive) 104 | if err != nil { 105 | panic(err) 106 | } 107 | 108 | //fmt.Println("receive", peer.Conn.GetRawConn().RemoteAddr(), stReceive) 109 | 110 | return peer.processMessage(stReceive, body) 111 | //} 112 | 113 | } 114 | 115 | func (peer *Peer) processMessage(msg *SendMessage, rawmsg []byte) PeerStatus { 116 | 117 | switch msg.MsgType { 118 | case MessageType_CreateRoom: 119 | return peer.CreateRoom(msg.CrParams.RoomId, msg.CrParams.MaxNumber) 120 | case MessageType_JoinRoom: 121 | return peer.JoinRoom(msg.JrParams.RoomId) 122 | case MessageType_JoinOrCreateRoom: 123 | return peer.JoinOrCreateRoom(msg.JocrParams.RoomId, msg.JocrParams.MaxNumber) 124 | case MessageType_LeaveRoom: 125 | return peer.LeaveRoom() 126 | case MessageType_RPC: 127 | return peer.RPC(msg.RpcParams) 128 | case MessageType_Instantiation: 129 | return peer.Instantiation(msg.IParams) 130 | case MessageType_ViewSync: 131 | return peer.ViewSync(msg.VsParams) 132 | case MessageType_CustomEvent: 133 | return peer.CustomEvent(msg.CeParams) 134 | case MessageType_SubscribeMsgChannels: 135 | return peer.SubscribeMsgChannels(msg.SmcParams.Channelids) 136 | case MessageType_UnSubscribeMsgChannels: 137 | return peer.UnSubscribeMsgChannels(msg.UsmcParams.Channelids) 138 | default: 139 | 140 | } 141 | return Success 142 | } 143 | 144 | //CreateRoom create a game room 145 | func (peer *Peer) CreateRoom(roomid string, maxnumber uint32) PeerStatus { 146 | 147 | //must add a lock for ID2Room 148 | if _server.IsRoomExist(roomid) { 149 | return CreateRoomAlreadyExist 150 | } 151 | //create a new Room 152 | room := NewRoom(roomid, maxnumber) 153 | room.AddPeer(peer) 154 | 155 | _server.AddRoom(room) 156 | 157 | return CreateRoomSuccess 158 | } 159 | 160 | //JoinRoom join a game room 161 | func (peer *Peer) JoinRoom(roomid string) PeerStatus { 162 | 163 | room, ok := _server.ID2Room[roomid] 164 | if !ok { 165 | return JoinRoomNotExist 166 | } 167 | 168 | if peer.ID != 0 { 169 | return JoinRoomAlreadyInRoom 170 | } 171 | 172 | if uint32(len(room.ID2Peer)) == room.MaxNumber { 173 | return JoinRoomFull 174 | } 175 | 176 | room.AddPeer(peer) 177 | 178 | var forwardParams JoinRoomForwardParams = JoinRoomForwardParams{} 179 | peer.CachedJoinRoomParams = &forwardParams 180 | 181 | var fmsg2others ForwardMessage 182 | fmsg2others.MsgType = MessageType_JoinRoom 183 | fmsg2others.JrfParams = &forwardParams 184 | fmsg2others.PeerId = peer.ID 185 | 186 | var recmsg2others ReceiveMessage 187 | recmsg2others.ReceiveMsgType = ReceiveMessageType_Forward 188 | recmsg2others.FMsg = &fmsg2others 189 | 190 | var fmsg2myself ForwardMessage 191 | fmsg2myself.MsgType = MessageType_JoinRoom 192 | // fmsg2myself.JrfParams = &forwardParams 193 | // fmsg2myself.PeerId = peer.ID 194 | 195 | var recmsg2myself ReceiveMessage 196 | recmsg2myself.ReceiveMsgType = ReceiveMessageType_Forward 197 | recmsg2myself.FMsg = &fmsg2myself 198 | 199 | peers := peer.GetAllSubscribePeers(nil) 200 | for _, v := range peers { 201 | if v.ID != peer.ID { 202 | v.AsyncWriteMessage(&recmsg2others) 203 | 204 | fmsg2myself.JrfParams = v.CachedJoinRoomParams 205 | fmsg2myself.PeerId = v.ID 206 | peer.AsyncWriteMessage(&recmsg2myself) 207 | } 208 | } 209 | 210 | return JoinRoomSuccess 211 | } 212 | 213 | //JoinOrCreateRoom if exist join else create room 214 | func (peer *Peer) JoinOrCreateRoom(roomid string, maxnumber uint32) PeerStatus { 215 | 216 | _, err := _server.GetRoom(roomid) 217 | 218 | if err != nil { 219 | return peer.CreateRoom(roomid, maxnumber) 220 | } 221 | return peer.JoinRoom(roomid) 222 | } 223 | 224 | //LeaveRoom leave a game room 225 | func (peer *Peer) LeaveRoom() PeerStatus { 226 | 227 | peers := peer.GetAllSubscribePeers(nil) 228 | 229 | room, ok := _server.ID2Room[peer.RoomID] 230 | if ok { 231 | //delete revelant peer from the Subscribed Channels. 232 | room.UnSubscribeAllChannels(peer.ID) 233 | //remove the Peer from current room 234 | room.DeletePeer(peer) 235 | 236 | var forwardParams LeaveRoomForwardParams = LeaveRoomForwardParams{} 237 | 238 | var forwardmsg ForwardMessage 239 | forwardmsg.MsgType = MessageType_LeaveRoom 240 | forwardmsg.LrfParams = &forwardParams 241 | forwardmsg.PeerId = peer.ID 242 | 243 | var recmessage ReceiveMessage 244 | recmessage.ReceiveMsgType = ReceiveMessageType_Forward 245 | recmessage.FMsg = &forwardmsg 246 | 247 | for _, v := range peers { 248 | if v.ID != peer.ID { 249 | v.AsyncWriteMessage(&recmessage) 250 | } 251 | } 252 | } 253 | if room.GetPeersCount() == 0 { 254 | _server.DeleteRoom(peer.RoomID) 255 | } 256 | return LeaveRoomSuccess 257 | } 258 | 259 | //RPC rpc method 260 | func (peer *Peer) RPC(params *RPCParams) PeerStatus { 261 | 262 | peers := peer.GetAllSubscribePeers(params.Options) 263 | 264 | var forwardParams RPCForwardParams 265 | forwardParams.MethodName = params.MethodName 266 | forwardParams.ViewID = params.ViewID 267 | forwardParams.Parameters = params.Parameters 268 | 269 | var forwardmsg ForwardMessage 270 | forwardmsg.MsgType = MessageType_RPC 271 | forwardmsg.RfParams = &forwardParams 272 | forwardmsg.PeerId = peer.ID 273 | 274 | var recmessage ReceiveMessage 275 | recmessage.ReceiveMsgType = ReceiveMessageType_Forward 276 | recmessage.FMsg = &forwardmsg 277 | 278 | switch params.Target { 279 | 280 | case RPCTarget_All: 281 | for _, v := range peers { 282 | v.AsyncWriteMessage(&recmessage) 283 | } 284 | case RPCTarget_Others: 285 | 286 | for _, v := range peers { 287 | if v.ID != peer.ID { 288 | v.AsyncWriteMessage(&recmessage) 289 | } 290 | } 291 | } 292 | 293 | return Success 294 | } 295 | 296 | //Instantiation Instantiation a prefab 297 | func (peer *Peer) Instantiation(params *InstantiationParams) PeerStatus { 298 | 299 | peers := peer.GetAllSubscribePeers(params.Options) 300 | 301 | var forwardParams InstantiationForwardParams 302 | 303 | forwardParams.PrefabName = params.PrefabName 304 | forwardParams.Position = params.Position 305 | forwardParams.Rotation = params.Rotation 306 | forwardParams.ViewIDs = params.ViewIDs 307 | 308 | //save local 309 | peer.CachedInstantiationParams = &forwardParams 310 | 311 | //let others' instantiate my prefab 312 | var forwardmsgothers ForwardMessage 313 | forwardmsgothers.MsgType = MessageType_Instantiation 314 | forwardmsgothers.IfParams = &forwardParams 315 | forwardmsgothers.PeerId = peer.ID 316 | 317 | var recmessageothers ReceiveMessage 318 | recmessageothers.ReceiveMsgType = ReceiveMessageType_Forward 319 | recmessageothers.FMsg = &forwardmsgothers 320 | 321 | //others' prefab instantiated in my room 322 | var forwardmsgmyself ForwardMessage 323 | forwardmsgmyself.MsgType = MessageType_Instantiation 324 | 325 | var recmessagemyself ReceiveMessage 326 | recmessagemyself.ReceiveMsgType = ReceiveMessageType_Forward 327 | recmessagemyself.FMsg = &forwardmsgmyself 328 | 329 | for _, v := range peers { 330 | if v.ID != peer.ID { 331 | 332 | v.AsyncWriteMessage(&recmessageothers) 333 | 334 | forwardmsgmyself.IfParams = v.CachedInstantiationParams 335 | forwardmsgmyself.PeerId = v.ID 336 | peer.AsyncWriteMessage(&recmessagemyself) 337 | } 338 | } 339 | return Success 340 | } 341 | 342 | //ViewSync Instantiation a prefab 343 | func (peer *Peer) ViewSync(params *ViewSyncParams) PeerStatus { 344 | 345 | peers := peer.GetAllSubscribePeers(params.Options) 346 | 347 | var forwardParams ViewSyncForwardParams 348 | forwardParams.VsdParams = params.VsdParams 349 | 350 | var forwardmsg ForwardMessage 351 | forwardmsg.MsgType = MessageType_ViewSync 352 | forwardmsg.VsfParams = &forwardParams 353 | 354 | var recmessage ReceiveMessage 355 | recmessage.ReceiveMsgType = ReceiveMessageType_Forward 356 | recmessage.FMsg = &forwardmsg 357 | 358 | for _, v := range peers { 359 | if v.ID != peer.ID { 360 | v.AsyncWriteMessage(&recmessage) 361 | } 362 | } 363 | return Success 364 | } 365 | 366 | //CustomEvent issue custom event 367 | func (peer *Peer) CustomEvent(params *CustomEventParams) PeerStatus { 368 | 369 | peers := peer.GetAllSubscribePeers(params.Options) 370 | 371 | var forwardParams CustomEventForwardParams 372 | forwardParams.EventID = params.EventID 373 | forwardParams.CustomData = params.CustomData 374 | 375 | var forwardmsg ForwardMessage 376 | forwardmsg.MsgType = MessageType_CustomEvent 377 | forwardmsg.CeParams = &forwardParams 378 | 379 | var recmessage ReceiveMessage 380 | recmessage.ReceiveMsgType = ReceiveMessageType_Forward 381 | recmessage.FMsg = &forwardmsg 382 | 383 | //TODO 384 | //targetids := params.TargetPeerIds 385 | 386 | for _, v := range peers { 387 | if v.ID != peer.ID { 388 | v.AsyncWriteMessage(&recmessage) 389 | } 390 | } 391 | return Success 392 | 393 | } 394 | 395 | //GetAllSubscribePeers get all the subscribe peers 396 | func (peer *Peer) GetAllSubscribePeers(commonoptions *CommonOptions) []*Peer { 397 | 398 | var channels []uint32 399 | 400 | if commonoptions == nil { 401 | channels = make([]uint32, 0) 402 | } else { 403 | channels = commonoptions.SendToChannelIds 404 | } 405 | 406 | room, _ := _server.GetRoom(peer.RoomID) 407 | return room.GetAllSubscribePeers(channels) 408 | } 409 | 410 | //SubscribeMsgChannels subscribe msg channels 411 | func (peer *Peer) SubscribeMsgChannels(channelids []uint32) PeerStatus { 412 | 413 | room, _ := _server.GetRoom(peer.RoomID) 414 | for _, v := range channelids { 415 | room.SubscribeChannel(v, peer.ID) 416 | } 417 | return Success 418 | } 419 | 420 | //UnSubscribeMsgChannels unsubscribe msg channels 421 | func (peer *Peer) UnSubscribeMsgChannels(channelids []uint32) PeerStatus { 422 | 423 | room, _ := _server.GetRoom(peer.RoomID) 424 | for _, v := range channelids { 425 | room.UnSubscribeChannel(v, peer.ID) 426 | } 427 | return Success 428 | } 429 | --------------------------------------------------------------------------------