Skip to content

Commit

Permalink
docs: 优化 README.md 可读性
Browse files Browse the repository at this point in the history
  • Loading branch information
kercylan98 committed Jan 15, 2024
1 parent 1645ae4 commit 22449ff
Show file tree
Hide file tree
Showing 47 changed files with 3,220 additions and 47 deletions.
45 changes: 45 additions & 0 deletions game/activity/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -201,31 +201,61 @@ type Controller[Type generic.Basic, ID generic.Basic, Data any, EntityID generic
mutex sync.RWMutex
}
```
<span id="struct_Controller_GetGlobalData"></span>

#### func (*Controller) GetGlobalData(activityId ID) Data
> 获取特定活动全局数据
***
<span id="struct_Controller_GetEntityData"></span>

#### func (*Controller) GetEntityData(activityId ID, entityId EntityID) EntityData
> 获取特定活动实体数据
***
<span id="struct_Controller_IsOpen"></span>

#### func (*Controller) IsOpen(activityId ID) bool
> 活动是否开启
***
<span id="struct_Controller_IsShow"></span>

#### func (*Controller) IsShow(activityId ID) bool
> 活动是否展示
***
<span id="struct_Controller_IsOpenOrShow"></span>

#### func (*Controller) IsOpenOrShow(activityId ID) bool
> 活动是否开启或展示
***
<span id="struct_Controller_Refresh"></span>

#### func (*Controller) Refresh(activityId ID)
> 刷新活动
***
<span id="struct_Controller_InitializeNoneData"></span>

#### func (*Controller) InitializeNoneData(handler func (activityId ID, data *DataMeta[Data])) NoneDataActivityController[Type, ID, Data, EntityID, EntityData]

***
<span id="struct_Controller_InitializeGlobalData"></span>

#### func (*Controller) InitializeGlobalData(handler func (activityId ID, data *DataMeta[Data])) GlobalDataActivityController[Type, ID, Data, EntityID, EntityData]

***
<span id="struct_Controller_InitializeEntityData"></span>

#### func (*Controller) InitializeEntityData(handler func (activityId ID, entityId EntityID, data *EntityDataMeta[EntityData])) EntityDataActivityController[Type, ID, Data, EntityID, EntityData]

***
<span id="struct_Controller_InitializeGlobalAndEntityData"></span>

#### func (*Controller) InitializeGlobalAndEntityData(handler func (activityId ID, data *DataMeta[Data]), entityHandler func (activityId ID, entityId EntityID, data *EntityDataMeta[EntityData])) GlobalAndEntityDataActivityController[Type, ID, Data, EntityID, EntityData]

***
<span id="struct_BasicActivityController"></span>
### BasicActivityController `INTERFACE`
Expand Down Expand Up @@ -313,19 +343,34 @@ type Options struct {
Loop time.Duration
}
```
<span id="struct_Options_WithUpcomingTime"></span>

#### func (*Options) WithUpcomingTime(t time.Time) *Options
> 设置活动预告时间
***
<span id="struct_Options_WithStartTime"></span>

#### func (*Options) WithStartTime(t time.Time) *Options
> 设置活动开始时间
***
<span id="struct_Options_WithEndTime"></span>

#### func (*Options) WithEndTime(t time.Time) *Options
> 设置活动结束时间
***
<span id="struct_Options_WithExtendedShowTime"></span>

#### func (*Options) WithExtendedShowTime(t time.Time) *Options
> 设置延长展示时间
***
<span id="struct_Options_WithLoop"></span>

#### func (*Options) WithLoop(interval time.Duration) *Options
> 设置活动循环,时间间隔小于等于 0 表示不循环
> - 当活动状态展示结束后,会根据该选项设置的时间间隔重新开始
***
39 changes: 39 additions & 0 deletions game/fight/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,18 +65,30 @@ type TurnBased[CampID comparable, EntityID comparable, Camp generic.IdR[CampID],
closed bool
}
```
<span id="struct_TurnBased_Close"></span>

#### func (*TurnBased) Close()
> 关闭回合制
***
<span id="struct_TurnBased_AddCamp"></span>

#### func (*TurnBased) AddCamp(camp Camp, entity Entity, entities ...Entity)
> 添加阵营
***
<span id="struct_TurnBased_SetActionTimeout"></span>

#### func (*TurnBased) SetActionTimeout(actionTimeoutHandler func ( Camp, Entity) time.Duration)
> 设置行动超时时间处理函数
> - 默认情况下行动超时时间函数将始终返回 0
***
<span id="struct_TurnBased_Run"></span>

#### func (*TurnBased) Run()
> 运行
<details>
<summary>查看 / 收起单元测试</summary>

Expand Down Expand Up @@ -154,33 +166,60 @@ type TurnBasedController[CampID comparable, EntityID comparable, Camp generic.Id
tb *TurnBased[CampID, EntityID, Camp, Entity]
}
```
<span id="struct_TurnBasedController_GetRound"></span>

#### func (*TurnBasedController) GetRound() int
> 获取当前回合数
***
<span id="struct_TurnBasedController_GetCamp"></span>

#### func (*TurnBasedController) GetCamp() Camp
> 获取当前操作阵营
***
<span id="struct_TurnBasedController_GetEntity"></span>

#### func (*TurnBasedController) GetEntity() Entity
> 获取当前操作实体
***
<span id="struct_TurnBasedController_GetActionTimeoutDuration"></span>

#### func (*TurnBasedController) GetActionTimeoutDuration() time.Duration
> 获取当前行动超时时长
***
<span id="struct_TurnBasedController_GetActionStartTime"></span>

#### func (*TurnBasedController) GetActionStartTime() time.Time
> 获取当前行动开始时间
***
<span id="struct_TurnBasedController_GetActionEndTime"></span>

#### func (*TurnBasedController) GetActionEndTime() time.Time
> 获取当前行动结束时间
***
<span id="struct_TurnBasedController_Finish"></span>

#### func (*TurnBasedController) Finish()
> 结束当前操作,将立即切换到下一个操作实体
***
<span id="struct_TurnBasedController_Stop"></span>

#### func (*TurnBasedController) Stop()
> 在当前回合执行完毕后停止回合进程
***
<span id="struct_TurnBasedController_Refresh"></span>

#### func (*TurnBasedController) Refresh(duration time.Duration) time.Time
> 刷新当前操作实体的行动超时时间
> - 当不在行动阶段时,将返回 time.Time 零值
***
<span id="struct_TurnBasedEntitySwitchEventHandler"></span>
### TurnBasedEntitySwitchEventHandler `STRUCT`
Expand Down
Loading

0 comments on commit 22449ff

Please sign in to comment.