This commit is contained in:
2025-07-17 17:18:21 +08:00
commit 1ffc1b5cf0
5309 changed files with 1150310 additions and 0 deletions
@@ -0,0 +1,13 @@
{
"ver": "1.1.50",
"importer": "prefab",
"imported": true,
"uuid": "54bfe600-9105-42b7-8725-fbd33f2cbfaa",
"files": [
".json"
],
"subMetas": {},
"userData": {
"syncNodeName": "levelItem"
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 111 KiB

@@ -0,0 +1,134 @@
{
"ver": "1.0.27",
"importer": "image",
"imported": true,
"uuid": "0746e360-dfa4-4d01-8f01-867d2d995362",
"files": [
".json",
".png"
],
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "0746e360-dfa4-4d01-8f01-867d2d995362@6c48a",
"displayName": "greta_shy",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "clamp-to-edge",
"wrapModeT": "clamp-to-edge",
"imageUuidOrDatabaseUri": "0746e360-dfa4-4d01-8f01-867d2d995362",
"isUuid": true,
"visible": false,
"minfilter": "linear",
"magfilter": "linear",
"mipfilter": "none",
"anisotropy": 0
},
"ver": "1.0.22",
"imported": true,
"files": [
".json"
],
"subMetas": {}
},
"f9941": {
"importer": "sprite-frame",
"uuid": "0746e360-dfa4-4d01-8f01-867d2d995362@f9941",
"displayName": "greta_shy",
"id": "f9941",
"name": "spriteFrame",
"userData": {
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": -16,
"offsetY": -15,
"trimX": 35,
"trimY": 30,
"width": 823,
"height": 1159,
"rawWidth": 925,
"rawHeight": 1189,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": true,
"pixelsToUnit": 100,
"pivotX": 0.5,
"pivotY": 0.5,
"meshType": 0,
"vertices": {
"rawPosition": [
-411.5,
-579.5,
0,
411.5,
-579.5,
0,
-411.5,
579.5,
0,
411.5,
579.5,
0
],
"indexes": [
0,
1,
2,
2,
1,
3
],
"uv": [
35,
1159,
858,
1159,
35,
0,
858,
0
],
"nuv": [
0.03783783783783784,
0,
0.9275675675675675,
0,
0.03783783783783784,
0.9747687132043734,
0.9275675675675675,
0.9747687132043734
],
"minPos": [
-411.5,
-579.5,
0
],
"maxPos": [
411.5,
579.5,
0
]
},
"isUuid": true,
"imageUuidOrDatabaseUri": "0746e360-dfa4-4d01-8f01-867d2d995362@6c48a",
"atlasUuid": ""
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"type": "sprite-frame",
"hasAlpha": true,
"fixAlphaTransparencyArtifacts": false,
"redirect": "0746e360-dfa4-4d01-8f01-867d2d995362@6c48a"
}
}
@@ -0,0 +1,229 @@
import { _decorator, Color, Label, Node, Sprite, view } from 'cc';
import { GButton } from '../../Main/Common/GButton';
import Utils from '../../Main/Common/Utils';
import li_BaseView from '../../Main/Common/li_BaseView';
import HttpUnit from '../../Main/Common/HttpUnit';
import SubManager from '../SubManager';
import GameManager from '../../Main/Manager/GameManager';
const { ccclass, property } = _decorator;
/**广告、分享的用途类型 */
export enum E_AD_TARGET {
/**加相亲次数 */
xiangqin = 1,
/**加聊天次数 */
liaotian = 2,
/**对话评分+10 */
baoji = 3,
/**撤回上一轮对话 */
chehui = 4,
}
//关卡内看广告弹窗界面
@ccclass('TalkAdDialog')
export class TalkAdDialog extends li_BaseView {
private _nodeTab: any = {};
private _data;
//----重写父类接口---------------------------------------
onLoadCT() {
this.registerListenner();
Utils.parseNode(this.node, this._nodeTab)
}
openUIDataCT(data: any): void {
this._data = data || {};
}
registerListenner() {
// Utils.addInnerEL(InnerMsgCode.GM_UI_Close, this, this.resiveGMClose)
}
start() {
GButton.BandClick(this._nodeTab.mask, ()=>{
if (this._data.closeCallback) {
this._data.closeCallback();
}
this.onClose();
}, this, 0, null, null, false);
GButton.BandClick(this._nodeTab.btnClose, ()=>{
if (this._data.closeCallback) {
this._data.closeCallback();
}
this.onClose();
}, this);
GButton.BandClick(this._nodeTab.btnCancel, ()=>{
if (this._data.closeCallback) {
this._data.closeCallback();
}
this.onClose();
}, this);
GButton.BandClick(this._nodeTab.btnFree, ()=>{
if (this._data.adCallback) {
this._data.adCallback(true);
}
this.onClose();
}, this);
GButton.BandClick(this._nodeTab.btnShare, ()=>{
if (this._data.type == E_AD_TARGET.liaotian) {
let levelData = GameManager.CurLevelData
if (levelData && levelData.share_num <= 0) {
SubManager.ShowPrompt("今日分享次数已用完");
return;
}
}
if (this._data.type == E_AD_TARGET.xiangqin && HttpUnit.GetXiangqinShareNum() <= 0) {
SubManager.ShowPrompt("今日分享次数已用完");
return;
}
if (this._data.shareCallback) {
this._data.shareCallback();
}
this.onClose();
}, this);
GButton.BandClick(this._nodeTab.btnAD, ()=>{
if (this._data.type == E_AD_TARGET.liaotian) {
let levelData = GameManager.CurLevelData
if (levelData && levelData.ad_num <= 0) {
SubManager.ShowPrompt("关卡内续航次数已用完");
return;
}
}
if (this._data.type == E_AD_TARGET.xiangqin && HttpUnit.GetXiangqinAdNum() <= 0) {
SubManager.ShowPrompt("今日广告次数已用完");
return;
}
if (this._data.type == E_AD_TARGET.baoji) {
let levelData = GameManager.CurLevelData
if (levelData) {
if (levelData.can_use_strength_cnt <= 0) {
SubManager.ShowPrompt("关卡内加分次数已用完");
return;
}
if (levelData.is_strength_take_effect == true) {
SubManager.ShowPrompt("“甜蜜暴击”效果已生效,效果不可叠加");
return;
}
}
}
if (this._data.type == E_AD_TARGET.chehui) {
let levelData = GameManager.CurLevelData
if (levelData && levelData.can_use_cancel_cnt <= 0) {
SubManager.ShowPrompt("关卡内撤回次数已用完");
return;
}
}
if (this._data.adCallback) {
this._data.adCallback();
}
this.onClose();
}, this);
Utils.setString(this._nodeTab.labContent, this._data.content);
//关卡内聊天不再显示分享按钮
let showshare = false
if (this._data.type == E_AD_TARGET.xiangqin) {
showshare = true
}
this._nodeTab.btnShare.active = showshare;
this._nodeTab.btnCancel.active = !showshare;
//免费使用次数逻辑
let isfree = false
if (this._data.type == E_AD_TARGET.baoji) {
let levelData = GameManager.CurLevelData
if (levelData) {
if (levelData.first_strength == undefined || levelData.first_strength == 0) {
isfree = true
}
}
} else if (this._data.type == E_AD_TARGET.chehui) {
let levelData = GameManager.CurLevelData
if (levelData) {
if (levelData.first_cancel == undefined || levelData.first_cancel == 0) {
isfree = true
}
}
}
this._nodeTab.btnFree.active = isfree;
this._nodeTab.btnAD.active = !isfree;
//次数用完后置灰按钮
this.refreshBtnState()
}
//刷新按钮状态
private refreshBtnState() {
//分享按钮
let shareGray = false
if (this._data.type == E_AD_TARGET.liaotian) {
let levelData = GameManager.CurLevelData
if (levelData && levelData.share_num <= 0) {
shareGray = true
}
} else if (this._data.type == E_AD_TARGET.xiangqin) {
if (HttpUnit.GetXiangqinShareNum() <= 0) {
shareGray = true
}
}
if (shareGray) {
let shareSpt: Sprite = this._nodeTab.btnShare.getComponent(Sprite);
shareSpt.grayscale = true;
shareSpt.color = new Color(173, 173, 173, 255);
}
//广告按钮
let adGray = false
if (this._data.type == E_AD_TARGET.liaotian) {
let levelData = GameManager.CurLevelData
if (levelData && levelData.ad_num <= 0) {
Utils.setNodeGray(this._nodeTab.btnAD, true);
adGray = true
}
} else if (this._data.type == E_AD_TARGET.xiangqin) {
if (HttpUnit.GetXiangqinAdNum() <= 0) {
Utils.setNodeGray(this._nodeTab.btnAD, true);
adGray = true
}
} else if (this._data.type == E_AD_TARGET.baoji) {
let levelData = GameManager.CurLevelData
if (levelData) {
if (levelData.can_use_strength_cnt <= 0 || levelData.is_strength_take_effect == true) {
adGray = true
}
}
} else if (this._data.type == E_AD_TARGET.chehui) {
let levelData = GameManager.CurLevelData
if (levelData && levelData.can_use_cancel_cnt <= 0) {
adGray = true
}
}
if (adGray) {
let adSpt: Sprite = this._nodeTab.btnAD.getComponent(Sprite);
adSpt.grayscale = true;
let adSpt1: Sprite = this._nodeTab.adSpt1.getComponent(Sprite);
adSpt1.color = new Color(255, 255, 255, 130);
let labYes: Label = this._nodeTab.labYes.getComponent(Label);
labYes.color = new Color(173, 173, 173, 255);
}
}
update(deltaTime: number) {
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 424 KiB

@@ -0,0 +1,134 @@
{
"ver": "1.0.27",
"importer": "image",
"imported": true,
"uuid": "3c386f8d-4eb4-4d48-99a5-fb808483ebbb",
"files": [
".jpg",
".json"
],
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "3c386f8d-4eb4-4d48-99a5-fb808483ebbb@6c48a",
"displayName": "amy_3_cg",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "clamp-to-edge",
"wrapModeT": "clamp-to-edge",
"imageUuidOrDatabaseUri": "3c386f8d-4eb4-4d48-99a5-fb808483ebbb",
"isUuid": true,
"visible": false,
"minfilter": "linear",
"magfilter": "linear",
"mipfilter": "none",
"anisotropy": 0
},
"ver": "1.0.22",
"imported": true,
"files": [
".json"
],
"subMetas": {}
},
"f9941": {
"importer": "sprite-frame",
"uuid": "3c386f8d-4eb4-4d48-99a5-fb808483ebbb@f9941",
"displayName": "amy_3_cg",
"id": "f9941",
"name": "spriteFrame",
"userData": {
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 996,
"height": 1280,
"rawWidth": 996,
"rawHeight": 1280,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": true,
"pixelsToUnit": 100,
"pivotX": 0.5,
"pivotY": 0.5,
"meshType": 0,
"vertices": {
"rawPosition": [
-498,
-640,
0,
498,
-640,
0,
-498,
640,
0,
498,
640,
0
],
"indexes": [
0,
1,
2,
2,
1,
3
],
"uv": [
0,
1280,
996,
1280,
0,
0,
996,
0
],
"nuv": [
0,
0,
1,
0,
0,
1,
1,
1
],
"minPos": [
-498,
-640,
0
],
"maxPos": [
498,
640,
0
]
},
"isUuid": true,
"imageUuidOrDatabaseUri": "3c386f8d-4eb4-4d48-99a5-fb808483ebbb@6c48a",
"atlasUuid": ""
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"type": "sprite-frame",
"hasAlpha": false,
"fixAlphaTransparencyArtifacts": false,
"redirect": "3c386f8d-4eb4-4d48-99a5-fb808483ebbb@6c48a"
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 161 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 879 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 800 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

File diff suppressed because it is too large Load Diff
@@ -0,0 +1,134 @@
{
"ver": "1.0.27",
"importer": "image",
"imported": true,
"uuid": "c74c5735-42a7-43a7-8e2b-42b3ce25776b",
"files": [
".json",
".png"
],
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "c74c5735-42a7-43a7-8e2b-42b3ce25776b@6c48a",
"displayName": "pauline_stage_icon",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "clamp-to-edge",
"wrapModeT": "clamp-to-edge",
"imageUuidOrDatabaseUri": "c74c5735-42a7-43a7-8e2b-42b3ce25776b",
"isUuid": true,
"visible": false,
"minfilter": "linear",
"magfilter": "linear",
"mipfilter": "none",
"anisotropy": 0
},
"ver": "1.0.22",
"imported": true,
"files": [
".json"
],
"subMetas": {}
},
"f9941": {
"importer": "sprite-frame",
"uuid": "c74c5735-42a7-43a7-8e2b-42b3ce25776b@f9941",
"displayName": "pauline_stage_icon",
"id": "f9941",
"name": "spriteFrame",
"userData": {
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 174,
"height": 174,
"rawWidth": 174,
"rawHeight": 174,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": true,
"pixelsToUnit": 100,
"pivotX": 0.5,
"pivotY": 0.5,
"meshType": 0,
"vertices": {
"rawPosition": [
-87,
-87,
0,
87,
-87,
0,
-87,
87,
0,
87,
87,
0
],
"indexes": [
0,
1,
2,
2,
1,
3
],
"uv": [
0,
174,
174,
174,
0,
0,
174,
0
],
"nuv": [
0,
0,
1,
0,
0,
1,
1,
1
],
"minPos": [
-87,
-87,
0
],
"maxPos": [
87,
87,
0
]
},
"isUuid": true,
"imageUuidOrDatabaseUri": "c74c5735-42a7-43a7-8e2b-42b3ce25776b@6c48a",
"atlasUuid": ""
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"type": "sprite-frame",
"hasAlpha": true,
"fixAlphaTransparencyArtifacts": false,
"redirect": "c74c5735-42a7-43a7-8e2b-42b3ce25776b@6c48a"
}
}
@@ -0,0 +1,134 @@
{
"ver": "1.0.27",
"importer": "image",
"imported": true,
"uuid": "cbfd32fd-3e5a-44be-9aa4-029cd71aa035",
"files": [
".json",
".png"
],
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "cbfd32fd-3e5a-44be-9aa4-029cd71aa035@6c48a",
"displayName": "hilaryvel_shy",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "clamp-to-edge",
"wrapModeT": "clamp-to-edge",
"imageUuidOrDatabaseUri": "cbfd32fd-3e5a-44be-9aa4-029cd71aa035",
"isUuid": true,
"visible": false,
"minfilter": "linear",
"magfilter": "linear",
"mipfilter": "none",
"anisotropy": 0
},
"ver": "1.0.22",
"imported": true,
"files": [
".json"
],
"subMetas": {}
},
"f9941": {
"importer": "sprite-frame",
"uuid": "cbfd32fd-3e5a-44be-9aa4-029cd71aa035@f9941",
"displayName": "hilaryvel_shy",
"id": "f9941",
"name": "spriteFrame",
"userData": {
"trimType": "none",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 925,
"height": 1189,
"rawWidth": 925,
"rawHeight": 1189,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": true,
"pixelsToUnit": 100,
"pivotX": 0.5,
"pivotY": 0.5,
"meshType": 0,
"vertices": {
"rawPosition": [
-462.5,
-594.5,
0,
462.5,
-594.5,
0,
-462.5,
594.5,
0,
462.5,
594.5,
0
],
"indexes": [
0,
1,
2,
2,
1,
3
],
"uv": [
0,
1189,
925,
1189,
0,
0,
925,
0
],
"nuv": [
0,
0,
1,
0,
0,
1,
1,
1
],
"minPos": [
-462.5,
-594.5,
0
],
"maxPos": [
462.5,
594.5,
0
]
},
"isUuid": true,
"imageUuidOrDatabaseUri": "cbfd32fd-3e5a-44be-9aa4-029cd71aa035@6c48a",
"atlasUuid": ""
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"type": "sprite-frame",
"hasAlpha": true,
"fixAlphaTransparencyArtifacts": false,
"redirect": "cbfd32fd-3e5a-44be-9aa4-029cd71aa035@6c48a"
}
}
@@ -0,0 +1,134 @@
{
"ver": "1.0.27",
"importer": "image",
"imported": true,
"uuid": "9300dd62-0e81-40a6-99e6-4019023cff42",
"files": [
".jpg",
".json"
],
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "9300dd62-0e81-40a6-99e6-4019023cff42@6c48a",
"displayName": "allie_2_cg",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "clamp-to-edge",
"wrapModeT": "clamp-to-edge",
"imageUuidOrDatabaseUri": "9300dd62-0e81-40a6-99e6-4019023cff42",
"isUuid": true,
"visible": false,
"minfilter": "linear",
"magfilter": "linear",
"mipfilter": "none",
"anisotropy": 0
},
"ver": "1.0.22",
"imported": true,
"files": [
".json"
],
"subMetas": {}
},
"f9941": {
"importer": "sprite-frame",
"uuid": "9300dd62-0e81-40a6-99e6-4019023cff42@f9941",
"displayName": "allie_2_cg",
"id": "f9941",
"name": "spriteFrame",
"userData": {
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 996,
"height": 1280,
"rawWidth": 996,
"rawHeight": 1280,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": true,
"pixelsToUnit": 100,
"pivotX": 0.5,
"pivotY": 0.5,
"meshType": 0,
"vertices": {
"rawPosition": [
-498,
-640,
0,
498,
-640,
0,
-498,
640,
0,
498,
640,
0
],
"indexes": [
0,
1,
2,
2,
1,
3
],
"uv": [
0,
1280,
996,
1280,
0,
0,
996,
0
],
"nuv": [
0,
0,
1,
0,
0,
1,
1,
1
],
"minPos": [
-498,
-640,
0
],
"maxPos": [
498,
640,
0
]
},
"isUuid": true,
"imageUuidOrDatabaseUri": "9300dd62-0e81-40a6-99e6-4019023cff42@6c48a",
"atlasUuid": ""
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"type": "sprite-frame",
"hasAlpha": false,
"fixAlphaTransparencyArtifacts": false,
"redirect": "9300dd62-0e81-40a6-99e6-4019023cff42@6c48a"
}
}
@@ -0,0 +1,181 @@
import { _decorator } from "cc";
const { ccclass, property } = _decorator;
//事件管理器
@ccclass
export default class li_EventManager {
private static _Instance: li_EventManager = null;
private _netEvent: object = {};
private _innerEvent: object = {};
public static get I(): li_EventManager {
if (!li_EventManager._Instance) {
li_EventManager._Instance = new li_EventManager();
}
return li_EventManager._Instance;
}
/**监听网络事件 */
public onNetEL(netCodeId: number | string, ...param: any[]) {
if (netCodeId) {
let handlerArray = this._netEvent[netCodeId];
if (!handlerArray) {
return;
}
for (let i = 0; i < handlerArray.length; i++) {
const func = handlerArray[i];
if (func) {
if (func.i_target) {
func.apply(func.i_target, param);
} else {
func(param[0], param[1]);
}
}
}
}
}
/**添加网络事件 */
public addNetEL(netCodeId: number | string, i_callback: any, i_target: any = null): void {
if (this._netEvent[netCodeId] == null) {
this._netEvent[netCodeId] = [];
}
i_callback.i_target = i_target;
this._netEvent[netCodeId].push(i_callback);
}
/**移除网络事件 */
public removeNetEL(netCodeId: number | string, i_callback: any) {
let handlerArray = this._netEvent[netCodeId];
if (!handlerArray) return;
let index = handlerArray.indexOf(i_callback);
if (index >= 0) {
handlerArray.splice(index, 1);
for (let idx in handlerArray) {
if (handlerArray[+idx] == i_callback) {
return;
}
}
i_callback.i_target = null;
}
}
/**监听本地事件 */
public onInnerEL(innerId: number | string, ...param: any[]) {
if (this._innerEvent[innerId] == null) {
return;
}
let handlerArray: Array<any> = this._innerEvent[innerId];
let i: number = 0;
let length: number = handlerArray.length;
let handler: Array<any> = null;
while (i < length) {
handler = handlerArray[i];
if (handler == null) {
i++;
continue;
}
if ((handler[1] && handler[1]["isValid"] && handler[1]["isValid"] == false) ||
(handler[1] && handler[1]["node"] && handler[1]["node"]["isValid"] && handler[1]["node"]["isValid"] == false)) {
//当前事件的节点以失效或销毁(事件未移除)
handlerArray.splice(i, 1);
} else {
try {
handler[0].apply(handler[1], param);
} catch (e) {
console.error("innerErr:" + e.stack);
}
}
if (handlerArray.length != length) {
length = handlerArray.length;
i--;
}
i++;
}
}
/**添加本地事件 */
public addInnerEL(innerId: number | string, i_callback: Function, obj: any): void {
let handlerArray: Array<any> = this._innerEvent[innerId];
if (handlerArray == null) {
handlerArray = [];
this._innerEvent[innerId] = handlerArray;
}
//检测是否已经存在
for (let i = 0; i < handlerArray.length; i++) {
if (handlerArray[i] == null || (handlerArray[i][0] == i_callback && handlerArray[i][1] == obj)) {
return;
}
}
this._innerEvent[innerId].push([i_callback, obj]);
}
/**移除本地事件 */
public removeInnerEL(innerId: number | string, i_callback: Function, obj: any) {
let handlerArray: Array<any> = this._innerEvent[innerId];
if (!handlerArray) return;
for (let i = 0; i < handlerArray.length; i++) {
if (handlerArray[i] == null || (handlerArray[i][0] == i_callback && handlerArray[i][1] == obj)) {
handlerArray.splice(i, 1);
break;
}
}
if (handlerArray.length == 0) {
handlerArray[innerId] = null;
delete this._innerEvent[innerId];
}
}
/**
* 移除某一对象的所有内部监听
* @param listenerObj 侦听函数所属对象
*/
public removeAllInnerEL(listenerObj: any): void {
let keys = Object.keys(this._innerEvent);
for (let i: number = 0, len = keys.length; i < len; i++) {
let type = keys[i];
let arr: Array<any> = this._innerEvent[type];
if (arr) {
for (let j = 0; j < arr.length; j++) {
if (arr[j][1] == listenerObj) {
arr.splice(j, 1);
j--;
}
}
if (arr.length == 0) {
delete this._innerEvent[type];
}
}
}
}
/**
* 移除某一对象的所有网络监听
* @param listenerObj 侦听函数所属对象
*/
public removeAllNetEL(listenerObj: any): void {
let keys = Object.keys(this._netEvent);
for (let i: number = 0, len = keys.length; i < len; i++) {
let type = keys[i];
let arr: Array<any> = this._netEvent[type];
if (arr) {
for (let j = 0; j < arr.length; j++) {
if (arr[j].i_target == listenerObj) {
arr.splice(j, 1);
j--;
}
}
if (arr.length == 0) {
delete this._netEvent[type];
}
}
}
}
/**移除所有监听 */
public removeAllEL() {
this._netEvent = {};
this._innerEvent = {};
}
}
@@ -0,0 +1,73 @@
import { _decorator, Label, Node, Toggle } from 'cc';
import { GButton } from '../../Main/Common/GButton';
import AudioManager from '../../Main/Manager/AudioManager';
import Utils from '../../Main/Common/Utils';
import li_BaseView from '../../Main/Common/li_BaseView';
import PlayerDataManager from '../../Main/Manager/PlayerDataManager';
import { InnerMsgCode } from '../../Main/Config/InnerMsgCode';
import { SDKManager } from '../../Main/Channel/SDKManager';
import SubManager from '../SubManager';
const { ccclass, property } = _decorator;
//GM命令
@ccclass('GM_UI')
export class GM_UI extends li_BaseView {
private _nodeTab: any = {};
onLoad() {
this._nodeTab = {}
}
start() {
Utils.parseNode(this.node, this._nodeTab)
GButton.BandClick(this._nodeTab.BtnClose, this.onCloseClick, this);
GButton.BandClick(this._nodeTab.btnClearCundang, this.onQingdangClick, this);
let musicTg: Toggle = this._nodeTab.musicTg.getComponent(Toggle)
musicTg.isChecked = PlayerDataManager.I.IsMusicOn
let soudTg: Toggle = this._nodeTab.soudTg.getComponent(Toggle)
soudTg.isChecked = PlayerDataManager.I.IsSoundOn
//GM Log
let gmLog = this._nodeTab.gmLogLable.getComponent(Label)
gmLog.string = "GM Log:\n" + SDKManager.GMLogString
}
update(deltaTime: number) {
}
//音效开关变化事件 prefab中调用
onSoundEvent(target: Toggle, arg2) {
if (target) {
PlayerDataManager.I.SetSoundOn(target.isChecked)
}
}
//音乐开关变化事件 prefab中调用
onMusicEvent(target: Toggle, arg2) {
if (target) {
PlayerDataManager.I.SetMusicOn(target.isChecked)
}
}
//清除存档
onQingdangClick() {
PlayerDataManager.clearAll()
SubManager.ShowPrompt("清除存档成功")
}
//关闭按钮
onCloseClick() {
this.onClose()
Utils.sendInnerMsg(InnerMsgCode.GM_UI_Close, {id:1})
}
}