krpano 项目自制 - 内测可用 - 续1 - 小地图!
解说声音控制、背景声音控制、视频控制、首开页面等等请点击我!
1、修改tour.xml的skin_settings
在配置中, 调整号maps小地图的相关配置!
<!-- CC:添加属性!
musicbjgroup="0" - 背景声音组!
musicspeakgroup="0" - 解说声音组!
loadingtext="加载中!" - 修改了场景加载时候,显示的文字!
thumbs_text="true" - 缩略图上显示名称。
title="true" - 左下角显示标题!
小地图
maps="true"
maps_type=""
maps_bing_api_key=""
maps_google_api_key=""
maps_zoombuttons="false"
-->
<skin_settings maps="true"
maps_type=""
maps_bing_api_key=""
maps_google_api_key=""
maps_zoombuttons="false"
gyro="true"
webvr="true"
webvr_gyro_keeplookingdirection="false"
webvr_prev_next_hotspots="true"
littleplanetintro="false"
title="true"
thumbs="true"
thumbs_width="120" thumbs_height="80" thumbs_padding="10" thumbs_crop="0|40|240|160"
thumbs_opened="false"
thumbs_text="true"
thumbs_dragging="true"
thumbs_onhoverscrolling="false"
thumbs_scrollbuttons="false"
thumbs_scrollindicator="false"
thumbs_loop="false"
tooltips_buttons="false"
tooltips_thumbs="false"
tooltips_hotspots="false"
tooltips_mapspots="false"
deeplinking="false"
loadscene_flags="MERGE"
loadscene_blend="OPENBLEND(0.5, 0.0, 0.75, 0.05, linear)"
loadscene_blend_prev="SLIDEBLEND(0.5, 180, 0.75, linear)"
loadscene_blend_next="SLIDEBLEND(0.5, 0, 0.75, linear)"
loadingtext="GGG..."
layout_width="100%"
layout_maxwidth="814"
controlbar_width="-24"
controlbar_height="40"
controlbar_offset="20"
controlbar_offset_closed="-40"
controlbar_overlap.no-fractionalscaling="10"
controlbar_overlap.fractionalscaling="0"
design_skin_images="vtourskin.png"
design_bgcolor="0x2D3E50"
design_bgalpha="0.8"
design_bgborder="0"
design_bgroundedge="1"
design_bgshadow="0 4 10 0x000000 0.3"
design_thumbborder_bgborder="3 0xFFFFFF 1.0"
design_thumbborder_padding="2"
design_thumbborder_bgroundedge="0"
design_text_css="color:#FFFFFF; font-family:Arial;"
design_text_shadow="1"
musicbjgroup="0"
musicspeakgroup="0"
/>
2、添加小地图相关的layer
一个是小地图(map),一个是小地图的开关(omap)!
小地图默认是小号的!
要实现的功能有:
a.点击小地图,可以放大,再点击复位。
b.点击小地图开关可以显示与隐藏。
<!-- CC:地图map系列制作! -->
<!-- CC: 图层 - map地图
在这里修改地图的宽高大小等等。点击事件为:放大地图。
-->
<layer name="map" url="img/map.png" keep="true" handcursor="false" capture="false"
align="righttop"
scale="0.25" scalechildren="true"
width="80%"
x="2%"
y="2%"
height="100%"
display="false"
enabled="false"
alpha="0"
onclick="
bigmap();
"
/>
<!-- CC: 图层 - map地图 控制按钮,功能是隐藏和关闭地图。
在这里修改地图的宽高大小等等。点击事件为:放大地图。
点击事件,可以依据当前图层的url来判断是显示地图(小),还是关闭!
-->
<layer name="omap"
alpha="1"
handcursor="true"
enabled="true"
children="true"
visible="true"
zorder="77"
align="righttop"
x="1%"
y="1%"
type="container"
maskchildren="true"
keep="true"
width="3%"
height="5%"
url="img/close_map.png"
bgcolor="0xFFFFFF"
bgalpha="1"
onclick="controllermap();"
/>
3、小地图控制action
如果UI显示为关闭小地图的UI,那么将小地图打开,并且修改UI为打开的。
如果UI显示为打开小地图的UI,那么将小地图关闭,并且修改UI为关闭的。
<!-- CC: 地图的关闭打开控制!
-->
<action name="controllermap">
if(layer[omap].url == 'img/close_map.png',
set(layer[map].alpha , 1);
set(layer[map].enabled , true);
set(layer[map].display , true);
set(layer[omap].url , 'img/open_map.png');
,
set(layer[map].alpha , 0);
set(layer[map].enabled , false);
set(layer[map].display , false);
set(layer[omap].url , 'img/close_map.png')
)
</action>
4、小地图点击action。放大与复位!
小地图默认是小号的,点击小号的,调用bigmap()方法,将点击事件改为显示小号的action(smallmap)。同时将小地图放大为大号(0.25 - 0.8)。
<!-- CC: 显示地图-大号! -->
<action name="bigmap">
set(layer[map].onclick, smallmap(); );
layer[map].changeorigin(center,center);
set(bigscale,0.8);
if(layer[map].imagewidth GT stagewidth, div(bigscale, stagewidth, layer[map].imagewidth); );
tween(layer[map].x, 10);
tween(layer[map].y, 10);
tween(layer[map].scale, get(bigscale));
</action>
<!-- CC: 显示地图-小号! -->
<action name="smallmap">
set(layer[map].onclick, bigmap(); );
layer[map].changeorigin(righttop,righttop);
tween(layer[map].x, '2%');
tween(layer[map].y, '2%');
tween(layer[map].scale, 0.25);
</action>
5、定义小地图上的标记点,一个场景对应一个标记点。
注意:
1、标记点从spot0开始。
2、它们的父类parent是小地图层(map)
<!-- CC: 所有地图上的标记点,使用layer!
style是定义的一个总样式!
注意: layer的那么属性,是spot加个数字,数字从0开始。这个是定好的。不能改 !
-->
<style name="mapspot" keep="true" url="img/map_selects.png" parent="map" align="lefttop" edge="center" scale.mobile="2" />
<layer name="spot0" style="mapspot" x="10" y="10" zorder="78" onclick="mapspot_loadscene(scene_a);" />
<layer name="spot1" style="mapspot" x="50" y="50" zorder="78" onclick="mapspot_loadscene(scene_b);" />
<layer name="spot2" style="mapspot" x="100" y="100" zorder="78" onclick="mapspot_loadscene(scene_c);" />
<layer name="spot3" style="mapspot" x="200" y="200" zorder="78" onclick="mapspot_loadscene(scene_d);" />
<layer name="spot4" style="mapspot" x="300" y="300" zorder="78" onclick="mapspot_loadscene(scene_e);" />
6、标记点的点击事件
分为两个状态,小地图大号点击和小地图的小号点击。
小号:直接加载标记点对应的场景。
大号:
a.先关闭小地图(enabled = false)并且透明度改为0;同时加载标记点对应的场景;
b.该表小地图的点击事件为 显示大图(layer[map].onclick, bigmap());
c.将小地图改成小号;
d.1秒后重新显示小地图,0.5秒渐显出来。
<!-- CC: 点击地图上标记点的方法,加载对应的场景,场景有:
index 当前场景(从0开始) ,
count 场景总数!!
spotid != scene(get(xml.scene).index) - 是做了个判断,标记点(从0开始的)的序号,与当前场景的序号是否相等,不等就加载当前标记点序号的场景!
-->
<action name="mapspot_loadscene">
subtxt(spotid , get(name) , 4 , 2);
if(layer[map].scale GT 0.25,
set(layer[map].enabled, false);
tween(layer[map].alpha, 0.0, 0.25, default,
if(spotid != scene(get(xml.scene).index) , loadscene(%1, null, MERGE, ZOOMBLEND(1, 1.1, easeInOutSine)););
set(layer[map].onclick, bigmap(); );
layer[map].changeorigin(righttop,righttop);
set(layer[map].x, '2%');
set(layer[map].y, '2%');
set(layer[map].scale, 0.25);
set(events[sceneload].onloadcomplete,
delayedcall(1,
tween(layer[map].alpha, 1.0, 0.5, default, set(layer[map].enabled, true); );
);
);
);
,
<!-- small map: just load the scene -->
<!-- CC: 几种混合效果!
blend="NOBLEND"
blend="BLEND(1.0, easeInCubic)"
blend="ZOOMBLEND(2.0, 2.0, easeInOutSine)" -cc
blend="COLORBLEND(2.0, 0x000000, easeOutSine)"
blend="LIGHTBLEND(1.0, 0xFFFFFF, 2.0, linear)"
blend="SLIDEBLEND(1.0, 0.0, 0.2, linear)"
blend="SLIDEBLEND(1.0, 90.0, 0.01, linear)"
blend="SLIDEBLEND(1.0, 135.0, 0.4, linear)"
blend="OPENBLEND(1.0, 0.0, 0.2, 0.0, linear)"
blend="OPENBLEND(0.7, 1.0, 0.1, 0.0, linear)"
blend="OPENBLEND(1.0, -1.0, 0.3, 0.0, linear)"
blend="OPENBLEND(1.0, -0.5, 0.3, 0.8, linear)"
-->
if(spotid != scene(get(xml.scene).index) , loadscene(%1, null, MERGE, ZOOMBLEND(1, 1.1, easeInOutSine)););
);
</action>
7、标记点的选中状态
下layer是标记点的选中图层样式。一个场景对应一个标记点!
当前加载的哪个场景,那么对应的标记点显示该样式(比如说一个红点,从小地图上,一看就知道当前场景位于小地图的哪个位置)。
<!-- CC: 地图中场景的选中显示。 -->
<layer name="activespot" url="img/map_choose.png" keep="true" parent="map"
zorder="79" scale.mobile="2" align="lefttop" edge="center"
/>
8、引入雷达插件(官方提供)
雷达插件,在小地图上显示的一个雷达样式。可以显示当前场景中,观看视角的角度和方位!
注意:它的父类parent是小地图层(map)
<!-- CC: 引入了雷达插件。这个比如导入该插件。 -->
<layer name="radar" keep="true" parent="map" edge="center"
url.flash="%SWFPATH%/plugins/radar.swf"
url.html5="%SWFPATH%/plugins/radar.js"
align="lefttop"
zorder="81"
width="25%"
height="25%"
scale.mobile="2"
fillalpha="0.5" fillcolor="0x7F5F3F"
linewidth="1.0" linecolor="0xE0E0A0" linealpha="0.5"
/>
9、每次场景加载的时候,显示小地图上该场景对应标记点,以及雷达样式
<!-- CC: 改方法,主要在地图上显示雷达,当前加载场景的标记点。-->
<action name="updateradar">
<!-- 将当前热点的坐标复制到雷达和激活点的坐标,直接利用当前场景的index,反过来得到layer的名字,这样就使得这个activetespot的参数只要一个就可以了-->
txtadd(spotidnow,'spot',get(scene[get(xml.scene)].index));
copy(layer[radar].x, layer[get(spotidnow)].x);
copy(layer[radar].y, layer[get(spotidnow)].y);
copy(layer[activespot].x, layer[get(spotidnow)].x);
copy(layer[activespot].y, layer[get(spotidnow)].y);
<!-- 下面方法显示了雷达,和角度。 -->
set(layer[radar].heading, -90);
set(layer[radar].visible, true);
set(layer[activespot].visible, true);
</action>
10、内嵌html,使用了iframe
call_iframe(’ … …')即可调用!
注意其有一个配置ip和地址的地方。
<!-- CC: 内嵌html页面,使用iframe。适合点击单开图片、视频、文档等资源。 -->
<control mousetype="drag2d" />
<preview type="grid();" />
<layer name="iframelayer"
url="img/black.png"
align="center"
width="100%"
height="100%"
zorder="999"
visible="false"
keep="true"
>
<layer name="closeiframe_button" url="img/closebutton.png" align="righttop" zorder="1000" x="2%" y="3%"
onclick="
remove_iframe();
set(layer[iframelayer].visible,false);
if(layer[voice_bj].url == 'img/voice_bj_on.png' , resumesound(bj),pausesound(bj));
if(layer[voice_speak].url == 'img/voice_speak_on.png', resumesound(scenesound) , pausesound(scenesound));
"/>
</layer>
<action name="call_iframe">
pausesound(bj);
pausesound(scenesound);
txtadd(u ,'http://192.168.0.222:81' , %1);
callwith(layer[iframelayer],add_iframe(get(u), 100%, 100%);set(visible,true));
</action>
<action name="add_iframe" type="Javascript"><![CDATA[
var iframe = document.createElement("iframe");
iframe.style.position = "absolute";
iframe.style.left = 0;
iframe.style.top = 0;
iframe.style.width = "100%";
iframe.style.height = "100%";
iframe.style.border = 0;
iframe.src = args[1];
iframe.setAttribute('id',resolve(caller.name));
caller.registercontentsize(args[2], args[3]);
caller.sprite.appendChild(iframe);
caller.sprite.style.webkitOverflowScrolling = "touch";
caller.sprite.style.overflowY = "auto";
caller.sprite.style.overflowX = "auto";
]]></action>
<!-- CC: 移除iframe的方法! -->
<action name="remove_iframe" type="Javascript"><![CDATA[
var lastIframe = document.getElementById('iframelayer');
lastIframe.parentNode.removeChild(lastIframe);
]]></action>
11、tour.xml
<krpano version="1.19" title="数字史馆">
<include url="skin/vtourskin.xml" />
<!-- customize skin settings: maps, gyro, webvr, thumbnails, tooltips, layout, design, ... -->
<!-- CC:添加属性!
musicbjgroup="0" - 背景声音组!
musicspeakgroup="0" - 解说声音组!
loadingtext="加载中!" - 修改了场景加载时候,显示的文字!
thumbs_text="true" - 缩略图上显示名称。
title="true" - 左下角显示标题!
小地图
maps="true"
maps_type=""
maps_bing_api_key=""
maps_google_api_key=""
maps_zoombuttons="false"
iframe启用内置dakaihtml
deeplinking="true"
-->
<skin_settings maps="true"
maps_type=""
maps_bing_api_key=""
maps_google_api_key=""
maps_zoombuttons="false"
gyro="true"
webvr="true"
webvr_gyro_keeplookingdirection="false"
webvr_prev_next_hotspots="true"
littleplanetintro="false"
title="true"
thumbs="true"
thumbs_width="120" thumbs_height="80" thumbs_padding="10" thumbs_crop="0|40|240|160"
thumbs_opened="false"
thumbs_text="true"
thumbs_dragging="true"
thumbs_onhoverscrolling="false"
thumbs_scrollbuttons="false"
thumbs_scrollindicator="false"
thumbs_loop="false"
tooltips_buttons="false"
tooltips_thumbs="false"
tooltips_hotspots="false"
tooltips_mapspots="false"
deeplinking="true"
loadscene_flags="MERGE"
loadscene_blend="OPENBLEND(0.5, 0.0, 0.75, 0.05, linear)"
loadscene_blend_prev="SLIDEBLEND(0.5, 180, 0.75, linear)"
loadscene_blend_next="SLIDEBLEND(0.5, 0, 0.75, linear)"
loadingtext="GGG..."
layout_width="100%"
layout_maxwidth="814"
controlbar_width="-24"
controlbar_height="40"
controlbar_offset="20"
controlbar_offset_closed="-40"
controlbar_overlap.no-fractionalscaling="10"
controlbar_overlap.fractionalscaling="0"
design_skin_images="vtourskin.png"
design_bgcolor="0x2D3E50"
design_bgalpha="0.8"
design_bgborder="0"
design_bgroundedge="1"
design_bgshadow="0 4 10 0x000000 0.3"
design_thumbborder_bgborder="3 0xFFFFFF 1.0"
design_thumbborder_padding="2"
design_thumbborder_bgroundedge="0"
design_text_css="color:#FFFFFF; font-family:Arial;"
design_text_shadow="1"
musicbjgroup="0"
musicspeakgroup="0"
/>
<!-- qita
For an alternative skin design either change the <skin_settings> values
from above or optionally include one of the predefined designs from below.
-->
<!-- CC:下为官方提供的皮肤! -->
<!-- <include url="skin/vtourskin_design_flat_light.xml" /> -->
<!-- <include url="skin/vtourskin_design_glass.xml" /> -->
<!-- <include url="skin/vtourskin_design_ultra_light.xml" /> -->
<include url="skin/vtourskin_design_117.xml" />
<!-- <include url="skin/vtourskin_design_117round.xml" /> -->
<!-- <include url="skin/vtourskin_design_black.xml" /> -->
<!-- startup action - load the first scene -->
<action name="startup" autorun="onstart" >
if(startscene === null OR !scene[get(startscene)], copy(startscene,scene[0].name); );
loadscene(get(startscene), null, MERGE);
if(startactions !== null, startactions() );
<!-- CC: 插入下行代码,播放背景声音!
bj - 背景声音的ID!
-->
playsound(bj, get(scene[get(xml.scene)].bjmusic), 0);
<!-- CC: 插入下行代码,播放当前解说声音!
scenesound - 当前场景解说的声音ID!
playsound() - 播放声音,传入声音ID - 地址 - 循环: 0 不循环; 1 循环(默认)。
-->
playsound(scenesound, get(scene[get(xml.scene)].speakmusic),0));
<!-- CC: 由于浏览器不然自动播放声音,容易混UI,所以这个播放周后,再暂停!
pausesound() - 传入ID, 则暂停当前ID的声音。
-->
pausesound(scenesound);
</action>
<!-- CC: 这个就是场景,一张全景图,一个点位,就是一个场景,一个scene!
bjgroup - 背景声音的组合,将相同背景声音的场景设为一个组, 从1 开始递增。 即 bjgroup="1";
bjmusic - 当前背景声音的地址!相同组bjgroup的背景声音是一样的!
speakgroup - 解说声音的组和,将相同解说声音的场景设为一个组, 从1 开始递增。 即 speakgroup="1";
speakmusic - 当前解说声音的地址!相同组speakmusic的解说声音是一样的!
-->
<scene name="scene_a" title="a" onstart="" havevrimage="true" thumburl="panos/a.tiles/thumb.jpg" lat="" lng="" heading="" bjgroup="1" bjmusic="sound/bj_1.mp3" speakgroup="1" speakmusic="sound/speak_1.mp3" >
<!-- CC: 定义当前场景的视图。
hlookat - 就是水平的初始角度,
vlookat - 就是垂直初始角度
fov - 是视角。
maxpixelzoom - 是最大像素变焦 -->
<view hlookat="30.034" vlookat="-21.951" fovtype="MFOV" fov="120.000" maxpixelzoom="2.0" fovmin="70" fovmax="140" limitview="auto"/>
<!-- CC: 小图加载地址! -->
<preview url="panos/a.tiles/preview.jpg" />
<!-- CC: 大图加载地址! -->
<image type="CUBE" multires="true" tilesize="512" if="!webvr.isenabled">
<level tiledimagewidth="4096" tiledimageheight="4096">
<cube url="panos/a.tiles/%s/l3/%v/l3_%s_%v_%h.jpg" />
</level>
<level tiledimagewidth="2048" tiledimageheight="2048">
<cube url="panos/a.tiles/%s/l2/%v/l2_%s_%v_%h.jpg" />
</level>
<level tiledimagewidth="1024" tiledimageheight="1024">
<cube url="panos/a.tiles/%s/l1/%v/l1_%s_%v_%h.jpg" />
</level>
</image>
<image if="webvr.isenabled">
<cube url="panos/a.tiles/vr/pano_%s.jpg" />
</image>
<!-- CC: 热点的说明:-->
<!-- 1、 该热点没有文字提示!-->
<hotspot name="spot1" url="img/hotspot.png" style="skin_hotspotstyle" ath="23.583" atv="33.308" linkedscene="scene_b" onloaded="hotspot_animation(128 , 128,60);" bjgroup="1" bjmusic="sound/bj_1.mp3" speakgroup="1" speakmusic="sound/speak_1.mp3"/>
<!-- 2、 该热点具有自定义文字提示! -text="加载下个场景" -->
<hotspot name="spot2" url="img/hotspot.png" style="skin_hotspotstyle" ath="33.583" atv="33.308" linkedscene="scene_b" onloaded="hotspot_animation(128 , 128,60);add_all_the_time_tooltip_for_VR()" bjgroup="1" bjmusic="sound/bj_1.mp3" speakgroup="1" speakmusic="sound/speak_1.mp3" text="加载下个场景" />
<!-- 3、 该热点具有自定义文字提示! -内容是下个场景得title -->
<hotspot name="spot3" url="img/hotspot.png" style="skin_hotspotstyle" ath="43.583" atv="33.308" linkedscene="scene_b" onloaded="hotspot_animation(128 , 128,60);add_all_the_time_tooltip_for_VR()" bjgroup="1" bjmusic="sound/bj_1.mp3" speakgroup="1" speakmusic="sound/speak_1.mp3" />
<!-- 4、 该热点外部弹出html -->
<hotspot name="spot4" url="img/hotspot_point.png" ath="68.613" atv="31.377" linkedscene="scene_b" onloaded="hotspot_animation(128 , 128,60);add_all_the_time_tooltip_for_VR()" style="skin_hotspotstyle" onclick="call_html('/3d/ques/login.html')" text="点击外弹HTML" />
<!-- 5、 该热点内部弹出html -显示动图第一帧,鼠标移入事件触发动图播放! -->
<hotspot name="spot5" url="img/hotspot_point.png" ath="56.904" atv="32.702" linkedscene="scene_b" onloaded="hotspot_animation_register(128 , 128);add_all_the_time_tooltip_for_VR()" style="skin_hotspotstyle" onover="hotspot_animation_onoven(128,128,60)" onclick="call_iframe('/3d/ques/login.html')" text="点击内弹HTML" />
<!-- 6、 该热点外部弹出视频(其实也是html) -->
<hotspot name="spot6" url="img/hotspot_point.png" onloaded="hotspot_animation(128 , 128,60);add_all_the_time_tooltip_for_VR()" style="skin_hotspotstyle" ath="-41.159" atv="26.326" onclick="call_html('/3d/webgl/showHigh.html?type=video&&va=dhce')" text="点击外弹视频"/>
<!-- 7、 该热点内部弹出视频(其实也是html) -->
<hotspot name="spot7" url="img/hotspot_point.png" onloaded="hotspot_animation(128 , 128,60);add_all_the_time_tooltip_for_VR()" style="skin_hotspotstyle" ath="-27.491" atv="28.898" onclick="call_iframe('/3d/webgl/showHigh.html?type=video&&va=dhce')" text="点击内弹视频"/>
<!-- 8、 该热点外部弹出图片(其实也是html) -->
<hotspot name="spot8" url="img/hotspot_point.png" onloaded="hotspot_animation(128 , 128,60);add_all_the_time_tooltip_for_VR()" style="skin_hotspotstyle" ath="-10.071" atv="31.481" onclick="call_html('/3d/webgl/showHigh.html?type=img&&va=xinqianyan')" text="点击外弹图片"/>
<!-- 9、 该热点内部弹出图片(其实也是html) -->
<hotspot name="spot9" url="img/hotspot_point.png" onloaded="hotspot_animation(128 , 128,60);add_all_the_time_tooltip_for_VR()" style="skin_hotspotstyle" ath="8.666" atv="32.380" onclick="call_iframe('/3d/webgl/showHigh.html?type=img&&va=xinqianyan')" text="点击内弹图片"/>
</scene>
<scene name="scene_b" title="b" onstart="" havevrimage="true" thumburl="panos/b.tiles/thumb.jpg" lat="" lng="" heading="" bjgroup="1" bjmusic="sound/bj_1.mp3" speakgroup="1" speakmusic="sound/speak_1.mp3" >
<view hlookat="1.469" vlookat="-5.777" fovtype="MFOV" fov="120.000" maxpixelzoom="2.0" fovmin="70" fovmax="140" limitview="auto" />
<preview url="panos/b.tiles/preview.jpg" />
<image type="CUBE" multires="true" tilesize="512" if="!webvr.isenabled">
<level tiledimagewidth="4096" tiledimageheight="4096">
<cube url="panos/b.tiles/%s/l3/%v/l3_%s_%v_%h.jpg" />
</level>
<level tiledimagewidth="2048" tiledimageheight="2048">
<cube url="panos/b.tiles/%s/l2/%v/l2_%s_%v_%h.jpg" />
</level>
<level tiledimagewidth="1024" tiledimageheight="1024">
<cube url="panos/b.tiles/%s/l1/%v/l1_%s_%v_%h.jpg" />
</level>
</image>
<image if="webvr.isenabled">
<cube url="panos/b.tiles/vr/pano_%s.jpg" />
</image>
<!-- style="skin_hotspotstyle" -->
<hotspot name="spot1" url="img/hotspot.png" ath="-0.046" atv="15.150" style="skin_hotspotstyle" linkedscene="scene_c"/>
</scene>
<scene name="scene_c" title="c" onstart="" havevrimage="true" thumburl="panos/c.tiles/thumb.jpg" lat="" lng="" heading="" bjgroup="1" bjmusic="sound/bj_1.mp3" speakgroup="2" speakmusic="sound/speak_2.mp3">
<view hlookat="3.623" vlookat="-17.429" fovtype="MFOV" fov="120.000" maxpixelzoom="2.0" fovmin="70" fovmax="140" limitview="auto" />
<preview url="panos/c.tiles/preview.jpg" />
<image type="CUBE" multires="true" tilesize="512" if="!webvr.isenabled">
<level tiledimagewidth="4096" tiledimageheight="4096">
<cube url="panos/c.tiles/%s/l3/%v/l3_%s_%v_%h.jpg" />
</level>
<level tiledimagewidth="2048" tiledimageheight="2048">
<cube url="panos/c.tiles/%s/l2/%v/l2_%s_%v_%h.jpg" />
</level>
<level tiledimagewidth="1024" tiledimageheight="1024">
<cube url="panos/c.tiles/%s/l1/%v/l1_%s_%v_%h.jpg" />
</level>
</image>
<image if="webvr.isenabled">
<cube url="panos/c.tiles/vr/pano_%s.jpg" />
</image>
<hotspot name="spot1" style="skin_hotspotstyle" ath="2.313" atv="31.905" linkedscene="scene_d" />
</scene>
<scene name="scene_d" title="d" onstart="" havevrimage="true" thumburl="panos/d.tiles/thumb.jpg" lat="" lng="" heading="" bjgroup="1" bjmusic="sound/bj_1.mp3" speakgroup="2" speakmusic="sound/speak_2.mp3">
<view hlookat="2.546" vlookat="-17.135" fovtype="MFOV" fov="120.000" maxpixelzoom="2.0" fovmin="70" fovmax="140" limitview="auto" />
<preview url="panos/d.tiles/preview.jpg" />
<image type="CUBE" multires="true" tilesize="512" if="!webvr.isenabled">
<level tiledimagewidth="4096" tiledimageheight="4096">
<cube url="panos/d.tiles/%s/l3/%v/l3_%s_%v_%h.jpg" />
</level>
<level tiledimagewidth="2048" tiledimageheight="2048">
<cube url="panos/d.tiles/%s/l2/%v/l2_%s_%v_%h.jpg" />
</level>
<level tiledimagewidth="1024" tiledimageheight="1024">
<cube url="panos/d.tiles/%s/l1/%v/l1_%s_%v_%h.jpg" />
</level>
</image>
<image if="webvr.isenabled">
<cube url="panos/d.tiles/vr/pano_%s.jpg" />
</image>
<hotspot name="spot1" style="skin_hotspotstyle" ath="-48.276" atv="16.216" linkedscene="scene_e" />
</scene>
<scene name="scene_e" title="e" onstart="" havevrimage="true" thumburl="panos/e.tiles/thumb.jpg" lat="" lng="" heading="" bjgroup="2" bjmusic="sound/bj_2.mp3" speakgroup="1" speakmusic="sound/speak_1.mp3">
<view hlookat="-1.273" vlookat="-18.604" fovtype="MFOV" fov="120.000" maxpixelzoom="2.0" fovmin="70" fovmax="140" limitview="auto" />
<preview url="panos/e.tiles/preview.jpg" />
<image type="CUBE" multires="true" tilesize="512" if="!webvr.isenabled">
<level tiledimagewidth="4096" tiledimageheight="4096">
<cube url="panos/e.tiles/%s/l3/%v/l3_%s_%v_%h.jpg" />
</level>
<level tiledimagewidth="2048" tiledimageheight="2048">
<cube url="panos/e.tiles/%s/l2/%v/l2_%s_%v_%h.jpg" />
</level>
<level tiledimagewidth="1024" tiledimageheight="1024">
<cube url="panos/e.tiles/%s/l1/%v/l1_%s_%v_%h.jpg" />
</level>
</image>
<image if="webvr.isenabled">
<cube url="panos/e.tiles/vr/pano_%s.jpg" />
</image>
<hotspot name="spot1" style="skin_hotspotstyle" ath="177.268" atv="22.327" linkedscene="scene_a" />
</scene>
<!-- CC: 打开html页面 ,另开窗口打开!没有使用iframe!适合打开超链接等等。
_self - 当前页面
_blank - 在新窗口中打开(默认)
注意:要再这里配置ip和端口!
-->
<action name="call_html" >
txtadd(u ,'http://192.168.0.222:81' , %1);
openurl(get(u) ,_blank);
</action>
<!-- CC: 内嵌html页面,使用iframe。适合点击单开图片、视频、文档等资源。 -->
<control mousetype="drag2d" />
<preview type="grid();" />
<layer name="iframelayer"
url="img/black.png"
align="center"
width="100%"
height="100%"
zorder="999"
visible="false"
keep="true"
>
<layer name="closeiframe_button" url="img/closebutton.png" align="righttop" zorder="1000" x="2%" y="3%"
onclick="
remove_iframe();
set(layer[iframelayer].visible,false);
if(layer[voice_bj].url == 'img/voice_bj_on.png' , resumesound(bj),pausesound(bj));
if(layer[voice_speak].url == 'img/voice_speak_on.png', resumesound(scenesound) , pausesound(scenesound));
"/>
</layer>
<action name="call_iframe">
pausesound(bj);
pausesound(scenesound);
txtadd(u ,'http://192.168.0.222:81' , %1);
callwith(layer[iframelayer],add_iframe(get(u), 100%, 100%);set(visible,true));
</action>
<action name="add_iframe" type="Javascript"><![CDATA[
var iframe = document.createElement("iframe");
iframe.style.position = "absolute";
iframe.style.left = 0;
iframe.style.top = 0;
iframe.style.width = "100%";
iframe.style.height = "100%";
iframe.style.border = 0;
iframe.src = args[1];
iframe.setAttribute('id',resolve(caller.name));
caller.registercontentsize(args[2], args[3]);
caller.sprite.appendChild(iframe);
caller.sprite.style.webkitOverflowScrolling = "touch";
caller.sprite.style.overflowY = "auto";
caller.sprite.style.overflowX = "auto";
]]></action>
<!-- CC: 移除iframe的方法! -->
<action name="remove_iframe" type="Javascript"><![CDATA[
var lastIframe = document.getElementById('iframelayer');
lastIframe.parentNode.removeChild(lastIframe);
]]></action>
<!-- CC: 自动旋转
onidle 此事件将在没有用户交互的idletime秒后调用
onautorotatestart 自动旋转开始,执行的事件 暂停声音播放:pausesound(bj);pausesound(scenesound);
onautorotatestop 自动旋转结束后,开始执行的事件 下为开启声音播放!
if(layer[voice_bj].url == 'img/voice_bj_on.png' , resumesound(bj) , pausesound(bj));
if(layer[voice_speak].url == 'img/voice_speak_on.png' , resumesound(scenesound) , pausesound(scenesound)) delayedcall(10,);
-->
<autorotate enabled="false"
waittime="20"
accel="1.0"
speed="3.0"
horizon="off"
tofov="off"
oneroundrange="360.0"
zoomslowdown="true"
interruptionevents="userviewchange|layers|keyboard"
/>
<!-- CC: 自动旋转相关事件。 -->
<events name="myAutorotate" keep="true"
onidle="
delayedcall(60, autorotate.start());
"
onautorotatestart="
"
onautorotatestop="
"
/>
<!-- CC:背景声音控制按钮,修改了图片名称,记得名称要全部换掉! -->
<!-- CC:描述 声音点击的按钮控制和逻辑。暂停和恢复声音。 注意声音文件名称的格式!
οnclick="
switch(layer[voice_bj].url , 'img/voice_bj_off.png' , 'img/voice_bj_on.png');
if(layer[voice_bj].url == 'img/voice_bj_off.png' ,
pausesound(bj) , resumesound(bj));
"
-->
<layer name="voice_bj"
alpha="1"
handcursor="true"
enabled="true"
children="true"
visible="true"
zorder="77"
align="righttop"
x="1%"
y="6%"
type="container"
maskchildren="true"
keep="true"
url="img/voice_bj_on.png"
bgcolor="0xFFFFFF"
bgalpha="1"
onclick="
switch(layer[voice_bj].url , 'img/voice_bj_off.png' , 'img/voice_bj_on.png');
if(layer[voice_bj].url == 'img/voice_bj_off.png' ,
pausesound(bj) , resumesound(bj));
"
/>
<!-- CC:解说声音控制按钮,如果修改了图片名称,记得名称要全部换掉,不建议修改图片名称! -->
<!-- CC:描述 解说词声音
οnclick="
switch(layer[voice_speak].url , 'img/voice_speak_on.png' , 'img/voice_speak_off.png');
if(layer[voice_speak].url == 'img/voice_speak_off.png' ,
pausesound(scenesound) , resumesound(scenesound));
"-->
<layer name="voice_speak"
alpha="1"
handcursor="true"
enabled="true"
children="true"
visible="true"
zorder="77"
align="righttop"
x="1%"
y="11%"
type="container"
maskchildren="true"
keep="true"
url="img/voice_speak_off.png"
bgcolor="0xFFFFFF"
bgalpha="1"
onclick="
switch(layer[voice_speak].url , 'img/voice_speak_on.png' , 'img/voice_speak_off.png');
if(layer[voice_speak].url == 'img/voice_speak_off.png' ,
pausesound(scenesound) , resumesound(scenesound));
"
/>
<!-- CC: 首页图片! -->
<layer name="index_container"
preload="true"
alpha="1"
handcursor="true"
enabled="true"
children="true"
visible="true"
zorder="99"
type="container"
maskchildren="true"
keep="true"
width="100%"
height="100%"
url="img/index.jpg"
bgcolor="0xFFFFFF"
bgalpha="1"
/>
<!-- CC: 首页图片 - 点击进入按钮!
videoplayer_open() - 是播放开场视频的方法(当点击进入按钮后播放的视频),如果没有开场视频。那么去掉改方法!
-->
<layer name="index_button"
zorder="100"
keep="true"
x="0"
y="250"
type="container"
align="center"
url="img/logo.png"
scale="1"
alpha="0"
enabled="true"
onloaded="tween(alpha,1,1);tweenintrobuttonalpha(0.35)"
onover="stoptween(alpha);set(alpha,1)"
onout="tweenintrobuttonalpha(0.35)"
onclick="
if(layer[voice_bj].url == 'img/voice_bj_off.png' , pausesound(bj) , resumesound(bj));
videoplayer_open('%CURRENTXML%/video/index.mp4|%CURRENTXML%/video/index.webm', '%CURRENTXML%/video/index.jpg', 0.5);pausesound(scenesound);pausesound(bj);
tween(layer[index_container].alpha,0,1);
delayedcall(1,set(layer[index_container].enabled,false);
delayedcall(1,set(layer[index_button].enabled,false);
set(layer[index_container].visible,false));
set(layer[index_button].visible,false));
"
/>
<!-- CC: 图片按钮,呼吸感的方法! -->
<action name="tweenintrobuttonalpha" >
if(%1 == 0.35,
set(alphavalue,1),
set(alphavalue,0.35)
);
tween(layer[index_button].alpha,%1,1,default,tweenintrobuttonalpha(get(alphavalue)));
</action>
<!-- CC: 动效热点,一直动! 在hotspot热点标签中的onloaded=""中调用。如果多个onloaded要加载,中间用分号隔开!-->
<action name="hotspot_animation" scope="local" args="framewidth, frameheight, framerate">
<!-- 定义局部变量 -->
calc(local.xframes, (caller.imagewidth /framewidth) BOR 0);
calc(local.frames, xframes * ((caller.imageheight / frameheight) BOR 0));
def(local.frame, integer, 0);
<!-- 设置第一帧 -->
calc(caller.crop, '0|0|' + framewidth + '|' + frameheight);
<!-- 动画部分 -->
setinterval(calc('crop_anim_' + caller.name), calc(1.0 / framerate),
if(caller.loaded,
inc(frame);
if(frame GE frames, if(caller.onlastframe !== null, callwith(caller, onlastframe() ) ); set(frame,0); );
mod(xpos, frame, xframes);
div(ypos, frame, xframes);
Math.floor(ypos);
mul(xpos, framewidth);
mul(ypos, frameheight);
calc(caller.crop, xpos + '|' + ypos + '|' + framewidth + '|' + frameheight);
,
<!-- 当热点移除时停止动画 -->
clearinterval(calc('crop_anim_' + caller.name));
);
);
</action>
<!-- 显示热点的描述 ,可以自定义text,可以是场景名称!在hotspot热点标签中的onloaded=""中调用。如果多个onloaded要加载,中间用分号隔开! -->
<action name="add_all_the_time_tooltip_for_VR">
txtadd(tooltipname, 'vrtooltip_', get(name));
addhotspot(get(tooltipname));
set(hotspot[get(tooltipname)],
type=text,
edge=get(hotspot[get(name)].edge),
distorted=get(hotspot[get(name)].distorted),
ath=get(hotspot[get(name)].ath),
atv=get(hotspot[get(name)].atv),
oy=-10,
ox=0,
vcenter=true,
padding=3,
mipmapping=true,
oversampling=2,
bg=true,
bgcolor=0x000000,
bgroundedge=5,
bgalpha=0.65,
bgborder=0,
bgshadow='0 0 0 0x000000 0',
css=calc(device.mobile ? 'text-align:center; color:#FFFFFF; font-family:MicrosoftYahei; font-weight:bold; font-size:12px;':'text-align:left; color:#FFFFFF; font-family:MicrosoftYahei; font-size:12px;'),
txtshadow='0 0 0 0x000000 0';
enabled=true,
);
txtadd(hotspot[get(tooltipname)].onclick,'callwith(hotspot[',get(name),'],onclick)');
if(text == '' OR text === null,
copy(hotspot[get(tooltipname)].html,scene[get(linkedscene)].title),
copy(hotspot[get(tooltipname)].html,text);
);
if(lp_running == false,
set(hotspot[get(tooltipname)].visible,true);
,
if(!webvr.isenabled,
if(lp_running == true,
set(hotspot[get(tooltipname)].visible,false);
set(hotspot[get(tooltipname)].mark2,true);
);
);
);
if(hotspot[get(name)].normal == false,
set(hotspot[get(tooltipname)].normal,false);
set(hotspot[get(tooltipname)].onloaded,
if(webvr.isenabled,
set(visible,false);
,
if(lp_running == false OR lp_running == null OR lp_running === null,
set(visible,true);
);
);
);
);
</action>
<!-- CC: 在onclick 或者onover 或者onout中,调用该action。但是不能同时使用onclick和onover -->
<action name="hotspot_animation_onoven">
if(hotspot[get(name)].animated === null OR hotspot[get(name)].animated == false,
set(hotspot[get(name)].animated,true);
setinterval(calc('crop_anim_' + name), calc(1.0 / %3),
inc(frame);
if(frame GE frames, if(onlastframe !== null, onlastframe() ); set(frame,0); );
mod(xpos, frame, xframes);
div(ypos, frame, xframes);
Math.floor(ypos);
mul(xpos, %1);
mul(ypos, %2);
calc(crop, xpos + '|' + ypos + '|%1|%2');
);
,
set(hotspot[get(name)].animated,false);
clearinterval(calc('crop_anim_' + name));
set(crop, '0|0|%1|%2');
);
</action>
<!-- CC: 在onloaded中调用该action! -->
<action name="hotspot_animation_register">
registerattribute(xframes, calc((imagewidth / %1) BOR 0));
registerattribute(yframes, calc((imageheight / %2) BOR 0));
registerattribute(frames, calc(xframes * yframes));
registerattribute(frame, 0);
set(crop, '0|0|%1|%2');
</action>
<!-- CC: 引入声音播放的插件! -->
<plugin name="soundinterface"
url="%SWFPATH%/plugins/soundinterface.swf"
alturl="%SWFPATH%/plugins/soundinterface.js"
rootpath=""
preload="true"
keep="true"
/>
<!-- CC: 自由控制播放声音!
onxmlcomplete="" , - 该事件,当当前场景scene的xml文件加载完成后,执行的方法!
下为 - 背景声音与场景判断,及其播放 、设置!
ifnot(scene[get(xml.scene)].bjgroup == skin_settings.musicbjgroup,
playsound(bj, get(scene[get(xml.scene)].bjmusic),0);
copy(skin_settings.musicbjgroup,scene[get(xml.scene)].bjgroup));
下为 - 解说声音与场景判断,及其播放 、设置!
ifnot(scene[get(xml.scene)].speakgroup == skin_settings.musicspeakgroup,
playsound(scenesound, get(scene[get(xml.scene)].speakmusic),0);
copy(skin_settings.musicspeakgroup,scene[get(xml.scene)].speakgroup));
下为 - 背景声音和解说声音判断,是否暂停或者开始! 图片不建议修改!
if(layer[voice_bj].url == 'img/voice_bj_off.png' , pausesound(scenesound) , resumesound(scenesound));
if(layer[voice_speak].url == 'img/voice_speak_off.png' , pausesound(scenesound) , resumesound(scenesound));
下为 - 加载场景scene判断,是否有视频播放。如果有,那么播放视频。
if(scene[get(xml.scene)].name == 'scene_c',videoplayer_open('%CURRENTXML%/video/scene_1.mp4|%CURRENTXML%/video/scene_1.webm', '%CURRENTXML%/video/scene_1.jpg', 0.5);pausesound(scenesound);pausesound(bj));
-->
<events name="scene1events" keep="true"
onxmlcomplete="
updateradar();
ifnot(scene[get(xml.scene)].bjgroup == skin_settings.musicbjgroup,
playsound(bj, get(scene[get(xml.scene)].bjmusic),0);
copy(skin_settings.musicbjgroup,scene[get(xml.scene)].bjgroup));
ifnot(scene[get(xml.scene)].speakgroup == skin_settings.musicspeakgroup,
playsound(scenesound, get(scene[get(xml.scene)].speakmusic),0);
copy(skin_settings.musicspeakgroup,scene[get(xml.scene)].speakgroup));
if(layer[voice_bj].url == 'img/voice_bj_off.png' , pausesound(bj) , resumesound(bj));
if(layer[voice_speak].url == 'img/voice_speak_off.png' , pausesound(scenesound) , resumesound(scenesound));
if(scene[get(xml.scene)].name == 'scene_c',videoplayer_open('%CURRENTXML%/video/scene_1.mp4|%CURRENTXML%/video/scene_1.webm', '%CURRENTXML%/video/scene_1.jpg', 0.5);pausesound(scenesound);pausesound(bj));
"
/>
<!-- CC: 视频播放区域!
可以修改,关闭按钮的位置布局。
-->
<action name="videoplayer_open">
if(layer[videoplayer_bg],
<!-- error -->
trace('videoplayer_open - there is already a videoplayer!'-);
,
<!-- step one - add a background layer and fade it in -->
addlayer(videoplayer_bg);
set(layer[videoplayer_bg].type, container);
set(layer[videoplayer_bg].zorder, 999);
set(layer[videoplayer_bg].safearea, false);
set(layer[videoplayer_bg].align, lefttop);
set(layer[videoplayer_bg].width, 100%);
set(layer[videoplayer_bg].height, 100%);
set(layer[videoplayer_bg].bgcolor, 0x000000);
set(layer[videoplayer_bg].bgalpha, 1);
set(layer[videoplayer_bg].bgcapture, true);
set(layer[videoplayer_bg].alpha, 0.0);
tween(layer[videoplayer_bg].alpha, 1.0, 0.2, default,
addlayer(videoplayer_plugin);
set(layer[videoplayer_plugin].parent, layer[videoplayer_bg]);
set(layer[videoplayer_plugin].align, center);
set(layer[videoplayer_plugin].loop, false);
set(layer[videoplayer_plugin].onclick, togglepause() );
set(layer[videoplayer_plugin].alpha, 0.0);
set(layer[videoplayer_plugin].onloaded, videoplayer_plugin_ready(%1) );
set(layer[videoplayer_plugin].onvideocomplete, videoplayer_close());
if('%2' != null, set(layer[videoplayer_plugin].posterurl,'%2'); );
if('%3' != null, set(layer[videoplayer_plugin].volume,%3); );
if(device.flash,
set(layer[videoplayer_plugin].url,'%SWFPATH%/plugins/videoplayer.swf');
,
set(layer[videoplayer_plugin].url,'%SWFPATH%/plugins/videoplayer.js');
);
);
);
addlayer(videoplayer_cls);
set(layer[videoplayer_cls].zorder, 1000);
set(layer[videoplayer_cls].keep, true);
set(layer[videoplayer_cls].url, '%SWFPATH%/img/cls.png');
set(layer[videoplayer_cls].x, '2%');
set(layer[videoplayer_cls].y, '2%');
set(layer[videoplayer_cls].align, 'righttop');
set(layer[videoplayer_cls].alpha, 0);
tween(layer[videoplayer_cls].alpha , 1 , 1);
set(layer[videoplayer_cls].onclick, videoplayer_close()
);
</action>
<!-- CC: 视频播放! -->
<action name="videoplayer_plugin_ready">
if(layer[videoplayer_plugin],
set(events[videoplayer_events].onresize, videoplayer_plugin_resize() );
set(layer[videoplayer_plugin].pausedonstart, true);
set(layer[videoplayer_plugin].onvideoready,
videoplayer_plugin_resize();
tween(alpha,1,0.5,default, ifnot(device.ios, play() ) );
);
layer[videoplayer_plugin].playvideo(%1);
);
</action>
<!-- CC: 窗口变化后,自适应! -->
<action name="videoplayer_plugin_resize">
div(aspect, layer[videoplayer_plugin].imagewidth, layer[videoplayer_plugin].imageheight);
mul(new_videowidth, stagewidth,1);
div(new_videoheight, new_videowidth, aspect);
mul(max_videoheight, stageheight, 1);
roundval(new_videowidth);
roundval(new_videoheight);
copy(layer[videoplayer_plugin].width, new_videowidth);
copy(layer[videoplayer_plugin].height, new_videoheight);
</action>
<!-- CC: 视频关闭!
视频关闭后,需要依据声音按钮状态,恢复或暂停背景与解说声音的播放!
不建议修改UI图片!
-->
<action name="videoplayer_close">
set(events.[videoplayer_events].name, null);
if(layer[videoplayer_plugin], layer[videoplayer_plugin].pause() );
set(layer[videoplayer_bg].onclick, null);
set(layer[videoplayer_cls].onclick , null);
removelayer(videoplayer_plugin);
removelayer(videoplayer_bg);
removelayer(videoplayer_cls);
tween(layer[videoplayer_plugin].alpha, 0, 1, default,
removelayer(videoplayer_plugin);
removelayer(videoplayer_bg);
removelayer(videoplayer_cls);
);
if(layer[voice_bj].url == 'img/voice_bj_on.png' , resumesound(bj),pausesound(bj));
if(layer[voice_speak].url == 'img/voice_speak_on.png', resumesound(scenesound) , pausesound(scenesound));
</action>
<!-- CC:地图map系列制作! -->
<!-- CC: 图层 - map地图
在这里修改地图的宽高大小等等。点击事件为:放大地图。
-->
<layer name="map" url="img/map.png" keep="true" handcursor="false" capture="false"
align="righttop"
scale="0.25" scalechildren="true"
width="80%"
x="2%"
y="2%"
height="100%"
display="false"
enabled="false"
alpha="0"
onclick="
bigmap();
"
/>
<!-- CC: 图层 - map地图 控制按钮,功能是隐藏和关闭地图。
在这里修改地图的宽高大小等等。点击事件为:放大地图。
点击事件,可以依据当前图层的url来判断是显示地图(小),还是关闭!
-->
<layer name="omap"
alpha="1"
handcursor="true"
enabled="true"
children="true"
visible="true"
zorder="77"
align="righttop"
x="1%"
y="1%"
type="container"
maskchildren="true"
keep="true"
url="img/close_map.png"
bgcolor="0xFFFFFF"
bgalpha="1"
onclick="controllermap();"
/>
<!-- CC: 地图的关闭打开控制!
-->
<action name="controllermap">
if(layer[omap].url == 'img/close_map.png',
set(layer[map].alpha , 1);
set(layer[map].enabled , true);
set(layer[map].display , true);
set(layer[omap].url , 'img/open_map.png');
,
set(layer[map].alpha , 0);
set(layer[map].enabled , false);
set(layer[map].display , false);
set(layer[omap].url , 'img/close_map.png')
)
</action>
<!-- CC: 显示地图-大号! -->
<action name="bigmap">
set(layer[map].onclick, smallmap(); );
layer[map].changeorigin(center,center);
set(bigscale,0.8);
if(layer[map].imagewidth GT stagewidth, div(bigscale, stagewidth, layer[map].imagewidth); );
tween(layer[map].x, 10);
tween(layer[map].y, 10);
tween(layer[map].scale, get(bigscale));
</action>
<!-- CC: 显示地图-小号! -->
<action name="smallmap">
set(layer[map].onclick, bigmap(); );
layer[map].changeorigin(righttop,righttop);
tween(layer[map].x, '2%');
tween(layer[map].y, '2%');
tween(layer[map].scale, 0.25);
</action>
<!-- CC: 所有地图上的标记点,使用layer!
style是定义的一个总样式!
注意: layer的那么属性,是spot加个数字,数字从0开始。这个是定好的。不能改 !
-->
<style name="mapspot" keep="true" url="img/map_selects.png" parent="map" align="lefttop" edge="center" scale.mobile="2" />
<layer name="spot0" style="mapspot" x="10" y="10" zorder="78" onclick="mapspot_loadscene(scene_a);" />
<layer name="spot1" style="mapspot" x="50" y="50" zorder="78" onclick="mapspot_loadscene(scene_b);" />
<layer name="spot2" style="mapspot" x="100" y="100" zorder="78" onclick="mapspot_loadscene(scene_c);" />
<layer name="spot3" style="mapspot" x="200" y="200" zorder="78" onclick="mapspot_loadscene(scene_d);" />
<layer name="spot4" style="mapspot" x="300" y="300" zorder="78" onclick="mapspot_loadscene(scene_e);" />
<!-- CC: 点击地图上标记点的方法,加载对应的场景,场景有:
index 当前场景(从0开始) ,
count 场景总数!!
-->
<action name="mapspot_loadscene">
subtxt(spotid , get(name) , 4 , 2);
if(layer[map].scale GT 0.25,
set(layer[map].enabled, false);
tween(layer[map].alpha, 0.0, 0.25, default,
if(spotid != scene(get(xml.scene).index) , loadscene(%1, null, MERGE, ZOOMBLEND(1, 1.1, easeInOutSine)););
set(layer[map].onclick, bigmap(); );
layer[map].changeorigin(righttop,righttop);
set(layer[map].x, '2%');
set(layer[map].y, '2%');
set(layer[map].scale, 0.25);
set(events[sceneload].onloadcomplete,
delayedcall(1,
tween(layer[map].alpha, 1.0, 0.5, default, set(layer[map].enabled, true); );
);
);
);
,
<!-- small map: just load the scene -->
<!-- CC: 几种混合效果!
blend="NOBLEND"
blend="BLEND(1.0, easeInCubic)"
blend="ZOOMBLEND(2.0, 2.0, easeInOutSine)" -cc
blend="COLORBLEND(2.0, 0x000000, easeOutSine)"
blend="LIGHTBLEND(1.0, 0xFFFFFF, 2.0, linear)"
blend="SLIDEBLEND(1.0, 0.0, 0.2, linear)"
blend="SLIDEBLEND(1.0, 90.0, 0.01, linear)"
blend="SLIDEBLEND(1.0, 135.0, 0.4, linear)"
blend="OPENBLEND(1.0, 0.0, 0.2, 0.0, linear)"
blend="OPENBLEND(0.7, 1.0, 0.1, 0.0, linear)"
blend="OPENBLEND(1.0, -1.0, 0.3, 0.0, linear)"
blend="OPENBLEND(1.0, -0.5, 0.3, 0.8, linear)"
-->
if(spotid != scene(get(xml.scene).index) , loadscene(%1, null, MERGE, ZOOMBLEND(1, 1.1, easeInOutSine)););
);
</action>
<!-- CC: 地图中场景的选中显示。 -->
<layer name="activespot" url="img/map_choose.png" keep="true" parent="map"
zorder="79" scale.mobile="2" align="lefttop" edge="center"
/>
<!-- CC: 引入了雷达插件。这个比如导入该插件。 -->
<layer name="radar" keep="true" parent="map" edge="center"
url.flash="%SWFPATH%/plugins/radar.swf"
url.html5="%SWFPATH%/plugins/radar.js"
align="lefttop"
zorder="81"
width="12%"
height="12%"
scale.mobile="2"
fillalpha="0.5" fillcolor="0x7F5F3F"
linewidth="1.0" linecolor="0xE0E0A0" linealpha="0.5"
/>
<!-- CC: 改方法,主要在地图上显示雷达,当前加载场景的标记点。-->
<action name="updateradar">
<!-- 将当前热点的坐标复制到雷达和激活点的坐标,直接利用当前场景的index,反过来得到layer的名字,这样就使得这个activetespot的参数只要一个就可以了-->
set(layer[radar].heading, -90);
txtadd(spotidnow,'spot',get(scene[get(xml.scene)].index));
copy(layer[radar].x, layer[get(spotidnow)].x);
copy(layer[radar].y, layer[get(spotidnow)].y);
copy(layer[activespot].x, layer[get(spotidnow)].x);
copy(layer[activespot].y, layer[get(spotidnow)].y);
<!-- 下面方法显示了雷达,和角度。 -->
set(layer[radar].visible, true);
set(layer[activespot].visible, true);
</action>
</krpano>