mirror of
https://github.com/whoahq/whoa.git
synced 2026-02-01 00:02:45 +03:00
feat(ui): implement Script_SelectCharacter
This commit is contained in:
parent
cf219c37ca
commit
6c9d15d6f7
@ -72,6 +72,10 @@ void CCharacterSelection::SetBackgroundModel(const char* modelPath) {
|
||||
}
|
||||
}
|
||||
|
||||
void CCharacterSelection::ShowCharacter() {
|
||||
// TODO
|
||||
}
|
||||
|
||||
void CCharacterSelection::UpdateCharacterList() {
|
||||
// TODO
|
||||
|
||||
|
||||
@ -35,6 +35,7 @@ class CCharacterSelection {
|
||||
static void OnGetCharacterList();
|
||||
static void RenderPrep();
|
||||
static void SetBackgroundModel(const char* modelPath);
|
||||
static void ShowCharacter();
|
||||
static void UpdateCharacterList();
|
||||
};
|
||||
|
||||
|
||||
@ -51,7 +51,22 @@ int32_t Script_GetCharacterInfo(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) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user