| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129 |
- cc.Class({
- extends: cc.BaseClass,
- properties: {},
- ctor: function () {
- this.m_ImgArr = new Array();
- this.m_nNeedUpdate = 0;
- },
- OnClicked_Toggle: function (Tag) {
- cc.gSoundRes.PlaySound('Button');
- this.m_nNeedUpdate = 1;
- },
- onLoad: function () {
- if (!this.m_Toggle) this.m_Toggle = this.$('Toggle@Toggle');
- if (this.m_Toggle) this.m_Toggle.node.active = false;
- },
- update: function () {
- if (this.m_nNeedUpdate > 0) {
- this.m_nNeedUpdate--;
- } else {
- return;
- }
- if (this.m_Toggle.isChecked) {
- cc.sys.localStorage.setItem(window.Key_ActivityPop, new Date().getTime());
-
- } else {
- cc.sys.localStorage.setItem(window.Key_ActivityPop, 0);
- }
- },
- OnShowData: function (LeagueID, ClubID, KindID) {
- if (this.m_Toggle) {
- if(LeagueID || ClubID || KindID) {
- this.m_Toggle.node.active = false;
- } else {
- this.m_Toggle.node.active = true;
- var ActivityPop = parseInt(cc.sys.localStorage.getItem(window.Key_ActivityPop));
- if (!ActivityPop) {
- this.m_Toggle.isChecked = false;
- } else {
- var last = new Date(ActivityPop);
- var cur = new Date();
- if (last.getFullYear() != cur.getFullYear() || last.getMonth() != cur.getMonth() || last.getDay() != cur.getDay()) {
- this.m_Toggle.isChecked = false;
- }
- }
- }
- }
- if (this.m_ListCtrl == null) this.m_ListCtrl = this.$('@CustomListCtrl');
- this.m_ListCtrl.InitList(0, 'Activity', this);
- var webUrl = `${window.PHP_HOME}/Activity.php?LeagueID=${LeagueID}&ClubID=${ClubID}`;
- WebCenter.GetData(webUrl, 60, function (data) {
- var DataList = JSON.parse(data);
- for (var i = 0; i < DataList.length; i++) {
- DataList[i][0] = i;
- this.m_ListCtrl.InsertListInfo(0, DataList[i]); //.push(i == 0)
- }
- //设置俱乐部公告标签
- if (ClubID) {
- var strTag = KindID > 1 ? '聯盟公告' : '俱樂部公告';
- var DataArr = [100, strTag, ClubID, '', 100];
- this.m_ListCtrl.InsertListInfo(0, DataArr); //.push(i == 0)
- }
- if (KindID) {
- var DataArr = [101, '專屬公告', ClubID, '', 100];
- this.m_ListCtrl.InsertListInfo(0, DataArr); //.push(i == 0)
- }
- }.bind(this));
- },
- OnChangeView: function (m_DataArr) {
-
- // if (Type == 1) {
- // this.$('ScrollView/view/content/RichText').active = true;
- // this.$('ScrollView/view/content/Sprite').active = false;
- // this.$('ScrollView/view/content/RichText@RichText').string = Url;
- // } else {
- // this.$('ScrollView/view/content/RichText').active = false;
- // this.$('ScrollView/view/content/Sprite').active = true;
- // var ImgUrl = window.PHP_HOME + '/HeadImage.php?url=' + Url;
- // this.$('ScrollView/view/content/Sprite@CustomImage').SetImageUrl(ImgUrl);
- // }
-
- if(m_DataArr[3]){this.$('ScrollView/view/content/RichText').active = true;}
- else {this.$('ScrollView/view/content/RichText').active = false;}
- if(m_DataArr[2]=='http://127.0.0.1:8081/') {this.$('ScrollView/view/content/Sprite').active = false;}
- else {this.$('ScrollView/view/content/Sprite').active = true;}
-
- this.$('ScrollView/view/content/RichText@RichText').string = m_DataArr[3];
- var ImgUrl = window.PHP_HOME + '/HeadImage.php?url=' + m_DataArr[2];
- this.$('ScrollView/view/content/Sprite@CustomImage').SetImageUrl(ImgUrl);
- },
- OnShowClubNotice: function (ClubID, type) {
- this.$('ScrollView/view/content/RichText').active = false;
- this.$('ScrollView/view/content/Sprite').active = false;
- this.ShowPrefabDLG("ClubNotice", null, function (Js) {
- Js.OnShowNotice(ClubID, type);
- });
- },
- ///////////////////////////////////////////////////////////////////
- //Pre js
- InitPre: function () {},
- SetPreInfo: function (ParaArr) { //
-
- this.m_DataArr = ParaArr;
- this.$('Background/Label@Label').string = ParaArr[1];
- this.$('Background/checkmark/Label@Label').string = ParaArr[1];
- if (ParaArr[0] == 0) {
- this.$('@Toggle').isChecked = false;
- this.$('@Toggle').check();
- }
- },
- OnClick_ShowData: function () {
- //加载联盟公告
- if (this.m_DataArr[4] == 100) {
- this.m_Hook.OnShowClubNotice(this.m_DataArr[2], this.m_DataArr[0] == 100 ? 0 : 1);
- return;
- }
- if (this.m_Hook['m_JsClubNotice']) this.m_Hook['m_JsClubNotice'].node.active = false;
- // var ViewIndex = 2;
- // if (this.m_DataArr[4] == 1) ViewIndex = 3;
- // this.m_Hook.OnChangeView(this.m_DataArr[ViewIndex], this.m_DataArr[4]);
- this.m_Hook.OnChangeView(this.m_DataArr);
- },
- });
|