123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367 |
- window.__require = function t(e, i, n) {
- function o(l, c) {
- if (!i[l]) {
- if (!e[l]) {
- var s = l.split("/");
- s = s[s.length - 1];
- if (!e[s]) {
- var r = "function" == typeof __require && __require;
- if (!c && r) return r(s, !0);
- if (a) return a(s, !0);
- throw new Error("Cannot find module '" + l + "'");
- }
- l = s;
- }
- var h = i[l] = {
- exports: {}
- };
- e[l][0].call(h.exports, function(t) {
- return o(e[l][1][t] || t);
- }, h, h.exports, t, e, i, n);
- }
- return i[l].exports;
- }
- for (var a = "function" == typeof __require && __require, l = 0; l < n.length; l++) o(n[l]);
- return o;
- }({
- UserListView: [ function(t, e) {
- "use strict";
- cc._RF.push(e, "c57cbOdmz1GWr10rLi+PsQo", "UserListView");
- function i(t, e) {
- var i;
- if ("undefined" == typeof Symbol || null == t[Symbol.iterator]) {
- if (Array.isArray(t) || (i = n(t)) || e && t && "number" == typeof t.length) {
- i && (t = i);
- var o = 0;
- return function() {
- return o >= t.length ? {
- done: !0
- } : {
- done: !1,
- value: t[o++]
- };
- };
- }
- throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
- }
- return (i = t[Symbol.iterator]()).next.bind(i);
- }
- function n(t, e) {
- if (t) {
- if ("string" == typeof t) return o(t, e);
- var i = Object.prototype.toString.call(t).slice(8, -1);
- "Object" === i && t.constructor && (i = t.constructor.name);
- return "Map" === i || "Set" === i ? Array.from(t) : "Arguments" === i || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i) ? o(t, e) : void 0;
- }
- }
- function o(t, e) {
- (null == e || e > t.length) && (e = t.length);
- for (var i = 0, n = new Array(e); i < e; i++) n[i] = t[i];
- return n;
- }
- cc.Class({
- extends: cc.Component,
- properties: {
- scrollView: cc.ScrollView,
- bounceBottomCallBack: null,
- bounceTopCallBack: null,
- scrollEndedCallBack: null,
- scrollingCallBack: null,
- scrollToBottomCallBack: null,
- scrollToTopCallBack: null,
- updateItemDataCallBack: null,
- isToMoveTop: !1,
- spacing: 0,
- lengthen: 0
- },
- onLoad: function() {},
- start: function() {},
- setDataSet: function(t, e, i) {
- this.dataSet = t;
- this.parentJs = e;
- this.item = i;
- },
- updateDataSet: function(t, e) {
- var i = this;
- this.dataSet = t;
- this.content.height = this.dataSet.length * (this.itemHeight + this.spacing) + this.spacing + this.lengthen + this.itemHeight;
- this.lastStartIndex = -1;
- if (e) for (var n = this.content.children, o = 0; o < n.length; o++) o < this.dataSet.length ? this.getView(n[o], n[o]._tag) : n[o].destroy();
- this.scheduleOnce(function() {
- i.content.height < i.node.height && (i.content.height = i.node.height);
- if (this.isToMoveTop) {
- this.content.y = Math.floor(this.content.parent.height / 2);
- this.isToMoveTop = !1;
- }
- console.log("****************lastStartIndex=" + this.lastStartIndex + "*****startUpdate=" + i.startUpdate + "*********");
- i.startUpdate = !0;
- }, .1);
- },
- initUi: function() {
- var t = this;
- this.content = this.scrollView.content;
- this.lastStartIndex = -1;
- this.canScrollToTop = !1;
- this.itemNodePool = new cc.NodePool();
- var e = this.itemNodePool.get() || cc.instantiate(this.item);
- this.itemHeight = e.height;
- this.itemsVisibleNumber = Math.ceil(this.content.parent.height / this.itemHeight);
- this.content.height = this.dataSet.length * (this.itemHeight + this.spacing) + this.spacing + this.lengthen;
- this.scheduleOnce(function() {
- t.itemsVisibleNumber = Math.ceil(t.content.parent.height / t.itemHeight);
- t.content.height < t.node.height && (t.content.height = t.node.height);
- this.content.y = Math.floor(this.content.parent.height / 2);
- t.startUpdate = !0;
- }, .05);
- },
- update: function() {
- if (this.startUpdate) {
- var t = this.checkNeedUpdate();
- t >= 0 && this.updateView(t);
- }
- },
- checkNeedUpdate: function() {
- var t = Math.ceil(this.content.y) - Math.floor(this.content.parent.height / 2), e = Math.floor(t / (this.itemHeight + this.spacing));
- if (e < 0 && !this.canScrollToTop) {
- this.scrollView.scrollToTop();
- this.canScrollToTop = !0;
- return e;
- }
- e > 0 && (this.canScrollToTop = !1);
- if (this.lastStartIndex != e) {
- this.lastStartIndex = e;
- return e;
- }
- return -1;
- },
- updateView: function(t) {
- var e = t, n = e + this.itemsVisibleNumber + 5, o = this.dataSet.length;
- if (!(e >= o)) {
- n > o && (n = o);
- for (var a = this.getRecycleItems(e - 3, n), l = 0; l < a.length; l++) this.itemNodePool.put(a[l]);
- for (var c, s = i(this.findUpdateIndex(e, n)); !(c = s()).done; ) {
- var r = c.value, h = this.getView(this.itemNodePool.get() || cc.instantiate(this.item), r);
- h && this.layoutVertical(h, r);
- }
- }
- },
- getRecycleItems: function(t, e) {
- for (var i = [], n = this.content.children, o = 0; o < n.length; o++) (n[o]._tag < t || n[o]._tag > e) && i.push(n[o]);
- return i;
- },
- findUpdateIndex: function(t, e) {
- for (var i = [], n = this.content.children, o = t; o < e; o++) {
- for (var a = !1, l = 0; l < n.length; l++) if (o == n[l]._tag) {
- a = !0;
- break;
- }
- a || i.push(o);
- }
- return i;
- },
- getView: function(t, e) {
- if (this.updateItemDataCallBack) {
- if (!this.dataSet[e]) {
- this.itemNodePool.put(t);
- return !1;
- }
- this.updateItemDataCallBack(t, this.dataSet[e], e);
- }
- return t;
- },
- layoutVertical: function(t, e) {
- if (cc.isValid(t, !0)) {
- this.content.addChild(t);
- t._tag = e;
- t.setPosition(0, -t.height * (.5 + e) - this.spacing * (e + 1));
- }
- },
- scrollviewEventCallback: function(t, e) {
- e == cc.ScrollView.EventType.BOUNCE_BOTTOM ? this.bounceBottomCallBack && this.bounceBottomCallBack() : e == cc.ScrollView.EventType.BOUNCE_TOP ? this.bounceTopCallBack && this.bounceTopCallBack() : e == cc.ScrollView.EventType.SCROLL_ENDED ? this.scrollEndedCallBack && this.scrollEndedCallBack() : e == cc.ScrollView.EventType.SCROLLING ? this.scrollingCallBack && this.scrollingCallBack() : e == cc.ScrollView.EventType.SCROLL_TO_BOTTOM ? this.scrollToBottomCallBack && this.scrollToBottomCallBack() : e == cc.ScrollView.EventType.SCROLL_TO_TOP && this.scrollToTopCallBack && this.scrollToTopCallBack();
- },
- getData: function() {
- return this.dataSet ? this.dataSet : [];
- },
- getPosition: function(t) {
- return -this.itemHeight * (.5 + t) - this.spacing * (t + 1);
- },
- initSlideBack: function(t) {
- HMFUtils.initSlideBack(this.scrollView.node, t);
- },
- removeChildrenView: function() {
- this.scrollView.content.removeAllChildren();
- }
- });
- cc._RF.pop();
- }, {} ],
- listViewDownToTopJs: [ function(t, e) {
- "use strict";
- cc._RF.push(e, "d442fQUJbpEhJskHdzo8ird", "listViewDownToTopJs");
- function i(t, e) {
- var i;
- if ("undefined" == typeof Symbol || null == t[Symbol.iterator]) {
- if (Array.isArray(t) || (i = n(t)) || e && t && "number" == typeof t.length) {
- i && (t = i);
- var o = 0;
- return function() {
- return o >= t.length ? {
- done: !0
- } : {
- done: !1,
- value: t[o++]
- };
- };
- }
- throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
- }
- return (i = t[Symbol.iterator]()).next.bind(i);
- }
- function n(t, e) {
- if (t) {
- if ("string" == typeof t) return o(t, e);
- var i = Object.prototype.toString.call(t).slice(8, -1);
- "Object" === i && t.constructor && (i = t.constructor.name);
- return "Map" === i || "Set" === i ? Array.from(t) : "Arguments" === i || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i) ? o(t, e) : void 0;
- }
- }
- function o(t, e) {
- (null == e || e > t.length) && (e = t.length);
- for (var i = 0, n = new Array(e); i < e; i++) n[i] = t[i];
- return n;
- }
- cc.Class({
- extends: cc.Component,
- properties: {
- scrollView: cc.ScrollView,
- bounceBottomCallBack: null,
- bounceTopCallBack: null,
- scrollEndedCallBack: null,
- scrollingCallBack: null,
- scrollToBottomCallBack: null,
- scrollToTopCallBack: null,
- updateItemDataCallBack: null,
- isToMoveBottom: !1,
- spacing: 0
- },
- start: function() {},
- setDataSet: function(t, e, i) {
- this.dataSet = t;
- this.parentJs = e;
- this.item = i;
- },
- updateDataSet: function(t, e) {
- var i = this;
- this.dataSet = t;
- this.content.height = this.dataSet.length * (this.itemHeight + this.spacing) + this.spacing;
- this.content.y < -Math.ceil(this.content.parent.height / 2) - this.itemHeight ? this.content.y = this.content.y - (this.itemHeight + this.spacing) : this.content.y = -Math.ceil(this.content.parent.height / 2);
- this.lastStartIndex = -1;
- if (e) for (var n = this.content.children, o = 0; o < n.length; o++) o < this.dataSet.length ? this.getView(n[o], n[o]._tag) : n[o].destroy();
- this.scheduleOnce(function() {
- i.startUpdate = !0;
- }, .1);
- },
- initUi: function() {
- var t = this;
- this.content = this.scrollView.content;
- this.lastStartIndex = -1;
- this.canScrollToTop = !1;
- this.itemNodePool = new cc.NodePool();
- var e = this.itemNodePool.get() || cc.instantiate(this.item);
- this.itemHeight = e.height;
- this.itemsVisibleNumber = Math.ceil(this.content.parent.height / this.itemHeight);
- this.content.height = this.dataSet.length * (this.itemHeight + this.spacing) + this.spacing;
- this.scheduleOnce(function() {
- t.itemsVisibleNumber = Math.ceil(t.content.parent.height / t.itemHeight);
- t.content.height < t.node.height && (t.content.height = t.node.height + 2);
- this.content.y = -Math.ceil(this.content.parent.height / 2);
- t.startUpdate = !0;
- }, .05);
- },
- update: function() {
- if (this.startUpdate) {
- var t = this.checkNeedUpdate();
- t >= 0 && this.updateView(t);
- }
- },
- checkNeedUpdate: function() {
- var t = Math.abs(this.content.y) - Math.floor(this.content.parent.height / 2), e = Math.floor(t / (this.itemHeight + this.spacing));
- if (e < 0 && !this.canScrollToTop) {
- this.scrollView.scrollToBottom();
- this.canScrollToTop = !0;
- return e;
- }
- e > 0 && (this.canScrollToTop = !1);
- if (this.lastStartIndex != e) {
- this.lastStartIndex = e;
- return e;
- }
- return -1;
- },
- updateView: function(t) {
- var e = t, n = e + this.itemsVisibleNumber + 5, o = this.dataSet.length;
- if (!(e >= o)) {
- n > o && (n = o);
- for (var a = this.getRecycleItems(e - 3, n), l = 0; l < a.length; l++) this.itemNodePool.put(a[l]);
- for (var c, s = i(this.findUpdateIndex(e, n)); !(c = s()).done; ) {
- var r = c.value, h = this.getView(this.itemNodePool.get() || cc.instantiate(this.item), r);
- h && this.layoutVertical(h, r);
- }
- }
- },
- getRecycleItems: function(t, e) {
- for (var i = [], n = this.content.children, o = 0; o < n.length; o++) (n[o]._tag < t || n[o]._tag > e) && i.push(n[o]);
- return i;
- },
- findUpdateIndex: function(t, e) {
- for (var i = [], n = this.content.children, o = t; o < e; o++) {
- for (var a = !1, l = 0; l < n.length; l++) if (o == n[l]._tag) {
- a = !0;
- break;
- }
- a || i.push(o);
- }
- return i;
- },
- getView: function(t, e) {
- if (this.updateItemDataCallBack) {
- if (!this.dataSet[e]) {
- this.itemNodePool.put(t);
- return !1;
- }
- this.updateItemDataCallBack(t, this.dataSet[e], e);
- }
- return t;
- },
- layoutVertical: function(t, e) {
- this.content.addChild(t);
- t._tag = e;
- t.setPosition(0, t.height * (.5 + e) + this.spacing * (e + 1));
- },
- scrollviewEventCallback: function(t, e) {
- e == cc.ScrollView.EventType.BOUNCE_BOTTOM ? this.bounceBottomCallBack && this.bounceBottomCallBack() : e == cc.ScrollView.EventType.BOUNCE_TOP ? this.bounceTopCallBack && this.bounceTopCallBack() : e == cc.ScrollView.EventType.SCROLL_ENDED ? this.scrollEndedCallBack && this.scrollEndedCallBack() : e == cc.ScrollView.EventType.SCROLLING ? this.scrollingCallBack && this.scrollingCallBack() : e == cc.ScrollView.EventType.SCROLL_TO_BOTTOM ? this.scrollToBottomCallBack && this.scrollToBottomCallBack() : e == cc.ScrollView.EventType.SCROLL_TO_TOP && this.scrollToTopCallBack && this.scrollToTopCallBack();
- },
- getData: function() {
- return this.dataSet ? this.dataSet : [];
- },
- getPosition: function(t) {
- return this.itemHeight * (.5 + t) + this.spacing * (t + 1);
- }
- });
- cc._RF.pop();
- }, {} ],
- testScene: [ function(t, e) {
- "use strict";
- cc._RF.push(e, "5a644LL5BhBxbYixJay9S9H", "testScene");
- cc.Class({
- extends: cc.Component,
- properties: {},
- start: function() {},
- clickBack: function() {
- SceneMgr.loadScene("hallCommon", {
- scene: "game"
- });
- }
- });
- cc._RF.pop();
- }, {} ]
- }, {}, [ "UserListView", "listViewDownToTopJs", "testScene" ]);
|