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

📄 menu.h

📁 一个3D的保龄球的源代码
💻 H
字号:
// Menu.h: interface for the CMenu class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_MENU_H__E81439B5_F9F0_4E1D_8941_369F10AA3CA9__INCLUDED_)
#define AFX_MENU_H__E81439B5_F9F0_4E1D_8941_369F10AA3CA9__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "UI.h"

const int MENUSTATECOUNT = 32;
typedef const int MENUSTATE;
MENUSTATE STATE_SUSPEND = 0;
MENUSTATE STATE_PREGAME = 1;
MENUSTATE STATE_MAINMENU = 2;
MENUSTATE STATE_QUICKMODE = 3;
MENUSTATE STATE_ONLINEMODE = 4;
MENUSTATE STATE_STORYMODE = 5;
MENUSTATE STATE_FREEMODE = 6;
MENUSTATE STATE_BONUSMODE = 7;
MENUSTATE STATE_BONUSSELECT = 8;
MENUSTATE STATE_PLAYERSELECTA = 9;
MENUSTATE STATE_CLOTHSELECTA = 10;
MENUSTATE STATE_BALLSELECTA = 11;
MENUSTATE STATE_ICONSELECTA = 12;
MENUSTATE STATE_PLAYERSELECTB = 13;
MENUSTATE STATE_CLOTHSELECTB = 14;
MENUSTATE STATE_BALLSELECTB = 15;
MENUSTATE STATE_ICONSELECTB = 16;
MENUSTATE STATE_LANESELECT = 17;
MENUSTATE STATE_INITCONNECT = 18;
MENUSTATE STATE_RANKING = 19;
MENUSTATE STATE_NICKNAME = 20;
MENUSTATE STATE_RIVALSELECT = 21;
MENUSTATE STATE_RESETPROFILE = 22;
MENUSTATE STATE_PAUSE = 23;
MENUSTATE STATE_YESNO = 24;
MENUSTATE STATE_STARTGAME = 25;
MENUSTATE STATE_OPTION = 26;
MENUSTATE STATE_HELP = 27;
MENUSTATE STATE_CREDIT = 28;
MENUSTATE STATE_VIEWSCORE = 29;
MENUSTATE STATE_TIMEDINFO = 30;

class CDataManager;
class CGame;

class CMenu
{
public:
	void Draw();

	// update menu logic
	void Update();
	CMenu(CEngine* pEngine,	CDataManager* pDataManager);
	void Init();
	void SetUI(CUI *pUI) { m_pUI = pUI;};

	// check if have state
	int CheckState(MENUSTATE) const;

	// get current active state
	MENUSTATE GetState() const;

	void ResetState();

	// set active state, reset selection
	void SetState(MENUSTATE, int = 0);

	// get selected value by user in specified state
	int GetSel(MENUSTATE) const;

	// get selected value by user in bonus game select
	void GetBonus(int& lvl, int& game) const	{	lvl = m_bny;	game = m_bnx;	};
	
	int m_WindDur;
	// store state representation
	unsigned int m_iState;

private:
	int m_iIsCheat;
	int isCheatOpen();
	enum	{
		MMANIMFRAME = 8
	};

	// mainmenu player
	void DrawPlayer(int playerId, int actionid, int clohtid, int posType=0);

	// initialize selection
	void InitSel();

	// exit from current state, reset selection
	void GoBack(MENUSTATE, int = 0);

	void ReleaseResource();

	// handle left/right/up/down key event
	void HandleLR(MENUSTATE);
	void HandleUD(MENUSTATE);

	// draw lane in menu
	void _Lane();

	// draw ball in menu
	void _Ball(MENUSTATE);

	// draw bonus select menu
	void _Bottle();

	CUI *m_pUI;
	CEngine* m_pEngine;
	CGame *m_pGame;
	CKeyinput* m_pInput;
	CDataManager *m_pDataManager;


	// yesno substate
	unsigned int m_iynState;
	enum	{
		YESNO_EXITGAME, 
		YESNO_EXITFROMGAME, 
		YESNO_SAVEGAME, 
		YESNO_NEWSTORY,
		YESNO_SAVEGAMEANDEXIT,
		YESNO_RESETONLINE
	};

	enum	{
		ERR_NONETWORK,
		INIT_CONNECT,
		ERR_GETNICKNAME, 
		ERR_SETNICKNAME, 
		ERR_NICKNAMEDUP,
		ERR_LOGIN, 
		ERR_GETRIVALNAME, 
		ERR_GETACCINFO,
		ERR_REJECTED,
		ERR_GETRANK,
		RESET_SUC,
		STOP_CONNECT
	};

	// count of state
	int m_nCount[MENUSTATECOUNT];

	// selected value of state
	int m_nSel[MENUSTATECOUNT];

	// string of state
	const char *m_cItemString[MENUSTATECOUNT][10];

	// for temporary use in menu animation effect
	int m_iLastItem, m_iSelAnim, m_iRotAnim[6], m_iRotAnim2[10], m_iActAnim, m_bSelected, m_player, m_iRotAnim3;
	int m_mmAnim, m_psAnim, m_opAnim, m_mminAnim;
	CTexture m_icontex[10];

	// bonus selection level, game
	int m_bnx, m_bny;

	// games per level
	int m_bngames[5];

	// page of help
	int m_helppage;
	int m_lastplayer;

	// string of item description
	const char *m_strBallDescA[6];
	const char *m_strBallDescNA;
	const char *m_strIconDesc[8];
	const char *m_strPlayerDescNA;
	const char *m_strPlayerDescNA2;
	const char *m_strLaneDescNA;
	const char *m_strBonusDescNA;
	const char *m_strHelpString[3][15];
	const char *m_strAboutString[70];

	// nickname
	int m_iKey[12], m_iLastKey[12];

	// in cloth selection state
	int m_stateCloth;
	int m_getinfo, m_waitplay, m_knownblank, m_settingnick, m_nickconf, m_accrej, m_acceptop, m_rank1, m_rank2, m_rank3;
	char m_strName[20];
};

#endif // !defined(AFX_MENU_H__E81439B5_F9F0_4E1D_8941_369F10AA3CA9__INCLUDED_)


⌨️ 快捷键说明

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