From: xue <2144439972@qq.com> Date: Mon, 3 Nov 2025 07:39:57 +0000 (+0800) Subject: 优化角色切换逻辑,修复绑定后闪屏Bug X-Git-Tag: V1.0.9_20251128_194606_LN~119 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=4eb561ccc3f6609e4b43048397236c97adf61f07;p=mirrors%2FFD230.git 优化角色切换逻辑,修复绑定后闪屏Bug --- diff --git a/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/include/ThunderBirdModel.h b/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/include/ThunderBirdModel.h index 0f82ff7c8..474ada2b4 100644 --- a/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/include/ThunderBirdModel.h +++ b/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/include/ThunderBirdModel.h @@ -331,6 +331,14 @@ namespace OHOS std::string screenImage_; bool screenImageAsEmoji_{false}; + // 上次角色配置 + std::string last_eyesShape_; + std::string last_hairColor_; + std::string last_eyesColor_; + std::string last_hairStyle_; + std::string last_screenImage_; + bool last_screenImageAsEmoji_{false}; + // 对话状态显示相关变量 std::string m_currentExpression; // 当前表情状态 std::string m_currentStatusText; // 当前状态文本 diff --git a/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdModel.cpp b/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdModel.cpp index a4c38ff8c..bd9ca3593 100644 --- a/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdModel.cpp +++ b/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdModel.cpp @@ -104,6 +104,12 @@ uapi_setScreenDuration(30000);//自动息屏30秒 Readlocalconfig(); + last_eyesShape_ = eyesShape_; + last_hairColor_ = hairColor_; + last_eyesColor_ = eyesColor_; + last_hairStyle_ = hairStyle_; + last_screenImageAsEmoji_ = screenImageAsEmoji_; + printf(" eyesShape_ = %s", eyesShape_.c_str()); printf(" hairColor_ = %s", hairColor_.c_str()); printf(" eyesColor_ = %s", eyesColor_.c_str()); @@ -1990,11 +1996,18 @@ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, " hairStyle: %s", hairStyle ? hairStyle : "null"); WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, " screenImageAsEmoji: %d", screenImageAsEmoji); - eyesShape_ = eyesShape; - hairColor_ = hairColor; - eyesColor_ = eyesColor; - hairStyle_ = hairStyle; - screenImageAsEmoji_ = screenImageAsEmoji; + if(eyesShape == last_eyesShape_ && hairColor == last_hairColor_ && eyesColor == last_eyesColor_ && hairStyle == last_hairStyle_ && screenImageAsEmoji == last_screenImageAsEmoji_) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ThunderBirdModel::HandleCharacterConfigChange: 角色配置没有变化,不进行处理"); + return; + } + //更新上次角色配置信息 + last_eyesShape_ = eyesShape_; + last_hairColor_ = hairColor_; + last_eyesColor_ = eyesColor_; + last_hairStyle_ = hairStyle_; + last_screenImageAsEmoji_ = screenImageAsEmoji_; + // 这里可以添加角色配置更改的具体处理逻辑 @@ -2030,6 +2043,12 @@ ThunderBirdMainView::GetInstance()->OpenScreenImageModel(); } } + //更新角色配置信息 + eyesShape_ = eyesShape; + hairColor_ = hairColor; + eyesColor_ = eyesColor; + hairStyle_ = hairStyle; + screenImageAsEmoji_ = screenImageAsEmoji; // SaveCharacterConfig(characterId, characterName, eyesShape, hairColor, eyesColor, hairStyle, screenImageAsEmoji); }