Comments (1)
使用文档 https://www.yuque.com/iohao/game/sw1y8u
使用示例
// 自定义一个元信息类,实现 Attachment 元附加信息接口
@ProtobufClass
@FieldDefaults(level = AccessLevel.PUBLIC)
public class MyAttachment implements Attachment {
@Getter
long userId;
String nickname;
}
@ActionController(1)
public class DemoAction {
@ActionMethod(1)
public void attachment(FlowContext flowContext) {
// 创建自定义的元附加信息对象
MyAttachment myAttachment = new MyAttachment();
myAttachment.userId = flowContext.getUserId();
myAttachment.nickname = "英雄无敌3";
// 设置元信息 ----- 关键代码
ExternalCommunicationKit.setAttachment(myAttachment);
}
@ActionMethod(2)
public MyAttachment printAttachment(FlowContext flowContext) {
// 得到元信息,这个是在上面的方法中设置的元信息对象
var attachment = flowContext.getAttachment(MyAttachment.class);
return attachment;
}
}
from iogame.
Related Issues (20)
- [对接文档] - 广播文档构建器支持对参数的单独描述
- [core] - 增加范围内的广播接口 RangeBroadcaster,业务参数支持基础类型(协议碎片)的简化使用 HOT 4
- light-domain-event对比虚拟线程 HOT 1
- 模拟系统创建房间,RoomCreateContext 的使用 HOT 3
- 模拟系统创建房间,GameFlowContext 的使用 HOT 4
- MsgTransferTopic.internalBroadcast(Broadcast.java:94) Exception caught when serialize content of rpc request command! HOT 2
- 分布式事件总线的使用 - 除了用 FlowContext 来发布事件,还有的其他方式吗? HOT 2
- [core] FlowContext 更新元信息后,需要立即生效(跨服调用时)
- 使用微信小程序进行websocket连接,在电脑端微信开发工具上本地测试连接与数据传输正常,但是使用手机真机调试时,连接正常,发送的数据会报类型转换错误TextWebSocketFrame 无法强制转换为类ExternalMessage HOT 2
- [内置 kit] 轻量的定时入库辅助功能 HOT 2
- 逻辑服之间通过路由调用超时返回 null HOT 6
- [示例] Godot 连接示例;Protobuf、C#、Netty HOT 1
- [示例] Cocos Creator 连接示例;Protobuf、TypeScript、Netty
- [示例] UE5 连接示例;Protobuf、C++、Netty
- [示例] Unity 连接示例;Protobuf、C#、Netty HOT 1
- [示例] FXGL 连接示例;Protobuf、java、Netty HOT 2
- [示例] JavaScript 连接示例;json、JavaScript、Netty HOT 1
- [示例] TypeScript 连接示例;json、TypeScript、Netty HOT 1
- [示例] SDK && SDK 代码生成 && 各游戏引擎相关示例集合 Unity、 UE、 Cocos Creator、FXGL、Godot、Netty ...更多 HOT 2
- 类型转换异常,AggregatedFullHttpRequest无法转换为BarMessage HOT 10
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from iogame.