コード例 #1
0
        public override void Append(UndoRedoAction action, bool performAction)
        {
            base.Append(action, performAction);
            EditTilesetAutoTileItemAction castAction = action as EditTilesetAutoTileItemAction;

            if (performAction)
            {
                castAction.backupTileInput = this.backupTileInput;
                castAction.Do();
            }

            // Copy the new actions tile input over to this one and adjust the masking
            this.tileInput.Count     = Math.Max(this.tileInput.Count, castAction.tileInput.Count);
            this.tileInputMask.Count = this.tileInput.Count;
            for (int i = 0; i < castAction.tileInput.Count; i++)
            {
                if (!castAction.tileInputMask[i])
                {
                    continue;
                }
                this.tileInput[i]     = castAction.tileInput[i];
                this.tileInputMask[i] = true;
            }

            // Adjust the backup length to fit the new tile input length
            this.backupTileInput.Count = this.autoTile.TileInput.Count;
        }
コード例 #2
0
        public override bool CanAppend(UndoRedoAction action)
        {
            EditTilesetAutoTileItemAction castAction = action as EditTilesetAutoTileItemAction;

            if (castAction == null)
            {
                return(false);
            }
            if (castAction.autoTile != this.autoTile)
            {
                return(false);
            }
            return(true);
        }