void EndTextEditing() { if (IsEditing()) { // Erm, do this first, cuz deactivating stuff could cause this to be // called again recursively. Like deactivating the inputFieldObject! lastActorEdited = actorBeingEdited; actorBeingEdited = null; inputFieldObject.SetActive(false); cooldownRoutine = StartCoroutine(CooldownRoutine()); if (inputField.text == EMPTY_TEXT) { engine.DestroyActor(lastActorEdited); } else { editMain.SetTargetActor(lastActorEdited); // editMain.SetFocusedTargetActor(lastActorEdited); string undoText = actorTextBeforeEditing; if (actorWasJustCreated) { var engine = lastActorEdited.GetEngine(); var actorData = engine.SaveActor(lastActorEdited); undoStack.PushUndoForCreatingActor(lastActorEdited, $"Create text panel"); } else { string currText = lastActorEdited.GetCommentText(); if (ActorUndoUtil.GetUnableToEditActorReason(lastActorEdited.GetEngine(), lastActorEdited.GetName()) == null) { undoStack.PushUndoForActor( lastActorEdited, $"Edit text panel", redoActor => { redoActor.SetCommentText(currText); redoActor.ApplyPropertiesToClones(); }, undoActor => { undoActor.SetCommentText(undoText); undoActor.ApplyPropertiesToClones(); }); } } } } }
public void DeleteActor(VoosActor actor) { bool cannotDelete = actor == null || actor.IsLockedByAnother() || actor.IsBuiltinActor(); if (cannotDelete) { return; } Vector3 pos = actor.transform.position; effects.Trigger("Explosion_FX", pos, Quaternion.identity, actor.GetIsOffstageEffective()); RemoveTargetActor(actor); engine.DestroyActor(actor); }