mirror of
https://github.com/CraftyBoss/SuperMarioOdysseyOnline.git
synced 2024-11-24 12:15:16 +00:00
remove reconnect button
This commit is contained in:
parent
4339847da5
commit
366ad5e888
4 changed files with 6 additions and 138 deletions
|
@ -29,7 +29,6 @@ class StageSceneStateServerConfig : public al::HostStateBase<al::Scene>, public
|
|||
enum ServerConfigOption {
|
||||
GAMEMODECONFIG,
|
||||
GAMEMODESWITCH,
|
||||
RECONNECT,
|
||||
SETIP,
|
||||
SETPORT
|
||||
};
|
||||
|
@ -42,11 +41,9 @@ class StageSceneStateServerConfig : public al::HostStateBase<al::Scene>, public
|
|||
void exeMainMenu();
|
||||
void exeOpenKeyboardIP();
|
||||
void exeOpenKeyboardPort();
|
||||
void exeRestartServer();
|
||||
void exeGamemodeConfig();
|
||||
void exeGamemodeSelect();
|
||||
void exeSaveData();
|
||||
void exeConnectError();
|
||||
|
||||
void endSubMenu();
|
||||
|
||||
|
@ -63,7 +60,7 @@ class StageSceneStateServerConfig : public al::HostStateBase<al::Scene>, public
|
|||
|
||||
SimpleLayoutMenu* mCurrentMenu = nullptr;
|
||||
CommonVerticalList* mCurrentList = nullptr;
|
||||
// Root Page, contains buttons for gamemode config, server reconnecting, and server ip address changing
|
||||
// Root Page, contains buttons for gamemode config, and server ip address changing
|
||||
SimpleLayoutMenu* mMainOptions = nullptr;
|
||||
CommonVerticalList *mMainOptionsList = nullptr;
|
||||
// Sub-Page of Mode config, used to select a gamemode for the client to use
|
||||
|
@ -86,9 +83,7 @@ namespace {
|
|||
NERVE_HEADER(StageSceneStateServerConfig, MainMenu)
|
||||
NERVE_HEADER(StageSceneStateServerConfig, OpenKeyboardIP)
|
||||
NERVE_HEADER(StageSceneStateServerConfig, OpenKeyboardPort)
|
||||
NERVE_HEADER(StageSceneStateServerConfig, RestartServer)
|
||||
NERVE_HEADER(StageSceneStateServerConfig, GamemodeConfig)
|
||||
NERVE_HEADER(StageSceneStateServerConfig, GamemodeSelect)
|
||||
NERVE_HEADER(StageSceneStateServerConfig, SaveData)
|
||||
NERVE_HEADER(StageSceneStateServerConfig, ConnectError)
|
||||
}
|
|
@ -16,7 +16,6 @@
|
|||
#include "al/LiveActor/LiveActor.h"
|
||||
#include "al/layout/LayoutInitInfo.h"
|
||||
#include "al/layout/SimpleLayoutAppearWaitEnd.h"
|
||||
#include "al/layout/WindowConfirmWait.h"
|
||||
#include "al/util.hpp"
|
||||
#include "al/layout/LayoutActor.h"
|
||||
#include "al/gamepad/util.h"
|
||||
|
@ -88,7 +87,6 @@ class Client {
|
|||
|
||||
bool startThread();
|
||||
void readFunc();
|
||||
static void restartConnection();
|
||||
|
||||
static bool isSocketActive() { return sInstance ? sInstance->mSocket->isConnected() : false; };
|
||||
bool isPlayerConnected(int index) { return mPuppetInfoArr[index]->isConnected; }
|
||||
|
@ -175,12 +173,6 @@ class Client {
|
|||
static bool openKeyboardIP();
|
||||
static bool openKeyboardPort();
|
||||
|
||||
static void showConnect();
|
||||
|
||||
static void showConnectError(const char16_t* msg);
|
||||
|
||||
static void hideConnect();
|
||||
|
||||
void resetCollectedShines();
|
||||
|
||||
void removeShine(int shineId);
|
||||
|
@ -241,8 +233,6 @@ class Client {
|
|||
|
||||
// --- Game Layouts ---
|
||||
|
||||
al::WindowConfirmWait* mConnectionWait;
|
||||
|
||||
al::SimpleLayoutAppearWaitEnd *mConnectStatus;
|
||||
|
||||
// --- Game Info ---
|
||||
|
|
|
@ -71,13 +71,8 @@ Client::Client() {
|
|||
*/
|
||||
void Client::init(al::LayoutInitInfo const &initInfo, GameDataHolderAccessor holder) {
|
||||
|
||||
mConnectionWait = new (mHeap) al::WindowConfirmWait("ServerWaitConnect", "WindowConfirmWait", initInfo);
|
||||
|
||||
mConnectStatus = new (mHeap) al::SimpleLayoutAppearWaitEnd("", "SaveMessage", initInfo, 0, false);
|
||||
|
||||
mConnectionWait->setTxtMessage(u"Connecting to Server.");
|
||||
mConnectionWait->setTxtMessageConfirm(u"Failed to Connect!");
|
||||
|
||||
al::setPaneString(mConnectStatus, "TxtSave", u"Connecting to Server.", 0);
|
||||
al::setPaneString(mConnectStatus, "TxtSaveSh", u"Connecting to Server.", 0);
|
||||
|
||||
|
@ -105,44 +100,6 @@ bool Client::startThread() {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief restarts currently active connection to server
|
||||
*
|
||||
*/
|
||||
void Client::restartConnection() {
|
||||
|
||||
if (!sInstance) {
|
||||
Logger::log("Static Instance is null!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
sead::ScopedCurrentHeapSetter setter(sInstance->mHeap);
|
||||
|
||||
Logger::log("Sending Disconnect.\n");
|
||||
|
||||
PlayerDC *playerDC = new PlayerDC();
|
||||
|
||||
playerDC->mUserID = sInstance->mUserID;
|
||||
|
||||
sInstance->mSocket->queuePacket(playerDC);
|
||||
|
||||
if (sInstance->mSocket->closeSocket()) {
|
||||
Logger::log("Sucessfully Closed Socket.\n");
|
||||
}
|
||||
|
||||
sInstance->mConnectCount = 0;
|
||||
|
||||
sInstance->mIsConnectionActive = sInstance->mSocket->init(sInstance->mServerIP.cstr(), sInstance->mServerPort).isSuccess();
|
||||
|
||||
if(sInstance->mSocket->getLogState() == SOCKET_LOG_CONNECTED) {
|
||||
|
||||
Logger::log("Reconnect Sucessful!\n");
|
||||
|
||||
} else {
|
||||
Logger::log("Reconnect Unsuccessful.\n");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief starts a connection using client's TCP socket class, pulling up the software keyboard for user inputted IP if save file does not have one saved.
|
||||
*
|
||||
|
@ -1393,37 +1350,3 @@ Shine* Client::findStageShine(int shineID) {
|
|||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void Client::showConnectError(const char16_t* msg) {
|
||||
if (!sInstance)
|
||||
return;
|
||||
|
||||
sInstance->mConnectionWait->setTxtMessageConfirm(msg);
|
||||
|
||||
al::hidePane(sInstance->mConnectionWait, "Page01"); // hide A button prompt
|
||||
|
||||
if (!sInstance->mConnectionWait->mIsAlive) {
|
||||
sInstance->mConnectionWait->appear();
|
||||
|
||||
sInstance->mConnectionWait->playLoop();
|
||||
}
|
||||
|
||||
al::startAction(sInstance->mConnectionWait, "Confirm", "State");
|
||||
}
|
||||
|
||||
void Client::showConnect() {
|
||||
if (!sInstance)
|
||||
return;
|
||||
|
||||
sInstance->mConnectionWait->appear();
|
||||
|
||||
sInstance->mConnectionWait->playLoop();
|
||||
|
||||
}
|
||||
|
||||
void Client::hideConnect() {
|
||||
if (!sInstance)
|
||||
return;
|
||||
|
||||
sInstance->mConnectionWait->tryEnd();
|
||||
}
|
||||
|
|
|
@ -41,14 +41,13 @@ StageSceneStateServerConfig::StageSceneStateServerConfig(const char *name, al::S
|
|||
|
||||
mMainOptionsList->unkInt1 = 1;
|
||||
|
||||
mMainOptionsList->initDataNoResetSelected(5);
|
||||
mMainOptionsList->initDataNoResetSelected(4);
|
||||
|
||||
sead::SafeArray<sead::WFixedSafeString<0x200>, 5>* mainMenuOptions =
|
||||
new sead::SafeArray<sead::WFixedSafeString<0x200>, 5>();
|
||||
sead::SafeArray<sead::WFixedSafeString<0x200>, 4>* mainMenuOptions =
|
||||
new sead::SafeArray<sead::WFixedSafeString<0x200>, 4>();
|
||||
|
||||
mainMenuOptions->mBuffer[ServerConfigOption::GAMEMODECONFIG].copy(u"Gamemode Config");
|
||||
mainMenuOptions->mBuffer[ServerConfigOption::GAMEMODESWITCH].copy(u"Change Gamemode");
|
||||
mainMenuOptions->mBuffer[ServerConfigOption::RECONNECT].copy(u"Reconnect to Server");
|
||||
mainMenuOptions->mBuffer[ServerConfigOption::SETIP].copy(u"Change Server IP");
|
||||
mainMenuOptions->mBuffer[ServerConfigOption::SETPORT].copy(u"Change Server Port");
|
||||
|
||||
|
@ -176,10 +175,6 @@ void StageSceneStateServerConfig::exeMainMenu() {
|
|||
al::setNerve(this, &nrvStageSceneStateServerConfigGamemodeSelect);
|
||||
break;
|
||||
}
|
||||
case ServerConfigOption::RECONNECT: {
|
||||
al::setNerve(this, &nrvStageSceneStateServerConfigRestartServer);
|
||||
break;
|
||||
}
|
||||
case ServerConfigOption::SETIP: {
|
||||
al::setNerve(this, &nrvStageSceneStateServerConfigOpenKeyboardIP);
|
||||
break;
|
||||
|
@ -233,27 +228,6 @@ void StageSceneStateServerConfig::exeOpenKeyboardPort() {
|
|||
}
|
||||
}
|
||||
|
||||
void StageSceneStateServerConfig::exeRestartServer() {
|
||||
if (al::isFirstStep(this)) {
|
||||
mCurrentList->deactivate();
|
||||
|
||||
Client::showConnect();
|
||||
|
||||
Client::restartConnection();
|
||||
}
|
||||
|
||||
if (Client::isSocketActive()) {
|
||||
|
||||
Client::hideConnect();
|
||||
|
||||
al::startHitReaction(mCurrentMenu, "リセット", 0);
|
||||
|
||||
al::setNerve(this, &nrvStageSceneStateServerConfigMainMenu);
|
||||
} else {
|
||||
al::setNerve(this, &nrvStageSceneStateServerConfigConnectError);
|
||||
}
|
||||
}
|
||||
|
||||
void StageSceneStateServerConfig::exeGamemodeConfig() {
|
||||
if (al::isFirstStep(this)) {
|
||||
mGamemodeConfigMenu = &mGamemodeConfigMenus[GameModeManager::instance()->getGameMode()];
|
||||
|
@ -290,18 +264,6 @@ void StageSceneStateServerConfig::exeGamemodeSelect() {
|
|||
}
|
||||
}
|
||||
|
||||
void StageSceneStateServerConfig::exeConnectError() {
|
||||
if (al::isFirstStep(this)) {
|
||||
Client::showConnectError(u"Failed to Reconnect!");
|
||||
}
|
||||
|
||||
if (al::isGreaterEqualStep(this, 60)) { // close after 1 second
|
||||
Client::hideConnect();
|
||||
al::startHitReaction(mCurrentMenu, "リセット", 0);
|
||||
al::setNerve(this, &nrvStageSceneStateServerConfigMainMenu);
|
||||
}
|
||||
}
|
||||
|
||||
void StageSceneStateServerConfig::exeSaveData() {
|
||||
|
||||
if (al::isFirstStep(this)) {
|
||||
|
@ -373,9 +335,7 @@ namespace {
|
|||
NERVE_IMPL(StageSceneStateServerConfig, MainMenu)
|
||||
NERVE_IMPL(StageSceneStateServerConfig, OpenKeyboardIP)
|
||||
NERVE_IMPL(StageSceneStateServerConfig, OpenKeyboardPort)
|
||||
NERVE_IMPL(StageSceneStateServerConfig, RestartServer)
|
||||
NERVE_IMPL(StageSceneStateServerConfig, GamemodeConfig)
|
||||
NERVE_IMPL(StageSceneStateServerConfig, GamemodeSelect)
|
||||
NERVE_IMPL(StageSceneStateServerConfig, SaveData)
|
||||
NERVE_IMPL(StageSceneStateServerConfig, ConnectError)
|
||||
}
|
Loading…
Reference in a new issue