设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 3400|回复: 4
打印 上一主题 下一主题

[有事请教] 如何在图片文件夹下创建子文件夹分类管理图片?

[复制链接]

Lv3.寻梦者

梦石
0
星屑
953
在线时间
191 小时
注册时间
2017-10-30
帖子
29
跳转到指定楼层
1
发表于 2018-2-24 12:54:41 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x
由于图片比较多,想要分类管理。。
但是经过试验目前只有第一层目录下的图片文件可正常读取,如果自己再直接建子文件夹是不行的
有没有什么方法可以解决呢?多谢

Lv3.寻梦者

梦石
0
星屑
4349
在线时间
552 小时
注册时间
2017-12-2
帖子
41
2
发表于 2018-2-24 16:12:42 | 只看该作者
JAVASCRIPT 代码复制
  1. //-----------------------------------------------------------------------------
  2. // ImageManager
  3. //
  4. // The static class that loads images, creates bitmap objects and retains them.
  5.  
  6. function ImageManager() {
  7.     throw new Error('This is a static class');
  8. }
  9.  
  10. ImageManager.cache = new CacheMap(ImageManager);
  11.  
  12. ImageManager._imageCache = new ImageCache();
  13. ImageManager._requestQueue = new RequestQueue();
  14. ImageManager._systemReservationId = Utils.generateRuntimeId();
  15.  
  16. ImageManager._generateCacheKey = function(path, hue){
  17.     return  path + ':' + hue;
  18. };
  19.  
  20. ImageManager.loadAnimation = function(filename, hue) {
  21.     return this.loadBitmap('img/animations/', filename, hue, true);
  22. };
  23.  
  24. ImageManager.loadBattleback1 = function(filename, hue) {
  25.     return this.loadBitmap('img/battlebacks1/', filename, hue, true);
  26. };
  27.  
  28. ImageManager.loadBattleback2 = function(filename, hue) {
  29.     return this.loadBitmap('img/battlebacks2/', filename, hue, true);
  30. };
  31.  
  32. ImageManager.loadEnemy = function(filename, hue) {
  33.     return this.loadBitmap('img/enemies/', filename, hue, true);
  34. };
  35.  
  36. ImageManager.loadCharacter = function(filename, hue) {
  37.     return this.loadBitmap('img/characters/', filename, hue, false);
  38. };
  39.  
  40. ImageManager.loadFace = function(filename, hue) {
  41.     return this.loadBitmap('img/faces/', filename, hue, true);
  42. };
  43.  
  44. ImageManager.loadParallax = function(filename, hue) {
  45.     return this.loadBitmap('img/parallaxes/', filename, hue, true);
  46. };
  47.  
  48. ImageManager.loadPicture = function(filename, hue) {
  49.     return this.loadBitmap('img/pictures/', filename, hue, true);
  50. };
  51.  
  52. ImageManager.loadSvActor = function(filename, hue) {
  53.     return this.loadBitmap('img/sv_actors/', filename, hue, false);
  54. };
  55.  
  56. ImageManager.loadSvEnemy = function(filename, hue) {
  57.     return this.loadBitmap('img/sv_enemies/', filename, hue, true);
  58. };
  59.  
  60. ImageManager.loadSystem = function(filename, hue) {
  61.     return this.loadBitmap('img/system/', filename, hue, false);
  62. };
  63.  
  64. ImageManager.loadTileset = function(filename, hue) {
  65.     return this.loadBitmap('img/tilesets/', filename, hue, false);
  66. };
  67.  
  68. ImageManager.loadTitle1 = function(filename, hue) {
  69.     return this.loadBitmap('img/titles1/', filename, hue, true);
  70. };
  71.  
  72. ImageManager.loadTitle2 = function(filename, hue) {
  73.     return this.loadBitmap('img/titles2/', filename, hue, true);
  74. };
  75.  
  76. ImageManager.loadBitmap = function(folder, filename, hue, smooth) {
  77.     if (filename) {
  78.         var path = folder + encodeURIComponent(filename) + '.png';
  79.         var bitmap = this.loadNormalBitmap(path, hue || 0);
  80.         bitmap.smooth = smooth;
  81.         return bitmap;
  82.     } else {
  83.         return this.loadEmptyBitmap();
  84.     }
  85. };
  86.  
  87. ImageManager.loadEmptyBitmap = function() {
  88.     var empty = this._imageCache.get('empty');
  89.     if(!empty){
  90.         empty = new Bitmap();
  91.         this._imageCache.add('empty', empty);
  92.         this._imageCache.reserve('empty', empty, this._systemReservationId);
  93.     }
  94.  
  95.     return empty;
  96. };
  97.  
  98. ImageManager.loadNormalBitmap = function(path, hue) {
  99.     var key = this._generateCacheKey(path, hue);
  100.     var bitmap = this._imageCache.get(key);
  101.     if (!bitmap) {
  102.         bitmap = Bitmap.load(path);
  103.         bitmap.addLoadListener(function() {
  104.             bitmap.rotateHue(hue);
  105.         });
  106.         this._imageCache.add(key, bitmap);
  107.     }else if(!bitmap.isReady()){
  108.         bitmap.decode();
  109.     }
  110.  
  111.     return bitmap;
  112. };
  113.  
  114. ImageManager.clear = function() {
  115.     this._imageCache = new ImageCache();
  116. };
  117.  
  118. ImageManager.isReady = function() {
  119.     return this._imageCache.isReady();
  120. };
  121.  
  122. ImageManager.isObjectCharacter = function(filename) {
  123.     var sign = filename.match(/^[\!\$]+/);
  124.     return sign && sign[0].contains('!');
  125. };
  126.  
  127. ImageManager.isBigCharacter = function(filename) {
  128.     var sign = filename.match(/^[\!\$]+/);
  129.     return sign && sign[0].contains('$');
  130. };
  131.  
  132. ImageManager.isZeroParallax = function(filename) {
  133.     return filename.charAt(0) === '!';
  134. };
  135.  
  136.  
  137. ImageManager.reserveAnimation = function(filename, hue, reservationId) {
  138.     return this.reserveBitmap('img/animations/', filename, hue, true, reservationId);
  139. };
  140.  
  141. ImageManager.reserveBattleback1 = function(filename, hue, reservationId) {
  142.     return this.reserveBitmap('img/battlebacks1/', filename, hue, true, reservationId);
  143. };
  144.  
  145. ImageManager.reserveBattleback2 = function(filename, hue, reservationId) {
  146.     return this.reserveBitmap('img/battlebacks2/', filename, hue, true, reservationId);
  147. };
  148.  
  149. ImageManager.reserveEnemy = function(filename, hue, reservationId) {
  150.     return this.reserveBitmap('img/enemies/', filename, hue, true, reservationId);
  151. };
  152.  
  153. ImageManager.reserveCharacter = function(filename, hue, reservationId) {
  154.     return this.reserveBitmap('img/characters/', filename, hue, false, reservationId);
  155. };
  156.  
  157. ImageManager.reserveFace = function(filename, hue, reservationId) {
  158.     return this.reserveBitmap('img/faces/', filename, hue, true, reservationId);
  159. };
  160.  
  161. ImageManager.reserveParallax = function(filename, hue, reservationId) {
  162.     return this.reserveBitmap('img/parallaxes/', filename, hue, true, reservationId);
  163. };
  164.  
  165. ImageManager.reservePicture = function(filename, hue, reservationId) {
  166.     return this.reserveBitmap('img/pictures/', filename, hue, true, reservationId);
  167. };
  168.  
  169. ImageManager.reserveSvActor = function(filename, hue, reservationId) {
  170.     return this.reserveBitmap('img/sv_actors/', filename, hue, false, reservationId);
  171. };
  172.  
  173. ImageManager.reserveSvEnemy = function(filename, hue, reservationId) {
  174.     return this.reserveBitmap('img/sv_enemies/', filename, hue, true, reservationId);
  175. };
  176.  
  177. ImageManager.reserveSystem = function(filename, hue, reservationId) {
  178.     return this.reserveBitmap('img/system/', filename, hue, false, reservationId || this._systemReservationId);
  179. };
  180.  
  181. ImageManager.reserveTileset = function(filename, hue, reservationId) {
  182.     return this.reserveBitmap('img/tilesets/', filename, hue, false, reservationId);
  183. };
  184.  
  185. ImageManager.reserveTitle1 = function(filename, hue, reservationId) {
  186.     return this.reserveBitmap('img/titles1/', filename, hue, true, reservationId);
  187. };
  188.  
  189. ImageManager.reserveTitle2 = function(filename, hue, reservationId) {
  190.     return this.reserveBitmap('img/titles2/', filename, hue, true, reservationId);
  191. };
  192.  
  193. ImageManager.reserveBitmap = function(folder, filename, hue, smooth, reservationId) {
  194.     if (filename) {
  195.         var path = folder + encodeURIComponent(filename) + '.png';
  196.         var bitmap = this.reserveNormalBitmap(path, hue || 0, reservationId || this._defaultReservationId);
  197.         bitmap.smooth = smooth;
  198.         return bitmap;
  199.     } else {
  200.         return this.loadEmptyBitmap();
  201.     }
  202. };
  203.  
  204. ImageManager.reserveNormalBitmap = function(path, hue, reservationId){
  205.     var bitmap = this.loadNormalBitmap(path, hue);
  206.     this._imageCache.reserve(this._generateCacheKey(path, hue), bitmap, reservationId);
  207.  
  208.     return bitmap;
  209. };
  210.  
  211. ImageManager.releaseReservation = function(reservationId){
  212.     this._imageCache.releaseReservation(reservationId);
  213. };
  214.  
  215. ImageManager.setDefaultReservationId = function(reservationId){
  216.     this._defaultReservationId = reservationId;
  217. };
  218.  
  219.  
  220. ImageManager.requestAnimation = function(filename, hue) {
  221.     return this.requestBitmap('img/animations/', filename, hue, true);
  222. };
  223.  
  224. ImageManager.requestBattleback1 = function(filename, hue) {
  225.     return this.requestBitmap('img/battlebacks1/', filename, hue, true);
  226. };
  227.  
  228. ImageManager.requestBattleback2 = function(filename, hue) {
  229.     return this.requestBitmap('img/battlebacks2/', filename, hue, true);
  230. };
  231.  
  232. ImageManager.requestEnemy = function(filename, hue) {
  233.     return this.requestBitmap('img/enemies/', filename, hue, true);
  234. };
  235.  
  236. ImageManager.requestCharacter = function(filename, hue) {
  237.     return this.requestBitmap('img/characters/', filename, hue, false);
  238. };
  239.  
  240. ImageManager.requestFace = function(filename, hue) {
  241.     return this.requestBitmap('img/faces/', filename, hue, true);
  242. };
  243.  
  244. ImageManager.requestParallax = function(filename, hue) {
  245.     return this.requestBitmap('img/parallaxes/', filename, hue, true);
  246. };
  247.  
  248. ImageManager.requestPicture = function(filename, hue) {
  249.     return this.requestBitmap('img/pictures/', filename, hue, true);
  250. };
  251.  
  252. ImageManager.requestSvActor = function(filename, hue) {
  253.     return this.requestBitmap('img/sv_actors/', filename, hue, false);
  254. };
  255.  
  256. ImageManager.requestSvEnemy = function(filename, hue) {
  257.     return this.requestBitmap('img/sv_enemies/', filename, hue, true);
  258. };
  259.  
  260. ImageManager.requestSystem = function(filename, hue) {
  261.     return this.requestBitmap('img/system/', filename, hue, false);
  262. };
  263.  
  264. ImageManager.requestTileset = function(filename, hue) {
  265.     return this.requestBitmap('img/tilesets/', filename, hue, false);
  266. };
  267.  
  268. ImageManager.requestTitle1 = function(filename, hue) {
  269.     return this.requestBitmap('img/titles1/', filename, hue, true);
  270. };
  271.  
  272. ImageManager.requestTitle2 = function(filename, hue) {
  273.     return this.requestBitmap('img/titles2/', filename, hue, true);
  274. };
  275.  
  276. ImageManager.requestBitmap = function(folder, filename, hue, smooth) {
  277.     if (filename) {
  278.         var path = folder + encodeURIComponent(filename) + '.png';
  279.         var bitmap = this.requestNormalBitmap(path, hue || 0);
  280.         bitmap.smooth = smooth;
  281.         return bitmap;
  282.     } else {
  283.         return this.loadEmptyBitmap();
  284.     }
  285. };
  286.  
  287. ImageManager.requestNormalBitmap = function(path, hue){
  288.     var key = this._generateCacheKey(path, hue);
  289.     var bitmap = this._imageCache.get(key);
  290.     if(!bitmap){
  291.         bitmap = Bitmap.request(path);
  292.         bitmap.addLoadListener(function(){
  293.             bitmap.rotateHue(hue);
  294.         });
  295.         this._imageCache.add(key, bitmap);
  296.         this._requestQueue.enqueue(key, bitmap);
  297.     }else{
  298.         this._requestQueue.raisePriority(key);
  299.     }
  300.  
  301.     return bitmap;
  302. };
  303.  
  304. ImageManager.update = function(){
  305.     this._requestQueue.update();
  306. };
  307.  
  308. ImageManager.clearRequest = function(){
  309.     this._requestQueue.clear();
  310. };
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
2346
在线时间
168 小时
注册时间
2017-4-25
帖子
219
3
发表于 2018-5-26 21:35:21 | 只看该作者
Mehmet 发表于 2018-2-24 16:12
//-----------------------------------------------------------------------------
// ImageManager
//

怎么用啊?
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
3750
在线时间
1177 小时
注册时间
2016-8-9
帖子
2395

开拓者

4
发表于 2018-5-27 14:16:10 | 只看该作者
根本不需要子文件夹,因为加了之后即使能够使用插件去解决,但是别的插件需要调用pic文件夹的话,你不能每个插件都去改动,很麻烦的。

我是采用首字母关键字,通过名称来分类的,比如几大类,通过大写字母与数字组合放在名称前即可
酸酸甜甜就④哇噢
回复 支持 反对

使用道具 举报

Lv3.寻梦者 (暗夜天使)

名侦探小柯

梦石
0
星屑
3299
在线时间
3619 小时
注册时间
2006-9-6
帖子
37400

开拓者贵宾第3届短篇游戏大赛主流游戏组亚军第5届短篇游戏比赛亚军

5
发表于 2018-5-27 16:53:41 | 只看该作者
这个是软件本身的限制,哪怕插件自身支持子文件也没用,你在软件里还是不支持的,除非改软件,所以像LS所说用名字来做规划比较好
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-11-30 12:37

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表