예제 #1
0
        public virtual void Drop(DropInfo dropInfo)
        {
            int insertIndex = dropInfo.InsertIndex;
            IList destinationList = GetList(dropInfo.TargetCollection);
            IEnumerable data = ExtractData(dropInfo.Data);

            if (dropInfo.DragInfo.VisualSource == dropInfo.VisualTarget)
            {
                IList sourceList = GetList(dropInfo.DragInfo.SourceCollection);

                foreach (object o in data)
                {
                    int index = sourceList.IndexOf(o);

                    if (index != -1)
                    {
                        sourceList.RemoveAt(index);
                        
                        if (sourceList == destinationList && index < insertIndex)
                        {
                            --insertIndex;
                        }
                    }
                }
            }

            foreach (object o in data)
            {
                destinationList.Insert(insertIndex++, o);
            }
        }
        public override void OnDrop(DropInfo dropInfo)
        {

            #region Implement Your OnDrop Here

            if (dropInfo.TargetModel != null)
            {
                if (dropInfo.TargetModel is MapView)
                {
                    MapView view = dropInfo.TargetModel as MapView;
                    // globe or local
                    if (view.ViewingMode == MapViewingMode.SceneGlobal ||
                        view.ViewingMode == MapViewingMode.SceneLocal)
                    {
                        //we are in 3D
                        OnDrop3D(dropInfo);
                    }
                    else
                    {
                        //we are in 2D
                        OnDrop2D(dropInfo);
                    }
                }
            }
            #endregion

            dropInfo.Handled = true;
        }
        private async void OnDrop2D(DropInfo dropInfo)
        {

            string xlsName = dropInfo.Items[0].Data.ToString();
            string xlsLayerName = Module1.GetUniqueLayerName(xlsName);
            string xlsSheetName = Module1.GetUniqueStandaloneTableName(xlsName);
            string xlsTableName = xlsName + "\\" + xlsSheetName;

            // set overwrite flag           
            var environments = Geoprocessing.MakeEnvironmentArray(overwriteoutput: true);

            #region Geoprocessing.ExecuteToolAsync(MakeXYEventLayer_management)

            var result = await Geoprocessing.ExecuteToolAsync("MakeXYEventLayer_management", new string[] {
                xlsTableName,
                "POINT_X",
                "POINT_Y",
                xlsLayerName,
                "WGS_1984"
            }, environments);

            #endregion

            #region Assign Symbology (from Location layer)

            await Geoprocessing.ExecuteToolAsync("ApplySymbologyFromLayer_management", new string[] {
              xlsLayerName, 
              @"C:\Data\SDK\Default2DPointSymbols.lyrx"
            });

            #endregion

        }
예제 #4
0
 public virtual void DragOver(DropInfo dropInfo)
 {
     if (CanAcceptData(dropInfo))
     {
         dropInfo.Effects = DragDropEffects.Copy;
         dropInfo.DropTargetAdorner = DropTargetAdorners.Insert;
     }
 }
예제 #5
0
 public void Collected(DropInfo info)
 {
     if(DataHolder.GameSettings().saveDrops && this.drops.ContainsKey(Application.loadedLevelName))
     {
         ArrayList scene = (ArrayList)this.drops[Application.loadedLevelName];
         this.drops.Remove(Application.loadedLevelName);
         scene.Remove(info);
         this.drops.Add(Application.loadedLevelName, scene);
     }
 }
        private async void OnDrop2D(DropInfo dropInfo)
        {
            #region Create layers for the XLS file 
            String Path = Project.Current.DefaultGeodatabasePath + "\\Campings_FGDB";
            // Delete the feature class "Campings_FGDB" if exists 
            var result = await Geoprocessing.ExecuteToolAsync("management.Delete", new string[] {
            Path, "FeatureClass"});

            // Add the xy event layer layer 
            string xlsLayerName = await CreateTheXYEventLayer(dropInfo);

            // Copy  feature from xy evant layer to the feature class 
            result = await Geoprocessing.ExecuteToolAsync("management.CopyFeatures", new string[] {
            xlsLayerName, Path});
            #endregion

            #region Assign Symbology (from Location layer)
            if (!result.IsFailed)
            {
                String path = Project.Current.HomeFolderPath; 
                // 1st way  execute the geoprocessing
                result = await Geoprocessing.ExecuteToolAsync("management.ApplySymbologyFromLayer", new string[] {
                "Campings_FGDB", path+@"/Symbology2D.lyrx"});

                // 2nd way to execute the geoprocessing
                /*
          
                var valueArray = await QueuedTask.Run(() =>
                {
                    var g = new List<object>() { "Campings_FGDB", };

                    var symbologyLayer = path+@"/Symbology2D.lyrx";

                    return Geoprocessing.MakeValueArray(g, symbologyLayer);
                });
            
                 var result =await Geoprocessing.ExecuteToolAsync("management.ApplySymbologyFromLayer", valueArray);

                */
            }
            #endregion
        }
예제 #7
0
 protected static bool CanAcceptData(DropInfo dropInfo)
 {
     if (dropInfo.DragInfo.SourceCollection == dropInfo.TargetCollection)
     {
         return GetList(dropInfo.TargetCollection) != null;
     }
     else if (dropInfo.DragInfo.SourceCollection is ItemCollection)
     {
         return false;
     }
     else
     {
         if (TestCompatibleTypes(dropInfo.TargetCollection, dropInfo.Data))
         {
             return !IsChildOf(dropInfo.VisualTargetItem, dropInfo.DragInfo.VisualSourceItem);
         }
         else
         {
             return false;
         }
     }
 }
예제 #8
0
    public void Drop(Vector3 position, int moneyAmount)
    {
        // drop to world
        DropInfo info = new DropInfo(position, moneyAmount);
        info.Drop();

        // save position
        if(DataHolder.GameSettings().saveDrops)
        {
            ArrayList scene = null;
            if(this.drops.ContainsKey(Application.loadedLevelName))
            {
                scene = (ArrayList)this.drops[Application.loadedLevelName];
                this.drops.Remove(Application.loadedLevelName);
            }
            else
            {
                scene = new ArrayList();
            }
            scene.Add(info);
            this.drops.Add(Application.loadedLevelName, scene);
        }
    }
        void IDropTarget.Drop(DropInfo dropInfo)
        {
            if (dropInfo.DragInfo == null)
            {
                return;
            }

            ListBox lbSource = dropInfo.DragInfo.VisualSource as ListBox;
            ListBox lbTarget = dropInfo.VisualTarget as ListBox;

            int insertIndex = dropInfo.InsertIndex;
            IList <CardViewModel>       sourceList      = null;
            IList <CardViewModel>       destinationList = GetList(dropInfo.TargetCollection);
            IEnumerable <CardViewModel> data            = ExtractData(dropInfo.Data);

            if (lbSource != null && lbTarget != null && lbSource.DataContext.GetType() == lbTarget.DataContext.GetType())
            {
                sourceList = GetList(dropInfo.DragInfo.SourceCollection);
            }

            if (this.PreserveSourceOrdering)
            {
                foreach (CardViewModel o in data)
                {
                    sourceList.Remove(o);

                    insertIndex = -1;
                    if (destinationList.Count > 0)
                    {
                        insertIndex = destinationList.Max(cvm => cvm.OriginalIndex < o.OriginalIndex ? destinationList.IndexOf(cvm) : -1);
                    }
                    if (insertIndex == -1)
                    {
                        destinationList.Insert(0, o);
                    }
                    else if (insertIndex == destinationList.Count - 1)
                    {
                        destinationList.Add(o);
                    }
                    else
                    {
                        destinationList.Insert(insertIndex + 1, o);
                    }
                }
            }
            else
            {
                if (sourceList != null)
                {
                    foreach (CardViewModel o in data)
                    {
                        int index = sourceList.IndexOf(o);

                        if (index != -1)
                        {
                            sourceList.RemoveAt(index);

                            if (sourceList == destinationList && index < insertIndex)
                            {
                                --insertIndex;
                            }
                        }
                    }
                }

                foreach (CardViewModel o in data)
                {
                    destinationList.Insert(insertIndex++, o);
                }
            }
        }
예제 #10
0
        private void LoadDrops()
        {
            DropGroups = new Dictionary <string, DropGroupInfo>();
            try
            {
                DataTable dropgroupinfoData = null;
                DataTable itemdroptableData = null;
                using (var dbClient = Program.DatabaseManager.GetClient())
                {
                    dropgroupinfoData = dbClient.ReadDataTable("SELECT  *FROM dropgroupinfo");
                    itemdroptableData = dbClient.ReadDataTable("SELECT  *FROM itemdroptable");
                }

                if (dropgroupinfoData != null)
                {
                    foreach (DataRow row in dropgroupinfoData.Rows)
                    {
                        var info = DropGroupInfo.Load(row);
                        if (DropGroups.ContainsKey(info.GroupID))
                        {
                            //Log.WriteLine(LogLevel.Warn, "Duplicate DropGroup ID found: {0}.", info.GroupID);
                            continue;
                        }

                        DropGroups.Add(info.GroupID, info);
                    }
                }

                var dropcount = 0;
                if (itemdroptableData != null)
                {
                    foreach (DataRow row in itemdroptableData.Rows)
                    {
                        var     mobid = (string)row["MobId"];
                        MobInfo mob;
                        if (MobsByName.TryGetValue(mobid, out mob))
                        {
                            mob.MinDropLevel = (byte)row["MinLevel"];
                            mob.MaxDropLevel = (byte)row["MaxLevel"];
                            var dropgroup = (string)row["GroupID"];
                            if (dropgroup.Length <= 2)
                            {
                                continue;
                            }
                            DropGroupInfo group;
                            if (DropGroups.TryGetValue(dropgroup, out group))
                            {
                                var rate = (float)row["Rate"];
                                var info = new DropInfo(group, rate);
                                mob.Drops.Add(info);
                                ++dropcount;
                            }
                        }

                        // else  Log.WriteLine(LogLevel.Warn, "Could not find mobname: {0} for drop.", mobid);
                    }
                }

                //first we load the dropgroups
                Log.WriteLine(LogLevel.Info, "Loaded {0} DropGroups, with {1} drops in total.", DropGroups.Count,
                              dropcount);
            }
            catch (Exception ex)
            {
                Log.WriteLine(LogLevel.Exception, "Error loading DropTable: {0}", ex);
            }
        }
 public static List <T> GetTOCContentOfType <T>(this DropInfo dropInfo) where T : MapMember
 {
     return(GetTOCContent(dropInfo).OfType <T>()?.ToList() ?? new List <T>());
 }
예제 #12
0
 public void Drop (DropInfo dropInfo)
 {
     var sourceIndex = CurrentJuji.Steps.IndexOf(dropInfo.Data as  RunCommand );
     if(sourceIndex <0)
         return;
     var targetIndex = dropInfo.InsertIndex-1;
     if(targetIndex < 0)
         targetIndex = 0;
     CurrentJuji.Steps.Move(sourceIndex,targetIndex); 
 }
예제 #13
0
 public override void OnDragOver(DropInfo dropInfo)
 {
     //default is to accept our data types
     dropInfo.Effects = DragDropEffects.All;
 }
예제 #14
0
        static void DropTarget_PreviewDrop(object sender, DragEventArgs e)
        {
            DropInfo dropInfo = new DropInfo(sender, e, m_DragInfo, m_Format.Name);
            IDropTarget dropHandler = GetDropHandler((UIElement)sender);

            DragAdorner = null;
            DropTargetAdorner = null;

            if (dropHandler != null)
            {
                dropHandler.Drop(dropInfo);
            }
            else
            {
                DefaultDropHandler.Drop(dropInfo);
            }

            e.Handled = true;
        }
예제 #15
0
 public AllowDropAdorner(UIElement adornedElement, DropInfo dropInfo) : base(adornedElement, dropInfo)
 {
 }
예제 #16
0
        void IDropTarget.Drop(DropInfo dropInfo)
        {
            var msp = (Msp)dropInfo.Data;

            ((IList)dropInfo.DragInfo.SourceCollection).Remove(msp);
        }
예제 #17
0
파일: MapInfo.cs 프로젝트: tapenjoyGame/cry
 public List <RewardLoot> DropItems()
 {
     return(DropInfo.SelectMany(d => d.groups.SelectMany(g => g.rewards)).Reverse().ToList());
 }
 public override void OnDragOver(DropInfo dropInfo)
 {
     dropInfo.Effects = DragDropEffects.All;
 }
예제 #19
0
 public ChromerDropTargetHighlightAdorner(UIElement adornedElement, DropInfo dropInfo)
     : base(adornedElement, dropInfo)
 {
     Pen = new Pen(new SolidColorBrush(Color.FromArgb(255, 0, 220, 255)), 2);
 }
예제 #20
0
 public void DragOver(DropInfo info)
 {
 }
예제 #21
0
 public void DragLeave(DropInfo info)
 {
 }
예제 #22
0
 public void DragEnter(DropInfo info)
 {
 }
 public override void OnDragOver(DropInfo dropInfo)
 {
     dropInfo.Effects = DragDropEffects.All;
 }
예제 #24
0
 public void DragEnter(DropInfo info)
 {
     _mouseOn   = true;
     _startTick = Environment.TickCount;
 }
        private static async Task<string> CreateTheXYEventLayer(DropInfo dropInfo)
        {
            string xlsName = dropInfo.Items[0].Data.ToString();
            string xlsLayerName = Module1.GetUniqueLayerName(xlsName);
            string xlsTableName = null;
            if (xlsName.ToUpper().EndsWith(".CSV"))
            {
                xlsTableName = xlsName;
            }
            else
            {
                string xlsSheetName = Module1.GetUniqueStandaloneTableName(xlsName);
                xlsTableName = xlsName + "\\" + xlsSheetName;
            }

            // set overwrite flag           
            var environments = Geoprocessing.MakeEnvironmentArray(overwriteoutput: true);

            #region Geoprocessing.ExecuteToolAsync(MakeXYEventLayer_management)

            var result = await Geoprocessing.ExecuteToolAsync("MakeXYEventLayer_management", new string[] {
                xlsTableName,
                "X",
                "Y",
                xlsLayerName,
                "WGS_1984"
            }, environments);

            #endregion
            return xlsLayerName;
        }
        private async void OnDrop3D(DropInfo dropInfo)
        {
            String path = Project.Current.HomeFolderPath; 
            string xlsLayerName = await CreateTheXYEventLayer(dropInfo);

            #region await Geoprocessing.ExecuteToolAsync(ApplySymbologyFromLayer_management)

            var result = await Geoprocessing.ExecuteToolAsync("ApplySymbologyFromLayer_management", new string[] {
              xlsLayerName, 
              path+@"/Symbology3D.lyrx"
            });

            #endregion
        }
예제 #27
0
    private void OnData(DataStreamReader stream)
    {
        NativeArray <byte> message = new NativeArray <byte>(stream.Length, Allocator.Temp);

        stream.ReadBytes(message);
        string returnData = Encoding.ASCII.GetString(message.ToArray());

        NetworkHeader header = new NetworkHeader();

        try
        {
            header = JsonUtility.FromJson <NetworkHeader>(returnData);
        }
        catch (System.ArgumentException e)
        {
            Debug.LogError(e.ToString() + "\nHeader loading failed. Disconnect");
            Disconnect();
            return;
        }

        try
        {
            switch (header.cmd)
            {
            case Command.Start:
                StartInfo startInfo = JsonUtility.FromJson <StartInfo>(returnData);
                GameManager.instance.CreatePlayer();
                break;

            case Command.Connect:
                ConnectInfo connectInfo = JsonUtility.FromJson <ConnectInfo>(returnData);
                ID = connectInfo.playerID;
                UIManager.instance.ChangeBackground(ID);
                Debug.Log(ID);
                break;

            case Command.Drop:
                DropInfo dropInfo = JsonUtility.FromJson <DropInfo>(returnData);
                //TODO Game end
                break;

            case Command.Turn:
                Turn turn = JsonUtility.FromJson <Turn>(returnData);
                GameManager.instance.Turn(turn.playerID == ID);
                break;

            case Command.Result:
                Result result = JsonUtility.FromJson <Result>(returnData);
                GridManager.instance.ReflectResult(result);
                break;

            case Command.Timer:
                Timer timer = JsonUtility.FromJson <Timer>(returnData);
                TimerScript.instance.UpdateTimer(timer.timer);
                break;

            case Command.Chat:
                Chat chat = JsonUtility.FromJson <Chat>(returnData);
                //chat.chatMessage = chat.RemoveQuestionMark(chat.chatMessage);
                Debug.Log("Chat " + chat.chatMessage);
                ChatScript.instance.AddText(chat.chatMessage);
                break;

            default:
                Debug.Log("Error");
                break;
            }
        }
        catch (System.Exception e)
        {
            Debug.LogError(e.ToString() + "\nMessage contents loading failed. Disconnecting.\nReturn Data : " + returnData);
            Disconnect();
            return;
        }
    }
예제 #28
0
 public ForbidDropAdorner(UIElement adornedElement, DropInfo dropInfo) : base(adornedElement, dropInfo)
 {
 }
예제 #29
0
	//==============: get,set method :========================================================================================



	//==============: factory method :========================================================================================

	static public DropInfo Create()
	{
		DropInfo newObj = new DropInfo ();
		newObj.Init ();

		return newObj;
	}
예제 #30
0
 public void DragOver (DropInfo dropInfo)
 {
     dropInfo.DropTargetAdorner = DropTargetAdorners.Highlight;
     dropInfo.Effects = DragDropEffects.Move;
 }
예제 #31
0
        void IDropTarget.DragOver(DropInfo drop_info)
        {
            log.Trace("DragOver");

            default_drop_handler.DragOver(drop_info);
        }
예제 #32
0
        public override bool Harvest(PlayerObject player)
        {
            if (RemainingSkinCount == 0)
            {
                for (int i = _drops.Count - 1; i >= 0; i--)
                {
                    if (player.CheckGroupQuestItem(_drops[i]))
                    {
                        _drops.RemoveAt(i);
                    }
                    else
                    {
                        if (player.CanGainItem(_drops[i]))
                        {
                            player.GainItem(_drops[i]);
                            _drops.RemoveAt(i);
                        }
                    }
                }

                if (_drops.Count == 0)
                {
                    Harvested = true;
                    _drops    = null;
                    Broadcast(new S.ObjectHarvested {
                        ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation
                    });
                }
                else
                {
                    player.ReceiveChat("You cannot carry anymore.", ChatType.System);
                }

                return(true);
            }

            if (--RemainingSkinCount > 0)
            {
                return(true);
            }


            _drops = new List <UserItem>();

            for (int i = 0; i < Info.Drops.Count; i++)
            {
                DropInfo drop = Info.Drops[i];

                int rate = (int)(drop.Chance / Settings.DropRate); if (rate < 1)
                {
                    rate = 1;
                }
                if (drop.Gold > 0 || Envir.Random.Next(rate) != 0)
                {
                    continue;
                }

                UserItem item = Envir.CreateDropItem(drop.Item);
                if (item == null)
                {
                    continue;
                }

                if (drop.QuestRequired)
                {
                    if (!player.CheckGroupQuestItem(item, false))
                    {
                        continue;
                    }
                }

                if (item.Info.Type == ItemType.Meat)
                {
                    item.CurrentDura = (ushort)Math.Max(0, item.CurrentDura + Quality);
                }

                _drops.Add(item);
            }


            if (_drops.Count == 0)
            {
                player.ReceiveChat("Nothing was found.", ChatType.System);
                Harvested = true;
                _drops    = null;
                Broadcast(new S.ObjectHarvested {
                    ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation
                });
            }


            return(true);
        }
예제 #33
0
 public BinDropTargetAdorner(UIElement adornedElement, DropInfo dropInfo)
     : base(adornedElement, dropInfo)
 {
 }
예제 #34
0
 public DataContainer(MainWindow wnd, string btnidentifier, DropInfo dropInfo)
 {
     MainWindow = wnd;
     btnId      = btnidentifier;
     DropInfo   = dropInfo;
 }
예제 #35
0
        void GongSolutions.Wpf.DragDrop.IDropTarget.Drop(DropInfo dropInfo)
        {
            TaskViewModel sourceTask = (TaskViewModel)dropInfo.Data;
            int           oldIndex   = ActiveTasks.IndexOf(sourceTask);
            int           newIndex   = dropInfo.InsertIndex;

            if (oldIndex >= 0)
            {
                if (newIndex < oldIndex)
                {
                    // move the item up in the list toward the top
                    ActiveTasks.Move(oldIndex, newIndex);
                    List <TaskViewModel> tasksToSave = new List <TaskViewModel>();

                    // update our sort order values
                    for (int i = newIndex; i < oldIndex; i++)
                    {
                        TaskViewModel currentTaskVM    = ActiveTasks[i];
                        TaskViewModel nextTaskVM       = ActiveTasks[i + 1];
                        int           currentSortOrder = currentTaskVM.SortOrder.Value;
                        int           nextSortOrder    = nextTaskVM.SortOrder.Value;
                        currentTaskVM.SortOrder = nextSortOrder;
                        nextTaskVM.SortOrder    = currentSortOrder;
                        tasksToSave.Add(currentTaskVM);

                        if (i + 1 == oldIndex)
                        {
                            tasksToSave.Add(nextTaskVM);
                        }
                    }

                    foreach (TaskViewModel updatedTask in tasksToSave)
                    {
                        updatedTask.Save();
                    }
                }
                else if (newIndex > oldIndex)
                {
                    // move the item down in the list toward the bottom
                    ActiveTasks.Move(oldIndex, newIndex - 1);
                    List <TaskViewModel> tasksToSave = new List <TaskViewModel>();

                    // update our sort order values
                    for (int i = newIndex - 1; i > oldIndex; i--)
                    {
                        TaskViewModel currentTaskVM     = ActiveTasks[i];
                        TaskViewModel previousTaskVM    = ActiveTasks[i - 1];
                        int           currentSortOrder  = currentTaskVM.SortOrder.Value;
                        int           previousSortOrder = previousTaskVM.SortOrder.Value;
                        currentTaskVM.SortOrder  = previousSortOrder;
                        previousTaskVM.SortOrder = currentSortOrder;
                        tasksToSave.Add(currentTaskVM);

                        if (i - 1 == oldIndex)
                        {
                            tasksToSave.Add(previousTaskVM);
                        }
                    }

                    foreach (TaskViewModel updatedTask in tasksToSave)
                    {
                        updatedTask.Save();
                    }
                }
            }
        }
예제 #36
0
        void GongSolutions.Wpf.DragDrop.IDropTarget.Drop(DropInfo dropInfo)
        {
            PlaylistItemType itemType = PlaylistItemType.AnimeSeries;
            int objIDOld = -1;

            PlaylistItemVM pli = dropInfo.Data as PlaylistItemVM;

            if (pli == null)
            {
                return;
            }

            if (pli.ItemType == PlaylistItemType.Episode)
            {
                AnimeEpisodeVM ep = (AnimeEpisodeVM)pli.PlaylistItem;
                itemType = PlaylistItemType.Episode;
                objIDOld = ep.AnimeEpisodeID;
            }
            if (pli.ItemType == PlaylistItemType.AnimeSeries)
            {
                AnimeSeriesVM ep = (AnimeSeriesVM)pli.PlaylistItem;
                itemType = PlaylistItemType.AnimeSeries;
                objIDOld = ep.AnimeSeriesID.Value;
            }

            int iType = (int)itemType;

            // find where this item was previously

            if (string.IsNullOrEmpty(this.PlaylistItems))
            {
                return;
            }

            string[] items = this.PlaylistItems.Split('|');

            // create a new list without the moved item
            string newItemList = "";

            foreach (string pitem in items)
            {
                string[] parms = pitem.Split(';');
                if (parms.Length != 2)
                {
                    continue;
                }

                int objType = -1;
                int objID   = -1;

                if (!int.TryParse(parms[0], out objType))
                {
                    continue;
                }
                if (!int.TryParse(parms[1], out objID))
                {
                    continue;
                }

                if (objType == iType && objID == objIDOld)
                {
                    // skip the old item
                }
                else
                {
                    if (newItemList.Length > 0)
                    {
                        newItemList += "|";
                    }
                    newItemList += string.Format("{0};{1}", objType, objID);
                }
            }

            // insert the moved item into it's new position
            items = newItemList.Split('|');

            this.PlaylistItems = "";
            int curPos = 0;

            if (string.IsNullOrEmpty(newItemList))
            {
                // means there was only one item in list to begin with
                PlaylistItems += string.Format("{0};{1}", iType, objIDOld);
            }
            else
            {
                foreach (string pitem in items)
                {
                    string[] parms = pitem.Split(';');
                    if (parms.Length != 2)
                    {
                        continue;
                    }

                    int objType = -1;
                    int objID   = -1;

                    int.TryParse(parms[0], out objType);
                    int.TryParse(parms[1], out objID);

                    if (curPos == dropInfo.InsertIndex)
                    {
                        // insert moved item
                        if (PlaylistItems.Length > 0)
                        {
                            PlaylistItems += "|";
                        }
                        PlaylistItems += string.Format("{0};{1}", iType, objIDOld);
                    }


                    if (PlaylistItems.Length > 0)
                    {
                        PlaylistItems += "|";
                    }
                    PlaylistItems += string.Format("{0};{1}", objType, objID);

                    curPos++;
                }
            }

            // moved to the end of the list
            if (dropInfo.InsertIndex > items.Length)
            {
                if (PlaylistItems.Length > 0)
                {
                    PlaylistItems += "|";
                }
                PlaylistItems += string.Format("{0};{1}", iType, objIDOld);
            }

            Save();
            PopulatePlaylistObjects();

            PlaylistHelperVM.Instance.OnPlaylistModified(new PlaylistModifiedEventArgs(PlaylistID));
        }
예제 #37
0
 /// <summary>
 /// Gets called when the user stops to drag the object and drops it into a dropcontainer
 /// </summary>
 /// <param name="dragData">Contains information about the ongoing drag.</param>
 /// <param name="dropData">Contains information about the drop event </param>
 protected abstract void OnDrop(DragInfo dragData, DropInfo dropData);
예제 #38
0
 /// <summary>
 /// Gets called when the user stops hovering (dragging) the Draggable over a drop container. 
 /// </summary>
 /// <param name="dragData">Contains information about the ongoing drag.</param>
 /// <param name="dropData">Contains information about the hovered container</param>
 protected abstract void OnStopHovering(DragInfo dragData, DropInfo dropData);
예제 #39
0
 public WndPopup(DropInfo dropInfo, TreeViewDropHandler dropTarget)
 {
     InitializeComponent();
     this.dropInfo    = dropInfo;
     this.dropHandler = dropTarget;
 }
예제 #40
0
 private void InitializeDrag(PointerEventData eventData)
 {
     _dragInfo = new DragInfo();
     _dropInfo = new DropInfo();
     _dropInfo.Draggable = this;
     _dragDistanceToScreen = eventData.pressEventCamera.WorldToScreenPoint(gameObject.transform.position).z;
 }
예제 #41
0
 public void OnDragOver(DropInfo dropInfo)
 {
     dropInfo.Effects = DragDropEffects.Copy;
 }
예제 #42
0
        public override bool Harvest(PlayerObject player)
        {
            if (RemainingSkinCount == 0)
            {
                for (int i = _drops.Count - 1; i >= 0; i--)
                {
                    if (player.CheckGroupQuestItem(_drops[i]))
                    {
                        _drops.RemoveAt(i);
                    }
                    else
                    {
                        if (player.CanGainItem(_drops[i]))
                        {
                            player.GainItem(_drops[i]);
                            _drops.RemoveAt(i);
                        }
                    }
                }

                if (_drops.Count == 0)
                {
                    Harvested = true;
                    _drops    = null;
                    Broadcast(new S.ObjectHarvested {
                        ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation
                    });
                }
                else
                {
                    player.ReceiveChat("You cannot carry anymore.", ChatType.System);
                }

                return(true);
            }

            if (--RemainingSkinCount > 0)
            {
                return(true);
            }


            _drops = new List <UserItem>();

            for (int i = 0; i < Info.Drops.Count; i++)
            {
                DropInfo drop = Info.Drops[i];

                var reward = drop.AttemptDrop(EXPOwner?.Stats[Stat.ItemDropRatePercent] ?? 0, EXPOwner?.Stats[Stat.GoldDropRatePercent] ?? 0);

                if (reward != null)
                {
                    foreach (var dropItem in reward.Items)
                    {
                        UserItem item = Envir.CreateDropItem(dropItem);
                        if (item == null)
                        {
                            continue;
                        }

                        if (drop.QuestRequired)
                        {
                            if (!player.CheckGroupQuestItem(item, false))
                            {
                                continue;
                            }
                        }

                        if (item.Info.Type == ItemType.Meat)
                        {
                            item.CurrentDura = (ushort)Math.Max(0, item.CurrentDura + Quality);
                        }

                        _drops.Add(item);
                    }
                }
            }

            if (_drops.Count == 0)
            {
                player.ReceiveChat("Nothing was found.", ChatType.System);
                Harvested = true;
                _drops    = null;
                Broadcast(new S.ObjectHarvested {
                    ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation
                });
            }

            return(true);
        }
 public static bool HasTOCContent(this DropInfo dropInfo)
 {
     return(dropInfo?.Data is TOCDragData);
 }
예제 #44
0
 /// <summary>
 /// Drag over logic.
 /// </summary>
 /// <param name="dropInfo">Info.</param>
 public virtual void DragOver(DropInfo dropInfo)
 {
     dropInfo.Effects = DragDropEffects.None;
 }
 public static string GetMapUri(this DropInfo dropInfo)
 {
     return(HasTOCContent(dropInfo) ? ((TOCDragData)dropInfo.Data).SourceMapURI : string.Empty);
 }
예제 #46
0
 /// <summary>
 /// Drop logic.
 /// </summary>
 /// <param name="dropInfo">Info.</param>
 public virtual void Drop(DropInfo dropInfo)
 {
 }
예제 #47
0
 public void SetDropInfo(DropInfo info)
 {
     this.dropInfo = info;
 }
예제 #48
0
        static void DropTarget_PreviewDragOver(object sender, DragEventArgs e)
        {
            DropInfo dropInfo = new DropInfo(sender, e, m_DragInfo, m_Format.Name);
            IDropTarget dropHandler = GetDropHandler((UIElement)sender);

            if (dropHandler != null)
            {
                dropHandler.DragOver(dropInfo);
            }
            else
            {
                DefaultDropHandler.DragOver(dropInfo);
            }

            // Update the drag adorner.
            if (dropInfo.Effects != DragDropEffects.None)
            {
                if (DragAdorner == null && m_DragInfo != null)
                {
                    CreateDragAdorner();
                }

                if (DragAdorner != null)
                {
                    DragAdorner.MousePosition = e.GetPosition(DragAdorner.AdornedElement);
                    DragAdorner.InvalidateVisual();
                }
            }
            else
            {
                DragAdorner = null;
            }

            // If the target is an ItemsControl then update the drop target adorner.
            if (sender is ItemsControl)
            {
                UIElement adornedElement = ((ItemsControl)sender).GetVisualDescendent<ItemsPresenter>();

                if (dropInfo.DropTargetAdorner == null)
                {
                    DropTargetAdorner = null;
                }
                else if (!dropInfo.DropTargetAdorner.IsInstanceOfType(DropTargetAdorner))
                {
                    DropTargetAdorner = DropTargetAdorner.Create(dropInfo.DropTargetAdorner, adornedElement);
                }

                if (DropTargetAdorner != null)
                {
                    DropTargetAdorner.DropInfo = dropInfo;
                    DropTargetAdorner.InvalidateVisual();
                }
            }

            e.Effects = dropInfo.Effects;
            e.Handled = true;

            Scroll((DependencyObject)sender, e);
        }
예제 #49
0
 public RemooeTreeHighlightAdorner(UIElement adornedElement, DropInfo dropInfo)
     : base(adornedElement, dropInfo)
 {
 }
예제 #50
0
        public override void OnScResponse(object s)
        {
            base.OnScResponse(s);



            if (s is SCFriendResponse)
            {
                var rsp = s as SCFriendResponse;

                if (MsgStatusCodeUtil.OnError(rsp.Status))
                {
                    return;
                }

                if (FriendReqType.Added == rsp.Type)
                {
                    FriendDataManager.Instance.Last_apply             = rsp.LastAgree;
                    FriendDataManager.Instance.Is_receive_application = !rsp.AddSwitch;
                }
                else if (FriendReqType.Agreeing == rsp.Type)
                {
                    GameEvents.RedPointEvents.Sys_OnNewApplyReadedEvent.SafeInvoke();
                }
                else if (FriendReqType.Addinfo == rsp.Type)
                {
                    FriendDataManager.Instance.Last_apply = false;
                    GameEvents.RedPointEvents.Sys_OnNewFriendReadedEvent.SafeInvoke();
                }


                if (this.m_friend_list_view.Visible)
                {
                    FriendDataManager.Instance.SetDatas(rsp.Friends, rsp.Type);
                    FriendDataManager.Instance.Max_friend_num     = rsp.Limit;
                    FriendDataManager.Instance.Send_gift_left_num = rsp.GiftCountLeft;

                    this.m_friend_list_view.Refresh((FRIEND_UI_TOGGLE_TYPE)rsp.Type);
                }
            }
            else if (s is SCFriendAddResponse)
            {
                var rsp = s as SCFriendAddResponse;
                if (MsgStatusCodeUtil.OnError(rsp.Status))
                {
                    return;
                }



                var raw_req            = EngineCoreEvents.SystemEvents.GetRspPairReq.SafeInvoke();
                CSFriendAddRequest req = raw_req as CSFriendAddRequest;
                GameEvents.UIEvents.UI_Friend_Event.Tell_add_recommend_firend_ok.SafeInvoke(req.PlayerId);

                EngineCoreEvents.AudioEvents.PlayAudio.SafeInvoke(Audio.AudioType.UISound, GameCustomAudioKey.friend_send.ToString());
            }
            else if (s is SCFriendDelResponse)
            {
                var rsp = s as SCFriendDelResponse;
                if (MsgStatusCodeUtil.OnError(rsp.Status))
                {
                    return;
                }



                if (this.m_friend_list_view.Visible)
                {
                    this.m_friend_list_view.Refresh(FRIEND_UI_TOGGLE_TYPE.Added);
                }
            }
            else if (s is SCFriendAgreeResponse)
            {
                var rsp = s as SCFriendAgreeResponse;

                if (MsgStatusCodeUtil.OnError(rsp.Status))
                {
                    if (!(MsgStatusCodeUtil.FRIEND_ADDED == rsp.Status.Code))
                    {
                        return; //添加已存在的好友,需要刷新申请界面
                    }
                }

                //半单机状态,添加好友,要等到服务器新好友提醒消息,才能显示已添加的好友,太慢了。所以在这里主动刷新
                RequestFriendInfos();

                if (this.m_friend_list_view.Visible)
                {
                    this.m_friend_list_view.Refresh(FRIEND_UI_TOGGLE_TYPE.Agreeing);
                }
            }
            else if (s is SCFriendDelApplyResponse)
            {
                var rsp = s as SCFriendDelApplyResponse;
                if (MsgStatusCodeUtil.OnError(rsp.Status))
                {
                    return;
                }

                if (this.m_friend_list_view.Visible)
                {
                    this.m_friend_list_view.Refresh(FRIEND_UI_TOGGLE_TYPE.Agreeing);
                }
            }
            else if (s is SCFriendGiftResponse)
            {
                var rsp = s as SCFriendGiftResponse;
                if (MsgStatusCodeUtil.OnError(rsp.Status))
                {
                    return;
                }

                FriendDataManager.Instance.Receive_gift_max_num  = rsp.Limit;
                FriendDataManager.Instance.Receive_gift_left_num = rsp.Limit - rsp.Count;
                FriendDataManager.Instance.SetGifts(rsp.FriendGiftLists);

                if (m_friend_list_view.Visible)
                {
                    this.m_friend_list_view.Refresh(FRIEND_UI_TOGGLE_TYPE.gift);
                    GameEvents.RedPointEvents.Sys_OnNewFriendReadedEvent.SafeInvoke();
                }
            }
            else if (s is SCFriendGiftSendResponse)
            {
                var rsp = s as SCFriendGiftSendResponse;
                if (MsgStatusCodeUtil.OnError(rsp.Status))
                {
                    return;
                }
            }
            else if (s is SCFriendGiftDrawResponse)
            {
                var rsp = s as SCFriendGiftDrawResponse;
                if (MsgStatusCodeUtil.OnError(rsp.Status))
                {
                    return;
                }

                if (m_friend_list_view.Visible)
                {
                    this.m_friend_list_view.Refresh(FRIEND_UI_TOGGLE_TYPE.gift);
                    GameEvents.RedPointEvents.Sys_OnNewFriendReadedEvent.SafeInvoke();
                }

                //if (m_gift_list_view.Visible)
                //{
                //    m_gift_list_view.Refresh();

                //    SCDropResp res = new SCDropResp();

                //    foreach (var item in rsp.PlayerPropMsg)
                //    {
                //        long item_id = item.PropId;
                //        int item_count = item.Count;

                //        DropInfo info = new DropInfo();
                //        info.PropId = item_id;
                //        info.Count = item_count;

                //        res.DropInfos.Add(info);
                //    }

                //    FrameMgr.OpenUIParams param = new FrameMgr.OpenUIParams(UIDefine.UI_GIFTRESULT);
                //    param.Param = res;
                //    EngineCoreEvents.UIEvent.ShowUIEventWithParam.SafeInvoke(param);
                //}

                if (m_friend_list_view.Visible)
                {
                    SCDropResp res = new SCDropResp();

                    foreach (var item in rsp.PlayerPropMsg)
                    {
                        long item_id    = item.PropId;
                        int  item_count = item.Count;

                        DropInfo info = new DropInfo();
                        info.PropId = item_id;
                        info.Count  = item_count;

                        res.DropInfos.Add(info);
                    }

                    GameEvents.UIEvents.UI_GameEntry_Event.Listen_OnCombinePropCollected.SafeInvoke();

                    FrameMgr.OpenUIParams param = new FrameMgr.OpenUIParams(UIDefine.UI_GIFTRESULT);
                    param.Param = res;
                    EngineCoreEvents.UIEvent.ShowUIEventWithParam.SafeInvoke(param);
                }
            }
            else if (s is SCFriendViewResponse)
            {
                var rsp = s as SCFriendViewResponse;
                if (MsgStatusCodeUtil.OnError(rsp.Status))
                {
                    return;
                }

                if (m_friend_detail_view.Visible)
                {
                    m_friend_detail_view.Refresh(rsp.PlayerFriendMsg, rsp.AchievementMsgs);
                    //m_friend_detail_view.Refresh(rsp.PlayerFriendMsg, new List<long>() { 1, 2, 3, 4, 5 });
                }
            }
            else if (s is SCFriendSwitchResponse)
            {
                var rsp = s as SCFriendSwitchResponse;
                if (MsgStatusCodeUtil.OnError(rsp.Status))
                {
                    return;
                }
            }
            else if (s is SCFriendRecommendGetResponse)
            {
                var rsp = s as SCFriendRecommendGetResponse;
                if (MsgStatusCodeUtil.OnError(rsp.Status))
                {
                    return;
                }

                m_friend_detail_view.Refresh(rsp.PlayerFriendMsg, rsp.AchievementMsgs);
                m_friend_detail_view.Visible = true;
            }
            else if (s is SCFriendRecommendListResponse)
            {
                var rsp = s as SCFriendRecommendListResponse;

                if (MsgStatusCodeUtil.OnError(rsp.Status))
                {
                    return;
                }

                FriendDataManager.Instance.Recommends.Clear();

                FriendDataManager.Instance.Recommends.AddRange(rsp.Recommend);

                FriendDataManager.Instance.Recommend_expire_date = System.DateTime.Now.AddSeconds(rsp.TimeDown);

                m_recommend_view.Refresh();
            }
            else if (s is SCFriendRecommendApplyResponse)
            {
                var rsp = s as SCFriendRecommendApplyResponse;

                if (MsgStatusCodeUtil.OnError(rsp.Status))
                {
                    return;
                }

                foreach (var item in rsp.RecommendId)
                {
                    var one_recommend = FriendDataManager.Instance.Recommends.Find((recommend) => recommend.RecommendId == item);
                    one_recommend.Status = (int)ENUM_RECOMMEND_STATUS.E_ADDED;
                    GameEvents.UIEvents.UI_Friend_Event.Tell_add_recommend_firend_ok.SafeInvoke(item);
                }

                var valids = FriendDataManager.Instance.Recommends.FindAll((item) => ENUM_RECOMMEND_STATUS.E_RECOMMEND == (ENUM_RECOMMEND_STATUS)item.Status);

                if (null == valids || 0 == valids.Count)
                {
                    m_recommend_view.Refresh();
                }
            }
            else
            {
                return;
            }

            FriendMsgCodeUtil.OnSuccess(s as IMessage);
        }