Merge pull request #19815 from PatriceJiang/ccEditBox_to_ccuiEditBox

[lua-tests] replace cc.EditBox with ccui.EditBox
This commit is contained in:
minggo 2019-06-10 01:53:26 -07:00 committed by GitHub
commit 0d2b40b6ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -87,7 +87,7 @@ local function runEditBoxTest()
end end
end end
-- top -- top
EditName = cc.EditBox:create(editBoxSize, cc.Scale9Sprite:create("extensions/green_edit.png")) EditName = ccui.EditBox:create(editBoxSize, ccui.Scale9Sprite:create("extensions/green_edit.png"))
EditName:setPosition(cc.p(visibleOrigin.x+visibleSize.width/2, visibleOrigin.y+visibleSize.height*3/4)) EditName:setPosition(cc.p(visibleOrigin.x+visibleSize.width/2, visibleOrigin.y+visibleSize.height*3/4))
local targetPlatform = cc.Application:getInstance():getTargetPlatform() local targetPlatform = cc.Application:getInstance():getTargetPlatform()
if kTargetIphone == targetPlatform or kTargetIpad == targetPlatform then if kTargetIphone == targetPlatform or kTargetIpad == targetPlatform then
@ -106,7 +106,7 @@ local function runEditBoxTest()
newLayer:addChild(EditName) newLayer:addChild(EditName)
--middle --middle
EditPassword = cc.EditBox:create(editBoxSize, cc.Scale9Sprite:create("extensions/orange_edit.png")) EditPassword = ccui.EditBox:create(editBoxSize, ccui.Scale9Sprite:create("extensions/orange_edit.png"))
EditPassword:setPosition(cc.p(visibleOrigin.x+visibleSize.width/2, visibleOrigin.y+visibleSize.height/2)) EditPassword:setPosition(cc.p(visibleOrigin.x+visibleSize.width/2, visibleOrigin.y+visibleSize.height/2))
if kTargetIphone == targetPlatform or kTargetIpad == targetPlatform then if kTargetIphone == targetPlatform or kTargetIpad == targetPlatform then
EditPassword:setFont("American Typewriter", 30) EditPassword:setFont("American Typewriter", 30)
@ -124,7 +124,7 @@ local function runEditBoxTest()
newLayer:addChild(EditPassword) newLayer:addChild(EditPassword)
--bottom --bottom
EditEmail = cc.EditBox:create(cc.size(editBoxSize.width, editBoxSize.height), cc.Scale9Sprite:create("extensions/yellow_edit.png")) EditEmail = ccui.EditBox:create(cc.size(editBoxSize.width, editBoxSize.height), ccui.Scale9Sprite:create("extensions/yellow_edit.png"))
EditEmail:setPosition(cc.p(visibleOrigin.x+visibleSize.width/2, visibleOrigin.y+visibleSize.height/4)) EditEmail:setPosition(cc.p(visibleOrigin.x+visibleSize.width/2, visibleOrigin.y+visibleSize.height/4))
EditEmail:setAnchorPoint(cc.p(0.5, 1.0)) EditEmail:setAnchorPoint(cc.p(0.5, 1.0))
EditEmail:setPlaceHolder("Email:") EditEmail:setPlaceHolder("Email:")

View File

@ -10,7 +10,7 @@ function TextInput.create()
local res = "Images/CyanSquare.png" local res = "Images/CyanSquare.png"
local width = 200 local width = 200
local height = 40 local height = 40
local back = cc.Scale9Sprite:create(res) local back = ccui.Scale9Sprite:create(res)
local edit = ccui.EditBox:create(cc.size(width,height),res) local edit = ccui.EditBox:create(cc.size(width,height),res)
layer:addChild(edit) layer:addChild(edit)
edit:setPosition( cc.p(250,200) ) edit:setPosition( cc.p(250,200) )