private void AddPresenter() { var newPresenter = TvSeriesPresenter.NewPresenter(_tvSeriesId); Presenters.Add(newPresenter); SelectedPresenter = newPresenter; }
public PresentersDto AddNewPresenter(PresenterCreationDTO newPresenter) { int id = Int32.Parse(Presenters.Max((presenter) => presenter.Id)) + 1; PresentersDto presenterToAdd = new PresentersDto(id.ToString(), newPresenter.Name, newPresenter.BirthYear, newPresenter.DeathYear); Presenters.Add(presenterToAdd); return(presenterToAdd); }
public void AddPanel(BasePresenter panel) { if (panel == null) { return; } if (Presenters.Contains(panel)) { return; } panel.IsSubPresenter = true; Presenters.Add(panel); }
IClipPresenter TransitToNextClip(Clip nextClip) { var nextPresenter = _factory.CreatePresenterForClip(nextClip); _presenterInFocus = nextPresenter; Presenters.Add(nextPresenter); nextPresenter.StartEntranceSequence(); nextPresenter.ReadyForCrossfade += Clip_ReadyForCrossfade; return(nextPresenter); }
/// <summary> /// Initializes a new instance of the <see cref="PanelContainerBase"/> class. /// </summary> /// <param name="another">Another <see cref="PanelContainerBase"/> instance to copy data from.</param> protected PanelContainerBase(PanelContainerBase another) { if (another.Header != null) { Header = (IPanelHeader)another.Header.Clone(); } // Deep copy all childs foreach (IPresenter child in another.Presenters) { if (child is IPanel) { Presenters.Add((IPanel)((IPanel)child).Clone()); } } }
public PresenterGroup(List <BasePresenter> panels) { if (panels == null) { throw new ArgumentNullException("panels"); } if (panels.Count == 0) { throw new InvalidOperationException("panels.Length == 0"); } Presenters.Clear(); foreach (var item in panels) { if (item.OwnerdPresenterGroup != null) { CLog.Error("item 已经被挂在某个PanelGroup下面"); continue; } item.IsSubPresenter = true; item.OwnerdPresenterGroup = this; Presenters.Add(item); } }
/// <summary> /// 通过数量初始化 /// </summary> /// <param name="count"></param> public void InitCount <TP, TD>(int count) where TP : Presenter <TD>, new() where TD : PresenterData, new() { if (IsInitedCount) { CLog.Error("InitCount 无法初始化2次!!!!"); return; } IsInitedCount = true; GOs.Clear(); for (int i = 0; i < Trans.childCount; ++i) { Transform temp = Trans.GetChild(i); var ele = temp.GetComponent <LayoutElement>(); if (ele != null && ele.ignoreLayout) { continue; } GOs.Add(temp.gameObject); temp.gameObject.SetActive(false); } if (Prefab == null && GOs.Count > 0) { Prefab = GOs[0]; } if (Prefab == null) { CLog.Error("{0}: Prefab == null", Path); return; } if (count <= 0) { CLog.Error("Count <= 0"); } if (Prefab.name.StartsWith(BaseConstMgr.STR_Base)) { CLog.Error($"不能使用基础UI Prefab 初始化:{Prefab.name}"); } //差值 int subCount = count - GOs.Count; if (subCount > 0) { //生成剩余的游戏对象 for (int i = 0; i < subCount; ++i) { GameObject temp = GameObject.Instantiate(Prefab, this.RectTrans.position, this.RectTrans.rotation) as GameObject; (temp.transform as RectTransform).SetParent(this.RectTrans); (temp.transform as RectTransform).localScale = Vector3.one; GOs.Add(temp); } } for (int i = 0; i < count; ++i) { GOs[i].SetActive(true); var tempPresenter = GOs[i].GetComponent <TP>(); Presenters.Add(tempPresenter); if (tempPresenter is BaseCheckBox checkBox) { checkBox.IsToggleGroup = IsToggleGroup; ToggleGroupCheckBoxs.Add(checkBox); } } //设置数量 //Count = GOs.Count; }
/// <summary> /// 加载Presenter,只在初始化OnInitialize()时候调用 /// </summary> /// <param name="presenter">The presenter.</param> protected virtual void LoadPresenters(TIDetailPresenter presenter) { Presenters.Add(presenter); }