Commit 3d0bb0dc 3d0bb0dc871b2433c22058e430d2293fe16ed4b1 by jinwawa

0624

1 parent 19110c18
......@@ -55,9 +55,9 @@
<reward id="3" name="我是会员Ⅲ" des="会员等级达到8级" item="100001,5000;910069,1" data="8"/>
</type>
<type viewid="11" id="11" name="我的礼包" des="包月/包年次数">
<reward id="1" name="我的礼包Ⅰ" des="VIP包年/包月1次" item="100001,1000;910066,1" data="1"/>
<reward id="2" name="我的礼包Ⅱ" des="VIP包年/包月3次" item="100001,2000;910068,1" data="3"/>
<reward id="3" name="我的礼包Ⅲ" des="VIP包年/包月5次" item="100001,5000;910064,1" data="5"/>
<reward id="1" name="我的礼包Ⅰ" des="动漫会员包年/包月1次" item="100001,1000;910066,1" data="1"/>
<reward id="2" name="我的礼包Ⅱ" des="动漫会员包年/包月3次" item="100001,2000;910068,1" data="3"/>
<reward id="3" name="我的礼包Ⅲ" des="动漫会员包年/包月5次" item="100001,5000;910064,1" data="5"/>
</type>
<level id="1" cnt="2" item="100001,200"/>
......
......@@ -55,9 +55,9 @@
<reward id="3" name="我是会员Ⅲ" des="会员等级达到8级" item="100001,5000;910069,1" data="8"/>
</type>
<type viewid="11" id="11" name="我的礼包" des="包月/包年次数">
<reward id="1" name="我的礼包Ⅰ" des="VIP包年/包月1次" item="100001,1000;910066,1" data="1"/>
<reward id="2" name="我的礼包Ⅱ" des="VIP包年/包月3次" item="100001,2000;910068,1" data="3"/>
<reward id="3" name="我的礼包Ⅲ" des="VIP包年/包月5次" item="100001,5000;910064,1" data="5"/>
<reward id="1" name="我的礼包Ⅰ" des="动漫会员包年/包月1次" item="100001,1000;910066,1" data="1"/>
<reward id="2" name="我的礼包Ⅱ" des="动漫会员包年/包月3次" item="100001,2000;910068,1" data="3"/>
<reward id="3" name="我的礼包Ⅲ" des="动漫会员包年/包月5次" item="100001,5000;910064,1" data="5"/>
</type>
<level id="1" cnt="2" item="100001,200"/>
......
......@@ -2,7 +2,7 @@ id name describe icon shopID amount type add_pet_exp pet_star unique vip
物品id 名字 描述 资源id 商品ID(背包里直接购买索引到商品ID) 库存数量(废弃) 1脸2发3上衣4裤子5鞋6翅膀7玩具 道具增加宠物经验值 对应宠物星级 唯一的 0:普通1:vip
100000 钻石 商店里购买 0 0 0 0 0 0 0 0
100001 金豆 游乐场玩游戏获得 1 100 0 0 0 0 0 0
100002 vip经验 vip经验 2 0 0 0 0 0 0 0
100002 动漫会员经验 动漫会员经验 2 0 0 0 0 0 0 0
100003 花 花 2 0 0 0 0 0 0 0
200001 宠物钥匙白 游乐场玩游戏获得,可用于宠物园抓宠物 1 0 0 0 0 1 0 0
200002 宠物钥匙绿 游乐场玩游戏获得,可用于宠物园抓宠物 2 0 0 0 0 2 0 0
......
No preview for this file type
......@@ -43,4 +43,11 @@
<pay id="202" name="年卡(365天)" type="2" des="年卡" day="365" item="100001,2000;600002,5;200001,1" payitem="" rmb="198.0" product="dclybn198" productPuTao="qjqp202" notice="1"/>
<pay id="301" name="自动续包月卡(31天)" type="2" des="月卡" day="31" item="100001,1000;600001,5" payitem="" rmb="20.0" product="tjlhdcylyby020@207" productPuTao="qjqp999" notice="1"/>
</platform>
<!--上海电信-->
<platform id="106" channel="shdx">
<pay id="201" name="月卡(31天)" type="2" des="4k动漫vip单月包" day="31" item="100001,1000;600001,5" payitem="" rmb="69.0" product="1000710508" productPuTao="qjqp201" notice="1"/>
<pay id="202" name="年卡(365天)" type="2" des="4k动漫vip年包" day="365" item="100001,2000;600002,5;200001,1" payitem="" rmb="299.0" product="1000710226" productPuTao="qjqp202" notice="1"/>
<pay id="301" name="自动续包月卡(31天)" type="2" des="4K动漫vip包" day="31" item="100001,1000;600001,5" payitem="" rmb="49.0" product="1000709506" productPuTao="qjqp999" notice="1"/>
</platform>
</root>
\ No newline at end of file
......
......@@ -2290,9 +2290,13 @@
<body id="7" data="800057,800107,800127,800207,800217,800227"/>
<!-- 自动战斗对手
pk_val表示玩家pk积分在以下范围内时会匹配到该等级的机器人
petstar中第一个数字表示需要进行差异化的宠物个数,第二个数字表示差异化的数值。示例中的“1,2”的意思为AI有1个宠的星级要比玩家随机一个宠物大2。
lv中第一个数字表示需要进行差异化的宠物个数,第二个数字表示差异化的数值。示例中的“1,2”的意思为AI有1个宠的等级要比玩家随机一个宠物大2。
skill中的数字表示AI宠物的技能开启和玩家的差异。“1”代表需要比玩家多1个宠物开启了技能。
-->
<user id="1001" name="对手1001" pk_val="500">
<user id="1001" name="对手1001" pk_val="500" petstar="0,0" lv="0,0" skill="0">
<!--
id//id
lv//等级
......@@ -2362,7 +2366,7 @@
</user>
<user id="1002" name="对手1002" pk_val="1000">
<user id="1002" name="对手1002" pk_val="1000" petstar="0,0" lv="0,0" skill="1">
<!--
id//id
lv//等级
......@@ -2464,7 +2468,7 @@
</user>
<user id="1003" name="对手1003" pk_val="2000">
<user id="1003" name="对手1003" pk_val="2000" petstar="0,0" lv="1,1" skill="1">
<!--
id//id
lv//等级
......@@ -2613,7 +2617,7 @@
</user>
<user id="1004" name="对手1004" pk_val="9999999">
<user id="1004" name="对手1004" pk_val="9999999" petstar="1,1" lv="1,1" skill="1">
<!--
id//id
lv//等级
......
......@@ -2,7 +2,7 @@ id name describe icon shopID amount type add_pet_exp pet_star unique vip
物品id 名字 描述 资源id 商品ID(背包里直接购买索引到商品ID) 库存数量(废弃) 1脸2发3上衣4裤子5鞋6翅膀7玩具 道具增加宠物经验值 对应宠物星级 唯一的 0:普通1:vip
100000 钻石 商店里购买 0 0 0 0 0 0 0 0
100001 金豆 游乐场玩游戏获得 1 100 0 0 0 0 0 0
100002 vip经验 vip经验 2 0 0 0 0 0 0 0
100002 动漫会员经验 动漫会员经验 2 0 0 0 0 0 0 0
100003 花 花 2 0 0 0 0 0 0 0
200001 宠物钥匙白 游乐场玩游戏获得,可用于宠物园抓宠物 1 0 0 0 0 1 0 0
200002 宠物钥匙绿 游乐场玩游戏获得,可用于宠物园抓宠物 2 0 0 0 0 2 0 0
......
No preview for this file type
......@@ -3,7 +3,7 @@
<!--m0800279afc6c-->
<!--m0800278b87c2-->
<!---->
<Account>m0800279afc6e</Account>
<Account>m0800279afc6c09</Account>
<exp>0</exp>
<versionnum>201801291657</versionnum>
<isMusic>0</isMusic>
......@@ -26,7 +26,7 @@
<new_guide_step>4</new_guide_step>
<is_feiyanzoubi_game_guide>1</is_feiyanzoubi_game_guide>
<feiyanzoubi_best>376</feiyanzoubi_best>
<uid>1030100010142906</uid>
<uid>1030100010142923</uid>
<is_bird_game_guide>1</is_bird_game_guide>
<bird_best>1008</bird_best>
<is_haidao_game_guide>1</is_haidao_game_guide>
......
......@@ -55,9 +55,9 @@
<reward id="3" name="我是会员Ⅲ" des="会员等级达到8级" item="100001,5000;910069,1" data="8"/>
</type>
<type viewid="11" id="11" name="我的礼包" des="包月/包年次数">
<reward id="1" name="我的礼包Ⅰ" des="VIP包年/包月1次" item="100001,1000;910066,1" data="1"/>
<reward id="2" name="我的礼包Ⅱ" des="VIP包年/包月3次" item="100001,2000;910068,1" data="3"/>
<reward id="3" name="我的礼包Ⅲ" des="VIP包年/包月5次" item="100001,5000;910064,1" data="5"/>
<reward id="1" name="我的礼包Ⅰ" des="动漫会员包年/包月1次" item="100001,1000;910066,1" data="1"/>
<reward id="2" name="我的礼包Ⅱ" des="动漫会员包年/包月3次" item="100001,2000;910068,1" data="3"/>
<reward id="3" name="我的礼包Ⅲ" des="动漫会员包年/包月5次" item="100001,5000;910064,1" data="5"/>
</type>
<level id="1" cnt="2" item="100001,200"/>
......
......@@ -2,7 +2,7 @@ id name describe icon shopID amount type add_pet_exp pet_star unique vip
物品id 名字 描述 资源id 商品ID(背包里直接购买索引到商品ID) 库存数量(废弃) 1脸2发3上衣4裤子5鞋6翅膀7玩具 道具增加宠物经验值 对应宠物星级 唯一的 0:普通1:vip
100000 钻石 商店里购买 0 0 0 0 0 0 0 0
100001 金豆 游乐场玩游戏获得 1 100 0 0 0 0 0 0
100002 vip经验 vip经验 2 0 0 0 0 0 0 0
100002 动漫会员经验 动漫会员经验 2 0 0 0 0 0 0 0
100003 花 花 2 0 0 0 0 0 0 0
200001 宠物钥匙白 游乐场玩游戏获得,可用于宠物园抓宠物 1 0 0 0 0 1 0 0
200002 宠物钥匙绿 游乐场玩游戏获得,可用于宠物园抓宠物 2 0 0 0 0 2 0 0
......
......@@ -100,13 +100,24 @@ end
function ActivityVipView:update(_is_init)
local vipList = ShopInfo.getVipList();
local flag=0; --是否订购了会员及是否领取了奖励,0,未订购,1订购,2未领取,3已领取
local _nodes = { };
-- 包月
local vipInfo1 = vipList[1];
local data1 = UserModel.getVipByID(vipInfo1.id);
--包年
local vipInfo2 = vipList[2];
local data2 = UserModel.getVipByID(vipInfo2.id);
-- 连续包月
local vipInfo3 = vipList[3];
local data3 = UserModel.getVipByID(vipInfo3.id); --包年礼包详情
--会员生效,可能是包月、续包月或包年会员之一
if (data1 and data1.val2 >= UserModel.time_second) or (data2 and data2.val2 >= UserModel.time_second) or (data3 and data3.val2 >= UserModel.time_second) then
flag=2;
end
local itemList1 = vipInfo1.itemList;
for i = 1, 2 do
......@@ -139,6 +150,7 @@ function ActivityVipView:update(_is_init)
local data1 = UserModel.getVipByID(vipInfo1.id);
if data1 and data1.val2 >= UserModel.time_second then
if data1.val1 == 0 or not TimeUtil.isToday(UserModel.time_second, data1.val1) then--单包月礼包详情
flag=3;
-- 可领取
local day = math.floor((data1.val2 - UserModel.time_second) /(24 * 3600)) + 1;
if data1.val1 > 0 and TimeUtil.isToday(UserModel.time_second, data1.val1) then
......@@ -153,10 +165,11 @@ function ActivityVipView:update(_is_init)
_nodes[1] = { self.btn_lingqu_month };
else
-- 已领取
flag=4;
self.btn_lingqu_month:setVisible(false);
self.yilingqu_month:setVisible(true);
end
else
elseif flag==0 then
self.btn_vip_month:setVisible(true); --显示包月按钮
_nodes[1] = { self.btn_vip_month };
--[[elseif not has_vip_month then --这里需要改
......@@ -174,16 +187,22 @@ function ActivityVipView:update(_is_init)
if data3 and(data3.val1 > 0 or data3.val2 > 0 or data3.val3 > 0) then
if data3.val1 == 0 or not TimeUtil.isToday(UserModel.time_second, data3.val1) then
-- 可领取
if flag==0 then --只有包月未赋值情况下才弄它
flag=3;
end
self.btn_lingqu_month:setVisible(true);
self.btn_lingqu_month.id = vipInfo3.id;
-- self.btn_lingqu_month:getChildByName("txt"):setString("永久");
_nodes[1] = { self.btn_lingqu_month };
else
-- 已领取
if flag==0 then --只有包月未赋值情况下才弄它
flag=4;
end
self.btn_lingqu_month:setVisible(false);
self.yilingqu_month:setVisible(true);
end
else --显示续包月按钮
elseif flag==0 then --显示续包月按钮
self.btn_vip_lianxu:setVisible(true);
if #_nodes > 0 then
_nodes[1][#_nodes[1]+1] = self.btn_vip_lianxu;
......@@ -208,7 +227,7 @@ function ActivityVipView:update(_is_init)
end--]]
-- 包年
local vipInfo2 = vipList[2];
local itemList2 = vipInfo2.itemList;
for i = 1, 3 do
local item = self:getChildByName("y_item_" .. i);
......@@ -229,6 +248,9 @@ function ActivityVipView:update(_is_init)
if data and data.val2 >= UserModel.time_second then
if data.val1 == 0 or not TimeUtil.isToday(UserModel.time_second, data.val1) then
-- 可领取
if flag==0 then --只有包月,续包月未赋值情况下才弄它
flag=3;
end
local day = math.floor((data.val2 - UserModel.time_second) /(24 * 3600)) + 1;
if data.val1 > 0 and TimeUtil.isToday(UserModel.time_second, data.val1) then
day = day - 1;
......@@ -244,10 +266,13 @@ function ActivityVipView:update(_is_init)
_nodes[1][#_nodes[1] + 1] = self.btn_lingqu_year;
else
-- 已领取
if flag==0 then --只有包月,续包月未赋值情况下才弄它
flag=4;
end
self.btn_lingqu_year:setVisible(false);
self.yilingqu_year:setVisible(true);
end
else
elseif flag==0 then
self.btn_vip_year:setVisible(true);
if not _nodes[1] then
_nodes[1] = { };
......@@ -258,9 +283,40 @@ function ActivityVipView:update(_is_init)
if not _is_init and self.update_nodes_func then
self.update_nodes_func(_nodes);
end
--[[if flag==0 then
self.btn_vip_year:setVisible(true); --包年
self.btn_vip_month:setVisible(true); --包月
self.btn_vip_lianxu:setVisible(true); --续包月
else
self.btn_vip_year:setVisible(false); --包年
self.btn_vip_month:setVisible(false); --包月
self.btn_vip_lianxu:setVisible(false); --续包月
--table:remove(self.btn_vip_year);
--table:remove(self.btn_vip_month);
--table:remove(self.btn_vip_lianxu);
end--]]
return _nodes;
end
-- 删除table表中符合conditionFunc的数据
-- @param tb 要删除数据的table
-- @param conditionFunc 符合要删除的数据的条件函数
function removeTableData(tb, conditionFunc)
-- body
if tb ~= nil and next(tb) ~= nil then
-- todo
for i = #tb, 1, -1 do
if conditionFunc(tb[i]) then
-- todo
table.remove(tb, i)
end
end
end
end
function ActivityVipView:onGetClick(ref)
local reciever = require("app.views.view.XyxPayView_shdx"):show();
cc.Director:getInstance():getRunningScene().keypadManager:addKeypadReceiver(reciever);
......
......@@ -13,13 +13,6 @@ function ActivityVipView:init()
local vipList = ShopInfo.getVipList();
-- (月卡,包年卡,包月卡)
self.btn_vip_year = self:getChildByName("btn_vip_year");
self.btn_vip_year.id = vipList[2].id;
self.btn_vip_year.fn = function()
self:onGetClick(self.btn_vip_year);
end
self.btn_vip_year:addTouchEventListener( function(ref, type) self:onButtonClick(ref, type, handler(self, self.onGetClick)) end);
self.btn_vip_lianxu = self:getChildByName("btn_vip_lianxu");
logD("vipList[3]--------------------->" .. #vipList);
if vipList[3] then
......@@ -37,27 +30,16 @@ function ActivityVipView:init()
end
self.btn_lingqu_month:addTouchEventListener( function(ref, type) self:onButtonClick(ref, type, handler(self, self.onLingquClick)) end);
self.btn_lingqu_year = self:getChildByName("btn_lingqu_year");
self.btn_lingqu_year.id = vipList[2].id;
self.btn_lingqu_year.fn = function()
self:onLingquClick(self.btn_lingqu_year);
end
self.btn_lingqu_year:addTouchEventListener( function(ref, type) self:onButtonClick(ref, type, handler(self, self.onLingquClick)) end);
self.yilingqu_month = self:getChildByName("yilingqu_month");
self.yilingqu_month:setVisible(false);
self.yilingqu_year = self:getChildByName("yilingqu_year");
self.yilingqu_year:setVisible(false);
EventListener.addEventListener(self, EnumEvent.UPDATE_VIP, handler(self, self.onVipUpdate));
UmengHelper.onEvent("activity_vip_show");
self.yilingqu_month:setVisible(false);
self.yilingqu_year:setVisible(false);
self.btn_lingqu_month:setVisible(false);
self.btn_vip_year:setVisible(false);
self.btn_lingqu_year:setVisible(false);
self.btn_vip_lianxu:setVisible(false);
local function authCallbackLua(result)
-- 去鉴权看看有没有订购连续包月
self.orderStaus = result;
......@@ -131,7 +113,7 @@ function ActivityVipView:update(_is_init)
end
local has_vip_month = false;
local data1 = UserModel.getVipByID(vipInfo1.id);
--[[local data1 = UserModel.getVipByID(vipInfo1.id); --没有包月
if data1 and data1.val2 >= UserModel.time_second then
has_vip_month = true;
elseif vipInfo3 then
......@@ -170,14 +152,14 @@ function ActivityVipView:update(_is_init)
-- self.btn_vip_month_single:setVisible(true);
-- _nodes[1] = { self.btn_vip_month_single };
end
end
end--]]
if vipInfo3 then
local data3 = UserModel.getVipByID(vipInfo3.id);
if data3 and(data3.val1 > 0 or data3.val2 > 0 or data3.val3 > 0) then
if data3.val1 == 0 or not TimeUtil.isToday(UserModel.time_second, data3.val1) then
-- 可领取
-- self.btn_lingqu_month:setVisible(true);
self.btn_lingqu_month:setVisible(true);
self.btn_lingqu_month.id = vipInfo3.id;
-- self.btn_lingqu_month:getChildByName("txt"):setString("永久");
_nodes[1] = { self.btn_lingqu_month };
......@@ -186,23 +168,23 @@ function ActivityVipView:update(_is_init)
self.btn_lingqu_month:setVisible(false);
self.yilingqu_month:setVisible(true);
end
elseif not has_vip_month then
--[[self.btn_vip_lianxu:setVisible(true);
else
self.btn_vip_lianxu:setVisible(true);
if #_nodes > 0 then
_nodes[1][#_nodes[1]+1] = self.btn_vip_lianxu;
else
_nodes[1] = {self.btn_vip_lianxu};
end--]]
end
end
end
if #_nodes > 0 then
--[[if #_nodes > 0 then
_nodes[1][#_nodes[1] + 1] = self.btn_vip_lianxu;
else
_nodes[1] = { self.btn_vip_lianxu };
end
end--]]
-- 包年
-- 包年,没有包年
local vipInfo2 = vipList[2];
local itemList2 = vipInfo2.itemList;
--[[for i = 1, 3 do
......@@ -220,7 +202,7 @@ function ActivityVipView:update(_is_init)
item:setVisible(false);
end
end--]]
local data = UserModel.getVipByID(vipInfo2.id);
--[[local data = UserModel.getVipByID(vipInfo2.id);
if data and data.val2 >= UserModel.time_second then
if data.val1 == 0 or not TimeUtil.isToday(UserModel.time_second, data.val1) then
-- 可领取
......@@ -231,23 +213,23 @@ function ActivityVipView:update(_is_init)
if day < 0 then
day = 0;
end
--[[self.btn_lingqu_year:setVisible(true);
self.btn_lingqu_year:setVisible(true);
self.btn_lingqu_year:getChildByName("txt"):setString("(剩余" .. day .. "天)");
if not _nodes[1] then
_nodes[1] = { };
end
_nodes[1][#_nodes[1] + 1] = self.btn_lingqu_year;--]]
_nodes[1][#_nodes[1] + 1] = self.btn_lingqu_year;
else
-- 已领取
--self.yilingqu_year:setVisible(true);
end
else
--[[self.btn_vip_year:setVisible(true);
self.btn_vip_year:setVisible(true);
if not _nodes[1] then
_nodes[1] = { };
end
_nodes[1][#_nodes[1] + 1] = self.btn_vip_year;--]]
end
_nodes[1][#_nodes[1] + 1] = self.btn_vip_year;
end--]]
if not _is_init and self.update_nodes_func then
self.update_nodes_func(_nodes);
......
......@@ -228,8 +228,13 @@ function RoleBussinessView:onWxClick(ref)
end
function RoleBussinessView:onVipClick(ref)
local reciever = require("app.views.view.ActivityView"):show("ActivityVipView");
cc.Director:getInstance():getRunningScene().keypadManager:addKeypadReceiver(reciever);
if CHANNEL=="shdx" then
local reciever = require("app.views.view.XyxPayView_shdx"):show();
cc.Director:getInstance():getRunningScene().keypadManager:addKeypadReceiver(reciever);
else
local reciever = require("app.views.view.ActivityView"):show("ActivityVipView");
cc.Director:getInstance():getRunningScene().keypadManager:addKeypadReceiver(reciever);
end
end
function RoleBussinessView:onGetClick(ref)
......
......@@ -3,8 +3,8 @@ cc.FileUtils:getInstance():setPopupNotify(false)
cc.FileUtils:getInstance():addSearchPath("src/")
cc.FileUtils:getInstance():addSearchPath("res/")
local engine_loaded = {};
for i,v in pairs(package.loaded) do
local engine_loaded = { };
for i, v in pairs(package.loaded) do
engine_loaded[i] = v;
end
......@@ -27,8 +27,10 @@ local function main()
PROXY_HTTP_ADDR = ConfigInfo.getConfigInfo("proxy_http_addr");
PROXY_SOCK_ADDR = ConfigInfo.getConfigInfo("proxy_sock_addr");
IS_TV = tonumber(ConfigInfo.getConfigInfo("is_tv"));
MEMBER_TYPE=0; --会员类型,0:不是会员, 其他对应pay.xml中的pay_id
IS_MEMBER=0; --是不是会员 0:不是会员
MEMBER_TYPE = 0;
-- 会员类型,0:不是会员, 其他对应pay.xml中的pay_id
IS_MEMBER = 0;
-- 是不是会员 0:不是会员
require "core.log.init";
require "core.net.socket_connection";
......@@ -40,93 +42,94 @@ local function main()
CDN_CONFIG_URL = ConfigInfo.getConfigInfo("cdn_config_url") or "";
if not CDN_CONFIG_URL or CDN_CONFIG_URL == "" then
GAME_LOGIN_URL = ConfigInfo.getConfigInfo("game_login_url");
print("本地配置 登录服务器地址:"..GAME_LOGIN_URL);
print("本地配置 登录服务器地址:" .. GAME_LOGIN_URL);
PLATFORM = tonumber(ConfigInfo.getConfigInfo("platform"));
print("本地配置 平台号PLATFORM:"..PLATFORM);
print("本地配置 平台号PLATFORM:" .. PLATFORM);
end
if CHANNEL == "shdx" and targetPlatform == cc.PLATFORM_OS_ANDROID then
self:isMember();
end
cc.Director:getInstance():setAnimationInterval(1/30);
cc.Director:getInstance():setAnimationInterval(1 / 30);
require("app.MyApp"):create():run("LoadingScene");
end
--判断是不是会员
-- 判断是不是会员
function isMember()
local targetPlatform = cc.Application:getInstance():getTargetPlatform();
local function callbackLua(params)
logUI("IS MEMEBER---->"..params);
if params=="success" then
IS_MEMBER=1;
else
IS_MEMBER=0;
end
end
local luaj = require "cocos.cocos2d.luaj"; --引入luaj
local className = "org/cocos2dx/lua/AppActivity";
local args = { callbackLua };
local sigs = "(I)V";
-- 传入string参数,无返回值
-- luaj 调用 Java 方法时,可能会出现各种错误,因此 luaj 提供了一种机制让 Lua 调用代码可以确定 Java 方法是否成功调用。
-- luaj.callStaticMethod() 会返回两个值
-- 当成功时,第一个值为 true,第二个值是 Java 方法的返回值(如果有)
-- 当失败时,第一个值为 false,第二个值是错误代码
local ok, ret = luaj.callStaticMethod(className, "authPermission", args, sigs);
if not ok then
print("authPermission error:" .. ret);
local function callbackLua(params)
logUI("IS MEMEBER---->" .. params);
if params == "success" then
IS_MEMBER = 1;
else
IS_MEMBER = 0;
end
end
local luaj = require "cocos.cocos2d.luaj";
-- 引入luaj
local className = "org/cocos2dx/lua/AppActivity";
local args = { callbackLua };
local sigs = "(I)V";
-- 传入string参数,无返回值
-- luaj 调用 Java 方法时,可能会出现各种错误,因此 luaj 提供了一种机制让 Lua 调用代码可以确定 Java 方法是否成功调用。
-- luaj.callStaticMethod() 会返回两个值
-- 当成功时,第一个值为 true,第二个值是 Java 方法的返回值(如果有)
-- 当失败时,第一个值为 false,第二个值是错误代码
local ok, ret = luaj.callStaticMethod(className, "authPermission", args, sigs);
if not ok then
print("authPermission error:" .. ret);
end
end
function reloadGame()
for k,_ in pairs(package.loaded) do
for k, _ in pairs(package.loaded) do
local has_k = false;
for i,v in pairs(engine_loaded) do
for i, v in pairs(engine_loaded) do
if k == i then
has_k = true;
end
end
if not has_k then
print("remove:"..k);
print("remove:" .. k);
package.loaded[k] = nil;
end
end
cc.Director:getInstance():purgeCachedData();
cc.FileUtils:getInstance():purgeCachedEntries();
require("main");
end
function loadGame(game_name)
local searchPaths = cc.FileUtils:getInstance():getSearchPaths();
local resPath = cc.FileUtils:getInstance():getWritablePath().."GameUpdate/"..game_name.."/";
searchPaths = {};
table.insert(searchPaths,1,resPath);
table.insert(searchPaths,2,resPath .. 'res/');
table.insert(searchPaths,3,resPath .. 'src/');
local resPath = cc.FileUtils:getInstance():getWritablePath() .. "GameUpdate/" .. game_name .. "/";
searchPaths = { };
table.insert(searchPaths, 1, resPath);
table.insert(searchPaths, 2, resPath .. 'res/');
table.insert(searchPaths, 3, resPath .. 'src/');
cc.FileUtils:getInstance():setSearchPaths(searchPaths);
for k,_ in pairs(package.loaded) do
for k, _ in pairs(package.loaded) do
local has_k = false;
for i,v in pairs(engine_loaded) do
for i, v in pairs(engine_loaded) do
if k == i then
has_k = true;
end
end
if not has_k then
print("remove:"..k);
print("remove:" .. k);
package.loaded[k] = nil;
end
end
cc.FileUtils:getInstance():purgeCachedEntries();
cc.Director:getInstance():purgeCachedData();
app:enterScene("LoadingScene",{nextSceneName="main"});
app:enterScene("LoadingScene", { nextSceneName = "main" });
end
local status, msg = xpcall(main, __G__TRACKBACK__)
......
......@@ -34,10 +34,9 @@
<FilePathData Path="ui/dress/BusinessView.csd" />
<FilePathData Path="ui/dress/DressLayer.csd" />
<FilePathData Path="ui/achievement/AchievementItem.csd" />
<FilePathData Path="ui/xyx/shanghai_ctcc/XyxPayLayer.csd" />
<FilePathData Path="ui/Activity/shanghai_ctcc/ActivityVip.csd" />
<FilePathData Path="ui/Activity/tianjin_cucc/ActivityVip.csd" />
</OpenedDocuments>
<ActiveDocument Path="ui/xyx/shanghai_ctcc/XyxPayLayer.csd" />
<ActiveDocument Path="ui/Activity/tianjin_cucc/ActivityVip.csd" />
</Value>
</Item>
</Properties>
......