init: cs player_status CDK demo

This commit is contained in:
2026-07-11 03:08:25 +08:00
commit bad1f2570b
9 changed files with 272 additions and 0 deletions

21
logic/state_manager.py Normal file
View File

@@ -0,0 +1,21 @@
class StateManager:
def __init__(self):
self.previous = None
def update(self, current):
if current is None or current.get("health") is None:
return None, None
# 第一次收到有效数据,只记录,不触发事件
if self.previous is None:
self.previous = current
return None, None
old = self.previous
self.previous = current
return old, current