This chapter is almost a month away from the previous chapter. During this period, it is mainly about the transformation and reconstruction of the client. The content of the overall client is almost completely different from the command-line version of the previous chapter.
According to the previous plan, I converted all the code written in JS to TS and transplanted the command-line interactive interface to the conventional game interactive interface (using cocos creator game engine).
Previously, in order to quickly realize the function, the server and client used only one file to encode. Up to now, the client code of the project has been modularized, and the classic PureMVC library has been introduced to completely decouple the UI interaction and data, network messages and game operation logic, so as to create conditions for extracting the code of the framework independent of the game engine (it is planned to use one framework to access different view layer engines).
PureMVC has been introduced in previous articles. The core idea is to decouple view and data. The data is processed by proxy and the facade is controlled by proxy.
Compared with the previous version, some changes are involved: -The difference between socket and web socket API. It mainly includes the names of several monitored events and the interfaces for sending messages. -UI display layer independent. Command line output and game engine rendering view interactive operation interface.
- socket 和 web socket api 的区别。主要是几个监听的事件名字，和发送消息的接口。
Did you find this article valuable?
Support Lizhiyu by becoming a sponsor. Any amount is appreciated!