added MnGuyens further improved menu handling and extra options.

This commit is contained in:
omegablast2002@yahoo.com
2010-09-17 06:34:12 +00:00
parent 3965505b15
commit 5939cbded8
15 changed files with 535 additions and 377 deletions
+6 -5
View File
@@ -1,5 +1,6 @@
#include <string>
#include <vector>
#include "DeckMetaData.h"
using namespace std;
@@ -12,12 +13,12 @@ protected:
public:
vector<int> playerDeckOrderList;
vector<int> aiDeckOrderList;
vector<DeckMetaData *> playerDeckOrderList;
vector<DeckMetaData *> aiDeckOrderList;
vector<int> * getPlayerDeckOrderList();
vector<int> * getAIDeckOrderList();
void updateMetaDataList(vector<DeckMetaData *>* refList, bool isAI );
vector<DeckMetaData *> * getPlayerDeckOrderList();
vector<DeckMetaData *> * getAIDeckOrderList();
static DeckManager * GetInstance();
static void EndInstance();
+17 -7
View File
@@ -4,29 +4,39 @@
#include <string>
#include <vector>
#include <map>
#include "../include/DeckStats.h"
using namespace std;
enum DECK_DIFFICULTY
{
HARD = -1,
NORMAL = 0,
EASY = 1
};
class DeckMetaData {
public:
DeckMetaData();
DeckMetaData(string filename);
DeckMetaData(string filename, Player * statsPlayer);
void load(string filename);
bool operator<(DeckMetaData b);
void loadStatsForPlayer( Player * statsPlayer, string opponentDeckName = "" );
string getDescription();
string desc;
string name;
int deckid;
// statistical information
string& trim(string &str);
string& ltrim(string &str);
string& rtrim(string &str);
int nbGamesPlayed, victories, percentVictories, difficulty;
};
class DeckMetaDataList {
public:
void invalidate(string filename);
DeckMetaData * get(string filename);
DeckMetaData * get(string filename, Player * statsPlayer = NULL);
~DeckMetaDataList();
static DeckMetaDataList * decksMetaData;
+20 -8
View File
@@ -9,6 +9,8 @@ class JGE;
#include <string>
#include <vector>
#include <iostream>
#include "../include/DeckMetaData.h"
using namespace std;
enum ENUM_GAME_STATE
@@ -54,15 +56,25 @@ class GameState
virtual void Update(float dt) = 0;
virtual void Render() = 0;
static int fillDeckMenu(SimpleMenu * _menu, string path, string smallDeckPrefix = "", Player * statsPlayer = NULL);
static int fillDeckMenu( vector<int> * deckIdList, SimpleMenu * _menu, string path, string smallDeckPrefix = "", Player * statsPlayer = NULL);
string& trim(string &str);
string& ltrim(string &str);
string& rtrim(string &str);
};
// deck manipulation methods
// 2010/09/15:
// this was originally one method to do everything. That has been split up into two distinct
// methods since the original was building a menu and returning a value. The first
// creates the vector containing the deck information. The second will render that information
// it makes it easier to manipulate the deck information menus.
// generate the Deck Meta Data and build the menu items of the menu given
static vector<DeckMetaData *> fillDeckMenu(SimpleMenu * _menu, string path, string smallDeckPrefix = "", Player * statsPlayer = NULL);
// build a vector of decks with the information passsed in.
static vector<DeckMetaData *> getValidDeckMetaData(string path, string smallDeckPrefix = "", Player * statsPlayer = NULL);
// build menu items based on the vector<DeckMetaData *>
static void renderDeckMenu(SimpleMenu * _menu, vector<DeckMetaData *> deckMetaDataList);
};
bool sortByName( DeckMetaData * d1, DeckMetaData * d2 );
#endif
@@ -35,6 +35,36 @@ enum
};
// TODO: need a better name for MENU_FIRST_MENU, this is reused for the 1st submenu of
// available options in the duel menu
enum
{
MENU_CARD_PURCHASE = 2,
MENU_DECK_SELECTION = 10,
MENU_DECK_BUILDER = 11,
MENU_FIRST_DUEL_SUBMENU = 102,
MENU_LANGUAGE_SELECTION = 103,
};
// enums for menu options
// TODO: make these enums a little more descriptive. (ie should reflect what menu they are attached to )
enum DECK_VIEWER_MENU_ITEMS
{
MENU_ITEM_NEW_DECK = -30,
MENU_ITEM_CHEAT_MODE = -12,
MENU_ITEM_CANCEL = -1,
MENU_ITEM_SAVE_RETURN_MAIN_MENU = 0,
MENU_ITEM_SAVE_RENAME = 1,
MENU_ITEM_SWITCH_DECKS_NO_SAVE = 2,
MENU_ITEM_MAIN_MENU = 3,
MENU_ITEM_EDITOR_CANCEL = 4,
MENU_ITEM_YES = 20,
MENU_ITEM_NO = 21,
MENU_ITEM_FILTER_BY = 22
};
#define ALL_COLORS -1
#define ROTATE_LEFT 1;
+10
View File
@@ -52,6 +52,16 @@ class GameStateDuel: public GameState, public JGuiListener
virtual void Update(float dt);
virtual void Render();
void initRand (unsigned seed = 0);
enum ENUM_DUEL_STATE_MENU_ITEM
{
MENUITEM_NEW_DECK = -1,
MENUITEM_CANCEL = -10,
MENUITEM_RANDOM_PLAYER = -11,
MENUITEM_RANDOM_AI = -12,
MENUITEM_MAIN_MENU = -13,
MENUITEM_EVIL_TWIN = -14
};
};
+9
View File
@@ -67,6 +67,15 @@ class GameStateMenu: public GameState, public JGuiListener
void resetDirectory();
void createUsersFirstDeck(int setId);
virtual ostream& toString(ostream& out) const;
enum
{
MENU_CARD_PURCHASE = 2,
MENU_DECK_SELECTION = 10,
MENU_DECK_BUILDER = 11,
MENU_FIRST_DUEL_SUBMENU = 102,
MENU_LANGUAGE_SELECTION = 103,
};
};
#endif
+4 -3
View File
@@ -33,9 +33,10 @@
using std::string;
//string manipulation methods
string& trim(string &str);
string& ltrim(string &str);
string& rtrim(string &str);
int loadRandValues(string s);
int filesize(const char * filename);