SetCurrentExpression(emotion);
SetCurrentExpressionAndStatus(); //更新当前表情和状态文本
- // 标记时间线已获取,允许休眠
- ThunderBirdMainView::SetTimelineReceived(true);
- WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ThunderBirdModel::HandleTimelineStatusChange: 时间线已获取,允许休眠");
+ // // 标记时间线已获取,允许休眠
+ // ThunderBirdMainView::SetTimelineReceived(true);
+ // WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ThunderBirdModel::HandleTimelineStatusChange: 时间线已获取,允许休眠");
}
}
{
// 重置对话模式finished标志
m_dialogueModeFinished = false;
- // 记录进入对话模式前的表情,不改变当前表情
+ //如果本来就是眨眼的表情直接返回
+ if (m_currentExpression == "winking") {
+ return;
+ }
+ // 记录进入对话模式前的时间线表情(用于退出时恢复)
m_dialogueExpression = m_currentExpression;
- WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ThunderBirdModel::OnEnterDialogueMode: 记录进入对话模式前的表情: %s", m_currentExpression.c_str());
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ThunderBirdModel::OnEnterDialogueMode: 记录时间线表情: %s", m_currentExpression.c_str());
+
+ // 切换到眨眼表情(winking)
+ std::string winkingExpressionPath = "/user/res/video/CloseEyes/" + eyesShape_ + "/" + eyesColor_ + ".mp4";
+
+ // 检查文件是否存在
+ if (access(winkingExpressionPath.c_str(), F_OK) == 0) {
+ // 切换到眨眼表情(但不更新m_currentExpression,因为退出时要恢复时间线表情)
+ SwitchExpressionVideo(winkingExpressionPath.c_str());
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ThunderBirdModel::OnEnterDialogueMode: 切换到眨眼表情: %s", winkingExpressionPath.c_str());
+ } else {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ThunderBirdModel::OnEnterDialogueMode: 眨眼表情文件不存在: %s", winkingExpressionPath.c_str());
+ }
}
// 退出对话模式时恢复表情
{
// 重置对话模式finished标志
m_dialogueModeFinished = false;
- // 恢复到进入对话模式前记录的表情
+
+ // 恢复到进入对话模式前记录的时间线表情
if (!m_currentExpression.empty()) {
- SetCurrentExpression(m_currentExpression);
- //SetCurrentExpressionAndStatus();
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ThunderBirdModel::OnExitDialogueMode: 恢复时间线表情: %s", m_dialogueExpression.c_str());
+ //如果相同直接返回
+ if(m_dialogueExpression == m_currentExpression)
+ {
+ return;
+ }
+ m_dialogueExpression = m_currentExpression;
+ // 恢复表情状态
+ // 构建表情文件路径并切换表情
+ std::string expressionPath;
+ if (screenImageAsEmoji_ == false) {
+ // 不为屏保模式,根据角色配置构建表情路径
+ if (eyesColor_.empty() || eyesShape_.empty() ||
+ (eyesShape_ == "calm-eyes" && eyesColor_ == "amber")) {
+ // 默认表情
+ std::string emotionFileName = MapEmotionToFileName(m_dialogueExpression.c_str());
+ expressionPath = "/user/res/video/Default/" + emotionFileName + ".mp4";
+ } else {
+ // 非默认表情
+ if (m_dialogueExpression == "winking") {
+ // 眨眼表情
+ expressionPath = "/user/res/video/CloseEyes/" + eyesShape_ + "/" + eyesColor_ + ".mp4";
+ } else if (m_dialogueExpression == "sleeping") {
+ // 睡眠表情
+ expressionPath = "/user/res/video/Default/sleeping.mp4";
+ } else {
+ // 其他表情
+ expressionPath = "/user/userdata/leiniao/emoji/" + eyesShape_ + "/" + eyesColor_ + "/" + m_dialogueExpression + ".mp4";
+ }
+ }
+
+ // 检查文件是否存在并切换表情
+ if (access(expressionPath.c_str(), F_OK) == 0) {
+ SwitchExpressionVideo(expressionPath.c_str());
+ HandleHairIconChange(m_dialogueExpression);
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ThunderBirdModel::OnExitDialogueMode: 恢复表情成功: %s", expressionPath.c_str());
+ } else {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ThunderBirdModel::OnExitDialogueMode: 表情文件不存在: %s", expressionPath.c_str());
+ }
+ }
+ } else {
+ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ThunderBirdModel::OnExitDialogueMode: 没有记录的表情,无法恢复");
}
}