Пример #1
0
 // Earse all children of canvas
 private void btnClearAll_Click(object sender, RoutedEventArgs e)
 {
     PaintCanvas.Children.Clear();
     PaintCanvas.Background = System.Windows.Media.Brushes.White;
     RedoObject.Clear();
     isSelectionTool = false;
     isSelectShape   = false;
 }
Пример #2
0
 private void btnDelete_Click(object sender, RoutedEventArgs e)
 {
     if (isSelectShape)
     {
         PaintCanvas.Children.RemoveAt(PaintCanvas.Children.Count - 1);
         RedoObject.RemoveAt(CurrentUIEIdx);
         CurrentUIEIdx--;
     }
 }
Пример #3
0
    public static RedoObject handleRedoObject(RedoObject ro)
    {
        UncreateObject uco = ro as UncreateObject;

        if (uco != null)
        {
            GameObject   go           = PropHandler.objectFromId(uco.id);
            Prop         prop         = go.GetComponent <Prop>();
            UnmoveObject unmoveObject = new UnmoveObject(uco.id, go.transform, prop.name, prop.paintHistory);
            PropHandler.untrack(go, true);
            return(unmoveObject);
        }

        UnmoveObject umo = ro as UnmoveObject;

        if (umo != null)
        {
            GameObject go = PropHandler.objectFromId(umo.id);
            RedoObject redoOb;
            if (go == null)
            {
                go = GameObject.Instantiate(PropHandler.props[umo.propName]);
                Prop prop = go.GetComponent <Prop>();
                prop.paintHistory = umo.paintHistory;
                prop.propObjectId = umo.id;
                foreach (UnpaintObject unp in prop.paintHistory)
                {
                    Prop.paintFromPath(go, unp.getNewColor(), unp.getColorPath(), false, false);
                }
                PropHandler.track(go);

                redoOb = new UncreateObject(umo.id);
            }
            else
            {
                redoOb = new UnmoveObject(umo.id, go.transform.position, go.transform.rotation, go.transform.localScale, umo.propName);
            }
            go.transform.position   = umo.position;
            go.transform.rotation   = umo.rotation;
            go.transform.localScale = umo.localScale;
            return(redoOb);
        }

        UnpaintObject upo = ro as UnpaintObject;

        if (upo != null)
        {
            GameObject go = PropHandler.objectFromId(upo.id);
            return(Prop.paintFromPath(go, upo.getNewColor(), upo.getColorPath(), true, false));
        }
        return(null);
    }
Пример #4
0
 private void btnNew_Click(object sender, RoutedEventArgs e)
 {
     PaintCanvas.Children.Clear();
     PaintCanvas.Background = System.Windows.Media.Brushes.White;
     RedoObject.Clear();
 }
Пример #5
0
 public static void addRedoObject(RedoObject ro)
 {
     undoStack.Push(ro);
 }