void setupItemListFavIcon() { GameObject label = this.transform.FindDeepChild("Item Label").gameObject; GameObject currentFaveImageObject = new GameObject("FaveItemListIcon"); currentFaveImageObject.transform.parent = label.transform; Image currentFaveImageComponent = currentFaveImageObject.AddComponent <Image>(); currentFaveImageComponent.sprite = favSprite; RectTransform rt = currentFaveImageObject.GetComponent <RectTransform>(); rt.anchoredPosition = new Vector2(0, 0); rt.sizeDelta = new Vector2(16, 16); rt.anchorMin = new Vector2(1, 0.5f); rt.anchorMax = new Vector2(1, 0.5f); rt.pivot = new Vector2(0.5f, 0.5f); dropdown.itemImage = currentFaveImageComponent; FavButton butt = currentFaveImageObject.AddComponent <FavButton>(); butt.clickReciever = this.gameObject; butt.clickMethodReciever = "FavButtonClicked"; /* * butt.onClick.AddListener(() => * { * Debug.Log("but click"); * GameObject ButtonClicked = EventSystem.current.currentSelectedGameObject; * Debug.Log(ButtonClicked); * // fav icon clicked * // which item are we hovering over? * * }); * * // hook user clicking on the fav icon * EventTrigger trigger = butt.gameObject.AddComponent<EventTrigger>(); * foreach (EventTriggerType t in Enum.GetValues(typeof(EventTriggerType))) * { * EventTrigger.Entry entry = new EventTrigger.Entry(); * entry.eventID = t; * //EventTriggerType.PointerDown; * entry.callback.AddListener((data) => { * Debug.Log("[" + t + "]: tada!"); * Debug.Log(data); * data.Use(); * }); * * trigger.triggers.Add(entry); * } */ }
void FavButtonClicked(Dictionary <string, object> dict) { int index = (int)dict["index"]; FavButton button = (FavButton)dict["source"]; DOption option = (DOption)dropdown.options[index]; Debug.Log("fav button clicked index:" + index + " source:" + button + " option:" + option.text); toggleFav(option); button.gameObject.GetComponent <Image>().sprite = option.image; dropdown.RefreshShownValue(); itemsDirty = true; storeFavs(); }
void ButtonAktifPasifBgYap(bool durum) { FavButton.BackgroundColor = UIColor.Clear; FavButton.Layer.BorderWidth = 0; FavButton.Layer.BorderColor = UIColor.Clear.CGColor; if (!durum) { FavButton.SetImage(UIImage.FromBundle("Images/fav_pasif.png"), UIControlState.Normal); } else { FavButton.SetImage(UIImage.FromBundle("Images/fav_aktif.png"), UIControlState.Normal); } }
void ReleaseDesignerOutlets() { if (BackButton != null) { BackButton.Dispose(); BackButton = null; } if (ButtomKisitlamaa != null) { ButtomKisitlamaa.Dispose(); ButtomKisitlamaa = null; } if (ChatArkaHazne != null) { ChatArkaHazne.Dispose(); ChatArkaHazne = null; } if (ChatTableView != null) { ChatTableView.Dispose(); ChatTableView = null; } if (FavButton != null) { FavButton.Dispose(); FavButton = null; } if (GonderButton != null) { GonderButton.Dispose(); GonderButton = null; } if (HazirMesajlarScroll != null) { HazirMesajlarScroll.Dispose(); HazirMesajlarScroll = null; } if (HeaderView != null) { HeaderView.Dispose(); HeaderView = null; } if (HediyeButton != null) { HediyeButton.Dispose(); HediyeButton = null; } if (MesajBGVieww != null) { MesajBGVieww.Dispose(); MesajBGVieww = null; } if (MesajText != null) { MesajText.Dispose(); MesajText = null; } if (UserImageView != null) { UserImageView.Dispose(); UserImageView = null; } if (UserNameLabel != null) { UserNameLabel.Dispose(); UserNameLabel = null; } }