Exemple #1
0
        public override bool TryCombine(EditroidAction newerAction)
        {
            ModifyObject a = newerAction as ModifyObject;

            if (a != null && a.change == this.change && CompareItemReference(a))
            {
                newValue = a.newValue;
                return(true);
            }
            return(false);
        }
Exemple #2
0
        internal void NotifyAction(LevelAction a, bool undo)
        {
            if (a.AffectedLevel != loadedData.Level)
            {
                return;
            }

            using (BeginUpdate()) {
                Actions.ModifyObject modAction = a as Actions.ModifyObject;
                if (modAction != null && modAction.AffectedLevel == data.Level && modAction.GetItem() is StructInstance)
                {
                    if (((StructInstance)modAction.GetItem()).ObjectType == StructIndex && modAction.Change == Editroid.Actions.ObjectModification.Palette)
                    {
                        loadedData.PaletteIndex = LoadedData.Invalid;
                    }
                }

                Actions.SetPaletteColor palAction = a as Actions.SetPaletteColor;
                if (palAction != null)
                {
                    if (palAction.AffectedLevel == data.Level && (palAction.PaletteIndex == data.PaletteIndex || palAction.EntryIndex == 0))
                    {
                        loadedData.PaletteIndex = LoadedData.Invalid;
                    }
                }
            }


            Editroid.Actions.ModifyCombo comboAction = a as Editroid.Actions.ModifyCombo;
            if (comboAction != null)
            {
                if (comboAction.Changes.Count == 1)
                {
                    comboEditor.DrawCombo(comboAction.Changes[0].index, true);
                }
                else
                {
                    comboEditor.Draw();
                }
            }

            loadedData.StructIndex = LoadedData.Invalid;
            PerformUpdates();
        }