public TestPop4() { m_popId = POP_ID.TEST_POP_4; m_layerIdx = POP_LAYER_IDX.LAYER_POP_1; ShowGameObject(); // m_btnOk = GetChildByName <KButton>("Button_Ok", true); m_btnClose = GetChildByName <KButton>("Button_Close", true); m_panel = GameObjUtil.GetParent(m_btnOk.gameObject); // m_inputName = GetChildByName <KInputField>("Input_name", true); m_labelTestInput = GetChildByName <KText>("Label_testInput", true); // m_tgl_1 = GetChildByName <KToggle>("Toggle_position1", true); m_labelTgl_1 = GetChildByName <KText>(m_tgl_1.gameObject, "Label_Text", true); m_tglGroup_1 = GetChildByName <KToggleGroup>("ToggleGroup_a1", true); // m_sliderSchedule = GetChildByName <KSlider>("Slider_Schedule1", true); m_labelSchedule = GetChildByName <KText>("Label_testSilder", true); // m_barLoading = GetChildByName <KProgressBar>("ProgressBar_loading", true); // m_icon = GetChildByName <KImage>("Image_sharedAnchor", true); // m_scrollView = GetChildByName <KScrollView>("ScrollView_GuildList", true); m_listView = ComponentUtil.EnsureComponent <KListViewScroll>(m_scrollView.gameObject); }
//-------∽-★-∽------∽-★-∽--------∽-★-∽ApplyGameObjectParam∽-★-∽--------∽-★-∽------∽-★-∽--------// public override void ApplyGameObjectParam(GameObject go, JsonData data) { base.ApplyGameObjectParam(go, data); if (HasParam(data, PATTERN_STATIC) == false) { KScrollView scrollView = go.AddComponent <KScrollView>(); if (HasParam(data, PATTERN_H) == true) { scrollView.direction = KScrollView.ScrollDir.horizontal; } else { scrollView.direction = KScrollView.ScrollDir.vertical; } if (HasParam(data, PATTERN_ADAPT_INPUT)) { //AdaptInputField(go); } //scrollView.Initialize(); GameObject mask = FuzzySearchChild(go, "mask"); GameObject content = FuzzySearchChild(mask, "content"); GameObject item = FuzzySearchChild(content, "item", true); if (item != null) { //有列表项 KListViewScroll list = go.AddComponent <KListViewScroll>(); } } }
//-------∽-★-∽------∽-★-∽--------∽-★-∽ListViewScroll∽-★-∽--------∽-★-∽------∽-★-∽--------// void ShowListViewScroll() { m_listViewScroll = ComponentUtil.EnsureComponent <KListViewScroll>(m_scrollViewItemList.gameObject); m_listViewScroll.itemViewType = typeof(Item1); m_listViewScroll.onDataChanged.AddListener(UpdateListItem2); LayoutParam param = m_listViewScroll.layoutParam; //param.padding = new Padding(20, 20, 20, 20); param.itemGap = new Vector2(10, 50); param.divNum = 3; //param.dir = LayoutDirection.LeftToRight; List <int> datas = new List <int>(); int num = 999; for (int i = 0; i < num; ++i) { datas.Add(i); } //m_listViewScroll.direction = KScrollView.ScrollDir.horizontal; m_listViewScroll.ShowList(datas); }