MCPcopy Index your code
hub / github.com/FloatTech/ZeroBot-Plugin / update

Method update

plugin/warframeapi/world.go:90–111  ·  view source on GitHub ↗

游戏时间更新

()

Source from the content-addressed store, hash-verified

88
89// 游戏时间更新
90func (w *world) update() {
91 if !w.hasSync() {
92 return
93 }
94 for _, t := range w.w {
95 t.Lock()
96 // 当前时间对比下一次游戏状态更新时间,看看还剩多少秒
97 nt := time.Until(t.NextTime).Seconds()
98 // 已经过了游戏时间状态更新时间
99 if nt < 0 {
100 // 更新游戏状态,如果是白天就切换到晚上,反之亦然
101 if t.IsDay {
102 // 计算下次的晚上更新时间
103 t.NextTime = t.NextTime.Add(time.Duration(t.NightLen) * time.Second)
104 } else {
105 // 计算下次的白天更新时间
106 t.NextTime = t.NextTime.Add(time.Duration(t.DayLen) * time.Second)
107 }
108 }
109 t.Unlock()
110 }
111}

Callers 1

initFunction · 0.45

Calls 1

hasSyncMethod · 0.95

Tested by

no test coverage detected