Laya
颠沛流离。。
这个作者很懒,什么都没留下…
展开
-
【Laya】 ClientTools【客户端工具】
1. {0} - {n} 之间获取一个随机数 public static GetRandomNum(min : number , max : number) { let num : number = min + (( max - min ) * Math.random()); return num; }2.数据转换 num-int;...原创 2019-01-26 14:44:38 · 1721 阅读 · 0 评论 -
【Laya】 解析string字符串
class KeyValueData{ //语言enum public _id : number; public _value : number; constructor(id:number,value:number){ this._id = id; this._value = value; }}class C...原创 2019-01-26 14:46:57 · 1146 阅读 · 0 评论 -
【Laya】BmFont(位图)字体的使用
1. 用BmFont生成,一个.fnt 和 一个.png 俩个文件。 (这个流程就不叙述,网上很多教程) - 如下图 打开-如下图2. 进行更改成xml 就按照这个格式,改就对了。3. 脚本 加载字体 4. 使用设置字体 预制体里,设置即可。 如果出现,没使用成功的话 ,那就在打开ui的时候设置一下字体。...原创 2019-01-26 14:58:44 · 1482 阅读 · 1 评论 -
【Laya】Debug脚本
/** name;*/class Debuger{ public static _isEdit : boolean = true; public static LogError(str:string | Number) { if(Debuger._isEdit) { console.log("error-...原创 2019-01-26 15:04:20 · 331 阅读 · 0 评论 -
【Laya】字典的使用
/**字典数据结构类 */// interface IDictionaryGetSet<KT, VT> {// readonly [key:string] : any;// }class Dictionary<KT, VT> { private keys: KT[] = []; private values: VT[] = []; protected c...原创 2019-01-26 15:06:04 · 1109 阅读 · 0 评论 -
【Laya】按钮点击缩放效果
制作方法- 附加脚本1. 在编辑模式里,创建一个附加脚本。 如图2. 导出 - 3. 在代码模式下,创建脚本。/*** name */module game{ export class ScaleButtonScript { public delayTime: number = 0; public minScale: numb...原创 2019-01-26 15:14:53 · 2563 阅读 · 0 评论 -
【Laya】枚举
enum UIName{ UILoading = 1,// 正面 UISkin = 2,// 反面 UIRank = 3,// 反面 UIOther = 0}原创 2019-01-26 15:19:26 · 931 阅读 · 1 评论 -
【Laya】发送和接收事件
UI监听的方法onShow() { ClientEventManager.Instance.On(ClientEvent.UPDATE_GAME_MONEY, this, this.OnUpdataMoney); } // 关闭界面 onClosed(): void { C...原创 2019-01-28 15:33:03 · 1958 阅读 · 0 评论 -
【Laya】微信分享功能
使用方法1. 被动转发 在gamemain,这个游戏开始的脚本,读取完数据后,就添加这行脚本。 2. 主动转发3. 这里有个图片,得找美术要一张。 位置是 4. 具体脚本如下图。 直接复制粘贴就好,即可使用。/** 平台管理器;*/class PlatformManager extends Singleton { //-------------...原创 2019-01-30 14:24:45 · 2608 阅读 · 1 评论