Cocos Creator 中脚本名称就是组件的名称,这个命名是大小写敏感的!如果组件名称的大小写不正确,将无法正确通过名称使用组件!打开的脚本里已经有了预先设置好的一些代码块,这些代码就是编写一个组件脚本所需的结构。
// 定义全局变量可以直接通过”this.”的方式
<code class="hljs cs has-numbering" style="display: block; padding: 0px; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal; background: transparent;"><span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">this</span>.jumpAction = <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">this</span>.setJumpAction(); </code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li></ul>
// 详情查询Cocos Creator生命周期
update function 在加载场景以后自动每帧调用一次
// 预制文件
对于需要重复生成的节点,我们可以将他保存成Prefab(预制)资源,作为我们动态生成节点时使用的模板。
// 用来定义属性和创建接口,命名开头加”_”可不在外部显示
<code class="hljs css has-numbering" style="display: block; padding: 0px; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal; background: transparent;"> <span class="hljs-tag" style="color: rgb(0, 0, 0); box-sizing: border-box;">properties</span>: <span class="hljs-rules" style="box-sizing: border-box;">{ <span class="hljs-rule" style="box-sizing: border-box;"><span class="hljs-attribute" style="box-sizing: border-box;">externalInterface</span>:<span class="hljs-value" style="box-sizing: border-box; color: rgb(0, 102, 102);"> cc.type </span></span></span>}</code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li></ul>
只有在属性声明时规定 type 为引用类型时(比如cc.Prefab , cc.Node…类型),才能够将资源或节点拖拽到该属性上
// this.getComponent(“name”)
getComponent 获取节点上指定类型的组件,如果节点有附加指定类型的组件,则返回,如果没有则为空。传入参数也可以是脚本的名称。 (在当前节点上去获取”name”组件)
// 求两个点之间的角度
cc.radiansToDegrees(cc.pAngleSigned(po1,po2)) 返回点po1,po2之间的角度
// 转坐标
convertToWorldSpaceAR(将一个点转换到世界空间坐标系。结果以 Vec2 为单位。返回值将基于节点坐标。)
convertToNodeSpaceAR(将一个点转换到局部坐标系。结果以 Vec2 为单位。返回值将基于节点坐标。)
// 动态加载
// 需要动态加载的资源必须放在名为resources的文件夹下**
1.加载 Prefab
<code class="hljs avrasm has-numbering" style="display: block; padding: 0px; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal; background: transparent;">cc<span class="hljs-preprocessor" style="color: rgb(68, 68, 68); box-sizing: border-box;">.loader</span><span class="hljs-preprocessor" style="color: rgb(68, 68, 68); box-sizing: border-box;">.loadRes</span>(<span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">"test assets/prefab"</span>, function (err, prefab) { var newNode = cc<span class="hljs-preprocessor" style="color: rgb(68, 68, 68); box-sizing: border-box;">.instantiate</span>(prefab)<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">;</span> cc<span class="hljs-preprocessor" style="color: rgb(68, 68, 68); box-sizing: border-box;">.director</span><span class="hljs-preprocessor" style="color: rgb(68, 68, 68); box-sizing: border-box;">.getScene</span>()<span class="hljs-preprocessor" style="color: rgb(68, 68, 68); box-sizing: border-box;">.addChild</span>(newNode)<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">;</span> })<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">;</span></code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li><li style="box-sizing: border-box; padding: 0px 5px;">4</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li><li style="box-sizing: border-box; padding: 0px 5px;">4</li></ul>
2.加载 AnimationClip
<code class="hljs avrasm has-numbering" style="display: block; padding: 0px; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal; background: transparent;"> cc<span class="hljs-preprocessor" style="color: rgb(68, 68, 68); box-sizing: border-box;">.loader</span><span class="hljs-preprocessor" style="color: rgb(68, 68, 68); box-sizing: border-box;">.loadRes</span>(<span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">"test assets/anim"</span>, function (err, clip) { myNode<span class="hljs-preprocessor" style="color: rgb(68, 68, 68); box-sizing: border-box;">.getComponent</span>(cc<span class="hljs-preprocessor" style="color: rgb(68, 68, 68); box-sizing: border-box;">.Animation</span>)<span class="hljs-preprocessor" style="color: rgb(68, 68, 68); box-sizing: border-box;">.addClip</span>(clip, <span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">"anim"</span>)<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">;</span> })<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">;</span></code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li></ul>
3.加载单独的SpriteFrame
<code class="hljs avrasm has-numbering" style="display: block; padding: 0px; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal; background: transparent;">cc<span class="hljs-preprocessor" style="color: rgb(68, 68, 68); box-sizing: border-box;">.loader</span><span class="hljs-preprocessor" style="color: rgb(68, 68, 68); box-sizing: border-box;">.loadRes</span>(<span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">"test assets/image"</span>, cc<span class="hljs-preprocessor" style="color: rgb(68, 68, 68); box-sizing: border-box;">.SpriteFrame</span>, function (err, spriteFrame) { myNode<span class="hljs-preprocessor" style="color: rgb(68, 68, 68); box-sizing: border-box;">.getComponent</span>(cc<span class="hljs-preprocessor" style="color: rgb(68, 68, 68); box-sizing: border-box;">.Sprite</span>)<span class="hljs-preprocessor" style="color: rgb(68, 68, 68); box-sizing: border-box;">.spriteFrame</span> = spriteFrame<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">;</span> })<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">;</span></code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li></ul>
4.将加载SpriteFrame封装成一个function,传入Container(需要添加图片节点的Sprite),name(图片名字)两个参数,并在1S后显示他
<code class="hljs matlab has-numbering" style="display: block; padding: 0px; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal; background: transparent;">_addSpriteFrameToContainer:<span class="hljs-function" style="box-sizing: border-box;"><span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">function</span><span class="hljs-params" style="color: rgb(102, 0, 102); box-sizing: border-box;">(container , name)</span>{</span> <span class="hljs-transposed_variable" style="box-sizing: border-box;">cc.</span><span class="hljs-built_in" style="color: rgb(102, 0, 102); box-sizing: border-box;">log</span>(<span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">'load pic:'</span>,name) <span class="hljs-transposed_variable" style="box-sizing: border-box;">container.</span>spriteFrame = <span class="hljs-transposed_variable" style="box-sizing: border-box;">this.</span>loadWaitImage <span class="hljs-transposed_variable" style="box-sizing: border-box;">cc.</span><span class="hljs-transposed_variable" style="box-sizing: border-box;">loader.</span>loadRes(name, <span class="hljs-transposed_variable" style="box-sizing: border-box;">cc.</span>SpriteFrame, <span class="hljs-function" style="box-sizing: border-box;"><span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">function</span> <span class="hljs-params" style="color: rgb(102, 0, 102); box-sizing: border-box;">(err, atlas)</span> {</span> <span class="hljs-transposed_variable" style="box-sizing: border-box;">cc.</span><span class="hljs-built_in" style="color: rgb(102, 0, 102); box-sizing: border-box;">log</span>(atlas) setTimeout(<span class="hljs-function" style="box-sizing: border-box;"><span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">function</span><span class="hljs-params" style="color: rgb(102, 0, 102); box-sizing: border-box;">()</span> {</span> <span class="hljs-transposed_variable" style="box-sizing: border-box;">container.</span>spriteFrame = atlas }, <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">1000</span>); }); }</code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li><li style="box-sizing: border-box; padding: 0px 5px;">4</li><li style="box-sizing: border-box; padding: 0px 5px;">5</li><li style="box-sizing: border-box; padding: 0px 5px;">6</li><li style="box-sizing: border-box; padding: 0px 5px;">7</li><li style="box-sizing: border-box; padding: 0px 5px;">8</li><li style="box-sizing: border-box; padding: 0px 5px;">9</li><li style="box-sizing: border-box; padding: 0px 5px;">10</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li><li style="box-sizing: border-box; padding: 0px 5px;">4</li><li style="box-sizing: border-box; padding: 0px 5px;">5</li><li style="box-sizing: border-box; padding: 0px 5px;">6</li><li style="box-sizing: border-box; padding: 0px 5px;">7</li><li style="box-sizing: border-box; padding: 0px 5px;">8</li><li style="box-sizing: border-box; padding: 0px 5px;">9</li><li style="box-sizing: border-box; padding: 0px 5px;">10</li></ul>
5.加载 SpriteAtlas(图集),并且获取其中的一个 SpriteFrame
! 注意 atlas 资源文件(plist)通常会和一个同名的图片文件(png)放在一个目录下
所以需要在第二个参数指定资源类型**
<code class="hljs javascript has-numbering" style="display: block; padding: 0px; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal; background: transparent;"> cc.loader.loadRes(<span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">"test assets/sheep"</span>, cc.SpriteAtlas, <span class="hljs-function" style="box-sizing: border-box;"><span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">function</span> <span class="hljs-params" style="color: rgb(102, 0, 102); box-sizing: border-box;">(err, atlas)</span> {</span> <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">var</span> frame = atlas.getSpriteFrame(<span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">'sheep_down_0'</span>); sprite.spriteFrame = frame; });</code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li><li style="box-sizing: border-box; padding: 0px 5px;">4</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li><li style="box-sizing: border-box; padding: 0px 5px;">4</li></ul>
加载配置文件
<code class="hljs javascript has-numbering" style="display: block; padding: 0px; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal; background: transparent;">_loadMapData:<span class="hljs-function" style="box-sizing: border-box;"><span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">function</span><span class="hljs-params" style="color: rgb(102, 0, 102); box-sizing: border-box;">()</span>{</span> <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">var</span> that = <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">this</span> cc.loader.loadRes(<span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">"csv/map"</span>, <span class="hljs-function" style="box-sizing: border-box;"><span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">function</span> <span class="hljs-params" style="color: rgb(102, 0, 102); box-sizing: border-box;">(err, mapCsv)</span> {</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">// 配置文件内容换行</span> <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">var</span> mapArr = mapCsv.split(<span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">"\n"</span>) <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">// 将配置文件从第二行开始用","隔开放入一个数组里</span> <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">for</span>(<span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">var</span> i = <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">1</span>; i < mapArr.length;i++){ <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">var</span> arr = mapArr[i].split(<span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">','</span>) <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">// 如果GameData.map[arr[0]]不存在则将GameData.map[arr[0]] = {}</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">// 如果GameData.map[arr[0]]存在则将值赋给他</span> GameData.map[arr[<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">0</span>]] = GameData.map[arr[<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">0</span>]] || {} <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">// 将配置文件里的内容添加到GameData.map里</span> GameData.map[arr[<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">0</span>]][arr[<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">1</span>]] = { image:<span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">"pic/map_person/"</span>+arr[<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">2</span>], name:arr[<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">3</span>], msg:arr[<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">4</span>], position:cc.p(<span class="hljs-built_in" style="color: rgb(102, 0, 102); box-sizing: border-box;">parseInt</span>(arr[<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">5</span>]),<span class="hljs-built_in" style="color: rgb(102, 0, 102); box-sizing: border-box;">parseInt</span>(arr[<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">6</span>])), action:arr[<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">7</span>] } } that._loadEnd() }); }, _loadEnd:<span class="hljs-function" style="box-sizing: border-box;"><span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">function</span><span class="hljs-params" style="color: rgb(102, 0, 102); box-sizing: border-box;">()</span>{</span> <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">this</span>._loadedNum ++ <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">// 当所有配置文件加载完成以后,就进入if</span> <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">if</span>(<span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">this</span>._loadedNum == <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">this</span>._C_needLoadNum){ <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">// 加载完成</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">// 用getComponent获取当前节点上的"ShowMap"组件,调用"ShowMap"里的pub_beginShow方法</span> <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">this</span>.getComponent(<span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">"ShowMap"</span>).pub_beginShow() } },</code>