chun

package
v0.0.0-...-64621da Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2024 License: GPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Root    = engine.DataFolder()
	Texture = engine.DataFolder() + "texture/"
)

Functions

func BaseRender

func BaseRender(JsonResultData ChunData, ctx *rei.Ctx) image.Image

func BreakWords

func BreakWords(getSongName string, breakerCount float64) string

BreakWords Reduce the length of strings, if out of range, use ".." instead.

func ChunRender

func ChunRender(ctx *rei.Ctx, israw bool)

func DownloadImage

func DownloadImage(url string) (image.Image, error)

DownloadImage Simple Downloader.

func DrawBorderString

func DrawBorderString(page *gg.Context, s string, size int, x float64, y float64, ax float64, ay float64, inlineRGB color.Color, outlineRGB color.Color)

DrawBorderString GG Package Not support The string render, so I write this (^^)

func GetCover

func GetCover(id string) (image.Image, error)

GetCover Careful The nil data

func LevelIndexCount

func LevelIndexCount(count int) string

func LoadFontFace

func LoadFontFace(filePath string, size float64) font.Face

LoadFontFace load font face once before running, to work it quickly and save memory.

func QueryChunDataFromUserName

func QueryChunDataFromUserName(userName string) (playerdata []byte, err error)

QueryChunDataFromUserName Query Chun Data.

func RenderCardChun

func RenderCardChun(data UserDataInner, renderCount int) image.Image

func Resize

func Resize(image image.Image, w int, h int) image.Image

Resize Image width height

func SaveImage

func SaveImage(img image.Image, path string)

SaveImage Save Cover Chun | Maimai

Types

type ChunData

type ChunData struct {
	Nickname string  `json:"nickname"`
	Rating   float64 `json:"rating"`
	Records  struct {
		B30 []struct {
			Cid        int     `json:"cid"`
			Ds         float64 `json:"ds"`
			Fc         string  `json:"fc"`
			Level      string  `json:"level"`
			LevelIndex int     `json:"level_index"`
			LevelLabel string  `json:"level_label"`
			Mid        int     `json:"mid"`
			Ra         float64 `json:"ra"`
			Score      int     `json:"score"`
			Title      string  `json:"title"`
		} `json:"b30"`
		R10 []struct {
			Cid        int     `json:"cid"`
			Ds         float64 `json:"ds"`
			Fc         string  `json:"fc"`
			Level      string  `json:"level"`
			LevelIndex int     `json:"level_index"`
			LevelLabel string  `json:"level_label"`
			Mid        int     `json:"mid"`
			Ra         float64 `json:"ra"`
			Score      int     `json:"score"`
			Title      string  `json:"title"`
		} `json:"r10"`
	} `json:"records"`
	Username string `json:"username"`
}

ChunData Struct.

type DivingFishB50

type DivingFishB50 struct {
	Username string `json:"username"`
	B50      bool   `json:"b50"`
}

type UserDataInner

type UserDataInner []struct {
	Cid        int     `json:"cid"`
	Ds         float64 `json:"ds"`
	Fc         string  `json:"fc"`
	Level      string  `json:"level"`
	LevelIndex int     `json:"level_index"`
	LevelLabel string  `json:"level_label"`
	Mid        int     `json:"mid"`
	Ra         float64 `json:"ra"`
	Score      int     `json:"score"`
	Title      string  `json:"title"`
}

UserDataInner CardBase

Jump to

Keyboard shortcuts

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