@leancloud/stateful-game
Options
All
Public
Public/Protected
All
Inherited
Externals
Only exported
Menu
Redux
Game
Stateful
Game
Stateful
Game
Base
XState
Game
get
State
Type
d
define
Game
define
Redux
Game
defineXState
Game
Index
Classes
Redux
Game
Stateful
Game
Stateful
Game
Base
XState
Game
Type aliases
get
State
Type
Variables
d
Functions
define
Game
define
Redux
Game
defineXState
Game
Type aliases
get
State
Type
get
State
Type<Context, Schema, Event, EP>
:
Pick
<
StateMachine
<
Context
,
Schema
,
GameEventType
<
EP
>
>
[
"initialState"
]
,
"value"
|
"context"
>
Type parameters
Context
Schema
:
StateSchema
Event
:
string
|
number
EP
:
EventPayloads
<
Event
>
Variables
d
d
:
Debug
&
{
debug
:
Debug
;
default
:
Debug
}
Functions
Const
define
Game
define
Game<State, Event, EP>
(
__namedParameters
:
{
events
:
undefined
|
EventHandlers
<
State
,
Event
,
EP
>
;
filter
:
undefined
|
(
(
state
:
State
, player
:
Player
)
=>
State
)
;
initialState
:
State
}
)
:
{}
Type parameters
State
:
{}
Event
:
string
|
number
EP
:
EventPayloads
<
Event
>
Parameters
__namedParameters:
{
events
:
undefined
|
EventHandlers
<
State
,
Event
,
EP
>
;
filter
:
undefined
|
(
(
state
:
State
, player
:
Player
)
=>
State
)
;
initialState
:
State
}
events
:
undefined
|
EventHandlers
<
State
,
Event
,
EP
>
事件处理方法
filter
:
undefined
|
(
(
state
:
State
, player
:
Player
)
=>
State
)
滤镜(玩家在客户端能看到状态与游戏状态的映射关系)
initial
State
:
State
游戏初始状态
Returns
{}
Const
define
Redux
Game
define
Redux
Game<State, Action, Event, EP>
(
__namedParameters
:
{
events
:
undefined
|
ReduxEventHandlers
<
State
,
Event
,
EP
,
Action
>
;
filter
:
undefined
|
(
(
state
:
State
, player
:
Player
)
=>
State
)
;
reducer
:
Reducer
<
State
,
Action
>
}
)
:
{}
Type parameters
State
:
{}
Action
:
ReduxAction
Event
:
string
|
number
EP
:
EventPayloads
<
Event
>
Parameters
__namedParameters:
{
events
:
undefined
|
ReduxEventHandlers
<
State
,
Event
,
EP
,
Action
>
;
filter
:
undefined
|
(
(
state
:
State
, player
:
Player
)
=>
State
)
;
reducer
:
Reducer
<
State
,
Action
>
}
events
:
undefined
|
ReduxEventHandlers
<
State
,
Event
,
EP
,
Action
>
事件处理方法
filter
:
undefined
|
(
(
state
:
State
, player
:
Player
)
=>
State
)
滤镜(玩家在客户端能看到状态与游戏状态的映射关系)
reducer
:
Reducer
<
State
,
Action
>
游戏状态转移规则
Returns
{}
Const
defineXState
Game
defineXState
Game<Context, Schema, Event, EP>
(
__namedParameters
:
{
filter
:
undefined
|
(
(
state
:
getStateType
<
Context
,
Schema
,
Event
,
EP
>
, player
:
Player
)
=>
getStateType
<
Context
,
Schema
,
Event
,
EP
>
)
;
machine
:
StateMachine
<
Context
,
Schema
,
GameEventType
<
EP
>
,
{
context
:
TContext
;
value
:
any
}
>
}
)
:
{
constructor
:
any
}
Type parameters
Context
Schema
:
StateSchema
Event
:
string
|
number
EP
:
EventPayloads
<
Event
>
Parameters
__namedParameters:
{
filter
:
undefined
|
(
(
state
:
getStateType
<
Context
,
Schema
,
Event
,
EP
>
, player
:
Player
)
=>
getStateType
<
Context
,
Schema
,
Event
,
EP
>
)
;
machine
:
StateMachine
<
Context
,
Schema
,
GameEventType
<
EP
>
,
{
context
:
TContext
;
value
:
any
}
>
}
filter
:
undefined
|
(
(
state
:
getStateType
<
Context
,
Schema
,
Event
,
EP
>
, player
:
Player
)
=>
getStateType
<
Context
,
Schema
,
Event
,
EP
>
)
滤镜(玩家在客户端能看到状态与游戏状态的映射关系)
machine
:
StateMachine
<
Context
,
Schema
,
GameEventType
<
EP
>
,
{
context
:
TContext
;
value
:
any
}
>
Returns
{
constructor
:
any
}
constructor
:
function
new __type
(
room
:
Room
, masterClient
:
Client
)
:
XStateGame
<
Context
,
Schema
,
Event
,
EP
>
Parameters
room:
Room
masterClient:
Client
Returns
XStateGame
<
Context
,
Schema
,
Event
,
EP
>
Generated using
TypeDoc
事件处理方法