Back to godoc.org

Package gamestate

v0.0.0-...-bf68151
Latest Go to latest

The latest major version is .

Published: Jul 13, 2019 | License: Apache-2.0 | Module: github.com/hajimehoshi/rpgsnack-runtime

Index

Variables

var GoToTitle = errors.New("go to title")

type Aborter

type Aborter interface {
	AbortForInterpreter(consts.InterpreterID)
}

type Game

type Game struct {
	// contains filtered or unexported fields
}

func NewGame

func NewGame() *Game

func NewTitleGame

func NewTitleGame(savedGame *Game, onShakeStartGameButton func()) *Game

func (*Game) AbortForInterpreter

func (g *Game) AbortForInterpreter(id consts.InterpreterID)

func (*Game) ActivateHint

func (g *Game) ActivateHint(id int)

func (*Game) AddItem

func (g *Game) AddItem(id int)

func (*Game) ApplyShake

func (g *Game) ApplyShake(geo *ebiten.GeoM)

func (*Game) ApplyTintColor

func (g *Game) ApplyTintColor(c *ebiten.ColorM)

func (*Game) Background

func (g *Game) Background(mapID, roomID int) (string, bool)

func (*Game) CanWindowProceed

func (g *Game) CanWindowProceed(interpreterID consts.InterpreterID) bool

func (*Game) Character

func (g *Game) Character(mapID, roomID, eventID int) *character.Character

func (*Game) ChosenWindowIndex

func (g *Game) ChosenWindowIndex() int

func (*Game) Clear

func (g *Game) Clear()

func (*Game) CloseAllWindows

func (g *Game) CloseAllWindows()

func (*Game) CompleteHint

func (g *Game) CompleteHint(id int)

func (*Game) CurrentEvents

func (g *Game) CurrentEvents() []*data.Event

func (*Game) DecodeMsgpack

func (g *Game) DecodeMsgpack(dec *msgpack.Decoder) error

func (*Game) DrawPictures

func (g *Game) DrawPictures(screen *ebiten.Image, offsetX, offsetY int, priority data.PicturePriorityType)

func (*Game) DrawScreen

func (g *Game) DrawScreen(screenImage *ebiten.Image)

func (*Game) DrawWeather

func (g *Game) DrawWeather(screen *ebiten.Image)

func (*Game) DrawWindows

func (g *Game) DrawWindows(screen *ebiten.Image, offsetX, offsetY, windowOffsetY int)

func (*Game) EncodeMsgpack

func (g *Game) EncodeMsgpack(enc *msgpack.Encoder) error

func (*Game) ExecutableEventAtPlayer

func (g *Game) ExecutableEventAtPlayer() *character.Character

func (*Game) FadeIn

func (g *Game) FadeIn(time int)

func (*Game) FadeOut

func (g *Game) FadeOut(time int)

func (*Game) Foreground

func (g *Game) Foreground(mapID, roomID int) (string, bool)

func (*Game) GenerateInterpreterID

func (g *Game) GenerateInterpreterID() consts.InterpreterID

func (*Game) GetItemValueString

func (g *Game) GetItemValueString(sceneManager *scene.Manager, itemID int) string

func (*Game) GetTableValueString

func (g *Game) GetTableValueString(sceneManager *scene.Manager, tableName string, recordID int, attrName string) string

func (*Game) HasChosenWindowIndex

func (g *Game) HasChosenWindowIndex() bool

func (*Game) HideInventory

func (g *Game) HideInventory()

func (*Game) HideMinigame

func (g *Game) HideMinigame()

func (*Game) InitMinigame

func (g *Game) InitMinigame(id, reqScore, score int)

func (*Game) InsertItemBefore

func (g *Game) InsertItemBefore(targetItemID int, insertItemID int)

func (*Game) InterfaceToTableValue

func (g *Game) InterfaceToTableValue(sceneManager *scene.Manager, v interface{}) interface{}

func (*Game) InventoryVisible

func (g *Game) InventoryVisible() bool

func (*Game) IsAutoSaveEnabled

func (g *Game) IsAutoSaveEnabled() bool

func (*Game) IsChangingTint

func (g *Game) IsChangingTint() bool

func (*Game) IsPlayerControlEnabled

func (g *Game) IsPlayerControlEnabled() bool

func (*Game) IsScreenFadedOut

func (g *Game) IsScreenFadedOut() bool

func (*Game) IsScreenFading

func (g *Game) IsScreenFading() bool

func (*Game) IsShaking

func (g *Game) IsShaking() bool

func (*Game) IsWindowAnimating

func (g *Game) IsWindowAnimating(interpreterID consts.InterpreterID) bool

func (*Game) IsWindowBusy

func (g *Game) IsWindowBusy() bool

func (*Game) Items

func (g *Game) Items() *items.Items

func (*Game) Map

func (g *Game) Map() *Map

TODO: Remove this

func (*Game) MapPassableAt

func (g *Game) MapPassableAt(through bool, x, y int, ignoreCharacters bool) bool

func (*Game) MeetsCondition

func (g *Game) MeetsCondition(cond *data.Condition, eventID int) (bool, error)

func (*Game) Minigame

func (g *Game) Minigame() *Minigame

func (*Game) PauseHint

func (g *Game) PauseHint(id int)

func (*Game) PlayerSpeed

func (g *Game) PlayerSpeed() data.Speed

func (*Game) RandomValue

func (g *Game) RandomValue(min, max int) int

func (*Game) RealChoiceIndex

func (g *Game) RealChoiceIndex(sceneManager *scene.Manager, index int, eventID int, conditions []*data.ChoiceCondition) int

func (*Game) RefreshEvents

func (g *Game) RefreshEvents() error

func (*Game) RemoveItem

func (g *Game) RemoveItem(id int)

func (*Game) RequestRewardedAds

func (g *Game) RequestRewardedAds(requestID int, sceneManager *scene.Manager, forceAds bool) bool

func (*Game) RequestSave

func (g *Game) RequestSave(requestID int, sceneManager *scene.Manager)

RequestSave requests to save the progress to the platform.

func (*Game) RequestSavePermanentMinigame

func (g *Game) RequestSavePermanentMinigame(requestID int, sceneManager *scene.Manager, id, score int, lastActiveAt int64) bool

func (*Game) RequestSavePermanentVariable

func (g *Game) RequestSavePermanentVariable(requestID int, sceneManager *scene.Manager, permanentVariableID, variableID int) bool

func (*Game) SetAutoSaveEnabled

func (g *Game) SetAutoSaveEnabled(enabled bool)

func (*Game) SetBGM

func (g *Game) SetBGM(bgm data.BGM)

func (*Game) SetBackground

func (g *Game) SetBackground(mapID, roomID int, image string)

func (*Game) SetEventItem

func (g *Game) SetEventItem(id int)

func (*Game) SetFadeColor

func (g *Game) SetFadeColor(clr color.Color)

func (*Game) SetForeground

func (g *Game) SetForeground(mapID, roomID int, image string)

func (*Game) SetPlayerControlEnabled

func (g *Game) SetPlayerControlEnabled(enabled bool)

func (*Game) SetPlayerDir

func (g *Game) SetPlayerDir(dir data.Dir)

func (*Game) SetPlayerSpeed

func (g *Game) SetPlayerSpeed(value data.Speed)

func (*Game) SetPrices

func (g *Game) SetPrices(p map[string]string)

func (*Game) SetRandomForTesting

func (g *Game) SetRandomForTesting(r Rand)

func (*Game) SetSelfSwitchValue

func (g *Game) SetSelfSwitchValue(eventID int, id int, value bool)

func (*Game) SetSwitchRefValue

func (g *Game) SetSwitchRefValue(id int, value bool)

func (*Game) SetSwitchValue

func (g *Game) SetSwitchValue(id int, value bool)

func (*Game) SetVariable

func (g *Game) SetVariable(sceneManager *scene.Manager, variableID int, op data.SetVariableOp, valueType data.SetVariableValueType, value interface{}, mapID, roomID, eventID int) error

func (*Game) SetVariableRef

func (g *Game) SetVariableRef(sceneManager *scene.Manager, variableID int, op data.SetVariableOp, valueType data.SetVariableValueType, value interface{}, mapID, roomID, eventID int) error

func (*Game) SetVariableValue

func (g *Game) SetVariableValue(id int, value int64)

func (*Game) SetWeather

func (g *Game) SetWeather(weatherType data.WeatherType)

func (*Game) ShakeStartGameButton

func (g *Game) ShakeStartGameButton()

func (*Game) ShouldShowCredits

func (g *Game) ShouldShowCredits() bool

func (*Game) ShouldShowCreditsCloseButton

func (g *Game) ShouldShowCreditsCloseButton() bool

func (*Game) ShowBalloon

func (g *Game) ShowBalloon(sceneManager *scene.Manager, interpreterID consts.InterpreterID, mapID, roomID, eventID int, contentID data.UUID, balloonType data.BalloonType, messageStyle *data.MessageStyle) bool

func (*Game) ShowChoices

func (g *Game) ShowChoices(sceneManager *scene.Manager, interpreterID consts.InterpreterID, eventID int, choiceIDs []data.UUID, conditions []*data.ChoiceCondition)

func (*Game) ShowCredits

func (g *Game) ShowCredits(shouldShowCreditsCloseButton bool)

func (*Game) ShowInventory

func (g *Game) ShowInventory(group int, wait bool, cancelable bool)

func (*Game) ShowMessage

func (g *Game) ShowMessage(sceneManager *scene.Manager, interpreterID consts.InterpreterID, eventID int, contentID data.UUID, background data.MessageBackground, positionType data.MessagePositionType, textAlign data.TextAlign, messageStyle *data.MessageStyle)

func (*Game) ShowMinigame

func (g *Game) ShowMinigame(lastActiveAt int64)

func (*Game) ShowedCredits

func (g *Game) ShowedCredits()

func (*Game) StartCombineCommands

func (g *Game) StartCombineCommands(combine *data.Combine)

func (*Game) StartItemCommands

func (g *Game) StartItemCommands(itemID int)

func (*Game) StartShaking

func (g *Game) StartShaking(power, speed, count int, dir data.ShakeDirection)

func (*Game) StartTint

func (g *Game) StartTint(red, green, blue, gray float64, time int)

func (*Game) StopShaking

func (g *Game) StopShaking()

func (*Game) SwitchValue

func (g *Game) SwitchValue(id int) int64

func (*Game) TransferPlayerImmediately

func (g *Game) TransferPlayerImmediately(roomID, x, y int, interpreter InterpreterInterface)

func (*Game) Update

func (g *Game) Update(sceneManager *scene.Manager) error

func (*Game) UpdatePictureTouch

func (g *Game) UpdatePictureTouch(offsetY int) bool

UpdatePictureTouch updates the picture touch states and reports whether one of the pictures is touched.

func (*Game) VariableValue

func (g *Game) VariableValue(id int) int64

func (*Game) ZeroTint

func (g *Game) ZeroTint() bool

type Interpreter

type Interpreter struct {
	// contains filtered or unexported fields
}

func NewInterpreter

func NewInterpreter(idGen InterpreterIDGenerator, mapID, roomID, eventID, pageIndex int, commands []*data.Command) *Interpreter

func (*Interpreter) Abort

func (i *Interpreter) Abort(aborter Aborter)

Abort aborts the interpreter. If Abort is called, the interpreter terminates after the current command finishes.

Abort is typically called when transferring the player.

func (*Interpreter) DecodeMsgpack

func (i *Interpreter) DecodeMsgpack(dec *msgpack.Decoder) error

func (*Interpreter) EncodeMsgpack

func (i *Interpreter) EncodeMsgpack(enc *msgpack.Encoder) error

func (*Interpreter) EventID

func (i *Interpreter) EventID() int

func (*Interpreter) ID

func (i *Interpreter) ID() consts.InterpreterID

func (*Interpreter) IsExecuting

func (i *Interpreter) IsExecuting() bool

func (*Interpreter) MapID

func (i *Interpreter) MapID() int

func (*Interpreter) PageIndex

func (i *Interpreter) PageIndex() int

func (*Interpreter) PageRoute

func (i *Interpreter) PageRoute() bool

func (*Interpreter) Parallel

func (i *Interpreter) Parallel() bool

func (*Interpreter) RoomID

func (i *Interpreter) RoomID() int

func (*Interpreter) Route

func (i *Interpreter) Route() bool

func (*Interpreter) Sub

func (i *Interpreter) Sub() InterpreterInterface

func (*Interpreter) Update

func (i *Interpreter) Update(sceneManager *scene.Manager, gameState *Game) error

type InterpreterIDGenerator

type InterpreterIDGenerator interface {
	GenerateInterpreterID() consts.InterpreterID
}

type InterpreterInterface

type InterpreterInterface interface {
	msgpack.CustomEncoder
	msgpack.CustomDecoder

	ID() consts.InterpreterID
	MapID() int
	RoomID() int
	EventID() int
	Sub() InterpreterInterface // TODO: Remove this
	Route() bool
	PageRoute() bool
	PageIndex() int
	Parallel() bool

	Update(sceneManager *scene.Manager, gameState *Game) error
	Abort(Aborter)
	IsExecuting() bool
}

type Map

type Map struct {
	// contains filtered or unexported fields
}

func NewMap

func NewMap() *Map

func NewTitleMap

func NewTitleMap() *Map

func (*Map) Background

func (m *Map) Background(gameState *Game) string

func (*Map) CurrentRoom

func (m *Map) CurrentRoom() *data.Room

func (*Map) DecodeMsgpack

func (m *Map) DecodeMsgpack(dec *msgpack.Decoder) error

func (*Map) DrawCharacters

func (m *Map) DrawCharacters(screen *ebiten.Image, priority data.Priority, offsetX, offsetY int)

func (*Map) EncodeMsgpack

func (m *Map) EncodeMsgpack(enc *msgpack.Encoder) error

func (*Map) FindImage

func (m *Map) FindImage(imageID int) *ebiten.Image

func (*Map) FindImageName

func (m *Map) FindImageName(imageID int) string

func (*Map) FinishPlayerMovingByUserInput

func (m *Map) FinishPlayerMovingByUserInput()

func (*Map) FocusingCharacter

func (m *Map) FocusingCharacter() *character.Character

func (*Map) Foreground

func (m *Map) Foreground(gameState *Game) string

func (*Map) GetPressedPosition

func (m *Map) GetPressedPosition() (int, int)

func (*Map) IsBlockingEventExecuting

func (m *Map) IsBlockingEventExecuting() bool

func (*Map) IsPlayerMovingByUserInput

func (m *Map) IsPlayerMovingByUserInput() bool

func (*Map) Passable

func (m *Map) Passable(through bool, x, y int, ignoreCharacters bool) bool

func (*Map) SetPressedPosition

func (m *Map) SetPressedPosition(x, y int)

func (*Map) StartCombineCommands

func (m *Map) StartCombineCommands(gameState *Game, combine *data.Combine)

func (*Map) StartItemCommands

func (m *Map) StartItemCommands(gameState *Game, itemID int)

func (*Map) TryMovePlayerByUserInput

func (m *Map) TryMovePlayerByUserInput(sceneManager *scene.Manager, gameState *Game, x, y int) bool

func (*Map) TryRunDirectEvent

func (m *Map) TryRunDirectEvent(gameState *Game, x, y int) bool

func (*Map) Update

func (m *Map) Update(sceneManager *scene.Manager, gameState *Game) error

type Minigame

type Minigame struct {
	// contains filtered or unexported fields
}

func (*Minigame) Active

func (m *Minigame) Active() bool

func (*Minigame) AddScore

func (m *Minigame) AddScore(score int)

func (*Minigame) ID

func (m *Minigame) ID() int

func (*Minigame) LastActiveAt

func (m *Minigame) LastActiveAt() int64

func (*Minigame) MarkLastActive

func (m *Minigame) MarkLastActive()

func (*Minigame) ReqScore

func (m *Minigame) ReqScore() int

func (*Minigame) Score

func (m *Minigame) Score() int

func (*Minigame) Success

func (m *Minigame) Success() bool

type Rand

type Rand interface {
	Intn(n int) int
}

type Screen

type Screen struct {
	// contains filtered or unexported fields
}

func (*Screen) ApplyShake

func (s *Screen) ApplyShake(g *ebiten.GeoM)

func (*Screen) ApplyTintColor

func (s *Screen) ApplyTintColor(c *ebiten.ColorM)

func (*Screen) DecodeMsgpack

func (s *Screen) DecodeMsgpack(dec *msgpack.Decoder) error

func (*Screen) Draw

func (s *Screen) Draw(img *ebiten.Image)

func (*Screen) EncodeMsgpack

func (s *Screen) EncodeMsgpack(enc *msgpack.Encoder) error

func (*Screen) Update

func (s *Screen) Update()

func (*Screen) ZeroTint

func (s *Screen) ZeroTint() bool

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier