-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbegintimer.cpp
More file actions
36 lines (31 loc) · 1.14 KB
/
Copy pathbegintimer.cpp
File metadata and controls
36 lines (31 loc) · 1.14 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
#include "common/macros.h"
#include "gameroot.h"
#include "logic/gamelogic/core/begintimer.h"
#include "utils/tarslog.h"
#include "dz.pb.h"
#include "message/sendclientmessage.h"
namespace game
{
namespace logic
{
namespace gamelogic
{
void BeginTimer(E_NN_XTIME xtimekey, int time, std::function<int(TimerParam &)> func, GameRoot *root, bool toclient)
{
__TRY__
Aggr::getInstance()->kill(root->roomid(), xtimekey);
Aggr::getInstance()->addXid(root->roomid(), xtimekey, SetSoTimer<std::tuple<GameRoot *>>(make_tuple(root), func, xtimekey, time, 0));
if (toclient)
{
using namespace message;
//通知客户端
XGameDZProto::NN_msg2sTimerBegin nncm;
nncm.set_itime(time);
nncm.set_ixtkey(xtimekey);
sendAllClientMessage<XGameDZProto::NN_msg2sTimerBegin>(XGameDZProto::NN_msg2sTimerBegin_E, nncm, root);
}
__CATCH__
}
}
}
}