Alert.lua
1.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
cc.exports.Alert = {}
function Alert.showOne(msg,okFun,cancelFun)
local receiver = require("app.views.view.AlertOneView"):show(msg,okFun,cancelFun);
local scene = cc.Director:getInstance():getRunningScene();
scene.keypadManager:addKeypadReceiver(receiver);
end
function Alert.showTwo(msg,okFun,cancelFun,selectedIndex)
local receiver = require("app.views.view.AlertTwoView"):show(msg,okFun,cancelFun,selectedIndex);
local scene = cc.Director:getInstance():getRunningScene();
scene.keypadManager:addKeypadReceiver(receiver);
end
function Alert.showNoMoney(shopID,okFun,cancelFun)
local scene = cc.Director:getInstance():getRunningScene();
local receiver;
local firstPayInfo = ActivityModel.getCurrentFirstPayInfo();
local shopInfo = ShopInfo.getShopInfo(shopID);
local costId = shopInfo.costList[1].id;
local costNum = shopInfo.costList[1].num;
local myNum = UserModel.getItemNum(costId);
print(costId,"my num:",myNum,"cost num:",costNum)
if UserModel.relief_cnt > 0 and UserModel.getCoin() < GameConfig.relief_base then
receiver = require("app.views.view.ReliefView"):show();
receiver.okFun = okFun;
elseif firstPayInfo and tonumber(firstPayInfo.costList[1].num) == 1.0 and myNum < costNum then
receiver = require("app.views.view.ActivityView"):show("ActivityFirstPayView");
receiver.okFun = okFun;
receiver.cancelFun = cancelFun;
EffectManager.showFntPop(strings.msg_2003);
else
receiver = require("app.views.view.AlertNoMoneyView"):show(shopID,okFun,cancelFun);
end
scene.keypadManager:addKeypadReceiver(receiver);
end
return Alert