当前位置:网站首页>Et framework -22 creating serverinfo entities and events
Et framework -22 creating serverinfo entities and events
2022-06-13 03:57:00 【Dutch pig small ash】
The goal of this section is The client obtains the number of server rooms
In multiplayer online games , We often have a lot of room concepts , Or the concept of regional service , This is our task in this section
The client sends the request , To get a ServerInfo Set
List of articles
- 1. Client part
- 1.1 establish ServerInfo Entity
- 1.2 Create a message to get the list of servers
- 1.3 To write ServerInfo Of System
- 1.4 Get into LoginHelper Write a method to get the server list in
- 1.5 Create a new component ServerInfosComponent
- 1.6 To write ServerInfosComponent System
- 1.7 Get into SceneFactory Create... In ZoneScene Add our components when
- 1.8 Get into LoginHelper in GetServerInfos Method to traverse our list of servers
- 2. Server part
- 2.1 Server add ServerInfo and ServerInfoSystem
- 2.2 Server add ServerInfoManagerComponent Components
- 2.3 To write ServerInfoManagerComponent System
- 2.4 ServerInfo Add a... Under the directory Handler Handle the messages sent by the client
- 2.5 stay SceneFacotry Created in Account Add this component to the server
- summary
1. Client part
1.1 establish ServerInfo Entity

there ServerInfo Entity , It is a room service entity
Corresponding to stateful , And name

1.2 Create a message to get the list of servers
Defining structure , As the body of the message

The return message must contain this structure , And set to repeated Representatives can repeat , That's one list
This list Can store our room area service collection


1.3 To write ServerInfo Of System

Here is the of the client ServerInfo System
So what needs to be handled
1. The structure of the message sent from the server ServerInfoProto Parse and save
2. Set the client's local ServerInfo Convert to ServerInfoProto
1.4 Get into LoginHelper Write a method to get the server list in

LoginHelper This is where we write the login method
Here we define a new asynchronous function , The return value is Int, Represents the result of the function

1.5 Create a new component ServerInfosComponent
On the client side we need ServerInfosComponent Component to save the data sent by our server n individual S erverInfo room
So our component is a List To hold the ServerInfo Room list


1.6 To write ServerInfosComponent System
ServerInfosComponent System yes ServerInfosComponent Processing function of
stay Hotfix layer

We did ServerInfosComponent System The entity's Destory Abstract method , It's actually release List It's all Entity
And then we expanded , add to ServerInfo The method of entity , Add it to List Inside

1.7 Get into SceneFactory Create... In ZoneScene Add our components when


1.8 Get into LoginHelper in GetServerInfos Method to traverse our list of servers
We are LoginHelper When sending the request room list to the server , Get one List, So we can go through List, Then save them to our client mounted ServerInfosComponent On the components


2. Server part
2.1 Server add ServerInfo and ServerInfoSystem
direct Add The code from our client side is OK , There is no need to rewrite 

2.2 Server add ServerInfoManagerComponent Components

there ServerInfoManagerComponent Component is used to store the room information collection on the server

2.3 To write ServerInfoManagerComponent System

The specific logic
Contact with the database , So here we use asynchronous Awake

Load Is the life cycle function of the thermal overload
We are Awake and Load When , We need to retrieve our room information from the database

2.4 ServerInfo Add a... Under the directory Handler Handle the messages sent by the client
Define a ErrorCode Represents a token error 

If Account Server connected session It corresponds to AccountId Of Token And the client Token atypism , Then there is something wrong with the account

After success, the server information will be returned directly
2.5 stay SceneFacotry Created in Account Add this component to the server


summary
In this section, we completed the client to obtain the number of server rooms
In multiplayer online games , We often have a lot of room concepts , Or the concept of regional service
The client sends the request , To get a ServerInfo Set , Then the server receives the request , Do judgment , And then ServerInfo The collection is taken from the database , Then send a reply message to the client
边栏推荐
- [zeloengine] localization process /imgui Chinese culture
- What to bring to 2022
- Example of try catch finally execution sequence
- Cache read / write -- write
- Binocular vision -- creating an "optimal solution" for outdoor obstacle avoidance
- Value of line height
- 【Web】Cookie 和 Session
- [test development] automated test selenium (III) -- unittest framework analysis
- 2022春学期总结
- Goframe day 5
猜你喜欢

【测试开发】自动化测试selenium(二)——webdriver常用的API

单片机:A/D 差分输入信号

Among the four common technologies for UAV obstacle avoidance, why does Dajiang prefer binocular vision

MySQL 8.0 enables remote root user access and solves the problem of you are not allowed to create a user with Grant

Big Five personality learning records

单片机:I2C通信协议讲解

【测试开发】测试管理工具禅道的安装

机器人避障系统基础

Line height equals height why not center
![[笔记]vs2015 编写汇编masm32之使用MASM32库](/img/f5/b47336af248d1b485208ec3f9ca12b.png)
[笔记]vs2015 编写汇编masm32之使用MASM32库
随机推荐
[test development] automatic test selenium (I)
干预分析 + 伪回归
Single chip microcomputer: basic concepts of a/d and d/a
[multithreading] what is multithreading in the end -- the elementary level of multithreading (review for self use)
解答私信@田田WX //2022-6-12 C语言 51单片机LED模拟交通灯
Lambda终结操作查找与匹配noneMatch
Single chip microcomputer: d/a output
Synching build your own synchronization cloud
单片机:A/D 差分输入信号
[test development] automated test selenium (III) -- unittest framework analysis
Lambda终结操作max&min
Redis-HyperLogLog-基数统计算法
单片机:NEC 协议红外遥控器
【多线程】多线程到底是个甚——多线程初阶(复习自用)
Alibaba cloud keep on record
Cache read / write -- write
单片机/嵌入式的实时性疑问解答
5G China unicom AP:B SMS ASCII 转码要求
MSG messages in ROS
Precautions for stream flow