void Update() { if (!UnityEditor.EditorApplication.isPlaying) { if (null == _sr) { _sr = GetComponent <ScrollRect>(); } if (null == _sr) { DestroyImmediate(this, true); return; } if (_sr.horizontal == true || ForceAddDragUI) { if (null == _dragUI) { _dragUI = GetComponent <DragUI>(); if (null == _dragUI) { _dragUI = gameObject.AddComponent <DragUI>(); } if (ForceAddDragUI) { _dragUI.ForceAdd = true; } else { _dragUI.ForceAdd = false; } } } } }
private void CreateCards() { cardParents.Add(this.talon); cardParents.Add(this.trash); cardParents.Add(this.northHand); cardParents.Add(this.southHand); for (int i = 0; i < 5; i++) { cardParents.Add(this.northField[i]); cardParents.Add(this.southField[i]); } Vector3 last = this.talon.transform.position + new Vector3(0, 1, 0); foreach (LilyAcolasia.Card card in LilyAcolasia.CardDeck.List[LilyAcolasia.Constants.DECK_TALON]) { string name = card.Name; this.cards[name] = Instantiate(cardPrefab); this.cards[name].transform.parent = this.talon.transform; this.cards[name].transform.position = last; DragUI ui = this.cards[name].GetComponent <DragUI>(); ui.Init(name, operationHandler, this); this.cardScripts[name] = ui; last += new Vector3(0, 0.1f, 0); } }
public void DragStorageItemSelected(DataPackage dataPackage, DragUI dragUI) { if (SelectedItems.Count == 0) { return; } BrowserService.DragStorageItems(dataPackage, dragUI, SelectedItems); }
public void OnDrop(PointerEventData eventData) { Debug.Log(eventData.pointerDrag.name + " was dropped on " + gameObject.name); DragUI d = eventData.pointerDrag.GetComponent <DragUI>(); if (d != null) { d.parentToReturnTo = this.transform; } }
// Start is called before the first frame update void Start() { // Schin set TextMesh layer to avoid render layer issue transform.Find("WaitTime").GetComponent <MeshRenderer>().sortingLayerName = "UserGUI"; transform.Find("WaitTime").GetComponent <MeshRenderer>().sortingOrder = 0; //rectTransform = GetComponent<RectTransform>(); // Tinaxd Drag UI DragUI = transform.parent.Find("DragUI").GetComponent <DragUI>(); emotionPanel = transform.Find("EmotionPanel").gameObject; emotionPanel.SetActive(false); }
public async void DragStorageItems(DataPackage dataPackage, DragUI dragUI, Collection <FileSystemElement> draggedItems) { var fse = draggedItems[0]; if (!fse.IsFolder) { var storageItem = await FileSystem.GetFileAsync(fse); dataPackage.SetStorageItems(new List <IStorageItem> { storageItem }, false); var ti = await storageItem.GetThumbnailAsync(ThumbnailMode.SingleItem, 30); if (ti != null) { var stream = ti.CloneStream(); var img = new BitmapImage(); await img.SetSourceAsync(stream); dataPackage.RequestedOperation = DataPackageOperation.Move; dragUI.SetContentFromBitmapImage(img, new Point(-1, 0)); //args.Data.Properties.Thumbnail = RandomAccessStreamReference.CreateFromStream(stream); //args.DragUI.SetContentFromDataPackage(); } } else { var storageItem = await FileSystem.GetFolderAsync(fse); dataPackage.SetStorageItems(new List <IStorageItem> { storageItem }, false); var ti = await storageItem.GetThumbnailAsync(ThumbnailMode.SingleItem, 30); if (ti != null) { var stream = ti.CloneStream(); var img = new BitmapImage(); await img.SetSourceAsync(stream); dataPackage.RequestedOperation = DataPackageOperation.Move; dragUI.SetContentFromBitmapImage(img, new Point(-1, 0)); //args.Data.Properties.Thumbnail = RandomAccessStreamReference.CreateFromStream(stream); //args.DragUI.SetContentFromDataPackage(); } } }
public void OnPointerDown(PointerEventData eventData) { // Spawn block // Attach to mouse immediately GameObject _instance = Instantiate(_prefab, _panel); _instance.transform.position = transform.position; DragUI _dragUi = _instance.GetComponent <DragUI>(); _dragUi.OnPointerDown(eventData); _dragUi.WorkspaceTransform = Workspace; }
private void CardMove(LilyAcolasia.CardDeck from, LilyAcolasia.CardDeck to, LilyAcolasia.Card card) { GameObject toObj = GameObject.Find(to.Name); DragUI ui = this.cards[card.Name].GetComponent <DragUI>(); ui.Move(toObj.transform); this.frameCounter = 0; this.currentGameState = GameState.CmdWait; if (to.Name == "Trash") { audioSource.clip = soundTrash; if (this.gameOperator.Round.Current.Status == LilyAcolasia.GameStatus.Status.WaitSpecialInput) { if (this.gameOperator.Round.Current.LastTrashed.Power == 1) { audioSource.clip = soundSkillLink; } else if (this.gameOperator.Round.Current.LastTrashed.Power == 7) { audioSource.clip = soundSkillSnipe; } } audioSource.Play(); } else if (from.Name == "Talon") { audioSource.clip = soundDraw; audioSource.Play(); } else if (to.Name.Contains("Field")) { audioSource.clip = soundDiscard; audioSource.Play(); } }
public void DragStorageItems(DataPackage dataPackage, DragUI dragUI, Collection <FileSystemElement> draggedItems) { }
/// <summary> /// Creates a visual element from a provided <see cref="BitmapImage"/> to represent /// the dragged data in a drag-and-drop operation. /// </summary> /// <param name="dragUI">The requested <see cref="DragUI"/>.</param> /// <param name="bitmapImage">The source image used to create the drag visual.</param> public static void SetContentFromBitmapImageWrapped(this DragUI dragUI, BitmapImage bitmapImage) => Resolver.SetContentFromBitmapImage(dragUI, bitmapImage);
public void OnDragClickRemove(DragUI drag) { inventory.RemoveItem(drag.item); UpdateDrag(); }
public void OnDragClickUse(DragUI drag) { print("Use"); }
public void RemoveSubscriber(DragUI dragUI) { dragUI.PointerClickUse_Action -= OnDragClickUse; dragUI.PointerClickRemove_Action -= OnDragClickRemove; }
/// <summary> /// Creates a visual element from a provided <see cref="SoftwareBitmap"/> to represent the dragged data /// in a drag-and-drop operation. /// </summary> /// <param name="dragUI">The requested <see cref="DragUI"/>.</param> /// <param name="softwareBitmap">The source image used to create the drag visual.</param> public static void SetContentFromSoftwareBitmapWrapped(this DragUI dragUI, SoftwareBitmap softwareBitmap) => Resolver.SetContentFromSoftwareBitmap(dragUI, softwareBitmap);
void IDragUIResolver.SetContentFromSoftwareBitmap(DragUI dragUI, SoftwareBitmap softwareBitmap, Point anchorPoint) => dragUI.SetContentFromSoftwareBitmap(softwareBitmap, anchorPoint);
/// <summary> /// Creates a visual element from a provided <see cref="BitmapImage"/> to represent /// the dragged data in a drag-and-drop operation, and sets the relative position /// of the visual from the pointer. /// </summary> /// <param name="dragUI">The requested <see cref="DragUI"/>.</param> /// <param name="bitmapImage">The source image used to create the drag visual.</param> /// <param name="anchorPoint">The relative position of the drag visual from the pointer.</param> public static void SetContentFromBitmapImageWrapped(this DragUI dragUI, BitmapImage bitmapImage, Point anchorPoint) => Resolver.SetContentFromBitmapImage(dragUI, bitmapImage, anchorPoint);
void IDragUIResolver.SetContentFromDataPackage(DragUI dragUI) => dragUI.SetContentFromDataPackage();
void IDragUIResolver.SetContentFromBitmapImage(DragUI dragUI, BitmapImage bitmapImage, Point anchorPoint) => dragUI.SetContentFromBitmapImage(bitmapImage, anchorPoint);
void IDragUIResolver.SetContentFromBitmapImage(DragUI dragUI, BitmapImage bitmapImage) => dragUI.SetContentFromBitmapImage(bitmapImage);
/// <summary> /// Creates a visual element from a provided <see cref="SoftwareBitmap"/> to represent the dragged data /// in a drag-and-drop operation, and sets the relative position of the visual from the pointer. /// </summary> /// <param name="dragUI">The requested <see cref="DragUI"/>.</param> /// <param name="softwareBitmap">The source image used to create the drag visual.</param> /// <param name="anchorPoint">The relative position of the drag visual from the pointer.</param> public static void SetContentFromSoftwareBitmapWrapped(this DragUI dragUI, SoftwareBitmap softwareBitmap, Point anchorPoint) => Resolver.SetContentFromSoftwareBitmap(dragUI, softwareBitmap, anchorPoint);
void IDragUIResolver.SetContentFromSoftwareBitmap(DragUI dragUI, SoftwareBitmap softwareBitmap) => dragUI.SetContentFromSoftwareBitmap(softwareBitmap);
/// <summary> /// Creates a system provided visual element that represents the format of the dragged data /// in a drag-and-drop operation, typically the icon of the default handler for the file format. /// </summary> /// <param name="dragUI">The requested <see cref="DragUI"/>.</param> public static void SetContentFromDataPackageWrapped(this DragUI dragUI) => Resolver.SetContentFromDataPackage(dragUI);