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

📄 maindlginc.h

📁 一款战旗类的打飞机游戏源码
💻 H
字号:
//////////////////////////////////
//
// Zone call function
//
//

inline void CbombplaneDlg::SetZoneNotDone()
{	GameBeginEnd.EnableWindow(false); }

inline void CbombplaneDlg::SetZoneDone()
{GameBeginEnd.EnableWindow(true);	}

//////////////////////////////////
//
//
//
//
inline void CbombplaneDlg::OnBnClickedHelper()
{
	HINSTANCE i = ShellExecute(0, L"open",L"help.exe", 0, 0, 0);
	if(((int)i)<=32)
	{
		CString str;
		str.LoadString(IDS_NO_HELP);
		MessageBox(str);
	}

}


inline void CbombplaneDlg::InsertInfo(UINT IDS_id)
{
	CString str;
	str.LoadString(IDS_id);
	InsertStr(str,RGB(100,100,100),true);
}

inline void CbombplaneDlg::InsertState(UINT IDS_id)
{
		CString str;
		str.LoadString(IDS_id);	
		InsertStr(str,RGB(0,0,100),true);
}

inline void CbombplaneDlg::SendMsg(CMsg& msg)
{
	if(sock_c==0)return;
	if(!sock_c->SendMsg(msg))
      InsertInfo(IDS_SNDERROR);
}

inline void CbombplaneDlg::InsertStr(const CString& str,COLORREF cr,bool bold)
{	chatWnd.AppendText(str,cr,bold); }

inline void CbombplaneDlg::OnBnClickedClearup()
{	chatWnd.ClearUp(); }

inline void CbombplaneDlg::SetGameGuide(UINT IDS_id)
{
	CString str;
	str.LoadString(IDS_id);
	ZoneGuide = str;
	UpdateData(false);
}

inline void CbombplaneDlg::SetGameState(UINT IDS_id)
{
	CString str;
	str.LoadString(IDS_id);
	GameState = str;
	UpdateData(false);
}



inline void CbombplaneDlg::I_Just_Executed_This_App(){

	CreateBtn.EnableWindow(true);
	ComboIP.EnableWindow(true);
	ConnetBtn.EnableWindow(true);

	diconBtn.EnableWindow(false);
	GameBeginEnd.EnableWindow(false);
	SendIt.EnableWindow(false);

	GuessZone.IsStart = false;
	GuessZone.SetActive(false);
	SetZone.IsStart = false;
	SetZone.SetActive(false);

	SetGameGuide(IDS_GU_WAIT_CONN);
	CString stateStr;
	stateStr.LoadString(IDS_GS_JUST_RUN);

   char name[255];
   CString ip;
	PHOSTENT hostinfo;
	if(gethostname( name, sizeof(name)) == 0)
	{
		if((hostinfo = gethostbyname(name)) != NULL)
		{
			ip = inet_ntoa (*(struct in_addr *)*hostinfo->h_addr_list);
		}
	}
	CString ThisIp;
	ThisIp.Format(stateStr.GetString(),ip);

	GameState = ThisIp;
	UpdateData(false);

}

inline void CbombplaneDlg::I_Clicked_Created(){

	diconBtn.EnableWindow(true);
	//GameBeginEnd.EnableWindow(false);
	CreateBtn.EnableWindow(false);
	ComboIP.EnableWindow(false);
	ConnetBtn.EnableWindow(false);
}

inline void CbombplaneDlg::I_Clicked_Connect(){

	diconBtn.EnableWindow(true);
	//GameBeginEnd.EnableWindow(false);
	CreateBtn.EnableWindow(false);
	ComboIP.EnableWindow(false);
	ConnetBtn.EnableWindow(false);
}

inline void CbombplaneDlg::U_And_Me_Connected(){
	SendIt.EnableWindow(true);
	Start_A_New_Turns();
}

inline void CbombplaneDlg::Start_A_New_Turns(){

	GuessZone.NewGame();
	SetZone.NewGame();

	CString st;
	st.LoadString(IDS_BTN_OK);
	GameBeginEnd.SetWindowText(st);
	GameBeginEnd.EnableWindow(false);

	diconBtn.EnableWindow(true);
	SetZone.IsStart = true;
	SetZone.SetActive(true);

	SetGameState(IDS_GS_NEW);
	Plz_Set_Plane_On_SetZone();
}

inline void CbombplaneDlg::Plz_Set_Plane_On_SetZone(){
	SetGameGuide(IDS_GU_WAIT4SET);
}

inline void CbombplaneDlg::I_Am_1st_Started_Plz_Quick(){
	SetZone.IsStart = false;
	SetZone.SetActive(false);

	GameBeginEnd.EnableWindow(false);

	SetGameState(IDS_GS_START_WAIT);
	SetGameGuide(IDS_GU_PLZ_WAIT);
}

inline void CbombplaneDlg::U_Started_Waiting_4_Me()
{
   SetGameState(IDS_GS_YOU_START);
}

inline void CbombplaneDlg::I_Am_2nd_Start_Wait_U_Guess(){
	SetZone.IsStart = false;
	//SetZone.SetActive(true);
	GuessZone.IsStart = true;
	GuessZone.SetActive(false);

	CString st;
	st.LoadString(IDS_BTN_AB);
	GameBeginEnd.SetWindowText(st);
	diconBtn.EnableWindow(false);

	//GameBeginEnd.EnableWindow(true);

	SetGameState(IDS_GS_YOU_1ST_HIT);
	SetGameGuide(IDS_GU_PLZ_WAIT);
}

inline void CbombplaneDlg::You_Stated_too_But_I_1st(){
	//SetZone.IsStart = false;
	//SetZone.SetActive(false);
	GuessZone.IsStart = true;
	GuessZone.SetActive(true);
   
	CString st;
	st.LoadString(IDS_BTN_AB);
	GameBeginEnd.SetWindowText(st);
	GameBeginEnd.EnableWindow(true);
	diconBtn.EnableWindow(false);

	SetGameState(IDS_GS_I_1ST_HIT);
	SetGameGuide(IDS_GU_GUESS);
}

inline void CbombplaneDlg::It_Is_My_Turn_Now(){
	SetZone.SetActive(false);
	GuessZone.SetActive(true);

	SetGameState(IDS_GS_MYTURN);
	SetGameGuide(IDS_GU_GUESS);
}

inline void CbombplaneDlg::I_Guessed_Wait_Result(){
	//SetZone.SetActive(false);
	GuessZone.SetActive(false);
	SetGameGuide(IDS_GU_SEND);
}

inline void CbombplaneDlg::It_Is_Ur_Turn_Now(){
	SetZone.SetActive(true);
	GuessZone.SetActive(false);
	SetGameGuide(IDS_GU_PLZ_WAIT);
}

inline void CbombplaneDlg::I_Am_Loser_3_Bombed(){
	SetGameState(IDS_GS_LOSE);
	SetGameGuide(IDS_GU_LOSE);
	SetZone.SetActive(false);
	GuessZone.IsStart = false;
	//GuessZone.SetActive(false);
	CString st;
	st.LoadString(IDS_BTN_NW);
	GameBeginEnd.SetWindowText(st);
	diconBtn.EnableWindow(true);
}

inline void CbombplaneDlg::I_Am_Loser_Abort(){
	SetGameGuide(IDS_GU_ABORT);
	SetGameState(IDS_GS_ABORT);
	CString st;
	SetZone.SetActive(false);
	GuessZone.IsStart = false;
	GuessZone.SetActive(false);
	st.LoadString(IDS_BTN_NW);
	GameBeginEnd.SetWindowText(st);
	diconBtn.EnableWindow(true);

}

inline void CbombplaneDlg::I_Am_Win_U_Abort(){
	SetGameState(IDS_GS_WIN_ABORT);
	SetGameGuide(IDS_GU_WIN_ABORT);
	SetZone.SetActive(false);
	GuessZone.IsStart = false;
	GuessZone.SetActive(false);
	CString st;
	st.LoadString(IDS_BTN_NW);
	GameBeginEnd.SetWindowText(st);
	diconBtn.EnableWindow(true);
}

inline void CbombplaneDlg::I_Am_Winner(){
	SetGameState(IDS_GS_WIN);
	SetGameGuide(IDS_GU_WIN);
	SetZone.SetActive(false);
	GuessZone.IsStart = false;
	//GuessZone.SetActive(false);
	CString st;
	st.LoadString(IDS_BTN_NW);
	GameBeginEnd.SetWindowText(st);
	diconBtn.EnableWindow(true);

}

inline void CbombplaneDlg::We_Are_Disconnected()
{
	SetZone.IsStart  = false;
	SetZone.SetActive(false);
	GuessZone.IsStart = false;
	SetZone.SetActive(false);
   I_Just_Executed_This_App();
}

⌨️ 快捷键说明

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