真的平平无奇,主要是免费
功能介绍
- 支持将指定格式的EXCEL配表转换成JSON或TS格式
- 支持对配表错配字段进行检查( int 和 string )
- 支持客户端 / 服务端模式分类字段导出
- 导出TS支持多字段索引、高效遍历及访问代码
- 作为智游堂源码商城的配套插件工具,也可以自由免费在其它游戏工程中使用
使用教程
- 获得插件并安装
- 开启插件
- 插件操作说明
- EXCEL格式定义说明
导出说明
- 导出JSON格式
{
"SYS_Ads":[
{ "id": 1, "platform": 1, "video_ads": "", "banner_ads": "", "inserted_ads": "" },
{ "id": 2, "platform": 2, "video_ads": "", "banner_ads": "", "inserted_ads": "" },
{ "id": 3, "platform": 3, "video_ads": "", "banner_ads": "", "inserted_ads": "" },
{ "id": 4, "platform": 4, "video_ads": "", "banner_ads": "", "inserted_ads": "" }
]
}
- 导出TS格式
// 导出结构和注释
export interface record_SYS_Ads {
readonly id? : number ,//广告ID
readonly platform? : number ,//广告平台
readonly video_ads? : string ,//视频广告ID
readonly banner_ads? : string ,//banner(原生模板)广告ID
readonly inserted_ads? : string ,//插屏广告ID
}
// 封装配表
export default class SYS_Ads {
// 数据
private static __data = [
[1,1,"","","",],
[2,2,"","","",],
[3,3,"","","",],
[4,4,"","","",],
]
// 索引
private static __index_id = {
"1" : 0,
"2" : 1,
"3" : 2,
"4" : 3,
}
// map
private static __key_map = {
"id" : 0,
"platform" : 1,
"video_ads" : 2,
"banner_ads" : 3,
"inserted_ads" : 4,
}
private static __caches = {}
// 获取长度
static getLength():number {....}
// 按key查找
static hasKey(k) :boolean{....}
// 按索引
static indexOf(index) : record_SYS_Ads {....}
// 按id
static get(id): record_SYS_Ads {....}
// 各种高效获取字段值的方法
static getValue(id,itemKey: any): any {....}
static getKeyValue(kvs: Array<{ key: any, value: any }>): record_SYS_Ads {....}
static getKeyValueList(kvs: Array<{ key: any, value: any }>): Array<record_SYS_Ads> {....}
// 各种高效查找字段值的方法
static find(findCB: (item: any) => boolean): record_SYS_Ads {....}
static findList(findCB: (idx: number, item: any) => number): Array<record_SYS_Ads> {....}
static byKey(key: any): number {....}
}
- 代码实际应用(TS格式)
// 按id获取
SYS_Ads.get(id)
// 按索引获取
SYS_Ads.indexOf(i)
// 获取某个id的字段值
SYS_Ads.getValue(id, "platform")
// 按其它值获取
SYS_Ads.getKeyValue([{ key: "platform", value: platformType }])
// 获取一组
SYS_Ads.getKeyValueList([{ key: "platform", value: platformType }])
// 查找单条记录
SYS_Ads.find((item: any)=> {item.platform == 1})
// 查找多条记录
SYS_Ads.findList((idx: number, item: any)=> {idx > 10 && item.platform == 1})
插件地址
-
其它精品源码
文档教程
- 关注公众号获得最新游戏开发技术、技巧、教程插件和搞钱心得。

联系作者
- 添加微信与我联系







