Documentation
¶
Index ¶
- type ActionMessage
- func (a ActionMessage) ToAttackMessage() (success bool, message AttackAction)
- func (a ActionMessage) ToBurnCardMessage() (success bool, message BurnCardAction)
- func (a ActionMessage) ToConcedeMessage() (success bool, message ConcedeAction)
- func (a ActionMessage) ToReRollMessage() (success bool, message ReRollAction)
- func (a ActionMessage) ToSkipRoundMessage() (success bool, message SkipRoundAction)
- func (a ActionMessage) ToSwitchMessage() (success bool, message SwitchAction)
- func (a ActionMessage) ToUesCardMessage() (success bool, message UseCardAction)
- type ActionMessageInterface
- type AttackAction
- type Base
- type BurnCardAction
- type Character
- type ConcedeAction
- type CooperativeSkill
- type DictionaryPair
- type Equipment
- type Event
- type Game
- type GameOptions
- type GuestMessage
- type InitializeMessage
- type MatchingMessage
- type Modifier
- type Other
- type PlayerMessage
- type ReRollAction
- type Self
- type SkipRoundAction
- type Summon
- type Support
- type SwitchAction
- type SyncMessage
- type SyncMessageInterface
- type UseCardAction
- type ViewerMessage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActionMessage ¶
type ActionMessage struct { Type enum.ActionType `json:"type" yaml:"type" xml:"type"` // Type 玩家的操作类型 Sender uint64 `json:"sender" yaml:"sender" xml:"sender"` // Sender 发送操作的玩家 Args interface{} `json:"args" yaml:"args" xml:"args"` // Args 玩家的操作信息 }
ActionMessage 玩家的操作信息
func (ActionMessage) ToAttackMessage ¶
func (a ActionMessage) ToAttackMessage() (success bool, message AttackAction)
ToAttackMessage 将ActionMessage转换为AttackAction
func (ActionMessage) ToBurnCardMessage ¶
func (a ActionMessage) ToBurnCardMessage() (success bool, message BurnCardAction)
ToBurnCardMessage 将ActionMessage转换为BurnCardAction
func (ActionMessage) ToConcedeMessage ¶
func (a ActionMessage) ToConcedeMessage() (success bool, message ConcedeAction)
ToConcedeMessage 将ActionMessage转换为ConcedeAction
func (ActionMessage) ToReRollMessage ¶
func (a ActionMessage) ToReRollMessage() (success bool, message ReRollAction)
ToReRollMessage 将ActionMessage转换为ReRollAction
func (ActionMessage) ToSkipRoundMessage ¶
func (a ActionMessage) ToSkipRoundMessage() (success bool, message SkipRoundAction)
ToSkipRoundMessage 将ActionMessage转换为SkipRoundAction
func (ActionMessage) ToSwitchMessage ¶
func (a ActionMessage) ToSwitchMessage() (success bool, message SwitchAction)
ToSwitchMessage 将ActionMessage转换为SwitchAction
func (ActionMessage) ToUesCardMessage ¶
func (a ActionMessage) ToUesCardMessage() (success bool, message UseCardAction)
ToUesCardMessage 将ActionMessage转换为UseCardAction
type ActionMessageInterface ¶
type ActionMessageInterface interface { AttackAction | BurnCardAction | UseCardAction | ReRollAction | SkipRoundAction | SwitchAction | ConcedeAction }
ActionMessageInterface 玩家操作信息的约束接口
type AttackAction ¶
type AttackAction struct { Sender uint64 `json:"sender" yaml:"sender" xml:"sender"` // Sender 发起操作的玩家 Target uint64 `json:"target" yaml:"target" xml:"target"` // Target 被攻击的玩家 Skill uint64 `json:"skill" yaml:"skill" xml:"skill"` // Skill 执行攻击的技能 Paid map[enum.ElementType]uint `json:"paid" yaml:"paid" xml:"paid"` // Paid 支付发起攻击的费用 }
AttackAction 玩家的攻击操作信息
type Base ¶
type Base struct { UID uint64 `json:"uid" yaml:"uid" xml:"uid"` // UID 玩家的UID Characters []Character `json:"characters" yaml:"characters" xml:"characters"` // Characters 玩家的持有角色 CampEffect []Modifier `json:"camp_effect" yaml:"camp_effect" xml:"camp_effect"` // CampEffect 玩家的阵营效果 Cooperatives []CooperativeSkill `json:"cooperatives" yaml:"cooperatives" xml:"cooperatives"` // Cooperatives 玩家可进行的协同攻击 Summons []Summon `json:"summons" yaml:"summons" xml:"summons"` // Summons 玩家持有的召唤物 Supports []Support `json:"supports" yaml:"supports" xml:"supports"` // Supports 玩家持有的支援效果 Events []Event `json:"events" yaml:"events" xml:"events"` // Events 玩家身上的事件 RemainCards uint `json:"remain_cards" yaml:"remain_cards" xml:"remain_cards"` // RemainCards 玩家牌堆剩余的数量 LegalActions []enum.ActionType `json:"legal_actions" yaml:"legal_actions" xml:"legal_actions"` // LegalActions 当前的合法操作 Status enum.PlayerStatus `json:"status" yaml:"status" xml:"status"` // Status 玩家的状态信息 }
Base 基础玩家信息
type BurnCardAction ¶
type BurnCardAction struct { Sender uint64 `json:"sender" yaml:"sender" xml:"sender"` // Sender 发起操作的玩家 Card uint64 `json:"card" yaml:"card" xml:"card"` // Card 被操作的卡牌 Paid enum.ElementType `json:"paid" yaml:"paid" xml:"paid"` // Paid 支付元素转换的费用 }
BurnCardAction 玩家的元素转换操作信息
type Character ¶
type Character struct { ID uint64 `json:"id" yaml:"id" xml:"id"` // ID 角色的实体ID MP uint `json:"mp" yaml:"mp" xml:"mp"` // MP 角色的当前充能 HP uint `json:"hp" yaml:"hp" xml:"hp"` // HP 角色的当前生命 Equipments []Equipment `json:"equipments" yaml:"equipments" xml:"equipments"` // Equipment 角色当前的装备 Modifiers []Modifier `json:"modifiers" yaml:"modifiers" xml:"modifiers"` // Modifiers 角色当前的修正BUFF Status enum.CharacterStatus `json:"status" yaml:"status" xml:"status"` // Status 角色当前的状态 }
Character 角色信息
type ConcedeAction ¶
type ConcedeAction struct {
Sender uint64 `json:"sender" yaml:"sender" xml:"sender"` // Sender 发起操作的玩家
}
ConcedeAction 玩家的弃权操作信息
type CooperativeSkill ¶
type CooperativeSkill struct { ID uint64 `json:"id" yaml:"id" xml:"id"` // ID 协同攻击的实体ID Trigger enum.TriggerType `json:"trigger" yaml:"trigger" xml:"trigger"` // Trigger 协同攻击的触发条件 }
CooperativeSkill 协同攻击
type DictionaryPair ¶
type DictionaryPair struct { TypeID uint64 `json:"type_id" yaml:"type_id" xml:"type_id"` // TypeID 类型的ID EntityID uint64 `json:"entity_id" yaml:"entity_id" xml:"entity_id"` // EntityID 实体的ID }
DictionaryPair 追加字典,将同步信息中给的实体ID与它们的类型ID相联系
type Equipment ¶
type Equipment struct { ID uint64 `json:"id" yaml:"id" xml:"id"` // ID 装备的实体ID Type enum.EquipmentType `json:"type" yaml:"type" xml:"type"` // Type 装备的类型 }
Equipment 装备信息
type Event ¶
type Event struct { ID uint64 `json:"id" yaml:"id" xml:"id"` // ID 事件的实体ID Trigger enum.TriggerType `json:"trigger" yaml:"trigger" xml:"trigger"` // Trigger 事件的触发条件 }
Event 事件信息
type Game ¶
type Game struct { ActingPlayer uint64 `json:"acting_player" yaml:"acting_player" xml:"acting_player"` // ActingPlayer 当前正在操作的玩家 RoundStage enum.RoundStage `json:"round_stage" yaml:"round_stage" xml:"round_stage"` // RoundStage 当前的回合阶段 RoundCount uint `json:"round_count" yaml:"round_count" xml:"round_count"` // RoundCount 当前的回合数 }
Game 对局的信息
type GameOptions ¶
type GuestMessage ¶
type GuestMessage struct { Players []Other `json:"players" yaml:"players" xml:"players"` // Players 在场玩家的信息 Append []DictionaryPair `json:"append" yaml:"append" xml:"append"` // Append 追加的字典 }
GuestMessage 游客接收道德同步信息
type InitializeMessage ¶
type InitializeMessage struct { Players []MatchingMessage Options GameOptions }
type MatchingMessage ¶
type Modifier ¶
type Modifier struct { ID uint64 `json:"id" yaml:"id" xml:"id"` // ID 修正BUFF的实体ID Type enum.ModifierType `json:"type" yaml:"type" xml:"type"` // Type 修正BUFF的类型 }
Modifier 修正BUFF
type Other ¶
type Other struct { Base Cost uint `json:"cost" yaml:"cost" xml:"cost"` // Cost 玩家持有的元素骰子数量 Cards uint `json:"cards" yaml:"cards" xml:"cards"` // Cards 玩家持有的卡牌数量 }
Other 接收玩家所见的其他玩家信息
type PlayerMessage ¶
type PlayerMessage struct { Self Self `json:"self" yaml:"self" xml:"self"` // Self 自己的信息 Others []Other `json:"others" yaml:"others" xml:"others"` // Others 其他人的信息 Append []DictionaryPair `json:"append" yaml:"append" xml:"append"` // Append 追加的字典 }
PlayerMessage 参与玩家接收到的同步信息
type ReRollAction ¶
type ReRollAction struct { Sender uint64 `json:"sender" yaml:"sender" xml:"sender"` // Sender 发起操作的玩家 Dropped map[enum.ElementType]uint `json:"dropped" yaml:"dropped" xml:"dropped"` // Dropped 被舍弃的元素骰子 }
ReRollAction 玩家的重掷元素骰子操作信息
type Self ¶
type Self struct { Base Cost map[enum.ElementType]uint `json:"cost" yaml:"cost" xml:"cost"` // Cost 玩家持有的元素骰子 Cards []uint64 `json:"cards" yaml:"cards" xml:"cards"` // Cards 玩家持有的卡牌 }
Self 接收玩家自己的信息
type SkipRoundAction ¶
type SkipRoundAction struct {
Sender uint64 `json:"sender" yaml:"sender" xml:"sender"` // Sender 发起操作的玩家
}
SkipRoundAction 玩家的跳过回合操作信息
type Summon ¶
type Summon struct { ID uint64 `json:"id" yaml:"id" xml:"id"` // ID 召唤物的ID Remain uint `json:"remain" yaml:"remain" xml:"remain"` // Remain 召唤物剩余可生效次数 }
Summon 召唤物信息
type Support ¶
type Support struct { ID uint64 `json:"id" yaml:"id" xml:"id"` // ID 支援物的ID Remain uint `json:"remain" yaml:"remain" xml:"remain"` // Remain 支援物的剩余可生效次数 }
Support 支援物信息
type SwitchAction ¶
type SwitchAction struct { Sender uint64 `json:"sender" yaml:"sender" xml:"sender"` // Sender 发起操作的玩家 Target uint64 `json:"target" yaml:"target" xml:"target"` // Target 切换到的目标角色 Paid map[enum.ElementType]uint `json:"paid" yaml:"paid" xml:"paid"` // Paid 玩家切换角色支付的费用 }
SwitchAction 玩家的切换前台角色操作信息
type SyncMessage ¶
type SyncMessage struct { Game Game `json:"game" yaml:"game" xml:"game"` // Game 对局信息 Target uint64 `json:"target" yaml:"target" xml:"target"` // Target 接收同步消息的玩家 Message interface{} `json:"message" yaml:"message" xml:"message"` // Message 同步消息 }
SyncMessage 玩家接收到的同步消息
func NewSyncMessage ¶
func NewSyncMessage[message SyncMessageInterface](target uint64, msg message, game Game) SyncMessage
NewSyncMessage 创建一个指定接收者的同步信息
type SyncMessageInterface ¶
type SyncMessageInterface interface { PlayerMessage | ViewerMessage | GuestMessage }
SyncMessageInterface 同步信息类型的约束接口
type UseCardAction ¶
type UseCardAction struct { Sender uint64 `json:"sender" yaml:"sender" xml:"sender"` // Sender 发起操作的玩家 Card uint64 `json:"card" yaml:"card" xml:"card"` // Card 玩家打出的卡牌 Paid map[enum.ElementType]uint `json:"paid" yaml:"paid" xml:"paid"` // Paid 玩家打出卡牌支付的费用 }
UseCardAction 玩家的使用卡牌操作信息
type ViewerMessage ¶
type ViewerMessage struct { Players []Self `json:"players" yaml:"players" xml:"players"` // Players 在场玩家的信息 Append []DictionaryPair `json:"append" yaml:"append" xml:"append"` // Append 追加的字典 }
ViewerMessage 观战玩家接收到的同步信息