GameConst.ts 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  1. const { ccclass } = cc._decorator;
  2. @ccclass
  3. export default class GameConst extends cc.Component {
  4. /**资源文件夹 */
  5. public static res_dirArr = ["game/config"];
  6. //OSS配置数据----------------------------------------------------------------
  7. /**关卡配置 */
  8. public static config_level: any = null;
  9. /**方块的icon index */
  10. public static iconIndex: number = 6;
  11. public static maxIconIndex: number = 2;
  12. //游戏数据------------------------------------------------------------------
  13. /**纵列 */
  14. public static col_num: number = 8;
  15. /**横列 */
  16. public static row_num: number = 8;
  17. /**加载配置 */
  18. public static loadConfig(): Promise<any> {
  19. return new Promise((resolve, reject) => {
  20. GameConst.res_dirArr.forEach(element => {
  21. cc.resources.loadDir(element, function (completedCount, totalCount, item) {
  22. // Loading.curloadedNum++;
  23. }, () => {
  24. GameConst.config_level = (cc.resources.get(`game/config/level`) as cc.JsonAsset).json;
  25. resolve(null);
  26. });
  27. });
  28. })
  29. }
  30. }