摘要: function getCacheData(key: string): any { return (window as any).cache[key]; } interface Cat { name: string; run(): void; } const tom = getCacheData(' 阅读全文
posted @ 2020-12-13 11:20 小翔momo 阅读(176) 评论(0) 推荐(0) 编辑
摘要: function toBoolean(something: any): boolean { return something as boolean; } cc.log(toBoolean(1)); 上面代码输出还是1,something还是number类型,类型断言并没有什么用 function t 阅读全文
posted @ 2020-12-13 10:51 小翔momo 阅读(152) 评论(1) 推荐(0) 编辑
摘要: interface Cat { run(): void; } interface Fish { swim(): void; } function testCat(cat: Cat) { return (cat as any as Fish); } 在上面的例子中,若直接使用 cat as Fish  阅读全文
posted @ 2020-12-13 10:34 小翔momo 阅读(197) 评论(0) 推荐(0) 编辑
摘要: 1 std::string CSLoader::GetTextureListFromCsb(const std::string& filename) 2 { 5 std::string path = filename; 6 size_t pos = path.find_last_of('.'); 7 std::string suffix = path.subst... 阅读全文
posted @ 2019-03-21 13:02 小翔momo 阅读(196) 评论(0) 推荐(0) 编辑
摘要: 解决办法: 在空闲时候异步预加载,后面切换场景就会快很多,前提是内存充足的情况下。 cocos2d-x lua图片资源异步预加载示例: 阅读全文
posted @ 2019-03-21 12:54 小翔momo 阅读(850) 评论(0) 推荐(0) 编辑
摘要: 1. 问题:引导指示箭头和按钮不在屏幕中。 解决方案:scene的位置不一样,把游戏场景和引导场景x、y位置保持一致。 2. 问题:grid layout group组件中,取子节点世界坐标是乱的,不是正确的世界坐标。 解决方案1:这个组件会进行排序,要延迟取世界坐标,不能在排序之前取世界坐标,一般 阅读全文
posted @ 2015-12-25 16:17 小翔momo 阅读(155) 评论(0) 推荐(0) 编辑
摘要: 我们需要把代码里面的R.xx.xx改成以下方式读取: 1 package com.xlcw.sdk.tool; 2 3 import java.lang.reflect.Field; 4 import android.content.Context; 5 import android.util.L... 阅读全文
posted @ 2015-11-21 09:32 小翔momo 阅读(959) 评论(0) 推荐(0) 编辑
摘要: 在开发过程中,发现小米4c调用CallStaticObjectMethod就会奔溃解决办法:把CallStaticObjectMethod换成CallStaticIntMethod后正常调用PS:怀疑是小米4c手机CallStaticObjectMethod函数底层有bug 阅读全文
posted @ 2015-11-18 14:55 小翔momo 阅读(604) 评论(0) 推荐(0) 编辑
摘要: 查找类、方法和属性的引用:ctrl + shift + g为函数添加注释:/** + 回车在本文件中查找变量:ctrl + shift + u单行注释:ctrl + /块注释:ctrl + shift + /查找本类中的方法:ctrl + o快速向下查找选中内容:ctrl + k快速向上查找选中内容... 阅读全文
posted @ 2015-11-11 20:51 小翔momo 阅读(172) 评论(0) 推荐(0) 编辑
摘要: 1 private static Handler mHandler = new Handler(){ 2 @Override 3 public void handleMessage(Message msg) 4 { 5 if(msg.what == 0) ... 阅读全文
posted @ 2015-11-05 19:31 小翔momo 阅读(143) 评论(0) 推荐(0) 编辑