├── res ├── Default │ ├── ImageFile.png │ ├── Button_Disable.png │ ├── Button_Normal.png │ ├── Button_Press.png │ ├── CheckBox_Press.png │ ├── CheckBox_Disable.png │ ├── CheckBox_Normal.png │ ├── CheckBoxNode_Normal.png │ └── CheckBoxNode_Disable.png └── LuaExtend.lua ├── .idea ├── copyright │ └── profiles_settings.xml ├── modules.xml ├── vcs.xml ├── encodings.xml ├── misc.xml └── compiler.xml ├── frameworks └── runtime-src │ ├── proj.ios_mac │ ├── ios │ │ ├── build-cfg.json │ │ ├── Default.png │ │ ├── Icon-100.png │ │ ├── Icon-114.png │ │ ├── Icon-120.png │ │ ├── Icon-144.png │ │ ├── Icon-152.png │ │ ├── Icon-29.png │ │ ├── Icon-40.png │ │ ├── Icon-50.png │ │ ├── Icon-57.png │ │ ├── Icon-58.png │ │ ├── Icon-72.png │ │ ├── Icon-76.png │ │ ├── Icon-80.png │ │ ├── Default@2x.png │ │ ├── Default-568h@2x.png │ │ ├── Default-667h@2x.png │ │ ├── Default-736h@3x.png │ │ ├── Prefix.pch │ │ ├── main.m │ │ ├── RootViewController.h │ │ └── AppController.h │ ├── mac │ │ ├── Icon.icns │ │ ├── build-cfg.json │ │ ├── main.m │ │ ├── Prefix.pch │ │ ├── zh-Hans.lproj │ │ │ └── ConsoleWindow.strings │ │ ├── ConsoleWindowController.h │ │ ├── Info.plist │ │ ├── SimulatorApp.h │ │ └── ConsoleWindowController.m │ ├── libTalkingData.a │ └── cocos_lua_lib.xcodeproj │ │ ├── xcuserdata │ │ └── antz.xcuserdatad │ │ │ ├── xcdebugger │ │ │ └── Breakpoints_v2.xcbkptlist │ │ │ └── xcschemes │ │ │ └── xcschememanagement.plist │ │ └── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ ├── xcuserdata │ │ └── antz.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ │ └── xcshareddata │ │ └── cocos_lua_lib.xccheckout │ ├── proj.win32 │ ├── game.rc │ ├── res │ │ └── game.ico │ ├── main.h │ ├── stdafx.cpp │ ├── targetver.h │ ├── build-cfg.json │ ├── stdafx.h │ ├── main.cpp │ ├── cocos_lua_lib.sln │ ├── cocos_lua_lib.vcxproj.user │ ├── resource.h │ ├── SimulatorWin.h │ └── cocos_lua_lib.vcxproj.filters │ ├── proj.android │ ├── res │ │ ├── drawable-hdpi │ │ │ └── icon.png │ │ ├── drawable-ldpi │ │ │ └── icon.png │ │ ├── drawable-mdpi │ │ │ └── icon.png │ │ └── values │ │ │ └── strings.xml │ ├── .settings │ │ └── org.eclipse.jdt.core.prefs │ ├── jni │ │ ├── Application.mk │ │ ├── Android.mk │ │ └── hellolua │ │ │ └── main.cpp │ ├── project.properties │ ├── .classpath │ ├── build-cfg.json │ ├── ant.properties │ ├── proguard-project.txt │ ├── .project │ ├── src │ │ ├── org │ │ │ └── cocos2dx │ │ │ │ └── lib │ │ │ │ ├── GameControllerUtils.java │ │ │ │ ├── Cocos2dxJavascriptJavaBridge.java │ │ │ │ ├── Cocos2dxLuaJavaBridge.java │ │ │ │ ├── GameControllerDelegate.java │ │ │ │ └── GameControllerAdapter.java │ │ └── com │ │ │ └── chukong │ │ │ └── cocosplay │ │ │ └── client │ │ │ └── CocosPlayClient.java │ └── AndroidManifest.xml │ └── Classes │ ├── ide-support │ ├── CodeIDESupport.h │ ├── lua_debugger.h │ ├── lang │ ├── SimpleConfigParser.h │ ├── RuntimeLuaImpl.h │ └── SimpleConfigParser.cpp │ ├── Purchase.h │ ├── AppDelegate.h │ ├── lua_module_register.h │ └── AppDelegate.cpp ├── .settings └── version.json ├── cocosstudio ├── cocosstudio │ ├── assets_lib │ │ ├── bg │ │ │ ├── Bk_1.png │ │ │ ├── Bk_2.png │ │ │ ├── bg_1.png │ │ │ ├── bg_2.png │ │ │ ├── bg_3.png │ │ │ ├── bg_4.png │ │ │ ├── bg_5.png │ │ │ ├── bg_6.png │ │ │ └── Zhujm_35.png │ │ ├── button │ │ │ ├── add.png │ │ │ ├── Liaot_4.png │ │ │ ├── Liaot_6.png │ │ │ ├── add_down.png │ │ │ ├── back_down.png │ │ │ ├── button_u.png │ │ │ ├── des_down.png │ │ │ ├── add_normal.png │ │ │ ├── back_normal.png │ │ │ ├── des_normal.png │ │ │ ├── tab_normal.png │ │ │ ├── button_normal.png │ │ │ ├── button_press.png │ │ │ ├── charage_down.png │ │ │ ├── charage_normal.png │ │ │ ├── close_normal.png │ │ │ └── tab_selected.png │ │ ├── figure │ │ │ ├── Zs_1.png │ │ │ ├── Zs_2.png │ │ │ ├── Zs_3.png │ │ │ └── icon1.jpg │ │ ├── frame │ │ │ ├── f1_1.png │ │ │ ├── f1_2.png │ │ │ ├── f1_3.png │ │ │ ├── f1_4.png │ │ │ ├── f1_5.png │ │ │ ├── f_1.png │ │ │ ├── f_2.png │ │ │ ├── f_3.png │ │ │ ├── f_4.png │ │ │ ├── f_5.png │ │ │ ├── ICON_11.png │ │ │ ├── ICON_12.png │ │ │ ├── ICON_13.png │ │ │ ├── ICON_14.png │ │ │ ├── ICON_15.png │ │ │ ├── ICON_21.png │ │ │ ├── ICON_22.png │ │ │ ├── card_1.png │ │ │ ├── card_2.png │ │ │ ├── card_3.png │ │ │ ├── card_4.png │ │ │ ├── card_5.png │ │ │ ├── head_bg.png │ │ │ └── highlight.png │ │ ├── icon │ │ │ ├── clock.png │ │ │ ├── gold.png │ │ │ ├── search.png │ │ │ ├── silver.png │ │ │ ├── star_normal.png │ │ │ └── star_disable.png │ │ └── line │ │ │ └── line1.jpg │ └── csd │ │ ├── MainLayer.csd.udf │ │ ├── theme_1 │ │ ├── ToastSkin.udf │ │ ├── IconSkin.csd.udf │ │ ├── LoadingSkin.csd.udf │ │ ├── PopupSkin.csd.udf │ │ ├── LoadingSkin.csd │ │ ├── IconSkin.csd │ │ └── ToastSkin.csd │ │ ├── theme_default │ │ ├── PopupSkin.csd.udf │ │ └── PopupSkin.csd │ │ └── LoginSceneSkin.csd.udf ├── cocos_lua_lib.cfg └── cocos_lua_lib.udf ├── src ├── app.lua ├── cocos │ ├── ui │ │ └── experimentalUIConstants.lua │ ├── spine │ │ └── SpineConstants.lua │ ├── 3d │ │ └── 3dConstants.lua │ ├── cocostudio │ │ └── StudioConstants.lua │ ├── cocos2d │ │ ├── deprecated.lua │ │ ├── luaoc.lua │ │ ├── luaj.lua │ │ └── bitExtend.lua │ ├── network │ │ ├── DeprecatedNetworkEnum.lua │ │ ├── NetworkConstants.lua │ │ ├── DeprecatedNetworkClass.lua │ │ └── DeprecatedNetworkFunc.lua │ ├── cocosdenshion │ │ ├── DeprecatedCocosDenshionClass.lua │ │ ├── DeprecatedCocosDenshionFunc.lua │ │ └── AudioEngine.lua │ ├── controller │ │ └── ControllerConstants.lua │ ├── cocosbuilder │ │ └── DeprecatedCocosBuilderClass.lua │ ├── framework │ │ ├── extends │ │ │ ├── MenuEx.lua │ │ │ ├── UIPageView.lua │ │ │ ├── UISlider.lua │ │ │ ├── UICheckBox.lua │ │ │ ├── UIEditBox.lua │ │ │ ├── UIWidget.lua │ │ │ ├── UITextField.lua │ │ │ ├── UIScrollView.lua │ │ │ ├── SpriteEx.lua │ │ │ ├── UIListView.lua │ │ │ └── LayerEx.lua │ │ └── init.lua │ └── extension │ │ ├── DeprecatedExtensionFunc.lua │ │ ├── DeprecatedExtensionEnum.lua │ │ └── ExtensionConstants.lua ├── core │ ├── BaseModel.lua │ ├── BaseViewModel.lua │ ├── BaseController.lua │ ├── Signal.lua │ ├── Observer.lua │ ├── ViewCenter.lua │ ├── ViewStack.lua │ └── BaseApp.lua ├── scenes │ ├── DramaScene.lua │ ├── LoginScene.lua │ ├── BattleScene.lua │ └── BaseScene.lua ├── widgets │ ├── Avatar.lua │ ├── BorderWidget.lua │ ├── NumChangeToast.lua │ ├── CombatlToast.lua │ ├── Loading.lua │ ├── BaseIcon.lua │ ├── Tips.lua │ ├── FormLayout.lua │ ├── PropsIcon.lua │ ├── ViewStack.lua │ ├── Toast.lua │ ├── SigninIcon.lua │ └── InfoWidget.lua ├── entitys │ └── TestVO.lua ├── utils │ ├── effects.lua │ ├── event.lua │ ├── utils.lua │ ├── date.lua │ ├── timer.lua │ ├── functions.lua │ ├── log.lua │ ├── String.lua │ ├── websocket.lua │ └── http.lua ├── main.lua └── managers │ └── ArmatureManager.lua ├── .cocos-project.json ├── .gitignore ├── .project └── config.json /res/Default/ImageFile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kokokele/cocos_lua_lib/HEAD/res/Default/ImageFile.png -------------------------------------------------------------------------------- /res/Default/Button_Disable.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kokokele/cocos_lua_lib/HEAD/res/Default/Button_Disable.png -------------------------------------------------------------------------------- /res/Default/Button_Normal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kokokele/cocos_lua_lib/HEAD/res/Default/Button_Normal.png -------------------------------------------------------------------------------- /res/Default/Button_Press.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kokokele/cocos_lua_lib/HEAD/res/Default/Button_Press.png -------------------------------------------------------------------------------- /res/Default/CheckBox_Press.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kokokele/cocos_lua_lib/HEAD/res/Default/CheckBox_Press.png -------------------------------------------------------------------------------- /.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /res/Default/CheckBox_Disable.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kokokele/cocos_lua_lib/HEAD/res/Default/CheckBox_Disable.png -------------------------------------------------------------------------------- /res/Default/CheckBox_Normal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kokokele/cocos_lua_lib/HEAD/res/Default/CheckBox_Normal.png -------------------------------------------------------------------------------- /res/Default/CheckBoxNode_Normal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kokokele/cocos_lua_lib/HEAD/res/Default/CheckBoxNode_Normal.png -------------------------------------------------------------------------------- /res/Default/CheckBoxNode_Disable.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kokokele/cocos_lua_lib/HEAD/res/Default/CheckBoxNode_Disable.png -------------------------------------------------------------------------------- /frameworks/runtime-src/proj.ios_mac/ios/build-cfg.json: -------------------------------------------------------------------------------- 1 | { 2 | "remove_res" : [ 3 | "src", 4 | "res" 5 | ] 6 | } 7 | -------------------------------------------------------------------------------- /.settings/version.json: -------------------------------------------------------------------------------- 1 | { 2 | "engineVersion": "cocos2d-x 3.6", 3 | "runtimeVersion": "2.0", 4 | "templateVersion": "2.0" 5 | } -------------------------------------------------------------------------------- /frameworks/runtime-src/proj.win32/game.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kokokele/cocos_lua_lib/HEAD/frameworks/runtime-src/proj.win32/game.rc -------------------------------------------------------------------------------- /cocosstudio/cocosstudio/assets_lib/bg/Bk_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kokokele/cocos_lua_lib/HEAD/cocosstudio/cocosstudio/assets_lib/bg/Bk_1.png -------------------------------------------------------------------------------- /cocosstudio/cocosstudio/assets_lib/bg/Bk_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kokokele/cocos_lua_lib/HEAD/cocosstudio/cocosstudio/assets_lib/bg/Bk_2.png -------------------------------------------------------------------------------- /cocosstudio/cocosstudio/assets_lib/bg/bg_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kokokele/cocos_lua_lib/HEAD/cocosstudio/cocosstudio/assets_lib/bg/bg_1.png -------------------------------------------------------------------------------- /cocosstudio/cocosstudio/assets_lib/bg/bg_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kokokele/cocos_lua_lib/HEAD/cocosstudio/cocosstudio/assets_lib/bg/bg_2.png -------------------------------------------------------------------------------- /cocosstudio/cocosstudio/assets_lib/bg/bg_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kokokele/cocos_lua_lib/HEAD/cocosstudio/cocosstudio/assets_lib/bg/bg_3.png -------------------------------------------------------------------------------- /cocosstudio/cocosstudio/assets_lib/bg/bg_4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kokokele/cocos_lua_lib/HEAD/cocosstudio/cocosstudio/assets_lib/bg/bg_4.png -------------------------------------------------------------------------------- /cocosstudio/cocosstudio/assets_lib/bg/bg_5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kokokele/cocos_lua_lib/HEAD/cocosstudio/cocosstudio/assets_lib/bg/bg_5.png -------------------------------------------------------------------------------- /cocosstudio/cocosstudio/assets_lib/bg/bg_6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kokokele/cocos_lua_lib/HEAD/cocosstudio/cocosstudio/assets_lib/bg/bg_6.png -------------------------------------------------------------------------------- /frameworks/runtime-src/proj.win32/res/game.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kokokele/cocos_lua_lib/HEAD/frameworks/runtime-src/proj.win32/res/game.ico -------------------------------------------------------------------------------- /cocosstudio/cocosstudio/assets_lib/bg/Zhujm_35.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kokokele/cocos_lua_lib/HEAD/cocosstudio/cocosstudio/assets_lib/bg/Zhujm_35.png -------------------------------------------------------------------------------- /cocosstudio/cocosstudio/assets_lib/button/add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kokokele/cocos_lua_lib/HEAD/cocosstudio/cocosstudio/assets_lib/button/add.png -------------------------------------------------------------------------------- /cocosstudio/cocosstudio/assets_lib/figure/Zs_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kokokele/cocos_lua_lib/HEAD/cocosstudio/cocosstudio/assets_lib/figure/Zs_1.png -------------------------------------------------------------------------------- /cocosstudio/cocosstudio/assets_lib/figure/Zs_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kokokele/cocos_lua_lib/HEAD/cocosstudio/cocosstudio/assets_lib/figure/Zs_2.png -------------------------------------------------------------------------------- /cocosstudio/cocosstudio/assets_lib/figure/Zs_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kokokele/cocos_lua_lib/HEAD/cocosstudio/cocosstudio/assets_lib/figure/Zs_3.png -------------------------------------------------------------------------------- /cocosstudio/cocosstudio/assets_lib/frame/f1_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kokokele/cocos_lua_lib/HEAD/cocosstudio/cocosstudio/assets_lib/frame/f1_1.png -------------------------------------------------------------------------------- /cocosstudio/cocosstudio/assets_lib/frame/f1_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kokokele/cocos_lua_lib/HEAD/cocosstudio/cocosstudio/assets_lib/frame/f1_2.png -------------------------------------------------------------------------------- /cocosstudio/cocosstudio/assets_lib/frame/f1_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kokokele/cocos_lua_lib/HEAD/cocosstudio/cocosstudio/assets_lib/frame/f1_3.png -------------------------------------------------------------------------------- /cocosstudio/cocosstudio/assets_lib/frame/f1_4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kokokele/cocos_lua_lib/HEAD/cocosstudio/cocosstudio/assets_lib/frame/f1_4.png -------------------------------------------------------------------------------- /cocosstudio/cocosstudio/assets_lib/frame/f1_5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kokokele/cocos_lua_lib/HEAD/cocosstudio/cocosstudio/assets_lib/frame/f1_5.png -------------------------------------------------------------------------------- /cocosstudio/cocosstudio/assets_lib/frame/f_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kokokele/cocos_lua_lib/HEAD/cocosstudio/cocosstudio/assets_lib/frame/f_1.png -------------------------------------------------------------------------------- /cocosstudio/cocosstudio/assets_lib/frame/f_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kokokele/cocos_lua_lib/HEAD/cocosstudio/cocosstudio/assets_lib/frame/f_2.png -------------------------------------------------------------------------------- /cocosstudio/cocosstudio/assets_lib/frame/f_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kokokele/cocos_lua_lib/HEAD/cocosstudio/cocosstudio/assets_lib/frame/f_3.png -------------------------------------------------------------------------------- /cocosstudio/cocosstudio/assets_lib/frame/f_4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kokokele/cocos_lua_lib/HEAD/cocosstudio/cocosstudio/assets_lib/frame/f_4.png -------------------------------------------------------------------------------- /cocosstudio/cocosstudio/assets_lib/frame/f_5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kokokele/cocos_lua_lib/HEAD/cocosstudio/cocosstudio/assets_lib/frame/f_5.png -------------------------------------------------------------------------------- /cocosstudio/cocosstudio/assets_lib/icon/clock.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kokokele/cocos_lua_lib/HEAD/cocosstudio/cocosstudio/assets_lib/icon/clock.png -------------------------------------------------------------------------------- /cocosstudio/cocosstudio/assets_lib/icon/gold.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kokokele/cocos_lua_lib/HEAD/cocosstudio/cocosstudio/assets_lib/icon/gold.png -------------------------------------------------------------------------------- /cocosstudio/cocosstudio/assets_lib/icon/search.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kokokele/cocos_lua_lib/HEAD/cocosstudio/cocosstudio/assets_lib/icon/search.png -------------------------------------------------------------------------------- /cocosstudio/cocosstudio/assets_lib/icon/silver.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kokokele/cocos_lua_lib/HEAD/cocosstudio/cocosstudio/assets_lib/icon/silver.png -------------------------------------------------------------------------------- /cocosstudio/cocosstudio/assets_lib/line/line1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kokokele/cocos_lua_lib/HEAD/cocosstudio/cocosstudio/assets_lib/line/line1.jpg -------------------------------------------------------------------------------- /frameworks/runtime-src/proj.ios_mac/mac/Icon.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kokokele/cocos_lua_lib/HEAD/frameworks/runtime-src/proj.ios_mac/mac/Icon.icns -------------------------------------------------------------------------------- /cocosstudio/cocosstudio/assets_lib/figure/icon1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kokokele/cocos_lua_lib/HEAD/cocosstudio/cocosstudio/assets_lib/figure/icon1.jpg -------------------------------------------------------------------------------- /cocosstudio/cocosstudio/assets_lib/frame/ICON_11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kokokele/cocos_lua_lib/HEAD/cocosstudio/cocosstudio/assets_lib/frame/ICON_11.png -------------------------------------------------------------------------------- /cocosstudio/cocosstudio/assets_lib/frame/ICON_12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kokokele/cocos_lua_lib/HEAD/cocosstudio/cocosstudio/assets_lib/frame/ICON_12.png -------------------------------------------------------------------------------- /cocosstudio/cocosstudio/assets_lib/frame/ICON_13.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kokokele/cocos_lua_lib/HEAD/cocosstudio/cocosstudio/assets_lib/frame/ICON_13.png -------------------------------------------------------------------------------- /cocosstudio/cocosstudio/assets_lib/frame/ICON_14.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kokokele/cocos_lua_lib/HEAD/cocosstudio/cocosstudio/assets_lib/frame/ICON_14.png -------------------------------------------------------------------------------- /cocosstudio/cocosstudio/assets_lib/frame/ICON_15.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kokokele/cocos_lua_lib/HEAD/cocosstudio/cocosstudio/assets_lib/frame/ICON_15.png -------------------------------------------------------------------------------- /cocosstudio/cocosstudio/assets_lib/frame/ICON_21.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kokokele/cocos_lua_lib/HEAD/cocosstudio/cocosstudio/assets_lib/frame/ICON_21.png -------------------------------------------------------------------------------- /cocosstudio/cocosstudio/assets_lib/frame/ICON_22.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kokokele/cocos_lua_lib/HEAD/cocosstudio/cocosstudio/assets_lib/frame/ICON_22.png -------------------------------------------------------------------------------- /cocosstudio/cocosstudio/assets_lib/frame/card_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kokokele/cocos_lua_lib/HEAD/cocosstudio/cocosstudio/assets_lib/frame/card_1.png -------------------------------------------------------------------------------- /cocosstudio/cocosstudio/assets_lib/frame/card_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kokokele/cocos_lua_lib/HEAD/cocosstudio/cocosstudio/assets_lib/frame/card_2.png -------------------------------------------------------------------------------- /cocosstudio/cocosstudio/assets_lib/frame/card_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kokokele/cocos_lua_lib/HEAD/cocosstudio/cocosstudio/assets_lib/frame/card_3.png -------------------------------------------------------------------------------- /cocosstudio/cocosstudio/assets_lib/frame/card_4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kokokele/cocos_lua_lib/HEAD/cocosstudio/cocosstudio/assets_lib/frame/card_4.png -------------------------------------------------------------------------------- /cocosstudio/cocosstudio/assets_lib/frame/card_5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kokokele/cocos_lua_lib/HEAD/cocosstudio/cocosstudio/assets_lib/frame/card_5.png -------------------------------------------------------------------------------- /cocosstudio/cocosstudio/assets_lib/frame/head_bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kokokele/cocos_lua_lib/HEAD/cocosstudio/cocosstudio/assets_lib/frame/head_bg.png -------------------------------------------------------------------------------- /frameworks/runtime-src/proj.ios_mac/ios/Default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kokokele/cocos_lua_lib/HEAD/frameworks/runtime-src/proj.ios_mac/ios/Default.png -------------------------------------------------------------------------------- /frameworks/runtime-src/proj.ios_mac/ios/Icon-100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kokokele/cocos_lua_lib/HEAD/frameworks/runtime-src/proj.ios_mac/ios/Icon-100.png -------------------------------------------------------------------------------- /frameworks/runtime-src/proj.ios_mac/ios/Icon-114.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kokokele/cocos_lua_lib/HEAD/frameworks/runtime-src/proj.ios_mac/ios/Icon-114.png -------------------------------------------------------------------------------- /frameworks/runtime-src/proj.ios_mac/ios/Icon-120.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kokokele/cocos_lua_lib/HEAD/frameworks/runtime-src/proj.ios_mac/ios/Icon-120.png -------------------------------------------------------------------------------- /frameworks/runtime-src/proj.ios_mac/ios/Icon-144.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kokokele/cocos_lua_lib/HEAD/frameworks/runtime-src/proj.ios_mac/ios/Icon-144.png -------------------------------------------------------------------------------- /frameworks/runtime-src/proj.ios_mac/ios/Icon-152.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kokokele/cocos_lua_lib/HEAD/frameworks/runtime-src/proj.ios_mac/ios/Icon-152.png -------------------------------------------------------------------------------- /frameworks/runtime-src/proj.ios_mac/ios/Icon-29.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kokokele/cocos_lua_lib/HEAD/frameworks/runtime-src/proj.ios_mac/ios/Icon-29.png -------------------------------------------------------------------------------- /frameworks/runtime-src/proj.ios_mac/ios/Icon-40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kokokele/cocos_lua_lib/HEAD/frameworks/runtime-src/proj.ios_mac/ios/Icon-40.png -------------------------------------------------------------------------------- /frameworks/runtime-src/proj.ios_mac/ios/Icon-50.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kokokele/cocos_lua_lib/HEAD/frameworks/runtime-src/proj.ios_mac/ios/Icon-50.png -------------------------------------------------------------------------------- /frameworks/runtime-src/proj.ios_mac/ios/Icon-57.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kokokele/cocos_lua_lib/HEAD/frameworks/runtime-src/proj.ios_mac/ios/Icon-57.png -------------------------------------------------------------------------------- /frameworks/runtime-src/proj.ios_mac/ios/Icon-58.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kokokele/cocos_lua_lib/HEAD/frameworks/runtime-src/proj.ios_mac/ios/Icon-58.png -------------------------------------------------------------------------------- /frameworks/runtime-src/proj.ios_mac/ios/Icon-72.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kokokele/cocos_lua_lib/HEAD/frameworks/runtime-src/proj.ios_mac/ios/Icon-72.png -------------------------------------------------------------------------------- /frameworks/runtime-src/proj.ios_mac/ios/Icon-76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kokokele/cocos_lua_lib/HEAD/frameworks/runtime-src/proj.ios_mac/ios/Icon-76.png -------------------------------------------------------------------------------- /frameworks/runtime-src/proj.ios_mac/ios/Icon-80.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kokokele/cocos_lua_lib/HEAD/frameworks/runtime-src/proj.ios_mac/ios/Icon-80.png -------------------------------------------------------------------------------- /frameworks/runtime-src/proj.ios_mac/libTalkingData.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kokokele/cocos_lua_lib/HEAD/frameworks/runtime-src/proj.ios_mac/libTalkingData.a -------------------------------------------------------------------------------- /src/app.lua: -------------------------------------------------------------------------------- 1 | 2 | local MyApp = class("MyApp") 3 | 4 | function MyApp:run() 5 | app.replaceScene(app.scenes.LoginScene.new()) 6 | end 7 | 8 | return MyApp 9 | -------------------------------------------------------------------------------- /.cocos-project.json: -------------------------------------------------------------------------------- 1 | { 2 | "engine_type": "prebuilt", 3 | "engine_version": "cocos2d-x-3.6", 4 | "has_native": true, 5 | "project_type": "lua" 6 | } -------------------------------------------------------------------------------- /cocosstudio/cocosstudio/assets_lib/button/Liaot_4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kokokele/cocos_lua_lib/HEAD/cocosstudio/cocosstudio/assets_lib/button/Liaot_4.png -------------------------------------------------------------------------------- /cocosstudio/cocosstudio/assets_lib/button/Liaot_6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kokokele/cocos_lua_lib/HEAD/cocosstudio/cocosstudio/assets_lib/button/Liaot_6.png -------------------------------------------------------------------------------- /cocosstudio/cocosstudio/assets_lib/button/add_down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kokokele/cocos_lua_lib/HEAD/cocosstudio/cocosstudio/assets_lib/button/add_down.png -------------------------------------------------------------------------------- /cocosstudio/cocosstudio/assets_lib/button/back_down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kokokele/cocos_lua_lib/HEAD/cocosstudio/cocosstudio/assets_lib/button/back_down.png -------------------------------------------------------------------------------- /cocosstudio/cocosstudio/assets_lib/button/button_u.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kokokele/cocos_lua_lib/HEAD/cocosstudio/cocosstudio/assets_lib/button/button_u.png -------------------------------------------------------------------------------- /cocosstudio/cocosstudio/assets_lib/button/des_down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kokokele/cocos_lua_lib/HEAD/cocosstudio/cocosstudio/assets_lib/button/des_down.png -------------------------------------------------------------------------------- /cocosstudio/cocosstudio/assets_lib/frame/highlight.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kokokele/cocos_lua_lib/HEAD/cocosstudio/cocosstudio/assets_lib/frame/highlight.png -------------------------------------------------------------------------------- /cocosstudio/cocosstudio/assets_lib/icon/star_normal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kokokele/cocos_lua_lib/HEAD/cocosstudio/cocosstudio/assets_lib/icon/star_normal.png -------------------------------------------------------------------------------- /frameworks/runtime-src/proj.ios_mac/ios/Default@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kokokele/cocos_lua_lib/HEAD/frameworks/runtime-src/proj.ios_mac/ios/Default@2x.png -------------------------------------------------------------------------------- /frameworks/runtime-src/proj.ios_mac/mac/build-cfg.json: -------------------------------------------------------------------------------- 1 | { 2 | "remove_res" : [ 3 | "src", 4 | "res", 5 | "config.json" 6 | ] 7 | } 8 | -------------------------------------------------------------------------------- /cocosstudio/cocosstudio/assets_lib/button/add_normal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kokokele/cocos_lua_lib/HEAD/cocosstudio/cocosstudio/assets_lib/button/add_normal.png -------------------------------------------------------------------------------- /cocosstudio/cocosstudio/assets_lib/button/back_normal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kokokele/cocos_lua_lib/HEAD/cocosstudio/cocosstudio/assets_lib/button/back_normal.png -------------------------------------------------------------------------------- /cocosstudio/cocosstudio/assets_lib/button/des_normal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kokokele/cocos_lua_lib/HEAD/cocosstudio/cocosstudio/assets_lib/button/des_normal.png -------------------------------------------------------------------------------- /cocosstudio/cocosstudio/assets_lib/button/tab_normal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kokokele/cocos_lua_lib/HEAD/cocosstudio/cocosstudio/assets_lib/button/tab_normal.png -------------------------------------------------------------------------------- /cocosstudio/cocosstudio/assets_lib/icon/star_disable.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kokokele/cocos_lua_lib/HEAD/cocosstudio/cocosstudio/assets_lib/icon/star_disable.png -------------------------------------------------------------------------------- /cocosstudio/cocosstudio/assets_lib/button/button_normal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kokokele/cocos_lua_lib/HEAD/cocosstudio/cocosstudio/assets_lib/button/button_normal.png -------------------------------------------------------------------------------- /cocosstudio/cocosstudio/assets_lib/button/button_press.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kokokele/cocos_lua_lib/HEAD/cocosstudio/cocosstudio/assets_lib/button/button_press.png -------------------------------------------------------------------------------- /cocosstudio/cocosstudio/assets_lib/button/charage_down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kokokele/cocos_lua_lib/HEAD/cocosstudio/cocosstudio/assets_lib/button/charage_down.png -------------------------------------------------------------------------------- /cocosstudio/cocosstudio/assets_lib/button/charage_normal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kokokele/cocos_lua_lib/HEAD/cocosstudio/cocosstudio/assets_lib/button/charage_normal.png -------------------------------------------------------------------------------- /cocosstudio/cocosstudio/assets_lib/button/close_normal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kokokele/cocos_lua_lib/HEAD/cocosstudio/cocosstudio/assets_lib/button/close_normal.png -------------------------------------------------------------------------------- /cocosstudio/cocosstudio/assets_lib/button/tab_selected.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kokokele/cocos_lua_lib/HEAD/cocosstudio/cocosstudio/assets_lib/button/tab_selected.png -------------------------------------------------------------------------------- /frameworks/runtime-src/proj.ios_mac/ios/Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kokokele/cocos_lua_lib/HEAD/frameworks/runtime-src/proj.ios_mac/ios/Default-568h@2x.png -------------------------------------------------------------------------------- /frameworks/runtime-src/proj.ios_mac/ios/Default-667h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kokokele/cocos_lua_lib/HEAD/frameworks/runtime-src/proj.ios_mac/ios/Default-667h@2x.png -------------------------------------------------------------------------------- /frameworks/runtime-src/proj.ios_mac/ios/Default-736h@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kokokele/cocos_lua_lib/HEAD/frameworks/runtime-src/proj.ios_mac/ios/Default-736h@3x.png -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /frameworks/runtime-src/proj.android/res/drawable-hdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kokokele/cocos_lua_lib/HEAD/frameworks/runtime-src/proj.android/res/drawable-hdpi/icon.png -------------------------------------------------------------------------------- /frameworks/runtime-src/proj.android/res/drawable-ldpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kokokele/cocos_lua_lib/HEAD/frameworks/runtime-src/proj.android/res/drawable-ldpi/icon.png -------------------------------------------------------------------------------- /frameworks/runtime-src/proj.android/res/drawable-mdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kokokele/cocos_lua_lib/HEAD/frameworks/runtime-src/proj.android/res/drawable-mdpi/icon.png -------------------------------------------------------------------------------- /frameworks/runtime-src/proj.android/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | cocos_lua_lib 4 | 5 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /cocosstudio/cocosstudio/csd/MainLayer.csd.udf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /frameworks/runtime-src/proj.ios_mac/mac/main.m: -------------------------------------------------------------------------------- 1 | 2 | #import 3 | 4 | int main(int argc, char *argv[]) 5 | { 6 | return NSApplicationMain(argc, (const char **)argv); 7 | } 8 | -------------------------------------------------------------------------------- /cocosstudio/cocosstudio/csd/theme_1/ToastSkin.udf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /cocosstudio/cocosstudio/csd/theme_1/IconSkin.csd.udf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /cocosstudio/cocosstudio/csd/theme_1/LoadingSkin.csd.udf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /cocosstudio/cocosstudio/csd/theme_default/PopupSkin.csd.udf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /cocosstudio/cocosstudio/csd/theme_1/PopupSkin.csd.udf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/cocos/ui/experimentalUIConstants.lua: -------------------------------------------------------------------------------- 1 | if nil == ccexp then 2 | return 3 | end 4 | 5 | ccexp.VideoPlayerEvent = { 6 | PLAYING = 0, 7 | PAUSED = 1, 8 | STOPPED= 2, 9 | COMPLETED =3, 10 | } 11 | -------------------------------------------------------------------------------- /frameworks/runtime-src/proj.ios_mac/mac/Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'Paralaxer' target in the 'Paralaxer' project 3 | // 4 | 5 | #ifdef __OBJC__ 6 | #import 7 | #endif 8 | -------------------------------------------------------------------------------- /frameworks/runtime-src/proj.ios_mac/cocos_lua_lib.xcodeproj/xcuserdata/antz.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /src/cocos/spine/SpineConstants.lua: -------------------------------------------------------------------------------- 1 | if nil == sp then 2 | return 3 | end 4 | 5 | sp.EventType = 6 | { 7 | ANIMATION_START = 0, 8 | ANIMATION_END = 1, 9 | ANIMATION_COMPLETE = 2, 10 | ANIMATION_EVENT = 3, 11 | } 12 | -------------------------------------------------------------------------------- /src/core/BaseModel.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | 说明: 模型基类 3 | ]] 4 | 5 | local BaseModel = class("BaseModel", app.D) 6 | 7 | function BaseModel:dispatchEvent(name, usedata) 8 | qy.Event.dispatch(name, usedata) 9 | end 10 | 11 | 12 | return BaseModel 13 | -------------------------------------------------------------------------------- /frameworks/runtime-src/proj.android/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 3 | org.eclipse.jdt.core.compiler.compliance=1.6 4 | org.eclipse.jdt.core.compiler.source=1.6 5 | -------------------------------------------------------------------------------- /frameworks/runtime-src/proj.ios_mac/ios/Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'simulator' target in the 'simulator' project 3 | // 4 | 5 | #ifdef __OBJC__ 6 | #import 7 | #import 8 | #endif 9 | -------------------------------------------------------------------------------- /frameworks/runtime-src/Classes/ide-support/CodeIDESupport.h: -------------------------------------------------------------------------------- 1 | #ifndef __CODE_IDE_SUPPORT_H__ 2 | #define __CODE_IDE_SUPPORT_H__ 3 | 4 | // define 1 to open Cocos Code IDE support, 0 to disable 5 | #define CC_CODE_IDE_DEBUG_SUPPORT 1 6 | 7 | #endif /* __CODE_IDE_SUPPORT_H__ */ 8 | -------------------------------------------------------------------------------- /src/scenes/DramaScene.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | 新手剧情 3 | ]] 4 | 5 | local DramaScene = class("DramaScene", qy.Scene.Base) 6 | 7 | function DramaScene:ctor() 8 | DramaScene.super.ctor(self) 9 | 10 | self:push(qy.Controller.Drama.new()) 11 | end 12 | 13 | return DramaScene -------------------------------------------------------------------------------- /frameworks/runtime-src/proj.ios_mac/cocos_lua_lib.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /src/cocos/3d/3dConstants.lua: -------------------------------------------------------------------------------- 1 | if nil == cc.Terrain then 2 | return 3 | end 4 | 5 | cc.Terrain.CrackFixedType = 6 | { 7 | SKIRT = 0, 8 | INCREASE_LOWER = 1, 9 | } 10 | 11 | cc.Animate3DQuality = 12 | { 13 | QUALITY_NONE = 0, 14 | QUALITY_LOW = 1, 15 | QUALITY_HIGH = 2, 16 | } 17 | -------------------------------------------------------------------------------- /frameworks/runtime-src/proj.win32/main.h: -------------------------------------------------------------------------------- 1 | #ifndef __MAIN_H__ 2 | #define __MAIN_H__ 3 | 4 | #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers 5 | 6 | // Windows Header Files: 7 | #include 8 | #include 9 | 10 | #endif // __WINMAIN_H__ 11 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | codes 2 | res/csd 3 | res/assets 4 | res/Default 5 | res/assets_lib 6 | frameworks/runtime-src/proj.ios_mac/ 7 | frameworks/cocos2d-x/build/build/ 8 | frameworks/cocos2d-x/cocos/scripting/lua-bindings/proj.ios_mac/build/ 9 | frameworks/runtime-src/proj.ios_mac/build/ 10 | project_baby 11 | project_gold 12 | -------------------------------------------------------------------------------- /src/cocos/cocostudio/StudioConstants.lua: -------------------------------------------------------------------------------- 1 | if nil == ccs then 2 | return 3 | end 4 | 5 | ccs.MovementEventType = { 6 | start = 0, 7 | complete = 1, 8 | loopComplete = 2, 9 | } 10 | 11 | ccs.InnerActionType = { 12 | LoopAction = 0, 13 | NoLoopAction = 1, 14 | SingleFrame = 2, 15 | } 16 | -------------------------------------------------------------------------------- /cocosstudio/cocosstudio/csd/LoginSceneSkin.csd.udf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /frameworks/runtime-src/proj.ios_mac/cocos_lua_lib.xcodeproj/project.xcworkspace/xcuserdata/antz.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kokokele/cocos_lua_lib/HEAD/frameworks/runtime-src/proj.ios_mac/cocos_lua_lib.xcodeproj/project.xcworkspace/xcuserdata/antz.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /frameworks/runtime-src/proj.win32/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // stdafx.cpp : source file that includes just the standard includes 2 | // player.pch will be the pre-compiled header 3 | // stdafx.obj will contain the pre-compiled type information 4 | 5 | #include "stdafx.h" 6 | 7 | // TODO: reference any additional headers you need in STDAFX.H 8 | // and not in this file 9 | -------------------------------------------------------------------------------- /.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | cocos_lua_lib 4 | 5 | 6 | 7 | 8 | 9 | 10 | org.ccdt.cocosproject 11 | org.eclipse.koneki.ldt.nature 12 | 13 | 14 | -------------------------------------------------------------------------------- /frameworks/runtime-src/proj.win32/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Including SDKDDKVer.h defines the highest available Windows platform. 4 | 5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 7 | 8 | #include 9 | -------------------------------------------------------------------------------- /src/widgets/Avatar.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | 说明:玩家头像 3 | 作者:林国锋 4 | ]] 5 | 6 | local Avatar = class("Avatar", qy.View.Base) 7 | 8 | function Avatar:ctor(onClicked) 9 | Avatar.super.ctor(self) 10 | 11 | self:InjectView("Image_1") 12 | self.Image_1:setSwallowTouches(false) 13 | self:OnClick("Image_1", onClicked) 14 | end 15 | 16 | return Avatar -------------------------------------------------------------------------------- /frameworks/runtime-src/proj.android/jni/Application.mk: -------------------------------------------------------------------------------- 1 | APP_STL := gnustl_static 2 | 3 | APP_CPPFLAGS := -frtti -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 -std=c++11 -fsigned-char 4 | APP_LDFLAGS := -latomic 5 | 6 | 7 | ifeq ($(NDK_DEBUG),1) 8 | APP_CPPFLAGS += -DCOCOS2D_DEBUG=1 9 | APP_OPTIM := debug 10 | else 11 | APP_CPPFLAGS += -DNDEBUG 12 | APP_OPTIM := release 13 | endif 14 | -------------------------------------------------------------------------------- /src/scenes/LoginScene.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | 说明:登录场景 3 | ]] 4 | 5 | local LoginScene = class("LoginScene", app.scenes.BaseScene) 6 | 7 | function LoginScene:ctor() 8 | LoginScene.super.ctor(self) 9 | end 10 | 11 | 12 | function LoginScene:onEnter() 13 | app.ViewCenter:appear("__Main") 14 | 15 | --local view = app.main.MainV.new() 16 | -- self:add(view) 17 | 18 | end 19 | 20 | return LoginScene 21 | -------------------------------------------------------------------------------- /frameworks/runtime-src/proj.ios_mac/ios/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // simulator 4 | // 5 | // Copyright __MyCompanyName__ 2011. All rights reserved. 6 | // 7 | 8 | #import 9 | 10 | int main(int argc, char *argv[]) { 11 | 12 | NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; 13 | int retVal = UIApplicationMain(argc, argv, nil, @"AppController"); 14 | [pool release]; 15 | return retVal; 16 | } 17 | -------------------------------------------------------------------------------- /frameworks/runtime-src/proj.android/project.properties: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by Android Tools. 2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED! 3 | # 4 | # This file must be checked in Version Control Systems. 5 | # 6 | # To customize properties used by the Ant build system use, 7 | # "ant.properties", and override values to adapt the script to your 8 | # project structure. 9 | 10 | # Project target. 11 | target=android-10 12 | -------------------------------------------------------------------------------- /src/entitys/TestVO.lua: -------------------------------------------------------------------------------- 1 | 2 | local TestVO = class("TestVO", app.D) 3 | 4 | function TestVO:ctor() 5 | print("testVO:Ctor") 6 | 7 | TestVO.super.ctor(self) 8 | self:setproperty({"id", 1, didSet= function(v) 9 | end}) 10 | 11 | self.testSignal = require("core.Signal").new() 12 | 13 | 14 | end 15 | 16 | function TestVO:fireSignal() 17 | self.testSignal:fire(".....test.....") 18 | end 19 | 20 | 21 | local vo = TestVO.new() 22 | 23 | return vo 24 | -------------------------------------------------------------------------------- /src/utils/effects.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | 特效管理 3 | 黄晨 4 | ]] 5 | 6 | local Effects = class("Effects") 7 | 8 | Effects.TOUCH_EFFECT_TIME = 0.05 9 | 10 | -- node整体缩放 11 | function Effects:nodeTouchBegan(node, scale) 12 | node:runAction(cc.ScaleTo:create(self.TOUCH_EFFECT_TIME, scale or 1.05)) 13 | end 14 | 15 | function Effects:nodeTouchEnd(node, scale) 16 | node:runAction(cc.ScaleTo:create(self.TOUCH_EFFECT_TIME, scale or 1)) 17 | end 18 | 19 | return Effects -------------------------------------------------------------------------------- /frameworks/runtime-src/proj.ios_mac/mac/zh-Hans.lproj/ConsoleWindow.strings: -------------------------------------------------------------------------------- 1 | 2 | /* Class = "NSWindow"; title = "Console"; ObjectID = "1"; */ 3 | "1.title" = "控制台"; 4 | 5 | /* Class = "NSButtonCell"; title = "Clear"; ObjectID = "47"; */ 6 | "47.title" = "清除"; 7 | 8 | /* Class = "NSButtonCell"; title = "scroll bottom"; ObjectID = "51"; */ 9 | "51.title" = "自动滚动"; 10 | 11 | /* Class = "NSButtonCell"; title = "always top"; ObjectID = "61"; */ 12 | "61.title" = "总在最前方"; 13 | -------------------------------------------------------------------------------- /frameworks/runtime-src/Classes/ide-support/lua_debugger.h: -------------------------------------------------------------------------------- 1 | 2 | /* lua_debugger.h.h */ 3 | 4 | #ifndef __LUA_MODULES_049C000C96FE547176CCBB7690BA01B6_H_ 5 | #define __LUA_MODULES_049C000C96FE547176CCBB7690BA01B6_H_ 6 | 7 | #if __cplusplus 8 | extern "C" { 9 | #endif 10 | 11 | #include "lua.h" 12 | 13 | void luaopen_lua_debugger(lua_State* L); 14 | 15 | /* 16 | int luaopen_lua_m_debugger(lua_State* L); 17 | */ 18 | 19 | #if __cplusplus 20 | } 21 | #endif 22 | 23 | #endif /* __LUA_MODULES_049C000C96FE547176CCBB7690BA01B6_H_ */ 24 | -------------------------------------------------------------------------------- /frameworks/runtime-src/proj.android/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /frameworks/runtime-src/proj.win32/build-cfg.json: -------------------------------------------------------------------------------- 1 | { 2 | "copy_resources": [ 3 | { 4 | "from": "../../../src", 5 | "to": "src" 6 | }, 7 | { 8 | "from": "../../../res", 9 | "to": "res" 10 | }, 11 | { 12 | "from": "../../../config.json", 13 | "to": "" 14 | }, 15 | { 16 | "from": "../Classes/ide-support/lang", 17 | "to": "" 18 | } 19 | ], 20 | "must_copy_resources": [ 21 | ] 22 | } 23 | -------------------------------------------------------------------------------- /src/cocos/cocos2d/deprecated.lua: -------------------------------------------------------------------------------- 1 | 2 | function schedule(node, callback, delay) 3 | local delay = cc.DelayTime:create(delay) 4 | local sequence = cc.Sequence:create(delay, cc.CallFunc:create(callback)) 5 | local action = cc.RepeatForever:create(sequence) 6 | node:runAction(action) 7 | return action 8 | end 9 | 10 | function performWithDelay(node, callback, delay) 11 | local delay = cc.DelayTime:create(delay) 12 | local sequence = cc.Sequence:create(delay, cc.CallFunc:create(callback)) 13 | node:runAction(sequence) 14 | return sequence 15 | end 16 | -------------------------------------------------------------------------------- /frameworks/runtime-src/proj.ios_mac/mac/ConsoleWindowController.h: -------------------------------------------------------------------------------- 1 | 2 | #import 3 | 4 | @interface ConsoleWindowController : NSWindowController 5 | { 6 | NSTextView *textView; 7 | IBOutlet NSButton *checkScroll; 8 | IBOutlet NSButton *topCheckBox; 9 | NSMutableArray *linesCount; 10 | NSUInteger traceCount; 11 | } 12 | 13 | @property (assign) IBOutlet NSTextView *textView; 14 | 15 | - (void) trace:(NSString*)msg; 16 | - (IBAction)onClear:(id)sender; 17 | - (IBAction)onScrollChange:(id)sender; 18 | - (IBAction)onTopChange:(id)sender; 19 | 20 | @end 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /frameworks/runtime-src/Classes/ide-support/lang: -------------------------------------------------------------------------------- 1 | { 2 | "zh-CN": { 3 | "View": "视图(&V)", 4 | "Exit": "退出(&X)", 5 | "File": "文件(&F)", 6 | "Portrait": "竖屏", 7 | "Landscape": "横屏", 8 | "Refresh": "刷新(重启)", 9 | "Zoom Out": "缩放", 10 | "Simulator": "模拟器", 11 | "Open File": "打开文件", 12 | "Open Project": "打开工程", 13 | "Error": "错误" 14 | }, 15 | "zh-Hans": { 16 | "View": "视图", 17 | "Exit": "退出", 18 | "File": "文件", 19 | "Portrait": "竖屏", 20 | "Landscape": "横屏", 21 | "Refresh": "刷新(重启)", 22 | "Zoom Out": "缩放", 23 | "Simulator": "模拟器" 24 | } 25 | } -------------------------------------------------------------------------------- /src/cocos/network/DeprecatedNetworkEnum.lua: -------------------------------------------------------------------------------- 1 | if nil == cc.XMLHttpRequest then 2 | return 3 | end 4 | 5 | _G.kWebSocketScriptHandlerOpen = cc.WEBSOCKET_OPEN 6 | _G.kWebSocketScriptHandlerMessage = cc.WEBSOCKET_MESSAGE 7 | _G.kWebSocketScriptHandlerClose = cc.WEBSOCKET_CLOSE 8 | _G.kWebSocketScriptHandlerError = cc.WEBSOCKET_ERROR 9 | 10 | _G.kStateConnecting = cc.WEBSOCKET_STATE_CONNECTING 11 | _G.kStateOpen = cc.WEBSOCKET_STATE_OPEN 12 | _G.kStateClosing = cc.WEBSOCKET_STATE_CLOSING 13 | _G.kStateClosed = cc.WEBSOCKET_STATE_CLOSED 14 | -------------------------------------------------------------------------------- /src/cocos/network/NetworkConstants.lua: -------------------------------------------------------------------------------- 1 | if nil == cc.XMLHttpRequest then 2 | return 3 | end 4 | 5 | cc.WEBSOCKET_OPEN = 0 6 | cc.WEBSOCKET_MESSAGE = 1 7 | cc.WEBSOCKET_CLOSE = 2 8 | cc.WEBSOCKET_ERROR = 3 9 | 10 | cc.WEBSOCKET_STATE_CONNECTING = 0 11 | cc.WEBSOCKET_STATE_OPEN = 1 12 | cc.WEBSOCKET_STATE_CLOSING = 2 13 | cc.WEBSOCKET_STATE_CLOSED = 3 14 | 15 | cc.XMLHTTPREQUEST_RESPONSE_STRING = 0 16 | cc.XMLHTTPREQUEST_RESPONSE_ARRAY_BUFFER = 1 17 | cc.XMLHTTPREQUEST_RESPONSE_BLOB = 2 18 | cc.XMLHTTPREQUEST_RESPONSE_DOCUMENT = 3 19 | cc.XMLHTTPREQUEST_RESPONSE_JSON = 4 20 | -------------------------------------------------------------------------------- /frameworks/runtime-src/proj.win32/stdafx.h: -------------------------------------------------------------------------------- 1 | // stdafx.h : include file for standard system include files, 2 | // or project specific include files that are used frequently, but 3 | // are changed infrequently 4 | // 5 | 6 | #pragma once 7 | 8 | #include "targetver.h" 9 | 10 | #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers 11 | // Windows Header Files: 12 | #include 13 | 14 | // C RunTime Header Files 15 | #include 16 | #include 17 | #include 18 | #include 19 | 20 | 21 | // TODO: reference additional headers your program requires here 22 | -------------------------------------------------------------------------------- /src/cocos/network/DeprecatedNetworkClass.lua: -------------------------------------------------------------------------------- 1 | if nil == cc.XMLHttpRequest then 2 | return 3 | end 4 | -- This is the DeprecatedNetworkClass 5 | 6 | DeprecatedNetworkClass = {} or DeprecatedNetworkClass 7 | 8 | --tip 9 | local function deprecatedTip(old_name,new_name) 10 | print("\n********** \n"..old_name.." was deprecated please use ".. new_name .. " instead.\n**********") 11 | end 12 | 13 | --WebSocket class will be Deprecated,begin 14 | function DeprecatedNetworkClass.WebSocket() 15 | deprecatedTip("WebSocket","cc.WebSocket") 16 | return cc.WebSocket 17 | end 18 | _G["WebSocket"] = DeprecatedNetworkClass.WebSocket() 19 | --WebSocket class will be Deprecated,end 20 | -------------------------------------------------------------------------------- /frameworks/runtime-src/proj.android/build-cfg.json: -------------------------------------------------------------------------------- 1 | { 2 | "ndk_module_path" :[ 3 | "${COCOS_FRAMEWORKS}/cocos2d-x-3.6", 4 | "${COCOS_FRAMEWORKS}/cocos2d-x-3.6/cocos/", 5 | "${COCOS_FRAMEWORKS}/cocos2d-x-3.6/external", 6 | "${COCOS_FRAMEWORKS}/cocos2d-x-3.6/cocos/scripting" 7 | ], 8 | "copy_resources": [ 9 | { 10 | "from": "../../../src", 11 | "to": "src" 12 | }, 13 | { 14 | "from": "../../../res", 15 | "to": "res" 16 | } 17 | ], 18 | "must_copy_resources": [ 19 | { 20 | "from": "../../../config.json", 21 | "to": "" 22 | } 23 | ] 24 | } 25 | -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /src/cocos/cocosdenshion/DeprecatedCocosDenshionClass.lua: -------------------------------------------------------------------------------- 1 | if nil == cc.SimpleAudioEngine then 2 | return 3 | end 4 | -- This is the DeprecatedCocosDenshionClass 5 | 6 | DeprecatedCocosDenshionClass = {} or DeprecatedCocosDenshionClass 7 | 8 | --tip 9 | local function deprecatedTip(old_name,new_name) 10 | print("\n********** \n"..old_name.." was deprecated please use ".. new_name .. " instead.\n**********") 11 | end 12 | 13 | --SimpleAudioEngine class will be Deprecated,begin 14 | function DeprecatedCocosDenshionClass.SimpleAudioEngine() 15 | deprecatedTip("SimpleAudioEngine","cc.SimpleAudioEngine") 16 | return cc.SimpleAudioEngine 17 | end 18 | _G["SimpleAudioEngine"] = DeprecatedCocosDenshionClass.SimpleAudioEngine() 19 | --SimpleAudioEngine class will be Deprecated,end 20 | -------------------------------------------------------------------------------- /frameworks/runtime-src/proj.android/ant.properties: -------------------------------------------------------------------------------- 1 | # This file is used to override default values used by the Ant build system. 2 | # 3 | # This file must be checked into Version Control Systems, as it is 4 | # integral to the build system of your project. 5 | 6 | # This file is only used by the Ant script. 7 | 8 | # You can use this to override default values such as 9 | # 'source.dir' for the location of your java source folder and 10 | # 'out.dir' for the location of your output folder. 11 | 12 | # You can also use it define how the release builds are signed by declaring 13 | # the following properties: 14 | # 'key.store' for the location of your keystore and 15 | # 'key.alias' for the name of the key to use. 16 | # The password will be asked during the build when you use the 'release' target. 17 | 18 | -------------------------------------------------------------------------------- /src/widgets/BorderWidget.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | 说明: 边框(公告) 3 | ]] 4 | 5 | local BorderWidget = qy.View.Base.extend("BorderWidget", "widget/BorderWidget") 6 | 7 | function BorderWidget:ctor() 8 | BorderWidget.super.ctor(self) 9 | 10 | self:InjectView("Border") 11 | self:InjectView("Corner1") 12 | self:InjectView("Corner2") 13 | self:InjectView("Corner3") 14 | self:InjectView("Corner4") 15 | end 16 | 17 | -- 设置高度 18 | function BorderWidget:setHeight(entity) 19 | local textHeight = entity.height_:get() 20 | local imageHeight = entity.picHeight_:get() 21 | local totalHeight = textHeight + imageHeight + 40 22 | self.Border:setContentSize(cc.size(505, totalHeight)) 23 | self.Corner1:setPositionY(totalHeight - 19) 24 | self.Corner2:setPositionY(totalHeight - 19) 25 | end 26 | 27 | return BorderWidget -------------------------------------------------------------------------------- /cocosstudio/cocos_lua_lib.cfg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /frameworks/runtime-src/Classes/ide-support/SimpleConfigParser.h: -------------------------------------------------------------------------------- 1 | #ifndef __SIMPLE_CONFIG_PARSER_H__ 2 | #define __SIMPLE_CONFIG_PARSER_H__ 3 | 4 | #include 5 | #include 6 | #include "cocos2d.h" 7 | #include "json/document.h" 8 | using namespace std; 9 | USING_NS_CC; 10 | 11 | #define CONFIG_FILE "config.json" 12 | 13 | class SimpleConfigParser 14 | { 15 | public: 16 | static SimpleConfigParser *getInstance(void); 17 | static void purge(); 18 | 19 | void readConfig(const string &filepath = ""); 20 | bool isLanscape(); 21 | rapidjson::Document& getConfigJsonRoot(); 22 | private: 23 | SimpleConfigParser(void); 24 | static SimpleConfigParser *s_sharedSimpleConfigParserInstance; 25 | bool _isLandscape; 26 | 27 | rapidjson::Document _docRootjson; 28 | }; 29 | 30 | #endif // __SIMPLE_CONFIG_PARSER_H__ 31 | 32 | -------------------------------------------------------------------------------- /frameworks/runtime-src/Classes/Purchase.h: -------------------------------------------------------------------------------- 1 | // 2 | // Purchase.h 3 | // God 4 | // 5 | // Created by antz on 15/5/15. 6 | // 7 | // 8 | 9 | #import 10 | #import 11 | 12 | 13 | @interface Purchase : NSObject { 14 | int _scriptHandler; 15 | int _errorHandler; 16 | NSArray* purchaseCache; 17 | } 18 | + (Purchase*) getInstance; 19 | 20 | + (void) destroyInstance; 21 | 22 | + (void) registerScriptHandler:(NSDictionary *)dict; 23 | + (void) unregisterScriptHandler; 24 | 25 | + (void) finish; 26 | 27 | + (int) buy:(NSDictionary *)dict; 28 | + (void) callbackScriptHandler; 29 | + (void) callErrorScriptHandler; 30 | 31 | + (NSString*) getDeviceID; 32 | 33 | - (id) init; 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /frameworks/runtime-src/proj.android/jni/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | 3 | include $(CLEAR_VARS) 4 | 5 | LOCAL_MODULE := cocos2dlua_shared 6 | 7 | LOCAL_MODULE_FILENAME := libcocos2dlua 8 | 9 | FILE_LIST := hellolua/main.cpp 10 | FILE_LIST += $(wildcard $(LOCAL_PATH)/../../Classes/*.cpp) 11 | FILE_LIST += $(wildcard $(LOCAL_PATH)/../../Classes/ide-support/*.cpp) 12 | FILE_LIST += $(wildcard $(LOCAL_PATH)/../../Classes/ide-support/*.c) 13 | 14 | LOCAL_SRC_FILES := $(FILE_LIST:$(LOCAL_PATH)/%=%) 15 | 16 | LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../Classes 17 | 18 | LOCAL_STATIC_LIBRARIES := cocos2d_lua_static 19 | LOCAL_STATIC_LIBRARIES += cocos2d_simulator_static 20 | 21 | include $(BUILD_SHARED_LIBRARY) 22 | 23 | $(call import-module,scripting/lua-bindings/proj.android/prebuilt-mk) 24 | $(call import-module,tools/simulator/libsimulator/proj.android/prebuilt-mk) 25 | 26 | -------------------------------------------------------------------------------- /src/utils/event.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | 说明: 事件工具类 3 | ]] 4 | 5 | local Event = {} 6 | 7 | Event.Dispatcher = cc.Director:getInstance():getEventDispatcher() 8 | 9 | -- 增加一个事件监听 10 | -- name: 事件名称 11 | -- func: 事件回调 12 | -- fixedPriority: 优化级, 默认为1 13 | function Event.add(name, func, fixedPriority) 14 | local listener = cc.EventListenerCustom:create(name, func) 15 | Event.Dispatcher:addEventListenerWithFixedPriority(listener, fixedPriority or 1) 16 | return listener 17 | end 18 | 19 | -- 删除一个事件监听 20 | function Event.remove(listener) 21 | if listener then 22 | Event.Dispatcher:removeEventListener(listener) 23 | end 24 | end 25 | 26 | -- 触发一个事件监听 27 | function Event.dispatch(name, usedata) 28 | local event = cc.EventCustom:new(name) 29 | event._usedata = usedata 30 | event.data = usedata 31 | Event.Dispatcher:dispatchEvent(event) 32 | end 33 | 34 | return Event 35 | -------------------------------------------------------------------------------- /frameworks/runtime-src/proj.android/proguard-project.txt: -------------------------------------------------------------------------------- 1 | # To enable ProGuard in your project, edit project.properties 2 | # to define the proguard.config property as described in that file. 3 | # 4 | # Add project specific ProGuard rules here. 5 | # By default, the flags in this file are appended to flags specified 6 | # in ${sdk.dir}/tools/proguard/proguard-android.txt 7 | # You can edit the include path and order by changing the ProGuard 8 | # include property in project.properties. 9 | # 10 | # For more details, see 11 | # http://developer.android.com/guide/developing/tools/proguard.html 12 | 13 | # Add any project specific keep options here: 14 | 15 | # If your project uses WebView with JS, uncomment the following 16 | # and specify the fully qualified class name to the JavaScript interface 17 | # class: 18 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 19 | # public *; 20 | #} 21 | -------------------------------------------------------------------------------- /src/core/BaseViewModel.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | 3 | 4 | ]] 5 | 6 | local BaseViewModel = class("BaseViewModel") 7 | 8 | function BaseViewModel:ctor () 9 | end 10 | 11 | function BaseViewModel:initView (viewClass) 12 | 13 | self.viewClass = viewClass 14 | end 15 | 16 | function BaseViewModel:showView () 17 | 18 | self.V = self.viewClass.new() 19 | self.V:setVM(self) 20 | 21 | self.V:show() 22 | 23 | end 24 | 25 | function BaseViewModel:hideView () 26 | if self.V then self.V:dismiss() end 27 | end 28 | 29 | function BaseViewModel:init() 30 | end 31 | 32 | -- 需要子类实现 33 | function BaseViewModel:eventHandler(name) 34 | assert(false, "BaseViewModel:eventHandler需要子类实现") 35 | end 36 | 37 | 38 | function BaseViewModel:_onExit () 39 | -- self.V:release() 40 | self:onExit() 41 | end 42 | 43 | -- 子类实现 44 | function BaseViewModel:onExit () 45 | 46 | end 47 | 48 | return BaseViewModel 49 | -------------------------------------------------------------------------------- /src/widgets/NumChangeToast.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | 说明: 提示小浮层 3 | 作者: 蒋明明 4 | 日期: 2015-4-27 5 | ]] 6 | 7 | local NumChangeToast = qy.View.Base.extend("NumChangeToast", "widget/NumChangeToast") 8 | 9 | function NumChangeToast:ctor() 10 | NumChangeToast.super.ctor(self) 11 | 12 | self:InjectView("Text_Num") 13 | 14 | self:setOpacity(0) 15 | -- self:setPosition(cc.p(display.size.width / 2, display.size.height * 0.5)) 16 | end 17 | 18 | function NumChangeToast:show(parent, num) 19 | self.Text_Num:setString("+" .. num) 20 | self:addTo(parent, 1000) 21 | self:setOpacity(255) 22 | 23 | local moveAndFadeOut = cc.Spawn:create(cc.FadeOut:create(0.5), cc.MoveBy:create(0.4, cc.p(0, 100))) 24 | self:runAction(cc.Sequence:create(cc.DelayTime:create(1.8), moveAndFadeOut, cc.CallFunc:create(function() 25 | self:removeFromParent() 26 | end))) 27 | end 28 | 29 | return NumChangeToast -------------------------------------------------------------------------------- /src/core/BaseController.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | 3 | 4 | ]] 5 | 6 | local BaseController = class("BaseController", qy.View) 7 | 8 | function BaseController:ctor() 9 | BaseController.super.ctor(self) 10 | end 11 | 12 | function BaseController:start() 13 | app.runningScene():push(self) 14 | end 15 | 16 | function BaseController:finish() 17 | app.runningScene():pop() 18 | end 19 | 20 | function BaseController:addEvent(name, listener) 21 | self._events = self._events or {} 22 | self._events[name] = app.Event.add(name, listener) 23 | end 24 | 25 | function BaseController:removeEvent(name) 26 | app.Event.remove(self._events[name]) 27 | self._events[name] = nil 28 | end 29 | 30 | function BaseController:removeAllEvents() 31 | if self._events then 32 | for name, _ in pairs(self._events) do 33 | self:removeEvent(name) 34 | end 35 | end 36 | end 37 | 38 | 39 | return BaseController -------------------------------------------------------------------------------- /src/utils/utils.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | 说明: 工具表 3 | ]] 4 | 5 | local Utils = class("Utils") 6 | 7 | -- 将一个一维数组合并为二维数组 8 | function Utils.oneToTwo(tables, num1, num2) 9 | local array = {} 10 | local tempTable = {} 11 | local tidx = 0 12 | for k, v in pairs(tables) do 13 | tidx = tidx + 1 14 | table.insert(tempTable, tidx, v) 15 | end 16 | 17 | local idx = 1 18 | for i = 1, num1 do 19 | array[i] = {} 20 | for j = 1, num2 do 21 | array[i][j] = tempTable[idx] 22 | idx = idx + 1 23 | end 24 | end 25 | 26 | return array 27 | end 28 | 29 | 30 | function Utils.slice(list, start, total) 31 | 32 | local _end = math.min(start + total - 1, #list) 33 | 34 | local array = {} 35 | 36 | for i = start, _end do 37 | table.insert(array, list[i]) 38 | end 39 | 40 | return array 41 | end 42 | 43 | 44 | 45 | return Utils 46 | -------------------------------------------------------------------------------- /src/cocos/controller/ControllerConstants.lua: -------------------------------------------------------------------------------- 1 | 2 | cc = cc or {} 3 | 4 | cc.ControllerKey = 5 | { 6 | JOYSTICK_LEFT_X = 1000, 7 | JOYSTICK_LEFT_Y = 1001, 8 | JOYSTICK_RIGHT_X = 1002, 9 | JOYSTICK_RIGHT_Y = 1003, 10 | 11 | BUTTON_A = 1004, 12 | BUTTON_B = 1005, 13 | BUTTON_C = 1006, 14 | BUTTON_X = 1007, 15 | BUTTON_Y = 1008, 16 | BUTTON_Z = 1009, 17 | 18 | BUTTON_DPAD_UP = 1010, 19 | BUTTON_DPAD_DOWN = 1011, 20 | BUTTON_DPAD_LEFT = 1012, 21 | BUTTON_DPAD_RIGHT = 1013, 22 | BUTTON_DPAD_CENTER = 1014, 23 | 24 | BUTTON_LEFT_SHOULDER = 1015, 25 | BUTTON_RIGHT_SHOULDER = 1016, 26 | 27 | AXIS_LEFT_TRIGGER = 1017, 28 | AXIS_RIGHT_TRIGGER = 1018, 29 | 30 | BUTTON_LEFT_THUMBSTICK = 1019, 31 | BUTTON_RIGHT_THUMBSTICK = 1020, 32 | 33 | BUTTON_START = 1021, 34 | BUTTON_SELECT = 1022, 35 | 36 | BUTTON_PAUSE = 1023, 37 | KEY_MAX = 1024, 38 | } 39 | -------------------------------------------------------------------------------- /frameworks/runtime-src/proj.ios_mac/cocos_lua_lib.xcodeproj/xcuserdata/antz.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | cocos_lua_lib Mac.xcscheme 8 | 9 | orderHint 10 | 1 11 | 12 | cocos_lua_lib iOS.xcscheme 13 | 14 | orderHint 15 | 0 16 | 17 | 18 | SuppressBuildableAutocreation 19 | 20 | 5023812617EBBCE400990C9B 21 | 22 | primary 23 | 24 | 25 | F293B3C715EB7BE500256477 26 | 27 | primary 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /frameworks/runtime-src/Classes/ide-support/RuntimeLuaImpl.h: -------------------------------------------------------------------------------- 1 | // 2 | // RuntimeLuaImpl.h 3 | // Simulator 4 | // 5 | // 6 | 7 | #ifndef __Simulator__RuntimeLuaImpl__ 8 | #define __Simulator__RuntimeLuaImpl__ 9 | 10 | #include "CodeIDESupport.h" 11 | #include "cocos2d.h" 12 | 13 | #if (COCOS2D_DEBUG > 0) && (CC_CODE_IDE_DEBUG_SUPPORT > 0) 14 | 15 | #include "runtime/RuntimeProtocol.h" 16 | 17 | class RuntimeLuaImpl : public RuntimeProtocol 18 | { 19 | public: 20 | static RuntimeLuaImpl *create(); 21 | 22 | void onStartDebuger(const rapidjson::Document& dArgParse, rapidjson::Document& dReplyParse); 23 | void onReload(const rapidjson::Document& dArgParse, rapidjson::Document& dReplyParse); 24 | void startScript(const std::string& strDebugArg); 25 | 26 | private: 27 | void init(); 28 | }; 29 | 30 | #endif // (COCOS2D_DEBUG > 0) && (CC_CODE_IDE_DEBUG_SUPPORT > 0) 31 | 32 | #endif /* defined(__Simulator__RuntimeLua__) */ 33 | -------------------------------------------------------------------------------- /frameworks/runtime-src/proj.win32/main.cpp: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | #include "SimulatorWin.h" 3 | #include 4 | 5 | #if _MSC_VER > 1700 6 | #pragma comment(lib,"libcocos2d_2013.lib") 7 | #pragma comment(lib,"libluacocos2d_2013.lib") 8 | #pragma comment(lib,"libbox2d_2013.lib") 9 | #pragma comment(lib,"libSpine_2013.lib") 10 | #pragma comment(lib,"libsimulator_2013.lib") 11 | #else 12 | #pragma comment(lib,"libcocos2d_2012.lib") 13 | #pragma comment(lib,"libluacocos2d_2012.lib") 14 | #pragma comment(lib,"libbox2d_2012.lib") 15 | #pragma comment(lib,"libSpine_2012.lib") 16 | #pragma comment(lib,"libsimulator_2012.lib") 17 | #endif 18 | 19 | int APIENTRY _tWinMain(HINSTANCE hInstance, 20 | HINSTANCE hPrevInstance, 21 | LPTSTR lpCmdLine, 22 | int nCmdShow) 23 | { 24 | UNREFERENCED_PARAMETER(hPrevInstance); 25 | UNREFERENCED_PARAMETER(lpCmdLine); 26 | auto simulator = SimulatorWin::getInstance(); 27 | return simulator->run(); 28 | } 29 | -------------------------------------------------------------------------------- /frameworks/runtime-src/proj.android/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | cocos_lua_lib 4 | 5 | 6 | 7 | 8 | 9 | com.android.ide.eclipse.adt.ResourceManagerBuilder 10 | 11 | 12 | 13 | 14 | com.android.ide.eclipse.adt.PreCompilerBuilder 15 | 16 | 17 | 18 | 19 | org.eclipse.jdt.core.javabuilder 20 | 21 | 22 | 23 | 24 | com.android.ide.eclipse.adt.ApkBuilder 25 | 26 | 27 | 28 | 29 | 30 | com.android.ide.eclipse.adt.AndroidNature 31 | org.eclipse.jdt.core.javanature 32 | 33 | 34 | -------------------------------------------------------------------------------- /src/widgets/CombatlToast.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | 说明: 提示小浮层 3 | 作者: 林国锋 4 | 日期: 2014-12-23 5 | 6 | usage: 7 | qy.Widget.CombatlToast.make("内容", 1, cc.p(480, 320)):show() 8 | ]] 9 | 10 | local CombatlToast = qy.View.Base.extend("CombatlToast", "widget/CombatlToast") 11 | 12 | function CombatlToast:ctor() 13 | CombatlToast.super.ctor(self) 14 | 15 | self:InjectView("Text_combatl") 16 | 17 | self:setOpacity(0) 18 | self:setPosition(cc.p(display.size.width / 2, display.size.height * 0.5)) 19 | end 20 | 21 | function CombatlToast:show(parent, combatl) 22 | self.Text_combatl:setString("+" .. combatl) 23 | self:addTo(parent, 1000) 24 | self:setOpacity(255) 25 | 26 | local moveAndFadeOut = cc.Spawn:create(cc.FadeOut:create(0.5), cc.MoveBy:create(0.4, cc.p(0, 100))) 27 | self:runAction(cc.Sequence:create(cc.DelayTime:create(1.8), moveAndFadeOut, cc.CallFunc:create(function() 28 | self:removeFromParent() 29 | end))) 30 | end 31 | 32 | return CombatlToast -------------------------------------------------------------------------------- /frameworks/runtime-src/proj.win32/cocos_lua_lib.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2012 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cocos_lua_lib", "cocos_lua_lib.vcxproj", "{4E6A7A0E-DDD8-4BAA-8B22-C964069364ED}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Win32 = Debug|Win32 9 | Release|Win32 = Release|Win32 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {4E6A7A0E-DDD8-4BAA-8B22-C964069364ED}.Debug|Win32.ActiveCfg = Debug|Win32 13 | {4E6A7A0E-DDD8-4BAA-8B22-C964069364ED}.Debug|Win32.Build.0 = Debug|Win32 14 | {4E6A7A0E-DDD8-4BAA-8B22-C964069364ED}.Release|Win32.ActiveCfg = Release|Win32 15 | {4E6A7A0E-DDD8-4BAA-8B22-C964069364ED}.Release|Win32.Build.0 = Release|Win32 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /src/cocos/cocos2d/luaoc.lua: -------------------------------------------------------------------------------- 1 | 2 | local luaoc = {} 3 | 4 | local callStaticMethod = LuaObjcBridge.callStaticMethod 5 | 6 | function luaoc.callStaticMethod(className, methodName, args) 7 | local ok, ret = callStaticMethod(className, methodName, args) 8 | if not ok then 9 | local msg = string.format("luaoc.callStaticMethod(\"%s\", \"%s\", \"%s\") - error: [%s] ", 10 | className, methodName, tostring(args), tostring(ret)) 11 | if ret == -1 then 12 | print(msg .. "INVALID PARAMETERS") 13 | elseif ret == -2 then 14 | print(msg .. "CLASS NOT FOUND") 15 | elseif ret == -3 then 16 | print(msg .. "METHOD NOT FOUND") 17 | elseif ret == -4 then 18 | print(msg .. "EXCEPTION OCCURRED") 19 | elseif ret == -5 then 20 | print(msg .. "INVALID METHOD SIGNATURE") 21 | else 22 | print(msg .. "UNKNOWN") 23 | end 24 | end 25 | return ok, ret 26 | end 27 | 28 | return luaoc 29 | -------------------------------------------------------------------------------- /src/cocos/cocosdenshion/DeprecatedCocosDenshionFunc.lua: -------------------------------------------------------------------------------- 1 | if nil == cc.SimpleAudioEngine then 2 | return 3 | end 4 | --tip 5 | local function deprecatedTip(old_name,new_name) 6 | print("\n********** \n"..old_name.." was deprecated please use ".. new_name .. " instead.\n**********") 7 | end 8 | 9 | --functions of SimpleAudioEngine will be deprecated begin 10 | local SimpleAudioEngineDeprecated = { } 11 | function SimpleAudioEngineDeprecated.sharedEngine() 12 | deprecatedTip("SimpleAudioEngine:sharedEngine","SimpleAudioEngine:getInstance") 13 | return cc.SimpleAudioEngine:getInstance() 14 | end 15 | SimpleAudioEngine.sharedEngine = SimpleAudioEngineDeprecated.sharedEngine 16 | 17 | function SimpleAudioEngineDeprecated.playBackgroundMusic(self,...) 18 | deprecatedTip("SimpleAudioEngine:playBackgroundMusic","SimpleAudioEngine:playMusic") 19 | return self:playMusic(...) 20 | end 21 | SimpleAudioEngine.playBackgroundMusic = SimpleAudioEngineDeprecated.playBackgroundMusic 22 | --functions of SimpleAudioEngine will be deprecated end 23 | -------------------------------------------------------------------------------- /frameworks/runtime-src/proj.android/jni/hellolua/main.cpp: -------------------------------------------------------------------------------- 1 | #include "AppDelegate.h" 2 | #include "cocos2d.h" 3 | #include "platform/android/jni/JniHelper.h" 4 | #include 5 | #include 6 | #include "ide-support/SimpleConfigParser.h" 7 | #include "ide-support/CodeIDESupport.h" 8 | 9 | #define LOG_TAG "main" 10 | #define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG,LOG_TAG,__VA_ARGS__) 11 | 12 | using namespace cocos2d; 13 | 14 | void cocos_android_app_init (JNIEnv* env, jobject thiz) { 15 | LOGD("cocos_android_app_init"); 16 | AppDelegate *pAppDelegate = new AppDelegate(); 17 | } 18 | 19 | extern "C" 20 | { 21 | bool Java_org_cocos2dx_lua_AppActivity_nativeIsLandScape(JNIEnv *env, jobject thisz) 22 | { 23 | return SimpleConfigParser::getInstance()->isLanscape(); 24 | } 25 | 26 | bool Java_org_cocos2dx_lua_AppActivity_nativeIsDebug(JNIEnv *env, jobject thisz) 27 | { 28 | #if (COCOS2D_DEBUG > 0) && (CC_CODE_IDE_DEBUG_SUPPORT > 0) 29 | return true; 30 | #else 31 | return false; 32 | #endif 33 | } 34 | } 35 | 36 | -------------------------------------------------------------------------------- /frameworks/runtime-src/proj.win32/cocos_lua_lib.vcxproj.user: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | false 5 | $(OutDir)/Resource 6 | WindowsLocalDebugger 7 | WindowsLocalDebugger 8 | 9 | 10 | $(OutDir)../../../../runtime/win32 11 | $(OutDir)../../../../runtime/win32/$(TargetFileName) 12 | -workdir $(ProjectDir)../../../ 13 | 14 | -------------------------------------------------------------------------------- /src/cocos/cocos2d/luaj.lua: -------------------------------------------------------------------------------- 1 | 2 | local luaj = {} 3 | 4 | local callJavaStaticMethod = LuaJavaBridge.callStaticMethod 5 | 6 | local function checkArguments(args, sig) 7 | if type(args) ~= "table" then args = {} end 8 | if sig then return args, sig end 9 | 10 | sig = {"("} 11 | for i, v in ipairs(args) do 12 | local t = type(v) 13 | if t == "number" then 14 | sig[#sig + 1] = "F" 15 | elseif t == "boolean" then 16 | sig[#sig + 1] = "Z" 17 | elseif t == "function" then 18 | sig[#sig + 1] = "I" 19 | else 20 | sig[#sig + 1] = "Ljava/lang/String;" 21 | end 22 | end 23 | sig[#sig + 1] = ")V" 24 | 25 | return args, table.concat(sig) 26 | end 27 | 28 | function luaj.callStaticMethod(className, methodName, args, sig) 29 | local args, sig = checkArguments(args, sig) 30 | --echoInfo("luaj.callStaticMethod(\"%s\",\n\t\"%s\",\n\targs,\n\t\"%s\"", className, methodName, sig) 31 | return callJavaStaticMethod(className, methodName, args, sig) 32 | end 33 | 34 | return luaj 35 | -------------------------------------------------------------------------------- /frameworks/runtime-src/proj.android/src/org/cocos2dx/lib/GameControllerUtils.java: -------------------------------------------------------------------------------- 1 | package org.cocos2dx.lib; 2 | 3 | import java.io.File; 4 | import java.io.FileInputStream; 5 | 6 | public class GameControllerUtils { 7 | 8 | public static void ensureDirectoryExist(String path){ 9 | 10 | File sdkDir = new File(path); 11 | if(!sdkDir.exists()){ 12 | sdkDir.mkdirs(); 13 | } 14 | } 15 | 16 | public static String readJsonFile(String filePath) { 17 | 18 | File file = new File(filePath); 19 | 20 | if (!file.exists()){ 21 | return null; 22 | } 23 | 24 | try { 25 | 26 | FileInputStream is = new FileInputStream(file);; 27 | 28 | int size = is.available(); 29 | byte[] buffer = new byte[size]; 30 | 31 | is.read(buffer); 32 | is.close(); 33 | 34 | String jsonstr = new String(buffer, "UTF-8"); 35 | 36 | return jsonstr; 37 | } catch (Exception e) { 38 | e.printStackTrace(); 39 | } 40 | 41 | return null; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /frameworks/runtime-src/Classes/AppDelegate.h: -------------------------------------------------------------------------------- 1 | #ifndef __APP_DELEGATE_H__ 2 | #define __APP_DELEGATE_H__ 3 | 4 | #include "cocos2d.h" 5 | 6 | /** 7 | @brief The cocos2d Application. 8 | 9 | The reason for implement as private inheritance is to hide some interface call by Director. 10 | */ 11 | class AppDelegate : private cocos2d::Application 12 | { 13 | public: 14 | AppDelegate(); 15 | virtual ~AppDelegate(); 16 | 17 | virtual void initGLContextAttrs(); 18 | 19 | /** 20 | @brief Implement Director and Scene init code here. 21 | @return true Initialize success, app continue. 22 | @return false Initialize failed, app terminate. 23 | */ 24 | virtual bool applicationDidFinishLaunching(); 25 | 26 | /** 27 | @brief The function be called when the application enter background 28 | @param the pointer of the application 29 | */ 30 | virtual void applicationDidEnterBackground(); 31 | 32 | /** 33 | @brief The function be called when the application enter foreground 34 | @param the pointer of the application 35 | */ 36 | virtual void applicationWillEnterForeground(); 37 | }; 38 | 39 | #endif // __APP_DELEGATE_H__ 40 | 41 | -------------------------------------------------------------------------------- /src/core/Signal.lua: -------------------------------------------------------------------------------- 1 | -- 2 | -- Author: zp 3 | -- Date: 2015-06-29 16:38:40 4 | -- 5 | 6 | 7 | local Signal = class("Signal") 8 | 9 | function Signal:ctor() 10 | self._pool = {} 11 | end 12 | 13 | function Signal:add(fun) 14 | assert(type(fun) == "function", "BaseEntity:addObserver(): 参数fun必须为function") 15 | table.insert(self._pool, {["fun"] = fun, ["once"] = 0}) 16 | end 17 | 18 | -- 只执行一次x 19 | function Signal:addOnce(fun) 20 | 21 | assert(type(fun) == "function", "BaseEntity:addObserver(): 参数fun必须为function") 22 | table.insert(self._pool, {["fun"] = fun, ["once"] = 1}) 23 | end 24 | 25 | function Signal:fire(...) 26 | if #self._pool > 0 then 27 | for i, obj in ipairs(self._pool) do 28 | obj.fun(...) 29 | if obj.once == 1 then 30 | table.remove(self._pool, i) 31 | end 32 | end 33 | end 34 | end 35 | 36 | function Signal:remove(handler) 37 | 38 | for i,v in ipairs(self._pool) do 39 | if v == handler then 40 | table.remove(self._pool, i) 41 | break 42 | end 43 | end 44 | end 45 | 46 | 47 | 48 | function Signal:clearAll() 49 | self._pool = {} 50 | end 51 | 52 | return Signal 53 | -------------------------------------------------------------------------------- /src/widgets/Loading.lua: -------------------------------------------------------------------------------- 1 | -- 2 | -- Author: Your Name 3 | -- Date: 2015-05-27 17:24:25 4 | -- 5 | local Loading = class("Loading", app.V) 6 | 7 | Loading.style = { 8 | ["skin"] = app.config.Theme .. ".LoadingSkin", 9 | ["bgOpacity"] = 120 10 | } 11 | 12 | function Loading:ctor() 13 | self:addCSB(self.style.skin) 14 | self:setVisible(false) 15 | 16 | self:render() 17 | end 18 | 19 | function Loading:render() 20 | self:setPosition(display.center ) 21 | 22 | self._layout = ccui.Layout:create() 23 | self._layout:setContentSize(cc.size(display.width, display.height)) 24 | self._layout:setBackGroundColor(cc.c3b(0, 0, 0)) -- 填充颜色 25 | self._layout:setBackGroundColorType(1) -- 填充方式 26 | self._layout:setBackGroundColorOpacity(self.style.bgOpacity) -- 颜色透明度 27 | self._layout:setTouchEnabled(true) 28 | 29 | self._layout:setPosition(-self:getPositionX(), -self:getPositionY()) 30 | self:addChild(self._layout, -1) 31 | end 32 | 33 | function Loading.on() 34 | display:getRunningScene():getLoading():setVisible(true) 35 | end 36 | 37 | function Loading:off() 38 | display:getRunningScene():getLoading():setVisible(false) 39 | end 40 | 41 | 42 | 43 | return Loading 44 | -------------------------------------------------------------------------------- /src/cocos/network/DeprecatedNetworkFunc.lua: -------------------------------------------------------------------------------- 1 | if nil == cc.XMLHttpRequest then 2 | return 3 | end 4 | 5 | --tip 6 | local function deprecatedTip(old_name,new_name) 7 | print("\n********** \n"..old_name.." was deprecated please use ".. new_name .. " instead.\n**********") 8 | end 9 | 10 | --functions of WebSocket will be deprecated begin 11 | local targetPlatform = CCApplication:getInstance():getTargetPlatform() 12 | if (kTargetIphone == targetPlatform) or (kTargetIpad == targetPlatform) or (kTargetAndroid == targetPlatform) or (kTargetWindows == targetPlatform) then 13 | local WebSocketDeprecated = { } 14 | function WebSocketDeprecated.sendTextMsg(self, string) 15 | deprecatedTip("WebSocket:sendTextMsg","WebSocket:sendString") 16 | return self:sendString(string) 17 | end 18 | WebSocket.sendTextMsg = WebSocketDeprecated.sendTextMsg 19 | 20 | function WebSocketDeprecated.sendBinaryMsg(self, table,tablesize) 21 | deprecatedTip("WebSocket:sendBinaryMsg","WebSocket:sendString") 22 | string.char(unpack(table)) 23 | return self:sendString(string.char(unpack(table))) 24 | end 25 | WebSocket.sendBinaryMsg = WebSocketDeprecated.sendBinaryMsg 26 | end 27 | --functions of WebSocket will be deprecated end 28 | -------------------------------------------------------------------------------- /src/utils/date.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | 说明: 日期类 3 | 4 | %a abbreviated weekday name (e.g., Wed) 5 | %A full weekday name (e.g., Wednesday) 6 | %b abbreviated month name (e.g., Sep) 7 | %B full month name (e.g., September) 8 | %c date and time (e.g., 09/16/98 23:48:10) 9 | %d day of the month (16) [01-31] 10 | %H hour, using a 24-hour clock (23) [00-23] 11 | %I hour, using a 12-hour clock (11) [01-12] 12 | %M minute (48) [00-59] 13 | %m month (09) [01-12] 14 | %p either "am" or "pm" (pm) 15 | %S second (10) [00-61] 16 | %w weekday (3) [0-6 = Sunday-Saturday] 17 | %x date (e.g., 09/16/98) 18 | %X time (e.g., 23:48:10) 19 | %Y full year (1998) 20 | %y two-digit year (98) [00-99] 21 | %% the character `%´ 22 | 23 | usage: 24 | local str, isZero = qy.Date.format("%X", 12345678910) 25 | if isZero then 26 | print("倒计时结束") 27 | else 28 | print(str .. " 后免费") 29 | end 30 | ]] 31 | 32 | local Date = class("Date") 33 | 34 | function Date.format(format, time) 35 | local sec = time - os.time() -- - fix_time 36 | local datetime = os.time(os.date("!*t", math.max(sec, 0))) 37 | return os.date(format, datetime), sec < 0 38 | end 39 | 40 | return Date -------------------------------------------------------------------------------- /cocosstudio/cocos_lua_lib.udf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /src/core/Observer.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | zp 3 | 4 | 5 | ]] 6 | 7 | local Observer = class("Observer") 8 | 9 | 10 | Observer._pool = {} 11 | 12 | function Observer:addObserver(name, fun) 13 | 14 | assert(type(fun) == "function", "BaseEntity:addObserver(): 参数fun必须为function") 15 | -- assert(self[name .. "_"], "BaseEntity:addObserver(): name=" .. name .. "不存在!") 16 | 17 | if not self._pool[name] then 18 | self._pool[name] = {} 19 | end 20 | 21 | table.insert(self._pool[name], fun) 22 | 23 | return name .. "_" ..#self._pool[name] 24 | 25 | end 26 | 27 | function Observer:fire(name, ...) 28 | if self._pool[name] then 29 | for i, fun in ipairs(self._pool[name]) do 30 | if type(fun) == "function" then fun(...) end 31 | end 32 | end 33 | end 34 | 35 | function Observer:removeObserver(handler) 36 | local h = string.split(handler, "_") 37 | 38 | if h[1] and h[2] and tonumber(h[2]) then 39 | if self._pool[h[1]] then 40 | table.remove(self._pool[h[1]], tonumber(h[2])) 41 | end 42 | end 43 | end 44 | 45 | function Observer:clearObserver(name) 46 | if self[name .. "_"] then 47 | if self._pool[name] then self._pool[name] = {} end 48 | end 49 | end 50 | 51 | return Observer 52 | -------------------------------------------------------------------------------- /src/widgets/BaseIcon.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | 3 | zp 4 | 基础icon 5 | ]] 6 | 7 | local BaseIcon = class("BaseIcon", app.V) 8 | 9 | BaseIcon.style = { 10 | ["skin"] = app.config.Theme .. ".IconSkin" 11 | } 12 | 13 | function BaseIcon:ctor() 14 | 15 | self:addCSB(self.style.skin) 16 | 17 | self:InjectView("icon") 18 | self:InjectView("frame") 19 | end 20 | 21 | function BaseIcon:render(url, eventHandler) 22 | 23 | self.icon:loadTexture(url, ccui.TextureResType.plistType) 24 | 25 | if eventHandler then 26 | self:OnClick(self.icon, function(sender, touchPos) 27 | eventHandler(self, touchPos) 28 | end, 29 | 30 | function(sender, eventType) 31 | 32 | -- 点击效果 33 | if eventType == ccui.TouchEventType.began then 34 | -- 记录原来的缩放大小 35 | if not self._origin_scale then 36 | self._origin_scale = self:getScale() 37 | end 38 | self:runAction(cc.ScaleTo:create(0.05, self._origin_scale * 1.05)) 39 | 40 | elseif eventType == ccui.TouchEventType.moved then 41 | else 42 | self:runAction(cc.ScaleTo:create(0.05, self._origin_scale)) 43 | end 44 | end 45 | )--end 46 | end 47 | 48 | end 49 | 50 | return BaseIcon 51 | -------------------------------------------------------------------------------- /src/core/ViewCenter.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | 3 | ]] 4 | 5 | local ViewCenter = class("ViewCenter") 6 | 7 | 8 | 9 | function ViewCenter:ctor() 10 | self.pool = {} 11 | self.views = require("ViewCenterConfig") 12 | end 13 | 14 | function ViewCenter:appear(key) 15 | 16 | local obj = self.pool[key] 17 | 18 | if obj == nil then 19 | local views = self.views[key] 20 | local viewClass = nil 21 | local viewModelClass = nil 22 | 23 | if #views == 2 then 24 | viewClass = app[views[1]][views[2]] 25 | viewModelClass = app[views[1]][views[2] .. "M"] 26 | 27 | elseif #views == 3 then 28 | viewClass = app[views[1]][views[2]][views[3]] 29 | viewModelClass = app[views[1]][views[2]][views[3] .. "M"] 30 | 31 | elseif #views == 4 then 32 | viewClass = app[views[1]][views[2]][views[3]][views[4]] 33 | viewModelClass = app[views[1]][views[2]][views[3]][views[4] .. "M"] 34 | end 35 | 36 | vm = viewModelClass.new() 37 | obj = {["vm"] = vm, ["viewClass"] = viewClass} 38 | self.pool[key] = obj 39 | end 40 | 41 | obj.vm:initView(obj.viewClass) 42 | obj.vm:init() 43 | 44 | 45 | -- viewClass.new():initVM(viewModelClass) 46 | 47 | end 48 | 49 | return ViewCenter.new() 50 | -------------------------------------------------------------------------------- /cocosstudio/cocosstudio/csd/theme_1/LoadingSkin.csd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /frameworks/runtime-src/Classes/lua_module_register.h: -------------------------------------------------------------------------------- 1 | #ifndef __LUA_TEMPLATE_RUNTIME_FRAMEWORKS_RUNTIME_SRC_CLASSES_LUA_MODULE_REGISTER_H__ 2 | #define __LUA_TEMPLATE_RUNTIME_FRAMEWORKS_RUNTIME_SRC_CLASSES_LUA_MODULE_REGISTER_H__ 3 | 4 | #include "cocosdenshion/lua_cocos2dx_cocosdenshion_manual.h" 5 | #include "network/lua_cocos2dx_network_manual.h" 6 | #include "cocosbuilder/lua_cocos2dx_cocosbuilder_manual.h" 7 | #include "cocostudio/lua_cocos2dx_coco_studio_manual.hpp" 8 | #include "extension/lua_cocos2dx_extension_manual.h" 9 | #include "ui/lua_cocos2dx_ui_manual.hpp" 10 | #include "spine/lua_cocos2dx_spine_manual.hpp" 11 | #include "3d/lua_cocos2dx_3d_manual.h" 12 | #include "audioengine/lua_cocos2dx_audioengine_manual.h" 13 | 14 | static int lua_module_register(lua_State* L) 15 | { 16 | //Dont' change the module register order unless you know what your are doing 17 | register_cocosdenshion_module(L); 18 | register_network_module(L); 19 | register_cocosbuilder_module(L); 20 | register_cocostudio_module(L); 21 | register_ui_moudle(L); 22 | register_extension_module(L); 23 | register_spine_module(L); 24 | register_cocos3d_module(L); 25 | register_audioengine_module(L); 26 | return 1; 27 | } 28 | 29 | #endif // __LUA_TEMPLATE_RUNTIME_FRAMEWORKS_RUNTIME_SRC_CLASSES_LUA_MODULE_REGISTER_H__ 30 | 31 | -------------------------------------------------------------------------------- /frameworks/runtime-src/proj.ios_mac/mac/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | Icon 11 | CFBundleIdentifier 12 | org.cocos.cocoslualib 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | LSApplicationCategoryType 26 | public.app-category.games 27 | LSMinimumSystemVersion 28 | ${MACOSX_DEPLOYMENT_TARGET} 29 | NSHumanReadableCopyright 30 | Copyright © 2013. All rights reserved. 31 | NSMainNibFile 32 | MainMenu 33 | NSPrincipalClass 34 | NSApplication 35 | 36 | 37 | -------------------------------------------------------------------------------- /src/main.lua: -------------------------------------------------------------------------------- 1 | cc.FileUtils:getInstance():setPopupNotify(false) 2 | cc.FileUtils:getInstance():addSearchPath("src") 3 | cc.FileUtils:getInstance():addSearchPath("codes") 4 | cc.FileUtils:getInstance():addSearchPath("res") 5 | 6 | require "config" 7 | require "cocos.init" 8 | 9 | -- for CCLuaEngine traceback 10 | function __G__TRACKBACK__(msg) 11 | print("LUA ERROR: " .. tostring(msg) .. "\n") 12 | print(debug.traceback()) 13 | return msg 14 | end 15 | 16 | local function start() 17 | 18 | require("core.BaseApp") 19 | require("app").new():run() 20 | end 21 | 22 | 23 | local function main() 24 | collectgarbage("collect") 25 | -- avoid memory leak 26 | collectgarbage("setpause", 100) 27 | collectgarbage("setstepmul", 5000) 28 | math.randomseed(tostring(os.time()):reverse():sub(1, 6)) 29 | 30 | print = release_print 31 | print("logging") 32 | -- initialize director 33 | local director = cc.Director:getInstance() 34 | 35 | --turn on display FPS 36 | if CC_SHOW_FPS then 37 | director:setDisplayStats(true) 38 | end 39 | 40 | --set FPS. the default value is 1.0/60 if you don't call this 41 | director:setAnimationInterval(1.0 / 60) 42 | 43 | start() 44 | end 45 | 46 | 47 | local status, msg = xpcall(main, __G__TRACKBACK__) 48 | if not status then 49 | error(msg) 50 | end 51 | -------------------------------------------------------------------------------- /src/cocos/cocosbuilder/DeprecatedCocosBuilderClass.lua: -------------------------------------------------------------------------------- 1 | if nil == cc.CCBProxy then 2 | return 3 | end 4 | -- This is the DeprecatedCocosBuilderClass 5 | 6 | DeprecatedCocosBuilderClass = {} or DeprecatedCocosBuilderClass 7 | 8 | --tip 9 | local function deprecatedTip(old_name,new_name) 10 | print("\n********** \n"..old_name.." was deprecated please use ".. new_name .. " instead.\n**********") 11 | end 12 | 13 | --CCBReader class will be Deprecated,begin 14 | function DeprecatedCocosBuilderClass.CCBReader() 15 | deprecatedTip("CCBReader","cc.BReader") 16 | return cc.BReader 17 | end 18 | _G["CCBReader"] = DeprecatedCocosBuilderClass.CCBReader() 19 | --CCBReader class will be Deprecated,end 20 | 21 | --CCBAnimationManager class will be Deprecated,begin 22 | function DeprecatedCocosBuilderClass.CCBAnimationManager() 23 | deprecatedTip("CCBAnimationManager","cc.BAnimationManager") 24 | return cc.BAnimationManager 25 | end 26 | _G["CCBAnimationManager"] = DeprecatedCocosBuilderClass.CCBAnimationManager() 27 | --CCBAnimationManager class will be Deprecated,end 28 | 29 | --CCBProxy class will be Deprecated,begin 30 | function DeprecatedCocosBuilderClass.CCBProxy() 31 | deprecatedTip("CCBProxy","cc.CCBProxy") 32 | return cc.CCBProxy 33 | end 34 | _G["CCBProxy"] = DeprecatedCocosBuilderClass.CCBProxy() 35 | --CCBProxy class will be Deprecated,end 36 | -------------------------------------------------------------------------------- /src/cocos/framework/extends/MenuEx.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | 3 | Copyright (c) 2011-2014 chukong-inc.com 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | 23 | ]] 24 | 25 | local Menu = cc.Menu 26 | local MenuItem = cc.MenuItem 27 | 28 | function MenuItem:onClicked(callback) 29 | self:registerScriptTapHandler(callback) 30 | return self 31 | end 32 | -------------------------------------------------------------------------------- /res/LuaExtend.lua: -------------------------------------------------------------------------------- 1 | 2 | --add LuaScript to search path. 3 | cc.FileUtils:getInstance():addSearchPath('LuaScript/') 4 | 5 | -- used as metaTable 6 | local luaExtend = {} 7 | 8 | local function getChildInSubNodes(nodeTable, key) 9 | if #nodeTable == 0 then 10 | return nil 11 | end 12 | local child = nil 13 | local subNodeTable = {} 14 | for _, v in ipairs(nodeTable) do 15 | child = v:getChildByName(key) 16 | if (child) then 17 | return child 18 | end 19 | end 20 | for _, v in ipairs(nodeTable) do 21 | local subNodes = v:getChildren() 22 | if #subNodes ~= 0 then 23 | for _, v1 in ipairs(subNodes) do 24 | table.insert(subNodeTable, v1) 25 | end 26 | end 27 | end 28 | return getChildInSubNodes(subNodeTable, key) 29 | end 30 | 31 | luaExtend.__index = function(table, key) 32 | local root = table.root 33 | local child = root[key] 34 | if child then 35 | return child 36 | end 37 | 38 | child = root:getChildByName(key) 39 | if child then 40 | root[key] = child 41 | return child 42 | end 43 | 44 | child = getChildInSubNodes(root:getChildren(), key) 45 | if child then root[key] = child end 46 | return child 47 | end 48 | -- used as metaTable 49 | 50 | return luaExtend 51 | -------------------------------------------------------------------------------- /frameworks/runtime-src/proj.android/src/org/cocos2dx/lib/Cocos2dxJavascriptJavaBridge.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013-2014 Chukong Technologies Inc. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | 23 | package org.cocos2dx.lib; 24 | 25 | public class Cocos2dxJavascriptJavaBridge { 26 | public static native int evalString(String value); 27 | } 28 | -------------------------------------------------------------------------------- /src/utils/timer.lua: -------------------------------------------------------------------------------- 1 | local Timer = class("Timer") 2 | 3 | Timer.times = {} 4 | 5 | function Timer.create(name, func, interval) 6 | if not Timer.times[name] then 7 | Timer.times[name] = cc.Director:getInstance():getScheduler():scheduleScriptFunc(func, interval, false) 8 | end 9 | end 10 | 11 | function Timer.remove(name) 12 | if Timer.times[name] then 13 | cc.Director:getInstance():getScheduler():unscheduleScriptEntry(Timer.times[name]) 14 | Timer.times[name] = nil 15 | end 16 | end 17 | 18 | function Timer.check(name) 19 | return Timer.times[name] ~= nil 20 | end 21 | 22 | -- 下一帧执行 方法 23 | function Timer.onFrameNext(func) 24 | 25 | local director = cc.Director:getInstance() 26 | local delay = director:getAnimationInterval() 27 | 28 | return Timer.createOnce(func, delay) 29 | end 30 | 31 | 32 | function Timer.createOnce (func, delay) 33 | 34 | local director = cc.Director:getInstance() 35 | 36 | local timeHandler = nil 37 | timeHandler = director:getScheduler():scheduleScriptFunc(function() 38 | func() 39 | director:getScheduler():unscheduleScriptEntry(timeHandler) 40 | 41 | end, delay, false) 42 | 43 | return timeHandler 44 | end 45 | 46 | function Timer.clearImmediately(timerHander) 47 | local director = cc.Director:getInstance() 48 | director:getScheduler():unscheduleScriptEntry(timeHandler) 49 | end 50 | 51 | return Timer 52 | -------------------------------------------------------------------------------- /src/widgets/Tips.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | 说明: tips 3 | 作者: 蒋明明 4 | 日期: 2015-4-23 5 | 6 | usage: 7 | qy.Widget.Toast.make("内容", 1, cc.p(480, 320)):show() 8 | ]] 9 | 10 | local Tips = qy.View.Base.extend("Tips", "widget/Tips") 11 | 12 | function Tips:ctor() 13 | Tips.super.ctor(self) 14 | 15 | self:InjectView("Name") 16 | self:InjectView("Desc") 17 | 18 | self.Desc:getVirtualRenderer():setLineHeight(22) 19 | self.Desc:fixSize(cc.size(280, 50)) 20 | end 21 | 22 | function Tips.make(name, desc, node, forward) 23 | local tips = qy.App.runningScene.tips 24 | tips.Name:setString(qy.I18N.getString(name) or name) 25 | tips.Desc:setString(qy.I18N.getString(desc) or desc) 26 | 27 | local position = node:getParent():convertToWorldSpace(cc.p(node:getPositionX(),node:getPositionY())) 28 | 29 | position.x = position.x + 350 > display.width and display.width - 350 or position.x 30 | 31 | local finalPosition = not forward and cc.p(position.x + 25, position.y - 30) or forward == "up" and cc.p(position.x - 25, position.y + 30) or cc.p(position.x + 25, position.y - 30) 32 | tips:setPosition(finalPosition) 33 | return tips 34 | end 35 | 36 | function Tips:show() 37 | self:setVisible(true) 38 | self:setOpacity(0) 39 | self:runAction(cc.FadeIn:create(0.2)) 40 | end 41 | 42 | function Tips:hide() 43 | self:runAction(cc.FadeOut:create(0.2)) 44 | self:setVisible(false) 45 | end 46 | 47 | return Tips -------------------------------------------------------------------------------- /src/cocos/extension/DeprecatedExtensionFunc.lua: -------------------------------------------------------------------------------- 1 | if nil == cc.Control then 2 | return 3 | end 4 | 5 | --tip 6 | local function deprecatedTip(old_name,new_name) 7 | print("\n********** \n"..old_name.." was deprecated please use ".. new_name .. " instead.\n**********") 8 | end 9 | 10 | --functions of CCControl will be deprecated end 11 | local CCControlDeprecated = { } 12 | function CCControlDeprecated.addHandleOfControlEvent(self,func,controlEvent) 13 | deprecatedTip("addHandleOfControlEvent","registerControlEventHandler") 14 | print("come in addHandleOfControlEvent") 15 | self:registerControlEventHandler(func,controlEvent) 16 | end 17 | CCControl.addHandleOfControlEvent = CCControlDeprecated.addHandleOfControlEvent 18 | --functions of CCControl will be deprecated end 19 | 20 | --Enums of CCTableView will be deprecated begin 21 | CCTableView.kTableViewScroll = cc.SCROLLVIEW_SCRIPT_SCROLL 22 | CCTableView.kTableViewZoom = cc.SCROLLVIEW_SCRIPT_ZOOM 23 | CCTableView.kTableCellTouched = cc.TABLECELL_TOUCHED 24 | CCTableView.kTableCellSizeForIndex = cc.TABLECELL_SIZE_FOR_INDEX 25 | CCTableView.kTableCellSizeAtIndex = cc.TABLECELL_SIZE_AT_INDEX 26 | CCTableView.kNumberOfCellsInTableView = cc.NUMBER_OF_CELLS_IN_TABLEVIEW 27 | --Enums of CCTableView will be deprecated end 28 | 29 | --Enums of CCScrollView will be deprecated begin 30 | CCScrollView.kScrollViewScroll = cc.SCROLLVIEW_SCRIPT_SCROLL 31 | CCScrollView.kScrollViewZoom = cc.SCROLLVIEW_SCRIPT_ZOOM 32 | --Enums of CCScrollView will be deprecated end 33 | -------------------------------------------------------------------------------- /src/cocos/extension/DeprecatedExtensionEnum.lua: -------------------------------------------------------------------------------- 1 | if nil == cc.Control then 2 | return 3 | end 4 | 5 | _G.kCCControlStepperPartMinus = cc.CONTROL_STEPPER_PART_MINUS 6 | _G.kCCControlStepperPartPlus = cc.CONTROL_STEPPER_PART_PLUS 7 | _G.kCCControlStepperPartNone = cc.CONTROL_STEPPER_PART_NONE 8 | 9 | _G.CCControlEventTouchDown = cc.CONTROL_EVENTTYPE_TOUCH_DOWN 10 | _G.CCControlEventTouchDragInside = cc.CONTROL_EVENTTYPE_DRAG_INSIDE 11 | _G.CCControlEventTouchDragOutside = cc.CONTROL_EVENTTYPE_DRAG_OUTSIDE 12 | _G.CCControlEventTouchDragEnter = cc.CONTROL_EVENTTYPE_DRAG_ENTER 13 | _G.CCControlEventTouchDragExit = cc.CONTROL_EVENTTYPE_DRAG_EXIT 14 | _G.CCControlEventTouchUpInside = cc.CONTROL_EVENTTYPE_TOUCH_UP_INSIDE 15 | _G.CCControlEventTouchUpOutside = cc.CONTROL_EVENTTYPE_TOUCH_UP_OUTSIDE 16 | _G.CCControlEventTouchCancel = cc.CONTROL_EVENTTYPE_TOUCH_CANCEL 17 | _G.CCControlEventValueChanged = cc.CONTROL_EVENTTYPE_VALUE_CHANGED 18 | _G.CCControlStateNormal = cc.CONTROL_STATE_NORMAL 19 | _G.CCControlStateHighlighted = cc.CONTROL_STATE_HIGH_LIGHTED 20 | _G.CCControlStateDisabled = cc.CONTROL_STATE_DISABLED 21 | _G.CCControlStateSelected = cc.CONTROL_STATE_SELECTED 22 | 23 | _G.kCCScrollViewDirectionHorizontal = cc.SCROLLVIEW_DIRECTION_HORIZONTAL 24 | _G.kCCScrollViewDirectionVertical = cc.SCROLLVIEW_DIRECTION_VERTICAL 25 | _G.kCCTableViewFillTopDown = cc.TABLEVIEW_FILL_TOPDOWN 26 | _G.kCCTableViewFillBottomUp = cc.TABLEVIEW_FILL_BOTTOMUP 27 | -------------------------------------------------------------------------------- /src/scenes/BattleScene.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | 3 | ]] 4 | 5 | -- local BattleScene = class("BattleScene", function() 6 | -- return qy.Scene.Base.new() 7 | -- end) 8 | 9 | local BattleScene = class("BattleScene", qy.Scene.Base) 10 | 11 | function BattleScene:ctor() 12 | -- local label = cc.Label:createWithSystemFont("战斗场景","",30) 13 | -- label:setPosition(480,320) 14 | -- self:addChild(label) 15 | 16 | -- local battle = require("game.gameLayer.battle.Battle").new() 17 | 18 | -- print(battle.battleData.name) 19 | 20 | -- self:addChild(battle) 21 | -- qy.Manager.Guide:registerContainer(self) 22 | BattleScene.super.ctor(self) 23 | self:push(qy.Controller.Battle.new()) 24 | end 25 | 26 | function BattleScene:onEnter() 27 | BattleScene.super.onEnter(self) 28 | 29 | self.listener = qy.Event.add(qy.Event.USER_LEVEL_CHANGED, function(event) 30 | if qy.Model.User.info.level_:get() > 1 then 31 | qy.M.playEffect("UI2.mp3") 32 | qy.Dialog.UserUpgrade.new():show() 33 | end 34 | end) 35 | 36 | self.listener_2 = qy.Event.add(qy.Model.Name.Event.IsEmpty, function() 37 | qy.Dialog.Name.new(qy.Model.User.info.name_:get()):show() 38 | end) 39 | 40 | -- 只有在初始引导的时候才会进入 41 | if qy.IS_NEW and qy.Manager.Guide.step == 1 then 42 | qy.Manager.Guide:start() 43 | end 44 | end 45 | 46 | function BattleScene:onExit() 47 | BattleScene.super.onExit(self) 48 | 49 | qy.Event.remove(self.listener) 50 | qy.Event.remove(self.listener_2) 51 | end 52 | 53 | return BattleScene -------------------------------------------------------------------------------- /src/cocos/framework/extends/UIPageView.lua: -------------------------------------------------------------------------------- 1 | 2 | --[[ 3 | 4 | Copyright (c) 2011-2014 chukong-inc.com 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | 24 | ]] 25 | 26 | local PageView = ccui.PageView 27 | 28 | function PageView:onEvent(callback) 29 | self:addEventListener(function(sender, eventType) 30 | local event = {} 31 | if eventType == 0 then 32 | event.name = "TURNING" 33 | end 34 | event.target = sender 35 | callback(event) 36 | end) 37 | return self 38 | end 39 | -------------------------------------------------------------------------------- /src/cocos/framework/extends/UISlider.lua: -------------------------------------------------------------------------------- 1 | 2 | --[[ 3 | 4 | Copyright (c) 2011-2014 chukong-inc.com 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | 24 | ]] 25 | 26 | local Slider = ccui.Slider 27 | 28 | function Slider:onEvent(callback) 29 | self:addEventListener(function(sender, eventType) 30 | local event = {} 31 | if eventType == 0 then 32 | event.name = "ON_PERCENTAGE_CHANGED" 33 | end 34 | event.target = sender 35 | callback(event) 36 | end) 37 | return self 38 | end 39 | -------------------------------------------------------------------------------- /config.json: -------------------------------------------------------------------------------- 1 | { 2 | "init_cfg":{ 3 | "isLandscape": false, 4 | "isWindowTop": false, 5 | "name": "cocos_lua_lib", 6 | "width": 640, 7 | "height": 960, 8 | "entry": "src/main.lua", 9 | "consolePort": 6050, 10 | "uploadPort": 6060 11 | }, 12 | "simulator_screen_size": [ 13 | { 14 | "title": "iPhone 3Gs (480x320)", 15 | "width": 320, 16 | "height": 480 17 | }, 18 | { 19 | "title": "iPhone 4 (960x640)", 20 | "width": 640, 21 | "height": 960 22 | }, 23 | { 24 | "title": "iPhone 5 (1136x640)", 25 | "width": 640, 26 | "height": 1136 27 | }, 28 | { 29 | "title": "iPad (1024x768)", 30 | "width": 768, 31 | "height": 1024 32 | }, 33 | { 34 | "title": "iPad Retina (2048x1536)", 35 | "width": 1536, 36 | "height": 2048 37 | }, 38 | { 39 | "title": "Android (800x480)", 40 | "width": 400, 41 | "height": 800 42 | }, 43 | { 44 | "title": "Android (854x480)", 45 | "width": 480, 46 | "height": 854 47 | }, 48 | { 49 | "title": "Android (1280x720)", 50 | "width": 720, 51 | "height": 1280 52 | }, 53 | { 54 | "title": "Android (1920x1080)", 55 | "width": 1080, 56 | "height": 1920 57 | } 58 | ] 59 | } 60 | -------------------------------------------------------------------------------- /frameworks/runtime-src/proj.ios_mac/ios/RootViewController.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | Copyright (c) 2010-2011 cocos2d-x.org 3 | Copyright (c) 2010 Ricardo Quesada 4 | 5 | http://www.cocos2d-x.org 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in 15 | all copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | THE SOFTWARE. 24 | ****************************************************************************/ 25 | 26 | #import 27 | 28 | 29 | @interface RootViewController : UIViewController { 30 | 31 | } 32 | - (BOOL)prefersStatusBarHidden; 33 | @end 34 | -------------------------------------------------------------------------------- /src/scenes/BaseScene.lua: -------------------------------------------------------------------------------- 1 | 2 | local BaseScene = class("BaseScene", cc.Scene) 3 | 4 | function BaseScene:ctor() 5 | print("BaseScene:ctor") 6 | 7 | self._viewStack = app.core.ViewStack.new() 8 | self._viewStack:addTo(self) 9 | 10 | self._popupContainer = cc.Node:create() 11 | self._popupContainer:setLocalZOrder(10) 12 | self._popupContainer:addTo(self) 13 | 14 | self._loading = app.Loading.new() 15 | self._loading:setLocalZOrder(20) 16 | self._loading:addTo(self) 17 | 18 | self._toast = cc.Node:create() 19 | self._toast:setLocalZOrder(30) 20 | self._toast:addTo(self) 21 | 22 | 23 | self:registerScriptHandler(function(event) 24 | if event == "enter" then 25 | self:onEnter() 26 | elseif event == "exit" then 27 | self:onExit() 28 | end 29 | end) 30 | end 31 | 32 | function BaseScene:getPopContainer() 33 | return self._popupContainer 34 | end 35 | 36 | function BaseScene:getToastContainer() 37 | return self._toast 38 | end 39 | 40 | function BaseScene:getLoading() 41 | return self._loading 42 | end 43 | 44 | function BaseScene:push(layer) 45 | self._viewStack:push(layer) 46 | end 47 | 48 | function BaseScene:pop() 49 | self._viewStack:pop() 50 | end 51 | 52 | function BaseScene:replace(layer) 53 | self._viewStack:replace(layer) 54 | end 55 | 56 | function BaseScene:popToRoot() 57 | self._viewStack:popToRoot() 58 | end 59 | 60 | function BaseScene:onEnter() 61 | end 62 | 63 | function BaseScene:onExit() 64 | end 65 | 66 | function BaseScene:onCleanup() 67 | end 68 | 69 | return BaseScene 70 | -------------------------------------------------------------------------------- /src/cocos/framework/extends/UICheckBox.lua: -------------------------------------------------------------------------------- 1 | 2 | --[[ 3 | 4 | Copyright (c) 2011-2014 chukong-inc.com 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | 24 | ]] 25 | 26 | local CheckBox = ccui.CheckBox 27 | 28 | function CheckBox:onEvent(callback) 29 | self:addEventListener(function(sender, eventType) 30 | local event = {} 31 | if eventType == 0 then 32 | event.name = "selected" 33 | else 34 | event.name = "unselected" 35 | end 36 | event.target = sender 37 | callback(event) 38 | end) 39 | return self 40 | end 41 | -------------------------------------------------------------------------------- /src/cocos/framework/extends/UIEditBox.lua: -------------------------------------------------------------------------------- 1 | 2 | --[[ 3 | 4 | Copyright (c) 2011-2014 chukong-inc.com 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | 24 | ]] 25 | 26 | local EditBox = ccui.EditBox 27 | 28 | function EditBox:onEditHandler(callback) 29 | self:registerScriptEditBoxHandler(function(name, sender) 30 | local event = {} 31 | event.name = name 32 | event.target = sender 33 | callback(event) 34 | end) 35 | return self 36 | end 37 | 38 | function EditBox:removeEditHandler() 39 | self:unregisterScriptEditBoxHandler() 40 | return self 41 | end 42 | -------------------------------------------------------------------------------- /frameworks/runtime-src/proj.win32/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by game.rc 4 | // 5 | #define IDS_PROJNAME 100 6 | #define IDR_TESTLUA 100 7 | #define IDR_MENU_COCOS 201 8 | #define IDD_DIALOG1 202 9 | #define IDD_DIALOG_ABOUT 202 10 | #define IDC_ABOUT_TITLE 1000 11 | #define IDC_EDIT2 1001 12 | #define IDC_ABOUT_VERSION 1001 13 | #define ID_VIEW_SIZE 30001 14 | #define ID_FILE_NEW_WINDOW 32771 15 | #define ID_VIEW_PORTRAIT 32775 16 | #define ID_VIEW_LANDSCAPE 32776 17 | #define ID_VIEW_CUSTOM 32777 18 | #define ID_HELP_ABOUT 32778 19 | #define ID_FILE_EXIT 32779 20 | #define ID_Menu 32780 21 | #define ID_Menu32781 32781 22 | #define ID_TEST_RESET 32782 23 | #define ID_CONTROL 32783 24 | #define ID_CONTROL_RELOAD 32784 25 | #define ID_VIEW_ZOOMOUT100 32785 26 | #define ID_VIEW_ZOOMOUT75 32786 27 | #define ID_VIEW_ZOOMOUT50 32787 28 | #define ID_VIEW_ZOOMOUT25 32788 29 | #define ID_CONTROL_TOP 32793 30 | 31 | // Next default values for new objects 32 | // 33 | #ifdef APSTUDIO_INVOKED 34 | #ifndef APSTUDIO_READONLY_SYMBOLS 35 | #define _APS_NEXT_RESOURCE_VALUE 201 36 | #define _APS_NEXT_COMMAND_VALUE 32794 37 | #define _APS_NEXT_CONTROL_VALUE 1002 38 | #define _APS_NEXT_SYMED_VALUE 101 39 | #endif 40 | #endif 41 | -------------------------------------------------------------------------------- /frameworks/runtime-src/proj.ios_mac/ios/AppController.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | Copyright (c) 2010-2013 cocos2d-x.org 3 | Copyright (c) 2013-2014 Chukong Technologies Inc. 4 | 5 | http://www.cocos2d-x.org 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in 15 | all copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | THE SOFTWARE. 24 | ****************************************************************************/ 25 | 26 | @class RootViewController; 27 | 28 | @interface AppController : NSObject 29 | { 30 | UIWindow *window; 31 | RootViewController *viewController; 32 | } 33 | 34 | @end 35 | 36 | -------------------------------------------------------------------------------- /src/widgets/FormLayout.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | 说明: 窗体布局 3 | 作者: 林国锋 4 | 日期: 2014-11-22 5 | ]] 6 | 7 | local FormLayout = qy.View.Base.extend("FormLayout", "widget/FormLayout") 8 | 9 | --[[ 10 | size: 大小 11 | 12 | qy.Widget.FormLayout.new({ 13 | size = {400, 400}, 14 | }) 15 | ]] 16 | 17 | function FormLayout:ctor(params) 18 | FormLayout.super.ctor(self) 19 | 20 | -- 内容区 21 | self:InjectView("Content") 22 | self:InjectView("Shadow_top") 23 | self:InjectView("Shadow_down") 24 | self:InjectView("Frame") 25 | self:InjectView("Close") 26 | 27 | self._params = params 28 | 29 | -- 默认大小 30 | self._size = cc.size(params.size[1] or 400, params.size[2] or 400) 31 | 32 | self:_onSizeChanged() 33 | end 34 | 35 | -- 大小改变 36 | function FormLayout:_onSizeChanged() 37 | -- 内容区 38 | self.Content:setContentSize(self._size) 39 | 40 | self.Frame:setContentSize(self._size.width + 24, self._size.height + 24) 41 | 42 | self.Shadow_top:setPositionY(self._size.height + 18) 43 | self.Shadow_top:setContentSize(self._size.width + 4, 33) 44 | 45 | self.Shadow_down:setContentSize(self._size.width + 4, 33) 46 | 47 | self.Close:setPosition(cc.p(self._size.width + 24, self._size.height + 16)) 48 | self.Close:setVisible(false) 49 | end 50 | 51 | -- 显示关闭按钮 52 | function FormLayout:showCloseButton(callback) 53 | self.Close:setVisible(true) 54 | self:OnClick(self.Close, callback) 55 | end 56 | 57 | function FormLayout:getSize() 58 | return self._size 59 | end 60 | 61 | function FormLayout:setShadowVisible(visible) 62 | self.Shadow_top:setVisible(visible) 63 | self.Shadow_down:setVisible(visible) 64 | end 65 | 66 | return FormLayout -------------------------------------------------------------------------------- /src/cocos/framework/extends/UIWidget.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | 3 | Copyright (c) 2011-2014 chukong-inc.com 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | 23 | ]] 24 | 25 | local Widget = ccui.Widget 26 | 27 | function Widget:onTouch(callback) 28 | self:addTouchEventListener(function(sender, state) 29 | local event = {x = 0, y = 0} 30 | if state == 0 then 31 | event.name = "began" 32 | elseif state == 1 then 33 | event.name = "moved" 34 | elseif state == 2 then 35 | event.name = "ended" 36 | else 37 | event.name = "cancelled" 38 | end 39 | event.target = sender 40 | callback(event) 41 | end) 42 | return self 43 | end 44 | -------------------------------------------------------------------------------- /frameworks/runtime-src/proj.win32/SimulatorWin.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "stdafx.h" 4 | #include "Resource.h" 5 | #include "cocos2d.h" 6 | #include "AppDelegate.h" 7 | #include "ProjectConfig/ProjectConfig.h" 8 | #include "ProjectConfig/SimulatorConfig.h" 9 | 10 | class SimulatorWin 11 | { 12 | public: 13 | static SimulatorWin *getInstance(); 14 | virtual ~SimulatorWin(); 15 | int run(); 16 | 17 | virtual void quit(); 18 | virtual void relaunch(); 19 | virtual void openNewPlayer(); 20 | virtual void openNewPlayerWithProjectConfig(const ProjectConfig &config); 21 | virtual void openProjectWithProjectConfig(const ProjectConfig &config); 22 | 23 | virtual int getPositionX(); 24 | virtual int getPositionY(); 25 | protected: 26 | SimulatorWin(); 27 | 28 | static SimulatorWin *_instance; 29 | ProjectConfig _project; 30 | HWND _hwnd; 31 | HWND _hwndConsole; 32 | AppDelegate *_app; 33 | FILE *_writeDebugLogFile; 34 | 35 | // 36 | void setupUI(); 37 | void setZoom(float frameScale); 38 | void updateWindowTitle(); 39 | 40 | // debug log 41 | void writeDebugLog(const char *log); 42 | void parseCocosProjectConfig(ProjectConfig &config); 43 | 44 | // 45 | void onOpenFile(const std::string &filePath); 46 | void onOpenProjectFolder(const std::string &folderPath); 47 | void onDrop(const std::string &path); 48 | 49 | // helper 50 | std::string convertPathFormatToUnixStyle(const std::string& path); 51 | std::string getUserDocumentPath(); 52 | std::string getApplicationExePath(); 53 | std::string getApplicationPath(); 54 | static char* convertTCharToUtf8(const TCHAR* src); 55 | 56 | static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); 57 | }; 58 | 59 | -------------------------------------------------------------------------------- /src/widgets/PropsIcon.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | 通用道具ICON 3 | ]] 4 | 5 | local PropsIcon = qy.View.Base.extend("PropsIcon", "widget/PropsIcon") 6 | 7 | function PropsIcon:ctor(data, isShowName) 8 | PropsIcon.super.ctor(self) 9 | 10 | local nums = nil -- 个数 11 | ---------------- 12 | -- 读取本地数据表 13 | local localTable = qy.Helper.static.hero 14 | local tag = nil 15 | if type(data) == "table" then 16 | tag = data.tag 17 | elseif type(data) == "string" then 18 | tag = data 19 | end 20 | 21 | local oneData = localTable[tostring(tag)] 22 | 23 | ---------------- 24 | -- 渲染UI 25 | self:InjectView("daoju") 26 | self:InjectView("daojuBox") 27 | self:InjectView("nums") 28 | self:InjectView("name") 29 | 30 | if data.num == nil or data.num == 1 then 31 | nums = 1 32 | else 33 | nums = data.num 34 | end 35 | 36 | local quality = oneData.quality 37 | if oneData.type ~= "tool" then 38 | quality = 1 39 | end 40 | 41 | self.types = oneData.type 42 | self.quality = quality 43 | self.nameStr = qy.I18N.getString(oneData.name) 44 | self.id = data.tag 45 | 46 | local tag = tonumber(data.tag) > 70000 and tonumber(data.tag) - 70000 or tonumber(data.tag) > 8000 and tonumber(data.tag) - 2000 or data.tag 47 | self.daoju:setSpriteFrame("Resources/common/icon/" .. tag .. ".jpg") 48 | local spStr = string.format("Resources/common/icon/frame_item_%d.png", quality) 49 | self.daojuBox:setSpriteFrame(spStr) 50 | self.nums:setString(nums) 51 | self.name:setString(self.nameStr) 52 | if tonumber(tag) < 5000 then 53 | self.daoju:setScale(86/self.daoju:getContentSize().width) 54 | end 55 | if not isShowName then 56 | self.name:setVisible(false) 57 | end 58 | end 59 | 60 | return PropsIcon -------------------------------------------------------------------------------- /src/cocos/framework/extends/UITextField.lua: -------------------------------------------------------------------------------- 1 | 2 | --[[ 3 | 4 | Copyright (c) 2011-2014 chukong-inc.com 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | 24 | ]] 25 | 26 | local TextField = ccui.TextField 27 | 28 | function TextField:onEvent(callback) 29 | self:addEventListener(function(sender, eventType) 30 | local event = {} 31 | if eventType == 0 then 32 | event.name = "ATTACH_WITH_IME" 33 | elseif eventType == 1 then 34 | event.name = "DETACH_WITH_IME" 35 | elseif eventType == 2 then 36 | event.name = "INSERT_TEXT" 37 | elseif eventType == 3 then 38 | event.name = "DELETE_BACKWARD" 39 | end 40 | event.target = sender 41 | callback(event) 42 | end) 43 | return self 44 | end 45 | -------------------------------------------------------------------------------- /frameworks/runtime-src/proj.android/src/org/cocos2dx/lib/Cocos2dxLuaJavaBridge.java: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | Copyright (c) 2013-2014 Chukong Technologies Inc. 3 | 4 | http://www.cocos2d-x.org 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | ****************************************************************************/ 24 | 25 | package org.cocos2dx.lib; 26 | 27 | public class Cocos2dxLuaJavaBridge 28 | { 29 | public static native int callLuaFunctionWithString(int luaFunctionId, String value); 30 | public static native int callLuaGlobalFunctionWithString(String luaFunctionName, String value); 31 | public static native int retainLuaFunction(int luaFunctionId); 32 | public static native int releaseLuaFunction(int luaFunctionId); 33 | } 34 | -------------------------------------------------------------------------------- /cocosstudio/cocosstudio/csd/theme_1/IconSkin.csd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /src/core/ViewStack.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | 说明: 视图栈, 用于先入后出的方式管理视图 3 | 作者: 林国锋 4 | 日期: 2014-11-11 5 | ]] 6 | 7 | local ViewStack = class("ViewStack", app.V) 8 | 9 | function ViewStack:ctor() 10 | ViewStack.super.ctor(self) 11 | 12 | self._views = {} 13 | end 14 | 15 | -- 压入一个视图, 原来正在显示的视图将被暂时移除 16 | function ViewStack:push(view, cleanup) 17 | if view then 18 | self:removeAllChildren(cleanup == nil and true or cleanup) 19 | 20 | view:retain() 21 | table.insert(self._views, view) 22 | self:addChild(view) 23 | end 24 | end 25 | 26 | -- 弹窗一个视图, 之前被临时移除的视图会重新被显示 27 | function ViewStack:pop() 28 | local view = table.remove(self._views) 29 | if view then 30 | view:release() 31 | self:removeChild(view) 32 | 33 | view = self:currentView() 34 | if view then 35 | self:addChild(view) 36 | end 37 | end 38 | end 39 | 40 | -- 替换当前视图为view, 被替换的视图将被永久删除 41 | function ViewStack:replace(view) 42 | if view then 43 | -- 删除当前视图 44 | local oldview = table.remove(self._views) 45 | if oldview then 46 | oldview:release() 47 | self:removeChild(oldview) 48 | end 49 | -- 替换成新的视图 50 | view:retain() 51 | table.insert(self._views, view) 52 | self:addChild(view) 53 | end 54 | end 55 | 56 | -- 弹出所有视图, 除了第一个 57 | function ViewStack:popToRoot() 58 | local view = self._views[1] 59 | self:removeAllChildren() 60 | self:push(view) 61 | self._views = {} 62 | table.insert(self._views, view) 63 | end 64 | 65 | function ViewStack:clean() 66 | self:removeAllChildren() 67 | self._views = {} 68 | end 69 | 70 | -- 获取当前正在显示的视图 71 | function ViewStack:currentView() 72 | return self._views[#self._views] 73 | end 74 | 75 | function ViewStack:size() 76 | return #self._views 77 | end 78 | 79 | return ViewStack 80 | -------------------------------------------------------------------------------- /src/widgets/ViewStack.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | 说明: 视图栈, 用于先入后出的方式管理视图 3 | 作者: 林国锋 4 | 日期: 2014-11-11 5 | ]] 6 | 7 | local ViewStack = class("ViewStack", qy.View.Base) 8 | 9 | function ViewStack:ctor() 10 | ViewStack.super.ctor(self) 11 | 12 | self._views = {} 13 | end 14 | 15 | -- 压入一个视图, 原来正在显示的视图将被暂时移除 16 | function ViewStack:push(view, cleanup) 17 | if view then 18 | self:removeAllChildren(cleanup == nil and true or cleanup) 19 | 20 | view:retain() 21 | table.insert(self._views, view) 22 | self:addChild(view) 23 | end 24 | end 25 | 26 | -- 弹窗一个视图, 之前被临时移除的视图会重新被显示 27 | function ViewStack:pop() 28 | local view = table.remove(self._views) 29 | if view then 30 | view:release() 31 | self:removeChild(view) 32 | 33 | view = self:currentView() 34 | if view then 35 | self:addChild(view) 36 | end 37 | end 38 | end 39 | 40 | -- 替换当前视图为view, 被替换的视图将被永久删除 41 | function ViewStack:replace(view) 42 | if view then 43 | -- 删除当前视图 44 | local oldview = table.remove(self._views) 45 | if oldview then 46 | oldview:release() 47 | self:removeChild(oldview) 48 | end 49 | -- 替换成新的视图 50 | view:retain() 51 | table.insert(self._views, view) 52 | self:addChild(view) 53 | end 54 | end 55 | 56 | -- 弹出所有视图, 除了第一个 57 | function ViewStack:popToRoot() 58 | local view = self._views[1] 59 | self:removeAllChildren() 60 | self:push(view) 61 | self._views = {} 62 | table.insert(self._views, view) 63 | end 64 | 65 | function ViewStack:clean() 66 | self:removeAllChildren() 67 | self._views = {} 68 | end 69 | 70 | -- 获取当前正在显示的视图 71 | function ViewStack:currentView() 72 | return self._views[#self._views] 73 | end 74 | 75 | function ViewStack:size() 76 | return #self._views 77 | end 78 | 79 | return ViewStack -------------------------------------------------------------------------------- /src/widgets/Toast.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | 说明: 提示小浮层 3 | 作者: 林国锋 4 | 日期: 2014-12-23 5 | 6 | usage: 7 | qy.Widget.Toast.make("内容", 1, cc.p(480, 320)):show() 8 | ]] 9 | 10 | local Toast = class("Toast", app.V) 11 | 12 | Toast.style = { 13 | ["skin"] = app.config.Theme .. ".ToastSkin" 14 | } 15 | 16 | function Toast:ctor() 17 | Toast.super.ctor(self) 18 | 19 | self:addCSB(self.style.skin) 20 | 21 | self:InjectView("Img_frame") 22 | self:InjectView("Text_title") 23 | 24 | self:setOpacity(0) 25 | end 26 | 27 | function Toast:setDuration(duration) 28 | self.duration = duration 29 | end 30 | 31 | function Toast:setTitle(title) 32 | self.Text_title:setString(title) 33 | local size = self.Text_title:getContentSize() 34 | self.Img_frame:setContentSize(cc.size(size.width + 20, math.max(size.height + 20, 40))) 35 | end 36 | 37 | function Toast:show() 38 | local originpos = cc.p(self:getPosition()) 39 | self:setOpacity(0) 40 | self:setPosition(originpos.x, originpos.y - 50) 41 | self:stopAllActions() 42 | self:runAction(cc.Sequence:create( 43 | cc.Spawn:create( 44 | cc.MoveTo:create(0.2, originpos), 45 | cc.FadeIn:create(0.16) 46 | ), 47 | cc.DelayTime:create(self.duration), 48 | cc.Spawn:create( 49 | cc.MoveTo:create(0.2, cc.p(originpos.x, originpos.y + 50)), 50 | cc.FadeOut:create(0.3) 51 | ), 52 | cc.CallFunc:create(function() 53 | self:removeFromParent() 54 | end) 55 | )) 56 | end 57 | 58 | -- title: 显示的内容 59 | -- duration: 显示多长时间, 默认为1.5秒 60 | -- position: 在屏幕的位置, 默认屏幕中心 61 | function Toast.make(title, duration, position) 62 | local toast = Toast.new() 63 | toast:setTitle(title) 64 | toast:setDuration(duration or 1.5) 65 | toast:setPosition(position or cc.p(display.cx, display.height * 0.78)) 66 | toast:show() 67 | 68 | display:getRunningScene():getToastContainer():addChild(toast) 69 | 70 | end 71 | 72 | return Toast 73 | -------------------------------------------------------------------------------- /src/cocos/cocos2d/bitExtend.lua: -------------------------------------------------------------------------------- 1 | -- bit operation 2 | 3 | bit = bit or {} 4 | bit.data32 = {} 5 | 6 | for i=1,32 do 7 | bit.data32[i]=2^(32-i) 8 | end 9 | 10 | function bit._b2d(arg) 11 | local nr=0 12 | for i=1,32 do 13 | if arg[i] ==1 then 14 | nr=nr+bit.data32[i] 15 | end 16 | end 17 | return nr 18 | end 19 | 20 | function bit._d2b(arg) 21 | arg = arg >= 0 and arg or (0xFFFFFFFF + arg + 1) 22 | local tr={} 23 | for i=1,32 do 24 | if arg >= bit.data32[i] then 25 | tr[i]=1 26 | arg=arg-bit.data32[i] 27 | else 28 | tr[i]=0 29 | end 30 | end 31 | return tr 32 | end 33 | 34 | function bit._and(a,b) 35 | local op1=bit._d2b(a) 36 | local op2=bit._d2b(b) 37 | local r={} 38 | 39 | for i=1,32 do 40 | if op1[i]==1 and op2[i]==1 then 41 | r[i]=1 42 | else 43 | r[i]=0 44 | end 45 | end 46 | return bit._b2d(r) 47 | 48 | end 49 | 50 | function bit._rshift(a,n) 51 | local op1=bit._d2b(a) 52 | n = n <= 32 and n or 32 53 | n = n >= 0 and n or 0 54 | 55 | for i=32, n+1, -1 do 56 | op1[i] = op1[i-n] 57 | end 58 | for i=1, n do 59 | op1[i] = 0 60 | end 61 | 62 | return bit._b2d(op1) 63 | end 64 | 65 | function bit._not(a) 66 | local op1=bit._d2b(a) 67 | local r={} 68 | 69 | for i=1,32 do 70 | if op1[i]==1 then 71 | r[i]=0 72 | else 73 | r[i]=1 74 | end 75 | end 76 | return bit._b2d(r) 77 | end 78 | 79 | function bit._or(a,b) 80 | local op1=bit._d2b(a) 81 | local op2=bit._d2b(b) 82 | local r={} 83 | 84 | for i=1,32 do 85 | if op1[i]==1 or op2[i]==1 then 86 | r[i]=1 87 | else 88 | r[i]=0 89 | end 90 | end 91 | return bit._b2d(r) 92 | end 93 | 94 | bit.band = bit.band or bit._and 95 | bit.rshift = bit.rshift or bit._rshift 96 | bit.bnot = bit.bnot or bit._not 97 | -------------------------------------------------------------------------------- /src/widgets/SigninIcon.lua: -------------------------------------------------------------------------------- 1 | 2 | local SigninIcon = qy.View.Base.extend("SigninIcon", "modules.signin.Icon") 3 | 4 | function SigninIcon:ctor(delegate) 5 | SigninIcon.super.ctor(self) 6 | 7 | self:InjectCustomView("UI_icon", qy.Widget.Icon, delegate) 8 | 9 | self:InjectView("reciver") 10 | self:InjectView("alreadyGet") 11 | self:InjectView("vip") 12 | self:InjectView("Img_vip") 13 | self:InjectView("Bg") 14 | self:InjectView("Bg3") 15 | self.Bg:setSwallowTouches(false) 16 | self.reciver:setSwallowTouches(false) 17 | self:setDone(false) 18 | end 19 | 20 | -- 21 | function SigninIcon:setData(item) 22 | local rewardData = item.reward_:get() 23 | local reward = qy.Model.Backpack:getById(rewardData[1].tag) 24 | local icon = reward:iconEntity() 25 | 26 | self.UI_icon:setData(icon) 27 | self.UI_icon.Text_num:setString("X" .. rewardData[1].num) 28 | 29 | self:setEnableAward(item.enable_:get()) 30 | self:setVip(item.vipData_:get() ~= 0) 31 | self.item = item 32 | self:setDone(item.done_:get()) 33 | if item.vip_:get() > 0 then 34 | self.Img_vip:setTexture("Resources/signIn/pic_num_sign" .. item.vip_:get() .. ".png") 35 | end 36 | end 37 | 38 | -- 是否可签到 39 | function SigninIcon:setEnableAward(flag) 40 | if flag == 2 then 41 | self.Bg3:setVisible(true) 42 | self.Bg3:setBackGroundImage("Resources/signIn/pic_sign_2.jpg") 43 | elseif flag == 1 then 44 | self.Bg3:setVisible(true) 45 | self.Bg3:setBackGroundImage("Resources/signIn/pic_sign_1.jpg") 46 | else 47 | self.Bg3:setVisible(false) 48 | end 49 | end 50 | 51 | -- 更新实体数据 52 | function SigninIcon:setEntityEable(flag) 53 | self.item.enable_:set(flag) 54 | self:setEnableAward(flag) 55 | end 56 | 57 | -- 已经签到 58 | function SigninIcon:setDone(flag) 59 | if self.item then 60 | self.item.done_:set(flag) 61 | end 62 | self.reciver:setVisible(flag) 63 | self.alreadyGet:setVisible(flag) 64 | end 65 | 66 | function SigninIcon:setVip(flag) 67 | self.vip:setVisible(flag) 68 | end 69 | 70 | return SigninIcon -------------------------------------------------------------------------------- /src/utils/functions.lua: -------------------------------------------------------------------------------- 1 | 2 | -- 使用cocos studio导出的lua中Text组件的自定义大小存在bug,暂时使用该方法解决 3 | function ccui.Text:fixSize(size) 4 | self:ignoreContentAdaptWithSize(false) 5 | self:setTextAreaSize(size) 6 | end 7 | 8 | 9 | function ccui.TextField:fixSize(size) 10 | self:ignoreContentAdaptWithSize(false) 11 | self:setTextAreaSize(size) 12 | end 13 | 14 | 15 | 16 | 17 | -- 设置行高 18 | function ccui.Text:setLineHeight(lineHeight) 19 | self:getVirtualRenderer():setLineHeight(lineHeight) 20 | end 21 | 22 | local __setPosition = cc.Node.setPosition 23 | function ccui.TextAtlas:setPosition(x, y) 24 | if type(x) == "table" then 25 | y = x.y 26 | x = x.x 27 | end 28 | __setPosition(self, x, y) 29 | self.__originX = x 30 | end 31 | 32 | function ccui.TextAtlas:setStringWithAnim(text, animated) 33 | local oldnum = self.__oldnum or 0 34 | local newnum = tonumber(text) 35 | self:setString(newnum) 36 | self:setPositionX(self.__originX + self:getContentSize().width / 2.0) 37 | if oldnum ~= 0 then 38 | local addnum = newnum - oldnum 39 | -- 减少时没有动画效果 40 | if addnum > 0 and (animated == nil or animated == true) then 41 | local i = 1 42 | local num = 31 43 | local increment = math.max(math.round(addnum / num), 1) 44 | self:setString(oldnum) 45 | self:runAction(cc.Sequence:create(cc.ScaleTo:create(0.25, 1.35), 46 | cc.ScaleTo:create(0.08, 1.2), 47 | cc.CallFunc:create(function() 48 | self:stopAllActions() 49 | schedule(self, function() 50 | self:setString(math.min(oldnum + i, newnum)) 51 | i = i + increment 52 | if i >= addnum then 53 | self:setString(newnum) 54 | self:stopAllActions() 55 | self:runAction(cc.ScaleTo:create(0.15, 1)) 56 | end 57 | end, 0.01) 58 | end) 59 | )) 60 | end 61 | end 62 | self.__oldnum = newnum 63 | end 64 | -------------------------------------------------------------------------------- /frameworks/runtime-src/proj.android/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | 11 | 13 | 14 | 15 | 17 | 18 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /frameworks/runtime-src/Classes/ide-support/SimpleConfigParser.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "json/document.h" 3 | #include "json/filestream.h" 4 | #include "json/stringbuffer.h" 5 | #include "json/writer.h" 6 | #include "SimpleConfigParser.h" 7 | 8 | // SimpleConfigParser 9 | SimpleConfigParser *SimpleConfigParser::s_sharedSimpleConfigParserInstance = NULL; 10 | SimpleConfigParser *SimpleConfigParser::getInstance(void) 11 | { 12 | if (!s_sharedSimpleConfigParserInstance) 13 | { 14 | s_sharedSimpleConfigParserInstance = new SimpleConfigParser(); 15 | s_sharedSimpleConfigParserInstance->readConfig(); 16 | } 17 | return s_sharedSimpleConfigParserInstance; 18 | } 19 | 20 | void SimpleConfigParser::purge() 21 | { 22 | CC_SAFE_DELETE(s_sharedSimpleConfigParserInstance); 23 | } 24 | 25 | void SimpleConfigParser::readConfig(const string &filepath) 26 | { 27 | string fullPathFile = filepath; 28 | 29 | // read config file 30 | if (fullPathFile.empty()) 31 | { 32 | fullPathFile = FileUtils::getInstance()->fullPathForFilename(CONFIG_FILE); 33 | } 34 | string fileContent = FileUtils::getInstance()->getStringFromFile(fullPathFile); 35 | 36 | if(fileContent.empty()) 37 | return; 38 | 39 | if (_docRootjson.Parse<0>(fileContent.c_str()).HasParseError()) { 40 | cocos2d::log("read json file %s failed because of %s", fullPathFile.c_str(), _docRootjson.GetParseError()); 41 | return; 42 | } 43 | 44 | if (_docRootjson.HasMember("init_cfg")) 45 | { 46 | if(_docRootjson["init_cfg"].IsObject()) 47 | { 48 | const rapidjson::Value& objectInitView = _docRootjson["init_cfg"]; 49 | if (objectInitView.HasMember("isLandscape") && objectInitView["isLandscape"].IsBool()) 50 | { 51 | _isLandscape = objectInitView["isLandscape"].GetBool(); 52 | } 53 | } 54 | } 55 | } 56 | 57 | SimpleConfigParser::SimpleConfigParser(void) : 58 | _isLandscape(true) 59 | { 60 | } 61 | 62 | rapidjson::Document& SimpleConfigParser::getConfigJsonRoot() 63 | { 64 | return _docRootjson; 65 | } 66 | 67 | bool SimpleConfigParser::isLanscape() 68 | { 69 | return _isLandscape; 70 | } 71 | -------------------------------------------------------------------------------- /frameworks/runtime-src/proj.android/src/com/chukong/cocosplay/client/CocosPlayClient.java: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | Copyright (c) 2015 Chukong Technologies Inc. 3 | 4 | http://www.cocos2d-x.org 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | ****************************************************************************/ 24 | package com.chukong.cocosplay.client; 25 | 26 | import android.app.Activity; 27 | 28 | public class CocosPlayClient { 29 | 30 | public static boolean init(Activity activity, boolean isDemo) { 31 | return false; 32 | } 33 | 34 | public static boolean isEnabled() { 35 | return false; 36 | } 37 | 38 | public static boolean isDemo() { 39 | return false; 40 | } 41 | 42 | public static boolean isNotifyFileLoadedEnabled() { 43 | return false; 44 | } 45 | 46 | public static void notifyFileLoaded(String filePath) { 47 | 48 | } 49 | 50 | public static void updateAssets(String filePath) { 51 | 52 | } 53 | 54 | public static String getGameRoot() { 55 | return ""; 56 | } 57 | 58 | public static native String[] getSearchPaths(); 59 | } 60 | -------------------------------------------------------------------------------- /src/cocos/framework/extends/UIScrollView.lua: -------------------------------------------------------------------------------- 1 | 2 | --[[ 3 | 4 | Copyright (c) 2011-2014 chukong-inc.com 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | 24 | ]] 25 | 26 | local ScrollView = ccui.ScrollView 27 | 28 | function ScrollView:onEvent(callback) 29 | self:addEventListener(function(sender, eventType) 30 | local event = {} 31 | if eventType == 0 then 32 | event.name = "SCROLL_TO_TOP" 33 | elseif eventType == 1 then 34 | event.name = "SCROLL_TO_BOTTOM" 35 | elseif eventType == 2 then 36 | event.name = "SCROLL_TO_LEFT" 37 | elseif eventType == 3 then 38 | event.name = "SCROLL_TO_RIGHT" 39 | elseif eventType == 4 then 40 | event.name = "SCROLLING" 41 | elseif eventType == 5 then 42 | event.name = "BOUNCE_TOP" 43 | elseif eventType == 6 then 44 | event.name = "BOUNCE_BOTTOM" 45 | elseif eventType == 7 then 46 | event.name = "BOUNCE_LEFT" 47 | elseif eventType == 8 then 48 | event.name = "BOUNCE_RIGHT" 49 | end 50 | event.target = sender 51 | callback(event) 52 | end) 53 | return self 54 | end 55 | 56 | ScrollView.onScroll = ScrollView.onEvent 57 | -------------------------------------------------------------------------------- /src/cocos/extension/ExtensionConstants.lua: -------------------------------------------------------------------------------- 1 | if nil == cc.Control then 2 | return 3 | end 4 | 5 | cc.CONTROL_STATE_NORMAL = 1 6 | cc.CONTROL_STATE_HIGH_LIGHTED = 2 7 | cc.CONTROL_STATE_DISABLED = 4 8 | cc.CONTROL_STATE_SELECTED = 8 9 | 10 | cc.CONTROL_STEPPER_PART_MINUS = 0 11 | cc.CONTROL_STEPPER_PART_PLUS = 1 12 | cc.CONTROL_STEPPER_PART_NONE = 2 13 | 14 | cc.TABLEVIEW_FILL_TOPDOWN = 0 15 | cc.TABLEVIEW_FILL_BOTTOMUP = 1 16 | 17 | cc.SCROLLVIEW_SCRIPT_SCROLL = 0 18 | cc.SCROLLVIEW_SCRIPT_ZOOM = 1 19 | cc.TABLECELL_TOUCHED = 2 20 | cc.TABLECELL_HIGH_LIGHT = 3 21 | cc.TABLECELL_UNHIGH_LIGHT = 4 22 | cc.TABLECELL_WILL_RECYCLE = 5 23 | cc.TABLECELL_SIZE_FOR_INDEX = 6 24 | cc.TABLECELL_SIZE_AT_INDEX = 7 25 | cc.NUMBER_OF_CELLS_IN_TABLEVIEW = 8 26 | 27 | cc.SCROLLVIEW_DIRECTION_NONE = -1 28 | cc.SCROLLVIEW_DIRECTION_HORIZONTAL = 0 29 | cc.SCROLLVIEW_DIRECTION_VERTICAL = 1 30 | cc.SCROLLVIEW_DIRECTION_BOTH = 2 31 | 32 | cc.CONTROL_EVENTTYPE_TOUCH_DOWN = 1 33 | cc.CONTROL_EVENTTYPE_DRAG_INSIDE = 2 34 | cc.CONTROL_EVENTTYPE_DRAG_OUTSIDE = 4 35 | cc.CONTROL_EVENTTYPE_DRAG_ENTER = 8 36 | cc.CONTROL_EVENTTYPE_DRAG_EXIT = 16 37 | cc.CONTROL_EVENTTYPE_TOUCH_UP_INSIDE = 32 38 | cc.CONTROL_EVENTTYPE_TOUCH_UP_OUTSIDE = 64 39 | cc.CONTROL_EVENTTYPE_TOUCH_CANCEL = 128 40 | cc.CONTROL_EVENTTYPE_VALUE_CHANGED = 256 41 | 42 | cc.EDITBOX_INPUT_MODE_ANY = 0 43 | cc.EDITBOX_INPUT_MODE_EMAILADDR = 1 44 | cc.EDITBOX_INPUT_MODE_NUMERIC = 2 45 | cc.EDITBOX_INPUT_MODE_PHONENUMBER = 3 46 | cc.EDITBOX_INPUT_MODE_URL = 4 47 | cc.EDITBOX_INPUT_MODE_DECIMAL = 5 48 | cc.EDITBOX_INPUT_MODE_SINGLELINE = 6 49 | 50 | cc.EDITBOX_INPUT_FLAG_PASSWORD = 0 51 | cc.EDITBOX_INPUT_FLAG_SENSITIVE = 1 52 | cc.EDITBOX_INPUT_FLAG_INITIAL_CAPS_WORD = 2 53 | cc.EDITBOX_INPUT_FLAG_INITIAL_CAPS_SENTENCE = 3 54 | cc.EDITBOX_INPUT_FLAG_INITIAL_CAPS_ALL_CHARACTERS = 4 55 | 56 | cc.KEYBOARD_RETURNTYPE_DEFAULT = 0 57 | cc.KEYBOARD_RETURNTYPE_DONE = 1 58 | cc.KEYBOARD_RETURNTYPE_SEND = 2 59 | cc.KEYBOARD_RETURNTYPE_SEARCH = 3 60 | cc.KEYBOARD_RETURNTYPE_GO = 4 61 | 62 | cc.ASSETSMANAGER_CREATE_FILE = 0 63 | cc.ASSETSMANAGER_NETWORK = 1 64 | cc.ASSETSMANAGER_NO_NEW_VERSION = 2 65 | cc.ASSETSMANAGER_UNCOMPRESS = 3 66 | 67 | cc.ASSETSMANAGER_PROTOCOL_PROGRESS = 0 68 | cc.ASSETSMANAGER_PROTOCOL_SUCCESS = 1 69 | cc.ASSETSMANAGER_PROTOCOL_ERROR = 2 70 | 71 | -------------------------------------------------------------------------------- /frameworks/runtime-src/proj.ios_mac/mac/SimulatorApp.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | Copyright (c) 2010 cocos2d-x.org 3 | 4 | http://www.cocos2d-x.org 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | ****************************************************************************/ 24 | 25 | 26 | #include 27 | #import 28 | 29 | #import "ConsoleWindowController.h" 30 | #include "ProjectConfig/ProjectConfig.h" 31 | #include "ProjectConfig/SimulatorConfig.h" 32 | #include "AppDelegate.h" 33 | 34 | @interface AppController : NSObject 35 | { 36 | NSWindow *_window; 37 | NSMenu *menu; 38 | 39 | AppDelegate *_app; 40 | ProjectConfig _project; 41 | int _debugLogFile; 42 | std::string _entryPath; 43 | 44 | //log file 45 | ConsoleWindowController *_consoleController; 46 | NSFileHandle *_fileHandle; 47 | 48 | //console pipe 49 | NSPipe *_pipe; 50 | NSFileHandle *_pipeReadHandle; 51 | } 52 | 53 | @property (nonatomic, assign) IBOutlet NSMenu* menu; 54 | 55 | -(BOOL)application:(NSApplication*)app openFile:(NSString*)path; 56 | -(IBAction)onFileClose:(id)sender; 57 | -(IBAction)onWindowAlwaysOnTop:(id)sender; 58 | 59 | @end 60 | -------------------------------------------------------------------------------- /frameworks/runtime-src/proj.ios_mac/cocos_lua_lib.xcodeproj/project.xcworkspace/xcshareddata/cocos_lua_lib.xccheckout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDESourceControlProjectFavoriteDictionaryKey 6 | 7 | IDESourceControlProjectIdentifier 8 | 08043CAF-F45C-40D6-B324-8B0064FD0E5B 9 | IDESourceControlProjectName 10 | cocos_lua_lib 11 | IDESourceControlProjectOriginsDictionary 12 | 13 | 87684411BA6696D5196173922956B2FA74F60149 14 | https://github.com/kokokele/cocos_lua_lib.git 15 | BC3652298C763DEDDC57941E4D5E5C993C7DE949 16 | git.oschina.net:kokokele/newGods.git 17 | 18 | IDESourceControlProjectPath 19 | frameworks/runtime-src/proj.ios_mac/cocos_lua_lib.xcodeproj 20 | IDESourceControlProjectRelativeInstallPathDictionary 21 | 22 | 87684411BA6696D5196173922956B2FA74F60149 23 | ../../../../.. 24 | BC3652298C763DEDDC57941E4D5E5C993C7DE949 25 | ../../../../..codes 26 | 27 | IDESourceControlProjectURL 28 | https://github.com/kokokele/cocos_lua_lib.git 29 | IDESourceControlProjectVersion 30 | 111 31 | IDESourceControlProjectWCCIdentifier 32 | 87684411BA6696D5196173922956B2FA74F60149 33 | IDESourceControlProjectWCConfigurations 34 | 35 | 36 | IDESourceControlRepositoryExtensionIdentifierKey 37 | public.vcs.git 38 | IDESourceControlWCCIdentifierKey 39 | 87684411BA6696D5196173922956B2FA74F60149 40 | IDESourceControlWCCName 41 | cocos_lua_lib 42 | 43 | 44 | IDESourceControlRepositoryExtensionIdentifierKey 45 | public.vcs.git 46 | IDESourceControlWCCIdentifierKey 47 | BC3652298C763DEDDC57941E4D5E5C993C7DE949 48 | IDESourceControlWCCName 49 | cocos_lua_libcodes 50 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /src/utils/log.lua: -------------------------------------------------------------------------------- 1 | --[[-- 2 | 打印UserData & table 3 | ]] 4 | app.print_r = function(o, ret, indent) 5 | local r = "" 6 | local t = type(o) 7 | 8 | if t == "table" then 9 | if not indent then indent = 0 end 10 | r = "{" 11 | local first = true 12 | 13 | for k, v in pairs(o) do 14 | r = r .. (first and "" or ", ") .. print_r(k, true, indent + 1).. "=" .. print_r(v, true, indent + 1) 15 | if first then first = false end 16 | end 17 | r = r .. "}\n" 18 | elseif t == "function" then r = "funciton" 19 | elseif t == "string" then r = o 20 | elseif t == "boolean" then r = o and "true" or "false" 21 | elseif t == "nil" then r = t 22 | elseif t == "userdata" then 23 | t = tolua.type(o) 24 | if t == "CCPoint" then r = "{x="..o.x..",y="..o.y.."}" 25 | elseif t == "CCSize" then r = "{width="..o.width..",height="..o.height.."}" 26 | elseif t == "CCRect" then r = "{origin="..print_r(o.origin, true)..",size="..print_r(o.size, true).."}" 27 | else r = t 28 | end 29 | else r = r .. o 30 | end 31 | 32 | if ret then return r else 33 | print("------------------ [print_r] Start---------------------") 34 | print(r) 35 | print("------------------ [print_r] End ---------------------") 36 | end 37 | end 38 | 39 | --[[-- 40 | Lua 格式化打印 table 函数 41 | use: http://www.laoxieit.com/coding/59.html 42 | ]] 43 | function app.print_lua_table (lua_table) 44 | indent = indent or 0 45 | for k, v in pairs(lua_table) do 46 | if type(k) == "string" then 47 | k = string.format("%q", k) 48 | end 49 | local szSuffix = "" 50 | if type(v) == "table" then 51 | szSuffix = "{" 52 | end 53 | local szPrefix = string.rep(" ", indent) 54 | formatting = szPrefix.."["..k.."]".." = "..szSuffix 55 | if type(v) == "table" then 56 | print(formatting) 57 | print_lua_table(v, indent + 1) 58 | print(szPrefix.."},") 59 | else 60 | local szValue = "" 61 | if type(v) == "string" then 62 | szValue = string.format("%q", v) 63 | else 64 | szValue = tostring(v) 65 | end 66 | print(formatting..szValue..",") 67 | end 68 | end 69 | end 70 | -------------------------------------------------------------------------------- /src/cocos/framework/extends/SpriteEx.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | 3 | Copyright (c) 2011-2014 chukong-inc.com 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | 23 | ]] 24 | 25 | local Sprite = cc.Sprite 26 | 27 | function Sprite:playAnimationOnce(animation, args) 28 | local actions = {} 29 | 30 | local showDelay = args.showDelay or 0 31 | if showDelay then 32 | self:setVisible(false) 33 | actions[#actions + 1] = cc.DelayTime:create(showDelay) 34 | actions[#actions + 1] = cc.Show:create() 35 | end 36 | 37 | local delay = args.delay or 0 38 | if delay > 0 then 39 | actions[#actions + 1] = cc.DelayTime:create(delay) 40 | end 41 | 42 | actions[#actions + 1] = cc.Animate:create(animation) 43 | 44 | if args.removeSelf then 45 | actions[#actions + 1] = cc.RemoveSelf:create() 46 | end 47 | 48 | if args.onComplete then 49 | actions[#actions + 1] = cc.CallFunc:create(args.onComplete) 50 | end 51 | 52 | local action 53 | if #actions > 1 then 54 | action = cc.Sequence:create(actions) 55 | else 56 | action = actions[1] 57 | end 58 | self:runAction(action) 59 | return action 60 | end 61 | 62 | function Sprite:playAnimationForever(animation) 63 | local animate = cc.Animate:create(animation) 64 | local action = cc.RepeatForever:create(animate) 65 | self:runAction(action) 66 | return action 67 | end 68 | -------------------------------------------------------------------------------- /frameworks/runtime-src/proj.win32/cocos_lua_lib.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {fc5cb953-2953-4968-83b3-39e3ff951754} 6 | 7 | 8 | {037a9a02-b906-4cc5-ad98-304acd4e25ee} 9 | 10 | 11 | {2d1d0979-58cd-4ab6-b91c-13650158f1fa} 12 | 13 | 14 | {833bf036-cf7e-4396-ab29-5f8b36672dbd} 15 | 16 | 17 | 18 | 19 | Classes 20 | 21 | 22 | win32 23 | 24 | 25 | 26 | 27 | win32 28 | 29 | 30 | win32 31 | 32 | 33 | Classes 34 | 35 | 36 | Classes 37 | 38 | 39 | Classes 40 | 41 | 42 | 43 | 44 | Classes 45 | 46 | 47 | win32 48 | 49 | 50 | 51 | win32 52 | 53 | 54 | Classes 55 | 56 | 57 | Classes 58 | 59 | 60 | 61 | 62 | resource 63 | 64 | 65 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /frameworks/runtime-src/proj.android/src/org/cocos2dx/lib/GameControllerDelegate.java: -------------------------------------------------------------------------------- 1 | package org.cocos2dx.lib; 2 | 3 | import android.content.Context; 4 | import android.view.KeyEvent; 5 | import android.view.MotionEvent; 6 | 7 | public interface GameControllerDelegate { 8 | 9 | static final int KEY_BASE = 1000; 10 | 11 | public static final int THUMBSTICK_LEFT_X = KEY_BASE; 12 | public static final int THUMBSTICK_LEFT_Y = KEY_BASE + 1; 13 | public static final int THUMBSTICK_RIGHT_X = KEY_BASE + 2; 14 | public static final int THUMBSTICK_RIGHT_Y = KEY_BASE + 3; 15 | 16 | public static final int BUTTON_A = KEY_BASE + 4; 17 | public static final int BUTTON_B = KEY_BASE + 5; 18 | public static final int BUTTON_C = KEY_BASE + 6; 19 | public static final int BUTTON_X = KEY_BASE + 7; 20 | public static final int BUTTON_Y = KEY_BASE + 8; 21 | public static final int BUTTON_Z = KEY_BASE + 9; 22 | 23 | public static final int BUTTON_DPAD_UP = KEY_BASE + 10; 24 | public static final int BUTTON_DPAD_DOWN = KEY_BASE + 11; 25 | public static final int BUTTON_DPAD_LEFT = KEY_BASE + 12; 26 | public static final int BUTTON_DPAD_RIGHT = KEY_BASE + 13; 27 | public static final int BUTTON_DPAD_CENTER = KEY_BASE + 14; 28 | 29 | public static final int BUTTON_LEFT_SHOULDER = KEY_BASE + 15; 30 | public static final int BUTTON_RIGHT_SHOULDER = KEY_BASE + 16; 31 | public static final int BUTTON_LEFT_TRIGGER = KEY_BASE + 17; 32 | public static final int BUTTON_RIGHT_TRIGGER = KEY_BASE + 18; 33 | 34 | public static final int BUTTON_LEFT_THUMBSTICK = KEY_BASE + 19; 35 | public static final int BUTTON_RIGHT_THUMBSTICK = KEY_BASE + 20; 36 | 37 | public static final int BUTTON_START = KEY_BASE + 21; 38 | public static final int BUTTON_SELECT = KEY_BASE + 22; 39 | 40 | void onCreate(Context context); 41 | void onPause(); 42 | void onResume(); 43 | void onDestroy(); 44 | 45 | boolean dispatchKeyEvent(KeyEvent event); 46 | boolean dispatchGenericMotionEvent(MotionEvent event); 47 | 48 | void setControllerEventListener(ControllerEventListener listener); 49 | 50 | public interface ControllerEventListener { 51 | void onButtonEvent(String vendorName, int controller, int button, boolean isPressed, float value, boolean isAnalog); 52 | void onAxisEvent(String vendorName, int controller, int axisID, float value, boolean isAnalog); 53 | 54 | void onConnected(String vendorName, int controller); 55 | void onDisconnected(String vendorName, int controller); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/cocos/framework/extends/UIListView.lua: -------------------------------------------------------------------------------- 1 | 2 | --[[ 3 | 4 | Copyright (c) 2011-2014 chukong-inc.com 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | 24 | ]] 25 | 26 | local ListView = ccui.ListView 27 | 28 | function ListView:onEvent(callback) 29 | self:addEventListener(function(sender, eventType) 30 | local event = {} 31 | if eventType == 0 then 32 | event.name = "ON_SELECTED_ITEM_START" 33 | else 34 | event.name = "ON_SELECTED_ITEM_END" 35 | end 36 | event.target = sender 37 | callback(event) 38 | end) 39 | return self 40 | end 41 | 42 | function ListView:onScroll(callback) 43 | self:addScrollViewEventListener(function(sender, eventType) 44 | local event = {} 45 | if eventType == 0 then 46 | event.name = "SCROLL_TO_TOP" 47 | elseif eventType == 1 then 48 | event.name = "SCROLL_TO_BOTTOM" 49 | elseif eventType == 2 then 50 | event.name = "SCROLL_TO_LEFT" 51 | elseif eventType == 3 then 52 | event.name = "SCROLL_TO_RIGHT" 53 | elseif eventType == 4 then 54 | event.name = "SCROLLING" 55 | elseif eventType == 5 then 56 | event.name = "BOUNCE_TOP" 57 | elseif eventType == 6 then 58 | event.name = "BOUNCE_BOTTOM" 59 | elseif eventType == 7 then 60 | event.name = "BOUNCE_LEFT" 61 | elseif eventType == 8 then 62 | event.name = "BOUNCE_RIGHT" 63 | end 64 | event.target = sender 65 | callback(event) 66 | end) 67 | return self 68 | end 69 | -------------------------------------------------------------------------------- /cocosstudio/cocosstudio/csd/theme_default/PopupSkin.csd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /src/core/BaseApp.lua: -------------------------------------------------------------------------------- 1 | -- 2 | -- Author: zp 3 | -- Date: 2015-06-24 15:34:47 4 | -- 5 | 6 | 7 | local function registerClass(o) 8 | 9 | function recursion(_o) 10 | setmetatable(_o, { 11 | __index = function(t, k) 12 | local path = rawget(t,"__path") 13 | local t1 = nil 14 | if string.byte(k,1) == string.byte(string.upper(k),1) then 15 | local className 16 | if path then 17 | className = path.."."..k 18 | else 19 | className = k 20 | end 21 | -- print(">>>>>>>>>>>>>>className:",className) 22 | t1 = require(className) 23 | rawset(t, k, t1) 24 | else 25 | t1 = {} 26 | if path then 27 | t1.__path = path ..".".. k 28 | else 29 | t1.__path = k 30 | end 31 | -- print(">>>>>>>>>>>>>>path:",t1.__path) 32 | rawset(t, k, t1) 33 | recursion(_o[k]) 34 | end 35 | return t1 36 | end, 37 | 38 | __newindex = function(_, k, v) 39 | -- only read 40 | end, 41 | }) 42 | end 43 | 44 | recursion(o) 45 | end 46 | -------------------------------------------------------------------- 47 | 48 | -- local BaseApp = class("BaseApp") 49 | 50 | function app.ctor() 51 | -- app.runningScene = nil 52 | app.S = require("core.Signal") 53 | app.D = require("core.BaseEntity") 54 | 55 | app.V = require("core.BaseView") 56 | app.VM = require("core.BaseViewModel") 57 | app.M = require("core.BaseModel") 58 | app.PP = require("core.BasePopup") 59 | 60 | app.ViewCenter = require("core.ViewCenter") 61 | 62 | app.Toast = require("widgets.Toast") 63 | app.Timer = require("utils.timer") 64 | app.Event = require("utils.event") 65 | app.Http = require("utils.http") 66 | app.Date = require("utils.date") 67 | app.Json = require("utils.dkjson") 68 | app.Loading = require("widgets.Loading") 69 | 70 | require("utils.functions") 71 | 72 | end 73 | 74 | 75 | -- 动态注册类,类java语法调用,包路径首字母小写,类名首字母大写 76 | -- local login = sg.scene.LoginScene.new() 77 | 78 | 79 | function app.popScene() 80 | cc.Director:getInstance():popScene() 81 | end 82 | 83 | function app.pushScene(scene) 84 | cc.Director:getInstance():pushScene(scene) 85 | end 86 | 87 | function app.replaceScene(scene) 88 | if cc.Director:getInstance():getRunningScene() then 89 | cc.Director:getInstance():replaceScene(scene) 90 | else 91 | cc.Director:getInstance():runWithScene(scene) 92 | end 93 | end 94 | 95 | app.ctor() 96 | registerClass(app) 97 | ------------------ 98 | -------------------------------------------------------------------------------- /src/cocos/framework/extends/LayerEx.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | 3 | Copyright (c) 2011-2014 chukong-inc.com 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | 23 | ]] 24 | 25 | local Layer = cc.Layer 26 | 27 | function Layer:onTouch(callback, isMultiTouches, swallowTouches) 28 | if type(isMultiTouches) ~= "boolean" then isMultiTouches = false end 29 | if type(swallowTouches) ~= "boolean" then swallowTouches = false end 30 | 31 | self:registerScriptTouchHandler(function(state, ...) 32 | local args = {...} 33 | local event = {name = state} 34 | if isMultiTouches then 35 | args = args[1] 36 | local points = {} 37 | for i = 1, #args, 3 do 38 | local x, y, id = args[i], args[i + 1], args[i + 2] 39 | points[id] = {x = x, y = y, id = id} 40 | end 41 | event.points = points 42 | else 43 | event.x = args[1] 44 | event.y = args[2] 45 | end 46 | callback(event) 47 | end, isMultiTouches, 0, swallowTouches) 48 | self:setTouchEnabled(true) 49 | return self 50 | end 51 | 52 | function Layer:removeTouch() 53 | self:unregisterScriptTouchHandler() 54 | self:setTouchEnabled(false) 55 | return self 56 | end 57 | 58 | function Layer:onKeypad(callback) 59 | self:registerScriptKeypadHandler(callback) 60 | self:setKeyboardEnabled(true) 61 | return self 62 | end 63 | 64 | function Layer:removeKeypad() 65 | self:unregisterScriptKeypadHandler() 66 | self:setKeyboardEnabled(false) 67 | return self 68 | end 69 | 70 | function Layer:onAccelerate(callback) 71 | self:registerScriptAccelerateHandler(callback) 72 | self:setAccelerometerEnabled(true) 73 | return self 74 | end 75 | 76 | function Layer:removeAccelerate() 77 | self:unregisterScriptAccelerateHandler() 78 | self:setAccelerometerEnabled(false) 79 | return self 80 | end 81 | -------------------------------------------------------------------------------- /src/utils/String.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | 字符串工具 3 | Author: Wei Long 4 | Date: 2014-12-19 21:14:27 5 | ]] 6 | 7 | local String = {} 8 | 9 | -- UTF8字符解析 10 | function String.getByteSizeUTF8(byte) 11 | local size = nil 12 | if byte < 128 then 13 | size = 1 14 | elseif byte < 194 then 15 | size = 2 16 | elseif byte < 224 then 17 | size = 2 18 | elseif byte < 240 then 19 | size = 3 20 | elseif byte < 248 then 21 | size = 4 22 | elseif byte < 252 then 23 | size = 5 24 | elseif byte < 254 then 25 | size = 6 26 | end 27 | return size 28 | end 29 | 30 | -- 获取原字符串总共多少个字,将字节数转化为字数 31 | function String.getLengthUTF8(str) 32 | local byte_len = string.len(str) 33 | local char_len = 0 34 | local i = 1 35 | -- print("byte_len ="..byte_len) 36 | while i <= byte_len do 37 | local byte = string.byte(str,i) 38 | i = i + String.getByteSizeUTF8(byte) 39 | char_len = char_len + 1 40 | end 41 | return char_len 42 | end 43 | 44 | function String.charAtUTF8(str,idx) 45 | local byte_len = string.len(str) 46 | local char_len = 0 47 | local i = 1 48 | local startIndex,endIndex = 1,1 49 | while i <= byte_len do 50 | local byte = string.byte(str,i) 51 | char_len = char_len + 1 52 | if char_len == idx then 53 | startIndex = i 54 | endIndex = i + String.getByteSize(byte) - 1 55 | return string.sub(str,startIndex,endIndex) 56 | end 57 | i = i + String.getByteSize(byte) 58 | end 59 | return nil 60 | end 61 | 62 | function String.substringUTF8(str,_startIndex,_endIndex) 63 | local byte_len = string.len(str) 64 | local char_len = 0 65 | local i = 1 66 | local startIndex,endIndex = 1,1 67 | while i <= byte_len do 68 | local byte = string.byte(str,i) 69 | char_len = char_len + 1 70 | if char_len == _startIndex then 71 | startIndex = i 72 | end 73 | 74 | i = i + String.getByteSizeUTF8(byte) 75 | if char_len == _endIndex then 76 | endIndex = i - 1 77 | return string.sub(str,startIndex,endIndex) 78 | end 79 | end 80 | return nil 81 | end 82 | 83 | function String.substrUTF8(str,_startIndex,_len) 84 | local byte_len = string.len(str) 85 | local char_len = 0 86 | local i = 1 87 | local startIndex,endIndex,len = nil,nil,1 88 | while i <= byte_len do 89 | local byte = string.byte(str,i) 90 | char_len = char_len + 1 91 | if char_len == _startIndex then 92 | startIndex = i 93 | len = char_len 94 | end 95 | 96 | i = i + String.getByteSize(byte) 97 | if char_len - len == _len - 1 then 98 | endIndex = i - 1 99 | return string.sub(str,startIndex,endIndex) 100 | end 101 | end 102 | return "fuck" 103 | end 104 | 105 | function String.indexOfUTF8(str,vol,_startIndex) 106 | end 107 | 108 | ------------------------------------------------------- 109 | 110 | return String 111 | -------------------------------------------------------------------------------- /frameworks/runtime-src/proj.ios_mac/mac/ConsoleWindowController.m: -------------------------------------------------------------------------------- 1 | 2 | #import "ConsoleWindowController.h" 3 | 4 | @interface ConsoleWindowController () 5 | 6 | @end 7 | 8 | #define SKIP_LINES_COUNT 3 9 | #define MAX_LINE_LEN 4096 10 | #define MAX_LINES_COUNT 200 11 | 12 | @implementation ConsoleWindowController 13 | @synthesize textView; 14 | 15 | - (id)initWithWindow:(NSWindow *)window 16 | { 17 | self = [super initWithWindow:window]; 18 | if (self) 19 | { 20 | // Initialization code here. 21 | linesCount = [[NSMutableArray arrayWithCapacity:MAX_LINES_COUNT + 1] retain]; 22 | } 23 | 24 | return self; 25 | } 26 | 27 | - (void)dealloc 28 | { 29 | [linesCount release]; 30 | [super dealloc]; 31 | } 32 | 33 | - (void)windowDidLoad 34 | { 35 | [super windowDidLoad]; 36 | // Implement this method to handle any initialization after your window controller's window has been loaded from its nib file. 37 | } 38 | 39 | - (void) trace:(NSString*)msg 40 | { 41 | if (traceCount >= SKIP_LINES_COUNT && [msg length] > MAX_LINE_LEN) 42 | { 43 | msg = [NSString stringWithFormat:@"%@ ...", [msg substringToIndex:MAX_LINE_LEN - 4]]; 44 | } 45 | traceCount++; 46 | NSFont *font = [NSFont fontWithName:@"Monaco" size:12.0]; 47 | NSDictionary *attrsDictionary = [NSDictionary dictionaryWithObject:font forKey:NSFontAttributeName]; 48 | NSAttributedString *string = [[NSAttributedString alloc] initWithString:msg attributes:attrsDictionary]; 49 | NSNumber *len = [NSNumber numberWithUnsignedInteger:[string length]]; 50 | [linesCount addObject:len]; 51 | 52 | NSTextStorage *storage = [textView textStorage]; 53 | [storage beginEditing]; 54 | [storage appendAttributedString:string]; 55 | 56 | if ([linesCount count] >= MAX_LINES_COUNT) 57 | { 58 | len = [linesCount objectAtIndex:0]; 59 | [storage deleteCharactersInRange:NSMakeRange(0, [len unsignedIntegerValue])]; 60 | [linesCount removeObjectAtIndex:0]; 61 | } 62 | 63 | [storage endEditing]; 64 | [self changeScroll]; 65 | } 66 | 67 | - (void) changeScroll 68 | { 69 | BOOL scroll = [checkScroll state] == NSOnState; 70 | if(scroll) 71 | { 72 | [self.textView scrollRangeToVisible: NSMakeRange(self.textView.string.length, 0)]; 73 | } 74 | } 75 | 76 | - (IBAction)onClear:(id)sender 77 | { 78 | NSTextStorage *storage = [textView textStorage]; 79 | [storage setAttributedString:[[[NSAttributedString alloc] initWithString:@""] autorelease]]; 80 | } 81 | 82 | - (IBAction)onScrollChange:(id)sender 83 | { 84 | [self changeScroll]; 85 | } 86 | 87 | - (IBAction)onTopChange:(id)sender 88 | { 89 | BOOL isTop = [topCheckBox state] == NSOnState; 90 | if(isTop) 91 | { 92 | [self.window setLevel:NSFloatingWindowLevel]; 93 | } 94 | else 95 | { 96 | [self.window setLevel:NSNormalWindowLevel]; 97 | } 98 | } 99 | 100 | @end 101 | -------------------------------------------------------------------------------- /src/cocos/framework/init.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | 3 | Copyright (c) 2011-2015 chukong-incc.com 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | 23 | ]] 24 | 25 | if type(DEBUG) ~= "number" then DEBUG = 0 end 26 | 27 | -- load framework 28 | printInfo("") 29 | printInfo("# DEBUG = " .. DEBUG) 30 | printInfo("#") 31 | 32 | device = require("cocos.framework.device") 33 | display = require("cocos.framework.display") 34 | audio = require("cocos.framework.audio") 35 | transition = require("cocos.framework.transition") 36 | 37 | require("cocos.framework.extends.NodeEx") 38 | require("cocos.framework.extends.SpriteEx") 39 | require("cocos.framework.extends.LayerEx") 40 | require("cocos.framework.extends.MenuEx") 41 | 42 | if ccui then 43 | require("cocos.framework.extends.UIWidget") 44 | require("cocos.framework.extends.UICheckBox") 45 | require("cocos.framework.extends.UIEditBox") 46 | require("cocos.framework.extends.UIListView") 47 | require("cocos.framework.extends.UIPageView") 48 | require("cocos.framework.extends.UIScrollView") 49 | require("cocos.framework.extends.UISlider") 50 | require("cocos.framework.extends.UITextField") 51 | end 52 | 53 | require("cocos.framework.package_support") 54 | 55 | -- register the build-in packages 56 | cc.register("event", require("cocos.framework.components.event")) 57 | 58 | -- export global variable 59 | local __g = _G 60 | cc.exports = {} 61 | setmetatable(cc.exports, { 62 | __newindex = function(_, name, value) 63 | rawset(__g, name, value) 64 | end, 65 | 66 | __index = function(_, name) 67 | return rawget(__g, name) 68 | end 69 | }) 70 | 71 | -- disable create unexpected global variable 72 | function cc.disable_global() 73 | setmetatable(__g, { 74 | __newindex = function(_, name, value) 75 | error(string.format("USE \" cc.exports.%s = value \" INSTEAD OF SET GLOBAL VARIABLE", name), 0) 76 | end 77 | }) 78 | end 79 | 80 | if CC_DISABLE_GLOBAL then 81 | cc.disable_global() 82 | end 83 | -------------------------------------------------------------------------------- /src/utils/websocket.lua: -------------------------------------------------------------------------------- 1 | local WS = class("WS") 2 | 3 | local _ws = nil 4 | local _islogined = false 5 | 6 | local _message_route = { 7 | ["Index.message"] = qy.Model.Chat, 8 | ["Index.history"] = qy.Model.Chat 9 | } 10 | 11 | function WS:connect() 12 | local currentZone = qy.Model.Area.currentZone_:get() 13 | _ws = cc.WebSocket:create("ws://" .. currentZone.socket_host_:get() .. ":" .. currentZone.socket_port_:get()) 14 | _ws:registerScriptHandler(function(data) 15 | self:onOpen(data) 16 | end,cc.WEBSOCKET_OPEN) 17 | _ws:registerScriptHandler(function(data) 18 | self:onMessage(qy.json.decode(data or {})) 19 | end,cc.WEBSOCKET_MESSAGE) 20 | _ws:registerScriptHandler(function(data) 21 | self:onClose(data) 22 | end,cc.WEBSOCKET_CLOSE) 23 | _ws:registerScriptHandler(function(data) 24 | self:onError(data) 25 | end,cc.WEBSOCKET_ERROR) 26 | end 27 | 28 | function WS:login(id, name, sec, level, icon) 29 | self._loginparams = { 30 | id = id, 31 | name = name, 32 | sec = sec, 33 | level = level or 1, 34 | icon = icon or "" 35 | } 36 | 37 | self:connect() 38 | end 39 | 40 | function WS:upinfo(info) 41 | if _ws == nil then 42 | return 43 | end 44 | self._loginparams.name = info.name or self._loginparams.name 45 | self._loginparams.level = info.level or self._loginparams.level 46 | self:send({ 47 | m = "Index.update_user_info", 48 | p = info 49 | }) 50 | end 51 | 52 | function WS:send(data) 53 | if _ws == nil then 54 | self:connect() 55 | end 56 | 57 | -- 等待建立 58 | if _islogined == false then 59 | while cc.WEBSOCKET_STATE_OPEN ~= _ws:getReadyState() do 60 | end 61 | end 62 | 63 | _ws:sendString(qy.json.encode(data)) 64 | print(qy.json.encode(data)) 65 | end 66 | 67 | function WS:onOpen(data) 68 | print("onOpen") 69 | 70 | -- 建立链接后进行登录 71 | self:send({ 72 | m = "Index.login", 73 | p = self._loginparams 74 | }) 75 | end 76 | 77 | function WS:onMessage(data) 78 | if data.msg and data.msg == "heartbeat" then 79 | else 80 | print("onMessage", qy.json.encode(data)) 81 | 82 | -- 登录回调 83 | if data.m == "Index.login" then 84 | _islogined = data.code == "OK" 85 | -- 登录成功后获取历史记录 86 | self:send({ 87 | m = "Index.history", 88 | p = { sec = self._loginparams.sec } 89 | }) 90 | else 91 | local model = _message_route[data.m or ""] 92 | if model then 93 | model:onMessage(data) 94 | end 95 | end 96 | end 97 | end 98 | 99 | function WS:onClose(data) 100 | print("onClose") 101 | _ws = nil 102 | _islogined = false 103 | end 104 | 105 | function WS:onError(data) 106 | print("onError", data) 107 | _ws = nil 108 | _islogined = false 109 | end 110 | 111 | return WS -------------------------------------------------------------------------------- /cocosstudio/cocosstudio/csd/theme_1/ToastSkin.csd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /src/managers/ArmatureManager.lua: -------------------------------------------------------------------------------- 1 | local ArmatureManager = class("ArmatureManager") 2 | 3 | local allArmature = {} 4 | -- setmetatable(allArmature, {__mode = 'v'}) 5 | function ArmatureManager.addArmature(arm) 6 | -- body 7 | local isadd = true 8 | 9 | if next(allArmature) == nil then 10 | table.insert(allArmature, arm) 11 | else 12 | for k,v in pairs(allArmature) do 13 | if v == arm then 14 | isadd = false 15 | break; 16 | end 17 | end 18 | if isadd then 19 | table.insert(allArmature, arm) 20 | end 21 | end 22 | 23 | end 24 | 25 | function ArmatureManager.removeArmature(arm) 26 | -- body 27 | local t = {} 28 | 29 | for k,v in pairs(allArmature) do 30 | if v == arm then 31 | table.insert(t, k) 32 | end 33 | end 34 | -- if #t > 1 then 35 | -- print("========================================================================================================================== 多个相同") 36 | -- end 37 | for k,v in pairs(t) do 38 | table.remove(allArmature, v) 39 | end 40 | -- print("matureManager.removeArmature(ar", #allArmature) 41 | end 42 | 43 | function ArmatureManager.removeAllArmature() 44 | -- body 45 | allArmature = {} 46 | 47 | end 48 | 49 | function ArmatureManager.pause() 50 | -- body 51 | -- print("ArmatureManager.resume()ArmatureManager.resume()ArmatureManager.resume()========================", #allArmature) 52 | -- collectgarbage() 53 | -- print("ArmatureManager.resume()ArmatureManager.resume()ArmatureManager.resume()========================", #allArmature) 54 | for k,v in pairs(allArmature) do 55 | -- print(k,v) 56 | -- print(" ArmatureManager.pause() ArmatureManager.pause()======", k) 57 | -- if v== nil then 58 | -- print("========================================================================================================================== 有空") 59 | -- end 60 | 61 | v:pause() 62 | v:setColor(cc.c3b(80,80,80)) 63 | end 64 | end 65 | 66 | function ArmatureManager.resume() 67 | -- body 68 | 69 | -- print("ArmatureManager.resume()ArmatureManager.resume()ArmatureManager.resume()========================", #allArmature) 70 | -- collectgarbage() 71 | -- print("ArmatureManager.resume()ArmatureManager.resume()ArmatureManager.resume()========================", #allArmature) 72 | for k,v in pairs(allArmature) do 73 | -- print(k,v) 74 | -- print(" ArmatureManager.resume()ArmatureManager.resume()======", k) 75 | -- if v== nil then 76 | -- print("========================================================================================================================== 有空") 77 | -- end 78 | v:resume() 79 | v:setColor(cc.c3b(255,255,255)) 80 | end 81 | end 82 | 83 | function ArmatureManager.removeAtEnd(armature, callfunc) 84 | local function animationEvent(armatureBack,movementType,movementID) 85 | if movementType == ccs.MovementEventType.complete then 86 | armatureBack:runAction(cc.Sequence:create(cc.DelayTime:create(0.1), cc.CallFunc:create(callfunc))) 87 | end 88 | end 89 | 90 | armature:getAnimation():setMovementEventCallFunc(animationEvent) 91 | end 92 | 93 | return ArmatureManager 94 | 95 | 96 | -------------------------------------------------------------------------------- /src/utils/http.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | 说明: Http请求库 3 | 4 | TODO: 实现队列功能, 加入协程 5 | 6 | usage: 7 | qy.Http.new(qy.Http.Request.new(params[, qy.Http.GET | qy.Http.POST]):send(function(response) 8 | print(response.code, response.data) 9 | end)) 10 | ]] 11 | 12 | 13 | 14 | local Http = class("Http") 15 | 16 | -- 请求方法常量 17 | Http.GET = "GET" 18 | Http.POST = "POST" 19 | 20 | Http.Request = class("HttpRequest") 21 | Http.Response = class("HttpResponse") 22 | 23 | function Http:ctor(request) 24 | self.request = request 25 | end 26 | 27 | function Http:send(callback, isHideLoading) 28 | 29 | if not isHideLoading then 30 | app.Loading.on() 31 | end 32 | 33 | if app.config.DEBUG then 34 | print("url: " .. self.request.url:toStr()) 35 | print("params: " .. app.Json.encode(self.request.params)) 36 | end 37 | 38 | local xhr = cc.XMLHttpRequest:new() 39 | 40 | local function onReadyStateChange() 41 | if app.config.DEBUG then 42 | print("http response: ") 43 | print("status: ", xhr.status) 44 | print("返回数据: ", xhr.response) 45 | end 46 | 47 | app.Loading.off() 48 | 49 | if xhr.status == 200 then 50 | 51 | local jdata = app.Json.decode(xhr.response) 52 | 53 | 54 | -- 回调数据 55 | if callback then 56 | callback(Http.Response.new(xhr.status, jdata), self.request) 57 | end 58 | 59 | else 60 | if app.config.DEBUG then 61 | print("responsecode: " .. xhr.status) 62 | end 63 | end 64 | end 65 | 66 | --local sessionId = qy.Model.User:getSessionId() 67 | --if sessionId then 68 | -- xhr:setRequestHeader("PHPSESSID", sessionId) 69 | --end 70 | 71 | xhr.responseType = cc.XMLHTTPREQUEST_RESPONSE_STRING 72 | xhr:open(self.request.method, self.request.url:toStr()) 73 | xhr:registerScriptHandler(onReadyStateChange) 74 | 75 | xhr:send(self.request:getParamsStr()) 76 | end 77 | 78 | function Http.Request:ctor(params, method) 79 | self.url = self:URL() 80 | if params.p then self.url.path = params.p .. ".php" end 81 | self.params = params 82 | self.method = method or Http.POST 83 | end 84 | 85 | function Http.Request:URL() 86 | return { 87 | scheme = app.config.SERVER_SCHEME, 88 | domain = app.config.SERVER_DOMAIN, 89 | port = app.config.SERVER_PORT, 90 | path = app.config.SERVER_PATH, 91 | 92 | toStr = function(self) 93 | return string.format("%s://%s:%s/%s", self.scheme, self.domain, self.port, self.path) 94 | end 95 | } 96 | end 97 | 98 | function Http.Request:getParamsStr() 99 | return self.method == Http.POST and app.Json.encode(self.params) or nil 100 | end 101 | 102 | -- data: 返回数据 103 | -- request: 请求的对象 104 | function Http.Response:ctor(code, data, request) 105 | self.code = code 106 | self.data = data 107 | self.request = request 108 | end 109 | 110 | return Http 111 | -------------------------------------------------------------------------------- /frameworks/runtime-src/proj.android/src/org/cocos2dx/lib/GameControllerAdapter.java: -------------------------------------------------------------------------------- 1 | package org.cocos2dx.lib; 2 | 3 | import java.util.ArrayList; 4 | 5 | public class GameControllerAdapter { 6 | private static ArrayList sRunnableFrameStartList = null; 7 | 8 | public static void addRunnableToFrameStartList(Runnable runnable) { 9 | if (sRunnableFrameStartList == null) 10 | sRunnableFrameStartList = new ArrayList(); 11 | sRunnableFrameStartList.add(runnable); 12 | } 13 | 14 | public static void removeRunnableFromFrameStartList(Runnable runnable) { 15 | if (sRunnableFrameStartList != null) 16 | sRunnableFrameStartList.remove(runnable); 17 | } 18 | 19 | public static void onDrawFrameStart() { 20 | if (sRunnableFrameStartList != null) 21 | { 22 | int size = sRunnableFrameStartList.size(); 23 | for (int i = 0; i < size; ++i) { 24 | sRunnableFrameStartList.get(i).run(); 25 | } 26 | } 27 | } 28 | 29 | public static void onConnected(final String vendorName, final int controller) 30 | { 31 | Cocos2dxHelper.runOnGLThread(new Runnable() { 32 | 33 | @Override 34 | public void run() { 35 | nativeControllerConnected(vendorName, controller); 36 | } 37 | }); 38 | } 39 | 40 | public static void onDisconnected(final String vendorName, final int controller) 41 | { 42 | Cocos2dxHelper.runOnGLThread(new Runnable() { 43 | 44 | @Override 45 | public void run() { 46 | nativeControllerDisconnected(vendorName, controller); 47 | } 48 | }); 49 | } 50 | 51 | public static void onButtonEvent(final String vendorName, final int controller, final int button, final boolean isPressed, final float value, final boolean isAnalog) 52 | { 53 | Cocos2dxHelper.runOnGLThread(new Runnable() { 54 | 55 | @Override 56 | public void run() { 57 | nativeControllerButtonEvent(vendorName, controller, button, isPressed, value, isAnalog); 58 | } 59 | }); 60 | } 61 | 62 | public static void onAxisEvent(final String vendorName, final int controller, final int axisID, final float value, final boolean isAnalog) 63 | { 64 | Cocos2dxHelper.runOnGLThread(new Runnable() { 65 | 66 | @Override 67 | public void run() { 68 | nativeControllerAxisEvent(vendorName, controller, axisID, value, isAnalog); 69 | } 70 | }); 71 | } 72 | 73 | private static native void nativeControllerConnected(final String vendorName, final int controller); 74 | private static native void nativeControllerDisconnected(final String vendorName, final int controller); 75 | private static native void nativeControllerButtonEvent(final String vendorName, final int controller, final int button, final boolean isPressed, final float value, final boolean isAnalog); 76 | private static native void nativeControllerAxisEvent(final String vendorName, final int controller, final int axisID, final float value, final boolean isAnalog); 77 | } 78 | -------------------------------------------------------------------------------- /src/cocos/cocosdenshion/AudioEngine.lua: -------------------------------------------------------------------------------- 1 | if nil == cc.SimpleAudioEngine then 2 | return 3 | end 4 | --Encapsulate SimpleAudioEngine to AudioEngine,Play music and sound effects. 5 | local M = {} 6 | 7 | function M.stopAllEffects() 8 | cc.SimpleAudioEngine:getInstance():stopAllEffects() 9 | end 10 | 11 | function M.getMusicVolume() 12 | return cc.SimpleAudioEngine:getInstance():getMusicVolume() 13 | end 14 | 15 | function M.isMusicPlaying() 16 | return cc.SimpleAudioEngine:getInstance():isMusicPlaying() 17 | end 18 | 19 | function M.getEffectsVolume() 20 | return cc.SimpleAudioEngine:getInstance():getEffectsVolume() 21 | end 22 | 23 | function M.setMusicVolume(volume) 24 | cc.SimpleAudioEngine:getInstance():setMusicVolume(volume) 25 | end 26 | 27 | function M.stopEffect(handle) 28 | cc.SimpleAudioEngine:getInstance():stopEffect(handle) 29 | end 30 | 31 | function M.stopMusic(isReleaseData) 32 | local releaseDataValue = false 33 | if nil ~= isReleaseData then 34 | releaseDataValue = isReleaseData 35 | end 36 | cc.SimpleAudioEngine:getInstance():stopMusic(releaseDataValue) 37 | end 38 | 39 | function M.playMusic(filename, isLoop) 40 | local loopValue = false 41 | if nil ~= isLoop then 42 | loopValue = isLoop 43 | end 44 | cc.SimpleAudioEngine:getInstance():playMusic(filename, loopValue) 45 | end 46 | 47 | function M.pauseAllEffects() 48 | cc.SimpleAudioEngine:getInstance():pauseAllEffects() 49 | end 50 | 51 | function M.preloadMusic(filename) 52 | cc.SimpleAudioEngine:getInstance():preloadMusic(filename) 53 | end 54 | 55 | function M.resumeMusic() 56 | cc.SimpleAudioEngine:getInstance():resumeMusic() 57 | end 58 | 59 | function M.playEffect(filename, isLoop) 60 | local loopValue = false 61 | if nil ~= isLoop then 62 | loopValue = isLoop 63 | end 64 | return cc.SimpleAudioEngine:getInstance():playEffect(filename, loopValue) 65 | end 66 | 67 | function M.rewindMusic() 68 | cc.SimpleAudioEngine:getInstance():rewindMusic() 69 | end 70 | 71 | function M.willPlayMusic() 72 | return cc.SimpleAudioEngine:getInstance():willPlayMusic() 73 | end 74 | 75 | function M.unloadEffect(filename) 76 | cc.SimpleAudioEngine:getInstance():unloadEffect(filename) 77 | end 78 | 79 | function M.preloadEffect(filename) 80 | cc.SimpleAudioEngine:getInstance():preloadEffect(filename) 81 | end 82 | 83 | function M.setEffectsVolume(volume) 84 | cc.SimpleAudioEngine:getInstance():setEffectsVolume(volume) 85 | end 86 | 87 | function M.pauseEffect(handle) 88 | cc.SimpleAudioEngine:getInstance():pauseEffect(handle) 89 | end 90 | 91 | function M.resumeAllEffects(handle) 92 | cc.SimpleAudioEngine:getInstance():resumeAllEffects() 93 | end 94 | 95 | function M.pauseMusic() 96 | cc.SimpleAudioEngine:getInstance():pauseMusic() 97 | end 98 | 99 | function M.resumeEffect(handle) 100 | cc.SimpleAudioEngine:getInstance():resumeEffect(handle) 101 | end 102 | 103 | function M.getInstance() 104 | return cc.SimpleAudioEngine:getInstance() 105 | end 106 | 107 | function M.destroyInstance() 108 | return cc.SimpleAudioEngine:destroyInstance() 109 | end 110 | 111 | AudioEngine = M 112 | -------------------------------------------------------------------------------- /src/widgets/InfoWidget.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | vip显示页头部信息,充值页头部信息(公用) 3 | ]] 4 | 5 | local InfoWidget = class("InfoWidget", qy.View.Base) 6 | 7 | InfoWidget.__create = function(delegate, csbFile) 8 | return InfoWidget.super.__create(csbFile or "widget/InfoWidget") 9 | end 10 | 11 | -- local InfoWidget = class("InfoWidget", function() 12 | -- return qy.View.Base.new(csbFile or "widget/InfoWidget") 13 | -- end) 14 | 15 | local model = qy.Model.Vip 16 | local userModel = qy.Model.User 17 | function InfoWidget:ctor(delegate) 18 | InfoWidget.super.ctor(self) 19 | 20 | self:InjectView("Level_1") 21 | self:InjectView("Level_2") 22 | self:InjectView("rmb") 23 | self:InjectView("Text_1") 24 | self:InjectView("diamond") 25 | self:InjectView("Text_2") 26 | self:InjectView("vip_2") 27 | self:InjectView("LoadingBar") 28 | self:InjectView("Button_3") 29 | self:InjectView("pro") 30 | if delegate.isReCharge == true then 31 | self.Button_3:setTitleText("充值") 32 | else 33 | self.Button_3:setTitleText("特权") 34 | end 35 | 36 | self:OnClick(self.Button_3, function(sender, touchPos) 37 | if delegate then 38 | if delegate.isReCharge == true then 39 | if delegate.onRecharge then 40 | delegate.onRecharge(touchPos) 41 | else 42 | print("没有此方法") 43 | end 44 | else 45 | if delegate.onVip then 46 | delegate.onVip(touchPos) 47 | else 48 | print("没有此方法") 49 | end 50 | end 51 | end 52 | end) 53 | 54 | self:setInfo() 55 | 56 | end 57 | 58 | function InfoWidget:setInfo() 59 | local level = userModel.Vip and userModel.Vip.level_:get() or 0 60 | local already_rmb = userModel.info.payment_gem_added_:get() 61 | 62 | local level1_ = level + 1 63 | local level2_ = level + 2 64 | if level2_ > 16 then 65 | level2_ = 16 66 | end 67 | if level1_ > 16 then 68 | level1_ = 16 69 | end 70 | 71 | local data = model:getLevel(level1_) 72 | local data2 = model:getLevel(level2_) 73 | local rmb = data2.rmb_:get() - already_rmb 74 | local rmb_add = data2.rmb_:get() - (data and data.rmb_:get() or 0) 75 | local rmb_add2 = already_rmb - (data and data.rmb_:get() or 0) 76 | 77 | if rmb_add2 < 0 then 78 | rmb_add2 = 0 79 | end 80 | 81 | if rmb < 0 then 82 | rmb = "XXXX" 83 | end 84 | self.Level_1:setString(level) 85 | local level2 = level + 1 86 | self.Level_2:setString(level2) 87 | self.rmb:setString(rmb) 88 | 89 | if rmb_add2 > rmb_add then 90 | rmb_add2 = rmb_add 91 | end 92 | self.LoadingBar:setPercent(math.floor(rmb_add2 * 100 / rmb_add)) 93 | self.pro:setString(rmb_add2 .. "/" .. rmb_add) 94 | if level2 > model:getNum() - 1 then 95 | self.rmb:setVisible(false) 96 | self.Text_1:setVisible(false) 97 | self.diamond:setVisible(false) 98 | self.Text_2:setVisible(false) 99 | self.vip_2:setVisible(false) 100 | self.Level_2:setVisible(false) 101 | end 102 | end 103 | 104 | return InfoWidget -------------------------------------------------------------------------------- /frameworks/runtime-src/Classes/AppDelegate.cpp: -------------------------------------------------------------------------------- 1 | #include "AppDelegate.h" 2 | #include "CCLuaEngine.h" 3 | #include "SimpleAudioEngine.h" 4 | #include "cocos2d.h" 5 | #include "lua_module_register.h" 6 | 7 | #if (CC_TARGET_PLATFORM != CC_PLATFORM_LINUX) 8 | #include "ide-support/CodeIDESupport.h" 9 | #endif 10 | 11 | #if (COCOS2D_DEBUG > 0) && (CC_CODE_IDE_DEBUG_SUPPORT > 0) 12 | #include "runtime/Runtime.h" 13 | #include "ide-support/RuntimeLuaImpl.h" 14 | #endif 15 | 16 | using namespace CocosDenshion; 17 | 18 | USING_NS_CC; 19 | using namespace std; 20 | 21 | AppDelegate::AppDelegate() 22 | { 23 | } 24 | 25 | AppDelegate::~AppDelegate() 26 | { 27 | SimpleAudioEngine::end(); 28 | 29 | #if (COCOS2D_DEBUG > 0) && (CC_CODE_IDE_DEBUG_SUPPORT > 0) 30 | // NOTE:Please don't remove this call if you want to debug with Cocos Code IDE 31 | RuntimeEngine::getInstance()->end(); 32 | #endif 33 | } 34 | 35 | //if you want a different context,just modify the value of glContextAttrs 36 | //it will takes effect on all platforms 37 | void AppDelegate::initGLContextAttrs() 38 | { 39 | //set OpenGL context attributions,now can only set six attributions: 40 | //red,green,blue,alpha,depth,stencil 41 | GLContextAttrs glContextAttrs = {8, 8, 8, 8, 24, 8}; 42 | 43 | GLView::setGLContextAttrs(glContextAttrs); 44 | } 45 | 46 | // If you want to use packages manager to install more packages, 47 | // don't modify or remove this function 48 | static int register_all_packages() 49 | { 50 | return 0; //flag for packages manager 51 | } 52 | 53 | bool AppDelegate::applicationDidFinishLaunching() 54 | { 55 | // set default FPS 56 | Director::getInstance()->setAnimationInterval(1.0 / 60.0f); 57 | 58 | // register lua module 59 | auto engine = LuaEngine::getInstance(); 60 | ScriptEngineManager::getInstance()->setScriptEngine(engine); 61 | lua_State* L = engine->getLuaStack()->getLuaState(); 62 | lua_module_register(L); 63 | 64 | register_all_packages(); 65 | 66 | LuaStack* stack = engine->getLuaStack(); 67 | stack->setXXTEAKeyAndSign("2dxLua", strlen("2dxLua"), "XXTEA", strlen("XXTEA")); 68 | 69 | //register custom function 70 | //LuaStack* stack = engine->getLuaStack(); 71 | //register_custom_function(stack->getLuaState()); 72 | 73 | #if (COCOS2D_DEBUG > 0) && (CC_CODE_IDE_DEBUG_SUPPORT > 0) 74 | // NOTE:Please don't remove this call if you want to debug with Cocos Code IDE 75 | auto runtimeEngine = RuntimeEngine::getInstance(); 76 | runtimeEngine->addRuntime(RuntimeLuaImpl::create(), kRuntimeEngineLua); 77 | runtimeEngine->start(); 78 | #else 79 | if (engine->executeScriptFile("src/main.lua")) 80 | { 81 | return false; 82 | } 83 | #endif 84 | 85 | return true; 86 | } 87 | 88 | // This function will be called when the app is inactive. When comes a phone call,it's be invoked too 89 | void AppDelegate::applicationDidEnterBackground() 90 | { 91 | Director::getInstance()->stopAnimation(); 92 | 93 | SimpleAudioEngine::getInstance()->pauseBackgroundMusic(); 94 | } 95 | 96 | // this function will be called when the app is active again 97 | void AppDelegate::applicationWillEnterForeground() 98 | { 99 | Director::getInstance()->startAnimation(); 100 | 101 | SimpleAudioEngine::getInstance()->resumeBackgroundMusic(); 102 | } 103 | --------------------------------------------------------------------------------