Giter Club home page Giter Club logo

ngui-cocos-creator-convertor's Introduction

插件说明

需求将Unity项目移植到CocosCreator(H5). 如果UI全部重拼一遍太费时费力. 故抽出时间写了这个扩展. 用于Unity NGUI制作的UI prefab移植到Cocos Creator.

NGUI版本: 3.8.2
CocosCreator版本:

  • 1.9.x使用 CocosCreator 中的插件
  • 1.10.x及2.x使用 CocosCreator_1.10_2.x 中的插件

工作原理

将Unity中prefab的节点父子结构, 以及节点上NGUI的UISprite, UILabel, UITexture等控件的有用信息保存至json文件. 在CocosCreator中解析后再创建.

目前可移植项:

  • 节点: position, scale, rotation(仅z轴), active, name
  • UIWidget: 锚点信息, 宽高, 颜色
  • UISprite, UITexture: 图集, 图片, 是否使用Slice, 九宫格Border信息
  • UILabel: 字号, 描边颜色宽度, overflow, 对齐方式, 行间距, bitmap字体(字间距)
  • 带有BoxCollider的节点会被挂载UIButton
  • 子节点按UIWidget的depth排序
  • ScrollView + Grid: 不完美移植,由于两方控件区别较大, 暂时没想到什么好方法完美移植. 现阶段支持使用最多的竖排列表的移植, 移植后需微调间距等数值.

可以覆盖大部分需求.

使用方法

  1. Unity 文件夹内文件放至Unity工程内. 在Prefab上右键导出Json文件.
  2. prefab-creator 文件夹放至CocosCreator工程packages目录下. 在扩展菜单中选择 Prefab生成工具 打开扩展窗口. 配置导出路径以及图片文件夹. 图片/字体文件夹内放入需要的资源, 支持图集和散图, 图集文件名/图集内图片文件名/散图文件名/字体文件名要与Unity端一致!!!. 之后拖入第一步导出的Json文件, 点生成即可.
  3. 首次创建时需要加载文件夹内的所有图片, 根据图片数量可能需要较长时间. 所以建议移除文件夹内的无用图片资源.

效果预览

如果这帮到你请我喝杯咖啡吧~:coffee:

ngui-cocos-creator-convertor's People

Contributors

glegoo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.