var httpUtils = require("HttpUtils"); cc.Class({ extends: require("Base"), properties: { // defaults, set visually when attaching this script to the Canvas siji: { default: null, type: dragonBones.ArmatureDisplay }, shijian: { default: null, type: dragonBones.ArmatureDisplay }, zijideshiqingzijizuo: { default: null, type: dragonBones.ArmatureDisplay }, view_scroll: { default: null, type: cc.ScrollView }, curriculum_prefab: { default: null, type: cc.Prefab }, helloWorld: { default: null, type: cc.Sprite }, share_prefab: { default: null, type: cc.Prefab }, content_prefab: { default: null, type: cc.Prefab } }, // use this for initialization onLoad: function() { setViewTouch( this.siji, null, function(event) { cc.log("点击了四季"); if (cc.sys.OS_ANDROID == cc.sys.os) { cc.log("android系统------------------"); jsb.reflection.callStaticMethod( "org/cocos2dx/javascript/CallAndroid", "showMessage", "(Ljava/lang/String;)V", "点击了四季" ); } var seq = cc.repeat( cc.sequence(cc.moveBy(0.1, 5, 0), cc.moveBy(0.1, -5, 0)), 5 ); this.siji.node.runAction(seq); }, null, this ); setViewTouch( this.siji, null, function(event) { cc.log("点击了四季"); }, null, this ); setViewTouch( this.shijian, null, function(event) { cc.log("点击了时间"); this.showCurriculum(null); if (cc.sys.OS_ANDROID == cc.sys.os) { cc.log("android系统------------------"); jsb.reflection.callStaticMethod( "org/cocos2dx/javascript/CallAndroid", "callJS", "()V" ); } }, null, this ); setViewTouch( this.zijideshiqingzijizuo, null, function(event) { // httpUtils // .getInstance() // .httpGets( // "https://api.weixin.qq.com/sns/userinfo?access_token=123&openid=123", // function(data) { // cc.log("data:" + data); // jsb.reflection.callStaticMethod( // "org/cocos2dx/javascript/CallAndroid", // "LogE", // "(Ljava/lang/String;)V", // data // ); // } // ); }, null, this ); setViewTouch( this.helloWorld, null, function(event) { cc.log("helloWorld"); // this.showCurriculum(null); // navigator.navigate('New Scene'); // cc.director.loadScene('New Scene') let parameter = {}; parameter.title = 'wang ronghui'; cc.wangronghui.navigator.navigate('New Scene', parameter); }, null, this ); }, start: function(dt) { this.view_scroll.scrollToLeft(0); if (cc.sys.OS_ANDROID == cc.sys.os) { jsb.reflection.callStaticMethod( "org/cocos2dx/javascript/CallAndroid", "removeLoadingImage", "()V" ); } }, lateUpdate: function(dt) { setScaleX(this.root_view); }, update: function(dt) {}, showCurriculum: function() { var curriculum = cc.instantiate(this.curriculum_prefab); console.log('=======',curriculum) curriculum.getComponent("课程弹窗").curriculum_window = this; curriculum.getComponent("课程弹窗").setTitle("点击了时间"); curriculum.getComponent("课程弹窗").initView(null); this.node.addChild(curriculum); }, showShare: function() { var share = cc.instantiate(this.share_prefab); share.getComponent("popup").curriculum_window = this; this.node.addChild(share); }, showDetail: function() { var content = cc.instantiate(this.content_prefab); content.getComponent("detail").curriculum_window = this; this.node.addChild(content); } });