public virtual void Drop(List <object> node, DropPosition mode, bool copy) { bool runningCompositeTask = Services.TaskService.IsRunningCompositeTask; if (!runningCompositeTask) { Services.TaskService.BeginCompositeTask("Drag drop GameObject"); } foreach (object obj in node) { if (!copy) { IDragSource dragSource = obj as IDragSource; if (dragSource != null) { dragSource.Detach(); } } NodeObject gameObjectData = obj as NodeObject; if (gameObjectData != null) { this.LoadDropObject(gameObjectData, mode); } } if (runningCompositeTask) { return; } Services.TaskService.EndCompositeTask(); }
internal virtual void InsertChild(int index, NodeObject nObject) { this.GetCSVisual().InsertChild(index, nObject.GetCSVisual()); nObject.OperationFlag |= OperationMask.MoveFlag; nObject.RefreshBoundingBox(true); nObject.Parent = this; }
private void ChildrenList_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { if (e.Action == NotifyCollectionChangedAction.Add) { int newStartingIndex = e.NewStartingIndex; foreach (object newItem in (IEnumerable)e.NewItems) { NodeObject nodeObject1 = newItem as NodeObject; this.GetCSVisual().InsertChild(newStartingIndex, nodeObject1.GetCSVisual()); ++newStartingIndex; nodeObject1.BindingRecorder((string)null); nodeObject1.AncestorObjectChanged((BaseObject)nodeObject1, NotifyCollectionChangedAction.Add); nodeObject1.IsHitTestVisible = false; NodeObject nodeObject2 = nodeObject1; int operationFlag = (int)nodeObject2.OperationFlag; int num = 0; nodeObject2.OperationFlag = (OperationMask)num; } } else { if (e.Action != NotifyCollectionChangedAction.Remove) { return; } foreach (object oldItem in (IEnumerable)e.OldItems) { NodeObject nodeObject = oldItem as NodeObject; nodeObject.AncestorObjectChanged((BaseObject)nodeObject, NotifyCollectionChangedAction.Remove); this.GetCSVisual().RemoveChild(nodeObject.GetCSVisual()); } } }
protected override void OnDragDrop(DragDropArgs e) { using (CompositeTask.Run("ChangeParent")) { ModelDragData dragData = e.Context.GetDragData() as ModelDragData; if (dragData != null && dragData.MetaData != null) { if (typeof(WidgetObject).IsAssignableFrom(dragData.MetaData.Type)) { List <VisualObject> visualObjectList = new List <VisualObject>(); NodeObject nodeObject = dragData.MetaData.CreateObject(); CocoStudio.Model.PointF scene = SceneTransformHelp.ConvertControlToScene(new CocoStudio.Model.PointF((float)e.X, (float)e.Y)); nodeObject.Position = this.TransformToSelf(scene); this.Children.Add(nodeObject); visualObjectList.Add((VisualObject)nodeObject); EventAggregator.Instance.GetEvent <SelectedVisualObjectsChangeEvent>().Publish(new SelectedVisualObjectsChangeEventArgs((IEnumerable <VisualObject>)visualObjectList, (IEnumerable <VisualObject>)visualObjectList, false)); } else { LogConfig.Output.Info((object)LanguageInfo.ListViewOutputMessage); } } this.SetObjectState(CSNode.ObjectState.Default); } }
private void ChildrenList_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { if (e.Action == NotifyCollectionChangedAction.Add) { int num = e.NewStartingIndex; foreach (object current in e.NewItems) { NodeObject nodeObject = current as NodeObject; this.GetCSVisual().InsertChild(num, nodeObject.GetCSVisual()); num++; nodeObject.BindingRecorder(null); nodeObject.AncestorObjectChanged(nodeObject, NotifyCollectionChangedAction.Add); nodeObject.IsHitTestVisible = false; NodeObject expr_6D = nodeObject; OperationMask arg_73_0 = expr_6D.OperationFlag; expr_6D.OperationFlag = OperationMask.NoneFlag; } } else if (e.Action == NotifyCollectionChangedAction.Remove) { foreach (object current in e.OldItems) { NodeObject nodeObject = current as NodeObject; nodeObject.AncestorObjectChanged(nodeObject, NotifyCollectionChangedAction.Remove); this.GetCSVisual().RemoveChild(nodeObject.GetCSVisual()); } } }
protected virtual void SetValue(object cObject, object cInnerObject) { NodeObject nodeObject = cObject as NodeObject; if (nodeObject == null) { return; } nodeObject.Name = this.Name + "_Copy"; nodeObject.CanEdit = this.CanEdit; nodeObject.OperationFlag = this.OperationFlag; nodeObject.Alpha = this.Alpha; nodeObject.CColor = this.CColor; nodeObject.Visible = this.Visible; nodeObject.ZOrder = this.ZOrder; nodeObject.Scale = this.Scale; nodeObject.Position = this.Position; nodeObject.RotationSkew = this.RotationSkew; nodeObject.AnchorPoint = this.AnchorPoint; nodeObject.VisibleForFrame = this.VisibleForFrame; nodeObject.Parent = this.Parent; nodeObject.PrePositionEnabled = this.PrePositionEnabled; nodeObject.FrameEvent = this.FrameEvent; nodeObject.CustomClassName = this.CustomClassName; }
public virtual void Drop(List <object> node, DropPosition mode, bool copy) { bool isRunningCompositeTask = Services.TaskService.IsRunningCompositeTask; if (!isRunningCompositeTask) { Services.TaskService.BeginCompositeTask("Drag drop GameObject"); } foreach (object current in node) { if (!copy) { IDragSource dragSource = current as IDragSource; if (dragSource != null) { dragSource.Detach(); } } NodeObject nodeObject = current as NodeObject; if (nodeObject != null) { this.LoadDropObject(nodeObject, mode); } } if (!isRunningCompositeTask) { Services.TaskService.EndCompositeTask(); } }
public virtual bool GetChildGlobalIndex(NodeObject vObject, ref int index) { index++; bool result; if (this.Children == null || this.Children.Count == 0) { result = false; } else { foreach (NodeObject current in this.Children) { if (current == vObject) { result = true; return(result); } if (current.GetChildGlobalIndex(vObject, ref index)) { result = true; return(result); } } result = false; } return(result); }
public virtual bool CanDrop(object node, DropPosition mode, bool copy) { if (copy || !(node is NodeObject) || this.IsAncestor(node as NodeObject)) { return(false); } NodeObject nodeObject = node as NodeObject; switch (mode) { case DropPosition.InsertBefore: if (this.Parent == null || !this.Parent.CanDrop(node, DropPosition.Add, copy)) { return(false); } break; case DropPosition.InsertAfter: if (this.Parent == null || !this.Parent.CanDrop(node, DropPosition.Add, copy)) { return(false); } break; } return(true); }
public static Timeline CreateTimeline(string name, NodeObject node) { Timeline timeline = new Timeline(node); timeline.FrameType = name; node.Timelines.Add(timeline); return(timeline); }
public void InitWithRootNode(NodeObject node) { foreach (NodeObject current in node.Children) { this.InitNodeItem(current); } this.innerClass.InitWithRootNode(node.GetCSVisual()); this.CurrentFrameIndex = 0; }
public void InitWithRootNode(NodeObject node) { foreach (NodeObject child in (Collection <NodeObject>)node.Children) { this.InitNodeItem(child); } this.innerClass.InitWithRootNode(node.GetCSVisual()); this.CurrentFrameIndex = 0; }
public override void UpdateProperty(NodeObject node) { SpriteObject spriteObject = node as SpriteObject; if (spriteObject != null) { this.TextureFile = spriteObject.FileData; } }
public Timeline(NodeObject node) { this.innerClass = new CSTimeline(); this.Node = node; this.frames = new ObservableCollection <Frame>(); this.Frames.CollectionChanged += new NotifyCollectionChangedEventHandler(this.OnFrameCollectionChanged); this.orderedFrames = new List <Frame>(); this.BindingRecorder(null); }
protected override void OnDragDrop(DragDropArgs e) { if (e.Context.GetDataPresent(typeof(ResourceInfoDragData))) { string str = this.CanDragDrop(e); if (str != null) { LogConfig.Output.Error((object)str, (Exception)null); return; } } bool runningCompositeTask = Services.TaskService.IsRunningCompositeTask; if (!runningCompositeTask) { Services.TaskService.BeginCompositeTask("Drag drop GameObject"); } List <VisualObject> visualObjectList = new List <VisualObject>(); if (e.Context.GetDataPresent(typeof(ResourceInfoDragData))) { ResourceInfoDragData dragData = (ResourceInfoDragData)e.Context.GetDragData(); if ((object)dragData == null) { return; } foreach (ResourceItem resourceFile in (IEnumerable <ResourceItem>)dragData.Items) { if (!(resourceFile is ResourceFolder)) { NodeObject objectFromFile = this.CreateObjectFromFile(resourceFile); if (objectFromFile != null) { this.LoadNodeObject(objectFromFile, new PointF((float)e.X, (float)e.Y)); visualObjectList.Add((VisualObject)objectFromFile); } } } } else if (e.Context.GetDataPresent(typeof(ModelDragData))) { NodeObject gObject = ((ModelDragData)e.Context.GetDragData()).MetaData.CreateObject(); this.LoadNodeObject(gObject, new PointF((float)e.X, (float)e.Y)); visualObjectList.Add((VisualObject)gObject); } this.SetObjectState(CSNode.ObjectState.Default); EventAggregator.Instance.GetEvent <SelectedVisualObjectsChangeEvent>().Publish(new SelectedVisualObjectsChangeEventArgs((IEnumerable <VisualObject>)visualObjectList, (IEnumerable <VisualObject>)visualObjectList, false)); if (runningCompositeTask) { return; } Services.TaskService.EndCompositeTask(); }
protected override void OnDragDrop(DragDropArgs e) { if (e.Context.GetDataPresent(typeof(ResourceInfoDragData))) { string text = this.CanDragDrop(e); if (text != null) { LogConfig.Output.Error(text, null); return; } } bool isRunningCompositeTask = Services.TaskService.IsRunningCompositeTask; if (!isRunningCompositeTask) { Services.TaskService.BeginCompositeTask("Drag drop GameObject"); } List <VisualObject> list = new List <VisualObject>(); if (e.Context.GetDataPresent(typeof(ResourceInfoDragData))) { ResourceInfoDragData resourceInfoDragData = (ResourceInfoDragData)e.Context.GetDragData(); if (resourceInfoDragData == null) { return; } foreach (ResourceItem current in resourceInfoDragData.Items) { if (!(current is ResourceFolder)) { NodeObject nodeObject = this.CreateObjectFromFile(current); if (nodeObject != null) { this.LoadNodeObject(nodeObject, new PointF((float)e.X, (float)e.Y)); list.Add(nodeObject); } } } } else if (e.Context.GetDataPresent(typeof(ModelDragData))) { ModelDragData modelDragData = (ModelDragData)e.Context.GetDragData(); NodeObject nodeObject2 = modelDragData.MetaData.CreateObject(); this.LoadNodeObject(nodeObject2, new PointF((float)e.X, (float)e.Y)); list.Add(nodeObject2); } this.SetObjectState(CSNode.ObjectState.Default); EventAggregator.Instance.GetEvent <SelectedVisualObjectsChangeEvent>().Publish(new SelectedVisualObjectsChangeEventArgs(list, list, false)); if (!isRunningCompositeTask) { Services.TaskService.EndCompositeTask(); } }
protected virtual void LoadNodeObject(NodeObject gObject, PointF coord) { if (gObject == null) { return; } PointF scene = SceneTransformHelp.ConvertControlToScene(coord); NodeObject nodeObject = !this.IsAddToCurrent ? Services.ProjectOperations.CurrentSelectedProject.GetRootNode() : this; PointF self = nodeObject.TransformToSelf(scene); gObject.Position = self; nodeObject.Children.Add(gObject); }
private void InitNodeItem(NodeObject node) { TimelineAction.GetNodeTimeline(node, typeof(PositionFrame).Name, true); TimelineAction.GetNodeTimeline(node, typeof(ScaleFrame).Name, true); TimelineAction.GetNodeTimeline(node, typeof(RotationSkewFrame).Name, true); foreach (NodeObject current in node.Children) { this.InitNodeItem(current); } foreach (Timeline current2 in node.Timelines) { this.AddTimeline(current2); } }
private void InitNodeItem(NodeObject node) { TimelineAction.GetNodeTimeline(node, typeof(PositionFrame).Name, true); TimelineAction.GetNodeTimeline(node, typeof(ScaleFrame).Name, true); TimelineAction.GetNodeTimeline(node, typeof(RotationSkewFrame).Name, true); foreach (NodeObject child in (Collection <NodeObject>)node.Children) { this.InitNodeItem(child); } foreach (Timeline timeline in (Collection <Timeline>)node.Timelines) { this.AddTimeline(timeline); } }
public virtual void UpdateProperty(NodeObject node) { if (this.Timeline != null) { Frame frame = this; foreach (Frame current in this.Timeline.Frames) { if (current.FrameIndex > this.FrameIndex) { frame = current; break; } } this.InnerClass.OnEnter(frame.InnerClass); } }
public virtual bool GetChildGlobalIndex(NodeObject vObject, ref int index) { ++index; if (this.Children == null || this.Children.Count == 0) { return(false); } foreach (NodeObject child in (Collection <NodeObject>) this.Children) { if (child == vObject || child.GetChildGlobalIndex(vObject, ref index)) { return(true); } } return(false); }
internal bool IsAncestor(NodeObject obj) { if (obj == null) { return(false); } if (obj == this.Parent) { return(true); } if (this.Parent != null) { return(this.Parent.IsAncestor(obj)); } return(false); }
public static Timeline GetNodeTimeline(NodeObject node, string FrameType, bool autoCreate = true) { Timeline timeline = null; node.Timelines.ForEach(delegate(Timeline t) { if (t.FrameType == FrameType) { timeline = t; } }); if (node.Parent != null && timeline == null && autoCreate) { timeline = Timeline.CreateTimeline(FrameType, node); } return(timeline); }
public override object Clone() { Type type = this.GetType(); CSNode instance1 = Activator.CreateInstance(this.GetCSVisual().GetType()) as CSNode; NodeObject instance2 = Activator.CreateInstance(type, new object[1] { (object)instance1 }) as NodeObject; this.SetValue((object)instance2, (object)instance1); this.SetAnimation((object)instance2); foreach (NodeObject child in (Collection <NodeObject>) this.Children) { instance2.Children.Add((NodeObject)child.Clone()); } return((object)instance2); }
protected virtual void LoadDropObject(NodeObject gameObjectData, DropPosition mode) { switch (mode) { case DropPosition.Add: this.Children.Add(gameObjectData); break; case DropPosition.InsertBefore: this.Parent.Children.Insert(this.Parent.Children.IndexOf(this), gameObjectData); break; case DropPosition.InsertAfter: this.Parent.Children.Insert(this.Parent.Children.IndexOf(this) + 1, gameObjectData); break; } }
public virtual void UpdateProperty(NodeObject node) { if (this.Timeline == null) { return; } Frame frame1 = this; foreach (Frame frame2 in (Collection <Frame>) this.Timeline.Frames) { if (frame2.FrameIndex > this.FrameIndex) { frame1 = frame2; break; } } this.InnerClass.OnEnter(frame1.InnerClass); }
public override object Clone() { Type type = base.GetType(); Type type2 = this.GetCSVisual().GetType(); CSNode cSNode = Activator.CreateInstance(type2) as CSNode; NodeObject nodeObject = Activator.CreateInstance(type, new object[] { cSNode }) as NodeObject; this.SetValue(nodeObject, cSNode); this.SetAnimation(nodeObject); foreach (NodeObject current in this.Children) { nodeObject.Children.Add((NodeObject)current.Clone()); } return(nodeObject); }
public static Timeline GetNodeTimeline(NodeObject node, string FrameType, bool autoCreate = true) { Timeline timeline = (Timeline)null; node.Timelines.ForEach <Timeline>((Action <Timeline>)(t => { if (!(t.FrameType == FrameType)) { return; } timeline = t; })); if (node.Parent != null && timeline == null && autoCreate) { timeline = Timeline.CreateTimeline(FrameType, node); } return(timeline); }
protected virtual void LoadNodeObject(NodeObject gObject, PointF coord) { if (gObject != null) { PointF sencePoint = SceneTransformHelp.ConvertControlToScene(coord); NodeObject nodeObject; if (this.IsAddToCurrent) { nodeObject = this; } else { nodeObject = Services.ProjectOperations.CurrentSelectedProject.GetRootNode(); } PointF position = nodeObject.TransformToSelf(sencePoint); gObject.Position = position; nodeObject.Children.Add(gObject); } }
private void LoadProject(Project project) { if (project != null && project.IsValid) { string filename = this.Project.FileName; IProgressMonitor consoleProgressMonitor = Services.ProgressMonitors.GetConsoleProgressMonitor(false); Project project2 = Services.ProjectsService.ReadProject(consoleProgressMonitor, filename); project2.Load(consoleProgressMonitor); if (consoleProgressMonitor.AsyncOperation.Success) { this.rootObject = project2.GetRootNode(); if (this.rootObject != null) { this.rootObject.GetCSVisual().SetZOrder(-1); } this.innerNode.AddChild(this.rootObject.GetCSVisual()); } } }