public void OnBeginDrag(PointerEventData eventData) { stickerUndoStep = new UStep(); stickerUndoStep.type = -2; stickerUndoStep.sticker = gameObject; stickerUndoStep.stickerLocalPos = transform.localPosition; stickerUndoStep.stickerScale = transform.localScale; stickerUndoStep.stickerRotation = transform.rotation; transform.parent.parent.GetComponent <PaintUndoManager>().AddStep(stickerUndoStep); }
void AddTransformUndoStep() { stickerUndoStep = new UStep(); stickerUndoStep.type = -2; stickerUndoStep.sticker = currentSticker; stickerUndoStep.stickerLocalPos = currentSticker.transform.localPosition; stickerUndoStep.stickerScale = currentSticker.transform.localScale; stickerUndoStep.stickerRotation = currentSticker.transform.rotation; transform.parent.GetComponent <PaintUndoManager>().AddStep(stickerUndoStep); }
public void InstantiateSticker(Sprite s) { clone = (GameObject)Instantiate(stickerPrefab, Vector3.zero, Quaternion.identity); clone.transform.SetParent(transform); clone.transform.localScale = Vector3.one; clone.transform.localPosition = Vector3.zero; clone.GetComponent <Image>().sprite = s; SelectSticker(clone); stickerUndoStep = new UStep(); stickerUndoStep.type = -1; stickerUndoStep.sticker = clone; transform.parent.GetComponent <PaintUndoManager>().AddStep(stickerUndoStep); }
public void DeleteSelectedSticker() { // Debug.Log("Sticker deleted? " + currentSticker); // stickerUndoStep.stickerDeleted = currentSticker.GetComponent<Sticker>().stickerIndex; // stickerUndoStep.stickerLocalPos = currentSticker.transform.localPosition; // stickerUndoStep.stickerScale = currentSticker.transform.localScale; // stickerUndoStep.stickerRotation = currentSticker.transform.rotation; // Destroy (currentSticker); if (currentSticker == null) { return; } stickerUndoStep = new UStep(); stickerUndoStep.type = -3; stickerUndoStep.sticker = currentSticker; currentSticker.SetActive(false); SelectSticker(null); transform.parent.GetComponent <PaintUndoManager>().AddStep(stickerUndoStep); }