Resolve the bug that requiring lua scrip did not consider the module dependent

This commit is contained in:
samuele3hu 2014-12-31 16:28:14 +08:00
parent 50914665e6
commit 54d376db01
23 changed files with 121 additions and 47 deletions

View File

@ -1,3 +1,7 @@
if nil == cc.CCBReader then
return
end
ccb = ccb or {}
function CCBReaderLoad(strFilePath,proxy,owner)

View File

@ -1,3 +1,6 @@
if nil == cc.CCBProxy then
return
end
-- This is the DeprecatedCocosBuilderClass
DeprecatedCocosBuilderClass = {} or DeprecatedCocosBuilderClass

View File

@ -1,4 +1,6 @@
if nil == cc.SimpleAudioEngine then
return
end
--Encapsulate SimpleAudioEngine to AudioEngine,Play music and sound effects.
local M = {}

View File

@ -1,3 +1,6 @@
if nil == cc.SimpleAudioEngine then
return
end
-- This is the DeprecatedCocosDenshionClass
DeprecatedCocosDenshionClass = {} or DeprecatedCocosDenshionClass

View File

@ -1,3 +1,6 @@
if nil == cc.SimpleAudioEngine then
return
end
--tip
local function deprecatedTip(old_name,new_name)
print("\n********** \n"..old_name.." was deprecated please use ".. new_name .. " instead.\n**********")

View File

@ -1,10 +1,11 @@
if nil == ccs then
return
end
if not json then
require "cocos.cocos2d.json"
end
ccs = ccs or {}
require "cocos.cocostudio.StudioConstants"
function ccs.sendTriggerEvent(event)

View File

@ -1,3 +1,6 @@
if nil == ccs then
return
end
-- This is the DeprecatedExtensionClass
DeprecatedExtensionClass = {} or DeprecatedExtensionClass

View File

@ -1,3 +1,7 @@
if nil == ccs then
return
end
--tip
local function deprecatedTip(old_name,new_name)
print("\n********** \n"..old_name.." was deprecated please use ".. new_name .. " instead.\n**********")

View File

@ -1,5 +1,6 @@
ccs = ccs or {}
if nil == ccs then
return
end
ccs.MovementEventType = {
start = 0,

View File

@ -1,5 +1,8 @@
-- This is the DeprecatedExtensionClass
if nil == cc.Control then
return
end
-- This is the DeprecatedExtensionClass
DeprecatedExtensionClass = {} or DeprecatedExtensionClass
--tip
@ -15,21 +18,6 @@ end
_G["CCControl"] = DeprecatedExtensionClass.CCControl()
--CCControl class will be Deprecated,end
--CCEditBox class will be Deprecated,begin
function DeprecatedExtensionClass.CCEditBox()
deprecatedTip("CCEditBox","ccui.EditBox")
return ccui.EditBox
end
_G["CCEditBox"] = DeprecatedExtensionClass.CCEditBox()
function DeprecatedExtensionClass.CCUIEditBox()
deprecatedTip("cc.EditBox","ccui.EditBox")
return ccui.EditBox
end
_G["cc"]["EditBox"] = DeprecatedExtensionClass.CCUIEditBox()
--CCEditBox class will be Deprecated,end
--CCScrollView class will be Deprecated,begin
function DeprecatedExtensionClass.CCScrollView()
deprecatedTip("CCScrollView","cc.ScrollView")
@ -102,6 +90,34 @@ end
_G["CCControlButton"] = DeprecatedExtensionClass.CCControlButton()
--CCControlButton class will be Deprecated,end
--CCControlColourPicker class will be Deprecated,begin
function DeprecatedExtensionClass.CCControlColourPicker()
deprecatedTip("CCControlColourPicker","cc.ControlColourPicker")
return cc.ControlColourPicker
end
_G["CCControlColourPicker"] = DeprecatedExtensionClass.CCControlColourPicker()
--CCControlColourPicker class will be Deprecated,end
if nil == ccui then
return
end
--CCEditBox class will be Deprecated,begin
function DeprecatedExtensionClass.CCEditBox()
deprecatedTip("CCEditBox","ccui.EditBox")
return ccui.EditBox
end
_G["CCEditBox"] = DeprecatedExtensionClass.CCEditBox()
function DeprecatedExtensionClass.CCUIEditBox()
deprecatedTip("cc.EditBox","ccui.EditBox")
return ccui.EditBox
end
_G["cc"]["EditBox"] = DeprecatedExtensionClass.CCUIEditBox()
--CCEditBox class will be Deprecated,end
--CCScale9Sprite class will be Deprecated,begin
function DeprecatedExtensionClass.CCScale9Sprite()
deprecatedTip("CCScale9Sprite","ccui.Scale9Sprite")
@ -116,11 +132,3 @@ end
_G["cc"]["Scale9Sprite"] = DeprecatedExtensionClass.UIScale9Sprite()
--CCScale9Sprite class will be Deprecated,end
--CCControlColourPicker class will be Deprecated,begin
function DeprecatedExtensionClass.CCControlColourPicker()
deprecatedTip("CCControlColourPicker","cc.ControlColourPicker")
return cc.ControlColourPicker
end
_G["CCControlColourPicker"] = DeprecatedExtensionClass.CCControlColourPicker()
--CCControlColourPicker class will be Deprecated,end

View File

@ -1,3 +1,6 @@
if nil == cc.Control then
return
end
_G.kCCControlStepperPartMinus = cc.CONTROL_STEPPER_PART_MINUS
_G.kCCControlStepperPartPlus = cc.CONTROL_STEPPER_PART_PLUS

View File

@ -1,3 +1,7 @@
if nil == cc.Control then
return
end
--tip
local function deprecatedTip(old_name,new_name)
print("\n********** \n"..old_name.." was deprecated please use ".. new_name .. " instead.\n**********")

View File

@ -1,5 +1,6 @@
cc = cc or {}
if nil == cc.Control then
return
end
cc.CONTROL_STATE_NORMAL = 1
cc.CONTROL_STATE_HIGH_LIGHTED = 2

View File

@ -35,16 +35,23 @@ else
-- audio
require "cocos.cocosdenshion.AudioEngine"
-- cocosstudio
if nil ~= ccs then
require "cocos.cocostudio.CocoStudio"
end
-- ui
if nil ~= ccui then
require "cocos.ui.GuiConstants"
require "cocos.ui.experimentalUIConstants"
end
-- extensions
require "cocos.extension.ExtensionConstants"
-- network
require "cocos.network.NetworkConstants"
-- Spine
if nil ~= sp then
require "cocos.spine.SpineConstants"
end
require "cocos.cocos2d.deprecated"
require "cocos.cocos2d.DrawPrimitives"
@ -59,8 +66,11 @@ else
require "cocos.cocos2d.DeprecatedOpenglEnum"
-- register_cocostudio_module
if nil ~= ccs then
require "cocos.cocostudio.DeprecatedCocoStudioClass"
require "cocos.cocostudio.DeprecatedCocoStudioFunc"
end
-- register_cocosbuilder_module
require "cocos.cocosbuilder.DeprecatedCocosBuilderClass"
@ -80,8 +90,10 @@ else
require "cocos.network.DeprecatedNetworkFunc"
-- register_ui_moudle
if nil ~= ccui then
require "cocos.ui.DeprecatedUIEnum"
require "cocos.ui.DeprecatedUIFunc"
end
-- cocosbuilder
require "cocos.cocosbuilder.CCBReaderLoad"

View File

@ -1,3 +1,6 @@
if nil == cc.XMLHttpRequest then
return
end
-- This is the DeprecatedNetworkClass
DeprecatedNetworkClass = {} or DeprecatedNetworkClass

View File

@ -1,3 +1,7 @@
if nil == cc.XMLHttpRequest then
return
end
_G.kWebSocketScriptHandlerOpen = cc.WEBSOCKET_OPEN
_G.kWebSocketScriptHandlerMessage = cc.WEBSOCKET_MESSAGE
_G.kWebSocketScriptHandlerClose = cc.WEBSOCKET_CLOSE

View File

@ -1,3 +1,7 @@
if nil == cc.XMLHttpRequest then
return
end
--tip
local function deprecatedTip(old_name,new_name)
print("\n********** \n"..old_name.." was deprecated please use ".. new_name .. " instead.\n**********")

View File

@ -1,5 +1,6 @@
cc = cc or {}
if nil == cc.XMLHttpRequest then
return
end
cc.WEBSOCKET_OPEN = 0
cc.WEBSOCKET_MESSAGE = 1

View File

@ -1,5 +1,6 @@
sp = sp or {}
if nil == sp then
return
end
sp.EventType =
{

View File

@ -1,3 +1,6 @@
if nil == ccui then
return
end
LAYOUT_COLOR_NONE = ccui.LayoutBackGroundColorType.none
LAYOUT_COLOR_SOLID = ccui.LayoutBackGroundColorType.solid

View File

@ -1,3 +1,7 @@
if nil == ccui then
return
end
--tip
local function deprecatedTip(old_name,new_name)
print("\n********** \n"..old_name.." was deprecated please use ".. new_name .. " instead.\n**********")

View File

@ -1,5 +1,6 @@
ccui = ccui or {}
if nil == ccui then
return
end
ccui.BrightStyle =
{

View File

@ -1,5 +1,6 @@
ccexp = ccexp or {}
if nil == ccexp then
return
end
ccexp.VideoPlayerEvent = {
PLAYING = 0,