Exemplo n.º 1
0
		public override void Drop(IDataObject data, int index, DropEffect finalEffect)
		{
			try {
				string insertText = (data.GetData(typeof(string[])) as string[])
					.Aggregate((text, part) => text += part);
				ITextAnchor marker;
				int length = 0;
				if (index == this.Children.Count) {
					if (index == 0)
						marker = null;
					else
						marker = (this.Children[index - 1] as XamlOutlineNode).EndMarker;
					if (marker == null) {
						marker = this.EndMarker;
						length = -1; // move backwards
					} else {
						length = 2 + (this.Children[index - 1] as XamlOutlineNode).elementName.Length;
					}
				} else
					marker = (this.Children[index] as XamlOutlineNode).Marker;
				
				int offset = marker.Offset + length;
				Editor.Document.Insert(offset, insertText);
			} catch (Exception ex) {
				throw ex;
			}
		}
Exemplo n.º 2
0
        UnmanagedMethods.HRESULT IDropTarget.DragOver(int grfKeyState, long pt, ref DropEffect pdwEffect)
        {
            var dispatch = _tl?.Input;

            if (dispatch == null)
            {
                pdwEffect = DropEffect.None;
                return(UnmanagedMethods.HRESULT.S_OK);
            }

            var args = new RawDragEvent(
                _dragDevice,
                RawDragEventType.DragOver,
                _target,
                GetDragLocation(pt),
                _currentDrag,
                ConvertDropEffect(pdwEffect),
                ConvertKeyState(grfKeyState)
                );

            dispatch(args);
            pdwEffect = ConvertDropEffect(args.Effects);

            return(UnmanagedMethods.HRESULT.S_OK);
        }
Exemplo n.º 3
0
		public override DropEffect CanDrop(IDataObject data, DropEffect requestedEffect)
		{
			var paths = data.GetData(typeof(string[])) as string[];
			if (paths != null) {
				return requestedEffect == DropEffect.Link ? DropEffect.Move : requestedEffect;
			}
			return DropEffect.None;
		}
Exemplo n.º 4
0
        public override DropEffect CanDrop(IDataObject data, DropEffect requestedEffect)
        {
            var paths = data.GetData(typeof(string[])) as string[];

            if (paths != null)
            {
                return(requestedEffect == DropEffect.Link ? DropEffect.Move : requestedEffect);
            }
            return(DropEffect.None);
        }
Exemplo n.º 5
0
        /// <summary>
        /// Handle the Paste operation to a targetNode
        /// </summary>
        protected internal override int PasteFromClipboard(HierarchyNode targetNode)
        {
            int returnValue = (int)OleConstants.OLECMDERR_E_NOTSUPPORTED;

            //Get the clipboardhelper service and use it after processing dataobject
            IVsUIHierWinClipboardHelper clipboardHelper = (IVsUIHierWinClipboardHelper)GetService(typeof(SVsUIHierWinClipboardHelper));

            if (clipboardHelper == null)
            {
                return(VSConstants.E_FAIL);
            }

            try
            {
                //Get dataobject from clipboard
                IOleDataObject dataObject = null;
                ErrorHandler.ThrowOnFailure(UnsafeNativeMethods.OleGetClipboard(out dataObject));
                if (dataObject == null)
                {
                    return(VSConstants.E_UNEXPECTED);
                }

                DropEffect   dropEffect   = DropEffect.None;
                DropDataType dropDataType = DropDataType.None;
                try
                {
                    dropDataType = this.ProcessSelectionDataObject(dataObject, targetNode.GetDragTargetHandlerNode());
                    dropEffect   = this.QueryDropEffect(dropDataType, 0);
                }
                catch (ExternalException e)
                {
                    Trace.WriteLine("Exception : " + e.Message);

                    // If it is a drop from windows and we get any kind of error ignore it. This
                    // prevents bogus messages from the shell from being displayed
                    if (dropDataType != DropDataType.Shell)
                    {
                        throw e;
                    }
                }
                finally
                {
                    // Inform VS (UiHierarchyWindow) of the paste
                    returnValue = clipboardHelper.Paste(dataObject, (uint)dropEffect);
                }
            }
            catch (COMException e)
            {
                Trace.WriteLine("Exception : " + e.Message);

                returnValue = e.ErrorCode;
            }

            return(returnValue);
        }
Exemplo n.º 6
0
    // 物品掉落特效,掉落播放完成后,不消耗go;
    void dropToFloor(GameObject go, object param)
    {
        DropEffect drop = go.AddMissingComponent <DropEffect>();

        if (param == null)
        {
            GameDebug.LogError("error");
            return;
        }

        drop.Play(go.transform.localPosition, (Vector3)param, 1f, false);
    }
Exemplo n.º 7
0
 public Monster(int id, string name, string model, bool isShow, bool isMiss, bool isDrop, bool isAffect, int dieeffect, int disapperWay, int dropEffect, int crashEffect)
 {
     this.id          = id;
     this.Name        = name;
     this.model       = model;
     this.hpShow      = isShow;
     this.miss        = isMiss;
     this.drop        = isDrop;
     this.affect      = isAffect;
     this.dieEffect   = dieeffect;
     this.disapperWay = (DisapperWay)disapperWay;
     this.dropEffect  = (DropEffect)dropEffect;
     this.crashEffect = (CrashEffect)crashEffect;
 }
Exemplo n.º 8
0
        public static void SetFileDropList(DropEffect effect, string[] files)
        {
            files.ThrowIfNull("files");

            IDataObject iDataObj = new DataObject(DataFormats.FileDrop, files);

            MemoryStream dropEffect = new MemoryStream();
            byte[] bytes = new byte[] { (byte)effect, 0, 0, 0 };
            dropEffect.Write(bytes, 0, bytes.Length);
            dropEffect.SetLength(bytes.Length);

            iDataObj.SetData("Preferred DropEffect", dropEffect);
            Clipboard.SetDataObject(iDataObj);
        }
Exemplo n.º 9
0
        /// <summary>
        ///
        /// </summary>
        private void Drop(DropEffect dropEffect)
        {
            var launchKeyEquippable = character.currentEquippable as LaunchKeyEquippable;

            Debug.Assert(launchKeyEquippable != null);

            Telemetry.game.Incr($"launchKey_drop_{dropEffect}");

            switch (dropEffect)
            {
            case DropEffect.InPlace:
                if (character.spawner.GetComponent <Collider2D>().IsTouching(character.GetComponent <Collider2D>()))
                {
                    GameMode.instance.RedeemKey(character);
                }
                else
                {
                    launchKeyEquippable.Drop();
                }
                break;

            case DropEffect.Throw:
            {
                var launchKeyPickable = launchKeyEquippable.Drop();
                var position          = launchKeyPickable.transform.position;
                launchKeyPickable.doFloatingAnimAtStart = false;
                var throwOrientation = character.targetOrientation * DropThrowMultiplier;
                launchKeyPickable.DoJumpAnim(new Vector2(throwOrientation.x + position.x, throwOrientation.y + position.y), launchKeyPickable.DoFloatingAnim);
                break;
            }

            case DropEffect.Hit:
            {
                var launchKeyPickable = launchKeyEquippable.Drop();
                var position          = launchKeyPickable.transform.position;
                launchKeyPickable.doFloatingAnimAtStart = false;
                var targetOrientation = character.isMoving ? character.targetOrientation : Vector2.zero;

                while (targetOrientation == Vector2.zero)
                {
                    targetOrientation = new Vector2(Random.Range(-1.0f, 1.0f), Random.Range(-1.0f, 1.0f));
                }
                targetOrientation.Normalize();

                var hitOrientation = targetOrientation * DropHitMultiplier * (-1.0f);
                launchKeyPickable.DoJumpAnim(new Vector2(hitOrientation.x + position.x, hitOrientation.y + position.y), launchKeyPickable.DoFloatingAnim);
                break;
            }
            }
        }
Exemplo n.º 10
0
        static DragDropEffects GetDragDropEffects(DropEffect effect)
        {
            switch (effect)
            {
            case DropEffect.Copy:
                return(DragDropEffects.Copy);

            case DropEffect.Link:
                return(DragDropEffects.Link);

            case DropEffect.Move:
                return(DragDropEffects.Move);
            }
            return(DragDropEffects.None);
        }
Exemplo n.º 11
0
        public void AddPlots()
        {
            int counter = 0;

            foreach (Vector2 v2 in cPlotPosition.Position)
            {
                Vector2    v3        = new Vector2(v2.X + 25, v2.Y + 25);
                DropEffect greenGlow = new DropEffect(content.Load <Texture2D>(@"SpellAndProjectiles\heal"), v3, 1, 6, 1, 0, 0);

                GraveStone p = new GraveStone(content.Load <Texture2D>(@"UI Content\cursed_grave"), v2, 8, 24, 0, 1, 2, greenGlow, counter);

                p.obj_Selected += new EventHandler(start_Selected);
                objManager.AddLst.Add(p);
                counter++;
            }
        }
Exemplo n.º 12
0
        public static DropEffect ConvertDropEffect(DragDropEffects operation)
        {
            DropEffect result = DropEffect.None;

            if (operation.HasFlag(DragDropEffects.Copy))
            {
                result |= DropEffect.Copy;
            }
            if (operation.HasFlag(DragDropEffects.Move))
            {
                result |= DropEffect.Move;
            }
            if (operation.HasFlag(DragDropEffects.Link))
            {
                result |= DropEffect.Link;
            }
            return(result);
        }
Exemplo n.º 13
0
        public static DragDropEffects ConvertDropEffect(DropEffect effect)
        {
            DragDropEffects result = DragDropEffects.None;

            if (effect.HasFlag(DropEffect.Copy))
            {
                result |= DragDropEffects.Copy;
            }
            if (effect.HasFlag(DropEffect.Move))
            {
                result |= DragDropEffects.Move;
            }
            if (effect.HasFlag(DropEffect.Link))
            {
                result |= DragDropEffects.Link;
            }
            return(result);
        }
Exemplo n.º 14
0
        public override void Drop(IDataObject data, int index, DropEffect finalEffect)
        {
            var paths = data.GetData(typeof(string[])) as string[];

            if (paths != null)
            {
                for (int i = 0; i < paths.Length; i++)
                {
                    var p = paths[i];
                    if (File.Exists(p))
                    {
                        Children.Insert(index + i, new FileNode(p));
                    }
                    else
                    {
                        Children.Insert(index + i, new FolderNode(p));
                    }
                }
            }
        }
Exemplo n.º 15
0
        public void LoadWave()
        {
            int counter = 0;

            lstWave = new List <Wave>();

            GraveStone grave;

            Wave wave = new Wave(dicEnemyTextures, 0, Content, texHPBar, Grid, ObjManager, counter);

            wave.setWave(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 2, 4);
            wave.setTime(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 30, 60);
            wave.Wave_Over += new EventHandler(waveCompleted);
            lstWave.Add(wave);
            counter++;
            Wave wave2 = new Wave(dicEnemyTextures, 2, Content, texHPBar, Grid, ObjManager, counter);

            wave2.setWave(0, 6, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0);
            wave2.setTime(0, 5, 30, 55, 0, 0, 0, 0, 0, 0, 0, 0, 0);
            wave2.Wave_Over += new EventHandler(waveCompleted);
            lstWave.Add(wave2);
            counter++;
            Wave wave3 = new Wave(dicEnemyTextures, 4, Content, texHPBar, Grid, ObjManager, counter);

            wave3.setWave(10, 0, 0, 0, 0, 0, 0, 3, 2, 1, 0, 0, 0);
            wave3.setTime(5, 0, 0, 0, 0, 0, 0, 60, 120, 150, 0, 0, 0);
            wave3.Wave_Over += new EventHandler(waveCompleted);
            counter++;
            Wave wave4 = new Wave(dicEnemyTextures, 6, Content, texHPBar, Grid, ObjManager, counter);

            wave4.setWave(0, 0, 0, 0, 10, 15, 20, 0, 0, 0, 0, 0, 0);
            wave4.setTime(0, 0, 0, 0, 5, 45, 110, 0, 0, 0, 0, 0, 0);
            wave4.Wave_Over    += new EventHandler(waveCompleted);
            greenGlow           = new DropEffect(lstTexRuned[0], new Vector2(300, 75), 1, 6, 1, 0, 0);
            grave               = new GraveStone(texGraveStones, new Vector2(275, 50), 8, 24, 0, 1, 2, greenGlow, counter, wave4);
            grave.obj_Selected += new EventHandler(grave_obj_MouseOver);
            ObjManager.AddLst.Add(grave);
            lstWave.Add(wave4);
            counter = 0;
        }
Exemplo n.º 16
0
        public override void Drop(IDataObject data, int index, DropEffect finalEffect)
        {
            try {
                string insertText = (data.GetData(typeof(string[])) as string[])
                                    .Aggregate((text, part) => text += part);
                ITextAnchor marker;
                int         length = 0;
                if (index == this.Children.Count)
                {
                    if (index == 0)
                    {
                        marker = null;
                    }
                    else
                    {
                        marker = (this.Children[index - 1] as XamlOutlineNode).EndMarker;
                    }
                    if (marker == null)
                    {
                        marker = this.EndMarker;
                        length = -1;                         // move backwards
                    }
                    else
                    {
                        length = 2 + (this.Children[index - 1] as XamlOutlineNode).elementName.Length;
                    }
                }
                else
                {
                    marker = (this.Children[index] as XamlOutlineNode).Marker;
                }

                int offset = marker.Offset + length;
                Editor.Document.Insert(offset, insertText);
            } catch (Exception ex) {
                throw ex;
            }
        }
Exemplo n.º 17
0
 public virtual void Drop(IDataObject data, int index, DropEffect finalEffect)
 {
     throw new NotSupportedException(GetType().Name + " does not support Drop()");
 }
Exemplo n.º 18
0
 public virtual DropEffect CanDrop(IDataObject data, DropEffect requestedEffect)
 {
     return(DropEffect.None);
 }
Exemplo n.º 19
0
        UnmanagedMethods.HRESULT IDropTarget.Drop(IOleDataObject pDataObj, int grfKeyState, long pt, ref DropEffect pdwEffect)
        {
            try
            {
                var dispatch = _tl?.Input;
                if (dispatch == null)
                {
                    pdwEffect = DropEffect.None;
                    return(UnmanagedMethods.HRESULT.S_OK);
                }

                _currentDrag = pDataObj as IDataObject;
                if (_currentDrag == null)
                {
                    _currentDrag = new OleDataObject(pDataObj);
                }

                var args = new RawDragEvent(
                    _dragDevice,
                    RawDragEventType.Drop,
                    _target,
                    GetDragLocation(pt),
                    _currentDrag,
                    ConvertDropEffect(pdwEffect),
                    ConvertKeyState(grfKeyState)
                    );
                dispatch(args);
                pdwEffect = ConvertDropEffect(args.Effects);

                return(UnmanagedMethods.HRESULT.S_OK);
            }
            finally
            {
                _currentDrag = null;
            }
        }
Exemplo n.º 20
0
 public int GiveFeedback(DropEffect dwEffect)
 {
     return(DRAGDROP_S_USEDEFAULTCURSORS);
 }
Exemplo n.º 21
0
 public virtual void Drop(IDataObject data, int index, DropEffect finalEffect)
 {
 }
 public FolderAddition(ProjectNode project, string newFolderPath, string sourceFolder, DropEffect dropEffect, Addition[] additions) {
     Project = project;
     NewFolderPath = newFolderPath;
     SourceFolder = sourceFolder;
     Additions = additions;
     DropEffect = dropEffect;
 }
        /// <summary>
        /// Moves files from one part of our project to another.
        /// </summary>
        /// <param name="targetNode">the targetHandler node</param>
        /// <param name="projectReferences">List of projectref string</param>
        /// <returns>true if succeeded</returns>
        internal bool AddFilesFromProjectReferences(HierarchyNode targetNode, string[] projectReferences, bool mouseDropping, DropEffect dropEffect) {
            //Validate input
            Utilities.ArgumentNotNull("projectReferences", projectReferences);
            Utilities.CheckNotNull(targetNode);

            if (!QueryEditProjectFile(false)) {
                throw Marshal.GetExceptionForHR(VSConstants.OLE_E_PROMPTSAVECANCELLED);
            }

            return new ProjectReferenceFileAdder(this, targetNode, projectReferences, mouseDropping, dropEffect).AddFiles();
        }
 public OverwriteFileAddition(ProjectNode project, string targetFolder, DropEffect dropEffect, string sourceMoniker, string newFileName, IVsProject sourceHierarchy)
     : base(project, targetFolder, dropEffect, sourceMoniker, newFileName, sourceHierarchy) {
 }
Exemplo n.º 25
0
        public ClipboardEntryLogic(Image ico)
        {
            _icoAppFrom = (Image)ico.Clone();

            ClipboardDataObject = Clipboard.GetDataObject();
            _svFormats          = ClipboardDataObject.GetFormats(true);
            if (_svFormats == null || _svFormats.Length == 0)
            {
                Thread.Sleep(100);
                ClipboardDataObject = Clipboard.GetDataObject();
                _svFormats          = ClipboardDataObject.GetFormats(true);
            }

            _desc = "[Clipboard data is not RTF or ASCII Text]";
            if (ClipboardDataObject.GetDataPresent(DataFormats.Rtf.ToString()))             // Clipboard.ContainsText(TextDataFormat.Rtf) )
            {
                _dataType    = DataFormats.Rtf;
                _data        = ClipboardDataObject.GetData(DataFormats.Rtf.ToString());         // Clipboard.GetText(TextDataFormat.Rtf);
                _icoItemType = 2;

                m_RtfBox.Rtf = (string)_data;
                _desc        = m_RtfBox.Text;
                if (_desc.Trim().Length == 0)
                {
                    _desc = "--Rtf Binary--";
                }

                //if there is 'international' string that cannot be translated
                if (_desc.IndexOf("???") >= 0 && ClipboardDataObject.GetDataPresent(DataFormats.UnicodeText.ToString()))
                {
                    UnicodeTextInit(ClipboardDataObject);
                }
            }                                                                                //end if
            else if (ClipboardDataObject.GetDataPresent(DataFormats.UnicodeText.ToString())) //Clipboard.ContainsText(TextDataFormat.UnicodeText) )
            {
                UnicodeTextInit(ClipboardDataObject);
            }                                                                         //end else if
            else if (ClipboardDataObject.GetDataPresent(DataFormats.Text.ToString())) // Clipboard.ContainsText(TextDataFormat.Text) )
            {
                _dataType    = DataFormats.Text;
                _data        = ClipboardDataObject.GetData(DataFormats.Text.ToString());         //  Clipboard.GetText(TextDataFormat.Text);
                _icoItemType = 0;

                _desc = (string)_data;
            }                                                                           //end else if
            else if (ClipboardDataObject.GetDataPresent(DataFormats.Bitmap.ToString())) //  Clipboard.ContainsImage() )
            {
                _dataType    = DataFormats.Bitmap;
                _data        = ClipboardDataObject.GetData(_dataType);         // Clipboard.GetImage();
                _icoItemType = 3;

                Image bmp = (Image)_data;
                if (bmp != null)
                {
                    _desc = "Bitmap: " + bmp.Width + "x" + bmp.Height;
                }
                else
                {
                    _desc = "Bitmap: Unknown";
                }
            }                                                                             //end else if
            else if (ClipboardDataObject.GetDataPresent(DataFormats.FileDrop.ToString())) //  Clipboard.ContainsFileDropList() )
            {
                DropEffect flag = DropEffect.DROPEFFECT_NONE;
                //MemoryStream streamType = (MemoryStream)Clipboard.GetData("Preferred DropEffect");
                MemoryStream streamType = (MemoryStream)ClipboardDataObject.GetData("Preferred DropEffect");
                if (streamType != null)
                {
                    flag = (DropEffect)streamType.ReadByte();
                }

                bool move = flag.HasFlag(DropEffect.DROPEFFECT_MOVE);
                bool copy = flag.HasFlag(DropEffect.DROPEFFECT_COPY);

                _dataType = DataFormats.FileDrop;
                _data     = ClipboardDataObject.GetData(DataFormats.FileDrop.ToString());            // Clipboard.GetData(DataFormats.FileDrop);

                string[] svFiles = (string[])_data;
                _icoItemType = 4;
                if (copy)
                {
                    _icoItemType = svFiles.Length == 1 ? 6 : 8;
                }
                else if (move)
                {
                    _icoItemType = svFiles.Length == 1 ? 7 : 9;
                }

                _desc = FileDropListDesc(svFiles);
            }            //end else if
            else         //Unsupported format or empty
            {
                _data        = null;
                _icoItemType = 5;

                if (_svFormats.Length > 0)
                {
                    _desc = "--Unsupported format: " + _svFormats[0] + "--";
                }
                else
                {
                    _desc = "--Empty--";
                }

                System.Diagnostics.Trace.WriteLine(
                    "ClipboardEntry::constructor - Unsupported clipboard format",
                    "ClipboardEntry");
            }    //end else
        }        //end constructor
Exemplo n.º 26
0
 public virtual DropEffect CanDrop(IDataObject data, DropEffect requestedEffect)
 {
     return DropEffect.None;
 }
 public FileAddition(ProjectNode project, string targetFolder, DropEffect dropEffect, string sourceMoniker, string newFileName, IVsProject sourceHierarchy) {
     Project = project;
     TargetFolder = targetFolder;
     DropEffect = dropEffect;
     SourceMoniker = sourceMoniker;
     SourceHierarchy = sourceHierarchy;
     NewFileName = newFileName;
 }
Exemplo n.º 28
0
 static DragDropEffects GetDragDropEffects(DropEffect effect)
 {
     switch (effect) {
         case DropEffect.Copy:
             return DragDropEffects.Copy;
         case DropEffect.Link:
             return DragDropEffects.Link;
         case DropEffect.Move:
             return DragDropEffects.Move;
     }
     return DragDropEffects.None;
 }
        /// <summary>
        /// Process dataobject from Drag/Drop/Cut/Copy/Paste operation
        /// 
        /// drop indicates if it is a drag/drop or a cut/copy/paste.
        /// </summary>
        /// <remarks>The targetNode is set if the method is called from a drop operation, otherwise it is null</remarks>
        internal DropDataType ProcessSelectionDataObject(IOleDataObject dataObject, HierarchyNode targetNode, bool drop, DropEffect dropEffect) {
            Utilities.ArgumentNotNull("targetNode", targetNode);

            DropDataType dropDataType = DropDataType.None;
            bool isWindowsFormat = false;

            // Try to get it as a directory based project.
            List<string> filesDropped = DragDropHelper.GetDroppedFiles(DragDropHelper.CF_VSSTGPROJECTITEMS, dataObject, out dropDataType);
            if (filesDropped.Count == 0) {
                filesDropped = DragDropHelper.GetDroppedFiles(DragDropHelper.CF_VSREFPROJECTITEMS, dataObject, out dropDataType);
            }
            if (filesDropped.Count == 0) {
                filesDropped = DragDropHelper.GetDroppedFiles(NativeMethods.CF_HDROP, dataObject, out dropDataType);
                isWindowsFormat = (filesDropped.Count > 0);
            }

            if (dropDataType != DropDataType.None && filesDropped.Count > 0) {
                string[] filesDroppedAsArray = filesDropped.ToArray();

                HierarchyNode node = targetNode;

                // For directory based projects the content of the clipboard is a double-NULL terminated list of Projref strings.
                if (isWindowsFormat) {
                    DropFilesOrFolders(filesDroppedAsArray, node);

                    return dropDataType;
                } else {
                    if (AddFilesFromProjectReferences(node, filesDroppedAsArray, drop, dropEffect)) {
                        return dropDataType;
                    }
                }
            }

            // If we reached this point then the drop data must be set to None.
            // Otherwise the OnPaste will be called with a valid DropData and that would actually delete the item.
            return DropDataType.None;
        }
Exemplo n.º 30
0
        public void Update(GameTime gameTime)
        {
            //fires events for all objects
            if (Enabled)
            {
                foreach (GameObject obj in this)
                {
                    if (isWin)
                    {
                        if (skellyList.Count == 0)
                        {
                            obj.OnWin(null);
                        }
                    }
                    if (obj.Location.Contains(new Point(Mouse.GetState().X, Mouse.GetState().Y)) && obj.IsEnabled)
                    {
                        obj.OnMouseOver(null);
                    }
                    if (!obj.Location.Contains(new Point(Mouse.GetState().X, Mouse.GetState().Y)) && obj.MouseOver == true && obj.IsEnabled)
                    {
                        obj.OnMouseLeave(null);
                    }

                    if (!obj.IsLocked && obj.IsEnabled)
                    {
                        if (obj.MouseOver == true && !btnDown && Mouse.GetState().LeftButton == ButtonState.Pressed)
                        {
                            obj.OnSelected(null);
                            btnDown = true;
                        }
                    }
                    if (Mouse.GetState().LeftButton == ButtonState.Released && btnDown == true)
                    {
                        btnDown = false;
                    }
                    if (!obj.IsLocked && obj.IsEnabled)
                    {
                        if (obj.MouseOver == true && !btnRightDown && Mouse.GetState().RightButton == ButtonState.Pressed)
                        {
                            obj.OnRightClick(null);
                            btnRightDown = true;
                        }
                    }
                    if (Mouse.GetState().RightButton == ButtonState.Released && btnRightDown == true)
                    {
                        btnRightDown = false;
                    }
                    if (obj.IsEnabled)
                    {
                        obj.Update(gameTime);
                    }
                    if (obj.IsDead)
                    {
                        RemoveLst.Add(obj);
                    }
                    if (obj.Type == "MessageBox" && !obj.MouseOver && Mouse.GetState().LeftButton == ButtonState.Pressed && btnDown == false)
                    {
                        btnDown    = true;
                        obj.IsDead = true;
                        unlockPlots();
                        removeConainers();
                    }
                    if (obj.Type == "Projectile")
                    {
                        Projectile p = (Projectile)obj;
                        if (p.Explosion)
                        {
                            foreach (Square sq in Grid.SquareList)
                            {
                                if (skellyList.Count != 0)
                                {
                                    foreach (Skeleton s in skellyList)
                                    {
                                        if (p.Location.Contains(new Point((int)s.Origin.X, (int)s.Origin.Y)))
                                        {
                                            s.TakeDamage(p.Damage);
                                        }
                                    }
                                    p.Damage = 0;
                                }
                            }
                        }
                    }
                    if (obj.Type == "Skelly")
                    {
                        Skeleton s = (Skeleton)obj;
                        if (skellyList.Count != 0)
                        {
                            foreach (Skeleton sL in skellyList)
                            {
                                if (s.EnemyId == sL.EnemyId)
                                {
                                    s.CurrentHealth = sL.CurrentHealth;
                                }
                            }
                        }
                    }
                    if (obj.Type == "Wave")
                    {
                        Wave w = (Wave)obj;
                        if (w.checkEnd())
                        {
                            w.Wave_completed(w, null);
                        }
                    }
                }
                //if (Grid != null)
                //{
                //    foreach (Square sq in Grid.SquareList)
                //    {
                //        sq.Damage = 0;
                //    }
                //}
                if (MageLst.Count != 0)
                {
                    foreach (MageTower m in MageLst)
                    {
                        foreach (Skeleton s in skellyList)
                        {
                            if (m.CircleRectangle.Contains((int)s.Origin.X, (int)s.Origin.Y) && m.CoolDown >= m.FireTime)
                            {
                                //Bullet b = new Bullet(projectiles[0], 8, m.FirePoint, s.Origin, s.EnemyId, this,Grid);

                                if (!m.isIce)
                                {
                                    plist.Add(new Projectile(projectiles[0], 8, projectiles[1], 4, 3, m.FirePoint, s.EnemyId, this, Grid, 4f, m.Damage, 1));
                                }
                                else
                                {
                                    plist.Add(new Projectile(projectiles[3], 8, projectiles[4], 3, 6, m.FirePoint, s.EnemyId, this, Grid, 5f, m.Damage, 0));
                                }
                                m.shots--;

                                m.CoolDown = 0;
                            }
                        }
                    }
                }
                //adds new items after updating
                foreach (GameObject obj in AddLst)
                {
                    this.Add(obj);
                    if (obj.IsTower)
                    {
                        MageLst.Add((MageTower)obj);
                    }
                    if (obj.IsEnemy)
                    {
                        skellyList.Add((Skeleton)obj);
                    }
                }
                if (plist != null)
                {
                    foreach (Projectile p in plist)
                    {
                        this.Add(p);
                    }
                    plist.Clear();
                }

                AddLst.Clear();
                //removes items after updating
                foreach (GameObject obj in RemoveLst)
                {
                    if (obj.IsTower)
                    {
                        MageLst.Remove((MageTower)obj);
                    }
                    if (obj.IsEnemy)
                    {
                        Skeleton   s = (Skeleton)obj;
                        DropEffect goldDrop;
                        if (s.Gold < 50)
                        {
                            goldDrop = new DropEffect(EffectList[0], new Vector2(s.Position.X, s.Position.Y - 10), 1, 6, 0, 4, 4);
                        }
                        else if (s.Gold >= 50 && s.Gold < 150)
                        {
                            goldDrop = new DropEffect(EffectList[0], new Vector2(s.Position.X, s.Position.Y - 10), 1, 6, 0, 4, 4);
                        }
                        else
                        {
                            goldDrop = new DropEffect(EffectList[0], new Vector2(s.Position.X, s.Position.Y - 10), 1, 6, 0, 4, 4);
                        }

                        this.addLst.Add(goldDrop);
                        if (s.CurrentHealth > 0)
                        {
                            skellyList.Remove((Skeleton)obj);
                            DamageGiven += s.PassDamage;
                        }
                        else
                        {
                            skellyList.Remove((Skeleton)obj);
                            MoneyGain += s.Gold;
                        }
                    }
                    if (obj.Type == "GraveStone")
                    {
                        isWin = true;
                    }
                    this.Remove(obj);
                }
                RemoveLst.Clear();
            }
        }
            public ProjectReferenceFileAdder(ProjectNode project, HierarchyNode targetNode, string[] projectReferences, bool mouseDropping, DropEffect dropEffect) {
                Utilities.ArgumentNotNull("targetNode", targetNode);
                Utilities.ArgumentNotNull("project", project);
                Utilities.ArgumentNotNull("projectReferences", projectReferences);

                TargetNode = targetNode;
                Project = project;
                ProjectReferences = projectReferences;
                MouseDropping = mouseDropping;
                DropEffect = dropEffect;
            }
Exemplo n.º 32
0
		public override DropEffect CanDrop(IDataObject data, DropEffect requestedEffect)
		{
			return  DropEffect.None; //DropEffect.Move;
		}
Exemplo n.º 33
0
 public override DropEffect CanDrop(IDataObject data, DropEffect requestedEffect)
 {
     return(DropEffect.None);             //DropEffect.Move;
 }
Exemplo n.º 34
0
        /// <summary>
        /// Sets the specified <see cref="dropEffect"/> value on the dataTransfer property in the dragover event to the specified value.
        /// </summary>
        /// <param name="source"></param>
        /// <param name="dropEffect"></param>
        /// <remarks>https://developer.mozilla.org/en-US/docs/Web/API/DataTransfer/dropEffect</remarks>
        /// <returns></returns>
        public static DropEventsOptions SetDragOverDataTransferDropEffect(this DropEventsOptions source, DropEffect dropEffect)
        {
            if (source is null)
            {
                throw new System.ArgumentNullException(nameof(source));
            }

            if (!dropeffectDomstringValues.TryGetValue(dropEffect, out var value))
            {
                throw new System.ArgumentException($"{dropEffect} is not a valid value for parameter {nameof(dropEffect)}", nameof(dropEffect));
            }

            source.OnDragOverScript = @$ "(dragEvent) => {{
                if (dragEvent.dataTransfer) {{
                    dragEvent.dataTransfer.dropEffect = " "{value}" ";
                }}
            }}";
Exemplo n.º 35
0
 public virtual void Drop(IDataObject data, int index, DropEffect finalEffect)
 {
 }
Exemplo n.º 36
0
		public override void Drop(IDataObject data, int index, DropEffect finalEffect)
		{
			var paths = data.GetData(typeof(string[])) as string[];
			if (paths != null) {
				for (int i = 0; i < paths.Length; i++) {
					var p = paths[i];
					if (File.Exists(p)) {
						Children.Insert(index + i, new FileNode(p));
					}
					else {
						Children.Insert(index + i, new FolderNode(p));
					}
				}
			}
		}