public ImagePanelViewModel(IContainerExtension container, ImageViewParameter parameter)
        {
            ContentIndex = parameter.ContentIndex;
            ContentCount = parameter.ContentCount;

            var applicationCommands = container.Resolve <IApplicationCommands>();
            var compositeDirectory  = container.Resolve <ICompositeImageDirectory>();
            var imageDirectory      = compositeDirectory.ImageDirectries[ContentIndex];

            // ドロップファイル通知(ドロップ数に応じたTabに移行する)
            DropEvent
            .Subscribe(paths =>
            {
                var tabImageUpdate = compositeDirectory.SetDroppedPaths(ContentIndex, paths);
                applicationCommands.NavigateImageTabContent.Execute(tabImageUpdate);
            })
            .AddTo(CompositeDisposable);

            // 読み出しディレクトリ購読(デバッグ用)
            DirectoryPath = imageDirectory
                            .ObserveProperty(x => x.DirectoryPath)
                            .ToReadOnlyReactiveProperty(mode: ReactivePropertyMode.None)
                            .AddTo(CompositeDisposable);

            // 選択ファイル購読(デバッグ用)
            SelectedImagePath = imageDirectory
                                .ObserveProperty(x => x.SelectedFilePath)
                                .ToReadOnlyReactiveProperty(mode: ReactivePropertyMode.DistinctUntilChanged)
                                .AddTo(CompositeDisposable);
        }
Example #2
0
 public static void OnDropEvent(bool isDrop)
 {
     DropEvent handler = OnDrop;
     if (handler != null)
     {
         handler(isDrop);
     }
 }
 public SelectionDropper(DropEvent handler)
 {
     this.m_Active           = true;
     this.OnDrop            += handler;
     this.m_DragAndDropDelay = new DragAndDropDelay();
     this.activateButton     = MouseButton.LeftMouse;
     this.panSpeed           = new Vector2(1f, 1f);
 }
Example #4
0
 public void HandleDrop(DropEvent e)
 {
     OnDrop(e);
     if (!e.Handled && Parent != null)
     {
         Parent.OnDrop(e);
     }
 }
Example #5
0
        public SelectionDropper(DropEvent handler)
        {
            m_Active = true;

            OnDrop += handler;

            m_DragAndDropDelay = new DragAndDropDelay();

            activateButton = MouseButton.LeftMouse;
            panSpeed       = new Vector2(1, 1);
        }
Example #6
0
        private void OnSlotDrop(object sender, DropEvent e)
        {
            var action = e.Data as GameAction;

            if (action != null)
            {
                int index = slots.IndexOf((BeltSlot)sender);
                if (index != -1)
                {
                    Set.Raise(index, action);
                }
            }
        }
Example #7
0
        protected override void OnDrop(DragEventArgs e)
        {
            base.OnDrop(e);
            DragObject dragObject = e.Data.GetData(typeof(DragObject)) as DragObject;

            if (dragObject != null && !String.IsNullOrEmpty(dragObject.Xaml))
            {
                DesignerItem newItem = null;
                object       content = XamlReader.Load(XmlReader.Create(new StringReader(dragObject.Xaml)));

                if (content != null)
                {
                    newItem         = new DesignerItem();
                    newItem.Content = content;
                    var ctrl = (newItem.Content as Grid);
                    var tag  = ctrl?.Tag;
                    newItem.Name = tag?.ToString();
                    Point position = e.GetPosition(this);

                    if (dragObject.DesiredSize.HasValue)
                    {
                        Size desiredSize = dragObject.DesiredSize.Value;
                        newItem.Width  = desiredSize.Width;
                        newItem.Height = desiredSize.Height;

                        DesignerCanvas.SetLeft(newItem, Math.Max(0, position.X - newItem.Width / 2));
                        DesignerCanvas.SetTop(newItem, Math.Max(0, position.Y - newItem.Height / 2));
                    }
                    else
                    {
                        DesignerCanvas.SetLeft(newItem, Math.Max(0, position.X));
                        DesignerCanvas.SetTop(newItem, Math.Max(0, position.Y));
                    }

                    Canvas.SetZIndex(newItem, this.Children.Count);
                    this.Children.Add(newItem);
                    SetConnectorDecoratorTemplate(newItem);

                    //update selection
                    this.SelectionService.SelectItem(newItem);
                    newItem.Focus();
                    DropEvent?.Invoke(newItem, new EventArgs());
                }

                e.Handled = true;
            }
        }
    private void TriggerEvent()
    {
        //print("trigger: " + nextEventToExecute.GetType());
        MoveEvent me = nextEventToExecute as MoveEvent;

        if (me != null)
        {
            //print("clone is moving");
            Main_Move(me.MoveData);
            cloneEventIndex++;
        }

        JumpEvent je = nextEventToExecute as JumpEvent;

        if (je != null)
        {
            //print("clone is jumping");
            Main_Jump(je.JumpData);
            cloneEventIndex++;
        }

        DropEvent de = nextEventToExecute as DropEvent;

        if (de != null)
        {
            //print("clone is dropping");
            Main_Drop();
            cloneEventIndex++;
        }

        BulletEvent be = nextEventToExecute as BulletEvent;

        if (be != null)
        {
            //print("clone is bulleting");
            Main_Action(be.MouseScreenPos);
            cloneEventIndex++;
        }

        if (gameManager.listEvents.Count > cloneEventIndex)
        {
            nextEventToExecute = gameManager.listEvents[cloneEventIndex];
        }
    }
    // Use this for initialization
    void Start()
    {
        m_inventory = new Inventory(Items);
        m_singleton = this;

        //Hide the selector's gameobject
        m_Selector.SetActive(false);

        if (OnItemSelected == null)
        {
            OnItemSelected = new ItemEvent();
        }
        if (OnItemDropped == null)
        {
            OnItemDropped = new DropEvent();
        }
        if (OnItemAdded == null)
        {
            OnItemAdded = new ItemEvent();
        }
    }
Example #10
0
    bool DropItem(Hands hand)
    {
        Item item = null;

        if (hand == Hands.LEFT)
        {
            item = Hand1;
        }
        else if (hand == Hands.RIGHT)
        {
            item = Hand2;
        }
        if (item == null)
        {
            return(false);
        }
        if ((dropPosition - transform.position).magnitude > Range)
        {
            return(false);
        }
        item.transform.parent = null;
        item.gameObject.SetActive(true);
        item.transform.position = dropPosition;
        if (dropPosition.x < transform.position.x)
        {
            item.transform.rotation = Quaternion.Euler(0, 180, 0);
        }
        if (hand == Hands.LEFT)
        {
            Hand1 = null;
        }
        else if (hand == Hands.RIGHT)
        {
            Hand2 = null;
        }
        DropEvent.Invoke(hand);
        activeCombination = -1;
        return(true);
    }
Example #11
0
    public void Drop()
    {
        if (item == null || water.GetTile(water.WorldToCell(transform.position)) != null)
        {
            return;
        }

        if (item.name == "Stick")
        {
            //child.transform.localPosition = baton.localPosition;
            carryBois.SetActive(false);
        }

        GameObject itemDropped   = Instantiate(defaultPhysicItem, transform.position + 0.05f * Vector3.forward + 0.4f * Vector3.right * Mathf.Sign(transform.localScale.x), Quaternion.identity);
        PhysicItem itemDroppedPI = itemDropped.GetComponent <PhysicItem>();

        itemDroppedPI.item = item;
        itemDropped.name   = item.name;

        DropEvent?.Invoke(itemDropped.transform, item.name);

        item      = null;
        sR.sprite = null;
    }
Example #12
0
 protected override void OnDrop(DropEvent e)
 {
     Drop.Raise(this, e);
 }
Example #13
0
 public static void Send(object sender, DropEventArgs e)
 {
     DropEvent?.Invoke(sender, e);
 }
 int CallProcRecordDropsForBattleAndEnemy(MySqlConnection connection, MySqlTransaction transaction, uint battle_id, DropEvent drop)
 {
     // Don't update the items cache here.  A DropEvent doesn't contain enough information to insert
     // an item anyway (in particular because it doesn't tell you the name of an item)
     using (MySqlCommand command = new MySqlCommand("record_drops_for_battle_and_enemy", connection, transaction))
     {
         command.CommandType = System.Data.CommandType.StoredProcedure;
         command.Parameters.AddWithValue("@battle_id", battle_id);
         command.Parameters.AddWithValue("@item_id", drop.ItemId);
         command.Parameters.AddWithValue("@enemy_id", drop.EnemyId);
         command.Parameters.AddWithValue("@item_count", drop.NumberOfItems);
         return(command.ExecuteNonQuery());
     }
 }
 private void UpdateAllDropsForLastBattle(EventBattleInitiated battle)
 {
     if (battle == null)
     {
         this.listViewAllDrops.VirtualListSize = 0;
         this.mAllItems.Clear();
         this.mFilteredItems.Collection.Clear();
     }
     else
     {
         foreach (BasicItemDropStats basicItemDropStats in this.mAllItems.Where <BasicItemDropStats>((Func <BasicItemDropStats, bool>)(x => (int)x.BattleId == (int)battle.Battle.BattleId)))
         {
             ++basicItemDropStats.TimesRun;
             ++basicItemDropStats.TimesRunWithHistogram;
         }
         lock (FFRKProxy.Instance.Cache.SyncRoot)
         {
             foreach (DropEvent drop1 in battle.Battle.Drops)
             {
                 DropEvent drop = drop1;
                 if (drop.ItemType != DataEnemyDropItem.DropItemType.Gold && drop.ItemType != DataEnemyDropItem.DropItemType.Materia && drop.ItemType != DataEnemyDropItem.DropItemType.Potion)
                 {
                     BasicItemDropStats basicItemDropStats = this.mAllItems.Find((Predicate <BasicItemDropStats>)(x => (int)x.BattleId == (int)battle.Battle.BattleId && (int)x.ItemId == (int)drop.ItemId));
                     if (basicItemDropStats != null)
                     {
                         ++basicItemDropStats.TotalDrops;
                     }
                     else
                     {
                         EventListBattles activeDungeon = FFRKProxy.Instance.GameState.ActiveDungeon;
                         if (activeDungeon != null)
                         {
                             DataBattle dataBattle = activeDungeon.Battles.Find(x => (int)x.Id == (int)battle.Battle.BattleId);
                             if (dataBattle != null)
                             {
                                 uint   num1 = 1;
                                 uint   num2 = 1;
                                 string name = drop.ItemId.ToString();
                                 FFRKInspector.DataCache.Items.Data data1;
                                 if (FFRKProxy.Instance.Cache.Items.TryGetValue(new FFRKInspector.DataCache.Items.Key()
                                 {
                                     ItemId = drop.ItemId
                                 }, out data1))
                                 {
                                     name = data1.Name;
                                 }
                                 FFRKInspector.DataCache.Battles.Data data2;
                                 if (FFRKProxy.Instance.Cache.Battles.TryGetValue(new FFRKInspector.DataCache.Battles.Key()
                                 {
                                     BattleId = battle.Battle.BattleId
                                 }, out data2))
                                 {
                                     num1 = data2.Samples;
                                     num2 = data2.HistoSamples;
                                 }
                                 this.mAllItems.Add(new BasicItemDropStats()
                                 {
                                     BattleId      = battle.Battle.BattleId,
                                     BattleName    = dataBattle.Name,
                                     BattleStamina = dataBattle.Stamina,
                                     ItemId        = drop.ItemId,
                                     ItemName      = name,
                                     TimesRun      = num1,
                                     TotalDrops    = 1U
                                 });
                             }
                         }
                     }
                 }
             }
         }
         this.RebuildFilteredDropListAndInvalidate();
     }
 }
Example #16
0
        private static unsafe void ProcessDropEvent(Sdl2NativeWindow window, DropEvent ev)
        {
            string dropString = PtrToStringAuto(ev.File);

            window.OnFileDrop(new[] { dropString });
        }
Example #17
0
 protected virtual void OnDropEvent(MessageEventArgs e)
 {
     DropEvent?.Invoke(this, e);
 }
Example #18
0
 protected virtual void OnDrop(DropEvent e)
 {
 }
Example #19
0
        public void TakeString(string Arrow, string Drop, string Player)
        {
            var           arr    = Arrow.Split(',');
            HashSet <int> IsUsed = new HashSet <int>();

            for (int i = 0; i < arr.Length; i++)
            {
                var small = arr[i].Split(' ');
                int tag   = Utily.Parse(small[0]);
                int dmg   = Utily.Parse(small[1]);
                int id    = Utily.Parse(small[2]);
                if (Arrows.ContainsKey(tag))
                {
                    Arrows[tag].dmg = dmg;
                    Arrows[tag].id  = id;
                }
                else
                {
                    Arrows.Add(tag, new AArrow(dmg, id));
                    ArrowEvent.Enqueue(tag);
                }
                IsUsed.Add(tag);
            }
            List <int> ForRemove = new List <int>();

            foreach (var i in Arrows)
            {
                if (!IsUsed.Contains(i.Key))
                {
                    ForRemove.Add(i.Key);
                    ArrowEvent.Enqueue(-i.Key);
                }
            }
            foreach (var i in ForRemove)
            {
                Arrows.Remove(i);
            }

            var dro = Drop.Split(',');

            IsUsed.Clear();
            for (int i = 0; i < arr.Length; i++)
            {
                var small = dro[i].Split(' ');
                int tag   = Utily.Parse(small[0]);
                int cnt   = Utily.Parse(small[1]);
                int id    = Utily.Parse(small[2]);
                if (Drops.ContainsKey(tag))
                {
                    Drops[tag].Count = cnt;
                    Drops[tag].id    = id;
                }
                else
                {
                    Drops.Add(tag, new ADrop(cnt, id));
                    DropEvent.Enqueue(tag);
                }
                IsUsed.Add(tag);
            }
            ForRemove.Clear();
            foreach (var i in Drops)
            {
                if (!IsUsed.Contains(i.Key))
                {
                    ForRemove.Add(i.Key);
                    DropEvent.Enqueue(-i.Key);
                }
            }
            foreach (var i in ForRemove)
            {
                Drops.Remove(i);
            }

            var pla = Player.Split(',');

            IsUsed.Clear();
            for (int i = 0; i < arr.Length; i++)
            {
                var small = pla[i].Split(' ');
                int tag   = Utily.Parse(small[0]);
                int kill  = Utily.Parse(small[1]);
                int death = Utily.Parse(small[2]);
                if (ArenaPlayer.ContainsKey(tag))
                {
                    ArenaPlayer[tag].RealName = small[3];
                    IsUsed.Add(tag);
                }
                else
                {
                    ArenaPlayer.Add(tag, new APlayer(small[3]));
                }
                ArenaPlayer[tag].Kill  = kill;
                ArenaPlayer[tag].Death = death;
            }
            ForRemove.Clear();
            foreach (var i in ArenaPlayer)
            {
                if (!IsUsed.Contains(i.Key))
                {
                    ForRemove.Add(i.Key);
                }
            }
            foreach (var i in ForRemove)
            {
                ArenaPlayer.Remove(i);
            }
        }
Example #20
0
        private void ValuesDiv_Drop(jQueryEvent evt, DropEvent ui)
        {
            if (currentDropTarget == null)
            {
                DragEnded();
                return;
            }

            int draggingIndex = selectedRowIndex;

            Element valuesDiv     = GetElement().Children[1];
            Element draggedElem   = ui.Draggable.GetElement(0);
            Element valuesTbodyEl = GetValuesTBody();

            if (currentDropTarget == valuesDiv)
            {
                // Dropping as the last element
                if (selectedRowIndex == NumRows - 1)
                {
                    DragEnded();
                    return;
                }

                GridDragDropCompletingEventArgs e = new GridDragDropCompletingEventArgs(draggingIndex, NumRows - 1);
                OnDragDropCompleting(e);
                if (e.Cancel)
                {
                    DragEnded();
                    return;
                }

                valuesTbodyEl.RemoveChild(draggedElem);
                valuesTbodyEl.AppendChild(draggedElem);
                object data = rowData[draggingIndex];
                rowData.RemoveAt(draggingIndex);
                rowData.Add(data);
                selectedRowIndex = NumRows - 1;
                GetElement().Focus();

                OnDragDropCompleted(new GridDragDropCompletedEventArgs(draggingIndex, NumRows - 1));
            }
            else
            {
                // Dropping on a row
                int newIndex = ((TableRowElement)currentDropTarget).RowIndex;
                newIndex = (newIndex > selectedRowIndex ? newIndex - 1 : newIndex);                 // If dragging down we have to pretend that the original row does not exist.
                if (newIndex == selectedRowIndex)
                {
                    return;
                }

                GridDragDropCompletingEventArgs e = new GridDragDropCompletingEventArgs(draggingIndex, newIndex);
                OnDragDropCompleting(e);
                if (e.Cancel)
                {
                    DragEnded();
                    return;
                }

                valuesTbodyEl.RemoveChild(draggedElem);
                valuesTbodyEl.InsertBefore(draggedElem, currentDropTarget);
                object data = rowData[draggingIndex];
                rowData.RemoveAt(draggingIndex);
                rowData.Insert(newIndex, data);
                selectedRowIndex = newIndex;
                GetElement().Focus();

                OnDragDropCompleted(new GridDragDropCompletedEventArgs(draggingIndex, newIndex));
            }

            DragEnded();
        }
Example #21
0
        private static unsafe void ProcessDropEvent(Sdl2NativeWindow window, DropEvent ev)
        {
            string dropString = Marshal.PtrToStringAuto(ev.File);

            window.OnFileDrop(dropString);
        }
Example #22
0
 public void OnDropEvent(Slot slot)
 {
     DropEvent?.Invoke(slot);
 }