fix: type judgment error (#1084)

* fix: type judgment error

---------

Co-authored-by: tkzcfc <tkzcfc@users.noreply.github.com>
Co-authored-by: 一线灵|Deal <halx99@live.com>
Co-authored-by: HYGK-PC\Administrator <tkzc@foxmail.com>
This commit is contained in:
tkzcfc 2023-02-27 19:12:21 +08:00 committed by GitHub
parent 9211db5232
commit 89981bc080
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -385,13 +385,13 @@ function display.newSprite(source, x, y, params)
error(string.format("display.newSprite() - invalid source type \"%s\"", sourceType), 0)
else
sourceType = tolua.type(source)
if sourceType == "cc.SpriteFrame" then
if sourceType == "ax.SpriteFrame" then
if not scale9 then
sprite = spriteClass:createWithSpriteFrame(source)
else
sprite = spriteClass:createWithSpriteFrame(source, params.capInsets)
end
elseif sourceType == "cc.Texture2D" then
elseif sourceType == "ax.Texture2D" then
sprite = spriteClass:createWithTexture(source)
else
error(string.format("display.newSprite() - invalid source type \"%s\"", sourceType), 0)
@ -420,7 +420,7 @@ function display.newSpriteFrame(source, ...)
if not frame then
error(string.format("display.newSpriteFrame() - invalid frame name \"%s\"", tostring(source)), 0)
end
elseif tolua.type(source) == "cc.Texture2D" then
elseif tolua.type(source) == "ax.Texture2D" then
frame = cc.SpriteFrame:createWithTexture(source, ...)
else
error("display.newSpriteFrame() - invalid parameters", 0)