public void UpdateElement(NameValueCollection values)
        {
            var panel = ParentTLE.PanelHub.SelectedPanel;

            if (panel == null)
            {
                throw new Exception("SelectedPanel is null");
            }

            var selectedCell = panel.SelectedPanelCell;

            if (selectedCell == null)
            {
                throw new Exception("SelectedCell is null");
            }

            ITLEPanelCellElement panelElement = ParentTLE.PanelHub.SelectedPanel.SelectedPanelCell.ReferenceElement;

            if (panelElement is AnimationSingleElement)
            {
                AnimationSingleElement elem = panelElement as AnimationSingleElement;
                elem.UpdateManual(values);
            }
            else if (panelElement is AnimationGroupElement)
            {
                AnimationGroupElement elem = panelElement as AnimationGroupElement;
                elem.UpdateManual(values);
            }

            var lastIndex = ParentTLE.PanelHub.GetLastPanelAnimationElementIndex();

            ParentTLE.PanelHub.InitializePanel(TLEPanelNames.ANIMATION_ELEMENT_PREFIX + lastIndex, ParentTLE.TimeLine.BeatGuider.GetTLECellElements());
        }
Exemple #2
0
        public void MoveTimeForPanelsElement(ITLEPanelCellElement element, float wayPrecentage)
        {
            TimeIdentyficator.MovePrecentage(wayPrecentage);

            TimeSpan destenationTime = TimeIdentyficator.GetTime();

            element.SetStartTime(destenationTime);
        }
Exemple #3
0
        //public bool Selected { get; set; }

        public static TLEPanelCell Parse(ITLEPanelCellElement element)
        {
            TLEPanelCell cell = new TLEPanelCell();

            cell.GraphicName      = GraphicProxy.GenerateGraphicName();
            cell.ReferenceElement = element;
            cell.Placement        = new Placement();
            return(cell);
        }
Exemple #4
0
        public TLEPanelCell GetCell(ITLEPanelCellElement referenceElement)
        {
            if (referenceElement == null)
            {
                return(null);
            }

            return(PanelCells.FirstOrDefault(f => f.ReferenceElement == referenceElement));
        }
Exemple #5
0
 public TLEPanelCell GetPanelCellBasedOnReferenceElement(ITLEPanelCellElement element)
 {
     foreach (var panel in Panels.Values)
     {
         var cell = panel.PanelCells.FirstOrDefault(f => f.ReferenceElement == element);
         if (cell != null)
         {
             return(cell);
         }
     }
     return(null);
 }
        public void AddNewElement()
        {
            AnimationSingleElement element = new AnimationSingleElement();

            element.SetStartTime(ParentTLE.PanelHub.TimeIdentyficator.SelectedTime);

            var panel = ParentTLE.PanelHub.SelectedPanel;

            if (panel == null)
            {
                throw new Exception("SelectedPanel is null");
            }

            var selectedCell = panel.SelectedPanelCell;

            if (selectedCell == null)
            {
                throw new Exception("SelectedCell is null");
            }

            ITLEPanelCellElement selectedPanelElement = ParentTLE.PanelHub.SelectedPanel.SelectedPanelCell.ReferenceElement;

            IAnimationElement animElem = selectedPanelElement as IAnimationElement;

            if (animElem == null)
            {
                throw new Exception("AddNewElement: Reference element is not an AnimationElement");
            }

            var parent = ParentTLE.TimeLine.SearchParentAnimationElement(animElem);

            if (parent != null)
            {
                var group = parent as AnimationGroupElement;
                if (group == null)
                {
                    throw new Exception("AddNewElement: Parent is not an GroupElement");
                }
                group.Elements.Add(element);
                ParentTLE.TimeLine.Refresh();
                ParentTLE.PanelHub.InitializePanel(ParentTLE.PanelHub.SelectedPanel.PanelName, group.Elements);
            }
            else
            {
                ParentTLE.TimeLine.AnimationElements.Add(element);
                ParentTLE.TimeLine.Refresh();
                ParentTLE.PanelHub.InitializePanel(ParentTLE.PanelHub.SelectedPanel.PanelName, ParentTLE.TimeLine.AnimationElements);
            }
        }
        public void AddNewChildElement()
        {
            AnimationSingleElement element = new AnimationSingleElement();

            element.SetStartTime(ParentTLE.PanelHub.TimeIdentyficator.SelectedTime);

            var panel = ParentTLE.PanelHub.SelectedPanel;

            if (panel == null)
            {
                throw new Exception("SelectedPanel is null");
            }

            var selectedCell = panel.SelectedPanelCell;

            if (selectedCell == null)
            {
                throw new Exception("SelectedCell is null");
            }

            ITLEPanelCellElement panelElement = ParentTLE.PanelHub.SelectedPanel.SelectedPanelCell.ReferenceElement;

            if (panelElement as AnimationGroupElement != null)
            {
                AnimationGroupElement group = panelElement as AnimationGroupElement;
                group.Elements.Add(element);
                ParentTLE.PanelHub.InitializeNewAnimationPanel(group.Elements.ToList());
            }
            else if (panelElement as AnimationSingleElement != null)
            {
                AnimationSingleElement singleAnimationElement = panelElement as AnimationSingleElement;
                IAnimationElement      parentParentElement    = ParentTLE.TimeLine.SearchParentAnimationElement(singleAnimationElement);

                if (parentParentElement is AnimationGroupElement)
                {
                    var par = parentParentElement as AnimationGroupElement;
                    if (par != null)
                    {
                        var convertedGroup = par.ConvertToGroup(singleAnimationElement);
                        convertedGroup.Elements.Add(element);

                        ParentTLE.PanelHub.InitializeNewAnimationPanel(convertedGroup.Elements.ToList());
                    }
                }
                else if (parentParentElement == null)// no parent, timeline
                {
                    var group = ParentTLE.TimeLine.ConvertToGroup(singleAnimationElement);
                    group.Elements.Add(element);

                    ParentTLE.PanelHub.InitializeNewAnimationPanel(group.Elements.ToList());
                }
            }
            else //null no group, directly attached to TimeLine. This shouldn't be used, although just in case.
            {
                ParentTLE.TimeLine.AnimationElements.Add(element);
                ParentTLE.PanelHub.InitializeNewAnimationPanel(ParentTLE.TimeLine.GetAnimationSingleElementFirstLayer());
                //throw new Exception("Nesu: TimeLineEditor - Parent animation element is null");
            }

            ParentTLE.TimeLine.Refresh();
        }