コード例 #1
0
        private void InitBindDatas(GameObject gameObject)
        {
            //数组下的内容交给数组来注册了
            if (gameObject.GetComponent <UIBindArrayTemplate>() != null)
            {
                return;
            }

            //注册Group
            BaseUIBindGroup bindGroup = gameObject.GetComponent <BaseUIBindGroup>();

            if (bindGroup)
            {
                bindGroup.Init(this);
                return;
            }

            //注册数组
            BaseUIBindArray bindArray = gameObject.GetComponent <BaseUIBindArray>();

            if (bindArray)
            {
                bindArray.Init(this);
            }

            var sNodes = StaticObject <List <BaseUINode> > .Instance;

            //注册事件和绑定
            gameObject.GetComponents <BaseUINode>(sNodes);
            foreach (var component in sNodes)
            {
                component.InitOnRoot(this);
            }
            sNodes.Clear();

            for (int i = 0; i < gameObject.transform.childCount; i++)
            {
                InitBindDatas(gameObject.transform.GetChild(i).gameObject);
            }
        }
コード例 #2
0
        private void InitBindDatas(Transform transform, int index, Transform rootTrans)
        {
            if (transform != rootTrans && transform.GetComponent <UIBindArrayTemplate>() != null)
            {
                return;
            }

            var sNodes = StaticObject <List <BaseUINode> > .Instance;

            transform.GetComponents <BaseUINode>(sNodes);
            foreach (var component in sNodes)
            {
                component.InitOnArray(root, this, index);
            }
            sNodes.Clear();

            //注册数组
            BaseUIBindArray bindArray = transform.GetComponent <BaseUIBindArray>();

            if (bindArray)
            {
                bindArray.Init(this.root, this, index);
            }

            //注册Group
            BaseUIBindGroup bindGroup = transform.GetComponent <BaseUIBindGroup>();

            if (bindGroup)
            {
                bindGroup.Init(this.root, this, index);
                return;
            }

            //防止调不到OnDestroy
            for (int i = 0; i < transform.childCount; i++)
            {
                InitBindDatas(transform.GetChild(i), index, rootTrans);
            }
        }
コード例 #3
0
ファイル: BaseUIBindGroup.cs プロジェクト: taigacon/ET
        private void InitBindDatas(Transform transform, BaseUIBindContainer parent = null, int arrayIndex = 0)
        {
            if (transform.GetComponent <UIBindArrayTemplate>() != null)
            {
                return;
            }

            var sNodes = StaticObject <List <BaseUINode> > .Instance;

            transform.GetComponents <BaseUINode>(sNodes);
            foreach (var component in sNodes)
            {
                component.InitOnGroup(root, this, arrayIndex);
            }
            sNodes.Clear();

            //注册数组
            BaseUIBindArray bindArray = transform.GetComponent <BaseUIBindArray>();

            if (bindArray)
            {
                bindArray.Init(this.root, this, arrayIndex);
            }

            //注册Group
            BaseUIBindGroup bindGroup = transform.GetComponent <BaseUIBindGroup>();

            if (bindGroup && bindGroup != this)
            {
                bindGroup.Init(this.root, this, arrayIndex);
                return;
            }

            for (int i = 0; i < transform.childCount; i++)
            {
                InitBindDatas(transform.GetChild(i), parent, arrayIndex);
            }
        }
コード例 #4
0
 public void UnbindUIArray(BaseUIBindArray array)
 {
     this.bindArrays.Remove(array);
 }
コード例 #5
0
 public void BindUIArray(BaseUIBindArray array)
 {
     this.bindArrays.Add(array);
 }
コード例 #6
0
ファイル: BaseUINode.cs プロジェクト: taigacon/ET
 public virtual void InitOnArray(UIBindRoot root, BaseUIBindArray array, int index)
 {
 }
コード例 #7
0
        public int CreateCellOnArray(GameObject gameObject, string bindFuncName, string bindDataName, BaseUIBindArray array, int index, object param)
        {
            var                dataSet  = array.Data[index];
            UIDataCell         cell     = new UIDataCell(bindDataName, dataSet, param, gameObject);
            UIDataCellCallback callback = new UIDataCellCallback(this, bindFuncName, cell);

            dataSet.AddListener(bindDataName, callback.Run);
            this.callbacks.Add(callback);
            return(this.callbacks.Count);
        }
コード例 #8
0
        public void AddRefOnArray(string refName, object value, BaseUIBindArray array, int arrayIndex)
        {
            var dataSet = array.Data[arrayIndex];

            dataSet.Set(refName, value);
        }
コード例 #9
0
ファイル: BaseUIBindData.cs プロジェクト: taigacon/ET
 //初始化,事件注册在Array下
 public override void InitOnArray(UIBindRoot root, BaseUIBindArray array, int index)
 {
     this.root = root;
     cellIndex = root.CreateCellOnArray(this.gameObject, this.GetBindFunctionName(), this.bindDataName, array, index, this.GetParam());
 }