Beispiel #1
0
func Game(this *GameController) (object *game.Object, err error) {
	objectId := this.GetSession("GameObjectId")

	if objectId != nil {
		object, err := game.Get(objectId.(string))

		if err == nil {
			return object, nil
		} else {
			return nil, err
		}
	} else {
		return nil, errors.New("No game")
	}
}
Beispiel #2
0
func Game(this *GameController) (object *game.Object, err error) {
	cookie, err := this.Ctx.Request.Cookie("GameObjectId")

	if err == nil && cookie.Value != "" {
		objectId, _ := url.QueryUnescape(cookie.Value)
		object, err := game.Get(objectId)

		if err == nil {
			return object, nil
		} else {
			return nil, err
		}
	} else {
		return nil, errors.New("No game")
	}
}