private void TestV() { layoutSpacing.text = "0"; layoutV = layoutVContent.gameObject.AddComponent <SampleLayout>(); RefreshDataNum(0); List <SampleItem.ItemData> datas = new List <SampleItem.ItemData>(); sortData.onClick.AddListener(() => { if (datas.Count <= 0) { return; } if (sortFlag) { datas.Sort((x, y) => - x.id.CompareTo(y.id)); } else { datas.Sort((x, y) => x.id.CompareTo(y.id)); } sortFlag = !sortFlag; layoutV.RefreshDatas(); }); genData.onClick.AddListener(() => { datas = GenDatas(GetDataNum()); if (!layoutV.Inited) { layoutV.DoInit(new LayoutConfig() { progress = layoutProgress.value, bufHalfCnt = 1, cellSize = new Vector2(190, 190), dir = GridLayoutGroup.Axis.Vertical, dirViewLen = 500f, prefab = prefab.transform, spacing = new Vector2(JerryUtil.String2TArray <float>(layoutSpacing.text)[0], JerryUtil.String2TArray <float>(layoutSpacing.text)[0]), dirCellWidth = 3, frameWorkCnt = 3, }, datas); } else { layoutV.RefreshDatas(datas, new ModifyConfig() { progress = layoutProgress.value, spacing = new Vector2(JerryUtil.String2TArray <float>(layoutSpacing.text)[0], JerryUtil.String2TArray <float>(layoutSpacing.text)[0]), }); } }); addData.onClick.AddListener(() => { if (GetDataNum() > 100000) { return; } RefreshDataNum(GetDataNum() == 0 ? 1 : GetDataNum() * 2); }); minusData.onClick.AddListener(() => { RefreshDataNum(GetDataNum() / 2); }); }
public override void Init() { base.Init(); m_LogContent = this.transform.FindChild("Log/Viewport/Content"); layout = m_LogContent.gameObject.AddComponent <LogLayout>(); m_LogPrefab = this.transform.FindChild("Log/LogPrefab"); m_LogPrefab.gameObject.SetActive(false); m_FilterInput = this.transform.FindChild("BaseCtr/InputField").GetComponent <InputField>(); m_FilterInput.onEndEdit.AddListener((str) => { filterStrs = JerryUtil.String2TArray <string>(str, ';'); RefreshList(); }); m_TypeDropdown = this.transform.FindChild("BaseCtr/TypeDropdown").GetComponent <Dropdown>(); m_TypeDropdown.options.Clear(); m_TypeDropdown.options.AddRange(new List <Dropdown.OptionData>() { new Dropdown.OptionData() { text = Enum_LogType.All.ToString() }, new Dropdown.OptionData() { text = Enum_LogType.Inf.ToString() }, new Dropdown.OptionData() { text = Enum_LogType.War.ToString() }, new Dropdown.OptionData() { text = Enum_LogType.Err.ToString() }, }); m_TypeDropdown.onValueChanged.AddListener((val) => { filterType = (Enum_LogType)val; RefreshList(); }); m_TagDropdown = this.transform.FindChild("BaseCtr/TagDropdown").GetComponent <Dropdown>(); m_TagDropdown.options.Clear(); m_TagDropdown.options.AddRange(new List <Dropdown.OptionData>() { new Dropdown.OptionData() { text = Enum_LogTag.All.ToString() }, new Dropdown.OptionData() { text = Enum_LogTag.Tag0.ToString() }, new Dropdown.OptionData() { text = Enum_LogTag.Tag1.ToString() }, new Dropdown.OptionData() { text = Enum_LogTag.Tag2.ToString() }, }); m_TagDropdown.onValueChanged.AddListener((val) => { filterTag = (Enum_LogTag)val; RefreshList(); }); JerryDebugUGUI.Inst.AddCtr(new CtrConfig() { m_Name = "Clear", m_Color = Color.red, m_Callback = (x) => { CleanAllLog(); }, }); CleanAllLog(); JerryEventMgr.AddEvent(Enum_Event.AddLog2Screen.ToString(), AddLog2Screen); JerryEventMgr.AddEvent(Enum_Event.Change2Bottom.ToString(), EventChange2Bottom); }
private int GetDataNum() { return(JerryUtil.String2TArray <int>(dataNum.text)[0]); }