代码整理,ai相关配置转luban,聊天气泡缓存
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
import { _decorator, Component, Label, Node, Sprite, UITransform } from "cc";
|
||||
import { GButton } from "db://assets/Scripts/Main/Common/GButton";
|
||||
import ResManager from "db://assets/Scripts/Main/Manager/ResManager";
|
||||
import Utils from "db://assets/Scripts/Main/Common/Utils";
|
||||
import { NavigationManager } from "../manager/NavigationManager";
|
||||
import { TbThemes, Theme } from "../../schema/schema";
|
||||
import LanguageUtils from "../../Main/Common/LanguageUtils";
|
||||
import { InnerMsgCode } from "../../Main/Config/InnerMsgCode";
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass("ThemeItem")
|
||||
export class ThemeItem extends Component {
|
||||
@property(Sprite)
|
||||
lockImg: Sprite;
|
||||
@property(Label)
|
||||
titleName: Label;
|
||||
|
||||
@property(Sprite)
|
||||
img: Sprite;
|
||||
|
||||
private category: number;
|
||||
|
||||
private isLocked: boolean;
|
||||
|
||||
key: string;
|
||||
protected onLoad(): void {
|
||||
Utils.addInnerEL(InnerMsgCode.LanguageChange, this, () => {
|
||||
this.titleName.string = LanguageUtils.getText(this.key);
|
||||
});
|
||||
}
|
||||
protected onDestroy(): void {
|
||||
Utils.removeInnerEL(InnerMsgCode.LanguageChange, this, () => {
|
||||
this.titleName.string = LanguageUtils.getText(this.key);
|
||||
});
|
||||
}
|
||||
|
||||
refresh(themeData: Theme) {
|
||||
this.lockImg.node.active = !themeData.isRelease;
|
||||
this.isLocked = !themeData.isRelease;
|
||||
this.key = themeData.key;
|
||||
this.titleName.string = LanguageUtils.getText(themeData.key);
|
||||
this.category = themeData.category;
|
||||
ResManager.I.changeBundleSpriteFrame(
|
||||
this.img,
|
||||
themeData.path,
|
||||
"Chat18x",
|
||||
() => {
|
||||
let sizeTran = this.img.node.parent.getComponent(UITransform);
|
||||
Utils.adjustBgPixelRatioToSize(sizeTran.contentSize, this.img.node, 2);
|
||||
}
|
||||
);
|
||||
GButton.RemoveAndBandClick(this.node, this.OnClickThis, this);
|
||||
}
|
||||
|
||||
OnClickThis() {
|
||||
if (this.isLocked) {
|
||||
return;
|
||||
}
|
||||
NavigationManager.Instance.navigateToGirlList(this.category);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user