marineparkclient/README.md
2023-08-15 11:09:12 +08:00

155 lines
4.0 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 5号玩家共建分支
### TODO LIST
* [x] 网络通讯模块
* [x] 日志模块
* [x] BUTTON常规点击效果事件封装(btnPrefab脚本挂载)
* [x] 层级管理
* [x] 音频管理器
* [x] UI管理器(prefab资源及prefab生成的组件和界面管理)
* [x] 开发者界面切换日志输出过滤通过UIManager打开界面协议流程调用游戏逻辑功能、动画检测牌型等
* [ ] 代码特效管理器
* [ ] 活动图标组件
* [ ] 引导系统
* [ ] 配置管理工具
* [ ] 资源管理器
- 基于2.4的cc.AssetManager的加载封装
- 更加方便的接口调用,只实现了三个接口:
- preload 预加载
- getAssetAsyn 异步取资源
- getAsset 同步取资源
- 强预加载实现(引擎的预加载接口为弱预加载),为首次呈现游戏提供无缝体验支持,且支持进度监测
### NOTE
* proto_bundle 不能导入为插件
*
```javascript
// var $protobuf = require("protobufjs/minimal"); <br>
var $protobuf = protobuf;
```
*
```typescript
// import * as $protobuf from "protobufjs"; <br>
import * as $protobuf from "./protobuf";
```
* 定义自定义数组
```typescript
@property(cc.Button)
btnArr:cc.Button[] =[];
```
* 定义自定义类型
**自定义类型**
```typescript
enum E_POKER_SUIT {
NONE,
DIAMONDS,
CLUBS,
HEARTS,
JOKER
}
@ccclass
class pokerSprFra{
@property(cc.SpriteFrame)
[E_POKER_SUIT.DIAMONDS]:cc.SpriteFrame = null;
@property(cc.SpriteFrame)
[E_POKER_SUIT.HEARTS]:cc.SpriteFrame = null;
@property(cc.SpriteFrame)
[E_POKER_SUIT.SPADES]:cc.SpriteFrame = null;
constructor() {}
}
```
**使用自定义类型**
```typescript
@property({type:pokerSprFra})
sprFr_Dic = {};
```
* 定义getter setter
```typescript
private _state: E_CONTROL_PANEL_STATE;
@property
get state () {
return this._state;
}
set state (value: E_CONTROL_PANEL_STATE) {
this._state = value;
this.changeStatus(value)
}
```
---
### VSCODE 快捷键
* Shift + Alt + Down/Up 复制光标所在行,并根据操作方向粘贴到临近位置
* 格式化代码: Alt + Shift + F (格式化后保存提交,确保代码格式一致,提高可读性)
---
### 命名规范
* 语法顺序
- 驼峰命名
- 形容词在前,主语在后 e.g. prettyGirl
- 下划线命名(少用)
- 主语在前,形容词在后 e.g. girl_pretty
- 帕斯卡命名
- 同驼峰
* 适用类型
- 类名, prefab, scene 等使用[帕斯卡命名法] e.g. GameScene
- 方法名, 变量名 等使用[驼峰命名法] e.g. getGameScene
- 常量 使用[下划线命名法](全大写, enum以E开头type以T开头
e.g.
``` typescript
enum E_HAIR_STYLE
type T_HAIR_STYLE
```
- 特殊情况
- 私有变量 e.g. mName
- 静态私有变量 e.g. sName
### 框架说明
* 解耦规范:
+ 具体挂载UI节点的view类只关注该节点UI相关操作, 以及对事件的处理逻辑, 所有需要的非UI节点数据依赖注入原则上“挂载UI节点的view类”仅被相应的Mediator类引用
+ View 类对其他所有类无感知(主场景和强关联的组件除外 e.g. DdzGameScene; list与item), 目的是让UI组件及脚本方便移植可复用。
* 名词解释
+ PM:Play Moudle, 与大厅模块相对应的游戏模块
* 列表视图
+ 列表继承 PM_UI_List
+ 列表项脚本继承 PM_Abs_UI_ListItem
### 项目代码目录结构
* Script
+ command
+ component(视图组件)
- listitem(列表项组件)
+ componentScript(为视图组件提供行为的脚本组件)
+ devTool
+ facade
+ global
+ manager
+ mediator
+ model
+ net
+ pb
+ plugin(三方库)
### 子游戏bundle加载流程
* 大厅loadBundle实例化预制体
* 预制体挂在场景脚本组件onLoad,初始化mvc框架