Skip to content

Latest commit

 

History

13 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

battle:战斗服
logic:逻辑服
gateway:网关服
login:登陆服
core: 框架核心模块
common:通用工具包
protocol:接口协议包
tools:代码自动生成、机器人模块


特性:
1.使用protoBuf协议作为网络数据编码方式
2.接口执行时,支持多种将其绑定到指定任务队列的策略,队列内串行执行,减少加锁消耗
3.在内存中维护玩家数据,异步落库,支持启动时检测数据库版本号
4.支持分模块加载玩家的数据, 优化加载不在线玩家的数据量
5.玩家数据及公共数据支持多种类型的生命周期
6.支持redis订阅/发布接口
7.提供soa服务,支持服务器以node为节点向nacos服务中心注册,node之间通过rpc请求通信
8.支持http和tcp两种通信模式
9.使用时间轮定时器,支持延迟、定时间隔以及crontab表达式的定时任务
10.支持基于protoBuf协议的RPC通信机制
11.支持可扩展的请求拦截器,支持接口日志打印、权限(待实现)、限流策略(待实现)以及分布式请求追踪(待实现)功能
12.提供了一个灵活的json构造器JsonBuilder
13.提供了一个支持在线修改的通用配置文件读取工具Configuration
14.提供了一个多语言工具LocalMessage,以及消息模板格式化工具MessageFormat
15.提供了一个通用的排行榜工具RankManager/Rank,采用前N名精确排行,N名之后采用非精确排行的方式排名
16.封装logback日志框架,提供多种类型的日志,并且优化错误日志
17.提供了一个雪花算法SnowFlake,每秒产生3.2万个Id。在流量峰值时,可扩大Id使用量,最多支持5 * 3.2万=16万个Id
18.提供了日期处理工具,http/https请求发送工具,随机工具,类扫描工具,字符串处理工具等
19.提供了解析pcap文件的工具,将protoBuf数据流反序列化成json


Action类:
@Action
public class PlayerAction {

    @Command(Cmd.PlayerGetListRq_Value)
    public void getPlayerList(PlayerGetListRq rq, GamePlayer player) {
    }

    @Command(Cmd.PlayerGetInfoRq_Value)
    public void getPlayerInfo(PlayerGetInfoRq rq, GamePlayer player) {
    }

    @Bind(bindType=CmdBindType.Bind_Fields, index = 0, bind={"playerId"})
    @Command(Cmd.PlayerUpdateNameRq_Value)
    public void updatePlayerName(PlayerUpdateNameRq rq, GamePlayer player) {
    }

    @Bind(bindType=CmdBindType.Bind_Fields, index = 0, bind={"clubId"}) // ClubApplyRq中包含clubId字段
    @Command(Cmd.ClubApplyRq_Value)
    public void apply(ClubApplyRq rq, GamePlayer player) {
    }

}

redis订阅接口:
@Action
public class RedisAction {

    @RedisCommand(CmdPb.Cmd.TopicPlayerOnline_VALUE)
    public void onlinePlayerMessage(RedisPb.PlayerOnlinePb msg) {

    }

}

redis发布:
RedisPb.PlayerOnlinePb.Builder builder = RedisPb.PlayerOnlinePb.newBuilder();
builder.setXXX
...
RedisUtil.publishTopic(CmdPb.Cmd.TopicPlayerOnline_VALUE, builder.build());


定时任务:
@Timer
public class PlayerTimer {

    @Schedule(crontab="0 0 0 * * ? *")
    public void resetOnlinePlayerDaily(long now) {

    }

}


IDEA中,自动生成带option的setter/getter方法:
```
#set($paramName = $helper.getParamName($field, $project))
#if($field.modifierStatic)
static ##
#end
void set$StringUtil.capitalizeWithJavaBeanConvention($StringUtil.sanitizeJavaIdentifier($helper.getPropertyName($field, $project)))($field.type $paramName) {
#if ($field.name == $paramName)
    #if (!$field.modifierStatic)
    #else
    #end
#end
#if ($field.primitive)
    if (this.$field.name != $paramName) {
        this.$field.name = $field.name;
        setOp(Option.Update);
    }
}
#else
if ($paramName != null && !$paramName##
.equals(this.$field.name)) {
this.$field.name = $field.name;
setOp(Option.Update);
}
}
#end
```

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages