internal override IList <IEnumerable <KeyValuePair <long, TSource> > > GetOrderedEnumerables(QueryOptions options) { IList <IEnumerable <KeyValuePair <long, TSource> > > sources = Parent.GetOrderedEnumerables(options); ProcessingSlot[] store = new ProcessingSlot[sources.Count]; Comparison <ProcessingSlot> arrayComparison = ArraySortMethod; long lastIndex = 0; Barrier barrier = new Barrier(sources.Count, delegate(Barrier b) { // Sort the store Array.Sort(store, arrayComparison); // Reassign a good index int i = 0; for (i = 0; i < store.Length && store[i].IsValid; ++i) { store[i].Index = lastIndex + i; } // Update lastIndex for next round lastIndex += i; }); return(sources .Select((s, i) => GetEnumerator(s, barrier, options.MergedToken, store, i)) .ToList()); }
public void MouseDrop() // スロットの上にアイテムがドロップされた時に実行 { if (FindObjectOfType <DragSlot>() == null || panelParam) { return; } foreach (Transform child in customslot_c) { child.gameObject.transform.GetComponent <CustomSlot>().BatsuEnd(); } AudioManager.Instance.PlaySE("closing-wooden-door-1"); transform.GetChild(0).GetComponent <Image>().sprite = null; myItemData = null; dragSlot = FindObjectOfType <DragSlot>(); // DragItemUIに設定しているDragItemDataスクリプトからアイテムデータを取得 myItemData = dragSlot.GetItem(); int id = myItemData.GetItemId(); if (id > 2 && panelParam == false) { itemSlot = dragSlot.GetSlotData(); //ドラッグしてきた持ち物パネルを取得持ち物 //Debug.Log(itemSlot); ShowInformation(); //カスタムパネルに装備 panelParam = true; pocketStatus.SetItemData(myItemData, slotNum); switch (dragSlot.GetDeleteNum()) { case 1: myItemStatus.SetItemCount(id, -1); ProcessingSlot processingSlot = itemSlot.GetComponent <ProcessingSlot>(); StartCoroutine(processingSlot.displayCount()); if (myItemStatus.GetItemCount(id) <= 0) { myItemStatus.SetItemFlag(id, false); itemSlot.GetComponent <ProcessingSlot>().PanelDelete(); } break; case 3: itemSlot.GetComponent <PocketItem>().PanelDelete(); break; default: break; } } dragSlot.DeleteDragItem(); // ドラッグしているアイテムデータの削除 //pocketStatus.SetItemData(myItemData, slotNum); }
static int ArraySortMethod(ProcessingSlot lhs, ProcessingSlot rhs) { if (lhs.IsValid && !rhs.IsValid) { return(-1); } if (!lhs.IsValid && rhs.IsValid) { return(1); } if (!lhs.IsValid && !rhs.IsValid) { return(0); } return(lhs.Index < rhs.Index ? -1 : 1); }