-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtestbegin.cpp
More file actions
64 lines (55 loc) · 2.18 KB
/
Copy pathtestbegin.cpp
File metadata and controls
64 lines (55 loc) · 2.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#include "common/macros.h"
#include "common/nndef.h"
#include "gameroot.h"
#include "logic/clientlogic/core/testbegin.h"
#include "utils/tarslog.h"
#include "context/context.h"
#include "config/gameconfig.h"
#include "process/process.h"
#include "message/sendclientmessage.h"
#include "message/sendroommessage.h"
#include "logic/gamelogic/core/endtimer.h"
#include "logic/gamelogic/core/checkbegin.h"
using namespace nndef;
namespace game
{
namespace logic
{
namespace clientlogic
{
void TestBegin(long uid, const vector<char> &vecMsgData, GameRoot *root)
{
__TRY__
DLOG_TRACE("roomkey:" << root->cfg->getRoomKey()<<", "<<"TestBegin" << ", uid: " << uid << ", roomid:" << root->roomid());
using namespace context;
using namespace process;
using namespace message;
using namespace gamelogic;
using namespace config;
//不是初始状态
if (root->pro->getProcess() != nil_nnstate)
{
DLOG_TRACE("roomkey:" << root->cfg->getRoomKey()<<", "<<"process is not nil_nnstate, uid: " << uid << ", process: " << root->pro->getProcess());
return;
}
//带入的货币通知
XGameDZProto::NN_msg2sTestBegin nncm;
std::map<cid_t, User> const &usermap = root->con->getUserMap();
for (auto it = usermap.begin(); it != usermap.end(); it++)
{
(*nncm.mutable_mdzwealth())[it->first] = it->second.getDZWealth();
}
//开始通知
sendAllClientMessage<XGameDZProto::NN_msg2sTestBegin>(XGameDZProto::NN_msg2cTestBegin_E, nncm, root);
//检查游戏开始
//玩家离开状态不用检查游戏开始
User *user = root->con->getUserByUid(uid);
if (user != NULL && !user->isLeft())
{
CheckBegin(root);
}
__CATCH__
}
}
}
}