| 1 | #include "Layout/ShopUtil.h" |
| 2 | |
| 3 | #include "Library/Base/StringUtil.h" |
| 4 | #include "Library/Layout/LayoutActionFunction.h" |
| 5 | #include "Library/Layout/LayoutActorUtil.h" |
| 6 | #include "Library/LiveActor/ActorActionFunction.h" |
| 7 | #include "Library/LiveActor/ActorModelFunction.h" |
| 8 | #include "Library/LiveActor/LiveActor.h" |
| 9 | #include "Library/Message/MessageHolder.h" |
| 10 | #include "Library/Play/Layout/SimpleLayoutAppearWaitEnd.h" |
| 11 | #include "Library/Play/Layout/TalkMessageVoicePlayer.h" |
| 12 | |
| 13 | void ShopUtil::makeExplainLabel(al::StringTmp<256>* result, const char* message, |
| 14 | const char* storeName, bool isWomanExplain) { |
| 15 | const char* person = isWomanExplain ? "Woman" : "" ; |
| 16 | result->format(formatStr: "%s%s%s" , message, storeName, person); |
| 17 | } |
| 18 | |
| 19 | void ShopUtil::startNpcMessage(al::SimpleLayoutAppearWaitEnd* layout, const char16* msgString, |
| 20 | al::LiveActor* actor, const char* actorName, bool* isSkipTextAnim, |
| 21 | al::TalkMessageVoicePlayer* voicePlayer) { |
| 22 | *isSkipTextAnim = false; |
| 23 | al::showPane(layout, "TxtMessage" ); |
| 24 | |
| 25 | al::startTextPaneAnimWithAudioUser(layout, msgString, nullptr, nullptr, actor); |
| 26 | if (voicePlayer) |
| 27 | voicePlayer->start(layout, actor, msgString, 0); |
| 28 | al::startAction(actor, actionName: actorName); |
| 29 | } |
| 30 | |
| 31 | void ShopUtil::startNpcMessage(al::SimpleLayoutAppearWaitEnd* layout, const char* messageName, |
| 32 | al::LiveActor* actor, const char* actorName, bool* isSkipTextAnim, |
| 33 | al::TalkMessageVoicePlayer* voicePlayer) { |
| 34 | const char16* msgString = getSystemMessageStringForShop(messageSystem: layout, messageName); |
| 35 | startNpcMessage(layout, msgString, actor, actorName, isSkipTextAnim, voicePlayer); |
| 36 | } |
| 37 | |
| 38 | const char16* ShopUtil::getSystemMessageStringForShop(const al::IUseMessageSystem* messageSystem, |
| 39 | const char* messageName) { |
| 40 | return al::getSystemMessageString(messageSystem, "ShopMessage" , messageName); |
| 41 | } |
| 42 | |
| 43 | const char* ShopUtil::getShopNameCityMan() { |
| 44 | return "CityManShop" ; |
| 45 | } |
| 46 | |
| 47 | const char* ShopUtil::getShopNameCityWoman() { |
| 48 | return "CityWomanShop" ; |
| 49 | } |
| 50 | |
| 51 | const char* ShopUtil::getShopNameSeaWoman() { |
| 52 | return "SeaWoman" ; |
| 53 | } |
| 54 | |
| 55 | const char* ShopUtil::getShopNameCapWoman() { |
| 56 | return "CapWoman" ; |
| 57 | } |
| 58 | |
| 59 | const char* ShopUtil::getShopNameCapMan() { |
| 60 | return "CapMan" ; |
| 61 | } |
| 62 | |
| 63 | bool ShopUtil::isShopWoman(const char* name) { |
| 64 | return al::isEqualString(str1: name, str2: getShopNameCapWoman()) || |
| 65 | al::isEqualString(str1: name, str2: getShopNameSeaWoman()) || |
| 66 | al::isEqualString(str1: name, str2: getShopNameCityWoman()); |
| 67 | } |
| 68 | |
| 69 | bool ShopUtil::isShopCap(const char* name) { |
| 70 | return al::isEqualString(str1: name, str2: getShopNameCapWoman()) || |
| 71 | al::isEqualString(str1: name, str2: getShopNameCapMan()); |
| 72 | } |
| 73 | |
| 74 | const char* ShopUtil::getWaitShopInActionName(const al::LiveActor* actor) { |
| 75 | if (isShopCap(name: al::getModelName(actor))) |
| 76 | return "WaitShop" ; |
| 77 | return "WaitShopIn" ; |
| 78 | } |
| 79 | |
| 80 | const char* ShopUtil::getWaitShopOutActionName(const al::LiveActor* actor) { |
| 81 | if (isShopCap(name: al::getModelName(actor))) |
| 82 | return "WaitShop" ; |
| 83 | return "WaitShopOut" ; |
| 84 | } |
| 85 | |
| 86 | const char* ShopUtil::getTalkShopInActionName(const al::LiveActor* actor) { |
| 87 | if (isShopCap(name: al::getModelName(actor))) |
| 88 | return "TalkShop" ; |
| 89 | return "TalkShopIn" ; |
| 90 | } |
| 91 | |
| 92 | const char* ShopUtil::getTalkShopOutActionName(const al::LiveActor* actor) { |
| 93 | if (isShopCap(name: al::getModelName(actor))) |
| 94 | return "TalkShop" ; |
| 95 | return "TalkShopOut" ; |
| 96 | } |
| 97 | |
| 98 | const char* ShopUtil::getWelcomeShopInActionName(const al::LiveActor* actor) { |
| 99 | if (isShopCap(name: al::getModelName(actor))) |
| 100 | return "Welcome" ; |
| 101 | return "WelcomeIn" ; |
| 102 | } |
| 103 | |
| 104 | const char* ShopUtil::getWelcomeShopOutActionName(const al::LiveActor* actor) { |
| 105 | if (isShopCap(name: al::getModelName(actor))) |
| 106 | return "Welcome" ; |
| 107 | return "WelcomeOut" ; |
| 108 | } |
| 109 | |