Beispiel #1
0
        public void AddDisplayRegion(DisplayRegion displayRegion, Texture2D texture)
        {
            CollapseItem item = textureListBox.GetItem(texture);

            if (item != null)
            {
                item.AddItem(displayRegion.Name, displayRegion);
            }
        }
        public void UpdateLists()
        {
            #region Update List window visibility

            mInstructionSetListBox.Visible    = GuiData.TimeLineWindow.InstructionMode == InstructionMode.Current;
            mAnimationSequenceListBox.Visible = GuiData.TimeLineWindow.InstructionMode == InstructionMode.All;

            #endregion

            #region Update the Global InstructionSets ListDisplayWindow

            mAnimationSequenceListBox.ListShowing = EditorData.GlobalInstructionSets;

            #endregion

            #region If there is not a CurrentInstructionSet

            if (EditorData.EditorLogic.CurrentInstructionSet == null)
            {
                mInstructionSetListBox.Clear();
            }

            #endregion

            #region Else, there is
            else
            {
                #region See if there are any KeyframeLists that aren't shown in the list
                for (int i = 0; i < EditorData.EditorLogic.CurrentInstructionSet.Count; i++)
                {
                    if (mInstructionSetListBox.ContainsObject(
                            EditorData.EditorLogic.CurrentInstructionSet[i]) == false)
                    {
                        CollapseItem item = mInstructionSetListBox.AddItem(
                            EditorData.EditorLogic.CurrentInstructionSet[i].Name,
                            EditorData.EditorLogic.CurrentInstructionSet[i]);
                    }
                    else
                    {
                        mInstructionSetListBox.GetItem(EditorData.EditorLogic.CurrentInstructionSet[i]).Text =
                            EditorData.EditorLogic.CurrentInstructionSet[i].Name;
                    }
                }
                #endregion

                #region See if there are any Keyframes that aren't in the ListBox

                foreach (KeyframeList keyframeList in EditorData.EditorLogic.CurrentInstructionSet)
                {
                    CollapseItem itemForKeyframe = mInstructionSetListBox.GetItem(keyframeList);

                    for (int i = 0; i < keyframeList.Count; i++)
                    {
                        InstructionList list = keyframeList[i];

                        string listName = "";

                        if (list.Count != 0)
                        {
                            string numberString = list[0].TimeToExecute.ToString("00.000");
                            listName = numberString + "  " + list.Name;
                        }
                        else
                        {
                            listName = list.Name;
                        }

                        if (itemForKeyframe.Contains(list) == false)
                        {
                            itemForKeyframe.InsertItem(i,
                                                       listName, list);
                        }
                        else
                        {
                            itemForKeyframe.GetItem(list).Text = listName;
                        }
                    }
                }

                #endregion

                #region See if there are any KeyframeLists or Keyframes in the ListBox that aren't in the List

                for (int itemNumber = 0; itemNumber < mInstructionSetListBox.Items.Count; itemNumber++)
                {
                    CollapseItem item = mInstructionSetListBox.Items[itemNumber];

                    KeyframeList keyframeList = item.ReferenceObject as KeyframeList;

                    if (EditorData.EditorLogic.CurrentInstructionSet.Contains(keyframeList) == false)
                    {
                        mInstructionSetListBox.RemoveCollapseItem(item);
                    }
                    else
                    {
                        for (int i = item.Count - 1; i > -1; i--)
                        {
                            CollapseItem subItem = item[i];

                            InstructionList keyframe = subItem.ReferenceObject as InstructionList;

                            if (keyframeList.Contains(keyframe) == false)
                            {
                                item.RemoveObject(keyframe);
                            }
                        }
                    }
                }

                #endregion
            }
            #endregion
        }