Skip to content

Commit

Permalink
Merge pull request chukong#311 from htlxyz/feature/integration_umeng_…
Browse files Browse the repository at this point in the history
…push

modifyr depreation function
  • Loading branch information
dualface committed May 14, 2014
2 parents c256821 + 66ef593 commit f16a6e4
Show file tree
Hide file tree
Showing 18 changed files with 12 additions and 162 deletions.
15 changes: 0 additions & 15 deletions samples/2048/scripts/update.lua
Original file line number Diff line number Diff line change
Expand Up @@ -220,21 +220,6 @@ function UpdateScene:onEnter()
self:requestFromServer(self.requesting)

self:addNodeEventListener(cc.NODE_ENTER_FRAME_EVENT, function(dt) self:onEnterFrame(dt) end)

print("device.platform", device.platform)
if device.platform ~= "android" then return end

-- avoid unmeant back
self:performWithDelay(function()
-- keypad layer, for android
local layer = display.newLayer()
layer:addKeypadEventListener(function(event)
if event == "back" then game.exit() end
end)
self:addChild(layer)

layer:setKeypadEnabled(true)
end, 0.5)
end

function UpdateScene:onExit()
Expand Down
13 changes: 0 additions & 13 deletions samples/chukong_ad/scripts/app/scenes/MainScene.lua
Original file line number Diff line number Diff line change
Expand Up @@ -118,19 +118,6 @@ function MainScene:initNoAd()
end

function MainScene:onEnter()
if device.platform == "android" then
-- avoid unmeant back
self:performWithDelay(function()
-- keypad layer, for android
local layer = display.newLayer()
layer:addKeypadEventListener(function(event)
if event == "back" then app.exit() end
end)
self:addChild(layer)

layer:setKeypadEnabled(true)
end, 0.5)
end
end

function MainScene:onExit()
Expand Down
13 changes: 0 additions & 13 deletions samples/cocopush/scripts/app/scenes/MainScene.lua
Original file line number Diff line number Diff line change
Expand Up @@ -155,19 +155,6 @@ function MainScene:noPushView()
end

function MainScene:onEnter()
if device.platform == "android" then
-- avoid unmeant back
self:performWithDelay(function()
-- keypad layer, for android
local layer = display.newLayer()
layer:addKeypadEventListener(function(event)
if event == "back" then app.exit() end
end)
self:addChild(layer)

layer:setKeypadEnabled(true)
end, 0.5)
end
end

function MainScene:onExit()
Expand Down
16 changes: 0 additions & 16 deletions samples/coinflip/scripts/app/scenes/MenuScene.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ function MenuScene:ctor()
sound = GAME_SFX.tapButton,
prepare = function()
self.menu:setEnabled(false)
self.layer:setKeypadEnabled(false)
end,
listener = function()
app:enterMoreGamesScene()
Expand All @@ -35,7 +34,6 @@ function MenuScene:ctor()
sound = GAME_SFX.tapButton,
prepare = function()
self.menu:setEnabled(false)
self.layer:setKeypadEnabled(false)
end,
listener = function()
app:enterChooseLevelScene()
Expand All @@ -44,23 +42,9 @@ function MenuScene:ctor()

self.menu = ui.newMenu({self.moreGamesButton, self.startButton})
self:addChild(self.menu)

-- keypad layer, for android
self.layer = display.newLayer()
self.layer:addKeypadEventListener(function(event)
if event == "back" then
audio.playSound(GAME_SFX.backButton)
app:exit()
end
end)
self:addChild(self.layer)
end

function MenuScene:onEnter()
-- avoid unmeant back
self:performWithDelay(function()
self.layer:setKeypadEnabled(true)
end, 0.5)
end

return MenuScene
2 changes: 1 addition & 1 deletion samples/coinflip/scripts/app/scenes/PlayLevelScene.lua
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ function PlayLevelScene:ctor(levelIndex)
end

function PlayLevelScene:onLevelCompleted()
audio.playEffect(GAME_SFX.levelCompleted)
audio.playSound(GAME_SFX.levelCompleted)

local dialog = display.newSprite("#LevelCompletedDialogBg.png")
dialog:setPosition(display.cx, display.top + dialog:getContentSize().height / 2 + 40)
Expand Down
8 changes: 4 additions & 4 deletions samples/coinflip/scripts/app/ui/ScrollView.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ local ScrollView = class("ScrollView", function(rect)
if not rect then rect = CCRect(0, 0, 0, 0) end
local node = display.newClippingRegionNode(rect)
node:setNodeEventEnabled(true)
require("framework.api.EventProtocol").extend(node)
cc(node):addComponent("components.behavior.EventProtocol"):exportMethods()
return node
end)

Expand All @@ -26,10 +26,10 @@ function ScrollView:ctor(rect, direction)
self.cells = {}
self.currentIndex = 0

self:registerScriptHandler(function(event)
if event == "enter" then
self:addNodeEventListener(cc.NODE_EVENT, function(event)
if event.name == "enter" then
self:onEnter()
elseif event == "exit" then
elseif event.name == "exit" then
self:onExit()
end
end)
Expand Down
2 changes: 1 addition & 1 deletion samples/coinflip/scripts/app/ui/ScrollViewCell.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ local ScrollViewCell = class("ScrollViewCell", function(contentSize)
local node = display.newNode()
if contentSize then node:setContentSize(contentSize) end
node:setNodeEventEnabled(true)
require("framework.api.EventProtocol").extend(node)
cc(node):addComponent("components.behavior.EventProtocol"):exportMethods()
return node
end)

Expand Down
4 changes: 2 additions & 2 deletions samples/coinflip/scripts/app/views/Board.lua
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ function Board:ctor(levelData)
end
end

self:addNodeEventListener(c.NODE_TOUCH_EVENT, function(event)
self:addNodeEventListener(cc.NODE_TOUCH_EVENT, function(event)
return self:onTouch(event.name, event.x, event.y)
end)
self:setNodeEventEnabled(true)
Expand Down Expand Up @@ -83,7 +83,7 @@ function Board:flipCoin(coin, includeNeighbour)
end
end)
if includeNeighbour then
audio.playEffect(GAME_SFX.flipCoin)
audio.playSound(GAME_SFX.flipCoin)
self.batch:reorderChild(coin, COIN_ZORDER + 1)
self:performWithDelay(function()
self:flipCoin(self:getCoin(coin.row - 1, coin.col))
Expand Down
14 changes: 1 addition & 13 deletions samples/editbox/scripts/scenes/MainScene.lua
Original file line number Diff line number Diff line change
Expand Up @@ -85,19 +85,7 @@ function MainScene:onEditBoxChanged(editbox)
end

function MainScene:onEnter()
if device.platform ~= "android" then return end

-- avoid unmeant back
self:performWithDelay(function()
-- keypad layer, for android
local layer = display.newLayer()
layer:addKeypadEventListener(function(event)
if event == "back" then game.exit() end
end)
self:addChild(layer)

layer:setKeypadEnabled(true)
end, 0.5)

end

return MainScene
2 changes: 1 addition & 1 deletion samples/iap4ios/scripts/services/Store.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Store.TRANSACTION_FAILED = "TRANSACTION_FAILED"
Store.TRANSACTION_UNKNOWN_ERROR = "TRANSACTION_UNKNOWN_ERROR"

function Store:ctor()
require("framework.api.EventProtocol").extend(self)
cc(self):addComponent("components.behavior.EventProtocol"):exportMethods()

self.provider = require("framework.api.Store")
self.provider.init(handler(self, self.transactionCallback))
Expand Down
13 changes: 0 additions & 13 deletions samples/luajavabridge/scripts/scenes/MainScene.lua
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,6 @@ function MainScene:ctor()
end

function MainScene:onEnter()
if device.platform ~= "android" then return end

-- avoid unmeant back
self:performWithDelay(function()
-- keypad layer, for android
local layer = display.newLayer()
layer:addKeypadEventListener(function(event)
if event == "back" then game.exit() end
end)
self:addChild(layer)

layer:setKeypadEnabled(true)
end, 0.5)
end

return MainScene
2 changes: 1 addition & 1 deletion samples/mvc/scripts/app/models/Actor.lua
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ function Actor:ctor(properties, events, callbacks)
{name = "relive", from = "dead", to = "idle"},
}
-- 如果继承类提供了其他事件,则合并
table.insertTo(defaultEvents, checktable(events))
table.insertto(defaultEvents, checktable(events))

-- 设定状态机的默认回调
local defaultCallbacks = {
Expand Down
13 changes: 0 additions & 13 deletions samples/mvc/scripts/app/scenes/MainScene.lua
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,6 @@ function MainScene:ctor()
end

function MainScene:onEnter()
if device.platform == "android" then
-- avoid unmeant back
self:performWithDelay(function()
-- keypad layer, for android
local layer = display.newLayer()
layer:addKeypadEventListener(function(event)
if event == "back" then app.exit() end
end)
self:addChild(layer)

layer:setKeypadEnabled(true)
end, 0.5)
end
end

function MainScene:onExit()
Expand Down
13 changes: 0 additions & 13 deletions samples/tests/scripts/scenes/MainScene.lua
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,6 @@ function MainScene:openTest(name)
end

function MainScene:onEnter()
if device.platform ~= "android" then return end

-- avoid unmeant back
self:performWithDelay(function()
-- keypad layer, for android
local layer = display.newLayer()
layer:addKeypadEventListener(function(event)
if event == "back" then game.exit() end
end)
self:addChild(layer)

layer:setKeypadEnabled(true)
end, 0.5)
end

return MainScene
14 changes: 0 additions & 14 deletions samples/umeng_analytics/scripts/app/scenes/MainScene.lua
Original file line number Diff line number Diff line change
Expand Up @@ -159,20 +159,6 @@ function MainScene:onEnter()
args = {sceneName = "MainScene"}}
-- MobClickCppForLua:beginScene("MainScene");
end

if device.platform == "android" then
-- avoid unmeant back
self:performWithDelay(function()
-- keypad layer, for android
local layer = display.newLayer()
layer:addKeypadEventListener(function(event)
if event == "back" then app.exit() end
end)
self:addChild(layer)

layer:setKeypadEnabled(true)
end, 0.5)
end
end

function MainScene:onExit()
Expand Down
15 changes: 0 additions & 15 deletions samples/umeng_push/scripts/app/scenes/MainScene.lua
Original file line number Diff line number Diff line change
Expand Up @@ -182,21 +182,6 @@ function MainScene:noPushView()
end

function MainScene:onEnter()
print("htl, MainScene entry")

if device.platform == "android" then
-- avoid unmeant back
self:performWithDelay(function()
-- keypad layer, for android
local layer = display.newLayer()
layer:addKeypadEventListener(function(event)
if event == "back" then app.exit() end
end)
self:addChild(layer)

layer:setKeypadEnabled(true)
end, 0.5)
end
end

function MainScene:onExit()
Expand Down
13 changes: 0 additions & 13 deletions samples/umeng_share/scripts/app/scenes/MainScene.lua
Original file line number Diff line number Diff line change
Expand Up @@ -48,19 +48,6 @@ function MainScene:showNotSupport()
end

function MainScene:onEnter()
if device.platform == "android" then
-- avoid unmeant back
self:performWithDelay(function()
-- keypad layer, for android
local layer = display.newLayer()
layer:addKeypadEventListener(function(event)
if event == "back" then app.exit() end
end)
self:addChild(layer)

layer:setKeypadEnabled(true)
end, 0.5)
end
end

function MainScene:onExit()
Expand Down
2 changes: 1 addition & 1 deletion samples/websockets/scripts/WebSockets.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ WebSockets.CLOSE_EVENT = "close"
WebSockets.ERROR_EVENT = "error"

function WebSockets:ctor(url)
require("framework.api.EventProtocol").extend(self)
cc(self):addComponent("components.behavior.EventProtocol"):exportMethods()
self.socket = WebSocket:create(url)

if self.socket then
Expand Down

0 comments on commit f16a6e4

Please sign in to comment.