My Project
PuzzleDBProvider.h
1 #pragma once
2 #include "ic/ParaDatabase.h"
3 #include ".\StringTable.h"
4 
5 
6 namespace ParaEngine
7 {
9  {
10  // TODO: change the db_puzzle.sql to new version
11 
13  __int64 ID;
14  stStringTableDbRecord PuzzleName; // record in string table
15 
18 
20  stStringTableDbRecord PuzzleDesc; // record in string table
21  int NumberOfChoices; // Limit to 4 (ABCD)
22  stStringTableDbRecord PuzzleAnswerA; // record in string table
23  stStringTableDbRecord PuzzleAnswerB; // record in string table
24  stStringTableDbRecord PuzzleAnswerC; // record in string table
25  stStringTableDbRecord PuzzleAnswerD; // record in string table
26  string PuzzleDescPicFilePath;
27 
30  stStringTableDbRecord Explanation; // record in string table
31  string ExplanationPicFilePath;
32 
34  string Reserved1;
35  string Reserved2;
36  string Reserved3;
37  string Reserved4;
38  string Reserved5;
39  };
40 
41  // Class Description: CPuzzleDBProvider contains all functions to access the
42  // puzzle database and the user interface data of puzzle control.
43  // This is a singleton class. Call GetInstance() to use this class.
45  {
46  public:
47  CPuzzleDBProvider(void);
49  ~CPuzzleDBProvider(void);
50  protected:
51  private:
52 
54  ParaEngine::asset_ptr<ParaInfoCenter::DBEntity> m_pDataBase;
55 
56  public:
58  static CPuzzleDBProvider & GetInstance();
60  ParaInfoCenter::DBEntity* GetDBEntity();
62  void SetDBEntity(ParaInfoCenter::DBEntity* pDb);
63 
64 #ifdef TEST_PUZZLE
65  public:
66  // TODO: only for test
67  void TestDB();
68 #endif
69 
70  public:
75  bool InsertPuzzleRecord(stPuzzleDbRecord& record);
76 
81  bool DeletePuzzleRecordByID(int ID);
82  };
83 }
int CorrectChoice
Answer Attribute.
Definition: PuzzleDBProvider.h:29
Definition: PuzzleDBProvider.h:44
stStringTableDbRecord PuzzleDesc
Puzzle Attribute.
Definition: PuzzleDBProvider.h:20
different physics engine has different winding order.
Definition: EventBinding.h:32
__int64 ID
Common Attribute.
Definition: PuzzleDBProvider.h:13
int DifficultyRate
Difficulty Attribute.
Definition: PuzzleDBProvider.h:17
string Reserved1
Reserved Attribute.
Definition: PuzzleDBProvider.h:34
Definition: StringTable.h:7
a single database file.
Definition: ICDBManager.h:39
Definition: PuzzleDBProvider.h:8