| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- package model
- import (
- "roserver/serverproto"
- )
- type RoleRed struct {
- SaveObject
- redInfo *serverproto.RoleRed
- }
- func newRoleRed(r *Role) *RoleRed {
- mail := &RoleRed{
- SaveObject: SaveObject{
- role: r,
- },
- redInfo: &serverproto.RoleRed{},
- }
- return mail
- }
- func (this *RoleRed) Load(msg interface{}) bool {
- proRole := msg.(*serverproto.Role)
- if proRole.RoleRed != nil {
- this.redInfo.IsUnreadMail = proRole.RoleRed.IsUnreadMail
- }
- return true
- }
- func (this *RoleRed) Save() {
- this.SetDirty(false)
- //util.DebugF("uid=%v RoleRed save...", this.role.GetUUid())
- saveMsg := &serverproto.SSRoleRedSaveReq{
- Red: this.redInfo,
- }
- this.role.SendDb(saveMsg)
- }
- func (this *RoleRed) dataChangNtf() {
- ackMsg := &serverproto.SCRoleRedNtf{
- Red: this.redInfo,
- }
- this.role.ReplayGate(ackMsg, true)
- //util.DebugF("uid=%v dataChangNtf.. msg=%v", this.role.GetUUid(), ackMsg)
- }
- func (this *RoleRed) SetUnRedMail(val bool, notify bool) {
- if this.redInfo.IsUnreadMail != val {
- this.redInfo.IsUnreadMail = val
- this.SetDirty(true)
- if notify {
- this.dataChangNtf()
- }
- }
- }
|