コード例 #1
0
 protected override void ShowView(AView view)
 {
     if (false == _viewList.Contains(view))
     {
         view.onDestroyHandler += RemoveView;
         _viewList.Add(view);
     }
 }
コード例 #2
0
 /// <summary>
 /// View对象销毁的回调
 /// </summary>
 /// <param name="view"></param>
 void OnViewDestroy(AView view)
 {
     if (Current == view)
     {
         Current.onDestroyHandler -= OnViewDestroy;
         Current = null;
     }
 }
コード例 #3
0
ファイル: AViewLayer.cs プロジェクト: ZhaoriGame/FrameworkPro
 /// <summary>
 /// 界面异步创建完成
 /// </summary>
 /// <param name="view"></param>
 private void OnAsyncCreated(AView view)
 {
     _layer.ShowView(view);
     if (null != _onCreated)
     {
         _onCreated.Invoke(view as AViewType, _token);
     }
 }
コード例 #4
0
 public override void Clear()
 {
     if (null != Current)
     {
         Current.onDestroyHandler -= OnViewDestroy;
         Current.Destroy();
         Current = null;
     }
 }
コード例 #5
0
        /// <summary>
        /// 创建视图
        /// </summary>
        /// <param name="type"></param>
        /// <param name="prefab"></param>
        /// <param name="parent"></param>
        /// <param name="data"></param>
        /// <returns></returns>
        public static AView Create(Type type, GameObject prefab, Transform parent, object data = null)
        {
            GameObject go = GameObject.Instantiate(prefab, parent);

            go.name = prefab.name;

            AView view = Activator.CreateInstance(type) as AView;

            view.SetGameObject(go, data);
            return(view);
        }
コード例 #6
0
        /// <summary>
        /// 切换视图
        /// </summary>
        /// <param name="view"></param>
        protected override void ShowView(AView view)
        {
            if (null != Current)
            {
                Current.onDestroyHandler -= OnViewDestroy;
                Current.Destroy();
                Current = null;
            }

            Current = view;
            view.onDestroyHandler += OnViewDestroy;
        }
コード例 #7
0
 public void ChangeSiblingIndex(AView view, int index)
 {
     view.gameObject.transform.SetSiblingIndex(index);
 }
コード例 #8
0
 void RemoveView(AView view)
 {
     view.onDestroyHandler -= RemoveView;
     _viewList.Remove(view);
 }
コード例 #9
0
ファイル: AViewLayer.cs プロジェクト: ZhaoriGame/FrameworkPro
 /// <summary>
 /// 显示视图
 /// </summary>
 /// <param name="view"></param>
 protected abstract void ShowView(AView view);
コード例 #10
0
        /// <summary>
        ///
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="prefab"></param>
        /// <param name="parent"></param>
        /// <param name="data"></param>
        /// <returns></returns>
        public static T Create <T>(GameObject prefab, Transform parent, object data = null) where T : AView
        {
            AView view = Create(typeof(T), prefab, parent, data);

            return(view as T);
        }