Class CountdownModuleBuilder
- Namespace
- HeyBox
- Assembly
- HeyBox.Net.Core.dll
用来构建 CountdownModule 模块的构建器。
public class CountdownModuleBuilder : IModuleBuilder, IEquatable<CountdownModuleBuilder>, IEquatable<IModuleBuilder>
- Inheritance
-
CountdownModuleBuilder
- Implements
- Inherited Members
Constructors
CountdownModuleBuilder()
初始化一个 CountdownModuleBuilder 类的新实例。
public CountdownModuleBuilder()
CountdownModuleBuilder(CountdownMode, DateTimeOffset)
初始化一个 CountdownModuleBuilder 类的新实例。
public CountdownModuleBuilder(CountdownMode mode, DateTimeOffset endTime)
Parameters
mode
CountdownMode倒计时的显示模式。
endTime
DateTimeOffset倒计时结束的时间。
Fields
MaxCountdownTimeSpan
获取倒计时的最大时间间隔。
public static readonly TimeSpan MaxCountdownTimeSpan
Field Value
Properties
EndTime
获取或设置倒计时结束的时间。
public DateTimeOffset EndTime { get; set; }
Property Value
Mode
获取或设置倒计时的显示模式。
public CountdownMode Mode { get; set; }
Property Value
Type
获取此构建器构建的模块的类型。
public ModuleType Type { get; }
Property Value
Methods
Build()
构建当前构建器为一个 CountdownModule 对象。
public CountdownModule Build()
Returns
- CountdownModule
由当前构建器表示的属性构建的 CountdownModule 对象。
Exceptions
- ArgumentOutOfRangeException
EndTime 早于当前时间。
- ArgumentOutOfRangeException
EndTime 与当前时间的时间间隔超过 MaxCountdownTimeSpan。
Equals(CountdownModuleBuilder?)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(CountdownModuleBuilder? countdownModuleBuilder)
Parameters
countdownModuleBuilder
CountdownModuleBuilder
Returns
Equals(object?)
Determines whether the specified object is equal to the current object.
public override bool Equals(object? obj)
Parameters
obj
objectThe object to compare with the current object.
Returns
GetHashCode()
Serves as the default hash function.
public override int GetHashCode()
Returns
- int
A hash code for the current object.
WithEndTime(DateTimeOffset)
设置倒计时结束的时间。
public CountdownModuleBuilder WithEndTime(DateTimeOffset endTime)
Parameters
endTime
DateTimeOffset倒计时结束的时间。
Returns
- CountdownModuleBuilder
当前构建器。
WithEndTime(TimeSpan)
设置倒计时结束的时间。
public CountdownModuleBuilder WithEndTime(TimeSpan interval)
Parameters
interval
TimeSpan倒计时结束的时间与当前时间的时间间隔。
Returns
- CountdownModuleBuilder
当前构建器。
WithMode(CountdownMode)
设置倒计时的显示模式。
public CountdownModuleBuilder WithMode(CountdownMode mode)
Parameters
mode
CountdownMode倒计时的显示模式。
Returns
- CountdownModuleBuilder
当前构建器。
Operators
operator ==(CountdownModuleBuilder?, CountdownModuleBuilder?)
判定两个 CountdownModuleBuilder 是否相等。
public static bool operator ==(CountdownModuleBuilder? left, CountdownModuleBuilder? right)
Parameters
left
CountdownModuleBuilderright
CountdownModuleBuilder
Returns
- bool
如果两个 CountdownModuleBuilder 相等,则为
true
;否则为false
。
operator !=(CountdownModuleBuilder?, CountdownModuleBuilder?)
判定两个 CountdownModuleBuilder 是否不相等。
public static bool operator !=(CountdownModuleBuilder? left, CountdownModuleBuilder? right)
Parameters
left
CountdownModuleBuilderright
CountdownModuleBuilder
Returns
- bool
如果两个 CountdownModuleBuilder 不相等,则为
true
;否则为false
。