Merge branch 'main' of 47.107.44.202:xionglijia/18xchat
This commit is contained in:
@@ -86,8 +86,10 @@ export class ChatAIService {
|
|||||||
const config = ApiConfig.Instance.getAIConfig();
|
const config = ApiConfig.Instance.getAIConfig();
|
||||||
|
|
||||||
// 使用 ChatHistoryManager 的统一加载方法(优先本地,无则获取服务端)
|
// 使用 ChatHistoryManager 的统一加载方法(优先本地,无则获取服务端)
|
||||||
const savedHistory = await ChatHistoryManager.Instance.loadChatHistory(roleId);
|
const savedHistory = await ChatHistoryManager.Instance.loadChatHistory(
|
||||||
|
roleId
|
||||||
|
);
|
||||||
|
|
||||||
let chat;
|
let chat;
|
||||||
if (savedHistory && savedHistory.length > 0) {
|
if (savedHistory && savedHistory.length > 0) {
|
||||||
chat = this.ai.chats.create({
|
chat = this.ai.chats.create({
|
||||||
|
|||||||
@@ -193,6 +193,8 @@ export class ChatPanel extends li_BaseView implements IChatPanelCallback {
|
|||||||
//const dataDetail = roleData.detail;
|
//const dataDetail = roleData.detail;
|
||||||
const girlData = DataManager.I.getDataById<GirlData>(DataId.Girl);
|
const girlData = DataManager.I.getDataById<GirlData>(DataId.Girl);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
this.nameKey = girlData.getGrilName(this.categoryId, this.id);
|
this.nameKey = girlData.getGrilName(this.categoryId, this.id);
|
||||||
this.girlName.string = LanguageUtils.getText(this.nameKey);
|
this.girlName.string = LanguageUtils.getText(this.nameKey);
|
||||||
// ResManager.I.changeBundleSpriteFrame(
|
// ResManager.I.changeBundleSpriteFrame(
|
||||||
|
|||||||
@@ -37,7 +37,8 @@ export class SettingPanel extends li_BaseView {
|
|||||||
@property(Node)
|
@property(Node)
|
||||||
private panelBg: Node = null;
|
private panelBg: Node = null;
|
||||||
|
|
||||||
private languageDrawdown;
|
private languageDrawdown: Node;
|
||||||
|
private curLanguage: Label;
|
||||||
private languageButtons: LanguageButton[] = [];
|
private languageButtons: LanguageButton[] = [];
|
||||||
private currentSelectedLang: LanguageType = null;
|
private currentSelectedLang: LanguageType = null;
|
||||||
protected start(): void {
|
protected start(): void {
|
||||||
@@ -45,25 +46,55 @@ export class SettingPanel extends li_BaseView {
|
|||||||
|
|
||||||
this.initUI();
|
this.initUI();
|
||||||
this.registerListener();
|
this.registerListener();
|
||||||
|
|
||||||
|
if (this.languageDrawdown) {
|
||||||
|
this.languageDrawdown.active = false;
|
||||||
|
this.languageDrawdown.setScale(new Vec3(1, 0, 1));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onEnable() {
|
onEnable() {
|
||||||
this.currentSelectedLang = LanguageUtils.CurrentLanguage;
|
this.currentSelectedLang = LanguageUtils.CurrentLanguage;
|
||||||
this.updateSelection();
|
this.updateSelection();
|
||||||
if (this.languageDrawdown) {
|
|
||||||
this.languageDrawdown.active = false;
|
|
||||||
}
|
|
||||||
this.playEnterAnimation();
|
this.playEnterAnimation();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private music_on: Node;
|
||||||
|
private music_off: Node;
|
||||||
|
private sound_on: Node;
|
||||||
|
private sound_off: Node;
|
||||||
private initUI() {
|
private initUI() {
|
||||||
this.languageDrawdown = this._nodeTab.languageSelection;
|
this.languageDrawdown = this._nodeTab.languageSelection;
|
||||||
|
this.curLanguage = this._nodeTab.curLanguage.getComponent(Label);
|
||||||
this.initLanguageButton(
|
this.initLanguageButton(
|
||||||
this._nodeTab.Language1,
|
this._nodeTab.Language1.getComponent(Button),
|
||||||
LanguageType.EN,
|
LanguageType.EN,
|
||||||
"English"
|
"English"
|
||||||
);
|
);
|
||||||
this.initLanguageButton(this._nodeTab.Language2, LanguageType.HI, "हिंदी");
|
this.initLanguageButton(
|
||||||
|
this._nodeTab.Language2.getComponent(Button),
|
||||||
|
LanguageType.HI,
|
||||||
|
"हिंदी"
|
||||||
|
);
|
||||||
|
|
||||||
|
this.languageButtons.forEach((b) => {
|
||||||
|
if (b.language == LanguageUtils.CurrentLanguage) {
|
||||||
|
this.curLanguage.string = b.label.string;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.music_on = this._nodeTab.MusicBtn.getChildByName("On");
|
||||||
|
this.music_off = this._nodeTab.MusicBtn.getChildByName("Off");
|
||||||
|
this.sound_on = this._nodeTab.SoundBtn.getChildByName("On");
|
||||||
|
this.sound_off = this._nodeTab.SoundBtn.getChildByName("Off");
|
||||||
|
|
||||||
|
let currentState = PlayerDataManager.I.IsSoundOn;
|
||||||
|
this.sound_on.active = currentState;
|
||||||
|
this.sound_off.active = !currentState;
|
||||||
|
currentState = PlayerDataManager.I.IsMusicOn;
|
||||||
|
this.music_on.active = currentState;
|
||||||
|
this.music_off.active = !currentState;
|
||||||
}
|
}
|
||||||
|
|
||||||
private initLanguageButton(
|
private initLanguageButton(
|
||||||
@@ -121,8 +152,8 @@ export class SettingPanel extends li_BaseView {
|
|||||||
this
|
this
|
||||||
);
|
);
|
||||||
|
|
||||||
GButton.BandClick(this._nodeTab.Language1, this.switchToEn, this);
|
// GButton.BandClick(this._nodeTab.Language1, this.switchToEn, this);
|
||||||
GButton.BandClick(this._nodeTab.Language2, this.swithcToHi, this);
|
// GButton.BandClick(this._nodeTab.Language2, this.swithcToHi, this);
|
||||||
|
|
||||||
GButton.BandClick(this._nodeTab.closeBtn, this.close, this);
|
GButton.BandClick(this._nodeTab.closeBtn, this.close, this);
|
||||||
|
|
||||||
@@ -140,20 +171,33 @@ export class SettingPanel extends li_BaseView {
|
|||||||
}
|
}
|
||||||
switchSound() {
|
switchSound() {
|
||||||
const currentState = PlayerDataManager.I.IsSoundOn;
|
const currentState = PlayerDataManager.I.IsSoundOn;
|
||||||
|
this.sound_on.active = currentState;
|
||||||
|
this.sound_off.active = !currentState;
|
||||||
PlayerDataManager.I.SetSoundOn(!currentState);
|
PlayerDataManager.I.SetSoundOn(!currentState);
|
||||||
AudioManager.I.PlayEffect("click");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
switchMusic() {
|
switchMusic() {
|
||||||
const currentState = PlayerDataManager.I.IsMusicOn;
|
const currentState = PlayerDataManager.I.IsMusicOn;
|
||||||
|
this.music_on.active = currentState;
|
||||||
|
this.music_off.active = !currentState;
|
||||||
PlayerDataManager.I.SetMusicOn(!currentState);
|
PlayerDataManager.I.SetMusicOn(!currentState);
|
||||||
AudioManager.I.PlayEffect("click");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isShow: boolean = false;
|
||||||
openLanguageSelection() {
|
openLanguageSelection() {
|
||||||
if (this.languageDrawdown) {
|
if (!this.isShow) {
|
||||||
this.languageDrawdown.active = true;
|
if (this.languageDrawdown) {
|
||||||
|
this.languageDrawdown.active = true;
|
||||||
|
tween(this.languageDrawdown)
|
||||||
|
.to(0.2, { scale: new Vec3(1, 1, 1) })
|
||||||
|
.start();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
tween(this.languageDrawdown)
|
||||||
|
.to(0.2, { scale: new Vec3(1, 0, 1) })
|
||||||
|
.start();
|
||||||
}
|
}
|
||||||
|
this.isShow = !this.isShow;
|
||||||
}
|
}
|
||||||
|
|
||||||
switchToEn() {
|
switchToEn() {
|
||||||
@@ -172,8 +216,7 @@ export class SettingPanel extends li_BaseView {
|
|||||||
if (this.currentSelectedLang === language) {
|
if (this.currentSelectedLang === language) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
//AudioManager.I.PlayEffect("click");
|
||||||
AudioManager.I.PlayEffect("click");
|
|
||||||
|
|
||||||
this.currentSelectedLang = language;
|
this.currentSelectedLang = language;
|
||||||
LanguageUtils.setLanguage(language);
|
LanguageUtils.setLanguage(language);
|
||||||
@@ -185,12 +228,14 @@ export class SettingPanel extends li_BaseView {
|
|||||||
if (selectedBtn && selectedBtn.button) {
|
if (selectedBtn && selectedBtn.button) {
|
||||||
this.playSelectAnimation(selectedBtn.button.node);
|
this.playSelectAnimation(selectedBtn.button.node);
|
||||||
}
|
}
|
||||||
|
this.curLanguage.string = selectedBtn.label.string;
|
||||||
|
|
||||||
this.scheduleOnce(() => {
|
if (this.languageDrawdown) {
|
||||||
this.playExitAnimation(() => {
|
tween(this.languageDrawdown)
|
||||||
this.close();
|
.to(0.2, { scale: new Vec3(1, 0, 1) })
|
||||||
});
|
.start();
|
||||||
}, 0.5);
|
}
|
||||||
|
this.isShow = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private updateSelection() {
|
private updateSelection() {
|
||||||
@@ -241,14 +286,4 @@ export class SettingPanel extends li_BaseView {
|
|||||||
callback();
|
callback();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onDestroy() {
|
|
||||||
this.languageButtons.forEach((langBtn) => {
|
|
||||||
if (langBtn.button) {
|
|
||||||
langBtn.button.node.targetOff(this);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
super.onDestroy();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,7 +46,7 @@
|
|||||||
"_lpos": {
|
"_lpos": {
|
||||||
"__type__": "cc.Vec3",
|
"__type__": "cc.Vec3",
|
||||||
"x": 0,
|
"x": 0,
|
||||||
"y": 0,
|
"y": 251.15699999999993,
|
||||||
"z": 0
|
"z": 0
|
||||||
},
|
},
|
||||||
"_lrot": {
|
"_lrot": {
|
||||||
@@ -227,7 +227,7 @@
|
|||||||
"r": 255,
|
"r": 255,
|
||||||
"g": 255,
|
"g": 255,
|
||||||
"b": 255,
|
"b": 255,
|
||||||
"a": 164
|
"a": 255
|
||||||
},
|
},
|
||||||
"_spriteFrame": {
|
"_spriteFrame": {
|
||||||
"__uuid__": "135b84c5-52d8-4565-812e-c212a5f1a366@f9941",
|
"__uuid__": "135b84c5-52d8-4565-812e-c212a5f1a366@f9941",
|
||||||
@@ -261,8 +261,6 @@
|
|||||||
"__id__": 0
|
"__id__": 0
|
||||||
},
|
},
|
||||||
"fileId": "c9vrQdTkJOhbCKY8SH8Zch",
|
"fileId": "c9vrQdTkJOhbCKY8SH8Zch",
|
||||||
"instance": null,
|
|
||||||
"targetOverrides": null,
|
|
||||||
"nestedPrefabInstanceRoots": null
|
"nestedPrefabInstanceRoots": null
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -5071,7 +5069,7 @@
|
|||||||
"node": {
|
"node": {
|
||||||
"__id__": 187
|
"__id__": 187
|
||||||
},
|
},
|
||||||
"_enabled": true,
|
"_enabled": false,
|
||||||
"__prefab": {
|
"__prefab": {
|
||||||
"__id__": 197
|
"__id__": 197
|
||||||
},
|
},
|
||||||
@@ -5080,12 +5078,15 @@
|
|||||||
"_dstBlendFactor": 4,
|
"_dstBlendFactor": 4,
|
||||||
"_color": {
|
"_color": {
|
||||||
"__type__": "cc.Color",
|
"__type__": "cc.Color",
|
||||||
"r": 255,
|
"r": 214,
|
||||||
"g": 255,
|
"g": 214,
|
||||||
"b": 255,
|
"b": 214,
|
||||||
"a": 255
|
"a": 255
|
||||||
},
|
},
|
||||||
"_spriteFrame": null,
|
"_spriteFrame": {
|
||||||
|
"__uuid__": "20835ba4-6145-4fbc-a58a-051ce700aa3e@f9941",
|
||||||
|
"__expectedType__": "cc.SpriteFrame"
|
||||||
|
},
|
||||||
"_type": 1,
|
"_type": 1,
|
||||||
"_fillType": 0,
|
"_fillType": 0,
|
||||||
"_sizeMode": 0,
|
"_sizeMode": 0,
|
||||||
@@ -5119,7 +5120,7 @@
|
|||||||
},
|
},
|
||||||
"clickEvents": [],
|
"clickEvents": [],
|
||||||
"_interactable": true,
|
"_interactable": true,
|
||||||
"_transition": 2,
|
"_transition": 1,
|
||||||
"_normalColor": {
|
"_normalColor": {
|
||||||
"__type__": "cc.Color",
|
"__type__": "cc.Color",
|
||||||
"r": 214,
|
"r": 214,
|
||||||
@@ -5184,8 +5185,6 @@
|
|||||||
"__id__": 0
|
"__id__": 0
|
||||||
},
|
},
|
||||||
"fileId": "c7elOiU6lL742K74e1NJ3v",
|
"fileId": "c7elOiU6lL742K74e1NJ3v",
|
||||||
"instance": null,
|
|
||||||
"targetOverrides": null,
|
|
||||||
"nestedPrefabInstanceRoots": null
|
"nestedPrefabInstanceRoots": null
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -5576,7 +5575,7 @@
|
|||||||
"node": {
|
"node": {
|
||||||
"__id__": 207
|
"__id__": 207
|
||||||
},
|
},
|
||||||
"_enabled": true,
|
"_enabled": false,
|
||||||
"__prefab": {
|
"__prefab": {
|
||||||
"__id__": 217
|
"__id__": 217
|
||||||
},
|
},
|
||||||
@@ -5585,12 +5584,15 @@
|
|||||||
"_dstBlendFactor": 4,
|
"_dstBlendFactor": 4,
|
||||||
"_color": {
|
"_color": {
|
||||||
"__type__": "cc.Color",
|
"__type__": "cc.Color",
|
||||||
"r": 255,
|
"r": 214,
|
||||||
"g": 255,
|
"g": 214,
|
||||||
"b": 255,
|
"b": 214,
|
||||||
"a": 255
|
"a": 255
|
||||||
},
|
},
|
||||||
"_spriteFrame": null,
|
"_spriteFrame": {
|
||||||
|
"__uuid__": "20835ba4-6145-4fbc-a58a-051ce700aa3e@f9941",
|
||||||
|
"__expectedType__": "cc.SpriteFrame"
|
||||||
|
},
|
||||||
"_type": 1,
|
"_type": 1,
|
||||||
"_fillType": 0,
|
"_fillType": 0,
|
||||||
"_sizeMode": 0,
|
"_sizeMode": 0,
|
||||||
@@ -5624,7 +5626,7 @@
|
|||||||
},
|
},
|
||||||
"clickEvents": [],
|
"clickEvents": [],
|
||||||
"_interactable": true,
|
"_interactable": true,
|
||||||
"_transition": 2,
|
"_transition": 0,
|
||||||
"_normalColor": {
|
"_normalColor": {
|
||||||
"__type__": "cc.Color",
|
"__type__": "cc.Color",
|
||||||
"r": 214,
|
"r": 214,
|
||||||
@@ -5689,8 +5691,6 @@
|
|||||||
"__id__": 0
|
"__id__": 0
|
||||||
},
|
},
|
||||||
"fileId": "ad+JOqXVVBgJzQOCZa3yWE",
|
"fileId": "ad+JOqXVVBgJzQOCZa3yWE",
|
||||||
"instance": null,
|
|
||||||
"targetOverrides": null,
|
|
||||||
"nestedPrefabInstanceRoots": null
|
"nestedPrefabInstanceRoots": null
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -6201,6 +6201,6 @@
|
|||||||
"__id__": 0
|
"__id__": 0
|
||||||
},
|
},
|
||||||
"fileId": "38Fm50GEVAG5PwFkR1o9QJ",
|
"fileId": "38Fm50GEVAG5PwFkR1o9QJ",
|
||||||
"targetOverrides": null
|
"instance": null
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
Reference in New Issue
Block a user