// 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 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; // } // }, item: cc.Prefab, }, // LIFE-CYCLE CALLBACKS: onLoad () { // console.log("排行页面看见"); }, //排行榜 start() { utils.isMobile(function () { Manager.ranklist = this; }.bind(this)); let ranklist = this.ranklist = UtilsPrefabs.getNode("ranklist", this.node); let list_Wholecountry_layout=this.list_Wholecountry_layout = UtilsPrefabs.getNode("list_Wholecountry_layout", this.node); let list_Goodfriend_layout =this.list_Goodfriend_layout= UtilsPrefabs.getNode("list_Goodfriend_layout", this.node); let list_Wholecountry = this.list_Wholecountry=UtilsPrefabs.getNode("list_Wholecountry", this.node); let list_Goodfriend = this.list_Goodfriend=UtilsPrefabs.getNode("list_Goodfriend", this.node); // var i = "https://ss0.bdstatic.com/" + // "70cFuHSh_Q1YnxGkpoWK1HF6hhy/it/" + // "u=3356744803,2445309553&fm=26&gp=0.jpg" // utils.loadHttpSpriteFrame(i, NewButton.getComponent(cc.Sprite)); // item/ranklist_bg UtilsPrefabs.setOn(list_Wholecountry, function () { this.switchs(0); }.bind(this)); UtilsPrefabs.setOn(list_Goodfriend, function () { this.switchs(1); }.bind(this)); this.switchs(0); //返回到结算页面 let backbutton = this.backbutton = UtilsPrefabs.getNode("backbutton", this.node); UtilsPrefabs.setOn(this.backbutton, function () { if (this.backButtonClick != null) { this.backButtonClick(); } }.bind(this)); UtilsPrefabs.setOn(this.backbutton, function () { if (this.backButtonClick != null) { this.backButtonClick(); } }.bind(this)); }, switchs : function(type){ switch (type) { case 0: this.list_Wholecountry_layout.active = true; this.list_Goodfriend_layout.active = false; UtilsPrefabs.getNode("Label1", this.list_Wholecountry).active = false; UtilsPrefabs.getNode("Label2", this.list_Wholecountry).active = true; UtilsPrefabs.getNode("Label1", this.list_Goodfriend).active = true; UtilsPrefabs.getNode("Label2", this.list_Goodfriend).active = false; console.log("排行页面看见"+type+" this.list_Wholecountry ",this.list_Wholecountry," this.list_Goodfriend ",this.list_Goodfriend); break; case 1: this.list_Wholecountry_layout.active = false; this.list_Goodfriend_layout.active = true; UtilsPrefabs.getNode("Label1", this.list_Wholecountry).active = true; UtilsPrefabs.getNode("Label2", this.list_Wholecountry).active = false; UtilsPrefabs.getNode("Label1", this.list_Goodfriend).active = false; UtilsPrefabs.getNode("Label2", this.list_Goodfriend).active = true; console.log("排行页面看见"+type+" this.list_Wholecountry ",this.list_Wholecountry," this.list_Goodfriend ",this.list_Goodfriend); break; } }, setListData : function(){ this.list_Wholecountry_layout.getComponent("listWholecountryManger").setListData(); this.list_Goodfriend_layout.getComponent("listGoodfriendManger").setListData(); }, setbackButtonClickListeniner : function (backButtonClick) { this.backButtonClick = backButtonClick; }, backButtonClick : function () { }, // update (dt) {}, });