no message
This commit is contained in:
@@ -852,7 +852,7 @@ class MenuBar extends React.Component {
|
|||||||
let realLvId_tmp = '';
|
let realLvId_tmp = '';
|
||||||
// 发送消息给 Unity 实例,切换关卡
|
// 发送消息给 Unity 实例,切换关卡
|
||||||
if (localStorage.getItem('platformMode') === 'normal') {
|
if (localStorage.getItem('platformMode') === 'normal') {
|
||||||
realLvId_tmp = CONFIG.getRealLvId(window.gamelvdataJson.gamelv, window.gamelvdataJson.gameid, window.gamelvdataJson.ismatch, window.gamelvdataJson.gameNumber) + window.gamelvdata.currentlv;
|
realLvId_tmp = CONFIG.getRealLvId(window.gamelvdataJson.gamelv, window.gamelvdataJson.gameid, window.gamelvdataJson.ismatch, window.gamelvdataJson.gameNumber, window.gamelvdataJson.gamemode) + window.gamelvdata.currentlv;
|
||||||
} else {
|
} else {
|
||||||
realLvId_tmp = CONFIG.getRealLvId(window.gamelvdataJson.gamelv, window.gamelvdataJson.gameid, window.gamelvdataJson.ismatch, window.gamelvdataJson.gameNumber);
|
realLvId_tmp = CONFIG.getRealLvId(window.gamelvdataJson.gamelv, window.gamelvdataJson.gameid, window.gamelvdataJson.ismatch, window.gamelvdataJson.gameNumber);
|
||||||
}
|
}
|
||||||
@@ -902,7 +902,8 @@ class MenuBar extends React.Component {
|
|||||||
window.gamelvdataJson.gamelv,
|
window.gamelvdataJson.gamelv,
|
||||||
window.gamelvdataJson.gameid,
|
window.gamelvdataJson.gameid,
|
||||||
window.gamelvdataJson.ismatch,
|
window.gamelvdataJson.ismatch,
|
||||||
window.gamelvdataJson.gameNumber
|
window.gamelvdataJson.gameNumber,
|
||||||
|
window.gamelvdataJson.gamemode
|
||||||
) + (window.gamelvdata ? window.gamelvdata.currentlv : '');
|
) + (window.gamelvdata ? window.gamelvdata.currentlv : '');
|
||||||
} else {
|
} else {
|
||||||
realLvId_tmp = CONFIG.getRealLvId(
|
realLvId_tmp = CONFIG.getRealLvId(
|
||||||
|
|||||||
@@ -148,7 +148,7 @@ const CurrentLevelChoose = ({ onCancel }) => {
|
|||||||
console.warn('window.loadCppProject 未定义或不是函数');
|
console.warn('window.loadCppProject 未定义或不是函数');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const realLvId_tmp = CONFIG.getRealLvId(window.gamelvdataJson.gamelv, window.gamelvdataJson.gameid, window.gamelvdataJson.ismatch, window.gamelvdataJson.gameNumber);
|
const realLvId_tmp = CONFIG.getRealLvId(window.gamelvdataJson.gamelv, window.gamelvdataJson.gameid, window.gamelvdataJson.ismatch, window.gamelvdataJson.gameNumber, window.gamelvdataJson.gamemode);
|
||||||
const realLvId = realLvId_tmp + cellIndex
|
const realLvId = realLvId_tmp + cellIndex
|
||||||
window.unityInstance.SendMessage("GameController", "SwitchLevel", realLvId);
|
window.unityInstance.SendMessage("GameController", "SwitchLevel", realLvId);
|
||||||
CONFIG.checkGameStyle(realLvId);
|
CONFIG.checkGameStyle(realLvId);
|
||||||
|
|||||||
@@ -144,7 +144,7 @@ const CurrentLevelChoose = ({ onCancel }) => {
|
|||||||
// 清除所有代码
|
// 清除所有代码
|
||||||
window.loadPythonProject(`` + `\n`.repeat(50));
|
window.loadPythonProject(`` + `\n`.repeat(50));
|
||||||
}
|
}
|
||||||
const realLvId_tmp = CONFIG.getRealLvId(window.gamelvdataJson.gamelv, window.gamelvdataJson.gameid, window.gamelvdataJson.ismatch, window.gamelvdataJson.gameNumber);
|
const realLvId_tmp = CONFIG.getRealLvId(window.gamelvdataJson.gamelv, window.gamelvdataJson.gameid, window.gamelvdataJson.ismatch, window.gamelvdataJson.gameNumber, window.gamelvdataJson.gamemode);
|
||||||
const realLvId = realLvId_tmp + cellIndex
|
const realLvId = realLvId_tmp + cellIndex
|
||||||
window.unityInstance.SendMessage("GameController", "SwitchLevel", realLvId);
|
window.unityInstance.SendMessage("GameController", "SwitchLevel", realLvId);
|
||||||
CONFIG.checkGameStyle(realLvId);
|
CONFIG.checkGameStyle(realLvId);
|
||||||
|
|||||||
@@ -613,18 +613,18 @@
|
|||||||
|
|
||||||
<div class="section-card" id="ttsVoiceCard">
|
<div class="section-card" id="ttsVoiceCard">
|
||||||
<div class="section-title" style="margin-bottom:4px;">选择音色</div>
|
<div class="section-title" style="margin-bottom:4px;">选择音色</div>
|
||||||
<div class="section-sub" style="margin-bottom:10px;font-size:12px;">想用自己的声音?先在下方「自定义音色」录一段 5~10 秒</div>
|
<div class="section-sub" style="margin-bottom:10px;font-size:12px;">选「我的声音」前,请先在下方录制或上传 5~10 秒参考人声</div>
|
||||||
<div class="voice-grid" id="ttsVoiceGrid"></div>
|
<div class="voice-grid" id="ttsVoiceGrid"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="section-card" id="ttsMineVoiceCard">
|
<div class="section-card" id="ttsMineVoiceCard">
|
||||||
<div class="section-title">自定义音色(录一段你的声音)</div>
|
<div class="section-title">自定义音色(录一段你的声音)</div>
|
||||||
<div class="section-sub">录一段 10 秒以内的话,AI 就能模仿你的声音说话啦!建议 5~10 秒,清晰无背景音(必填)</div>
|
<div class="section-sub">仅选择「我的声音」时需要。录一段 5~10 秒清晰人声,AI 就能模仿你说话</div>
|
||||||
<div class="record-box">
|
<div class="record-box">
|
||||||
<div class="record-box__icon"><img src="../images/aigc/icon-voice-mic.png" alt="" /></div>
|
<div class="record-box__icon"><img src="../images/aigc/icon-voice-mic.png" alt="" /></div>
|
||||||
<div class="record-box__body">
|
<div class="record-box__body">
|
||||||
<div class="record-box__title">录一段你的声音</div>
|
<div class="record-box__title">录一段你的声音</div>
|
||||||
<div class="record-box__sub">请录制 5~10 秒清晰人声,完成后即可选中「我的声音」</div>
|
<div class="record-box__sub">完成后即可选中「我的声音」;选其他音色无需录音</div>
|
||||||
<div class="record-box__status" id="recordStatus"></div>
|
<div class="record-box__status" id="recordStatus"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="record-box__actions">
|
<div class="record-box__actions">
|
||||||
@@ -1331,19 +1331,21 @@
|
|||||||
if (!selectedTtsVoiceId || !voiceOpt) {
|
if (!selectedTtsVoiceId || !voiceOpt) {
|
||||||
return fail('请选择音色', document.getElementById('ttsVoiceCard'));
|
return fail('请选择音色', document.getElementById('ttsVoiceCard'));
|
||||||
}
|
}
|
||||||
// 无论选哪种音色,都必须先录制/上传参考音频
|
// 只有选择「我的声音」时才必须录制/上传参考音频
|
||||||
if (!voiceBlob) {
|
if (voiceOpt.mine) {
|
||||||
return fail('请先录制或上传自定义音色', mineCard);
|
if (!voiceBlob) {
|
||||||
}
|
return fail('请先录制或上传自定义音色', mineCard);
|
||||||
if (!isVoiceDurationValid(voiceDurationSec)) {
|
}
|
||||||
return fail(
|
if (!isVoiceDurationValid(voiceDurationSec)) {
|
||||||
'自定义音色需 ' + MIN_VOICE_SECONDS + '~' + MAX_VOICE_SECONDS + ' 秒,当前约 ' +
|
return fail(
|
||||||
Math.max(0, Math.floor(Number(voiceDurationSec) || 0)) + ' 秒,请重新录制或上传',
|
'自定义音色需 ' + MIN_VOICE_SECONDS + '~' + MAX_VOICE_SECONDS + ' 秒,当前约 ' +
|
||||||
mineCard
|
Math.max(0, Math.floor(Number(voiceDurationSec) || 0)) + ' 秒,请重新录制或上传',
|
||||||
);
|
mineCard
|
||||||
}
|
);
|
||||||
if (voiceBlob.size > 10 * 1024 * 1024) {
|
}
|
||||||
return fail('参考音频不能超过 10MB', mineCard);
|
if (voiceBlob.size > 10 * 1024 * 1024) {
|
||||||
|
return fail('参考音频不能超过 10MB', mineCard);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!speedEl || !isFinite(speedIdx) || speedIdx < 0 || speedIdx > 7 || !speedLabels[speedIdx]) {
|
if (!speedEl || !isFinite(speedIdx) || speedIdx < 0 || speedIdx > 7 || !speedLabels[speedIdx]) {
|
||||||
return fail('请设置语速', document.getElementById('ttsSliderCard') || speedEl);
|
return fail('请设置语速', document.getElementById('ttsSliderCard') || speedEl);
|
||||||
@@ -2009,12 +2011,12 @@
|
|||||||
return voiceId;
|
return voiceId;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function generateTtsAudio(text, voiceId) {
|
async function generateTtsAudio(text, voiceId, modelName) {
|
||||||
if (!voiceId) throw new Error('缺少复刻音色,请先完成 voice-clone');
|
if (!voiceId) throw new Error('缺少音色');
|
||||||
var payload = {
|
var payload = {
|
||||||
text: text,
|
text: text,
|
||||||
voice: voiceId,
|
voice: voiceId,
|
||||||
model_name: TTS_MODEL,
|
model_name: modelName || TTS_MODEL,
|
||||||
instruction: buildTtsInstruction()
|
instruction: buildTtsInstruction()
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -2136,14 +2138,21 @@
|
|||||||
setVoicePreviewLoading('正在准备合成…');
|
setVoicePreviewLoading('正在准备合成…');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// 无论选哪种音色:先 voice-clone,再 tts/generate
|
var voiceId;
|
||||||
btn.textContent = '复刻中…';
|
var modelName = TTS_MODEL;
|
||||||
setVoicePreviewLoading('正在上传参考音频并复刻音色…');
|
if (voiceOpt.mine) {
|
||||||
var voiceId = await cloneVoiceFromFile(voiceBlob, voiceFileName);
|
btn.textContent = '复刻中…';
|
||||||
if (!voiceId) throw new Error('音色复刻失败,未返回 voice_id');
|
setVoicePreviewLoading('正在上传参考音频并复刻音色…');
|
||||||
|
voiceId = await cloneVoiceFromFile(voiceBlob, voiceFileName);
|
||||||
|
if (!voiceId) throw new Error('音色复刻失败,未返回 voice_id');
|
||||||
|
} else {
|
||||||
|
// 预设音色:与「声音变声」同一套 model / voice
|
||||||
|
voiceId = CHANGE_VOICE;
|
||||||
|
modelName = CHANGE_MODEL;
|
||||||
|
}
|
||||||
btn.textContent = '合成中…';
|
btn.textContent = '合成中…';
|
||||||
setVoicePreviewLoading('正在用「' + voiceOpt.name + '」合成语音…');
|
setVoicePreviewLoading('正在用「' + voiceOpt.name + '」合成语音…');
|
||||||
var gen = await generateTtsAudio(text, voiceId);
|
var gen = await generateTtsAudio(text, voiceId, modelName);
|
||||||
var meta = '语速 ' + speedLabels[params.speedIdx] +
|
var meta = '语速 ' + speedLabels[params.speedIdx] +
|
||||||
' · 语调 ' + pitchLabels[params.pitchIdx] +
|
' · 语调 ' + pitchLabels[params.pitchIdx] +
|
||||||
' · 情绪 ' + emotionLabels[params.emotionIdx];
|
' · 情绪 ' + emotionLabels[params.emotionIdx];
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user