當前位置: 首頁>>代碼示例>>Golang>>正文


Golang sitef.Record類代碼示例

本文整理匯總了Golang中github.com/beoran/woe/sitef.Record的典型用法代碼示例。如果您正苦於以下問題:Golang Record類的具體用法?Golang Record怎麽用?Golang Record使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Record類的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: SaveSitef

// Save a being to a sitef record.
func (me *Being) SaveSitef(rec *sitef.Record) (err error) {
	me.Entity.SaveSitef(rec)
	rec.PutInt("level", me.Level)

	if me.Gender != nil {
		rec.Put("gender", me.Gender.ID)
	}

	if me.Job != nil {
		rec.Put("job", me.Job.ID)
	}

	if me.Kin != nil {
		rec.Put("kin", me.Kin.ID)
	}

	me.Talents.SaveSitef(rec)
	me.Vitals.SaveSitef(rec)
	me.EquipmentValues.SaveSitef(rec)
	me.Aptitudes.SaveSitef(rec)
	me.Inventory.SaveSitef(rec)

	if me.Room != nil {
		rec.Put("room", me.Room.ID)
	}

	return nil
}
開發者ID:beoran,項目名稱:woe,代碼行數:29,代碼來源:being.go

示例2: LoadSitef

// Load a being from a sitef record.
func (me *Being) LoadSitef(rec sitef.Record) (err error) {
	me.Entity.LoadSitef(rec)

	me.Level = rec.GetIntDefault("level", 1)

	me.Gender = EntitylikeToGender(GenderEntityList.FindID(rec.Get("gender")))
	me.Job = EntitylikeToJob(JobEntityList.FindID(rec.Get("job")))
	me.Kin = EntitylikeToKin(KinEntityList.FindID(rec.Get("kin")))

	me.Talents.LoadSitef(rec)
	me.Vitals.LoadSitef(rec)
	me.EquipmentValues.LoadSitef(rec)
	me.Aptitudes.LoadSitef(rec)
	me.Inventory.LoadSitef(rec)

	if rec.Get("room") != "" {
		var err error
		me.Room, err = DefaultWorld.LoadRoom(rec.Get("room"))
		if err != nil {
			monolog.WriteError(err)
			return err
		}
	}
	return nil
}
開發者ID:beoran,項目名稱:woe,代碼行數:26,代碼來源:being.go

示例3: SaveSitef

func (me *Equipment) SaveSitef(rec sitef.Record) (err error) {
	for k, v := range me.Equipped {
		if v != nil {
			key := fmt.Sprintf("equipment[%s]", k)
			rec.Put(key, v.ID)
		}
	}
	return nil
}
開發者ID:beoran,項目名稱:woe,代碼行數:9,代碼來源:item.go

示例4: LoadSirec

// Load a character from a sitef record.
func (me *Character) LoadSirec(rec sitef.Record) (err error) {
	aname := rec.Get("accountname")
	account, err := DefaultWorld.LoadAccount(aname)
	if err != nil {
		return err
	}
	me.Account = account
	me.Being.LoadSitef(rec)
	return nil
}
開發者ID:beoran,項目名稱:woe,代碼行數:11,代碼來源:character.go

示例5: LoadSitef

func (me *Equipment) LoadSitef(rec sitef.Record, world *World, dirname string) (err error) {
	for k := range EquipWhereList {
		key := fmt.Sprintf("equipment[%s]", k)
		val, ok := rec.MayGet(key)
		if ok {
			item, err := world.LoadItem(val)
			if item != nil && err == nil {
				me.Equipped[EquipWhere(k)] = item
			}
		}
	}
	return nil
}
開發者ID:beoran,項目名稱:woe,代碼行數:13,代碼來源:item.go

示例6: LoadSitef

// Load an entity from a sitef record.
func (me *Entity) LoadSitef(rec sitef.Record) (err error) {
	me.ID = rec.Get("id")
	me.Name = rec.Get("name")
	me.Short = rec.Get("short")
	me.Long = rec.Get("long")
	return nil
}
開發者ID:beoran,項目名稱:woe,代碼行數:8,代碼來源:entity.go

示例7: SaveSitef

// Save an entity to a sitef record.
func (me *Entity) SaveSitef(rec *sitef.Record) (err error) {
	rec.Put("id", me.ID)
	rec.Put("name", me.Name)
	rec.Put("short", me.Short)
	rec.Put("long", me.Long)
	return nil
}
開發者ID:beoran,項目名稱:woe,代碼行數:8,代碼來源:entity.go

示例8: SaveSirec

// Save a character into a a sitef record.
func (me *Character) SaveSirec(rec *sitef.Record) (err error) {
	rec.Put("accountname", me.Account.Name)
	me.Being.SaveSitef(rec)
	return nil
}
開發者ID:beoran,項目名稱:woe,代碼行數:6,代碼來源:character.go


注:本文中的github.com/beoran/woe/sitef.Record類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。