public void AddCard(int index, CardValues cs, IPlayerView iPlayerView = null) { GameObject prefab = GetPrefab(); ICardView cv = Instantiate(prefab, transform).GetComponent <ICardView>(); cv.SetIndex(index); cv.SetCard(cs); cv.IPlayerView = iPlayerView; list.Add(cv); }
void CardMouseOver(ICardView card) { if (card == null) { return; } if (Time.time - _lastClipPlayed > _minTimeBetweenClips) { _AudioSource.PlayOneShot(MouseOverClip); _lastClipPlayed = Time.time; } Verbose(20, $"MouseOver {card.Agent.Model}"); }
protected override void Awake() { handHidden = handHiddenGO.GetComponent <IHandView>(); weaponCard = weaponGO.GetComponent <ICardView>(); handCards = handCardsGO.GetComponent <ICardListView>(); propertyCards = propertyCardsGO.GetComponent <ICardListView>(); skill = skillGO.GetComponent <ISkillView>(); TurnView = turnCountdownGO.GetComponent <ICountdownView>(); ResponseView = responseCountdownGO.GetComponent <ICountdownView>(); turnCountdownGO.SetActive(false); responseCountdownGO.SetActive(false); base.Awake(); SetTurn(false); }
/// <summary> /// Gets the appropriate image for a card /// </summary> /// <param name="card"></param> /// <returns></returns> private Image GetImage(ICardView card) { if (card == null) { return(null); } try { return(Image.FromFile(UIConfig.IMG_FOLDER + card.FileName)); } catch (FileNotFoundException) { return(Image.FromFile(UIConfig.IMG_FOLDER + "c_not_found.png")); } }
private void pbCard_Click(object sender, EventArgs e) { ICardView clickedCard = (ICardView)((PictureBox)sender).Tag; if (IsSelected(clickedCard)) { // deselect Selected.Remove(clickedCard); ((PictureBox)sender).BorderStyle = BorderStyle.None; update(); } else { // select Selected.Add(clickedCard); ((PictureBox)sender).BorderStyle = BorderStyle.FixedSingle; update(); } }
public void RegisterView(ICardView view) { _view = view; }
public CardController(ICardModel model, ICardView view) { this.model = model; this.view = view; Initialize(); }
void Awake() { discardTopCard = discardTopCardGO.GetComponent <ICardView>(); }
private bool IsSelected(ICardView card) { return(Selected.Contains(card)); }
void SelectImageFromGallery(ICardView target, string localUrl, string remoteUrl, string fileName,string cacheKey) { if (target == null) return; var vc = new GalleryImagePicker(); vc.Canceled += (sender, e) => { vc.DismissViewController(true, null); }; vc.FinishedPickingMedia += (object sender, UIImagePickerMediaPickedEventArgs e) => { switch (e.Info[UIImagePickerController.MediaType].ToString()) { case "public.image": Console.WriteLine("Image selected"); target.ToggleLoadingIndicators(true); UIImage editedImage = e.Info[UIImagePickerController.EditedImage] as UIImage; editedImage = ImageUtils.ScaledToSize(editedImage, new CGSize(200, 200)); var bytes = ImageUtils.ByteArrayFromImage(editedImage, 100); S3Utils.UploadPhoto(bytes,localUrl, remoteUrl, fileName, () => { SDWebImageManager.SharedManager.ImageCache.ClearDisk(); SDWebImageManager.SharedManager.ImageCache.ClearMemory(); Update(true); }, null); break; case "public.video": Console.WriteLine("Video selected"); break; } vc.DismissViewController(true, null); }; PresentViewController(vc, true, null); }
if (cardBack != null) cardBack.BindDataToView(SelectedCard, Editable); PerformFlipAnimationIfNecessary(); } public void PerformFlipAnimationIfNecessary() { var cardFront = ContainerView.Subviews.Where(c => c.GetType() == typeof(CardFront)).First(); var cardBack = ContainerView.Subviews.Where(c => c.GetType() == typeof(CardBack)).First(); //animation not needed if (cardFront.Hidden == SelectedCard.IsFlipped) return; UIView.Transition(View, 0.5, UIViewAnimationOptions.TransitionFlipFromRight, () => { cardFront.Hidden = SelectedCard.IsFlipped; cardBack.Hidden = !SelectedCard.IsFlipped; }, null); } public void Flip() { if (SelectedCard == null) return; SelectedCard.Flip(); var cardFront = ContainerView.Subviews.Where(c => c.GetType() == typeof(CardFront)).First(); var cardBack = ContainerView.Subviews.Where(c => c.GetType() == typeof(CardBack)).First(); UIView.Transition(View, 0.5, UIViewAnimationOptions.TransitionFlipFromRight, () => { cardFront.Hidden = SelectedCard.IsFlipped; cardBack.Hidden = !SelectedCard.IsFlipped; }, null); } void DownloadFacebookImage(ICardView target, string localUrl, string remoteUrl, string fileName, string cacheKey) { if (target == null) return; var me = RealmUserServices.GetMe(false); if (me == null) return; var url = me.GetFacebookProfilePictureUrl(); if (url == null) return; target.ToggleLoadingIndicators(true); SDWebImageManager.SharedManager.ImageDownloader.DownloadImage(NSUrl.FromString(url), SDWebImageDownloaderOptions.HighPriority, null, (image, data, error, finished) => { if (image == null || error != null) { target.ToggleLoadingIndicators(false); return; } var bytes = ImageUtils.ByteArrayFromImage(image, 100); S3Utils.UploadPhoto(bytes, localUrl,remoteUrl, fileName, () => { SDWebImageManager.SharedManager.ImageCache.RemoveImage(cacheKey, true, null); Update(true); }, null); }); }