feat(ui): implement Script_SelectCharacter

This commit is contained in:
fallenoak 2025-10-05 19:43:42 -05:00
parent cf219c37ca
commit 6c9d15d6f7
No known key found for this signature in database
GPG Key ID: 7628F8E61AEA070D
3 changed files with 21 additions and 1 deletions

View File

@ -72,6 +72,10 @@ void CCharacterSelection::SetBackgroundModel(const char* modelPath) {
} }
} }
void CCharacterSelection::ShowCharacter() {
// TODO
}
void CCharacterSelection::UpdateCharacterList() { void CCharacterSelection::UpdateCharacterList() {
// TODO // TODO

View File

@ -35,6 +35,7 @@ class CCharacterSelection {
static void OnGetCharacterList(); static void OnGetCharacterList();
static void RenderPrep(); static void RenderPrep();
static void SetBackgroundModel(const char* modelPath); static void SetBackgroundModel(const char* modelPath);
static void ShowCharacter();
static void UpdateCharacterList(); static void UpdateCharacterList();
}; };

View File

@ -51,7 +51,22 @@ int32_t Script_GetCharacterInfo(lua_State* L) {
} }
int32_t Script_SelectCharacter(lua_State* L) { int32_t Script_SelectCharacter(lua_State* L) {
WHOA_UNIMPLEMENTED(0); if (!lua_isnumber(L, 1)) {
return luaL_error(L, "Usage: SelectCharacter(index)");
}
int32_t index = static_cast<int32_t>(lua_tonumber(L, 1)) - 1;
if (index < 0 || index >= CCharacterSelection::s_characterList.Count()) {
index = 0;
}
CCharacterSelection::s_selectionIndex = index;
CCharacterSelection::ShowCharacter();
FrameScript_SignalEvent(8, "%d", CCharacterSelection::s_selectionIndex + 1);
return 0;
} }
int32_t Script_DeleteCharacter(lua_State* L) { int32_t Script_DeleteCharacter(lua_State* L) {