world

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2024 License: MIT Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	G  = 6.67430 * 1e-11 //万有引力常数(Nm²/kg²)
	C  = 299792458       //光速(m/s)
	AU = 149597870.7e3   //天文单位(m)

	DataTimeMin        = "2006-01-02 15:04"
	DateTimeNASA       = "2006-Jan-02 15:04"
	NASADataFile       = "nasa_data.db"
	NASADataTimeLast   = time.Hour * 24 //一次查询时间范围
	NASADataStepSize   = "1h"           //星体数据步长 1h 1d 1m
	ObserveDataTable   = "observe_data"
	CelestialBodyTable = "celestial_body"
)
View Source
const (
	HpGanYear  = 80
	HpZhiYear  = 40
	HpGanMonth = 120
	HpZhiMonth = 400
	HpGanDay   = 120
	HpZhiDay   = 120
	HpGanTime  = 120
	HpZhiTime  = 120
)

八字能量比例 年干8 月干12 日元12 时干12 年支4 月支40 日支12 时支12

View Source
const (
	GenderFemale = 0 //女♀
	GenderMale   = 1 //男♂
)
View Source
const (
	TPSRate = 30
)

Variables

View Source
var Bodies = map[int]*CelestialBody{
	10:  {Id: 10, /* contains filtered or unexported fields */},
	199: {Id: 199, /* contains filtered or unexported fields */},
	299: {Id: 299, /* contains filtered or unexported fields */},
	301: {Id: 301, /* contains filtered or unexported fields */},
	399: {Id: 399, /* contains filtered or unexported fields */},
	3:   {Id: 3, /* contains filtered or unexported fields */},
	401: {Id: 401, /* contains filtered or unexported fields */},
	402: {Id: 402, /* contains filtered or unexported fields */},
	499: {Id: 499, /* contains filtered or unexported fields */},
	4:   {Id: 4, /* contains filtered or unexported fields */},
	501: {Id: 501, /* contains filtered or unexported fields */},
	502: {Id: 502, /* contains filtered or unexported fields */},
	503: {Id: 503, /* contains filtered or unexported fields */},
	504: {Id: 504, /* contains filtered or unexported fields */},
	599: {Id: 599, /* contains filtered or unexported fields */},
	601: {Id: 601, /* contains filtered or unexported fields */},
	602: {Id: 602, /* contains filtered or unexported fields */},
	603: {Id: 603, /* contains filtered or unexported fields */},
	604: {Id: 604, /* contains filtered or unexported fields */},
	605: {Id: 605, /* contains filtered or unexported fields */},
	606: {Id: 606, /* contains filtered or unexported fields */},
	607: {Id: 607, /* contains filtered or unexported fields */},
	699: {Id: 699, /* contains filtered or unexported fields */},
	799: {Id: 799, /* contains filtered or unexported fields */},
	899: {Id: 899, /* contains filtered or unexported fields */},
	901: {Id: 901, /* contains filtered or unexported fields */},
	999: {Id: 999, /* contains filtered or unexported fields */},
	9:   {Id: 9, /* contains filtered or unexported fields */},
}
View Source
var Draws = []int{
	10, 199, 299, 399, 499, 599, 699,
}
View Source
var GenderName = []string{"女", "男"}
View Source
var GenderSoul = []string{"坤造", "乾造"}
View Source
var HideGanVal = map[int][]int{
	1: {100},
	2: {70, 30},
	3: {60, 30, 10},
}

HideGanVal 藏干值比例

View Source
var Interactive = map[string]func(va, vb *int, ma, mb int, speed int){
	"比肩": InteractiveBiJie,
	"劫财": InteractiveBiJie,
	"食神": InteractiveShi,
	"伤官": InteractiveShang,
	"正印": InteractiveYin,
	"偏印": InteractiveXiao,
	"正官": InteractiveGuan,
	"七杀": InteractiveSha,
	"正财": InteractiveZhengCai,
	"偏财": InteractivePianCai,
}
View Source
var (
	ThisGame *game
)

Functions

func CharBodyInteractive

func CharBodyInteractive(a, b *CharBody, speed int)

func ColorGanZhi

func ColorGanZhi(gz string) color.RGBA

func ColorNaYin

func ColorNaYin(gz string) color.RGBA

func DrawFlow

func DrawFlow(dst *ebiten.Image, sx, sy float32, soul string, cb *CharBody)

DrawFlow 流年流月流日流时柱

func DrawProBar

func DrawProBar[T util.Numeric](dst *ebiten.Image, x, y, width, height float32, clr color.Color, val, maxV T)

DrawProBar draw a horizontal progress bar

func DrawProBarV

func DrawProBarV[T util.Numeric](dst *ebiten.Image, x, y, width, height float32, clr color.Color, val, maxV T)

DrawProBarV draw a vertical progress bar

func DrawRangeBar

func DrawRangeBar(dst *ebiten.Image, x, y, width float32, name string, val, minV, maxV float64, clr color.Color)

DrawRangeBar draw a range bar

func DrawRangeBarV

func DrawRangeBarV(dst *ebiten.Image, x, y, height float32, name string, val, minV, maxV float64, clr color.Color)

DrawRangeBarV draw a vertical range bar

func GetFontFace

func GetFontFace(size float64) (font.Face, error)

func GetHideGan

func GetHideGan(gan string, idx int) string

func InteractiveBiJie

func InteractiveBiJie(va, vb *int, ma, mb int, speed int)

InteractiveBiJie 比劫

func InteractiveGuan

func InteractiveGuan(va, vb *int, ma, mb int, speed int)

InteractiveGuan 正官:a嫁b

func InteractivePianCai

func InteractivePianCai(va, vb *int, ma, mb int, speed int)

InteractivePianCai 偏财:a抢b

func InteractiveSha

func InteractiveSha(va, vb *int, ma, mb int, speed int)

InteractiveSha 七杀:b夺a

func InteractiveShang

func InteractiveShang(va, vb *int, ma, mb int, speed int)

InteractiveShang 伤官 a生b 异阴阳 生力小

func InteractiveShi

func InteractiveShi(va, vb *int, ma, mb int, speed int)

InteractiveShi 食神 a生b 同阴阳 生力大. 水衰不生木,木衰不生火,火衰不生土,土衰不生金,金衰不生水。

func InteractiveXiao

func InteractiveXiao(va, vb *int, ma, mb int, speed int)

InteractiveXiao 偏印:b生a

func InteractiveYin

func InteractiveYin(va, vb *int, ma, mb int, speed int)

InteractiveYin 正印:b生a

func InteractiveZhengCai

func InteractiveZhengCai(va, vb *int, ma, mb int, speed int)

InteractiveZhengCai 正财:a娶b

func NewGame

func NewGame() *game

func NewWorld

func NewWorld() ebiten.Game

func ShiShenShort

func ShiShenShort(dayGan, gan string) string

func UIHideQiMen

func UIHideQiMen()

func UIShowMsgBox

func UIShowMsgBox(text, btnText1, btnText2 string, btnClick1, btnClick2 func(b *ui.Button))

Types

type Astrolabe

type Astrolabe struct {
	sync.RWMutex
	X, Y float32

	Ephemeris map[string]*ObserveData

	ConstellationLoc [12]gongLocation //星座位
	AstrolabeLoc     [12]gongLocation //宫位
	XiuLoc           [28]gongLocation //星宿宫位

	Sun  *ebiten.Image
	Moon *ebiten.Image
	// contains filtered or unexported fields
}

func NewAstrolabe

func NewAstrolabe(x, y float32) *Astrolabe

func (*Astrolabe) DataQuerying

func (a *Astrolabe) DataQuerying() bool

func (*Astrolabe) Draw

func (a *Astrolabe) Draw(dst *ebiten.Image)

func (*Astrolabe) DrawGravity

func (a *Astrolabe) DrawGravity(dst *ebiten.Image)

func (*Astrolabe) GetEphemeris

func (a *Astrolabe) GetEphemeris(tid int, s *calendar.Solar) *ObserveData

func (*Astrolabe) GetMoonPos

func (a *Astrolabe) GetMoonPos() (float32, float32)

func (*Astrolabe) GetNASAData

func (a *Astrolabe) GetNASAData(tid int, sts, ets string) map[string]*observeDataSrc

func (*Astrolabe) GetSolarPos

func (a *Astrolabe) GetSolarPos() (float32, float32)

func (*Astrolabe) QueryNASAData

func (a *Astrolabe) QueryNASAData(tid int, sts, ets string)

func (*Astrolabe) SetPos

func (a *Astrolabe) SetPos(x, y float32)

func (*Astrolabe) Update

func (a *Astrolabe) Update()

type Body4

type Body4 struct {
	Year  *CharBody //年柱
	Month *CharBody //月柱
	Day   *CharBody //日柱
	Time  *CharBody //时柱
}

type Camera

type Camera struct {
	ViewPort   f64.Vec2
	Position   f64.Vec2
	ZoomFactor int
	Rotation   int
}

func (*Camera) Render

func (c *Camera) Render(world, screen *ebiten.Image)

func (*Camera) Reset

func (c *Camera) Reset()

func (*Camera) ScreenToWorld

func (c *Camera) ScreenToWorld(posX, posY int) (float64, float64)

func (*Camera) String

func (c *Camera) String() string

type CelestialBody

type CelestialBody struct {
	Id int `gorm:"primarykey" xorm:"pk"`

	GMin, GMax float64 //引力范围
	// contains filtered or unexported fields
}

func (*CelestialBody) DrawR

func (c *CelestialBody) DrawR() float32

DrawR 星盘半径

type Char8Pan

type Char8Pan struct {
	X, Y         float32
	Flow         *Body4  //流气
	Player       *Player //玩家
	BodyShow     bool
	OverviewShow bool

	ui.Container
	// contains filtered or unexported fields
}

func NewChar8Pan

func NewChar8Pan(x, y float32) *Char8Pan

func (*Char8Pan) Draw

func (g *Char8Pan) Draw(dst *ebiten.Image)

func (*Char8Pan) DrawCharHP

func (g *Char8Pan) DrawCharHP(dst *ebiten.Image, sx, sy float32, body *CharBody, title string)

func (*Char8Pan) Init

func (g *Char8Pan) Init()

func (*Char8Pan) SetPos

func (g *Char8Pan) SetPos(x, y float32)

func (*Char8Pan) Update

func (g *Char8Pan) Update()

func (*Char8Pan) UpdateHp

func (g *Char8Pan) UpdateHp(p *Player)

type CharBody

type CharBody struct {
	Gan  string //干为头
	Zhi  string //支为体
	Body string //本气为身
	Legs string //中气为腿
	Feet string //余气为足

	HPHead  int //干值
	HPBody  int //本气值
	HPLegs  int //中气值
	HPFeet  int //余气值
	HPMHead int //干为值Max
	HPMBody int //本气值Max
	HPMLegs int //中气值Max
	HPMFeet int //余气值Max

	FlowEnergy bool //流气锁值
}

func NewCharBody

func NewCharBody(gan, zhi string, ganMax, zhiMax int, flow bool) *CharBody

func (*CharBody) GetGanZhi

func (b *CharBody) GetGanZhi() string

func (*CharBody) InteractiveSelf

func (b *CharBody) InteractiveSelf(speed int)

type ObserveData

type ObserveData struct {
	Id     string  `gorm:"primarykey" xorm:"pk"`
	Target int     `gorm:"index" xorm:"index"`
	Year   int     `gorm:"index" xorm:"index"`
	Month  int     `gorm:"index" xorm:"index"`
	Day    int     `gorm:"index" xorm:"index"`
	Hour   int     `gorm:"index" xorm:"index"`
	Minute int     `gorm:"index" xorm:"index"`
	RA_DEC string  // 赤经赤纬
	Delta  float64 // 距离 AU
	Deldot float64 // delta-dot 距离变化 KM/S 为正表示远离观察者
	SOT    float32 // S-O-T 观察者-目标-太阳角度
	SOTR   string  // "/T": TRAILS 目标跟踪S  "/L": LEADS 目标引领S
	STO    float32 // S-T-O 太阳-目标-观察者角度
	Cnst   string  // 星座
}

func (*ObserveData) DEC

func (c *ObserveData) DEC() string

DEC 赤纬 +23 15 24.3

func (*ObserveData) RA

func (c *ObserveData) RA() string

RA 赤经 05 29 58.88

func (*ObserveData) RARadius

func (c *ObserveData) RARadius() float32

RARadius 赤经角度

type Player

type Player struct {
	Gender int //性别0女1男
	Birth  *calendar.Lunar
	Body4            //四柱
	FYun   *CharBody //大运
	Mate   *Player   //配偶

	YunIdx0, YunIdx int      //当前大运小运索引
	Fates0          []string //小运名
	Fates           []string //大运名

	UpdateCount int

	ShenShaY  []string //神煞年
	ShenShaM  []string //神煞月
	ShenShaD  []string //神煞日
	ShenShaT  []string //神煞时
	ShenShaYY []string //神煞大运
	ShenShaFY []string //神煞流年
	ShenShaFM []string //神煞流月
	ShenShaFD []string //神煞流日
	ShenShaFT []string //神煞流时
	// contains filtered or unexported fields
}

func (*Player) Reset

func (p *Player) Reset(lunar *calendar.Lunar, gender int)

type QMShow

type QMShow struct {
	X, Y float32
}

func NewQiMenShow

func NewQiMenShow(centerX, centerY float32) *QMShow

func (*QMShow) Draw

func (q *QMShow) Draw(dst *ebiten.Image)

func (*QMShow) DrawHead

func (q *QMShow) DrawHead(dst *ebiten.Image)

func (*QMShow) Update

func (q *QMShow) Update()

type StarEffect

type StarEffect struct {
	X, Y float32
	// contains filtered or unexported fields
}

func NewStarEffect

func NewStarEffect(x, y float32) *StarEffect

func (*StarEffect) Draw

func (se *StarEffect) Draw(dst *ebiten.Image)

func (*StarEffect) SetPos

func (se *StarEffect) SetPos(x, y float32)

func (*StarEffect) Update

func (se *StarEffect) Update()

type StarLine

type StarLine struct {
	// contains filtered or unexported fields
}

func NewStarLine

func NewStarLine() StarLine

func (*StarLine) Draw

func (s *StarLine) Draw(dst *ebiten.Image)

func (*StarLine) Init

func (s *StarLine) Init(scale float32)

func (*StarLine) Update

func (s *StarLine) Update(x, y float32)

type UIMsgBox

type UIMsgBox struct {
	ui.BaseUI
	// contains filtered or unexported fields
}

func NewUIMsgBox

func NewUIMsgBox(text, btnText1, btnText2 string, btnClick1, btnClick2 func(b *ui.Button)) *UIMsgBox

type UIQiMen

type UIQiMen struct {
	ui.BaseUI
	// contains filtered or unexported fields
}

func NewUIQiMen

func NewUIQiMen() *UIQiMen

func UIShowQiMen

func UIShowQiMen() *UIQiMen

func (*UIQiMen) Apply

func (p *UIQiMen) Apply(solar *calendar.Solar) *qimen.QMGame

func (*UIQiMen) AutoTick

func (p *UIQiMen) AutoTick() bool

func (*UIQiMen) NextApply

func (p *UIQiMen) NextApply() *qimen.QMGame

func (*UIQiMen) OnClose

func (p *UIQiMen) OnClose()

type UISelect

type UISelect struct {
	ui.BaseUI
	// contains filtered or unexported fields
}

func NewUISelect

func NewUISelect(solar *calendar.Solar, gender int, onOK func(*calendar.Solar, int)) *UISelect

func UIShowSelectBirth

func UIShowSelectBirth(date *calendar.Solar, gender int, onOK func(*calendar.Solar, int)) *UISelect

Jump to

Keyboard shortcuts

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