⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gamestate.cpp

📁 墨香最新私服
💻 CPP
字号:
// GameState.cpp: implementation of the CGameState class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "GameState.h"
#include "MainGame.h"
#include "..\interface\cwindowmanager.h"
#include "windowidenum.h"
#include "cmsgbox.h"
#include "chatmanager.h"

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
extern HWND _g_hWnd;


CGameState::CGameState()
{
	m_bBlockScreen	= FALSE;
	m_bDisconnected = FALSE;
}

CGameState::~CGameState()
{

}
BOOL CGameState::CommonNetworkParser(BYTE Category,BYTE Protocol,void* pMsg)
{
	BOOL rt = FALSE;
	switch(Category) 
	{
	case MP_USERCONN:
		{
			switch(Protocol) 
			{
			case MP_USERCONN_OTHERUSER_CONNECTTRY_NOTIFY:
				{
					//cEditBox* pEdit = (cEditBox*)WINDOWMGR->GetWindowForIDEx( MT_PWDEDITBOX );
					//pEdit->SetFocusEdit( FALSE );
					//MAINGAME->GetCurGameState()->SetBlock(TRUE);
					WINDOWMGR->MsgBox( MBI_OTHERUSER_CONNECTTRY, MBT_OK, CHATMGR->GetChatMsg(2) );
					rt = TRUE;
				}
				break;
			case MP_USERCONN_CONNECTION_CHECK:
				{
					MSGBASE msg;
					msg.Category = MP_USERCONN;
					msg.Protocol = MP_USERCONN_CONNECTION_CHECK_OK;
					NETWORK->Send(&msg,sizeof(msg));
					rt = TRUE;
				}
				break;
			case MP_USERCONN_DISCONNECTED_BY_OVERLAPLOGIN:
				{
					WINDOWMGR->MsgBox( MBI_DISCONNECTED_OVERLAPPEDLOGIN, 
						MBT_OK, CHATMGR->GetChatMsg(3) );
					rt = TRUE;
				}
				break;
			}
		}
		break;
	}

	return rt;
}

void CGameState::SetBlock(BOOL val)
{
	m_bBlockScreen = val;
}

void CGameState::OnDisconnect()
{
	m_bDisconnected = TRUE;
	if( cMsgBox::IsInit() )	//霸烙沥瘤鞘夸? confirm
	{
		cMsgBox* pMsgBox = WINDOWMGR->MsgBox( MBI_SERVERDISCONNECT, MBT_OK, CHATMGR->GetChatMsg( 448 ) );
	}
	else
	{
		MessageBox( NULL, "Disconnected To Server.\nThe Game is Closing.", 0, 0 );
//		MAINGAME->SetGameState(eGAMESTATE_END);
		PostMessage( _g_hWnd, WM_CLOSE, NULL, NULL );
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -