本文整理匯總了Golang中kmud/database.Character類的典型用法代碼示例。如果您正苦於以下問題:Golang Character類的具體用法?Golang Character怎麽用?Golang Character使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了Character類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: ToString
func (self SayEvent) ToString(receiver *database.Character) string {
who := ""
if receiver.GetId() == self.Character.GetId() {
who = "You say"
} else {
who = self.Character.GetName() + " says"
}
return utils.Colorize(utils.ColorBlue, who+", ") +
utils.Colorize(utils.ColorWhite, "\""+self.Message+"\"")
}
示例2: Register
func Register(character *database.Character) chan Event {
_mutex.Lock()
if _listeners == nil {
_listeners = map[chan Event]*database.Character{}
}
_mutex.Unlock()
listener := make(chan Event, 100)
_mutex.Lock()
_listeners[listener] = character
_mutex.Unlock()
character.SetOnline(true)
queueEvent(LoginEvent{character})
return listener
}
示例3: IsFor
func (self LoginEvent) IsFor(receiver *database.Character) bool {
return receiver.GetId() != self.Character.GetId()
}