// Learn cc.Class: // - [Chinese] http://docs.cocos.com/creator/manual/zh/scripting/class.html // - [English] http://www.cocos2d-x.org/docs/creator/en/scripting/class.html // Learn Attribute: // - [Chinese] http://docs.cocos.com/creator/manual/zh/scripting/reference/attributes.html // - [English] http://www.cocos2d-x.org/docs/creator/en/scripting/reference/attributes.html // Learn life-cycle callbacks: // - [Chinese] http://docs.cocos.com/creator/manual/zh/scripting/life-cycle-callbacks.html // - [English] http://www.cocos2d-x.org/docs/creator/en/scripting/life-cycle-callbacks.html window.userData = { httpData : { data: { avatarUrl: "https://wx.qlogo.cn/mmopen/vi_32/DYAIOgq83eohXLEIOV99ic2JosrQDgIgL4cU4ZlmmvkWzGpygkNV9aEJ6nCC2mVf4kYBDHogNOHgXo2wZhv85jA/132", city: "Harbin", gender: 1, nickName: "汪汪Husky", openid: "oGxOa5SQ1ltBWWsVRirUvXUBGRRY", province: "Heilongjiang", id : 0 }, }, // oGxOa5bd61v9jI_indIdQtI2T5P8 大佬 // oGxOa5bjKLaCSbkPev09yVze0WSA 晓明 // oGxOa5del9BkzJ3e8fLVzI4mlvEI 小狐仙 // oGxOa5eZUuWCNCoEUQIjtu2uN9BM 9527 // oGxOa5SQ1ltBWWsVRirUvXUBGRRY 汪汪 openId: "oGxOa5SQ1ltBWWsVRirUvXUBGRRY" } cc.Class({ extends: cc.Component, properties: { // foo: { // // ATTRIBUTES: // default: null, // The default value will be used only when the component attaching // // to a node for the first time // type: cc.SpriteFrame, // optional, default is typeof default // serializable: true, // optional, default is true // }, // bar: { // get () { // return this._bar; // }, // set (value) { // this._bar = value; // } // }, }, // LIFE-CYCLE CALLBACKS: // onLoad () {}, start () { this.Display = UtilsPrefabs.getNode("layout",this.node); // this.Display = UtilsPrefabs.getNode("Display",this.node); if (cc.sys.platform === cc.sys.WECHAT_GAME){ wx.onMessage(function (data) { if (data.message != null) { var message = data.message; // console.log("主域 过来的数据",data.message); switch (message.name) { case "showFriend": this.showFriend(); break; case "hideFriend": this.hideFriend(); break; case "Whoareyou": userData.openId = message.openId; // userData.httpData.data.id = parseInt(message.id); this.getRankingchao(); break; case "Whoareme": userData.openId = message.openId; // userData.httpData.data.id = parseInt(message.id); this.getRanking(); break; } } }.bind(this)); }else{ this.showFriend(); // this.getRanking(); } }, showFriend : function () { this.Display.getChildByName("Display").active = true; this.Display.getComponent("launch").getFriend(); }, hideFriend : function () { this.Display.getChildByName("Display").active = false; this.Display.getComponent("launch").removeAll(); }, getIndex : function (openId) { }, getRanking : function () { this.Display.getComponent("launch").getRanking(function (list) { //添加排行榜为 自己的条目在下面 // console.log("我在统计数组1",list,userData.openId); for (var i = 0; i 0 ) { // // console.log("当前名次",i,"排名下降"); // } // //播放动画 // // // this.myCurr = i; // } // console.log("超越4",this.ischao,list[i],i - 1); if (i - 1 >= 0) { // console.log("我前面的数据",list[i-1],"我的数据",list[i]); // if (list[i - 1].id - list[i].id <= 15000) { this.Display.getComponent("launch").curr(list[i-1]); // } } }, getCurr : function (i,list) { this.Display.getComponent("launch").getCurrs(i,list); }, // update (dt) {}, });