u3d消消乐移植Laya心得总结
试玩地址
因为原版用了U3D的大量的携程做UI和特效效果
所以需要攻克的问题是 ts实现u3d携程,并在真机通过代码测试
//以上的代码的意思是等待 0.5秒后初始化完成
我的项目编译时webpack编译出来的bundle.js
还要在前面加上
promise.js 的内容
注意!微信开发者工具需要增强编译,否则报错
经过以上步骤才能在微信小游戏里实现携程的功能
总结:Webpack编译+bundle.js头部放入promise.js 内容+微信增强编译
但是因为 在微信上使用了xml(位图字体)。必须导入
又因为使用增强编译,导致类库报错,所以要修改js文件
特效移植 颜色动画播放出错
export class AnimatorFix {
public static FixUVANDColr(owner: Laya.Node) {
let animator = owner.getComponent(Laya.Animator);
let d = animator._keyframeNodeOwners;
for (let key in d) {
let item = d[key];
// 修改 颜色 报错
if (item.fullPath.search("material._TintColor") != -1) {
console.log('material._TintColor');
item.fullPath = item.fullPath.replace("_TintColor", "color");
for (let i = 0; i < item.property.length; i++) {
if (item.property[i] == "_TintColor") {
item.property[i] = "color";
}
}
}
}
}
C#->js 代码重构
预期结果是true,但实际结果是false
原因
vector向量在c#是结构体是进行值比较,而js是类 进行的是地址指针比较