代码整理,ai相关配置转luban,聊天气泡缓存
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
import { _decorator, Component, math, Node, Sprite } from "cc";
|
||||
import { Config18x } from "db://assets/Scripts/Main/Config/Config18x";
|
||||
import ResManager from "db://assets/Scripts/Main/Manager/ResManager";
|
||||
import { ViewManager } from "db://assets/Scripts/Main/Manager/ViewManager";
|
||||
import { GButton } from "db://assets/Scripts/Main/Common/GButton";
|
||||
import { GirlDetailPanel } from "../ui/panels/GirlDetailPanel";
|
||||
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass("DetailImageItem")
|
||||
export class DetailImageItem extends Component {
|
||||
@property(Sprite)
|
||||
img: Sprite;
|
||||
|
||||
@property(Node)
|
||||
lock: Node;
|
||||
@property(Node)
|
||||
question: Node;
|
||||
|
||||
base: GirlDetailPanel;
|
||||
url: string;
|
||||
|
||||
onLoad() {
|
||||
GButton.BandClick(this.node, this.onClickThis, this);
|
||||
}
|
||||
|
||||
onClickThis() {
|
||||
let data = {
|
||||
url: this.url,
|
||||
closeFunc: () => {
|
||||
this.base.setVideEnable(true);
|
||||
},
|
||||
};
|
||||
if (this.url) {
|
||||
ViewManager.I.openBundlesView("ShowPanel", data);
|
||||
this.base.setVideEnable(false);
|
||||
}
|
||||
}
|
||||
refresh(path: string, base: GirlDetailPanel) {
|
||||
this.base = base;
|
||||
this.lock.active = false;
|
||||
this.question.active = false;
|
||||
|
||||
if (true) {
|
||||
this.url = path;
|
||||
// if (info.imageState !== ImageState.Release) {
|
||||
// this.url += '_blured';
|
||||
// if (info.imageState === ImageState.Lock)
|
||||
// this.img.color = new math.Color(127, 127, 127, 255);
|
||||
// else
|
||||
// this.img.color = new math.Color(50, 50, 50, 255);
|
||||
|
||||
// } else {
|
||||
// this.img.color = new math.Color(255, 255, 255, 255);
|
||||
// }
|
||||
|
||||
ResManager.I.changeBundleSpriteFrame(this.img, this.url, "Chat18x");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.24",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "4ce7049c-58aa-4519-a959-fd17314db9a4",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
import { _decorator, Component, Label, Node, Sprite, UITransform } from "cc";
|
||||
import { Config18x } from "db://assets/Scripts/Main/Config/Config18x";
|
||||
import { ViewManager } from "db://assets/Scripts/Main/Manager/ViewManager";
|
||||
import ResManager from "db://assets/Scripts/Main/Manager/ResManager";
|
||||
import Utils from "db://assets/Scripts/Main/Common/Utils";
|
||||
import { NavigationManager } from "../manager/NavigationManager";
|
||||
import { Girl, PriceType } from "../../schema/schema";
|
||||
import LanguageUtils from "../../Main/Common/LanguageUtils";
|
||||
import { InnerMsgCode } from "../../Main/Config/InnerMsgCode";
|
||||
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass("GirlListItem")
|
||||
export class GirlListItem extends Component {
|
||||
@property(Sprite)
|
||||
avatar: Sprite;
|
||||
@property(Label)
|
||||
girlName: Label;
|
||||
@property(Label)
|
||||
tags: Label;
|
||||
@property(Label)
|
||||
price: Label;
|
||||
@property(Node)
|
||||
freeNode: Node;
|
||||
@property(Node)
|
||||
tryNode: Node;
|
||||
@property(Node)
|
||||
chatBtn: Node;
|
||||
@property(Node)
|
||||
starParent: Node;
|
||||
|
||||
id: number = -1;
|
||||
|
||||
nameKey: string;
|
||||
tagKey: string;
|
||||
|
||||
private onLanguageChangeCallback = () => {
|
||||
if (!this.girlName || !this.tags) return;
|
||||
|
||||
this.girlName.string = LanguageUtils.getText(this.nameKey);
|
||||
let desc = "";
|
||||
const tags = LanguageUtils.getText(this.tagKey).split("|");
|
||||
for (let i = 0; i < tags.length; i++) {
|
||||
if (i != 0) desc += "\n";
|
||||
desc += tags[i];
|
||||
}
|
||||
this.tags.string = desc;
|
||||
};
|
||||
|
||||
protected onLoad(): void {
|
||||
Utils.addInnerEL(InnerMsgCode.LanguageChange, this, this.onLanguageChangeCallback);
|
||||
}
|
||||
|
||||
protected onDestroy(): void {
|
||||
Utils.removeInnerEL(InnerMsgCode.LanguageChange, this, this.onLanguageChangeCallback);
|
||||
}
|
||||
|
||||
baseNode: Node;
|
||||
refreshData(data: Girl, baseNode: Node) {
|
||||
this.baseNode = baseNode;
|
||||
this.id = data.id;
|
||||
this.nameKey = data.nameKey;
|
||||
this.girlName.string = LanguageUtils.getText(data.nameKey);
|
||||
this.tagKey = data.tagKey;
|
||||
let desc = "";
|
||||
const tags = LanguageUtils.getText(data.tagKey).split("|");
|
||||
for (let i = 0; i < tags.length; i++) {
|
||||
if (i != 0) desc += "|";
|
||||
desc += tags[i];
|
||||
}
|
||||
this.tags.string = desc;
|
||||
this.price.node.active = data.priceType == PriceType.pay;
|
||||
this.freeNode.active = data.priceType == PriceType.free;
|
||||
this.tryNode.active = data.priceType == PriceType.first_time_free;
|
||||
|
||||
ResManager.I.changeBundleSpriteFrame(
|
||||
this.avatar,
|
||||
data.avatarPath,
|
||||
"Chat18x",
|
||||
() => {
|
||||
let sizeTran = this.avatar.node.parent.getComponent(UITransform);
|
||||
Utils.adjustBgPixelRatioToSize(
|
||||
sizeTran.contentSize,
|
||||
this.avatar.node,
|
||||
2
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
for (let i = 0; i < 5; i++) {
|
||||
this.starParent.children[i].active = i < data.starCount;
|
||||
}
|
||||
}
|
||||
|
||||
onClickDetail() {
|
||||
NavigationManager.Instance.navigateToGirlDetail(this.id);
|
||||
ViewManager.I.closeView(this.baseNode);
|
||||
}
|
||||
|
||||
update(deltaTime: number) {}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.24",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "6d3e0de4-2f2e-44c0-ba8e-a6917e51357b",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.24",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "a41b690d-5d61-4648-b2bc-4c9c19bb157b",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
Reference in New Issue
Block a user