protected override void OnAdd(GUnit unit) { var controlDataList = ObjectControlDataDict.Get(unit); foreach (var controlData in controlDataList) { var controlModule = ObjectControlModuleDict.Get(controlData.controlType); controlData.objectControl = controlModule; ObjectControlStateTypeDict.Set(unit, controlData.controlType, KeyStateType.None); } }
protected override void OnRemove(GUnit unit) { var controlStateData = unit.GetData <ObjectControlStateData>(); controlStateData.stateType.Value = ObjectControlStateType.Finish; var controlDataList = ObjectControlDataDict.Get(unit); foreach (var controlData in controlDataList) { Pool.Release(controlData); } ObjectControlDataDict.Clear(unit); ObjectControlStateTypeDict.Clear(unit); }
public static void CheckAllControl(GUnit unit, int controlType, ObjectControlStateData controlStateData, ObjectStateProcessData stateProcessData) { var controlDataList = ObjectControlDataDict.Get(unit); foreach (var controlData in controlDataList) { if (!ContainsControlType(controlData.objectControl.ControlTypeList, controlType)) { continue; } var controlModule = controlData.objectControl; var result = controlModule.CheckControl(unit, controlData, stateProcessData); if (result.Item1) { DoState(unit, controlData, result.Item2); } } }