logout works
This commit is contained in:
parent
1bb89e053a
commit
9de3bfb8b0
|
@ -1,3 +1,11 @@
|
||||||
function Game.createMainInterface()
|
function Game.createMainInterface()
|
||||||
gameUi = loadUI('/game/ui/gameinterface.otui', UI.root)
|
gameUi = loadUI('/game/ui/gameinterface.otui', UI.root)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function Game.onLogin()
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
function Game.onLogout()
|
||||||
|
|
||||||
|
end
|
||||||
|
|
|
@ -9,4 +9,5 @@ UIWidget
|
||||||
Button
|
Button
|
||||||
anchors.left: gameMap.right
|
anchors.left: gameMap.right
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
text: Logout
|
text: Logout
|
||||||
|
onClick: Game.logout()
|
|
@ -157,7 +157,17 @@ namespace Fw
|
||||||
KeyF9 = 137,
|
KeyF9 = 137,
|
||||||
KeyF10 = 138,
|
KeyF10 = 138,
|
||||||
KeyF11 = 139,
|
KeyF11 = 139,
|
||||||
KeyF12 = 140
|
KeyF12 = 140,
|
||||||
|
KeyNumpad0 = 141,
|
||||||
|
KeyNumpad1 = 142,
|
||||||
|
KeyNumpad2 = 143,
|
||||||
|
KeyNumpad3 = 144,
|
||||||
|
KeyNumpad4 = 145,
|
||||||
|
KeyNumpad5 = 146,
|
||||||
|
KeyNumpad6 = 147,
|
||||||
|
KeyNumpad7 = 148,
|
||||||
|
KeyNumpad8 = 149,
|
||||||
|
KeyNumpad9 = 150
|
||||||
};
|
};
|
||||||
|
|
||||||
enum LogLevel {
|
enum LogLevel {
|
||||||
|
|
|
@ -40,8 +40,10 @@ void ModuleManager::discoverAndLoadModules()
|
||||||
|
|
||||||
// auto load modules
|
// auto load modules
|
||||||
for(const ModulePtr& module : m_modules) {
|
for(const ModulePtr& module : m_modules) {
|
||||||
if(!module->isLoaded() && module->autoLoad())
|
if(!module->isLoaded() && module->autoLoad()) {
|
||||||
module->load();
|
if(!module->load())
|
||||||
|
logFatal("cannot continue to run");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -202,6 +202,19 @@ void Platform::init(PlatformListener* platformListener, const char *appName)
|
||||||
x11.keyMap[XK_KP_Enter] = Fw::KeyEnter;
|
x11.keyMap[XK_KP_Enter] = Fw::KeyEnter;
|
||||||
|
|
||||||
// keypad with numlock off
|
// keypad with numlock off
|
||||||
|
x11.keyMap[XK_KP_Insert] = Fw::KeyNumpad0;
|
||||||
|
x11.keyMap[XK_KP_End] = Fw::KeyNumpad1;
|
||||||
|
x11.keyMap[XK_KP_Down] = Fw::KeyNumpad2;
|
||||||
|
x11.keyMap[XK_KP_Page_Down] = Fw::KeyNumpad3;
|
||||||
|
x11.keyMap[XK_KP_Left] = Fw::KeyNumpad4;
|
||||||
|
x11.keyMap[XK_KP_Begin] = Fw::KeyNumpad5;
|
||||||
|
x11.keyMap[XK_KP_Right] = Fw::KeyNumpad6;
|
||||||
|
x11.keyMap[XK_KP_Home] = Fw::KeyNumpad7;
|
||||||
|
x11.keyMap[XK_KP_Up] = Fw::KeyNumpad8;
|
||||||
|
x11.keyMap[XK_KP_Page_Up] = Fw::KeyNumpad9;
|
||||||
|
x11.keyMap[XK_KP_Delete] = Fw::KeyDelete;
|
||||||
|
|
||||||
|
/*
|
||||||
x11.keyMap[XK_KP_Up] = Fw::KeyUp;
|
x11.keyMap[XK_KP_Up] = Fw::KeyUp;
|
||||||
x11.keyMap[XK_KP_Down] = Fw::KeyDown;
|
x11.keyMap[XK_KP_Down] = Fw::KeyDown;
|
||||||
x11.keyMap[XK_KP_Left] = Fw::KeyLeft;
|
x11.keyMap[XK_KP_Left] = Fw::KeyLeft;
|
||||||
|
@ -212,6 +225,7 @@ void Platform::init(PlatformListener* platformListener, const char *appName)
|
||||||
x11.keyMap[XK_KP_End] = Fw::KeyEnd;
|
x11.keyMap[XK_KP_End] = Fw::KeyEnd;
|
||||||
x11.keyMap[XK_KP_Insert] = Fw::KeyInsert;
|
x11.keyMap[XK_KP_Insert] = Fw::KeyInsert;
|
||||||
x11.keyMap[XK_KP_Delete] = Fw::KeyDelete;
|
x11.keyMap[XK_KP_Delete] = Fw::KeyDelete;
|
||||||
|
*/
|
||||||
|
|
||||||
// keypad with numlock on
|
// keypad with numlock on
|
||||||
x11.keyMap[XK_KP_0] = Fw::Key0;
|
x11.keyMap[XK_KP_0] = Fw::Key0;
|
||||||
|
|
|
@ -46,6 +46,7 @@ void OTClient::registerLuaFunctions()
|
||||||
|
|
||||||
g_lua.registerClass<Game>();
|
g_lua.registerClass<Game>();
|
||||||
g_lua.bindClassStaticFunction<Game>("loginWorld", std::bind(&Game::loginWorld, &g_game, _1, _2, _3, _4, _5));
|
g_lua.bindClassStaticFunction<Game>("loginWorld", std::bind(&Game::loginWorld, &g_game, _1, _2, _3, _4, _5));
|
||||||
|
g_lua.bindClassStaticFunction<Game>("logout", std::bind(&Game::logout, &g_game));
|
||||||
|
|
||||||
g_lua.registerClass<UIMap, UIWidget>();
|
g_lua.registerClass<UIMap, UIWidget>();
|
||||||
g_lua.bindClassStaticFunction<UIMap>("create", &UIWidget::create<UIMap>);
|
g_lua.bindClassStaticFunction<UIMap>("create", &UIWidget::create<UIMap>);
|
||||||
|
|
|
@ -40,30 +40,30 @@ void UIMap::render()
|
||||||
bool UIMap::onKeyPress(uchar keyCode, char keyChar, int keyboardModifiers)
|
bool UIMap::onKeyPress(uchar keyCode, char keyChar, int keyboardModifiers)
|
||||||
{
|
{
|
||||||
if(keyboardModifiers == Fw::KeyboardNoModifier) {
|
if(keyboardModifiers == Fw::KeyboardNoModifier) {
|
||||||
if(keyCode == Fw::KeyUp) {
|
if(keyCode == Fw::KeyUp || keyCode == Fw::KeyNumpad8) {
|
||||||
g_game.walk(Otc::North);
|
g_game.walk(Otc::North);
|
||||||
return true;
|
return true;
|
||||||
} else if(keyCode == Fw::KeyRight) {
|
} else if(keyCode == Fw::KeyRight || keyCode == Fw::KeyNumpad6) {
|
||||||
g_game.walk(Otc::East);
|
g_game.walk(Otc::East);
|
||||||
return true;
|
return true;
|
||||||
} else if(keyCode == Fw::KeyDown) {
|
} else if(keyCode == Fw::KeyDown || keyCode == Fw::KeyNumpad2) {
|
||||||
g_game.walk(Otc::South);
|
g_game.walk(Otc::South);
|
||||||
return true;
|
return true;
|
||||||
} else if(keyCode == Fw::KeyLeft) {
|
} else if(keyCode == Fw::KeyLeft || keyCode == Fw::KeyNumpad4) {
|
||||||
g_game.walk(Otc::West);
|
g_game.walk(Otc::West);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} else if(keyboardModifiers == Fw::KeyboardCtrlModifier) {
|
} else if(keyboardModifiers == Fw::KeyboardCtrlModifier) {
|
||||||
if(keyCode == Fw::KeyUp) {
|
if(keyCode == Fw::KeyUp || keyCode == Fw::KeyNumpad8) {
|
||||||
g_game.turn(Otc::North);
|
g_game.turn(Otc::North);
|
||||||
return true;
|
return true;
|
||||||
} else if(keyCode == Fw::KeyRight) {
|
} else if(keyCode == Fw::KeyRight || keyCode == Fw::KeyNumpad6) {
|
||||||
g_game.turn(Otc::East);
|
g_game.turn(Otc::East);
|
||||||
return true;
|
return true;
|
||||||
} else if(keyCode == Fw::KeyDown) {
|
} else if(keyCode == Fw::KeyDown || keyCode == Fw::KeyNumpad2) {
|
||||||
g_game.turn(Otc::South);
|
g_game.turn(Otc::South);
|
||||||
return true;
|
return true;
|
||||||
} else if(keyCode == Fw::KeyLeft) {
|
} else if(keyCode == Fw::KeyLeft || keyCode == Fw::KeyNumpad4) {
|
||||||
g_game.turn(Otc::West);
|
g_game.turn(Otc::West);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue