public void DoAction(LegacyEditorAction act) { //Once we do a new thing, our redo list blows the hell up redoList.Clear(); //Then actually do the thing act.execute(); //This is a special tool that will help us later undoList.Push(act); }
public void Redo() { //If we have nothing to redo then we just quietly don't do anything if (redoList.Count > 0) { LegacyEditorAction act = redoList.Pop(); act.execute(); undoList.Push(act); FireModelChange(); } }
public void Undo() { //If we have no history we don't have anything to undo and just quietly don't do anything if (undoList.Count > 0) { LegacyEditorAction act = undoList.Pop(); act.undo(); redoList.Push(act); FireModelChange(); } }
public void OnAction(bool inputData) { LegacyEditorAction action = null; if (varSource == ActionVarType.FIELD) { action = ScriptableObject.CreateInstance <ChangeActionField>(); ((ChangeActionField)action).init(varName, inputData); } else if (varSource == ActionVarType.VARIABLE) { action = ScriptableObject.CreateInstance <ChangeActionField>(); ((ChangeActionField)action).init(varName, inputData); } LegacyEditorData.instance.DoAction(action); }
public void OnAction() { string inputData = input.value; //If we have a filter object, make sure to filter the incoming text before we do anything with it. if (filter != null) { inputData = filter.filterText(inputData); } LegacyEditorAction action = null; if (varSource == DataInputVarSource.FIELD) { if (source == DataInputSource.FIGHTER) { action = ScriptableObject.CreateInstance <ChangeFighterInfoField>(); ((ChangeFighterInfoField)action).init(varName, inputData); } else if (source == DataInputSource.ACTION) { action = ScriptableObject.CreateInstance <ChangeActionField>(); ((ChangeActionField)action).init(varName, stringToObjectType(inputData)); } } else if (varSource == DataInputVarSource.VARIABLE) { if (source == DataInputSource.FIGHTER) { action = ScriptableObject.CreateInstance <ChangeFighterInfoVar>(); ((ChangeFighterInfoVar)action).init(varName, inputData); } else if (source == DataInputSource.ACTION) { action = ScriptableObject.CreateInstance <ChangeActionField>(); ((ChangeActionField)action).init(varName, stringToObjectType(inputData)); } } LegacyEditorData.instance.DoAction(action); }
public void SetAction(LegacyEditorAction legacyAction) { action = legacyAction; }