using UnityEngine; using YooAsset; using static FairyGUI.ControllerAction; namespace GFGGame { public class DressUpRemoveOperation : DressUpOperationBase { internal int itemID; internal GameObject parentObj; public DressUpRemoveOperation(int itemID, GameObject parentObj) { this.itemID = itemID; this.parentObj = parentObj; //LogUtil.LogEditor($"remove init {itemID}"); } internal override void Release() { this.parentObj = null; } internal override void Start() { Status = EOperationStatus.Succeed; } internal override void Update() { } internal override void Cancel() { Status = EOperationStatus.Failed; Error = "User cancel."; } internal override bool CheckRepeated(DressUpOperationBase t) { DressUpLayerOperation layerOperation = t as DressUpLayerOperation; if (layerOperation != null && layerOperation.actionType == DressUpLayerOperation.EAction.Layer) { return (layerOperation.itemCfg != null && this.itemID == layerOperation.itemCfg.id && this.parentObj == layerOperation.parentObj); } var removeOperation = t as DressUpRemoveOperation; return (removeOperation != null && removeOperation.itemID == this.itemID && removeOperation.parentObj == this.parentObj); } internal override void UpdateView() { if(parentObj == null) { this.Release(); return; } //LogUtil.LogEditor($"remove UpdateView {itemID}"); DressUpUtil.RemoveItem(this.itemID, this.parentObj); } } }