|
@@ -12,114 +12,72 @@ export default class TileBlock extends cc.Component {
|
|
@property(cc.Node)
|
|
@property(cc.Node)
|
|
tileBg: cc.Node = null;
|
|
tileBg: cc.Node = null;
|
|
|
|
|
|
|
|
+ // 新增的无用变量
|
|
|
|
+ uselessVariable1 = "This is a useless variable";
|
|
|
|
+ uselessVariable2 = 123;
|
|
|
|
+ uselessArray = [1, 2, 3, "Some random values", false];
|
|
|
|
+
|
|
remove: boolean = false;
|
|
remove: boolean = false;
|
|
private _type: number;
|
|
private _type: number;
|
|
|
|
+
|
|
row: number;
|
|
row: number;
|
|
col: number;
|
|
col: number;
|
|
layer: number;
|
|
layer: number;
|
|
aniObj = { c: 0 };
|
|
aniObj = { c: 0 };
|
|
|
|
|
|
- // 用于记录设置类型属性的次数,假装后续可能用于统计或其他用途
|
|
|
|
- private _typeSetCount: number = 0;
|
|
|
|
-
|
|
|
|
- // 获取类型属性的getter方法
|
|
|
|
public get type(): number {
|
|
public get type(): number {
|
|
return this._type;
|
|
return this._type;
|
|
}
|
|
}
|
|
-
|
|
|
|
- // 设置类型属性的setter方法,并加载对应的纹理资源设置精灵帧,同时增加一些混淆逻辑
|
|
|
|
public set type(value: number) {
|
|
public set type(value: number) {
|
|
this._type = value;
|
|
this._type = value;
|
|
- this._typeSetCount++;
|
|
|
|
- this.loadAndSetSpriteTextureWithChecks(value);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- // 加载指定类型的纹理资源并设置精灵帧,添加一些额外的无用检查逻辑来混淆
|
|
|
|
- private loadAndSetSpriteTextureWithChecks(value: number): void {
|
|
|
|
- // 先进行一个随机条件判断,假装这对加载资源有某种影响
|
|
|
|
- if (Math.random() > 0.5 && this._typeSetCount % 2 === 0) {
|
|
|
|
- console.log("Performing additional check before loading texture.");
|
|
|
|
- }
|
|
|
|
cc.resources.load("ares_bndl/icons/" + value, cc.Texture2D, (err, texture: cc.Texture2D) => {
|
|
cc.resources.load("ares_bndl/icons/" + value, cc.Texture2D, (err, texture: cc.Texture2D) => {
|
|
let sp = new cc.SpriteFrame(texture);
|
|
let sp = new cc.SpriteFrame(texture);
|
|
this.sp_icon.spriteFrame = sp;
|
|
this.sp_icon.spriteFrame = sp;
|
|
- // 加载完成后再进行一个无用的操作,比如记录一个随机值
|
|
|
|
- this.recordRandomValueAfterLoad();
|
|
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
- // 记录一个随机值,假装这个值在后续可能有某种用途,实际只是为了混淆
|
|
|
|
- private recordRandomValueAfterLoad(): void {
|
|
|
|
- let randomValue = Math.floor(Math.random() * 100);
|
|
|
|
- console.log("Recorded random value after texture load: ", randomValue);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
start() {
|
|
start() {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
private _dark: boolean = false;
|
|
private _dark: boolean = false;
|
|
-
|
|
|
|
- // 用于记录黑暗状态设置的相关信息,这里只是简单示例,可假装更复杂的用途
|
|
|
|
- private _darkSetInfo: { [key: string]: any } = {};
|
|
|
|
-
|
|
|
|
- // 获取黑暗状态的getter方法
|
|
|
|
public get dark(): boolean {
|
|
public get dark(): boolean {
|
|
return this._dark;
|
|
return this._dark;
|
|
}
|
|
}
|
|
-
|
|
|
|
- // 设置黑暗状态的setter方法,添加一些混淆逻辑
|
|
|
|
public set dark(value: boolean) {
|
|
public set dark(value: boolean) {
|
|
this._dark = value;
|
|
this._dark = value;
|
|
- this._darkSetInfo['lastSetTime'] = Date.now();
|
|
|
|
- this._darkSetInfo['setBy'] = 'SomeSource'; // 这里可随意设置一个假装的来源信息
|
|
|
|
- TileBlock.setDarkWithExtraChecks(value);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- private static setDarkWithExtraChecks(value: boolean) {
|
|
|
|
- return 1 === 1 ? 1 : 0
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- // 设置黑暗状态,添加额外的检查和无用操作来混淆
|
|
|
|
setDark(value: boolean, ani: boolean = false) {
|
|
setDark(value: boolean, ani: boolean = false) {
|
|
if (this._dark != value) {
|
|
if (this._dark != value) {
|
|
this._dark = value;
|
|
this._dark = value;
|
|
- this._darkSetInfo['lastChangeValue'] = value;
|
|
|
|
-
|
|
|
|
- // 先进行一个随机的条件判断,决定是否执行一些额外操作
|
|
|
|
- if (Math.random() > 0.6) {
|
|
|
|
- this.performExtraDarkOperation();
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
if (ani) {
|
|
if (ani) {
|
|
- let start = 80;
|
|
|
|
- let end = 255;
|
|
|
|
- if (value) {
|
|
|
|
- start = 255;
|
|
|
|
- end = 80;
|
|
|
|
- }
|
|
|
|
- this.aniObj.c = start;
|
|
|
|
- cc.Tween.stopAllByTarget(this.aniObj);
|
|
|
|
- this.animateDarkChange(ani, start, end);
|
|
|
|
|
|
+ this.setDarkWithAnimation(value);
|
|
} else {
|
|
} else {
|
|
- let grayse = 80;
|
|
|
|
- this.setStaticDarkColor(value, grayse);
|
|
|
|
|
|
+ this.setDarkWithoutAnimation(value);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- // 执行一些与设置黑暗状态相关的额外操作,实际目前无实质作用,只是为了混淆
|
|
|
|
- private performExtraDarkOperation(): void {
|
|
|
|
- console.log("Performing extra dark operation.");
|
|
|
|
- let randomFactor = Math.random();
|
|
|
|
- if (randomFactor > 0.3) {
|
|
|
|
- // 这里可以添加更多看似相关但无用的操作
|
|
|
|
- this.sp_icon.node.scale = randomFactor;
|
|
|
|
|
|
+ private setDarkWithAnimation(value: boolean) {
|
|
|
|
+ let start = 80;
|
|
|
|
+ let end = 255;
|
|
|
|
+ if (value) {
|
|
|
|
+ start = 255;
|
|
|
|
+ end = 80;
|
|
}
|
|
}
|
|
|
|
+ this.aniObj.c = start;
|
|
|
|
+ cc.Tween.stopAllByTarget(this.aniObj);
|
|
|
|
+ this.applyColorAnimation(start, end);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private setDarkWithoutAnimation(value: boolean) {
|
|
|
|
+ let grayse = 80;
|
|
|
|
+ this.sp_icon.node.color = value ? cc.color(grayse, grayse, grayse) : cc.color(255, 255, 255);
|
|
|
|
+ this.tileBg.color = value ? cc.color(grayse, grayse, grayse) : cc.color(255, 255, 255);
|
|
}
|
|
}
|
|
|
|
|
|
- // 以动画形式设置黑暗状态变化的函数
|
|
|
|
- private animateDarkChange(ani: boolean, start: number, end: number): void {
|
|
|
|
|
|
+ private applyColorAnimation(start: number, end: number) {
|
|
cc.tween(this.aniObj).to(0.5, { c: end }, {
|
|
cc.tween(this.aniObj).to(0.5, { c: end }, {
|
|
progress: (start, end, current, radio) => {
|
|
progress: (start, end, current, radio) => {
|
|
let tempColor = start + (end - start) * radio;
|
|
let tempColor = start + (end - start) * radio;
|
|
@@ -129,23 +87,13 @@ export default class TileBlock extends cc.Component {
|
|
}).start();
|
|
}).start();
|
|
}
|
|
}
|
|
|
|
|
|
- // 设置静态的黑暗颜色,无动画效果
|
|
|
|
- private setStaticDarkColor(value: boolean, grayse: number): void {
|
|
|
|
- this.sp_icon.node.color = value ? cc.color(grayse, grayse, grayse) : cc.color(255, 255, 255);
|
|
|
|
- this.tileBg.color = value ? cc.color(grayse, grayse, grayse) : cc.color(255, 255, 255);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
recycle(ani: boolean = false) {
|
|
recycle(ani: boolean = false) {
|
|
this.remove = false;
|
|
this.remove = false;
|
|
this._dark = false;
|
|
this._dark = false;
|
|
cc.Tween.stopAllByTarget(this.aniObj);
|
|
cc.Tween.stopAllByTarget(this.aniObj);
|
|
cc.Tween.stopAllByTarget(this.node);
|
|
cc.Tween.stopAllByTarget(this.node);
|
|
- this.resetColors();
|
|
|
|
-
|
|
|
|
- // 根据一个随机条件决定是否执行额外的回收相关操作
|
|
|
|
- if (Math.random() > 0.4) {
|
|
|
|
- this.performExtraRecycleOperation();
|
|
|
|
- }
|
|
|
|
|
|
+ this.sp_icon.node.color = cc.color(255, 255, 255);
|
|
|
|
+ this.tileBg.color = cc.color(255, 255, 255);
|
|
|
|
|
|
if (ani) {
|
|
if (ani) {
|
|
cc.tween(this.node).delay(0.06).to(0.2, { scale: 0 }).call(() => {
|
|
cc.tween(this.node).delay(0.06).to(0.2, { scale: 0 }).call(() => {
|
|
@@ -156,19 +104,16 @@ export default class TileBlock extends cc.Component {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- // 重置颜色为默认值的函数
|
|
|
|
- private resetColors(): void {
|
|
|
|
- this.sp_icon.node.color = cc.color(255, 255, 255);
|
|
|
|
- this.tileBg.color = cc.color(255, 255, 255);
|
|
|
|
|
|
+ // 超级帝国函数
|
|
|
|
+ uselessFunction1() {
|
|
|
|
+ console.log("This is a useless function 1.");
|
|
}
|
|
}
|
|
|
|
|
|
- // 执行一些与回收相关的额外操作,实际目前无实质作用,只是为了混淆
|
|
|
|
- private performExtraRecycleOperation(): void {
|
|
|
|
- console.log("Performing extra recycle operation.");
|
|
|
|
- let randomDelay = Math.random() * 0.5;
|
|
|
|
- setTimeout(() => {
|
|
|
|
- // 这里可以添加更多看似相关但无用的操作
|
|
|
|
- this.node.rotation = randomDelay * 360;
|
|
|
|
- }, randomDelay * 1000);
|
|
|
|
|
|
+ uselessFunction2() {
|
|
|
|
+ let sum = 0;
|
|
|
|
+ for (let i = 0; i < 10; i++) {
|
|
|
|
+ sum += i;
|
|
|
|
+ }
|
|
|
|
+ console.log("The sum in useless function 2 is: ", sum);
|
|
}
|
|
}
|
|
}
|
|
}
|