This commit is contained in:
aozhiwei 2020-05-29 12:56:05 +08:00
parent 3b1a8bc94d
commit 572f39d848
4 changed files with 8 additions and 13 deletions

View File

@ -59,10 +59,6 @@ void Room::Init()
void Room::UnInit()
{
App::Instance()->perf.alive_count -= alive_count_;
if (game_over_timer) {
a8::Timer::Instance()->DeleteTimer(game_over_timer);
game_over_timer = nullptr;
}
xtimer_attacher_.ClearTimerList();
for (auto& pair : accountid_hash_) {
PlayerMgr::Instance()->RemovePlayerBySocket(pair.second->socket_handle);

View File

@ -1,7 +1,6 @@
#pragma once
#include <a8/xtimer.h>
#include <a8/timer_attacher.h>
#include "frameevent.h"
#include "framemaker.h"
@ -23,7 +22,6 @@ namespace metatable
class DropObjJson;
}
struct timer_list;
struct xtimer_list;
class Entity;
class RoomEntity;
@ -34,7 +32,6 @@ class Bullet;
class Human;
class Player;
class Building;
class Hero;
class AabbCollider;
class Android;
class Room
@ -50,7 +47,6 @@ public:
bool game_over = false;
long long game_over_frameno = 0;
long long game_over_tick = 0;
timer_list* game_over_timer = nullptr;
a8::XTimer xtimer;
GridService* grid_service = nullptr;
MapService* map_service = nullptr;
@ -64,6 +60,7 @@ public:
std::vector<MetaData::MapTplThing*>* loots = nullptr;
std::vector<Building*>* buildings = nullptr;
Human* first_newbie = nullptr;
a8::XTimerAttacher timer_attacher;
~Room();
void Init();

View File

@ -176,10 +176,12 @@ void RoomMgr::AddOverRoom(long long room_uuid)
Room* room = GetRoomByUuid(room_uuid);
if (room) {
room->game_over_tick = a8::XGetTickCount();
room->game_over_timer = a8::Timer::Instance()->AddRepeatTimer(500,
a8::XParams()
.SetSender(room_uuid),
callback);
a8::Timer::Instance()->AddRepeatTimerAndAttach
(500,
a8::XParams()
.SetSender(room_uuid),
callback,
&room->timer_attacher.timer_list_);
}
}

@ -1 +1 @@
Subproject commit 51e182024207ec893cd0ed1b8f8d971341afb4a9
Subproject commit 8ab07d896fab50c552a60220fa2508967f76a69b