Example #1
0
        protected override bool OnDragDrop(DragContext context, int x, int y, uint time_)
        {
            object dragData = context.GetDragData();
            ResourceInfoDragData resourceInfoDragData = dragData as ResourceInfoDragData;
            bool result;

            if (resourceInfoDragData == null || resourceInfoDragData.Items.Count < 1 || !(resourceInfoDragData.Items.FirstOrDefault <ResourceItem>() is ResourceFile))
            {
                result = false;
            }
            else
            {
                ResourceFile resourceFile = (ResourceFile)resourceInfoDragData.Items.FirstOrDefault <ResourceItem>();
                if (resourceFile != null)
                {
                    if (this.CheckResource(resourceFile))
                    {
                        this.SetValue(resourceFile);
                        this.resourceFile = resourceFile;
                    }
                }
                result = base.OnDragDrop(context, x, y, time_);
            }
            return(result);
        }
Example #2
0
        protected virtual bool CanReceiveResourceObject(ResourceInfoDragData objectData)
        {
            bool result;

            if (objectData == null)
            {
                result = false;
            }
            else
            {
                GameProjectFile gameProjectFile = Services.ProjectOperations.CurrentSelectedProject.ProjectItem as GameProjectFile;
                if (gameProjectFile == null)
                {
                    result = false;
                }
                else
                {
                    foreach (ResourceItem current in objectData.Items)
                    {
                        if (!(current is ImageFile) && !(current is PlistImageFile) && !(current is Project))
                        {
                            result = false;
                            return(result);
                        }
                    }
                    result = true;
                }
            }
            return(result);
        }
Example #3
0
        private string CanDragDrop(DragDropArgs e)
        {
            ResourceInfoDragData resourceInfoDragData = e.Context.GetDragData() as ResourceInfoDragData;
            GameProjectFile      gameProjectFile      = Services.ProjectOperations.CurrentSelectedProject.ProjectItem as GameProjectFile;
            string result;

            foreach (ResourceItem current in resourceInfoDragData.Items)
            {
                if (current.FullPath == gameProjectFile.FileName)
                {
                    result = LanguageInfo.MessageBox207_NestedSelfError;
                    return(result);
                }
                Project project = current as Project;
                if (project != null)
                {
                    string text = project.CheckNest(gameProjectFile.Project);
                    if (!string.IsNullOrEmpty(text))
                    {
                        result = text;
                        return(result);
                    }
                }
            }
            result = null;
            return(result);
        }
Example #4
0
 protected override bool CanReceiveResourceObject(ResourceInfoDragData objectData)
 {
     if (this.CanShowMessage)
     {
         LogConfig.Output.Info((object)LanguageInfo.ListViewOutputMessage);
         this.CanShowMessage = false;
     }
     return(false);
 }
Example #5
0
        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();
        }
Example #6
0
        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();
            }
        }
Example #7
0
 protected virtual bool CanReceiveResourceObject(ResourceInfoDragData objectData)
 {
     if (objectData == null || !(Services.ProjectOperations.CurrentSelectedProject.ProjectItem is GameProjectFile))
     {
         return(false);
     }
     foreach (ResourceItem resourceItem in (IEnumerable <ResourceItem>)objectData.Items)
     {
         if (!(resourceItem is ImageFile) && !(resourceItem is PlistImageFile) && !(resourceItem is Project))
         {
             return(false);
         }
     }
     return(true);
 }
        protected override bool OnDragDrop(DragContext context, int x, int y, uint time_)
        {
            ResourceInfoDragData dragData = context.GetDragData() as ResourceInfoDragData;

            if (dragData == null)
            {
                return(false);
            }
            ResourceFile file = dragData.Items.FirstOrDefault <ResourceItem>() as ResourceFile;

            if (file != null && this.CheckResource(file))
            {
                this.SetValue(file);
            }
            return(base.OnDragDrop(context, x, y, time_));
        }
        private void ResourceFileImport_DragMotion(object o, DragMotionArgs args)
        {
            ResourceInfoDragData dragData = args.Context.GetDragData() as ResourceInfoDragData;

            if (dragData == null)
            {
                args.SetAllowDragAction((DragAction)0);
                args.RetVal = (object)true;
            }
            else
            {
                ResourceFile file = dragData.Items.FirstOrDefault <ResourceItem>() as ResourceFile;
                if (file == null || !this.CheckResource(file))
                {
                    args.SetAllowDragAction((DragAction)0);
                    args.RetVal = (object)true;
                }
            }
        }
Example #10
0
        private void ImageEventBox_DragMotion(object o, DragMotionArgs args)
        {
            object dragData = args.Context.GetDragData();
            ResourceInfoDragData resourceInfoDragData = dragData as ResourceInfoDragData;

            if (resourceInfoDragData == null)
            {
                args.SetAllowDragAction((DragAction)0);
                args.RetVal = true;
            }
            else
            {
                ResourceFile resourceFile = resourceInfoDragData.Items.FirstOrDefault <ResourceItem>() as ResourceFile;
                if (resourceFile == null || !this.CheckResource(resourceFile))
                {
                    args.SetAllowDragAction((DragAction)0);
                    args.RetVal = true;
                }
            }
        }
Example #11
0
        private string CanDragDrop(DragDropArgs e)
        {
            ResourceInfoDragData dragData    = e.Context.GetDragData() as ResourceInfoDragData;
            GameProjectFile      projectItem = Services.ProjectOperations.CurrentSelectedProject.ProjectItem as GameProjectFile;

            foreach (ResourceItem resourceItem in (IEnumerable <ResourceItem>)dragData.Items)
            {
                if ((FilePath)resourceItem.FullPath == projectItem.FileName)
                {
                    return(LanguageInfo.MessageBox207_NestedSelfError);
                }
                Project project = resourceItem as Project;
                if (project != null)
                {
                    string str = project.CheckNest(projectItem.Project);
                    if (!string.IsNullOrEmpty(str))
                    {
                        return(str);
                    }
                }
            }
            return((string)null);
        }