public void OnPointerClick(PointerEventData eventData) { var linkIndex = TMP_TextUtilities.FindIntersectingLink(m_Text, eventData.position , m_Text.canvas == null ? (Core.Instance.m_Camera != null // text doesn't use canvas set world camera ? Core.Instance.m_Camera : Camera.main) : (m_Text.canvas.renderMode == RenderMode.ScreenSpaceOverlay // text use canvas, if ScreenSpaceOverlay set null, is not use canvas camera ? null : m_Text.canvas.worldCamera) ); if (linkIndex != -1) { TMP_LinkInfo linkInfo = m_Text.textInfo.linkInfo[linkIndex]; // run event if (m_EventDictionary.TryGetValue(linkInfo.GetLinkID(), out var ultEvent)) { ultEvent.Invoke(gameObject); } else { Debug.LogWarning("Link value not presented in the dictionary"); } } }
private void SetEvent(BinaryReader br) { Guid key = new Guid(br.ReadBytes(16)); var res = WorkVariants.GetObject(br, this); WrapperObjectWithEvents value; if (EventDictionary.TryGetValue(key, out value)) { value.RaiseEvent(key, res); } }
public FlowEvent Get(Type declaredType, bool strict = true) { FlowEvent e; if (_eventsByDeclaredType.TryGetValue(declaredType, out e)) { return(e); } ExpectNot(strict, "Unknown event type: " + Text.Of(declaredType)); return(null); }
public FlowEvent Get(RuntimeTypeKey key, bool strict = true) { FlowEvent e; if (_eventsByKey.TryGetValue(key, out e)) { return(e); } ExpectNot(strict, "Unknown event key: " + Text.Of(key)); return(null); }
public StateInstance this[StateIdentifier identifier] { get { if (Stats == null) { return(null); } if (!States.TryGetValue(identifier, out var instance)) { var template = traitContext.States[identifier]; instance = template.CreateInstance(identifier); States.Add(identifier, instance); } return(instance); } }
protected void OnDrawItem(Object sender, DrawListViewItemEventArgs e) { e.DrawDefault = true; Int32 index = e.ItemIndex; ListViewItem lvitem = e.Item; if (!IndexInItems(index)) { return; } Object item = ItemsMap.TryGetValue(lvitem, (Object)lvitem); DrawingData data = ColorDictionary.TryGetValue(item, new DrawingData(DefaultBackgroundColor, DefaultForegroundColor, lvitem.Font)); lvitem.ImageKey = GetItemImageKey(lvitem); lvitem.BackColor = GetItemBackColor(lvitem, data); lvitem.ForeColor = GetItemForeColor(lvitem, data); lvitem.Font = GetItemFont(lvitem, data); e.Graphics.FillRectangle(new SolidBrush(lvitem.BackColor), e.Item.Bounds); }
protected virtual void OnDrawItem(Object sender, DrawListViewItemEventArgs e) { e.DrawDefault = true; Int32 index = e.ItemIndex; if (!IndexInItems(index)) { return; } if (e.Item is not GenericListViewItem <T> lvitem) { throw new CollectionSyncException(); } DrawingData data = ColorDictionary.TryGetValue(lvitem.Item, new DrawingData(DefaultBackgroundColor, DefaultForegroundColor, lvitem.Font)); lvitem.ImageKey = GetItemImageKey(lvitem); lvitem.BackColor = GetItemBackColor(lvitem, data); lvitem.ForeColor = GetItemForeColor(lvitem, data); lvitem.Font = GetItemFont(lvitem, data); e.Graphics.FillRectangle(new SolidBrush(lvitem.BackColor), e.Item.Bounds); }
protected virtual String GetItemImageKey(ListViewItem lvitem) { Object item = ItemsMap.TryGetValue(lvitem, (Object)lvitem); return(ImageDictionary.TryGetValue(item, "null")); }
protected virtual String GetItemImageKey(GenericListViewItem <T> lvitem) { return(ImageDictionary.TryGetValue(lvitem.Item, StringUtils.NullString)); }