Example #1
0
        public static bool ExchangeItem(object arg1, DragDropItem.DropEvent arg2,
                                        out int index, out int sourceIndex)
        {
            var item       = (DragDropItem)arg1;
            var sourceItem = arg2.Source;
            var data       = item.Data as GoodItemData;
            var sourceData = sourceItem.Data as GoodItemData;

            if (data != null && sourceData != null)
            {
                GoodsListManager.ExchangeListItemAndEquiping(data.Index, sourceData.Index);
                item.BaseTexture       = GoodsListManager.GetTexture(data.Index);
                sourceItem.BaseTexture = GoodsListManager.GetTexture(sourceData.Index);
                index       = data.Index;
                sourceIndex = sourceData.Index;
                var info       = GoodsListManager.GetItemInfo(index);
                var sourceInfo = GoodsListManager.GetItemInfo(sourceIndex);
                item.TopLeftText = info != null?info.Count.ToString() : "";

                sourceItem.TopLeftText = sourceInfo != null?sourceInfo.Count.ToString() : "";

                return(true);
            }
            index       = 0;
            sourceIndex = 0;
            return(false);
        }
Example #2
0
        public static void DropHandler(object arg1, DragDropItem.DropEvent arg2)
        {
            var item       = (DragDropItem)arg1;
            var sourceItem = arg2.Source;
            var data       = item.Data as GoodItemData;
            var sourceData = sourceItem.Data as GoodItemData;

            if (data != null && sourceData != null)
            {
                if (GoodsListManager.IsInEquipRange(sourceData.Index))
                {
                    var info       = GoodsListManager.GetItemInfo(data.Index);
                    var sourceGood = GoodsListManager.Get(sourceData.Index);
                    if (sourceGood == null ||
                        (info != null && info.TheGood == null) ||
                        (info != null && info.TheGood.Part != sourceGood.Part))
                    {
                        return;
                    }
                }
            }

            int index, sourceIndex;

            ExchangeItem(arg1, arg2, out index, out sourceIndex);
        }
Example #3
0
        private bool CanDrop(DragDropItem.DropEvent arg2, Good.EquipPosition position)
        {
            var sourceItem = arg2.Source;
            var sourceData = sourceItem.Data as GoodsGui.GoodItemData;

            if (sourceData != null)
            {
                return(GoodsListManager.CanEquip(sourceData.Index, position));
            }
            return(false);
        }
Example #4
0
        public static void DropHandler(object arg1, DragDropItem.DropEvent arg2)
        {
            var item       = (DragDropItem)arg1;
            var sourceItem = arg2.Source;
            var data       = item.Data as MagicItemData;
            var sourceData = sourceItem.Data as MagicItemData;

            if (data != null && sourceData != null)
            {
                MagicListManager.ExchangeListItem(data.Index, sourceData.Index);
                item.BaseTexture       = MagicListManager.GetTexture(data.Index);
                sourceItem.BaseTexture = MagicListManager.GetTexture(sourceData.Index);
            }
        }