static void OnSpeClipValueChange() { var clipProxy = SpecialEffectAnimClipEditorModel.GetInstance().CurrentClip; TimeLineViewCtrl timeLineView = GetTimeLineViewCtrl(); //同步时间线 int i = 0; //更新预览动作时间线 var previewAction = SpecialEffectAnimClipEditorModel.GetInstance().GetPreviewModelAction(); if (previewAction != null) { timeLineView.Items[i].startTime = 0.0f; timeLineView.Items[i].length = previewAction.Length; } else { timeLineView.Items[i].startTime = 0.0f; timeLineView.Items[i].length = 0.0f; } i++; foreach (var item in clipProxy.Clip.itemList) { timeLineView.Items[i].startTime = item.StartTime; timeLineView.Items[i].length = item.Length; i++; } UpdatePreviewLength(); RefreshUIState(); }
static void RefreshListViewAndTimeLineViewSelectItem() { ListViewCtrl listView = GetListViewCtrl(); TimeLineViewCtrl timeLineView = GetTimeLineViewCtrl(); int sel = SpecialEffectAnimClipEditorModel.GetInstance().CurrentSelect; listView.SelectItems.Clear(); listView.SelectItems.Add(sel); timeLineView.LastSelectedItem = sel; }
static void OnTimeLineDragItemsBegin(EditorControl c, List <TimeLineViewCtrl.ItemSelectInfo> indxList) { TimeLineViewCtrl timeLineCtrl = c.Root.FindControl <TimeLineViewCtrl>(); if (timeLineCtrl == null) { return; } RequestRepaint(); }
static void OnTimeLineDragItemsEnd(EditorControl c, List <TimeLineViewCtrl.ItemSelectInfo> indxList) { TimeLineViewCtrl timeLineCtrl = c.Root.FindControl <TimeLineViewCtrl>(); if (timeLineCtrl == null) { return; } foreach (var selItem in indxList) { int i = selItem.indx; var item = timeLineCtrl.Items[i]; SpecialEffectAnimClipEditorModel.GetInstance().SetSpeAnimItemTimeLine(TransItemIndex(i), item.startTime, item.length); } RequestRepaint(); }
static void RebuildListViewAndTimeLineView() { var clip = SpecialEffectAnimClipEditorModel.GetInstance().CurrentClip; //更新ListView ListViewCtrl listView = GetListViewCtrl(); listView.ClearItems(); var previewAnimClip = clip.PreviewAnimClip; { ListCtrlItem item = new ListCtrlItem(); if (previewAnimClip != null) { item.name = previewAnimClip.name; } else { item.name = "空动作"; } item.image = UnityInternalIconCache.GetInstance().GetCacheIcon("UnityEditor.AnimationWindow"); listView.AddItem(item); } foreach (var item in clip.Clip.itemList) { ListCtrlItem listItem = new ListCtrlItem(); listItem.name = item.obj.name; if (item as SpecialEffectAnimClipAudioItem != null) { listItem.image = UnityInternalIconCache.GetInstance().GetCacheIcon("SceneViewAudio"); } else if (item as SpecialEffectAnimClipEffectItem != null) { listItem.image = UnityInternalIconCache.GetInstance().GetCacheIcon("AvatarPivot"); } listView.AddItem(listItem); } //更新TimeLineView TimeLineViewCtrl timeLineView = GetTimeLineViewCtrl(); timeLineView.Items.Clear(); { TimeLineItem item = new TimeLineItem(); item.startTime = 0.0f; if (previewAnimClip != null) { item.length = previewAnimClip.length; } else { item.length = 0.0f; } timeLineView.Items.Add(item); } foreach (var item in clip.Clip.itemList) { TimeLineItem timeLineItem = new TimeLineItem(); timeLineItem.startTime = item.StartTime; timeLineItem.length = item.Length; timeLineView.Items.Add(timeLineItem); } UpdatePreviewLength(); }
//构建控件 public static void InitControls(EditorRoot editorRoot) { s_root = editorRoot; editorRoot.RootCtrl = new HSpliterCtrl(); (editorRoot.RootCtrl as SpliterCtrl).Dragable = false; editorRoot.RootCtrl.layoutConstraint = LayoutConstraint.GetSpliterConstraint(30); HBoxCtrl menuArea = new HBoxCtrl(); editorRoot.RootCtrl.Add(menuArea); _BuildMenuButtons(menuArea); HSpliterCtrl h1 = new HSpliterCtrl(); h1.layoutConstraint = LayoutConstraint.GetSpliterConstraint(30); editorRoot.RootCtrl.Add(h1); HBoxCtrl playCtrlArea = new HBoxCtrl(); h1.Add(playCtrlArea); //播放控件 PlayCtrl playCtrl = new PlayCtrl(); playCtrl.Name = s_playCtrlName; playCtrl.onValueChange = OnPlayCtrlValueChange; playCtrl.onStop = OnPlayCtrlStop; playCtrlArea.Add(playCtrl); VSpliterCtrl v1 = new VSpliterCtrl(); v1.layoutConstraint = LayoutConstraint.GetSpliterConstraint(200); v1.Dragable = false; VBoxCtrl speListArea = new VBoxCtrl(); v1.Add(speListArea); h1.Add(v1); //特效动画子项列表 ListViewCtrl speListView = new ListViewCtrl(); speListView.Name = s_speListCtrlName; speListView.onAcceptDragObjs = OnSpeListAcceptDragObjs; speListView.onDropObjs = OnSpeListDropObjs; speListView.onItemSelected = OnSpeListItemSelect; speListView.onDoubleClick = OnSpeListItemDoubleClick; speListView.onScroll = OnSpeListScroll; //speListView.onItemSelectedR = OnSpeListItemRightBtnUp; speListView.onItemSelectedRU = OnSpeListItemRightBtnUp; speListArea.Add(speListView); VSpliterCtrl v2 = new VSpliterCtrl(); v2.layoutConstraint = LayoutConstraint.GetSpliterConstraint(400, true); v2.Dragable = true; v1.Add(v2); VBoxCtrl timeLineViewArea = new VBoxCtrl(); v2.Add(timeLineViewArea); //时间线控件 TimeLineViewCtrl timeLineView = new TimeLineViewCtrl(); timeLineView.Name = s_speTimeLineCtrlName; timeLineView.onItemSelected = OnTimeLineItemSelect; timeLineViewArea.Add(timeLineView); VBoxCtrl tabViewArea = new VBoxCtrl(); v2.Add(tabViewArea); TabViewCtrl tabView = new TabViewCtrl(); tabView.Name = s_tabViewCtrlName; tabViewArea.Add(tabView); tabView.onItemSelected = OnTabViewSelect; _BuildPropertyTabView(tabView); {//注册窗体回调 editorRoot.onEnable = OnEditorEnable; editorRoot.onDisable = OnEditorDisable; editorRoot.onUpdate = OnEditorUpdate; editorRoot.onDestroy = OnEditorDestroy; editorRoot.onGUI = OnEditorGUI; editorRoot.onMessage = OnEditorMessage; } }