Exemplo n.º 1
0
    private static void SetupDeviceToAtlasInfo()
    {
        _deviceToAtlasInfo = new Dictionary <RSAtlasHelper.Device, List <AtlasInfo> >();

        RSAtlasHelper.Device[] devices = { RSAtlasHelper.Device.Tablet, RSAtlasHelper.Device.Phone };

        for (int i = 0; i < devices.Length; ++i)
        {
            var device  = devices[i];
            var dirInfo = new DirectoryInfo(string.Format("Assets/Resources/Atlases/{0}/", device));
            if (dirInfo == null || !dirInfo.Exists)
            {
                continue;
            }
            var fis        = dirInfo.GetFiles("*.prefab");
            var atlasNames = new List <string>();
            foreach (var fi in fis)
            {
                atlasNames.Add(fi.Name.Split('@')[0]);
            }

            _deviceToAtlasInfo[device] = new List <AtlasInfo>();
            foreach (var atlasName in atlasNames)
            {
                var atlasInfo = new AtlasInfo();
                atlasInfo.atlasName = atlasName;
                if (device == RSAtlasHelper.Device.Tablet)
                {
                    atlasInfo.hdAtlas = RSAtlasHelper.GetAtlas(atlasName, device, RSAtlasHelper.AtlasType.HD);
                }
                atlasInfo.refAtlas = RSAtlasHelper.GetAtlas(atlasName, device, RSAtlasHelper.AtlasType.Ref);
                atlasInfo.sdAtlas  = RSAtlasHelper.GetAtlas(atlasName, device, RSAtlasHelper.AtlasType.SD);
                _deviceToAtlasInfo[device].Add(atlasInfo);
            }
        }
    }