添加示例项目
This commit is contained in:
11
示例项目/点券充值卡/Proj.ifo
Normal file
11
示例项目/点券充值卡/Proj.ifo
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"ProjectName": "点券充值卡",
|
||||
"ProjectDescribe": "根据道具ID充值对应的点券数量",
|
||||
"ProjectAuthor": "南瓜",
|
||||
"ProjectVersion": 1.0,
|
||||
"ProjectConfig": "点券充值卡配置_Nangua.json",
|
||||
"ProjectFiles": [
|
||||
"点券充值卡.nut"
|
||||
],
|
||||
"ProjectRunFunc": "_Dps_handleCeraCard_Main_"
|
||||
}
|
||||
38
示例项目/点券充值卡/点券充值卡.nut
Normal file
38
示例项目/点券充值卡/点券充值卡.nut
Normal file
@@ -0,0 +1,38 @@
|
||||
function handleCeraCardBynangua(SUser, ItemId) {
|
||||
local Config = GlobalConfig.Get("点券充值卡配置_Nangua.json");
|
||||
local ItemIdStr = ItemId.tostring();
|
||||
|
||||
if (Config["充值卡配置"].rawin(ItemIdStr)) {
|
||||
local CeraAmount = Config["充值卡配置"][ItemIdStr];
|
||||
SUser.RechargeCera(CeraAmount);
|
||||
if (Config["启用233发包(true/false)"]) {
|
||||
SUser.SendNotiBox(format(Config["充值成功提示"], CeraAmount), 1);
|
||||
}else{
|
||||
SUser.SendNotiPacketMessage(format(Config["充值成功提示"], CeraAmount), 8);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//加载入口
|
||||
function _Dps_handleCeraCard_Main_() {
|
||||
_Dps_handleCeraCard_Logic_();
|
||||
}
|
||||
|
||||
//重载入口
|
||||
function _Dps_handleCeraCard_Main_Reload_(OldConfig) {
|
||||
local Config = GlobalConfig.Get("点券充值卡配置_Nangua.json");
|
||||
// 删除旧的注册
|
||||
foreach(itemId, _ in OldConfig["充值卡配置"]) {
|
||||
Cb_Use_Item_Sp_Func.rawdelete(itemId.tointeger());
|
||||
}
|
||||
//重新注册
|
||||
_Dps_handleCeraCard_Logic_();
|
||||
}
|
||||
|
||||
function _Dps_handleCeraCard_Logic_() {
|
||||
local Config = GlobalConfig.Get("点券充值卡配置_Nangua.json");
|
||||
// 注册所有充值卡
|
||||
foreach(itemId, _ in Config["充值卡配置"]) {
|
||||
Cb_Use_Item_Sp_Func[itemId.tointeger()] <- handleCeraCardBynangua;
|
||||
}
|
||||
}
|
||||
12
示例项目/点券充值卡/点券充值卡配置_Nangua.json
Normal file
12
示例项目/点券充值卡/点券充值卡配置_Nangua.json
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"充值卡配置": {
|
||||
"2024120601": 1000,
|
||||
"2024120602": 5000,
|
||||
"2024120603": 10000,
|
||||
"2024120604": 30000,
|
||||
"2024120605": 50000
|
||||
},
|
||||
"提示": "如果使用233发包需要客户端插件,在群文件搜索<客户端插件消息框233>下载使用,否则会导致游戏崩溃",
|
||||
"启用233发包(true/false)": false,
|
||||
"充值成功提示": "成功充值 %d 点券"
|
||||
}
|
||||
Reference in New Issue
Block a user