LuaQuick框架(客户端)

996传奇引擎三端lua快速开发


co

<p>[TOC]</p> <h3>返回 {x=x,y=y}</h3> <pre><code>co.p(x,y)</code></pre> <h3>返回 {width = width,height = height}</h3> <pre><code>co.size(width,height)</code></pre> <h3>检测c3b.r,c3b.g,c3b.b 任意一个有值 为true</h3> <pre><code>co.isc3b(c3b)</code></pre> <h3>返回 {r=r,g=g,b=b}</h3> <pre><code>co.c3b(r,g,b)</code></pre> <pre><code class="language-lua">if type(r) == &amp;quot;table&amp;quot; then     if co.isc3b(r) then         return r     else         return {r = r[1] or 0,g = r[2] or 0,b = r[3] or 0}     end else     return {r = r or 0,g = g or 0,b = b or 0} end</code></pre> <h3>根据key删除表中元素</h3> <p>`co.delete(t,k)</p> <h3>物品数组转物品数组对象</h3> <pre><code>co.item(array)</code></pre> <pre><code>array {10011,1} 返回值 table = { id    = 10011,  物品ID count = 1,      物品数量 bind  = 390,    绑定规则(没有则为nil) }</code></pre> <h3>物品二维数组转物品二维数组对象</h3> <pre><code>co.items(array)</code></pre> <pre><code>array {{10011,1},{10012,1}} 返回值 table = { [1] = { id    = 10011,  物品ID count = 1,      物品数量 bind  = 390,    绑定规则(没有则为nil) }, [2] = { id    = 10011,  物品ID count = 1,      物品数量 bind  = 390,    绑定规则(没有则为nil) }, }</code></pre> <h3>属性数组转属性数组对象</h3> <pre><code>co.attr(array)</code></pre> <pre><code>array = 属性数组{1,10} 返回值 table = { id = 1,      属性ID value = 10,  属性值 }</code></pre> <h3>属性二维数组转属性二维数组对象</h3> <pre><code>co.attrs(array)</code></pre> <pre><code>array 属性二维数组{{1,10},{2,10}} 返回值 table = { [1] = { id    = 1,  属性ID value = 10, 属性值 }, [2] = { id    = 2,  属性ID value = 10, 属性值 }, }</code></pre> <h3>c3b颜色转十六进制颜色</h3> <pre><code>co.toHex(c3b)</code></pre> <pre><code>c3b  table {r = 0,g = 0,b = 0} 返回值 &amp;quot;#000000&amp;quot;</code></pre> <h3>富文本超链转参数对象</h3> <pre><code>co.jumpLink(str)</code></pre> <pre><code>str 超链字符串 返回值 table { head 超链头 type 超链类型 id   超链ID }</code></pre> <h3>字符串转二维数组</h3> <pre><code>co.array(str)</code></pre> <pre><code>str  格式10^10|20^20 返回值 table = { [1] = { [1] = 10, [2] = 10, }, [2] = { [1] = 20, [2] = 20, } }</code></pre> <h3>字符串转数组</h3> <pre><code>co.array1(str)</code></pre> <pre><code>str  格式10|20 返回值 table = { [1] = 10, [2] = 20, }</code></pre> <h3>获取父节点的快捷子控件组</h3> <pre><code>co.quickChildren(parent)</code></pre> <pre><code>返回值: table [key 为控件名称]</code></pre> <h3>判断c对象是否为null</h3> <pre><code>co.isnull(widget)</code></pre> <h3>加载UI文件,Ctrl+f9 界面编辑器导出的lua文件</h3> <pre><code>co.LoadGUI(parent,filename)</code></pre> <h3>克隆widget目录下的UI</h3> <pre><code>co.loadWidget(parent,filename,func)</code></pre> <h3>快捷取控件</h3> <pre><code>co.loadChildren(filename,func)</code></pre> <pre><code>filename 文件名称(GUI输出文件或COCOS输出文件,优先读取GUI输出文件) func 回调函数,参数(parent children)</code></pre> <h3>H5加载json文件</h3> <pre><code>co.loadJson(filename,callback)</code></pre> <pre><code>filename 文件名称 callback 回调函数,参数(data)</code></pre> <h3>显示文本Tips</h3> <pre><code>co.ShowWorldTips(tips, worldPos, anchorPoint)</code></pre> <pre><code>tips        显示文本 worldPos    世界坐标 anchorPoint 锚点</code></pre> <h3>关闭文本Tips</h3> <pre><code>co.HideWorldTips()</code></pre> <h3>移动到B点:以世界坐标系为原点(0,0)</h3> <pre><code>co.MoveTo(time, x, y)</code></pre> <h3>A点移动到B点 移动相对位置:以A点为原点(0,0)</h3> <pre><code>co.MoveBy(time, x, y)</code></pre> <h3>放大或缩小到某一比例有第三个参数时, 后两位参数分别表示X轴缩放比、Y轴缩放比 3.40.8版本新增</h3> <pre><code>co.ScaleTo(time, scale, ...)</code></pre> <h3>放大或缩小到原来的某一比例有第三个参数时, 后两位参数分别表示X轴缩放比、Y轴缩放比 3.40.8版本新增</h3> <pre><code>co.ScaleBy(time, scale, ...)</code></pre> <h3>旋转到多少角度</h3> <pre><code>co.RotateTo(time, value)</code></pre> <h3>旋转到原来的多少角度</h3> <pre><code>co.RotateBy(time, value)</code></pre> <h3>淡入</h3> <pre><code>co.FadeIn(time)</code></pre> <h3>淡出</h3> <pre><code>co.FadeOut(time)</code></pre> <h3>时间 透明度</h3> <pre><code>co.FadeTo(time,opacity)</code></pre> <h3>闪烁</h3> <pre><code>co.Blink(time, num)</code></pre> <h3>动画回调函数</h3> <pre><code>co.CallFunc(callback)</code></pre> <h3>延迟</h3> <pre><code>co.DelayTime(time)</code></pre> <h3>显示</h3> <pre><code>co.Show()</code></pre> <h3>隐藏</h3> <pre><code>co.Hide()</code></pre> <h3>移除自身</h3> <pre><code>co.Remove()</code></pre> <h3>多个动作顺序播放</h3> <pre><code>co.Sequence(action,...)</code></pre> <h3>多个动作同时播放</h3> <pre><code>co.Spawn(action,...)</code></pre> <h3>循环播放(按次数播放)</h3> <pre><code>co.Repeat(action, num)</code></pre> <h3>循环播放(一直循环)</h3> <pre><code>co.RepeatForever(action)</code></pre> <h3>加速度向右,反方向缓慢移动</h3> <pre><code>co.EaseBackIn(action)</code></pre> <h3>快速移动到结束,然后缓慢返回到结束</h3> <pre><code>co.EaseBackOut(action)</code></pre> <h3>贝塞尔曲线运动</h3> <pre><code>co.EaseBackOut(time, controlPoint_1, controlPoint_2, endPosition)</code></pre> <pre><code>time             时间 controlPoint_1   控制点1 坐标 controlPoint_2   控制点2 坐标 endPosition      结束坐标</code></pre> <h3>缓慢开始, 加速结束</h3> <pre><code>co.EaseExponentialIn(action)</code></pre> <h3>加速开始, 缓慢结束</h3> <pre><code>co.EaseExponentialOut(action)</code></pre> <h3>动作缓慢开始和终止</h3> <pre><code>co.EaseExponentialInOut(action)</code></pre> <h3>键盘监听事件</h3> <pre><code>co.AddKeyboardEventListener(codeKeys, pressedCB, releaseCB, checkFullSort)</code></pre> <pre><code>codeKeys      要监听的键盘键key pressedCB     按下回调 releaseCB     松开回调 checkFullSort 兼容全顺序键盘key排列, 针对监听多键 [3.40.7版本] 键盘键key 如下: &amp;quot;KEY_NONE&amp;quot;, &amp;quot;KEY_PAUSE&amp;quot;, &amp;quot;KEY_SCROLL_LOCK&amp;quot;, &amp;quot;KEY_PRINT&amp;quot;, &amp;quot;KEY_SYSREQ&amp;quot;, &amp;quot;KEY_BREAK&amp;quot;, &amp;quot;KEY_ESCAPE&amp;quot;, &amp;quot;KEY_BACKSPACE&amp;quot;, &amp;quot;KEY_TAB&amp;quot;, &amp;quot;KEY_BACK_TAB&amp;quot;, &amp;quot;KEY_RETURN&amp;quot;, &amp;quot;KEY_CAPS_LOCK&amp;quot;, &amp;quot;KEY_SHIFT&amp;quot;, &amp;quot;KEY_RIGHT_SHIFT&amp;quot;, &amp;quot;KEY_CTRL&amp;quot;, &amp;quot;KEY_RIGHT_CTRL&amp;quot;, &amp;quot;KEY_ALT&amp;quot;, &amp;quot;KEY_RIGHT_ALT&amp;quot;, &amp;quot;KEY_MENU&amp;quot;, &amp;quot;KEY_HYPER&amp;quot;, &amp;quot;KEY_INSERT&amp;quot;, &amp;quot;KEY_HOME&amp;quot;, &amp;quot;KEY_PG_UP&amp;quot;, &amp;quot;KEY_DELETE&amp;quot;, &amp;quot;KEY_END&amp;quot;, &amp;quot;KEY_PG_DOWN&amp;quot;, &amp;quot;KEY_LEFT_ARROW&amp;quot;, &amp;quot;KEY_RIGHT_ARROW&amp;quot;, &amp;quot;KEY_UP_ARROW&amp;quot;, &amp;quot;KEY_DOWN_ARROW&amp;quot;, &amp;quot;KEY_NUM_LOCK&amp;quot;, &amp;quot;KEY_KP_PLUS&amp;quot;, &amp;quot;KEY_KP_MINUS&amp;quot;, &amp;quot;KEY_KP_MULTIPLY&amp;quot;, &amp;quot;KEY_KP_DIVIDE&amp;quot;, &amp;quot;KEY_KP_ENTER&amp;quot;, &amp;quot;KEY_KP_HOME&amp;quot;, &amp;quot;KEY_KP_UP&amp;quot;, &amp;quot;KEY_KP_PG_UP&amp;quot;, &amp;quot;KEY_KP_LEFT&amp;quot;, &amp;quot;KEY_KP_FIVE&amp;quot;, &amp;quot;KEY_KP_RIGHT&amp;quot;, &amp;quot;KEY_KP_END&amp;quot;, &amp;quot;KEY_KP_DOWN&amp;quot;, &amp;quot;KEY_KP_PG_DOWN&amp;quot;, &amp;quot;KEY_KP_INSERT&amp;quot;, &amp;quot;KEY_KP_DELETE&amp;quot;, &amp;quot;KEY_F1&amp;quot;, &amp;quot;KEY_F2&amp;quot;, &amp;quot;KEY_F3&amp;quot;, &amp;quot;KEY_F4&amp;quot;, &amp;quot;KEY_F5&amp;quot;, &amp;quot;KEY_F6&amp;quot;, &amp;quot;KEY_F7&amp;quot;, &amp;quot;KEY_F8&amp;quot;, &amp;quot;KEY_F9&amp;quot;, &amp;quot;KEY_F10&amp;quot;, &amp;quot;KEY_F11&amp;quot;, &amp;quot;KEY_F12&amp;quot;, &amp;quot;KEY_SPACE&amp;quot;, &amp;quot;KEY_EXCLAM&amp;quot;, &amp;quot;KEY_QUOTE&amp;quot;, &amp;quot;KEY_NUMBER&amp;quot;, &amp;quot;KEY_DOLLAR&amp;quot;, &amp;quot;KEY_PERCENT&amp;quot;, &amp;quot;KEY_CIRCUMFLEX&amp;quot;, &amp;quot;KEY_AMPERSAND&amp;quot;, &amp;quot;KEY_APOSTROPHE&amp;quot;, &amp;quot;KEY_LEFT_PARENTHESIS&amp;quot;, &amp;quot;KEY_RIGHT_PARENTHESIS&amp;quot;, &amp;quot;KEY_ASTERISK&amp;quot;, &amp;quot;KEY_PLUS&amp;quot;, &amp;quot;KEY_COMMA&amp;quot;, &amp;quot;KEY_MINUS&amp;quot;, &amp;quot;KEY_PERIOD&amp;quot;, &amp;quot;KEY_SLASH&amp;quot;, &amp;quot;KEY_0&amp;quot;, &amp;quot;KEY_1&amp;quot;, &amp;quot;KEY_2&amp;quot;, &amp;quot;KEY_3&amp;quot;, &amp;quot;KEY_4&amp;quot;, &amp;quot;KEY_5&amp;quot;, &amp;quot;KEY_6&amp;quot;, &amp;quot;KEY_7&amp;quot;, &amp;quot;KEY_8&amp;quot;, &amp;quot;KEY_9&amp;quot;, &amp;quot;KEY_COLON&amp;quot;, &amp;quot;KEY_SEMICOLON&amp;quot;, &amp;quot;KEY_LESS_THAN&amp;quot;, &amp;quot;KEY_EQUAL&amp;quot;, &amp;quot;KEY_GREATER_THAN&amp;quot;, &amp;quot;KEY_QUESTION&amp;quot;, &amp;quot;KEY_AT&amp;quot;, &amp;quot;KEY_CAPITAL_A&amp;quot;, &amp;quot;KEY_CAPITAL_B&amp;quot;, &amp;quot;KEY_CAPITAL_C&amp;quot;, &amp;quot;KEY_CAPITAL_D&amp;quot;, &amp;quot;KEY_CAPITAL_E&amp;quot;, &amp;quot;KEY_CAPITAL_F&amp;quot;, &amp;quot;KEY_CAPITAL_G&amp;quot;, &amp;quot;KEY_CAPITAL_H&amp;quot;, &amp;quot;KEY_CAPITAL_I&amp;quot;, &amp;quot;KEY_CAPITAL_J&amp;quot;, &amp;quot;KEY_CAPITAL_K&amp;quot;, &amp;quot;KEY_CAPITAL_L&amp;quot;, &amp;quot;KEY_CAPITAL_M&amp;quot;, &amp;quot;KEY_CAPITAL_N&amp;quot;, &amp;quot;KEY_CAPITAL_O&amp;quot;, &amp;quot;KEY_CAPITAL_P&amp;quot;, &amp;quot;KEY_CAPITAL_Q&amp;quot;, &amp;quot;KEY_CAPITAL_R&amp;quot;, &amp;quot;KEY_CAPITAL_S&amp;quot;, &amp;quot;KEY_CAPITAL_T&amp;quot;, &amp;quot;KEY_CAPITAL_U&amp;quot;, &amp;quot;KEY_CAPITAL_V&amp;quot;, &amp;quot;KEY_CAPITAL_W&amp;quot;, &amp;quot;KEY_CAPITAL_X&amp;quot;, &amp;quot;KEY_CAPITAL_Y&amp;quot;, &amp;quot;KEY_CAPITAL_Z&amp;quot;, &amp;quot;KEY_LEFT_BRACKET&amp;quot;, &amp;quot;KEY_BACK_SLASH&amp;quot;, &amp;quot;KEY_RIGHT_BRACKET&amp;quot;, &amp;quot;KEY_UNDERSCORE&amp;quot;, &amp;quot;KEY_GRAVE&amp;quot;, &amp;quot;KEY_A&amp;quot;, &amp;quot;KEY_B&amp;quot;, &amp;quot;KEY_C&amp;quot;, &amp;quot;KEY_D&amp;quot;, &amp;quot;KEY_E&amp;quot;, &amp;quot;KEY_F&amp;quot;, &amp;quot;KEY_G&amp;quot;, &amp;quot;KEY_H&amp;quot;, &amp;quot;KEY_I&amp;quot;, &amp;quot;KEY_J&amp;quot;, &amp;quot;KEY_K&amp;quot;, &amp;quot;KEY_L&amp;quot;, &amp;quot;KEY_M&amp;quot;, &amp;quot;KEY_N&amp;quot;, &amp;quot;KEY_O&amp;quot;, &amp;quot;KEY_P&amp;quot;, &amp;quot;KEY_Q&amp;quot;, &amp;quot;KEY_R&amp;quot;, &amp;quot;KEY_S&amp;quot;, &amp;quot;KEY_T&amp;quot;, &amp;quot;KEY_U&amp;quot;, &amp;quot;KEY_V&amp;quot;, &amp;quot;KEY_W&amp;quot;, &amp;quot;KEY_X&amp;quot;, &amp;quot;KEY_Y&amp;quot;, &amp;quot;KEY_Z&amp;quot;, &amp;quot;KEY_LEFT_BRACE&amp;quot;, &amp;quot;KEY_BAR&amp;quot;, &amp;quot;KEY_RIGHT_BRACE&amp;quot;, &amp;quot;KEY_TILDE&amp;quot;, &amp;quot;KEY_EURO&amp;quot;, &amp;quot;KEY_POUND&amp;quot;, &amp;quot;KEY_YEN&amp;quot;, &amp;quot;KEY_MIDDLE_DOT&amp;quot;, &amp;quot;KEY_SEARCH&amp;quot;, &amp;quot;KEY_DPAD_LEFT&amp;quot;, &amp;quot;KEY_DPAD_RIGHT&amp;quot;, &amp;quot;KEY_DPAD_UP&amp;quot;, &amp;quot;KEY_DPAD_DOWN&amp;quot;, &amp;quot;KEY_DPAD_CENTER&amp;quot;, &amp;quot;KEY_ENTER&amp;quot;, &amp;quot;KEY_PLAY&amp;quot;,</code></pre> <h3>移除键盘监听</h3> <pre><code>co.RemoveKeyboardEventListner(codeKeys)</code></pre> <h3>加载 GUIExport文件</h3> <pre><code>co.loadExport(parent,filename,callback)</code></pre> <h3>ssr.CreateExport(filename)</h3> <pre><code>co.CreateExport(filename)</code></pre> <h3>停止所有动作</h3> <pre><code>co.StopAllActions(action)</code></pre>

页面列表

ITEM_HTML