Example #1
0
 //TODO 目前这块的添加是完全混轮的,后期需要重点设计
 //以左上角为锚点,添加到组件中
 public virtual void AddComponent(ERect rect, float pos_x, float pos_y)
 {
     pos_x = pos_x + rect.Ew / 2;
     pos_y = pos_y + rect.Eh / 2;
     rect.ResetPosition(pos_x, pos_y);
     _internal_add_chile(rect);
 }
Example #2
0
        public void SetInfo(string[] titles, float[] titles_width, int max_size)
        {
            ERect first = null;

            for (int i = 0; i < titles.Length; i++)
            {
                EButton title_btn = new EButton(titles[i], titles_width[i]);
                _title_btns.Add(title_btn);
                if (first == null)
                {
                    AddComponent(title_btn, 2, 5);
                }
                else
                {
                    AddComponentRight(title_btn, first, 0);
                }

                first = title_btn;
            }

            _scrollview = new EScrollView(Ew, Eh - DEFAULT_HEIGHT * 2 - 20);
            AddComponent(_scrollview, 0, DEFAULT_HEIGHT + 10);
            _scrollview.SetHeightInterval(2);

            _page_item = new ExtendPageItem();
            _page_item.SetPageInfo(100, 10);
            AddComponent(_page_item, E_Anchor.DOWN_CENTER);
            _page_item.ResetPosition(_page_item.Ex, _page_item.Ey - 5);
            _page_item.OnUpdatePage += _on_update_page;
        }
Example #3
0
        public virtual void AddItem(ERect rect)
        {
            float x = _size.x / 2;

            _cur_height += _cur_height + rect.Eh / 2 + height_interval;
            rect.ResetPosition(x, _cur_height);
            _internal_add_chile(rect);
        }
Example #4
0
        public virtual void AddItem(ERect rect)
        {
            float x = rect.Ew / 2 + offset_x;

            _cur_height = (_view_height + rect.Eh / 2);
            rect.ResetPosition(x, _cur_height);
            _internal_add_chile(rect);
            _view_height = (_cur_height + rect.Eh / 2 + height_interval);
        }
Example #5
0
        public ERect AddComponentDown(ERect rect, ERect rect_a, float r_heigth = 5)
        {
            float pos_x = rect_a.Ex - rect_a.Ew / 2 + rect.Ew / 2;
            float pos_y = rect_a.Ey + rect_a.Eh / 2 + r_heigth + rect.Eh / 2;

            rect.ResetPosition(pos_x, pos_y);
            _internal_add_chile(rect);
            return(rect);
        }
Example #6
0
        // rect 在rect_a的右边
        public virtual ERect AddComponentRight(ERect rect, ERect rect_a, float r_width = 5)
        {
            float pos_x = rect_a.Ex + rect_a.Ew / 2 + r_width + rect.Ew / 2;
            //float pos_y = rect_a.Ey + (rect_a.Eh - rect.Eh) / 2;
            float pos_y = rect_a.Ey - rect_a.Eh / 2 + rect.Eh / 2;

            rect.ResetPosition(pos_x, pos_y);
            _internal_add_chile(rect);
            return(rect);
        }
Example #7
0
        public void _init_position()
        {
            float tmp_x      = 10;
            float tmp_y      = 10;
            float tmp_height = 10;

            AddComponent(_des, tmp_x, tmp_y);
            tmp_y += _des.Size.y + tmp_height;

            ERect anchor = _des;

            anchor = AddComponentDown(_check_tex_ref_btn, anchor);
            anchor = AddComponentRight(_check_dc_btn, anchor);
        }
Example #8
0
        public void _init_position()
        {
            float tmp_x      = 10;
            float tmp_y      = 10;
            float tmp_height = 10;

            AddComponent(_des, tmp_x, tmp_y);
            tmp_y += _des.Size.y + tmp_height;

            ERect anchor = _des;

            anchor = AddComponentDown(_swparation_animation_btn, anchor);
            anchor = AddComponentRight(_seo_animation, anchor);
        }
Example #9
0
        public void _init_position()
        {
            float tmpX = 10;
            float tmpY = 10;

            //float tmp_height = 10;
            //float tmp_width = 10;
            AddComponent(_des, tmpX, tmpY);
            //tmpY += _des.Size.y + tmp_height;

            ERect anchor = _des;

            anchor = AddComponentDown(_csv_to_cs_btn, anchor);
            anchor = AddComponentRight(_csv_to_byte_btn, anchor);
            anchor = AddComponentRight(_check_byte_btn, anchor);
            anchor = AddComponentRight(_check_csv_vaild, anchor);
        }
Example #10
0
        //添加 带锚点
        public virtual void AddComponent(ERect rect, E_Anchor anchor)
        {
            // TODO bug 没有fixed
            float    pos_x = rect.Ex;
            float    pos_y = rect.Ey;
            E_Anchor e     = (anchor & E_Anchor.Left);

            if ((anchor & E_Anchor.Left) == E_Anchor.Left)
            {
                pos_x = rect.Ew / 2;
            }
            else if ((anchor & E_Anchor.Right) == E_Anchor.Right)
            {
                pos_x = _size.x - pos_x - rect.Ew / 2;
            }

            /*else if ((anchor & E_Anchor.center) == E_Anchor.center)
             * {
             *  pos_x = _size.x / 2 + pos_x;
             * }*/

            /* if ((anchor & E_Anchor.center) == E_Anchor.center)
             * {
             *   pos_y = _size.y / 2 + pos_y;
             * }
             * else */
            if ((anchor & E_Anchor.UP) == E_Anchor.UP)
            {
                pos_y = pos_y + rect.Eh / 2;
            }
            else if ((anchor & E_Anchor.DOWN) == E_Anchor.DOWN)
            {
                pos_y = _size.y + pos_y - rect.Eh / 2;
            }

            if ((anchor & E_Anchor.DOWN_CENTER) == E_Anchor.DOWN_CENTER)
            {
                pos_x = (_size.x / 2) - (rect.Ew / 2);
                pos_y = _size.y + pos_y - rect.Eh / 2;
            }

            rect.ResetPosition(pos_x, pos_y);
            _internal_add_chile(rect);
        }
Example #11
0
        public void _init(EditorWindow win)
        {
            _rootPath      = new ELabelInput("文件名:", 80, "", 400);
            _searchFileBtn = new EButton("文件名检索", 150);

            _searchFileBtn.OnClick += OnSearchFileByPath;

            ERect item = _rootPath;

            AddComponent(_rootPath, 5, 5);
            item = AddComponentRight(_searchFileBtn, item);

            _effectTable             = new TableView(win, typeof(CheckEffectReportCnf));
            _effectTable.OnSelected += OnRuleSelected;
            _effectTable.AddColumn("_assetPath", CheckEffectReportCnf.ASSET_PATH, 0.4f);
            _effectTable.AddColumn("_effName", CheckEffectReportCnf.EFFECT_NAME, 0.15f);
            _effectTable.AddColumn("_loadTime", CheckEffectReportCnf.LOAD_TIME, 0.05f);
            _effectTable.AddColumn("_instTime", CheckEffectReportCnf.INST_TIME, 0.05f);

            _effectTable.AddColumn("_dc", CheckEffectReportCnf.DRAWCALL, 0.05f);
            _effectTable.AddColumn("_triangles", CheckEffectReportCnf.TRIANGLES, 0.05f);
            _effectTable.AddColumn("_materialCount", CheckEffectReportCnf.MATERIAL_COUNT, 0.05f);
            _effectTable.AddColumn("_totalPsCount", CheckEffectReportCnf.TOTAL_PS_COUNT, 0.05f);
            _effectTable.AddColumn("_texMemBytes", CheckEffectReportCnf.TEX_MEM_BYTES, 0.05f);
            _effectTable.AddColumn("_texMemCount", CheckEffectReportCnf.TEX_MEM_COUNT, 0.05f);
            _effectTable.AddColumn("_animationCount", CheckEffectReportCnf.ANIM_COUNT, 0.05f);


            _effectTablePanel = new TableViewPanel(Ew - 10, 200);
            _effectTablePanel.AddTableView(_effectTable);
            _effectTablePanel.RefreshData(_shows);

            AddComponent(_effectTablePanel, 5, 10 + _rootPath.Eh);

            _effectTexTable = new TableView(win, typeof(TmpStringInfo));
            _effectTexTable.AddColumn("_param1", "路径", 0.45f, TextAnchor.MiddleLeft);
            _effectTexTable.AddColumn("_param2", "内存占用", 0.05f, TextAnchor.MiddleCenter);


            _effectTexTablePanel = new TableViewPanel(Ew - 10, Eh - 10 - _rootPath.Eh - _effectTablePanel.Eh);
            _effectTexTablePanel.AddTableView(_effectTexTable);
            AddComponentDown(_effectTexTablePanel, _effectTablePanel);
        }
Example #12
0
        public void _init(EditorWindow win)
        {
            _rootPath             = new ELabelInput("根目录:", 80, "", 400);
            _searchBtn            = new EButton("根据目录检索", 150);
            _serchAllBtn          = new EButton("检索所有目录", 150);
            _loadRuleBtn          = new EButton("加载纹理规则", 150);
            _formatBtn            = new EButton("格式化纹理", 150);
            _searchBtn.OnClick   += OnSearchByPath;
            _serchAllBtn.OnClick += OnSearchAll;
            _loadRuleBtn.OnClick += OnloadRuleBtn;
            _formatBtn.OnClick   += OnFormatBtn;
            ERect item = _rootPath;

            AddComponent(_rootPath, 5, 5);
            item                      = AddComponentRight(_searchBtn, item);
            item                      = AddComponentRight(_serchAllBtn, item);
            item                      = AddComponentRight(_loadRuleBtn, item);
            item                      = AddComponentRight(_formatBtn, item);
            _texRuleTable             = new TableView(win, typeof(AssetFormatRule));
            _texRuleTable.OnSelected += OnRuleSelected;
            _texRuleTable.AddColumn("FilterPath", "过滤的路径", 0.45f);
            _texRuleTable.AddColumn("FilterRule", "过滤规则", 0.35f);
            _texRuleTable.AddColumn("FormatRule", "格式化", 0.25f);
            _texRuleTablePanel = new TableViewPanel(Ew - 10, 200);
            _texRuleTablePanel.AddTableView(_texRuleTable);
            AddComponent(_texRuleTablePanel, 5, 10 + _rootPath.Eh);

            _texShowTable             = new TableView(win, typeof(TextureFormatInfo));
            _texShowTable.OnSelected += OnInfoSelected;
            _texShowTable.AddColumn("Path", "路径", 0.35f, TextAnchor.MiddleLeft);
            _texShowTable.AddColumn("MemSize", "内存占用", 0.05f, TextAnchor.MiddleCenter, "<fmt_bytes>");
            _texShowTable.AddColumn("ReadWriteEnable", "R/W", 0.05f);
            _texShowTable.AddColumn("MipmapEnable", "Mipmap", 0.05f);
            _texShowTable.AddColumn("IsSpriteTag", "图集(和Format冲突)", 0.1f);
            _texShowTable.AddColumn("AndroidFormat", "AndroidFormat", 0.1f);
            _texShowTable.AddColumn("IosFormat", "IosFormat", 0.1f);
            _texShowTable.AddColumn("ImportType", "纹理格式", 0.1f);
            _texShowTable.AddColumn("ImportShape", "ImportShape", 0.1f);

            _texShowTablePanel = new TableViewPanel(Ew - 10, Eh - 10 - _rootPath.Eh - _texRuleTablePanel.Eh);
            _texShowTablePanel.AddTableView(_texShowTable);
            AddComponentDown(_texShowTablePanel, _texRuleTablePanel);
        }
Example #13
0
        public static Vector2 GetSize(List <ERect> rects)
        {
            Vector2 size = Vector2.zero;

            float minX = 0;
            float minY = 0;
            float maxX = 0;
            float maxY = 0;

            for (int i = 0; i < rects.Count; i++)
            {
                ERect rect = rects[i];

                float leftX  = rect.Ex - rect.Ew / 2;
                float leftY  = rect.Ey - rect.Eh / 2;
                float rightX = rect.Ex + rect.Ew / 2;
                float rightY = rect.Ey + rect.Eh / 2;

                if (leftX < minX)
                {
                    minX = leftX;
                }

                if (leftY < minY)
                {
                    minY = leftY;
                }

                if (rightX > maxX)
                {
                    maxX = rightX;
                }

                if (rightY > maxY)
                {
                    maxY = rightY;
                }
            }
            size.x = maxX - minX;
            size.y = maxY - minY;
            return(size);
        }
Example #14
0
        public void _init()
        {
            ERect first = null;

            for (int i = 0; i < _max_size; i++)
            {
                ELabel lab = new ELabel("", _titles_width[i]);
                _labs.Add(lab);
                if (first == null)
                {
                    AddComponent(lab, 2, 5);
                }
                else
                {
                    AddComponentRight(lab, first, 0);
                }

                first = lab;
            }
        }
Example #15
0
 public override void AddComponent(ERect rect, E_Anchor anchor)
 {
     Debug.LogError("垂直布局,不支持这种添加方式");
 }
Example #16
0
 //依靠在item的右边
 public void SetPositionRight(ERect item, float width = 10)
 {
     _pos.x = item.Ex + item.Ew / 2 + _size.x / 2 + width;
     _pos.y = item.Ey - item.Eh / 2 + _size.y / 2;
 }
Example #17
0
 public void SetPositionLeft(ERect item, float width = 10)
 {
     _pos.x = item.Ex - item.Ew / 2 - _size.x / 2 - width;
     _pos.y = item.Ey;
 }
Example #18
0
        //添加
        public virtual void AddComponent(ERect rect)
        {
            E_Anchor a = E_Anchor.Left | E_Anchor.UP;

            AddComponent(rect, a);
        }
Example #19
0
 public void SetPositionDown(ERect item, float height = 10)
 {
     _pos.x = item.Ex;
     _pos.y = item.Ey + item.Eh / 2 + _size.y / 2 + height;
 }
Example #20
0
 public void _internal_add_chile(ERect item)
 {
     item.parent = this;
     _childs.Add(item);
 }