public void RecycleItem(SCAN_GAME_ITEM_TYPE type_, long id_) { if (SCAN_GAME_ITEM_TYPE.NORMAL == type_) { for (int i = 0; i < m_normal_grid.ChildCount; ++i) { var item = m_normal_grid.GetChild <NormalItemView>(i); if (item.Unique_id == id_) { Debug.Log("Die " + item); m_normal_grid.RecycleElement <NormalItemView>(item); break; } } } else if (SCAN_GAME_ITEM_TYPE.SPECIAL == type_) { //for (int i = 0; i < m_special_grid.ChildCount; ++i) //{ // var item = m_special_grid.GetChild<SpecialItemView>(i); // if (item.Unique_id == id_) // { // m_special_grid.RecycleElement<SpecialItemView>(item); // break; // } //} } }
protected override void OnInit() { base.OnInit(); m_time_txt = Make <GameLabel>("Text"); m_input_tex = Make <GameTexture>("RawImage_bg"); m_pause_btn = Make <GameButton>("Button_pause"); m_clue_progress_grid = Make <GameUIContainer>("Canvas:ClueProgressGrid"); m_clue_progress_grid.Visible = false; m_normal_grid = Make <GameRecycleContainer>("Normal_Grid"); m_normal_grid.EnsureSize <NormalItemView>(5); for (int i = 0; i < m_normal_grid.ChildCount; ++i) { m_normal_grid.GetChild <NormalItemView>(i).Refresh(i); } m_special_grid = Make <GameRecycleContainer>("Special_Grid"); //m_special_grid.EnsureSize<SpecialItemView>(5); //for (int i = 0; i < m_special_grid.ChildCount; ++i) //{ // m_special_grid.GetChild<SpecialItemView>(i).Refresh(i); //} //m_anchors_grid = Make<GameUIContainer>("Anchors_Grid"); m_details_grid = Make <GameRecycleContainer>("Detail_Grid"); m_details_grid.EnsureSize <ClueDetailView>(3); m_fly_icons_grid = Make <GameRecycleContainer>("FlyIcon_Grid"); m_fly_icons_grid.EnsureSize <FlyIconItemView>(3); m_fly_time_txt = Make <GameLabel>("Text (2)"); m_fly_time_tween_pos = m_fly_time_txt.GetComponent <TweenPosition>(); m_start_view = Make <ScanStartView>("Panel_start"); m_start_view_tween_pos = m_start_view.GetComponent <TweenPosition>(); }