public void SetItems(FrameDebugDumpInfo.FrameEventInfo[] infos) { this.currentIdx = 0; this.uiDataBind = new List <UIPair>(); this.scrollView.Clear(); foreach (var info in infos) { var label = new Label(info.frameEventIndex.ToString() + " " + info.type); #if UNITY_2019_1_OR_NEWER || UNITY_2019_OR_NEWER label.focusable = true; #else #endif label.RegisterCallback <MouseDownEvent>((evt) => { SetCurrentFrameEvent(label); }); label.RegisterCallback <KeyDownEvent>((evt) => { if (evt.keyCode == KeyCode.UpArrow) { SetSelectedIndex(this.currentIdx - 1); } else if (evt.keyCode == KeyCode.DownArrow) { SetSelectedIndex(this.currentIdx + 1); } }); this.scrollView.Add(label); UIPair uiPair = new UIPair(info, label); this.uiDataBind.Add(uiPair); } SetSelectedIndex(infos.Length - 1); }
// Use this for initialization void Start() { if (ui.Count > 1) { for (int i = 0; i < ui.Count;) { UIPair p = new UIPair(); p.normal = ui[i]; p.action = ui[i + 1]; p.NormalState(); m_uiList.Add(p); i += 2; } } }