1
This commit is contained in:
parent
dc2670bfb8
commit
98729ea223
@ -7,6 +7,7 @@ import (
|
|||||||
|
|
||||||
type playerMgr struct {
|
type playerMgr struct {
|
||||||
accountIdHash sync.Map
|
accountIdHash sync.Map
|
||||||
|
lock sync.Mutex
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *playerMgr) Init() {
|
func (this *playerMgr) Init() {
|
||||||
@ -23,6 +24,15 @@ func (this *playerMgr) GetPlayerByAccountId(accountId string) common.Player {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *playerMgr) ForceCreatePlayer(string, string) common.Player {
|
func (this *playerMgr) ForceCreatePlayer(accountId string, sessionId string) common.Player {
|
||||||
return nil
|
defer this.lock.Unlock()
|
||||||
|
this.lock.Lock()
|
||||||
|
hum := this.GetPlayerByAccountId(accountId)
|
||||||
|
if hum == nil {
|
||||||
|
p := newPlayer()
|
||||||
|
p.accountId = accountId
|
||||||
|
p.sessionId = sessionId
|
||||||
|
hum = p
|
||||||
|
}
|
||||||
|
return hum
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user