0624
Showing
20 changed files
with
162 additions
and
106 deletions
| ... | @@ -55,9 +55,9 @@ | ... | @@ -55,9 +55,9 @@ |
| 55 | <reward id="3" name="我是会员Ⅲ" des="会员等级达到8级" item="100001,5000;910069,1" data="8"/> | 55 | <reward id="3" name="我是会员Ⅲ" des="会员等级达到8级" item="100001,5000;910069,1" data="8"/> |
| 56 | </type> | 56 | </type> |
| 57 | <type viewid="11" id="11" name="我的礼包" des="包月/包年次数"> | 57 | <type viewid="11" id="11" name="我的礼包" des="包月/包年次数"> |
| 58 | <reward id="1" name="我的礼包Ⅰ" des="VIP包年/包月1次" item="100001,1000;910066,1" data="1"/> | 58 | <reward id="1" name="我的礼包Ⅰ" des="动漫会员包年/包月1次" item="100001,1000;910066,1" data="1"/> |
| 59 | <reward id="2" name="我的礼包Ⅱ" des="VIP包年/包月3次" item="100001,2000;910068,1" data="3"/> | 59 | <reward id="2" name="我的礼包Ⅱ" des="动漫会员包年/包月3次" item="100001,2000;910068,1" data="3"/> |
| 60 | <reward id="3" name="我的礼包Ⅲ" des="VIP包年/包月5次" item="100001,5000;910064,1" data="5"/> | 60 | <reward id="3" name="我的礼包Ⅲ" des="动漫会员包年/包月5次" item="100001,5000;910064,1" data="5"/> |
| 61 | </type> | 61 | </type> |
| 62 | 62 | ||
| 63 | <level id="1" cnt="2" item="100001,200"/> | 63 | <level id="1" cnt="2" item="100001,200"/> | ... | ... |
| ... | @@ -55,9 +55,9 @@ | ... | @@ -55,9 +55,9 @@ |
| 55 | <reward id="3" name="我是会员Ⅲ" des="会员等级达到8级" item="100001,5000;910069,1" data="8"/> | 55 | <reward id="3" name="我是会员Ⅲ" des="会员等级达到8级" item="100001,5000;910069,1" data="8"/> |
| 56 | </type> | 56 | </type> |
| 57 | <type viewid="11" id="11" name="我的礼包" des="包月/包年次数"> | 57 | <type viewid="11" id="11" name="我的礼包" des="包月/包年次数"> |
| 58 | <reward id="1" name="我的礼包Ⅰ" des="VIP包年/包月1次" item="100001,1000;910066,1" data="1"/> | 58 | <reward id="1" name="我的礼包Ⅰ" des="动漫会员包年/包月1次" item="100001,1000;910066,1" data="1"/> |
| 59 | <reward id="2" name="我的礼包Ⅱ" des="VIP包年/包月3次" item="100001,2000;910068,1" data="3"/> | 59 | <reward id="2" name="我的礼包Ⅱ" des="动漫会员包年/包月3次" item="100001,2000;910068,1" data="3"/> |
| 60 | <reward id="3" name="我的礼包Ⅲ" des="VIP包年/包月5次" item="100001,5000;910064,1" data="5"/> | 60 | <reward id="3" name="我的礼包Ⅲ" des="动漫会员包年/包月5次" item="100001,5000;910064,1" data="5"/> |
| 61 | </type> | 61 | </type> |
| 62 | 62 | ||
| 63 | <level id="1" cnt="2" item="100001,200"/> | 63 | <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 | ... | @@ -2,7 +2,7 @@ id name describe icon shopID amount type add_pet_exp pet_star unique vip |
| 2 | 物品id 名字 描述 资源id 商品ID(背包里直接购买索引到商品ID) 库存数量(废弃) 1脸2发3上衣4裤子5鞋6翅膀7玩具 道具增加宠物经验值 对应宠物星级 唯一的 0:普通1:vip | 2 | 物品id 名字 描述 资源id 商品ID(背包里直接购买索引到商品ID) 库存数量(废弃) 1脸2发3上衣4裤子5鞋6翅膀7玩具 道具增加宠物经验值 对应宠物星级 唯一的 0:普通1:vip |
| 3 | 100000 钻石 商店里购买 0 0 0 0 0 0 0 0 | 3 | 100000 钻石 商店里购买 0 0 0 0 0 0 0 0 |
| 4 | 100001 金豆 游乐场玩游戏获得 1 100 0 0 0 0 0 0 | 4 | 100001 金豆 游乐场玩游戏获得 1 100 0 0 0 0 0 0 |
| 5 | 100002 vip经验 vip经验 2 0 0 0 0 0 0 0 | 5 | 100002 动漫会员经验 动漫会员经验 2 0 0 0 0 0 0 0 |
| 6 | 100003 花 花 2 0 0 0 0 0 0 0 | 6 | 100003 花 花 2 0 0 0 0 0 0 0 |
| 7 | 200001 宠物钥匙白 游乐场玩游戏获得,可用于宠物园抓宠物 1 0 0 0 0 1 0 0 | 7 | 200001 宠物钥匙白 游乐场玩游戏获得,可用于宠物园抓宠物 1 0 0 0 0 1 0 0 |
| 8 | 200002 宠物钥匙绿 游乐场玩游戏获得,可用于宠物园抓宠物 2 0 0 0 0 2 0 0 | 8 | 200002 宠物钥匙绿 游乐场玩游戏获得,可用于宠物园抓宠物 2 0 0 0 0 2 0 0 | ... | ... |
No preview for this file type
| ... | @@ -43,4 +43,11 @@ | ... | @@ -43,4 +43,11 @@ |
| 43 | <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"/> | 43 | <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"/> |
| 44 | <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"/> | 44 | <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"/> |
| 45 | </platform> | 45 | </platform> |
| 46 | <!--上海电信--> | ||
| 47 | <platform id="106" channel="shdx"> | ||
| 48 | <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"/> | ||
| 49 | <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"/> | ||
| 50 | <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"/> | ||
| 51 | </platform> | ||
| 52 | |||
| 46 | </root> | 53 | </root> |
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| ... | @@ -2290,9 +2290,13 @@ | ... | @@ -2290,9 +2290,13 @@ |
| 2290 | <body id="7" data="800057,800107,800127,800207,800217,800227"/> | 2290 | <body id="7" data="800057,800107,800127,800207,800217,800227"/> |
| 2291 | 2291 | ||
| 2292 | <!-- 自动战斗对手 | 2292 | <!-- 自动战斗对手 |
| 2293 | pk_val表示玩家pk积分在以下范围内时会匹配到该等级的机器人 | ||
| 2294 | petstar中第一个数字表示需要进行差异化的宠物个数,第二个数字表示差异化的数值。示例中的“1,2”的意思为AI有1个宠的星级要比玩家随机一个宠物大2。 | ||
| 2295 | lv中第一个数字表示需要进行差异化的宠物个数,第二个数字表示差异化的数值。示例中的“1,2”的意思为AI有1个宠的等级要比玩家随机一个宠物大2。 | ||
| 2296 | skill中的数字表示AI宠物的技能开启和玩家的差异。“1”代表需要比玩家多1个宠物开启了技能。 | ||
| 2293 | --> | 2297 | --> |
| 2294 | 2298 | ||
| 2295 | <user id="1001" name="对手1001" pk_val="500"> | 2299 | <user id="1001" name="对手1001" pk_val="500" petstar="0,0" lv="0,0" skill="0"> |
| 2296 | <!-- | 2300 | <!-- |
| 2297 | id//id | 2301 | id//id |
| 2298 | lv//等级 | 2302 | lv//等级 |
| ... | @@ -2362,7 +2366,7 @@ | ... | @@ -2362,7 +2366,7 @@ |
| 2362 | 2366 | ||
| 2363 | </user> | 2367 | </user> |
| 2364 | 2368 | ||
| 2365 | <user id="1002" name="对手1002" pk_val="1000"> | 2369 | <user id="1002" name="对手1002" pk_val="1000" petstar="0,0" lv="0,0" skill="1"> |
| 2366 | <!-- | 2370 | <!-- |
| 2367 | id//id | 2371 | id//id |
| 2368 | lv//等级 | 2372 | lv//等级 |
| ... | @@ -2464,7 +2468,7 @@ | ... | @@ -2464,7 +2468,7 @@ |
| 2464 | 2468 | ||
| 2465 | </user> | 2469 | </user> |
| 2466 | 2470 | ||
| 2467 | <user id="1003" name="对手1003" pk_val="2000"> | 2471 | <user id="1003" name="对手1003" pk_val="2000" petstar="0,0" lv="1,1" skill="1"> |
| 2468 | <!-- | 2472 | <!-- |
| 2469 | id//id | 2473 | id//id |
| 2470 | lv//等级 | 2474 | lv//等级 |
| ... | @@ -2613,7 +2617,7 @@ | ... | @@ -2613,7 +2617,7 @@ |
| 2613 | 2617 | ||
| 2614 | </user> | 2618 | </user> |
| 2615 | 2619 | ||
| 2616 | <user id="1004" name="对手1004" pk_val="9999999"> | 2620 | <user id="1004" name="对手1004" pk_val="9999999" petstar="1,1" lv="1,1" skill="1"> |
| 2617 | <!-- | 2621 | <!-- |
| 2618 | id//id | 2622 | id//id |
| 2619 | lv//等级 | 2623 | lv//等级 | ... | ... |
| ... | @@ -2,7 +2,7 @@ id name describe icon shopID amount type add_pet_exp pet_star unique vip | ... | @@ -2,7 +2,7 @@ id name describe icon shopID amount type add_pet_exp pet_star unique vip |
| 2 | 物品id 名字 描述 资源id 商品ID(背包里直接购买索引到商品ID) 库存数量(废弃) 1脸2发3上衣4裤子5鞋6翅膀7玩具 道具增加宠物经验值 对应宠物星级 唯一的 0:普通1:vip | 2 | 物品id 名字 描述 资源id 商品ID(背包里直接购买索引到商品ID) 库存数量(废弃) 1脸2发3上衣4裤子5鞋6翅膀7玩具 道具增加宠物经验值 对应宠物星级 唯一的 0:普通1:vip |
| 3 | 100000 钻石 商店里购买 0 0 0 0 0 0 0 0 | 3 | 100000 钻石 商店里购买 0 0 0 0 0 0 0 0 |
| 4 | 100001 金豆 游乐场玩游戏获得 1 100 0 0 0 0 0 0 | 4 | 100001 金豆 游乐场玩游戏获得 1 100 0 0 0 0 0 0 |
| 5 | 100002 vip经验 vip经验 2 0 0 0 0 0 0 0 | 5 | 100002 动漫会员经验 动漫会员经验 2 0 0 0 0 0 0 0 |
| 6 | 100003 花 花 2 0 0 0 0 0 0 0 | 6 | 100003 花 花 2 0 0 0 0 0 0 0 |
| 7 | 200001 宠物钥匙白 游乐场玩游戏获得,可用于宠物园抓宠物 1 0 0 0 0 1 0 0 | 7 | 200001 宠物钥匙白 游乐场玩游戏获得,可用于宠物园抓宠物 1 0 0 0 0 1 0 0 |
| 8 | 200002 宠物钥匙绿 游乐场玩游戏获得,可用于宠物园抓宠物 2 0 0 0 0 2 0 0 | 8 | 200002 宠物钥匙绿 游乐场玩游戏获得,可用于宠物园抓宠物 2 0 0 0 0 2 0 0 | ... | ... |
No preview for this file type
| ... | @@ -3,7 +3,7 @@ | ... | @@ -3,7 +3,7 @@ |
| 3 | <!--m0800279afc6c--> | 3 | <!--m0800279afc6c--> |
| 4 | <!--m0800278b87c2--> | 4 | <!--m0800278b87c2--> |
| 5 | <!----> | 5 | <!----> |
| 6 | <Account>m0800279afc6e</Account> | 6 | <Account>m0800279afc6c09</Account> |
| 7 | <exp>0</exp> | 7 | <exp>0</exp> |
| 8 | <versionnum>201801291657</versionnum> | 8 | <versionnum>201801291657</versionnum> |
| 9 | <isMusic>0</isMusic> | 9 | <isMusic>0</isMusic> |
| ... | @@ -26,7 +26,7 @@ | ... | @@ -26,7 +26,7 @@ |
| 26 | <new_guide_step>4</new_guide_step> | 26 | <new_guide_step>4</new_guide_step> |
| 27 | <is_feiyanzoubi_game_guide>1</is_feiyanzoubi_game_guide> | 27 | <is_feiyanzoubi_game_guide>1</is_feiyanzoubi_game_guide> |
| 28 | <feiyanzoubi_best>376</feiyanzoubi_best> | 28 | <feiyanzoubi_best>376</feiyanzoubi_best> |
| 29 | <uid>1030100010142906</uid> | 29 | <uid>1030100010142923</uid> |
| 30 | <is_bird_game_guide>1</is_bird_game_guide> | 30 | <is_bird_game_guide>1</is_bird_game_guide> |
| 31 | <bird_best>1008</bird_best> | 31 | <bird_best>1008</bird_best> |
| 32 | <is_haidao_game_guide>1</is_haidao_game_guide> | 32 | <is_haidao_game_guide>1</is_haidao_game_guide> | ... | ... |
| ... | @@ -55,9 +55,9 @@ | ... | @@ -55,9 +55,9 @@ |
| 55 | <reward id="3" name="我是会员Ⅲ" des="会员等级达到8级" item="100001,5000;910069,1" data="8"/> | 55 | <reward id="3" name="我是会员Ⅲ" des="会员等级达到8级" item="100001,5000;910069,1" data="8"/> |
| 56 | </type> | 56 | </type> |
| 57 | <type viewid="11" id="11" name="我的礼包" des="包月/包年次数"> | 57 | <type viewid="11" id="11" name="我的礼包" des="包月/包年次数"> |
| 58 | <reward id="1" name="我的礼包Ⅰ" des="VIP包年/包月1次" item="100001,1000;910066,1" data="1"/> | 58 | <reward id="1" name="我的礼包Ⅰ" des="动漫会员包年/包月1次" item="100001,1000;910066,1" data="1"/> |
| 59 | <reward id="2" name="我的礼包Ⅱ" des="VIP包年/包月3次" item="100001,2000;910068,1" data="3"/> | 59 | <reward id="2" name="我的礼包Ⅱ" des="动漫会员包年/包月3次" item="100001,2000;910068,1" data="3"/> |
| 60 | <reward id="3" name="我的礼包Ⅲ" des="VIP包年/包月5次" item="100001,5000;910064,1" data="5"/> | 60 | <reward id="3" name="我的礼包Ⅲ" des="动漫会员包年/包月5次" item="100001,5000;910064,1" data="5"/> |
| 61 | </type> | 61 | </type> |
| 62 | 62 | ||
| 63 | <level id="1" cnt="2" item="100001,200"/> | 63 | <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 | ... | @@ -2,7 +2,7 @@ id name describe icon shopID amount type add_pet_exp pet_star unique vip |
| 2 | 物品id 名字 描述 资源id 商品ID(背包里直接购买索引到商品ID) 库存数量(废弃) 1脸2发3上衣4裤子5鞋6翅膀7玩具 道具增加宠物经验值 对应宠物星级 唯一的 0:普通1:vip | 2 | 物品id 名字 描述 资源id 商品ID(背包里直接购买索引到商品ID) 库存数量(废弃) 1脸2发3上衣4裤子5鞋6翅膀7玩具 道具增加宠物经验值 对应宠物星级 唯一的 0:普通1:vip |
| 3 | 100000 钻石 商店里购买 0 0 0 0 0 0 0 0 | 3 | 100000 钻石 商店里购买 0 0 0 0 0 0 0 0 |
| 4 | 100001 金豆 游乐场玩游戏获得 1 100 0 0 0 0 0 0 | 4 | 100001 金豆 游乐场玩游戏获得 1 100 0 0 0 0 0 0 |
| 5 | 100002 vip经验 vip经验 2 0 0 0 0 0 0 0 | 5 | 100002 动漫会员经验 动漫会员经验 2 0 0 0 0 0 0 0 |
| 6 | 100003 花 花 2 0 0 0 0 0 0 0 | 6 | 100003 花 花 2 0 0 0 0 0 0 0 |
| 7 | 200001 宠物钥匙白 游乐场玩游戏获得,可用于宠物园抓宠物 1 0 0 0 0 1 0 0 | 7 | 200001 宠物钥匙白 游乐场玩游戏获得,可用于宠物园抓宠物 1 0 0 0 0 1 0 0 |
| 8 | 200002 宠物钥匙绿 游乐场玩游戏获得,可用于宠物园抓宠物 2 0 0 0 0 2 0 0 | 8 | 200002 宠物钥匙绿 游乐场玩游戏获得,可用于宠物园抓宠物 2 0 0 0 0 2 0 0 | ... | ... |
No preview for this file type
No preview for this file type
| ... | @@ -100,13 +100,24 @@ end | ... | @@ -100,13 +100,24 @@ end |
| 100 | 100 | ||
| 101 | function ActivityVipView:update(_is_init) | 101 | function ActivityVipView:update(_is_init) |
| 102 | local vipList = ShopInfo.getVipList(); | 102 | local vipList = ShopInfo.getVipList(); |
| 103 | local flag=0; --是否订购了会员及是否领取了奖励,0,未订购,1订购,2未领取,3已领取 | ||
| 103 | 104 | ||
| 104 | local _nodes = { }; | 105 | local _nodes = { }; |
| 105 | 106 | ||
| 106 | -- 包月 | 107 | -- 包月 |
| 107 | local vipInfo1 = vipList[1]; | 108 | local vipInfo1 = vipList[1]; |
| 109 | local data1 = UserModel.getVipByID(vipInfo1.id); | ||
| 110 | --包年 | ||
| 111 | local vipInfo2 = vipList[2]; | ||
| 112 | local data2 = UserModel.getVipByID(vipInfo2.id); | ||
| 108 | -- 连续包月 | 113 | -- 连续包月 |
| 109 | local vipInfo3 = vipList[3]; | 114 | local vipInfo3 = vipList[3]; |
| 115 | local data3 = UserModel.getVipByID(vipInfo3.id); --包年礼包详情 | ||
| 116 | |||
| 117 | --会员生效,可能是包月、续包月或包年会员之一 | ||
| 118 | 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 | ||
| 119 | flag=2; | ||
| 120 | end | ||
| 110 | 121 | ||
| 111 | local itemList1 = vipInfo1.itemList; | 122 | local itemList1 = vipInfo1.itemList; |
| 112 | for i = 1, 2 do | 123 | for i = 1, 2 do |
| ... | @@ -139,6 +150,7 @@ function ActivityVipView:update(_is_init) | ... | @@ -139,6 +150,7 @@ function ActivityVipView:update(_is_init) |
| 139 | local data1 = UserModel.getVipByID(vipInfo1.id); | 150 | local data1 = UserModel.getVipByID(vipInfo1.id); |
| 140 | if data1 and data1.val2 >= UserModel.time_second then | 151 | if data1 and data1.val2 >= UserModel.time_second then |
| 141 | if data1.val1 == 0 or not TimeUtil.isToday(UserModel.time_second, data1.val1) then--单包月礼包详情 | 152 | if data1.val1 == 0 or not TimeUtil.isToday(UserModel.time_second, data1.val1) then--单包月礼包详情 |
| 153 | flag=3; | ||
| 142 | -- 可领取 | 154 | -- 可领取 |
| 143 | local day = math.floor((data1.val2 - UserModel.time_second) /(24 * 3600)) + 1; | 155 | local day = math.floor((data1.val2 - UserModel.time_second) /(24 * 3600)) + 1; |
| 144 | if data1.val1 > 0 and TimeUtil.isToday(UserModel.time_second, data1.val1) then | 156 | if data1.val1 > 0 and TimeUtil.isToday(UserModel.time_second, data1.val1) then |
| ... | @@ -153,10 +165,11 @@ function ActivityVipView:update(_is_init) | ... | @@ -153,10 +165,11 @@ function ActivityVipView:update(_is_init) |
| 153 | _nodes[1] = { self.btn_lingqu_month }; | 165 | _nodes[1] = { self.btn_lingqu_month }; |
| 154 | else | 166 | else |
| 155 | -- 已领取 | 167 | -- 已领取 |
| 168 | flag=4; | ||
| 156 | self.btn_lingqu_month:setVisible(false); | 169 | self.btn_lingqu_month:setVisible(false); |
| 157 | self.yilingqu_month:setVisible(true); | 170 | self.yilingqu_month:setVisible(true); |
| 158 | end | 171 | end |
| 159 | else | 172 | elseif flag==0 then |
| 160 | self.btn_vip_month:setVisible(true); --显示包月按钮 | 173 | self.btn_vip_month:setVisible(true); --显示包月按钮 |
| 161 | _nodes[1] = { self.btn_vip_month }; | 174 | _nodes[1] = { self.btn_vip_month }; |
| 162 | --[[elseif not has_vip_month then --这里需要改 | 175 | --[[elseif not has_vip_month then --这里需要改 |
| ... | @@ -174,16 +187,22 @@ function ActivityVipView:update(_is_init) | ... | @@ -174,16 +187,22 @@ function ActivityVipView:update(_is_init) |
| 174 | if data3 and(data3.val1 > 0 or data3.val2 > 0 or data3.val3 > 0) then | 187 | if data3 and(data3.val1 > 0 or data3.val2 > 0 or data3.val3 > 0) then |
| 175 | if data3.val1 == 0 or not TimeUtil.isToday(UserModel.time_second, data3.val1) then | 188 | if data3.val1 == 0 or not TimeUtil.isToday(UserModel.time_second, data3.val1) then |
| 176 | -- 可领取 | 189 | -- 可领取 |
| 190 | if flag==0 then --只有包月未赋值情况下才弄它 | ||
| 191 | flag=3; | ||
| 192 | end | ||
| 177 | self.btn_lingqu_month:setVisible(true); | 193 | self.btn_lingqu_month:setVisible(true); |
| 178 | self.btn_lingqu_month.id = vipInfo3.id; | 194 | self.btn_lingqu_month.id = vipInfo3.id; |
| 179 | -- self.btn_lingqu_month:getChildByName("txt"):setString("永久"); | 195 | -- self.btn_lingqu_month:getChildByName("txt"):setString("永久"); |
| 180 | _nodes[1] = { self.btn_lingqu_month }; | 196 | _nodes[1] = { self.btn_lingqu_month }; |
| 181 | else | 197 | else |
| 182 | -- 已领取 | 198 | -- 已领取 |
| 199 | if flag==0 then --只有包月未赋值情况下才弄它 | ||
| 200 | flag=4; | ||
| 201 | end | ||
| 183 | self.btn_lingqu_month:setVisible(false); | 202 | self.btn_lingqu_month:setVisible(false); |
| 184 | self.yilingqu_month:setVisible(true); | 203 | self.yilingqu_month:setVisible(true); |
| 185 | end | 204 | end |
| 186 | else --显示续包月按钮 | 205 | elseif flag==0 then --显示续包月按钮 |
| 187 | self.btn_vip_lianxu:setVisible(true); | 206 | self.btn_vip_lianxu:setVisible(true); |
| 188 | if #_nodes > 0 then | 207 | if #_nodes > 0 then |
| 189 | _nodes[1][#_nodes[1]+1] = self.btn_vip_lianxu; | 208 | _nodes[1][#_nodes[1]+1] = self.btn_vip_lianxu; |
| ... | @@ -208,7 +227,7 @@ function ActivityVipView:update(_is_init) | ... | @@ -208,7 +227,7 @@ function ActivityVipView:update(_is_init) |
| 208 | end--]] | 227 | end--]] |
| 209 | 228 | ||
| 210 | -- 包年 | 229 | -- 包年 |
| 211 | local vipInfo2 = vipList[2]; | 230 | |
| 212 | local itemList2 = vipInfo2.itemList; | 231 | local itemList2 = vipInfo2.itemList; |
| 213 | for i = 1, 3 do | 232 | for i = 1, 3 do |
| 214 | local item = self:getChildByName("y_item_" .. i); | 233 | local item = self:getChildByName("y_item_" .. i); |
| ... | @@ -229,6 +248,9 @@ function ActivityVipView:update(_is_init) | ... | @@ -229,6 +248,9 @@ function ActivityVipView:update(_is_init) |
| 229 | if data and data.val2 >= UserModel.time_second then | 248 | if data and data.val2 >= UserModel.time_second then |
| 230 | if data.val1 == 0 or not TimeUtil.isToday(UserModel.time_second, data.val1) then | 249 | if data.val1 == 0 or not TimeUtil.isToday(UserModel.time_second, data.val1) then |
| 231 | -- 可领取 | 250 | -- 可领取 |
| 251 | if flag==0 then --只有包月,续包月未赋值情况下才弄它 | ||
| 252 | flag=3; | ||
| 253 | end | ||
| 232 | local day = math.floor((data.val2 - UserModel.time_second) /(24 * 3600)) + 1; | 254 | local day = math.floor((data.val2 - UserModel.time_second) /(24 * 3600)) + 1; |
| 233 | if data.val1 > 0 and TimeUtil.isToday(UserModel.time_second, data.val1) then | 255 | if data.val1 > 0 and TimeUtil.isToday(UserModel.time_second, data.val1) then |
| 234 | day = day - 1; | 256 | day = day - 1; |
| ... | @@ -244,10 +266,13 @@ function ActivityVipView:update(_is_init) | ... | @@ -244,10 +266,13 @@ function ActivityVipView:update(_is_init) |
| 244 | _nodes[1][#_nodes[1] + 1] = self.btn_lingqu_year; | 266 | _nodes[1][#_nodes[1] + 1] = self.btn_lingqu_year; |
| 245 | else | 267 | else |
| 246 | -- 已领取 | 268 | -- 已领取 |
| 269 | if flag==0 then --只有包月,续包月未赋值情况下才弄它 | ||
| 270 | flag=4; | ||
| 271 | end | ||
| 247 | self.btn_lingqu_year:setVisible(false); | 272 | self.btn_lingqu_year:setVisible(false); |
| 248 | self.yilingqu_year:setVisible(true); | 273 | self.yilingqu_year:setVisible(true); |
| 249 | end | 274 | end |
| 250 | else | 275 | elseif flag==0 then |
| 251 | self.btn_vip_year:setVisible(true); | 276 | self.btn_vip_year:setVisible(true); |
| 252 | if not _nodes[1] then | 277 | if not _nodes[1] then |
| 253 | _nodes[1] = { }; | 278 | _nodes[1] = { }; |
| ... | @@ -258,9 +283,40 @@ function ActivityVipView:update(_is_init) | ... | @@ -258,9 +283,40 @@ function ActivityVipView:update(_is_init) |
| 258 | if not _is_init and self.update_nodes_func then | 283 | if not _is_init and self.update_nodes_func then |
| 259 | self.update_nodes_func(_nodes); | 284 | self.update_nodes_func(_nodes); |
| 260 | end | 285 | end |
| 286 | |||
| 287 | --[[if flag==0 then | ||
| 288 | self.btn_vip_year:setVisible(true); --包年 | ||
| 289 | self.btn_vip_month:setVisible(true); --包月 | ||
| 290 | self.btn_vip_lianxu:setVisible(true); --续包月 | ||
| 291 | else | ||
| 292 | self.btn_vip_year:setVisible(false); --包年 | ||
| 293 | self.btn_vip_month:setVisible(false); --包月 | ||
| 294 | self.btn_vip_lianxu:setVisible(false); --续包月 | ||
| 295 | --table:remove(self.btn_vip_year); | ||
| 296 | --table:remove(self.btn_vip_month); | ||
| 297 | --table:remove(self.btn_vip_lianxu); | ||
| 298 | end--]] | ||
| 299 | |||
| 300 | |||
| 261 | return _nodes; | 301 | return _nodes; |
| 262 | end | 302 | end |
| 263 | 303 | ||
| 304 | -- 删除table表中符合conditionFunc的数据 | ||
| 305 | -- @param tb 要删除数据的table | ||
| 306 | -- @param conditionFunc 符合要删除的数据的条件函数 | ||
| 307 | function removeTableData(tb, conditionFunc) | ||
| 308 | -- body | ||
| 309 | if tb ~= nil and next(tb) ~= nil then | ||
| 310 | -- todo | ||
| 311 | for i = #tb, 1, -1 do | ||
| 312 | if conditionFunc(tb[i]) then | ||
| 313 | -- todo | ||
| 314 | table.remove(tb, i) | ||
| 315 | end | ||
| 316 | end | ||
| 317 | end | ||
| 318 | end | ||
| 319 | |||
| 264 | function ActivityVipView:onGetClick(ref) | 320 | function ActivityVipView:onGetClick(ref) |
| 265 | local reciever = require("app.views.view.XyxPayView_shdx"):show(); | 321 | local reciever = require("app.views.view.XyxPayView_shdx"):show(); |
| 266 | cc.Director:getInstance():getRunningScene().keypadManager:addKeypadReceiver(reciever); | 322 | cc.Director:getInstance():getRunningScene().keypadManager:addKeypadReceiver(reciever); | ... | ... |
| ... | @@ -13,13 +13,6 @@ function ActivityVipView:init() | ... | @@ -13,13 +13,6 @@ function ActivityVipView:init() |
| 13 | local vipList = ShopInfo.getVipList(); | 13 | local vipList = ShopInfo.getVipList(); |
| 14 | -- (月卡,包年卡,包月卡) | 14 | -- (月卡,包年卡,包月卡) |
| 15 | 15 | ||
| 16 | self.btn_vip_year = self:getChildByName("btn_vip_year"); | ||
| 17 | self.btn_vip_year.id = vipList[2].id; | ||
| 18 | self.btn_vip_year.fn = function() | ||
| 19 | self:onGetClick(self.btn_vip_year); | ||
| 20 | end | ||
| 21 | self.btn_vip_year:addTouchEventListener( function(ref, type) self:onButtonClick(ref, type, handler(self, self.onGetClick)) end); | ||
| 22 | |||
| 23 | self.btn_vip_lianxu = self:getChildByName("btn_vip_lianxu"); | 16 | self.btn_vip_lianxu = self:getChildByName("btn_vip_lianxu"); |
| 24 | logD("vipList[3]--------------------->" .. #vipList); | 17 | logD("vipList[3]--------------------->" .. #vipList); |
| 25 | if vipList[3] then | 18 | if vipList[3] then |
| ... | @@ -37,27 +30,16 @@ function ActivityVipView:init() | ... | @@ -37,27 +30,16 @@ function ActivityVipView:init() |
| 37 | end | 30 | end |
| 38 | self.btn_lingqu_month:addTouchEventListener( function(ref, type) self:onButtonClick(ref, type, handler(self, self.onLingquClick)) end); | 31 | self.btn_lingqu_month:addTouchEventListener( function(ref, type) self:onButtonClick(ref, type, handler(self, self.onLingquClick)) end); |
| 39 | 32 | ||
| 40 | self.btn_lingqu_year = self:getChildByName("btn_lingqu_year"); | ||
| 41 | self.btn_lingqu_year.id = vipList[2].id; | ||
| 42 | self.btn_lingqu_year.fn = function() | ||
| 43 | self:onLingquClick(self.btn_lingqu_year); | ||
| 44 | end | ||
| 45 | self.btn_lingqu_year:addTouchEventListener( function(ref, type) self:onButtonClick(ref, type, handler(self, self.onLingquClick)) end); | ||
| 46 | |||
| 47 | self.yilingqu_month = self:getChildByName("yilingqu_month"); | 33 | self.yilingqu_month = self:getChildByName("yilingqu_month"); |
| 48 | self.yilingqu_month:setVisible(false); | 34 | self.yilingqu_month:setVisible(false); |
| 49 | self.yilingqu_year = self:getChildByName("yilingqu_year"); | ||
| 50 | self.yilingqu_year:setVisible(false); | ||
| 51 | 35 | ||
| 52 | EventListener.addEventListener(self, EnumEvent.UPDATE_VIP, handler(self, self.onVipUpdate)); | 36 | EventListener.addEventListener(self, EnumEvent.UPDATE_VIP, handler(self, self.onVipUpdate)); |
| 53 | 37 | ||
| 54 | UmengHelper.onEvent("activity_vip_show"); | 38 | UmengHelper.onEvent("activity_vip_show"); |
| 55 | 39 | ||
| 56 | self.yilingqu_month:setVisible(false); | 40 | self.yilingqu_month:setVisible(false); |
| 57 | self.yilingqu_year:setVisible(false); | ||
| 58 | self.btn_lingqu_month:setVisible(false); | 41 | self.btn_lingqu_month:setVisible(false); |
| 59 | self.btn_vip_year:setVisible(false); | 42 | self.btn_vip_lianxu:setVisible(false); |
| 60 | self.btn_lingqu_year:setVisible(false); | ||
| 61 | local function authCallbackLua(result) | 43 | local function authCallbackLua(result) |
| 62 | -- 去鉴权看看有没有订购连续包月 | 44 | -- 去鉴权看看有没有订购连续包月 |
| 63 | self.orderStaus = result; | 45 | self.orderStaus = result; |
| ... | @@ -131,7 +113,7 @@ function ActivityVipView:update(_is_init) | ... | @@ -131,7 +113,7 @@ function ActivityVipView:update(_is_init) |
| 131 | end | 113 | end |
| 132 | 114 | ||
| 133 | local has_vip_month = false; | 115 | local has_vip_month = false; |
| 134 | local data1 = UserModel.getVipByID(vipInfo1.id); | 116 | --[[local data1 = UserModel.getVipByID(vipInfo1.id); --没有包月 |
| 135 | if data1 and data1.val2 >= UserModel.time_second then | 117 | if data1 and data1.val2 >= UserModel.time_second then |
| 136 | has_vip_month = true; | 118 | has_vip_month = true; |
| 137 | elseif vipInfo3 then | 119 | elseif vipInfo3 then |
| ... | @@ -170,14 +152,14 @@ function ActivityVipView:update(_is_init) | ... | @@ -170,14 +152,14 @@ function ActivityVipView:update(_is_init) |
| 170 | -- self.btn_vip_month_single:setVisible(true); | 152 | -- self.btn_vip_month_single:setVisible(true); |
| 171 | -- _nodes[1] = { self.btn_vip_month_single }; | 153 | -- _nodes[1] = { self.btn_vip_month_single }; |
| 172 | end | 154 | end |
| 173 | end | 155 | end--]] |
| 174 | 156 | ||
| 175 | if vipInfo3 then | 157 | if vipInfo3 then |
| 176 | local data3 = UserModel.getVipByID(vipInfo3.id); | 158 | local data3 = UserModel.getVipByID(vipInfo3.id); |
| 177 | if data3 and(data3.val1 > 0 or data3.val2 > 0 or data3.val3 > 0) then | 159 | if data3 and(data3.val1 > 0 or data3.val2 > 0 or data3.val3 > 0) then |
| 178 | if data3.val1 == 0 or not TimeUtil.isToday(UserModel.time_second, data3.val1) then | 160 | if data3.val1 == 0 or not TimeUtil.isToday(UserModel.time_second, data3.val1) then |
| 179 | -- 可领取 | 161 | -- 可领取 |
| 180 | -- self.btn_lingqu_month:setVisible(true); | 162 | self.btn_lingqu_month:setVisible(true); |
| 181 | self.btn_lingqu_month.id = vipInfo3.id; | 163 | self.btn_lingqu_month.id = vipInfo3.id; |
| 182 | -- self.btn_lingqu_month:getChildByName("txt"):setString("永久"); | 164 | -- self.btn_lingqu_month:getChildByName("txt"):setString("永久"); |
| 183 | _nodes[1] = { self.btn_lingqu_month }; | 165 | _nodes[1] = { self.btn_lingqu_month }; |
| ... | @@ -186,23 +168,23 @@ function ActivityVipView:update(_is_init) | ... | @@ -186,23 +168,23 @@ function ActivityVipView:update(_is_init) |
| 186 | self.btn_lingqu_month:setVisible(false); | 168 | self.btn_lingqu_month:setVisible(false); |
| 187 | self.yilingqu_month:setVisible(true); | 169 | self.yilingqu_month:setVisible(true); |
| 188 | end | 170 | end |
| 189 | elseif not has_vip_month then | 171 | else |
| 190 | --[[self.btn_vip_lianxu:setVisible(true); | 172 | self.btn_vip_lianxu:setVisible(true); |
| 191 | if #_nodes > 0 then | 173 | if #_nodes > 0 then |
| 192 | _nodes[1][#_nodes[1]+1] = self.btn_vip_lianxu; | 174 | _nodes[1][#_nodes[1]+1] = self.btn_vip_lianxu; |
| 193 | else | 175 | else |
| 194 | _nodes[1] = {self.btn_vip_lianxu}; | 176 | _nodes[1] = {self.btn_vip_lianxu}; |
| 195 | end--]] | 177 | end |
| 196 | end | 178 | end |
| 197 | end | 179 | end |
| 198 | 180 | ||
| 199 | if #_nodes > 0 then | 181 | --[[if #_nodes > 0 then |
| 200 | _nodes[1][#_nodes[1] + 1] = self.btn_vip_lianxu; | 182 | _nodes[1][#_nodes[1] + 1] = self.btn_vip_lianxu; |
| 201 | else | 183 | else |
| 202 | _nodes[1] = { self.btn_vip_lianxu }; | 184 | _nodes[1] = { self.btn_vip_lianxu }; |
| 203 | end | 185 | end--]] |
| 204 | 186 | ||
| 205 | -- 包年 | 187 | -- 包年,没有包年 |
| 206 | local vipInfo2 = vipList[2]; | 188 | local vipInfo2 = vipList[2]; |
| 207 | local itemList2 = vipInfo2.itemList; | 189 | local itemList2 = vipInfo2.itemList; |
| 208 | --[[for i = 1, 3 do | 190 | --[[for i = 1, 3 do |
| ... | @@ -220,7 +202,7 @@ function ActivityVipView:update(_is_init) | ... | @@ -220,7 +202,7 @@ function ActivityVipView:update(_is_init) |
| 220 | item:setVisible(false); | 202 | item:setVisible(false); |
| 221 | end | 203 | end |
| 222 | end--]] | 204 | end--]] |
| 223 | local data = UserModel.getVipByID(vipInfo2.id); | 205 | --[[local data = UserModel.getVipByID(vipInfo2.id); |
| 224 | if data and data.val2 >= UserModel.time_second then | 206 | if data and data.val2 >= UserModel.time_second then |
| 225 | if data.val1 == 0 or not TimeUtil.isToday(UserModel.time_second, data.val1) then | 207 | if data.val1 == 0 or not TimeUtil.isToday(UserModel.time_second, data.val1) then |
| 226 | -- 可领取 | 208 | -- 可领取 |
| ... | @@ -231,23 +213,23 @@ function ActivityVipView:update(_is_init) | ... | @@ -231,23 +213,23 @@ function ActivityVipView:update(_is_init) |
| 231 | if day < 0 then | 213 | if day < 0 then |
| 232 | day = 0; | 214 | day = 0; |
| 233 | end | 215 | end |
| 234 | --[[self.btn_lingqu_year:setVisible(true); | 216 | self.btn_lingqu_year:setVisible(true); |
| 235 | self.btn_lingqu_year:getChildByName("txt"):setString("(剩余" .. day .. "天)"); | 217 | self.btn_lingqu_year:getChildByName("txt"):setString("(剩余" .. day .. "天)"); |
| 236 | if not _nodes[1] then | 218 | if not _nodes[1] then |
| 237 | _nodes[1] = { }; | 219 | _nodes[1] = { }; |
| 238 | end | 220 | end |
| 239 | _nodes[1][#_nodes[1] + 1] = self.btn_lingqu_year;--]] | 221 | _nodes[1][#_nodes[1] + 1] = self.btn_lingqu_year; |
| 240 | else | 222 | else |
| 241 | -- 已领取 | 223 | -- 已领取 |
| 242 | --self.yilingqu_year:setVisible(true); | 224 | --self.yilingqu_year:setVisible(true); |
| 243 | end | 225 | end |
| 244 | else | 226 | else |
| 245 | --[[self.btn_vip_year:setVisible(true); | 227 | self.btn_vip_year:setVisible(true); |
| 246 | if not _nodes[1] then | 228 | if not _nodes[1] then |
| 247 | _nodes[1] = { }; | 229 | _nodes[1] = { }; |
| 248 | end | 230 | end |
| 249 | _nodes[1][#_nodes[1] + 1] = self.btn_vip_year;--]] | 231 | _nodes[1][#_nodes[1] + 1] = self.btn_vip_year; |
| 250 | end | 232 | end--]] |
| 251 | 233 | ||
| 252 | if not _is_init and self.update_nodes_func then | 234 | if not _is_init and self.update_nodes_func then |
| 253 | self.update_nodes_func(_nodes); | 235 | self.update_nodes_func(_nodes); | ... | ... |
| ... | @@ -228,8 +228,13 @@ function RoleBussinessView:onWxClick(ref) | ... | @@ -228,8 +228,13 @@ function RoleBussinessView:onWxClick(ref) |
| 228 | end | 228 | end |
| 229 | 229 | ||
| 230 | function RoleBussinessView:onVipClick(ref) | 230 | function RoleBussinessView:onVipClick(ref) |
| 231 | local reciever = require("app.views.view.ActivityView"):show("ActivityVipView"); | 231 | if CHANNEL=="shdx" then |
| 232 | cc.Director:getInstance():getRunningScene().keypadManager:addKeypadReceiver(reciever); | 232 | local reciever = require("app.views.view.XyxPayView_shdx"):show(); |
| 233 | cc.Director:getInstance():getRunningScene().keypadManager:addKeypadReceiver(reciever); | ||
| 234 | else | ||
| 235 | local reciever = require("app.views.view.ActivityView"):show("ActivityVipView"); | ||
| 236 | cc.Director:getInstance():getRunningScene().keypadManager:addKeypadReceiver(reciever); | ||
| 237 | end | ||
| 233 | end | 238 | end |
| 234 | 239 | ||
| 235 | function RoleBussinessView:onGetClick(ref) | 240 | function RoleBussinessView:onGetClick(ref) | ... | ... |
| ... | @@ -3,8 +3,8 @@ cc.FileUtils:getInstance():setPopupNotify(false) | ... | @@ -3,8 +3,8 @@ cc.FileUtils:getInstance():setPopupNotify(false) |
| 3 | cc.FileUtils:getInstance():addSearchPath("src/") | 3 | cc.FileUtils:getInstance():addSearchPath("src/") |
| 4 | cc.FileUtils:getInstance():addSearchPath("res/") | 4 | cc.FileUtils:getInstance():addSearchPath("res/") |
| 5 | 5 | ||
| 6 | local engine_loaded = {}; | 6 | local engine_loaded = { }; |
| 7 | for i,v in pairs(package.loaded) do | 7 | for i, v in pairs(package.loaded) do |
| 8 | engine_loaded[i] = v; | 8 | engine_loaded[i] = v; |
| 9 | end | 9 | end |
| 10 | 10 | ||
| ... | @@ -27,8 +27,10 @@ local function main() | ... | @@ -27,8 +27,10 @@ local function main() |
| 27 | PROXY_HTTP_ADDR = ConfigInfo.getConfigInfo("proxy_http_addr"); | 27 | PROXY_HTTP_ADDR = ConfigInfo.getConfigInfo("proxy_http_addr"); |
| 28 | PROXY_SOCK_ADDR = ConfigInfo.getConfigInfo("proxy_sock_addr"); | 28 | PROXY_SOCK_ADDR = ConfigInfo.getConfigInfo("proxy_sock_addr"); |
| 29 | IS_TV = tonumber(ConfigInfo.getConfigInfo("is_tv")); | 29 | IS_TV = tonumber(ConfigInfo.getConfigInfo("is_tv")); |
| 30 | MEMBER_TYPE=0; --会员类型,0:不是会员, 其他对应pay.xml中的pay_id | 30 | MEMBER_TYPE = 0; |
| 31 | IS_MEMBER=0; --是不是会员 0:不是会员 | 31 | -- 会员类型,0:不是会员, 其他对应pay.xml中的pay_id |
| 32 | IS_MEMBER = 0; | ||
| 33 | -- 是不是会员 0:不是会员 | ||
| 32 | 34 | ||
| 33 | require "core.log.init"; | 35 | require "core.log.init"; |
| 34 | require "core.net.socket_connection"; | 36 | require "core.net.socket_connection"; |
| ... | @@ -40,93 +42,94 @@ local function main() | ... | @@ -40,93 +42,94 @@ local function main() |
| 40 | CDN_CONFIG_URL = ConfigInfo.getConfigInfo("cdn_config_url") or ""; | 42 | CDN_CONFIG_URL = ConfigInfo.getConfigInfo("cdn_config_url") or ""; |
| 41 | if not CDN_CONFIG_URL or CDN_CONFIG_URL == "" then | 43 | if not CDN_CONFIG_URL or CDN_CONFIG_URL == "" then |
| 42 | GAME_LOGIN_URL = ConfigInfo.getConfigInfo("game_login_url"); | 44 | GAME_LOGIN_URL = ConfigInfo.getConfigInfo("game_login_url"); |
| 43 | print("本地配置 登录服务器地址:"..GAME_LOGIN_URL); | 45 | print("本地配置 登录服务器地址:" .. GAME_LOGIN_URL); |
| 44 | PLATFORM = tonumber(ConfigInfo.getConfigInfo("platform")); | 46 | PLATFORM = tonumber(ConfigInfo.getConfigInfo("platform")); |
| 45 | print("本地配置 平台号PLATFORM:"..PLATFORM); | 47 | print("本地配置 平台号PLATFORM:" .. PLATFORM); |
| 46 | end | 48 | end |
| 47 | 49 | ||
| 48 | if CHANNEL == "shdx" and targetPlatform == cc.PLATFORM_OS_ANDROID then | 50 | if CHANNEL == "shdx" and targetPlatform == cc.PLATFORM_OS_ANDROID then |
| 49 | self:isMember(); | 51 | self:isMember(); |
| 50 | end | 52 | end |
| 51 | 53 | ||
| 52 | cc.Director:getInstance():setAnimationInterval(1/30); | 54 | cc.Director:getInstance():setAnimationInterval(1 / 30); |
| 53 | require("app.MyApp"):create():run("LoadingScene"); | 55 | require("app.MyApp"):create():run("LoadingScene"); |
| 54 | end | 56 | end |
| 55 | 57 | ||
| 56 | --判断是不是会员 | 58 | -- 判断是不是会员 |
| 57 | function isMember() | 59 | function isMember() |
| 58 | local targetPlatform = cc.Application:getInstance():getTargetPlatform(); | 60 | local targetPlatform = cc.Application:getInstance():getTargetPlatform(); |
| 59 | local function callbackLua(params) | 61 | local function callbackLua(params) |
| 60 | logUI("IS MEMEBER---->"..params); | 62 | logUI("IS MEMEBER---->" .. params); |
| 61 | if params=="success" then | 63 | if params == "success" then |
| 62 | IS_MEMBER=1; | 64 | IS_MEMBER = 1; |
| 63 | else | 65 | else |
| 64 | IS_MEMBER=0; | 66 | IS_MEMBER = 0; |
| 65 | end | ||
| 66 | end | ||
| 67 | local luaj = require "cocos.cocos2d.luaj"; --引入luaj | ||
| 68 | local className = "org/cocos2dx/lua/AppActivity"; | ||
| 69 | local args = { callbackLua }; | ||
| 70 | local sigs = "(I)V"; | ||
| 71 | -- 传入string参数,无返回值 | ||
| 72 | |||
| 73 | -- luaj 调用 Java 方法时,可能会出现各种错误,因此 luaj 提供了一种机制让 Lua 调用代码可以确定 Java 方法是否成功调用。 | ||
| 74 | -- luaj.callStaticMethod() 会返回两个值 | ||
| 75 | -- 当成功时,第一个值为 true,第二个值是 Java 方法的返回值(如果有) | ||
| 76 | -- 当失败时,第一个值为 false,第二个值是错误代码 | ||
| 77 | local ok, ret = luaj.callStaticMethod(className, "authPermission", args, sigs); | ||
| 78 | if not ok then | ||
| 79 | print("authPermission error:" .. ret); | ||
| 80 | end | 67 | end |
| 81 | 68 | end | |
| 69 | local luaj = require "cocos.cocos2d.luaj"; | ||
| 70 | -- 引入luaj | ||
| 71 | local className = "org/cocos2dx/lua/AppActivity"; | ||
| 72 | local args = { callbackLua }; | ||
| 73 | local sigs = "(I)V"; | ||
| 74 | -- 传入string参数,无返回值 | ||
| 75 | |||
| 76 | -- luaj 调用 Java 方法时,可能会出现各种错误,因此 luaj 提供了一种机制让 Lua 调用代码可以确定 Java 方法是否成功调用。 | ||
| 77 | -- luaj.callStaticMethod() 会返回两个值 | ||
| 78 | -- 当成功时,第一个值为 true,第二个值是 Java 方法的返回值(如果有) | ||
| 79 | -- 当失败时,第一个值为 false,第二个值是错误代码 | ||
| 80 | local ok, ret = luaj.callStaticMethod(className, "authPermission", args, sigs); | ||
| 81 | if not ok then | ||
| 82 | print("authPermission error:" .. ret); | ||
| 83 | end | ||
| 84 | |||
| 82 | end | 85 | end |
| 83 | 86 | ||
| 84 | function reloadGame() | 87 | function reloadGame() |
| 85 | for k,_ in pairs(package.loaded) do | 88 | for k, _ in pairs(package.loaded) do |
| 86 | local has_k = false; | 89 | local has_k = false; |
| 87 | for i,v in pairs(engine_loaded) do | 90 | for i, v in pairs(engine_loaded) do |
| 88 | if k == i then | 91 | if k == i then |
| 89 | has_k = true; | 92 | has_k = true; |
| 90 | end | 93 | end |
| 91 | end | 94 | end |
| 92 | if not has_k then | 95 | if not has_k then |
| 93 | print("remove:"..k); | 96 | print("remove:" .. k); |
| 94 | package.loaded[k] = nil; | 97 | package.loaded[k] = nil; |
| 95 | end | 98 | end |
| 96 | end | 99 | end |
| 97 | 100 | ||
| 98 | cc.Director:getInstance():purgeCachedData(); | 101 | cc.Director:getInstance():purgeCachedData(); |
| 99 | cc.FileUtils:getInstance():purgeCachedEntries(); | 102 | cc.FileUtils:getInstance():purgeCachedEntries(); |
| 100 | 103 | ||
| 101 | require("main"); | 104 | require("main"); |
| 102 | end | 105 | end |
| 103 | 106 | ||
| 104 | function loadGame(game_name) | 107 | function loadGame(game_name) |
| 105 | local searchPaths = cc.FileUtils:getInstance():getSearchPaths(); | 108 | local searchPaths = cc.FileUtils:getInstance():getSearchPaths(); |
| 106 | local resPath = cc.FileUtils:getInstance():getWritablePath().."GameUpdate/"..game_name.."/"; | 109 | local resPath = cc.FileUtils:getInstance():getWritablePath() .. "GameUpdate/" .. game_name .. "/"; |
| 107 | searchPaths = {}; | 110 | searchPaths = { }; |
| 108 | table.insert(searchPaths,1,resPath); | 111 | table.insert(searchPaths, 1, resPath); |
| 109 | table.insert(searchPaths,2,resPath .. 'res/'); | 112 | table.insert(searchPaths, 2, resPath .. 'res/'); |
| 110 | table.insert(searchPaths,3,resPath .. 'src/'); | 113 | table.insert(searchPaths, 3, resPath .. 'src/'); |
| 111 | cc.FileUtils:getInstance():setSearchPaths(searchPaths); | 114 | cc.FileUtils:getInstance():setSearchPaths(searchPaths); |
| 112 | 115 | ||
| 113 | for k,_ in pairs(package.loaded) do | 116 | for k, _ in pairs(package.loaded) do |
| 114 | local has_k = false; | 117 | local has_k = false; |
| 115 | for i,v in pairs(engine_loaded) do | 118 | for i, v in pairs(engine_loaded) do |
| 116 | if k == i then | 119 | if k == i then |
| 117 | has_k = true; | 120 | has_k = true; |
| 118 | end | 121 | end |
| 119 | end | 122 | end |
| 120 | if not has_k then | 123 | if not has_k then |
| 121 | print("remove:"..k); | 124 | print("remove:" .. k); |
| 122 | package.loaded[k] = nil; | 125 | package.loaded[k] = nil; |
| 123 | end | 126 | end |
| 124 | end | 127 | end |
| 125 | 128 | ||
| 126 | cc.FileUtils:getInstance():purgeCachedEntries(); | 129 | cc.FileUtils:getInstance():purgeCachedEntries(); |
| 127 | cc.Director:getInstance():purgeCachedData(); | 130 | cc.Director:getInstance():purgeCachedData(); |
| 128 | 131 | ||
| 129 | app:enterScene("LoadingScene",{nextSceneName="main"}); | 132 | app:enterScene("LoadingScene", { nextSceneName = "main" }); |
| 130 | end | 133 | end |
| 131 | 134 | ||
| 132 | local status, msg = xpcall(main, __G__TRACKBACK__) | 135 | local status, msg = xpcall(main, __G__TRACKBACK__) | ... | ... |
No preview for this file type
This diff is collapsed.
Click to expand it.
| ... | @@ -34,10 +34,9 @@ | ... | @@ -34,10 +34,9 @@ |
| 34 | <FilePathData Path="ui/dress/BusinessView.csd" /> | 34 | <FilePathData Path="ui/dress/BusinessView.csd" /> |
| 35 | <FilePathData Path="ui/dress/DressLayer.csd" /> | 35 | <FilePathData Path="ui/dress/DressLayer.csd" /> |
| 36 | <FilePathData Path="ui/achievement/AchievementItem.csd" /> | 36 | <FilePathData Path="ui/achievement/AchievementItem.csd" /> |
| 37 | <FilePathData Path="ui/xyx/shanghai_ctcc/XyxPayLayer.csd" /> | 37 | <FilePathData Path="ui/Activity/tianjin_cucc/ActivityVip.csd" /> |
| 38 | <FilePathData Path="ui/Activity/shanghai_ctcc/ActivityVip.csd" /> | ||
| 39 | </OpenedDocuments> | 38 | </OpenedDocuments> |
| 40 | <ActiveDocument Path="ui/xyx/shanghai_ctcc/XyxPayLayer.csd" /> | 39 | <ActiveDocument Path="ui/Activity/tianjin_cucc/ActivityVip.csd" /> |
| 41 | </Value> | 40 | </Value> |
| 42 | </Item> | 41 | </Item> |
| 43 | </Properties> | 42 | </Properties> | ... | ... |
-
Please register or sign in to post a comment