public void OnUpdateAction(BasePackage package, UpdateAction[] acts) { foreach (var act in acts) { switch (act.Type) { case UpdateAction.ActionType.Init: Init(); break; case UpdateAction.ActionType.Add: UpdateItem(act.Index, package.GetItemAt <ItemData>(act.Index)); break; case UpdateAction.ActionType.Remove: UpdateItem(act.Index, package.GetItemAt <ItemData>(act.Index)); break; case UpdateAction.ActionType.UpdateCount: UpdateItem(act.Index, package.GetItemAt <ItemData>(act.Index)); break; default: throw new ArgumentOutOfRangeException(); } } }
public void OnItemAdded(BasePackage basePackage, int index) { UpdateItem(index, basePackage.GetItemAt <ItemData>(index)); }