From b7d4efb7a6a208187e3fa2c187873d41ae1e7c85 Mon Sep 17 00:00:00 2001 From: sk <123456@qq.com> Date: Fri, 30 Aug 2024 18:52:11 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- {worldsrv => common}/clock.go | 47 ++++++------ gamesrv/action/action_server.go | 32 ++++----- gamesrv/base/scene_mgr.go | 99 +++++--------------------- gamesrv/base/scene_policy.go | 7 -- gamesrv/tienlen/scenepolicy_tienlen.go | 10 ++- worldsrv/awardlogmgr.go | 4 +- worldsrv/cachedata.go | 7 +- worldsrv/permitmgr.go | 6 +- worldsrv/platformmgr.go | 6 +- worldsrv/player.go | 4 +- worldsrv/playermgr.go | 6 +- worldsrv/playernotify.go | 6 +- worldsrv/qmflowmgr.go | 7 +- worldsrv/rankmatch.go | 7 +- worldsrv/scenemgr.go | 8 +-- worldsrv/tournament.go | 4 +- worldsrv/transact_daytimechange.go | 12 ++-- worldsrv/welfmgr.go | 6 +- 18 files changed, 108 insertions(+), 170 deletions(-) rename {worldsrv => common}/clock.go (77%) diff --git a/worldsrv/clock.go b/common/clock.go similarity index 77% rename from worldsrv/clock.go rename to common/clock.go index 63b3ea6..fc00b79 100644 --- a/worldsrv/clock.go +++ b/common/clock.go @@ -1,27 +1,26 @@ -package main +package common import ( "time" - "mongo.games.com/game/common" "mongo.games.com/goserver/core/module" ) -var ClockMgrSington = &ClockMgr{ +var ClockMgrSingleton = &ClockMgr{ LastHour: -1, LastDay: -1, Notifying: false, } const ( - CLOCK_EVENT_SECOND int = iota - CLOCK_EVENT_MINUTE - CLOCK_EVENT_HOUR - CLOCK_EVENT_DAY - CLOCK_EVENT_WEEK - CLOCK_EVENT_MONTH - CLOCK_EVENT_SHUTDOWN - CLOCK_EVENT_MAX + ClockEventSecond int = iota + ClockEventMinute + ClockEventHour + ClockEventDay + ClockEventWeek + ClockEventMonth + ClockEventShutdown + ClockEventMax ) type ClockSinker interface { @@ -38,7 +37,7 @@ type ClockSinker interface { type BaseClockSinker struct { } -func (s *BaseClockSinker) InterestClockEvent() int { return (1 << CLOCK_EVENT_MAX) - 1 } +func (s *BaseClockSinker) InterestClockEvent() int { return (1 << ClockEventMax) - 1 } func (s *BaseClockSinker) OnSecTimer() {} func (s *BaseClockSinker) OnMiniTimer() {} func (s *BaseClockSinker) OnHourTimer() {} @@ -48,7 +47,7 @@ func (s *BaseClockSinker) OnMonthTimer() {} func (s *BaseClockSinker) OnShutdown() {} type ClockMgr struct { - sinkers [CLOCK_EVENT_MAX][]ClockSinker + sinkers [ClockEventMax][]ClockSinker LastTickTime time.Time LastMonth time.Month LastWeek int @@ -60,9 +59,9 @@ type ClockMgr struct { LastFiveMin int } -func (this *ClockMgr) RegisteSinker(sinker ClockSinker) { +func (this *ClockMgr) RegisterSinker(sinker ClockSinker) { interest := sinker.InterestClockEvent() - for i := 0; i < CLOCK_EVENT_MAX; i++ { + for i := 0; i < ClockEventMax; i++ { if (1<