My Project
ItemDBProvider.h
1 #pragma once
2 #include "ic/ParaDatabase.h"
3 #include ".\StringTable.h"
4 
5 namespace ParaEngine
6 {
8  {
9  // TODO: change the db_item.sql to new version
10 
12  __int64 ID;
13  stStringTableDbRecord ItemName; // record in string table
14 
16  string IconAssetName;
17  string DescTextAssetName;
18  bool IsGlobal; // stored in db 0/1
19 
21  string IconFilePath;
23  stStringTableDbRecord Desc; // record in string table
24  string ModelFilePath;
25 
27  int ItemType;
29  bool IsObtained; // stored in db 0/1
30  bool IsUnique; // stored in db 0/1
32  int CostExperiencePt; // stored in db 0/1
35  int CostApple;
36  int CostPeach;
37 
39  string Reserved1;
40  string Reserved2;
41  string Reserved3;
42  string Reserved4;
43  string Reserved5;
44  };
45 
46  // Class CItemDBProvider: CItemDBProvider contains all functions to access the
47  // item database and the user interface data of item control.
48  // This is a singleton class. Call GetInstance() to use this class.
50  {
51  public:
52  CItemDBProvider(void);
54  ~CItemDBProvider(void);
55  protected:
56  private:
57 
59  ParaEngine::asset_ptr<ParaInfoCenter::DBEntity> m_pDataBase;
60 
61  public:
63  static CItemDBProvider & GetInstance();
65  ParaInfoCenter::DBEntity* GetDBEntity();
67  void SetDBEntity(ParaInfoCenter::DBEntity* pDb);
68 
69 //#define TEST_ITEM
70 #ifdef TEST_ITEM
71  public:
72  // TODO: only for test
73  void TestDB();
74 #endif
75 
76  public:
81  bool InsertItemRecord(stItemDbRecord& record);
82 
87  bool DeleteItemRecordByID(int ID);
88 
93  bool UpdateItemRecord(stItemDbRecord& record);
94 
99  bool SelectItemRecordByID(stItemDbRecord& record, __int64 ID);
100  };
101 }
int ItemType
Kids Game Related Attribute.
Definition: ItemDBProvider.h:27
Definition: ItemDBProvider.h:49
different physics engine has different winding order.
Definition: EventBinding.h:32
stStringTableDbRecord Desc
Desc: text shown when mouse over the icon.
Definition: ItemDBProvider.h:23
string IconAssetName
Engine Asset Management Attribute.
Definition: ItemDBProvider.h:16
bool IsObtained
NOTE: IsObtained is a tag specify if player can build.
Definition: ItemDBProvider.h:29
__int64 ID
Common Attribute.
Definition: ItemDBProvider.h:12
string IconFilePath
UI Related Attribute.
Definition: ItemDBProvider.h:21
Definition: ItemDBProvider.h:7
int CostOrange
TODO: Change according to game design.
Definition: ItemDBProvider.h:34
string Reserved1
Reserved Attribute.
Definition: ItemDBProvider.h:39
Definition: StringTable.h:7
a single database file.
Definition: ICDBManager.h:39
int CostExperiencePt
TODO: if special item need cost exp and fruit.
Definition: ItemDBProvider.h:32