1 Star 1 Fork 16

yarmyq / CocosCreator简易开发框架

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

SCL

SCL是一套基于CocosCreator的极简(Simple)、基于组件(Component)以及类库(Libs)的开源框架,主要服务于休闲类游戏的快速开发。

弹框管理使用

  1. 在弹框之前初始化
PopupManager.instance.init();
  1. 将弹框制作成prefab,并挂在继承PopupBase的脚本组件
    /**
     * 是否设置点击拦截
     */
    @property(CCBoolean)
    blockInput: boolean = true;

    /**
     * 是否显示弹框动画
     */
    @property(CCBoolean)
    anim: boolean = true;

    /**
     * 弹框动画类型
     */
    @property({
        type: Enum(AnimType),
        visible() {
            return (this as any).anim;
        }
    })
    animType: AnimType = AnimType.SCALE;
  1. 显示弹框
PopupManager.instance.show(option: { name?: string, prefab?: Prefab, path?: string, siblingIndex?: number, params?: any, keep?: boolean });
参数 类型 默认值 说明
name string null 自定义弹框名字
prefab Prefab null Prefab
path string null 动态加载的路径
siblingIndex number 0 层级
params any null 传递的参数
keep boolean false 是否保留当前弹框
  1. 隐藏弹框
PopupManager.instance.hide(name:string);
// 隐藏所有
PopupManager.instance.hideAll();
  1. 销毁弹框
PopupManager.instance.remove(name:string)
// 销毁所有
PopupManager.instance.removeAll();
  1. 获取当前弹框
// 弹框Node,如果当前没有弹框,返回null
PopupManager.instance.getCurrentPopup():Node|null;
// 弹框名字,如果当前没有弹框,则返回null
PopupManager.instance.getCurrentName(): string | null;
  1. 获取某个弹框
PopupManager.instance.getPopup(name: string): Node | null;

本地化存储

API

  1. 初始化密钥
SqlUtil.init(key: string, iv: string);
  1. 存储
SqlUtil.set(key: string, value: any);
  1. 取出
SqlUtil.get(key: string, defaultValue?: any);
  1. 移除
SqlUtil.remove(key: string);
  1. 清空
SqlUtil.clear();

组件

CanvasAdapter

挂载后,选择模式

  • EXACT_FIT = ResolutionPolicy.EXACT_FIT, // 拉伸适配,目前已不被支持
  • NO_BORDER = ResolutionPolicy.NO_BORDER, // 铺满屏幕
  • SHOW_ALL = ResolutionPolicy.SHOW_ALL, // 内容完整显示,裁剪区域
  • FIXED_HEIGHT = ResolutionPolicy.FIXED_HEIGHT, // 适配高
  • FIXED_WIDTH = ResolutionPolicy.FIXED_WIDTH, // 适配宽
  • CUSTOM = 9 // 完整显示内容,但不裁剪区域

吐司

Toast.makeTest(node: Node|null, test: string, time:number).show();
MIT License Copyright (c) 2021 dream93 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

基于CocosCreator引擎的一套开发框架,突出简易、组件、工具化 展开 收起
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/yarmyq/scl.git
git@gitee.com:yarmyq/scl.git
yarmyq
scl
CocosCreator简易开发框架
main

搜索帮助

344bd9b3 5694891 D2dac590 5694891