pkg

package
v0.0.0-...-6875e1c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 5, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DifficultyLow    = -1 // 该项难度偏低
	DifficultyNormal = 0  // 该项难度正常
	DifficultyHigh   = 1  // 该项难度偏高
)

Variables

This section is empty.

Functions

func ParseMap

func ParseMap(Map Chart) (parsedMap ParsedChart, irregularInfo IrregularInfo)

ParseMap 拆谱拆谱、输入的谱排序好先

Types

type BestdoriV2BasicNote

type BestdoriV2BasicNote struct {
	Beat_  *float64 `json:"beat,omitempty"`
	Lane_  *float64 `json:"lane,omitempty"`
	Flick  bool     `json:"flick,omitempty"`
	Hidden bool     `json:"hidden,omitempty"`
}

type BestdoriV2Chart

type BestdoriV2Chart []BestdoriV2Note

func (BestdoriV2Chart) Decode

func (formatChart BestdoriV2Chart) Decode() (Chart Chart)

func (*BestdoriV2Chart) Encode

func (formatChart *BestdoriV2Chart) Encode(chart Chart) error

func (BestdoriV2Chart) Len

func (formatChart BestdoriV2Chart) Len() int

func (BestdoriV2Chart) Less

func (formatChart BestdoriV2Chart) Less(i, j int) bool

func (BestdoriV2Chart) MapCheck

func (formatChart BestdoriV2Chart) MapCheck() (result bool, err error)

func (BestdoriV2Chart) Swap

func (formatChart BestdoriV2Chart) Swap(i, j int)

type BestdoriV2Note

type BestdoriV2Note struct {
	BestdoriV2BasicNote
	Type        string                `json:"type"`
	BPM         float64               `json:"bpm,omitempty"`
	Connections []BestdoriV2BasicNote `json:"connections,omitempty"`
	Direction   string                `json:"direction,omitempty"`
	Width       int                   `json:"width,omitempty"`
}

func (BestdoriV2Note) Beat

func (note BestdoriV2Note) Beat() (value float64)

func (BestdoriV2Note) Lane

func (note BestdoriV2Note) Lane() (value float64)

type BpmInfo

type BpmInfo struct {
	BPMLow  float64 `json:"bpm_low"`
	BPMHigh float64 `json:"bpm_high"`
	MainBPM float64 `json:"main_bpm"`
}

type Chart

type Chart []Note

func (Chart) InitParseChart

func (chart Chart) InitParseChart() (ParsedChart ParsedChart)

func (Chart) Len

func (chart Chart) Len() int

func (Chart) Less

func (chart Chart) Less(i, j int) bool

func (Chart) Swap

func (chart Chart) Swap(i, j int)

type DifficultyDescription

type DifficultyDescription int

type Distribution

type Distribution struct {
	Note []int `json:"note"`
	Hit  []int `json:"hit"`
}

type Float64Heap

type Float64Heap []float64

func (*Float64Heap) GetTopRankAverage

func (h *Float64Heap) GetTopRankAverage() (average float64)

GetTopRankAverage 从5%~30%部分

func (Float64Heap) Len

func (h Float64Heap) Len() int

func (Float64Heap) Less

func (h Float64Heap) Less(i, j int) bool

func (*Float64Heap) Pop

func (h *Float64Heap) Pop() interface{}

func (*Float64Heap) Push

func (h *Float64Heap) Push(x interface{})

func (Float64Heap) Swap

func (h Float64Heap) Swap(i, j int)

type HandType

type HandType int
const (
	UnknownHand HandType = iota
	LeftHand
	RightHand
	TryLeftHand
	TryRightHand
)

type InputMap

type InputMap interface {
	MapCheck() (bool, error)
	Decode() Chart
	Encode(chart Chart) error
}

type IrregularInfo

type IrregularInfo struct {
	Irregular     RegularType `json:"irregular"`      // 存在多压/交叉(出张)0 失败 1 标准 2 非标准
	IrregularInfo string      `json:"irregular_info"` // 无法分析的第一个错误情况
}

type MapDifficultyExtend

type MapDifficultyExtend struct {
	MaxSpeed          DifficultyDescription `json:"max_speed"`
	FingerMaxHPS      DifficultyDescription `json:"finger_max_hps"`
	FlickNoteInterval DifficultyDescription `json:"flick_note_interval"`
	NoteFlickInterval DifficultyDescription `json:"note_flick_interval"`
}

MapDifficultyExtend 扩展部分,要求正常谱面,非正常时为nil

func ExtendDifficultyGetter

func ExtendDifficultyGetter(metrics MapMetricsExtend, diff int, level float64) (ExtendDifficulty *MapDifficultyExtend)

ExtendDifficultyGetter 获得标准 谱面难度 信息,除了Irregular项

type MapDifficultyStandard

type MapDifficultyStandard struct {
	TotalNPS            float64 `json:"total_nps"`
	TotalHPS            float64 `json:"total_hps"`
	MaxScreenNPS        float64 `json:"max_screen_nps"`
	Difficulty          float64 `json:"difficulty"`
	BlueWhiteDifficulty float64 `json:"blue_white_difficulty"`
}

MapDifficultyStandard 基础部分,不要求正常谱面

func StandardDifficultyGetter

func StandardDifficultyGetter(metrics MapMetricsStandard, diff int) (StandardDifficulty MapDifficultyStandard, newDiff int)

StandardDifficultyGetter 获得标准 谱面难度 信息,除了Irregular项

type MapInfo

type MapInfo struct {
	MapMetrics          *MapMetricsStandard    `json:"map_metrics"`
	MapMetricsExtend    *MapMetricsExtend      `json:"map_metrics_extend,omitempty"`
	MapDifficulty       *MapDifficultyStandard `json:"map_difficulty"`
	MapDifficultyExtend *MapDifficultyExtend   `json:"map_difficulty_extend,omitempty"`
}

func MapInfoGetter

func MapInfoGetter(inputMap InputMap, diff int) (MapInfo, error)

MapInfoGetter 获得全部的谱面信息

type MapMetricsBasic

type MapMetricsBasic struct {
	IrregularInfo
	TotalNote int     `json:"total_note"`
	TotalTime float64 `json:"total_time"`
	TotalNPS  float64 `json:"total_nps"`
	SPRhythm  bool    `json:"sp_rhythm"`
}

MapMetricsBasic 将会放入数据库存档的数据部分

type MapMetricsExtend

type MapMetricsExtend struct {
	LeftPercent       float64 `json:"left_percent"`
	MaxSpeed          float64 `json:"max_speed"`
	FingerMaxHPS      float64 `json:"finger_max_hps"`
	FlickNoteInterval float64 `json:"flick_note_interval"`
	NoteFlickInterval float64 `json:"note_flick_interval"`
}

MapMetricsExtend 扩展部分,要求正常谱面,非正常时为nil

type MapMetricsStandard

type MapMetricsStandard struct {
	MapMetricsBasic

	BpmInfo
	TotalHitNote int     `json:"total_hit_note"`
	MaxScreenNPS float64 `json:"max_screen_nps"`
	TotalHPS     float64 `json:"total_hps"`

	NoteCount    NoteCount
	Distribution Distribution
}

MapMetricsStandard 基础部分,不要求正常谱面

func StandardInfoGetter

func StandardInfoGetter(Map Chart) (StandardInfo MapMetricsStandard)

StandardInfoGetter 获得标准谱面信息,除了Irregular项

type Note

type Note struct {
	Type      NoteType    // 音符类型
	BPM       float64     // BPM信息
	Beat      float64     // 节拍数
	Time      float64     // 判定时间
	Lane      float64     // 轨道号
	Direction int         // 左右滑建,普通滑键的大小:-3~-1 左滑键;0 普通滑建;1~3右滑建
	Pos       int         // type为NoteType_Slide时,所属的绿条编号
	Status    SlideStatus // 是否为最后一个SlideTick
	Flick     bool        // 是否为粉键/滑键
	Hidden    bool        // 是否为隐藏音符
}

type NoteCount

type NoteCount struct {
	Single         int `json:"single"`
	Flick          int `json:"flick"`
	SlideStart     int `json:"slide_start"`
	SlideTick      int `json:"slide_tick"`
	SlideEnd       int `json:"slide_end"`
	SlideFlick     int `json:"slide_flick"`
	SlideHidden    int `json:"slide_hidden"`
	DirectionLeft  int `json:"direction_left"`
	DirectionRight int `json:"direction_right"`
}

type NoteType

type NoteType int
const (
	NoteTypeBpm NoteType = iota
	NoteTypeSingle
	NoteTypeSlide
)

type ParsedChart

type ParsedChart []ParsedNote

func (ParsedChart) Len

func (chart ParsedChart) Len() int

func (ParsedChart) Less

func (chart ParsedChart) Less(i, j int) bool

func (ParsedChart) Swap

func (chart ParsedChart) Swap(i, j int)

type ParsedNote

type ParsedNote struct {
	Note
	Hand         HandType
	NotePrevious *ParsedNote
	NoteAfter    *ParsedNote
}

func (ParsedNote) GetGapFront

func (note ParsedNote) GetGapFront() (gap float64)

func (ParsedNote) GetInterval

func (note ParsedNote) GetInterval(note2 *ParsedNote) (interval float64)

func (ParsedNote) GetIntervalBack

func (note ParsedNote) GetIntervalBack() (interval float64)

func (ParsedNote) GetIntervalFront

func (note ParsedNote) GetIntervalFront() (interval float64)

type RegularType

type RegularType int
const (
	RegularTypeUnknown RegularType = iota
	RegularTypeRegular
	RegularTypeIrregular
)

type SlideStatus

type SlideStatus int
const (
	SlideTick SlideStatus = iota
	SlideStart
	SlideEnd
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL