123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171 |
- 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);
- }
- });
|