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());
        }
        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();
        }
예제 #3
0
        internal static string GenerateGraphicName(AnimationGroupElement animationElement)
        {
            string name = animationElement.GetType().Name.ToString() + "_" + (GraphicElementNameIndex++);

            return("GE_" + name);
        }
예제 #4
0
 public AnimationGroupElementTests()
 {
     element = new AnimationGroupElement();
 }