注销耗时计算日志打印
修改EntityId定义
This commit is contained in:
parent
0d24ef1dc2
commit
e7be64a2f9
8
world.go
8
world.go
@ -13,7 +13,7 @@ import (
|
|||||||
|
|
||||||
type WorldState int
|
type WorldState int
|
||||||
|
|
||||||
type WorldId int
|
type WorldId = donburi.WorldId
|
||||||
|
|
||||||
const (
|
const (
|
||||||
Init WorldState = iota
|
Init WorldState = iota
|
||||||
@ -179,7 +179,6 @@ func (w *world) executeTodos() {
|
|||||||
}
|
}
|
||||||
func (w *world) run() {
|
func (w *world) run() {
|
||||||
for {
|
for {
|
||||||
start := time.Now()
|
|
||||||
select {
|
select {
|
||||||
case <-w.quit: // 退出信号
|
case <-w.quit: // 退出信号
|
||||||
// 仿真退出,更新状态
|
// 仿真退出,更新状态
|
||||||
@ -196,6 +195,7 @@ func (w *world) run() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
<-w.ticker.C
|
<-w.ticker.C
|
||||||
|
// start := time.Now()
|
||||||
if w.state == Pause { // 暂停不更新
|
if w.state == Pause { // 暂停不更新
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
@ -214,7 +214,7 @@ func (w *world) run() {
|
|||||||
} else {
|
} else {
|
||||||
w.times += w.speed
|
w.times += w.speed
|
||||||
}
|
}
|
||||||
dt := time.Since(start)
|
// dt := time.Since(start)
|
||||||
fmt.Println("仿真执行耗时:", dt.Milliseconds(), "ms")
|
// fmt.Println("仿真系统执行耗时:", dt.Milliseconds(), "ms")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user