[文档]defupdate(self,obj:BaseGeometry,target_obj:Any):""" 更新 obj 的状态信息,并向策略函数传递 """ifobjnotinself.states.keys():self.states[obj]={"state":"Init","count":0}ifnotobj.on_errorandself.states[obj]!="Error":self.states[obj]={"state":"Normal","count":self.states[obj]["count"]+1}ifnotobj.on_errorandself.states[obj]=="Error":self.states[obj]={"state":"Restore","count":self.states[obj]["count"]+1}ifobj.on_error:self.states[obj]={"state":"Error","count":self.states[obj]["count"]+1}# 传递策略matchself.manage_type:case"manimgl"|"janim":self.strategy_func(self.states[obj],obj,target_obj)case_:raiseValueError(f"{self.manage_type} is not a valid managing target")