示例#1
0
        public static UIInfo LoadUIInfo(this CsvTable table)
        {
            if (table.IsUIInfoTable(false))
            {
                var uiInfo = new UIInfo(table.name);

                if (table.Rows != null && table.Columns != null)
                {
                    for (int i = 0; i < table.Rows.Count; i++)
                    {
                        var layerInfo = new LayerInfo();
                        layerInfo.name = table[0, i];
                        layerInfo.path = table[1, i];
                        layerInfo.type = table[2, i];
                        layerInfo.rect = ParamAnalysisTool.StringToRect(table[3, i]);
                        var resourceDic = ParamAnalysisTool.ToDictionary(table[4, i]);
                        if (resourceDic != null)
                        {
                            ChargeDic(layerInfo.resourceDic, resourceDic);
                        }


                        if (table.Columns.Count > 5)
                        {
                            List <ResourceDic> sub_images;
                            List <ResourceDic> sub_texts;
                            List <ResourceDic> sub_rawImages;
                            var subResourceDic = ParamAnalysisTool.ToDictionary_Sub(table[5, i], out sub_images, out sub_texts, out sub_rawImages);
                            if (subResourceDic != null)
                            {
                                ChargeDic(layerInfo.subResourceDic, subResourceDic);
                            }
                            ChargeList(layerInfo.sub_images, sub_images);
                            ChargeList(layerInfo.sub_texts, sub_texts);
                            ChargeList(layerInfo.sub_rawImages, sub_rawImages);
                        }

                        uiInfo.layers.Add(layerInfo);
                    }
                }

                return(uiInfo);
            }
            return(null);
        }