Deploying to gh-pages from @ VickScarlet/lifeRestart@8f46e286dd 🚀
@@ -0,0 +1 @@
|
|||||||
|
theme: jekyll-theme-cayman
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="{{ site.lang | default: "en-US" }}">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
{% seo %}
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
<meta name="theme-color" content="#157878">
|
||||||
|
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
|
||||||
|
<link rel="stylesheet" href="{{ '/assets/css/style.css?v=' | append: site.github.build_revision | relative_url }}">
|
||||||
|
{% include head-custom.html %}
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<a id="skip-to-content" href="#content">Skip to the content.</a>
|
||||||
|
|
||||||
|
<header class="page-header" role="banner">
|
||||||
|
<h1 class="project-name">{{ page.title | default: site.title | default: site.github.repository_name }}</h1>
|
||||||
|
<h2 class="project-tagline">{{ page.description | default: site.description | default: site.github.project_tagline }}</h2>
|
||||||
|
<a href="/public/" class="btn">RESTART</a>
|
||||||
|
{% if site.github.is_project_page %}
|
||||||
|
<a href="{{ site.github.repository_url }}" class="btn">View on GitHub</a>
|
||||||
|
{% endif %}
|
||||||
|
{% if site.show_downloads %}
|
||||||
|
<a href="{{ site.github.zip_url }}" class="btn">Download .zip</a>
|
||||||
|
<a href="{{ site.github.tar_url }}" class="btn">Download .tar.gz</a>
|
||||||
|
{% endif %}
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<main id="content" class="main-content" role="main">
|
||||||
|
{{ content }}
|
||||||
|
|
||||||
|
<footer class="site-footer">
|
||||||
|
{% if site.github.is_project_page %}
|
||||||
|
<span class="site-footer-owner"><a href="{{ site.github.repository_url }}">{{ site.github.repository_name }}</a> is maintained by <a href="{{ site.github.owner_url }}">{{ site.github.owner_name }}</a>.</span>
|
||||||
|
{% endif %}
|
||||||
|
<span class="site-footer-credits">This page was generated by <a href="https://pages.github.com">GitHub Pages</a>.</span>
|
||||||
|
</footer>
|
||||||
|
</main>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
# Life Restart
|
||||||
|
|
||||||
|
やり直すんだ。そして、次はうまくやる。[RESTART](view/index.html)
|
||||||
|
|
||||||
|
<iframe src="https://discord.com/widget?id=883382868427014255&theme=dark" width="350" height="500" allowtransparency="true" frameborder="0" sandbox="allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-scripts"></iframe>
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
class c extends ui.view.DefaultTheme.AchievementUI{constructor(){super(),this.btnBack.on(Laya.Event.CLICK,this,()=>$ui.switchView(UI.pages.MAIN)),this.btnRank.on(Laya.Event.CLICK,this,$$event,["message",["M_NoRank"]]),this.listAchievements.renderHandler=new Laya.Handler(this,this.onRenderAchievement),this.listAchievements.scrollBar.elasticDistance=150}init(){const{statistics:e,achievements:a,PropertyTypes:t}=core;this.listAchievements.array=a,this.labRemakeTimes.text=$_.format($lang.F_RemakeTimes,e[t.TMS].value),this.labRemakeTimesJudge.text=e[t.TMS].judge,$_.deepMapSet(this.boxRemakeTimes,$ui.common.achievement[e[t.TMS].grade]),this.labAchievementCount.text=$_.format($lang.F_AchievementCount,e[t.CACHV].value),this.labAchievementCountJudge.text=e[t.CACHV].judge,$_.deepMapSet(this.boxAchievementCount,$ui.common.achievement[e[t.CACHV].grade]),this.labEventRate.text=parseInt(e[t.REVT].value*100)+"%",this.prgEventRate.scaleX=e[t.REVT].value,$_.deepMapSet(this.boxEventRate,$ui.common.achievement[e[t.REVT].grade]),this.labTalentRate.text=parseInt(e[t.RTLT].value*100)+"%",this.prgTalentRate.scaleX=e[t.RTLT].value,$_.deepMapSet(this.boxTalentRate,$ui.common.achievement[e[t.RTLT].grade])}onRenderAchievement(e){const a=e.dataSource,t=e.getChildByName("name"),i=e.getChildByName("description"),n=e.getChildByName("boxMask");$_.deepMapSet(e,$ui.common.achievement[a.grade]),t.color=i.color=$ui.common.defaultFontColor,a.isAchieved?(t.text=a.name,i.text=a.description,n.visible=!1):(t.text=a.hide?"???":a.name,i.text=a.hide?"???":a.description,n.visible=!0)}}export{c as default};
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
var u=s=>{throw TypeError(s)};var b=(s,a,t)=>a.has(s)||u("Cannot "+t);var n=(s,a,t)=>(b(s,a,"read from private field"),t?t.call(s):a.get(s)),v=(s,a,t)=>a.has(s)?u("Cannot add the same private member more than once"):a instanceof WeakSet?a.add(s):a.set(s,t),m=(s,a,t,i)=>(b(s,a,"write to private field"),i?i.call(s,t):a.set(s,t),t);var c,h;class w extends ui.view.CyberTheme.CyberAchievementUI{constructor(){super();v(this,c);v(this,h);this.btnBack.on(Laya.Event.CLICK,this,()=>$ui.switchView(UI.pages.MAIN));const t=Math.min(this.btnAchievement.fontSize,this.btnStatistics.fontSize),i=Math.max(this.btnAchievement.fontSize,this.btnStatistics.fontSize);m(this,c,{min:t,max:i}),this.btnStatistics.on(Laya.Event.CLICK,this,()=>this.switch("statistics")),this.btnAchievement.on(Laya.Event.CLICK,this,()=>this.switch("achievement")),this.btnRank.on(Laya.Event.CLICK,this,$$event,["message",["M_NoRank"]]),this.listAchievements.renderHandler=new Laya.Handler(this,this.onRenderAchievement),this.listAchievements.scrollBar.elasticDistance=150,this.on(Laya.Event.RESIZE,this,()=>{var o,r,l;this.boxPage.width=2*this.width,this.boxA.width=this.boxB.width=this.width,this.boxPage.x<0&&(this.boxPage.x=-this.width);const e=(l=(r=(o=this.listAchievements)==null?void 0:o._itemRender)==null?void 0:r.props)==null?void 0:l.width;if(e){const d=Math.max(Math.floor((this.width-65)/e),1);this.listAchievements.width=d*e+(d-1)*(this.listAchievements.spaceY||0)+30}})}init(){this.switch("statistics",0);const{statistics:t,achievements:i,PropertyTypes:e}=core;this.listAchievements.array=i,this.labRemakeTimes.text=t[e.TMS].value,this.labRemakeTimesJudge.text=t[e.TMS].judge,this.labAchievementCountJudge.color=$ui.common.grade[t[e.TMS].grade],this.labAchievementCount.text=t[e.CACHV].value,this.labAchievementCountJudge.text=t[e.CACHV].judge,this.labAchievementCountJudge.color=$ui.common.grade[t[e.CACHV].grade],this.labEventRate.text=parseInt(t[e.REVT].value*100)+"%",this.prgEventRate.value=t[e.REVT].value,this.labTalentRate.text=parseInt(t[e.RTLT].value*100)+"%",this.prgTalentRate.value=t[e.RTLT].value}switch(t,i=300){switch(n(this,h)&&n(this,h).forEach(e=>Laya.Tween.clear(e)),m(this,h,[]),t){case"statistics":i=-this.boxPage.x/this.width*i,n(this,h).push(Laya.Tween.to(this.boxPage,{x:0},i,Laya.Ease.backOut,Laya.Handler.create(this,()=>m(this,h,null))),Laya.Tween.to(this.btnStatistics,{fontSize:n(this,c).max,anchorX:.5,anchorY:1},i,Laya.Ease.backOut),Laya.Tween.to(this.btnAchievement,{fontSize:n(this,c).min,anchorX:.5,anchorY:1},i,Laya.Ease.backOut));break;case"achievement":i=(this.width+this.boxPage.x)/this.width*i,n(this,h).push(Laya.Tween.to(this.boxPage,{x:-this.width},i,Laya.Ease.backOut,Laya.Handler.create(this,()=>m(this,h,null))),Laya.Tween.to(this.btnStatistics,{fontSize:n(this,c).min,anchorX:.5,anchorY:1},i,Laya.Ease.backOut),Laya.Tween.to(this.btnAchievement,{fontSize:n(this,c).max,anchorX:.5,anchorY:1},i,Laya.Ease.backOut));break}}onRenderAchievement(t,i){const e=t.dataSource,o=t.getChildByName("name"),r=t.getChildByName("description"),l=t.getChildByName("completed"),d=t.getChildByName("uncomplete");e.isAchieved?(o.text=e.name,r.text=e.description,l.visible=!0,d.visible=!1):(o.text=e.hide?"???":e.name,r.text=e.hide?"???":e.description,l.visible=!1,d.visible=!0),t.colorFilter=$ui.gradeFilter(e.grade)}}c=new WeakMap,h=new WeakMap;export{w as default};
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
class s extends ui.view.CyberTheme.CyberAchievementPopupUI{constructor(){super()}async popup({achievement:a},t){Laya.Tween.clearAll(this),Laya.Tween.clearAll(this.boxBg),this.alpha=.8,this.labName.text=a.name,this.labName.color=$ui.common.grade[a.grade],this.x=-this.width,this.boxBg.x=this.boxBg.width,await Promise.all([Laya.promises.Tween.to(this,{x:0},300,Laya.Ease.strongOut),Laya.promises.Tween.to(this.boxBg,{x:0},300,Laya.Ease.strongOut,50)]),await Laya.promises.Tween.to(this,{alpha:0},3e3,Laya.Ease.strongIn)}}export{s as default};
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
class s extends ui.view.DefaultTheme.AchievementPopupUI{constructor(){super()}async popup({achievement:a},t){Laya.Tween.clearAll(this),Laya.Tween.clearAll(this.boxBg),this.alpha=.8,this.labName.text=a.name,this.labName.color=$ui.common.grade[a.grade],this.x=-this.width,this.boxBg.x=this.boxBg.width,await Promise.all([Laya.promises.Tween.to(this,{x:0},300,Laya.Ease.strongOut),Laya.promises.Tween.to(this.boxBg,{x:0},300,Laya.Ease.strongOut,50)]),await Laya.promises.Tween.to(this,{alpha:0},3e3,Laya.Ease.strongIn)}}export{s as default};
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
var S=a=>{throw TypeError(a)};var E=(a,s,e)=>s.has(a)||S("Cannot "+e);var u=(a,s,e)=>(E(a,s,"read from private field"),e?e.call(a):s.get(a)),v=(a,s,e)=>s.has(a)?S("Cannot add the same private member more than once"):s instanceof WeakSet?s.add(a):s.set(a,e),f=(a,s,e,t)=>(E(a,s,"write to private field"),t?t.call(a,e):s.set(a,e),e),p=(a,s,e)=>(E(a,s,"access private method"),e);var r,g,x,L,$;const m=class m extends ui.view.CyberTheme.CelebrityUI{constructor(){super();v(this,x);v(this,r);this.btnRetry.on(Laya.Event.CLICK,this,()=>this.random()),this.btnNext.on(Laya.Event.CLICK,this,this.next),this.panelCharacter.vScrollBar.elasticDistance=150}init(){this.random()}close(){f(this,r,null),this.vboxCharacter.destroyChildren(!0)}random(e){f(this,r,null),this.vboxCharacter.destroyChildren(!0);const{unique:t,normal:l}=core.characterRandom(),i=[],c=this.generateUnique(t,()=>{core.generateUnique(),this.random(l)});c&&i.push(c),(e||l).forEach(n=>i.push(p(this,x,L).call(this,n))),i.forEach((n,o)=>{n.y=o,this.vboxCharacter.addChild(n),n.click(()=>{u(this,r)&&u(this,r).switch(!1),f(this,r,n),n.switch(!0),n.event(Laya.Event.RESIZE)})}),e&&c&&(f(this,r,c),c.switch(!0),c.event(Laya.Event.RESIZE))}generateUnique(e,t){return e?e.generate?(e.name=$lang.UI_UniqueWaTaShi,p(this,x,L).call(this,e)):p(this,x,$).call(this,t):null}next(){if(!u(this,r))return $$event("message",["M_PleaseSelectOne"]);if(!u(this,r).dataSource)return $$event("message",["M_UnGenerate"]);const{property:e,talent:t}=u(this,r).dataSource,l=core.remake(t.map(i=>i.id));l.length>0&&$$event("message",[l.map(i=>["F_TalentReplace",i])]),$ui.switchView(UI.pages.TRAJECTORY,{propertyAllocate:e,talents:t,enableExtend:!1})}};r=new WeakMap,g=new WeakMap,x=new WeakSet,L=function(e,t){var I,B;const{name:l,property:i,talent:c}=e,n=u(I=m,g).call(I,"boxCharacter"),o=n.getChildByName("vboxStates"),y=n.getChildByName("boxName");y.getChildByName("label").text=l;const h=$_.clone(i);for(const C in h)Math.abs(h[C]-Math.PI)<1e-7&&(h[C]="π");o.getChildByName("label").text=$_.format($lang.F_PropertyStr,h);for(const C of c){const b=u(B=m,g).call(B,"boxTalent");b.getChildByName("label").text=$_.format($lang.F_TalentSelection,C),b.y=o.height+o.space;let N=b.getChildByName(`grade${C.grade}`);N&&(N.visible=!0),o.addChild(b)}const d=new Laya.Box;return d.height=o.space,d.y=o.height,o.addChild(d),o.scaleY=0,n.dataSource=e,n.switch=C=>o.scaleY=C?1:0,n.click=(C,b)=>{y.offAll(Laya.Event.CLICK),y.on(Laya.Event.CLICK,b||this,C)},t&&n.click(t),n},$=function(e){var y;const t=u(y=m,g).call(y,"boxUniqueUnGenerate"),l=t.getChildByName("boxName"),i=t.getChildByName("vboxStates"),c=i.getChildByName("label"),o=i.getChildByName("boxBtn").getChildByName("btn");return c.event(Laya.Event.RESIZE),i.scaleY=0,t.dataSource=!1,t.switch=h=>i.scaleY=h?1:0,t.click=(h,d)=>{l.offAll(Laya.Event.CLICK),l.on(Laya.Event.CLICK,d||this,h)},t.generate=(h,d)=>{o.offAll(Laya.Event.CLICK),o.on(Laya.Event.CLICK,d||this,h)},e&&t.generate(e),t},v(m,g,Laya.plugin.extractComponents(m.uiView,["boxCharacter","boxTalent","boxUniqueUnGenerate"]));let U=m;export{U as default};
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
var U=t=>{throw TypeError(t)};var E=(t,s,e)=>s.has(t)||U("Cannot "+e);var d=(t,s,e)=>(E(t,s,"read from private field"),e?e.call(t):s.get(t)),g=(t,s,e)=>s.has(t)?U("Cannot add the same private member more than once"):s instanceof WeakSet?s.add(t):s.set(t,e),v=(t,s,e,a)=>(E(t,s,"write to private field"),a?a.call(t,e):s.set(t,e),e),$=(t,s,e)=>(E(t,s,"access private method"),e);var h,x,b,L,B;const y=class y extends ui.view.DefaultTheme.CelebrityUI{constructor(){super();g(this,b);g(this,h);this.btnRetry.on(Laya.Event.CLICK,this,()=>this.random()),this.btnNext.on(Laya.Event.CLICK,this,this.next),this.panelCharacter.vScrollBar.elasticDistance=150}init(){this.random()}close(){v(this,h,null),this.vboxCharacter.destroyChildren(!0)}random(e){v(this,h,null),this.vboxCharacter.destroyChildren(!0);const{unique:a,normal:n}=core.characterRandom(),c=[],o=this.generateUnique(a,()=>{core.generateUnique(),this.random(n)});o&&c.push(o),(e||n).forEach(r=>c.push($(this,b,L).call(this,r))),c.forEach((r,l)=>{r.y=l,this.vboxCharacter.addChild(r),r.click(()=>{d(this,h)&&d(this,h).switch(!1),v(this,h,r),r.switch(!0),r.event(Laya.Event.RESIZE)})}),e&&o&&(v(this,h,o),o.switch(!0),o.event(Laya.Event.RESIZE))}generateUnique(e,a){return e?e.generate?(e.name=$lang.UI_UniqueWaTaShi,$(this,b,L).call(this,e)):$(this,b,B).call(this,a):null}next(){if(!d(this,h))return $$event("message",["M_PleaseSelectOne"]);if(!d(this,h).dataSource)return $$event("message",["M_UnGenerate"]);const{property:e,talent:a}=d(this,h).dataSource,n=core.remake(a.map(c=>c.id));n.length>0&&$$event("message",[n.map(c=>["F_TalentReplace",c])]),$ui.switchView(UI.pages.TRAJECTORY,{propertyAllocate:e,talents:a,enableExtend:!1})}};h=new WeakMap,x=new WeakMap,b=new WeakSet,L=function(e,a){var S,I;const{name:n,property:c,talent:o}=e,r=$ui.common.characterItem,l=d(S=y,x).call(S,"boxCharacter"),i=l.getChildByName("vboxStates"),C=l.getChildByName("boxName");C.label=n;const m=$_.clone(c);for(const u in m)Math.abs(m[u]-Math.PI)<1e-7&&(m[u]="π");i.label=$_.format($lang.F_PropertyStr,m),$_.deepMapSet(C,r.name),$_.deepMapSet(i,r.state);for(const u of o){const f=d(I=y,x).call(I,"boxTalent");f.label=$_.format($lang.F_TalentSelection,u),f.y=i.height+i.space,$_.deepMapSet(f,$ui.common.card[u.grade].normal),i.addChild(f)}const p=new Laya.Box;return p.height=i.space,p.y=i.height,i.addChild(p),i.scaleY=0,l.dataSource=e,l.switch=u=>i.scaleY=u?1:0,l.click=(u,f)=>{C.offAll(Laya.Event.CLICK),C.on(Laya.Event.CLICK,f||this,u)},a&&l.click(a),l},B=function(e){var C;const a=$ui.common.characterItem,n=d(C=y,x).call(C,"boxUniqueUnGenerate"),c=n.getChildByName("boxName"),o=n.getChildByName("vboxStates"),r=o.getChildByName("label"),l=o.getChildByName("boxBtn"),i=l.getChildByName("btn");return $_.deepMapSet(c,a.name),$_.deepMapSet(o,a.state),$_.deepMapSet(i,a.name),l.y=r.height+o.space,r.event(Laya.Event.RESIZE),o.scaleY=0,n.dataSource=!1,n.switch=m=>o.scaleY=m?1:0,n.click=(m,p)=>{c.offAll(Laya.Event.CLICK),c.on(Laya.Event.CLICK,p||this,m)},n.generate=(m,p)=>{i.offAll(Laya.Event.CLICK),i.on(Laya.Event.CLICK,p||this,m)},e&&n.generate(e),n},g(y,x,Laya.plugin.extractComponents(y.uiView,["boxCharacter","boxTalent","boxUniqueUnGenerate"]));let N=y;export{N as default};
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
const e={UI_Next:"Next",UI_Back:"Back",UI_Skip:"Skip",UI_Done:"Done",UI_Cancel:"Cancel",UI_Confirm:"Confirm",UI_Retry:"Retry",UI_Yes:"Yes",UI_No:"No",UI_OK:"OK",UI_Close:"Close",UI_Open:"Open",UI_Search:"Search",UI_Loading:"Now Loading",UI_Error:"Error",UI_Colon:":",UI_Times:"Times",UI_Count:"",UI_Property_Charm:"CHR",UI_Property_Intelligence:"INT",UI_Property_Strength:"STR",UI_Property_Money:"MNY",UI_Property_Spirit:"SPR",UI_Title_Remake:"Remake Simulate",UI_Title_Subsequent:"The rubbish life doesn't want to stay for a second",UI_Remake:"↻Remake Now",UI_Thanks:"Thx",UI_Achievement:"Achv",UI_Cyber_Theme_Art_Design:"UI Design by 晰晰",UI_Banner:`作者的新作《纸上谈亲》已上线小程序
|
||||||
|
微信/抖音搜索“纸上谈亲”即可游玩~`,UI_Title_Talent:"Talent Draw",UI_Talent_Draw:"!10 Pulls!",UI_Talent_Select_Uncomplete:"Choose 3 Talents, Please.",UI_Title_Property:"Property Allocate",UI_Left_Property_Point:"Left Property Point",UI_Selected_Talent:"Selected Talent",UI_Random_Allocate:"Random Allocate",UI_Make_New_Life:"Make New Life",UI_Manual:"Manual",UI_Auto:"Auto",UI_Goto_Summary:"Goto Summary",UI_Title_Summary:"Life Summary",UI_Talent_Extend:"Talent, You can choose one to extend",UI_Remake_Again:"Remake Again",UI_Final_Age:"Age",UI_Total_Judge:"Judge",UI_Achievement_Count:"Achievement",UI_Remake_Times:"Remake Times",UI_Event_Collection_Rate:"Event Collection",UI_Talent_Collection_Rate:"Talent Collection",UI_Statistics:"Statistics",UI_Rank:"Rank",UI_Achievement_Achieve:"Achievement",UI_Judge_Level_0:"Hell",UI_Judge_Level_1:"Worse",UI_Judge_Level_2:"Bad",UI_Judge_Level_3:"Normal",UI_Judge_Level_4:"Good",UI_Judge_Level_5:"Great",UI_Judge_Level_6:"Excellent",UI_Judge_Level_7:"Perfect",UI_Spirit_Judge_Level_0:"Hell",UI_Spirit_Judge_Level_1:"Tortured",UI_Spirit_Judge_Level_2:"Unlucky",UI_Spirit_Judge_Level_3:"Normal",UI_Spirit_Judge_Level_4:"Happy",UI_Spirit_Judge_Level_5:"Blissful ",UI_Spirit_Judge_Level_6:"Paradise",UI_AGE_Judge_Level_0:"Stillborn",UI_AGE_Judge_Level_1:"Early",UI_AGE_Judge_Level_2:"Young",UI_AGE_Judge_Level_3:"Heyday",UI_AGE_Judge_Level_4:"Middle",UI_AGE_Judge_Level_5:"Sexagenarian",UI_AGE_Judge_Level_6:"Septuagenarian",UI_AGE_Judge_Level_7:"Octogenarian",UI_AGE_Judge_Level_8:"Nonagenarian",UI_AGE_Judge_Level_9:"不老",UI_AGE_Judge_Level_10:"修仙",UI_AGE_Judge_Level_11:"仙寿",UI_Intelligence_Judge_Level_7:"识海",UI_Intelligence_Judge_Level_8:"元神",UI_Intelligence_Judge_Level_9:"仙魂",UI_Strength_Judge_Level_7:"凝气",UI_Strength_Judge_Level_8:"筑基",UI_Strength_Judge_Level_9:"金丹",UI_Strength_Judge_Level_10:"元婴",UI_Strength_Judge_Level_11:"仙体",UI_Remake_Times_Judge_Level_0:"Purple rate constant",UI_Remake_Times_Judge_Level_1:"Purple rate double",UI_Remake_Times_Judge_Level_2:"Purple rate triple",UI_Remake_Times_Judge_Level_3:"Purple rate Quadruple",UI_Remake_Times_Judge_Level_4:"Purple rate Quintuple",UI_Remake_Times_Judge_Level_5:"Purple rate Sextuple",UI_Achievement_Count_Judge_Level_0:"Orange rate constant",UI_Achievement_Count_Judge_Level_1:"Orange rate double",UI_Achievement_Count_Judge_Level_2:"Orange rate triple",UI_Achievement_Count_Judge_Level_3:"Orange rate Quadruple",UI_Achievement_Count_Judge_Level_4:"Orange rate Quintuple",UI_Achievement_Count_Judge_Level_5:"Orange rate Sextuple",UI_Support_Programmer:"Programmer",UI_Support_Designer:"Designer",UI_Save:"Save",UI_Load:"Load",UI_Read:"Copy",UI_Write:"Paste",UI_CopySuccess:"Copy to clipboard success",UI_CopyFailed:"Copy to clipboard Failed",UI_PasteSuccessDecodeSuccess:"Load Success!",UI_PasteSuccessDecodeFailed:"Paste success, but load Failed!",UI_PasteFailedDecodeSuccess:"Paste Failed, use input load success!",UI_PasteFailedDecodeFailed:"Paste Failed, use input load Failed!",UI_LoadSuccess:"Load Success!",UI_LoadFailed:"Load Failed!",UI_Title_Celebrity:"Past life was...",UI_CustomMode:"Custom",UI_CustomModeDescription:`10 Talent
|
||||||
|
Custom property`,UI_CelebrityMode:"Celebrity",UI_CelebrityModeDescription:`Past life is celebrity
|
||||||
|
Rebirth to modern`,UI_AllNot:"↻All Not",UI_UniqueWaTaShi:"Unique of mine",UI_UniqueWaTaShiContent:`
|
||||||
|
Unique character card different from other 60 million player
|
||||||
|
All property, All talent, All random
|
||||||
|
All has only one chance`,UI_GenerateNow:"Generate Now",M_NoRank:"There is no rank",M_PleaseSelectOne:"Please Select One",M_UnGenerate:"Unique Character no generate",M_DisableExtendTalent:"Celebrity mode can't extends talent",F_RemakeTimes:"Remake {0} Times",F_AchievementCount:"Achievement {0}",F_TalentSelection:"{name} ({description})",F_TalentConflict:"Conflict with talent ({0})",F_TalentSelectLimit:"Talent select limit {0}",F_TalentSelectNotComplect:"Please select {0} talent",F_PropertyPointLeft:"You have left {0} property point",F_TalentReplace:"Talent replace [{source.name}] -> [{target.name}]",F_PropertyStr:"CHR{CHR} INT{INT} STR{STR} MNY{MNY}"};export{e as default};
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
class e extends ui.view.LoadingUI{constructor(){super()}static load(){return["images/atlas/images/resource.atlas"]}show(){}onProgress(a){}}export{e as default};
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
class s extends ui.view.DefaultTheme.MainUI{constructor(){super(),this.btnRemake.on(Laya.Event.CLICK,this,()=>$ui.switchView(UI.pages.MODE)),this.btnAchievement.on(Laya.Event.CLICK,this,()=>$ui.switchView(UI.pages.ACHIEVEMENT)),this.btnThanks.on(Laya.Event.CLICK,this,()=>$ui.switchView(UI.pages.THANKS)),this.btnGithub.on(Laya.Event.CLICK,this,goto,["github"]),this.btnDiscord.on(Laya.Event.CLICK,this,goto,["discord"]),this.btnThemes.on(Laya.Event.CLICK,this,()=>$ui.showDialog(UI.pages.THEMES)),this.btnSaveLoad.on(Laya.Event.CLICK,this,()=>$ui.showDialog(UI.pages.SAVELOAD))}static load(){return["images/atlas/images/icons.atlas"]}init(){this.banner.visible=this.btnDiscord.visible=this.btnAchievement.visible=this.btnThanks.visible=!!core.times;const t=this.labSubTitle.text;this.labSubTitle.text=" ",this.labSubTitle.text=t}}export{s as default};
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
class i extends ui.view.CyberTheme.CyberMainUI{constructor(){super(),this.btnRemake.on(Laya.Event.CLICK,this,()=>$ui.switchView(UI.pages.MODE)),this.btnAchievement.on(Laya.Event.CLICK,this,()=>$ui.switchView(UI.pages.ACHIEVEMENT)),this.btnThanks.on(Laya.Event.CLICK,this,()=>$ui.switchView(UI.pages.THANKS)),this.btnGithub.on(Laya.Event.CLICK,this,goto,["github"]),this.btnDiscord.on(Laya.Event.CLICK,this,goto,["discord"]),this.btnThemes.on(Laya.Event.CLICK,this,()=>$ui.showDialog(UI.pages.THEMES)),this.btnSaveLoad.on(Laya.Event.CLICK,this,()=>$ui.showDialog(UI.pages.SAVELOAD)),this.on(Laya.Event.RESIZE,this,()=>{const s=Math.max(this.width/this.imgBg.width,this.height/this.imgBg.height);this.imgBg.scale(s,s)})}static load(){return["fonts/方正像素12.ttf","images/atlas/images/accessories.atlas","images/atlas/images/border.atlas","images/atlas/images/button.atlas","images/atlas/images/icons.atlas","images/atlas/images/progress.atlas","images/atlas/images/slider.atlas"]}init(){this.banner.visible=this.btnDiscord.visible=this.btnAchievement.visible=this.btnThanks.visible=!!core.times}}export{i as default};
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
class t extends ui.view.MessagePopupUI{constructor(){super(),this.left=this.right=0,this.boxBg.defaultColor="#000000",this.boxBg.hoverColor="#000000",this.boxBg.radius=20}async popup({message:s},a){this.message.text=s,this.message.commitMeasure(),this.height=this.message.height+this.boxBg.radius*2+this.message.fontSize,Laya.Tween.clearAll(this),this.alpha=0,this.y=-2*this.height,await Laya.promises.Tween.to(this,{y:0,alpha:1},300,Laya.Ease.backOut),await Laya.promises.Tween.to(this,{alpha:0},300,Laya.Ease.strongIn,3e3)}}export{t as default};
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
class t extends ui.view.CyberTheme.ModeUI{constructor(){super(),this.btnCustom.on(Laya.Event.CLICK,this,()=>$ui.switchView(UI.pages.TALENT)),this.btnCelebrity.on(Laya.Event.CLICK,this,()=>$ui.switchView(UI.pages.CELEBRITY))}}export{t as default};
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
class t extends ui.view.DefaultTheme.ModeUI{constructor(){super(),this.btnCustom.on(Laya.Event.CLICK,this,()=>$ui.switchView(UI.pages.TALENT)),this.btnCelebrity.on(Laya.Event.CLICK,this,()=>$ui.switchView(UI.pages.CELEBRITY))}}export{t as default};
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
var u=r=>{throw TypeError(r)};var I=(r,o,e)=>o.has(r)||u("Cannot "+e);var t=(r,o,e)=>(I(r,o,"read from private field"),e?e.call(r):o.get(r)),y=(r,o,e)=>o.has(r)?u("Cannot add the same private member more than once"):o instanceof WeakSet?o.add(r):o.set(r,e),p=(r,o,e,s)=>(I(r,o,"write to private field"),s?s.call(r,e):o.set(r,e),e);var n,l,a,h;class g extends ui.view.DefaultTheme.PropertyUI{constructor(){super();y(this,n);y(this,l);y(this,a);y(this,h);const e=p(this,n,core.PropertyTypes);this.btnCharmIncrease.on(Laya.Event.CLICK,this,this.onPropertyAllocate,[e.CHR,1]),this.btnCharmReduce.on(Laya.Event.CLICK,this,this.onPropertyAllocate,[e.CHR,-1]),this.btnIntelligenceIncrease.on(Laya.Event.CLICK,this,this.onPropertyAllocate,[e.INT,1]),this.btnIntelligenceReduce.on(Laya.Event.CLICK,this,this.onPropertyAllocate,[e.INT,-1]),this.btnStrengthIncrease.on(Laya.Event.CLICK,this,this.onPropertyAllocate,[e.STR,1]),this.btnStrengthReduce.on(Laya.Event.CLICK,this,this.onPropertyAllocate,[e.STR,-1]),this.btnMoneyIncrease.on(Laya.Event.CLICK,this,this.onPropertyAllocate,[e.MNY,1]),this.btnMoneyReduce.on(Laya.Event.CLICK,this,this.onPropertyAllocate,[e.MNY,-1]),this.inputCharm.on(Laya.Event.INPUT,this,this.onPropertyAllocateInput,[e.CHR]),this.inputIntelligence.on(Laya.Event.INPUT,this,this.onPropertyAllocateInput,[e.INT]),this.inputStrength.on(Laya.Event.INPUT,this,this.onPropertyAllocateInput,[e.STR]),this.inputMoney.on(Laya.Event.INPUT,this,this.onPropertyAllocateInput,[e.MNY]);const s=({currentTarget:i})=>{i.text=""};this.inputCharm.on(Laya.Event.MOUSE_DOWN,this,s),this.inputIntelligence.on(Laya.Event.MOUSE_DOWN,this,s),this.inputStrength.on(Laya.Event.MOUSE_DOWN,this,s),this.inputMoney.on(Laya.Event.MOUSE_DOWN,this,s),this.btnRandomAllocate.on(Laya.Event.CLICK,this,this.random),this.btnNext.on(Laya.Event.CLICK,this,this.next),this.listSelectedTalents.renderHandler=Laya.Handler.create(this,this.renderTalent,null,!1)}init({talents:e}){this.listSelectedTalents.array=e;const s=core.remake(e.map(i=>i.id));s.length>0&&$$event("message",[s.map(i=>["F_TalentReplace",i])]),p(this,l,core.getPropertyPoints()),p(this,h,core.propertyAllocateLimit),this.labLeftPropertyPoint.text=t(this,l),p(this,a,{[t(this,n).CHR]:0,[t(this,n).INT]:0,[t(this,n).STR]:0,[t(this,n).MNY]:0}),this.updateAllocate()}next(){const e=t(this,l)-this.total;if(e>0)return $$event("message",["F_PropertyPointLeft",e]);$ui.switchView(UI.pages.TRAJECTORY,{propertyAllocate:t(this,a),talents:this.listSelectedTalents.array,enableExtend:!0})}get total(){return t(this,a)[t(this,n).CHR]+t(this,a)[t(this,n).INT]+t(this,a)[t(this,n).STR]+t(this,a)[t(this,n).MNY]}updateAllocate(){const e=t(this,a)[t(this,n).CHR],s=t(this,a)[t(this,n).INT],i=t(this,a)[t(this,n).STR],c=t(this,a)[t(this,n).MNY];this.inputCharm.text=""+e,this.inputIntelligence.text=""+s,this.inputStrength.text=""+i,this.inputMoney.text=""+c,this.labLeftPropertyPoint.text=t(this,l)-this.total,this.btnCharmIncrease.disabled=this.btnCharmIncrease.gray=!1,this.btnCharmReduce.disabled=this.btnCharmReduce.gray=!1,this.btnIntelligenceIncrease.disabled=this.btnIntelligenceIncrease.gray=!1,this.btnIntelligenceReduce.disabled=this.btnIntelligenceReduce.gray=!1,this.btnStrengthIncrease.disabled=this.btnStrengthIncrease.gray=!1,this.btnStrengthReduce.disabled=this.btnStrengthReduce.gray=!1,this.btnMoneyIncrease.disabled=this.btnMoneyIncrease.gray=!1,this.btnMoneyReduce.disabled=this.btnMoneyReduce.gray=!1}check(e,s,i){return!(i<e||i>s)}random(){let e=t(this,l);const s=new Array(4).fill(t(this,h)[1]);for(;e>0;){const i=Math.round(Math.random()*(Math.min(e,t(this,h)[1])-1))+1;for(;;){const c=Math.floor(Math.random()*4)%4;if(!(s[c]-i<0)){s[c]-=i,e-=i;break}}}t(this,a)[t(this,n).CHR]=t(this,h)[1]-s[0],t(this,a)[t(this,n).INT]=t(this,h)[1]-s[1],t(this,a)[t(this,n).STR]=t(this,h)[1]-s[2],t(this,a)[t(this,n).MNY]=t(this,h)[1]-s[3],this.updateAllocate()}onPropertyAllocate(e,s){this.check(t(this,h)[0],t(this,h)[1],t(this,a)[e]+s)&&this.check(0,t(this,l),this.total+s)&&(t(this,a)[e]+=s,this.updateAllocate())}onPropertyAllocateInput(e,s){let i=parseInt(s.text)||0;const c=this.total;c+i<0?i=t(this,h)[0]*4-c:c+i>t(this,l)&&(i=t(this,l)-c),i<t(this,h)[0]?i=t(this,h)[0]:i>t(this,h)[1]&&(i=t(this,h)[1]);const d=i-t(this,a)[e];d?this.onPropertyAllocate(e,d):this.updateAllocate()}renderTalent(e){const s=e.dataSource;e.label=$_.format($lang.F_TalentSelection,s);const i=$ui.common.card[s.grade].normal;$_.deepMapSet(e,i)}}n=new WeakMap,l=new WeakMap,a=new WeakMap,h=new WeakMap;export{g as default};
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
class c extends ui.view.SaveLoadUI{constructor(){super(),this.btnClose.on(Laya.Event.CLICK,this,async()=>{await this.close(),$ui.switchView(UI.pages.MAIN)}),this.btnRead.on(Laya.Event.CLICK,this,async()=>{const t=await $$copy(this.input.text=this.data);$$event("message",[t?"UI_CopySuccess":"UI_CopyFailed"])}),this.btnWrite.on(Laya.Event.CLICK,this,async()=>{const t=await $$read();t==!1?this.data=[this.input.text,"UI_PasteFailedDecodeSuccess","UI_PasteFailedDecodeFailed"]:(this.input.text=t,this.data=[t,"UI_PasteSuccessDecodeSuccess","UI_PasteSuccessDecodeFailed"])}),this.btnSave.on(Laya.Event.CLICK,this,()=>{let t=new Blob([this.data],{type:"application/json"});t=(t.slice||t.webkitSlice||t.mozSlice).call(t,0,t.size,"application/octet-stream");const e=document.createElementNS("http://www.w3.org/1999/xhtml","a");e.href=URL.createObjectURL(t),e.download=`Remake_save_${new Date().toISOString().replace(":",".")}.json`,document.body.appendChild(e),e.click(),document.body.removeChild(e),URL.revokeObjectURL(e.href)}),this.btnLoad.on(Laya.Event.CLICK,this,()=>{const t=document.createElement("input");t.setAttribute("type","file"),t.setAttribute("name","file"),t.setAttribute("accept","application/json"),t.setAttribute("style","display: none;"),document.body.appendChild(t),t.click(),t.onchange=a=>{const e=a.target.files[0];if(!e)return;const i=new FileReader;i.onload=()=>this.data=[i.result],i.readAsText(e),document.body.removeChild(e)}}),this.input.on(Laya.Event.MOUSE_DOWN,this,()=>{this.input.setSelection(0,this.input.text.length)}),this.btnBackup.on(Laya.Event.CLICK,this,()=>{const t=document.createElement("div");document.body.appendChild(t),t.style=`
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
opacity: 0.95`;const a=document.createElement("div");a.style=`
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
background: #fff;
|
||||||
|
opacity: 0.95`,document.body.appendChild(t),t.appendChild(a);const e=document.createElement("textarea");e.style=`position: absolute; width: ${window.innerWidth}px; height: ${window.innerHeight}px;`,e.value=JSON.stringify(JSON.parse(this.data),null,4),t.appendChild(e);const i=document.createElement("div");i.style=`
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
right: 0;
|
||||||
|
width: 100px;
|
||||||
|
height: 100px;
|
||||||
|
background: red;
|
||||||
|
font-size:100px;
|
||||||
|
padding: 0;
|
||||||
|
line-height: 100px;
|
||||||
|
color: white;
|
||||||
|
opacity: 0.7`,i.innerHTML="×",t.appendChild(i),i.onclick=()=>t.remove();const o=document.createElement("div");o.style=`
|
||||||
|
position: absolute;
|
||||||
|
bottom: 0;
|
||||||
|
right: 0;
|
||||||
|
width: 100px;
|
||||||
|
height: 100px;
|
||||||
|
background: limegreen;
|
||||||
|
font-size: 35px;
|
||||||
|
padding: 0;
|
||||||
|
line-height: 50px;
|
||||||
|
color: white;
|
||||||
|
opacity: 0.7`,o.innerHTML="LOAD<br>读取",t.appendChild(o),o.onclick=()=>this.data=[e.value,"成功/success","失败/failed",!0]})}static load(){return["images/atlas/images/radio.atlas"]}init(){this.input.text=this.data}get data(){const t={};return Object.keys(localStorage).filter(a=>a.substr(0,4)!="goog").forEach(a=>t[a]=localStorage[a]),JSON.stringify(t)}set data([t,a="UI_LoadSuccess",e="UI_LoadFailed",i]){try{const o=JSON.parse(t);for(const n in o)localStorage.setItem(n,o[n]);i?alert(a):$$event("message",[a]),$ui.theme=$ui.theme,this.btnClose.event(Laya.Event.CLICK)}catch(o){console.error(o),i?alert(`${e}
|
||||||
|
${o}`):$$event("message",[e])}}}export{c as default};
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
var C=t=>{throw TypeError(t)};var S=(t,s,e)=>s.has(t)||C("Cannot "+e);var h=(t,s,e)=>(S(t,s,"read from private field"),e?e.call(t):s.get(t)),T=(t,s,e)=>s.has(t)?C("Cannot add the same private member more than once"):s instanceof WeakSet?s.add(t):s.set(t,e),c=(t,s,e,i)=>(S(t,s,"write to private field"),i?i.call(t,e):s.set(t,e),e);var l,u;class H extends ui.view.CyberTheme.CyberSummaryUI{constructor(){super();T(this,l);T(this,u);this.listSelectedTalents.renderHandler=Laya.Handler.create(this,this.renderTalent,null,!1),this.btnAgain.on(Laya.Event.CLICK,this,this.onAgain)}onAgain(){core.talentExtend(h(this,l)),core.times++,$ui.switchView(UI.pages.MAIN)}init({talents:e,enableExtend:i}){const{summary:n,lastExtendTalent:o}=core;c(this,u,i);const a=$ui.common.filter,r=$ui.common.grade,b=n[core.PropertyTypes.HAGE];this.labAge.text=""+b.value,this.labAgeJudge.text=b.judge,this.labAgeJudge.color=r[b.grade];const g=n[core.PropertyTypes.SUM];this.labTotal.text=""+g.value,this.labTotalJudge.text=g.judge,this.labTotalJudge.color=r[g.grade];const d=n[core.PropertyTypes.HCHR];this.labCharm.text=""+d.value,this.prgCharm.value=d.progress,this.labCharmJudge.text=d.judge,this.labCharmJudge.color=r[d.grade],this.boxCharmGrade.colorFilter=a[d.grade];const y=n[core.PropertyTypes.HINT];this.labIntelligence.text=""+y.value,this.prgIntelligence.value=y.progress,this.labIntelligenceJudge.text=y.judge,this.labIntelligenceJudge.color=r[y.grade],this.boxIntelligenceGrade.colorFilter=a[y.grade];const p=n[core.PropertyTypes.HSTR];this.labStrength.text=""+p.value,this.prgStrength.value=p.progress,this.labStrengthJudge.text=p.judge,this.labStrengthJudge.color=r[p.grade],this.boxStrengthGrade.colorFilter=a[p.grade];const v=n[core.PropertyTypes.HMNY];this.labMoney.text=""+v.value,this.prgMoney.value=v.progress,this.labMoneyJudge.text=v.judge,this.labMoneyJudge.color=r[v.grade],this.boxMoneyGrade.colorFilter=a[v.grade];const m=n[core.PropertyTypes.HSPR];this.labSpirit.text=""+m.value,this.prgSpirit.value=m.progress,this.labSpiritJudge.text=m.judge,this.labSpiritJudge.color=r[m.grade],this.boxSpiritGrade.colorFilter=a[m.grade],e.sort(({id:f,grade:x},{id:J,grade:I})=>f==o?-1:J==o?1:I-x),h(this,u)?c(this,l,e[0].id):c(this,l,o),this.listSelectedTalents.array=e}renderTalent(e){const i=e.dataSource,n=e.getChildByName("labTitle"),o=e.getChildByName("grade1"),a=e.getChildByName("grade2"),r=e.getChildByName("grade3"),b=e.getChildByName("labDescription"),g=e.getChildByName("selected"),d=e.getChildByName("unselected");switch(n.text=i.name,b.text=i.description,i.grade){case 1:o.visible=!0,a.visible=!1,r.visible=!1;break;case 2:o.visible=!1,a.visible=!0,r.visible=!1;break;case 3:o.visible=!1,a.visible=!1,r.visible=!0;break;default:o.visible=!1,a.visible=!1,r.visible=!1;break}g.visible=i.id==h(this,l),d.visible=!g.visible,e.off(Laya.Event.CLICK,this,this.onSelectTalent),e.on(Laya.Event.CLICK,this,this.onSelectTalent,[i.id])}onSelectTalent(e){if(!h(this,u))return $$event("message",["M_DisableExtendTalent"]);e==h(this,l)?c(this,l,null):c(this,l,e),this.listSelectedTalents.refresh()}}l=new WeakMap,u=new WeakMap;export{H as default};
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
var p=t=>{throw TypeError(t)};var m=(t,r,e)=>r.has(t)||p("Cannot "+e);var l=(t,r,e)=>(m(t,r,"read from private field"),e?e.call(t):r.get(t)),u=(t,r,e)=>r.has(t)?p("Cannot add the same private member more than once"):r instanceof WeakSet?r.add(t):r.set(t,e),i=(t,r,e,a)=>(m(t,r,"write to private field"),a?a.call(t,e):r.set(t,e),e);var n,o;class T extends ui.view.DefaultTheme.SummaryUI{constructor(){super();u(this,n);u(this,o);this.listSummary.renderHandler=Laya.Handler.create(this,this.renderSummary,null,!1),this.listSelectedTalents.renderHandler=Laya.Handler.create(this,this.renderTalent,null,!1),this.btnAgain.on(Laya.Event.CLICK,this,this.onAgain)}onAgain(){core.talentExtend(l(this,n)),core.times++,$ui.switchView(UI.pages.MAIN)}init({talents:e,enableExtend:a}){const{summary:s,lastExtendTalent:c}=core;i(this,o,a),this.listSummary.array=[[core.PropertyTypes.HCHR,$lang.UI_Property_Charm],[core.PropertyTypes.HINT,$lang.UI_Property_Intelligence],[core.PropertyTypes.HSTR,$lang.UI_Property_Strength],[core.PropertyTypes.HMNY,$lang.UI_Property_Money],[core.PropertyTypes.HSPR,$lang.UI_Property_Spirit],[core.PropertyTypes.HAGE,$lang.UI_Final_Age],[core.PropertyTypes.SUM,$lang.UI_Total_Judge]].map(([y,h])=>{const d=s[y];return{label:`${h}${$lang.UI_Colon} ${d.value} ${$lang[d.judge]}`,grade:d.grade}}),e.sort(({id:y,grade:h},{id:d,grade:g})=>y==c?-1:d==c?1:g-h),l(this,o)?i(this,n,e[0].id):i(this,n,c),this.listSelectedTalents.array=e}renderSummary(e){const{label:a,grade:s}=e.dataSource;e.label=a,$_.deepMapSet(e,$ui.common.summary[s])}renderTalent(e){const a=e.dataSource;e.label=$_.format($lang.F_TalentSelection,a);const s=$ui.common.card[a.grade];$_.deepMapSet(e,a.id==l(this,n)?s.selected:s.normal),e.getChildByName("blank").pause=a.id!=l(this,n),e.off(Laya.Event.CLICK,this,this.onSelectTalent),e.on(Laya.Event.CLICK,this,this.onSelectTalent,[a.id])}onSelectTalent(e){if(!l(this,o))return $$event("message",["M_DisableExtendTalent"]);e==l(this,n)?i(this,n,null):i(this,n,e),this.listSelectedTalents.refresh()}}n=new WeakMap,o=new WeakMap;export{T as default};
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
var d=a=>{throw TypeError(a)};var T=(a,s,e)=>s.has(a)||d("Cannot "+e);var l=(a,s,e)=>(T(a,s,"read from private field"),e?e.call(a):s.get(a)),u=(a,s,e)=>s.has(a)?d("Cannot add the same private member more than once"):s instanceof WeakSet?s.add(a):s.set(a,e);var t;class p extends ui.view.DefaultTheme.TalentUI{constructor(){super();u(this,t,new Set);this.btnDrawCard.on(Laya.Event.CLICK,this,this.onClickDrawCard),this.btnNext.on(Laya.Event.CLICK,this,this.onClickNext),this.listTalents.renderHandler=Laya.Handler.create(this,this.renderTalent,null,!1),this.listTalents.scrollBar.elasticDistance=150}init(){this.pageDrawCard.visible=!0,this.pageResult.visible=!1,this.btnNext.label="UI_Talent_Select_Uncomplete",l(this,t).clear()}close(){}onClickDrawCard(){this.pageDrawCard.visible=!1,this.pageResult.visible=!0,this.listTalents.array=core.talentRandom()}onClickNext(){if(l(this,t).size<core.talentSelectLimit)return $$event("message",["F_TalentSelectNotComplect",core.talentSelectLimit]);const e=[...l(this,t)].map(i=>this.listTalents.array[i]);$ui.switchView(UI.pages.PROPERTY,{talents:e,enableExtend:!0})}renderTalent(e,i){const c=e.dataSource,m=e.getChildByName("blank");e.label=$_.format($lang.F_TalentSelection,c);const h=$ui.common.card[c.grade],o=()=>{const n=l(this,t).has(i);m.pause=!n,$_.deepMapSet(e,n?h.selected:h.normal)};o(),e.offAll(Laya.Event.CLICK),e.on(Laya.Event.CLICK,this,()=>{if(l(this,t).has(i))l(this,t).delete(i);else{if(l(this,t).size>=core.talentSelectLimit)return $$event("message",["F_TalentSelectLimit",core.talentSelectLimit]);const n=core.exclude([...l(this,t)].map(r=>this.listTalents.array[r].id),this.listTalents.array[i].id);if(n!=null){for(const{name:r,id:C}of this.listTalents.array)if(n==C)return $$event("message",["F_TalentConflict",r]);return}l(this,t).add(i)}this.btnNext.label=l(this,t).size===core.talentSelectLimit?"UI_Next":"UI_Talent_Select_Uncomplete",o()})}}t=new WeakMap;export{p as default};
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
var u=s=>{throw TypeError(s)};var p=(s,l,e)=>l.has(s)||u("Cannot "+e);var i=(s,l,e)=>(p(s,l,"read from private field"),e?e.call(s):l.get(s)),f=(s,l,e)=>l.has(s)?u("Cannot add the same private member more than once"):l instanceof WeakSet?l.add(s):l.set(s,e);var t;class N extends ui.view.CyberTheme.CyberTalentUI{constructor(){super();f(this,t,new Set);this.btnDrawCard.on(Laya.Event.CLICK,this,this.onClickDrawCard),this.btnNext.on(Laya.Event.CLICK,this,this.onClickNext),this.listTalents.renderHandler=Laya.Handler.create(this,this.renderTalent,null,!1),this.listTalents.scrollBar.elasticDistance=150,this.on(Laya.Event.RESIZE,this,()=>{var a,c,h;const e=(h=(c=(a=this.listTalents)==null?void 0:a._itemRender)==null?void 0:c.props)==null?void 0:h.width;if(e){const n=Math.max(Math.floor((this.width-40)/e),1);this.listTalents.width=n*e+(n-1)*(this.listTalents.spaceY||0)}})}static load(){return["images/background/background_2@3x.png"]}init(){this.pageDrawCard.visible=!0,this.pageResult.visible=!1,this.btnNext.label="UI_Talent_Select_Uncomplete",i(this,t).clear()}close(){}onClickDrawCard(){this.pageDrawCard.visible=!1,this.pageResult.visible=!0,this.listTalents.array=core.talentRandom()}onClickNext(){if(i(this,t).size<core.talentSelectLimit)return $$event("message",["F_TalentSelectNotComplect",core.talentSelectLimit]);const e=[...i(this,t)].map(a=>this.listTalents.array[a]);$ui.switchView(UI.pages.PROPERTY,{talents:e,enableExtend:!0})}renderTalent(e,a){const c=e.dataSource,h=e.getChildByName("hboxTitle"),n=h.getChildByName("labTitle"),r=h.getChildByName("grades"),d=r.getChildByName("grade1"),o=r.getChildByName("grade2"),b=r.getChildByName("grade3"),T=e.getChildByName("labDescription"),C=e.getChildByName("unselected"),g=e.getChildByName("selected");switch(c.grade){case 1:r.x=0,n.x=1,d.visible=!0,o.visible=!1,b.visible=!1;break;case 2:r.x=0,n.x=1,d.visible=!1,o.visible=!0,b.visible=!1;break;case 3:r.x=0,n.x=1,d.visible=!1,o.visible=!1,b.visible=!0;break;default:r.x=1,n.x=0,d.visible=!1,o.visible=!1,b.visible=!1;break}n.text=c.name,n.event(Laya.Event.RESIZE),T.text=c.description,C.visible=!(g.visible=i(this,t).has(a)),e.offAll(Laya.Event.CLICK),e.on(Laya.Event.CLICK,this,()=>{if(i(this,t).has(a))i(this,t).delete(a);else{if(i(this,t).size>=core.talentSelectLimit)return $$event("message",["F_TalentSelectLimit",core.talentSelectLimit]);const m=core.exclude([...i(this,t)].map(v=>this.listTalents.array[v].id),this.listTalents.array[a].id);if(m!=null){for(const{name:v,id:y}of this.listTalents.array)if(m==y)return $$event("message",["F_TalentConflict",v]);return}i(this,t).add(a)}this.btnNext.label=i(this,t).size===core.talentSelectLimit?"UI_Next":"UI_Talent_Select_Uncomplete",C.visible=!(g.visible=i(this,t).has(a))})}}t=new WeakMap;export{N as default};
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
var S=o=>{throw TypeError(o)};var m=(o,e,t)=>e.has(o)||S("Cannot "+t);var n=(o,e,t)=>(m(o,e,"read from private field"),t?t.call(o):e.get(o)),u=(o,e,t)=>e.has(o)?S("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(o):e.set(o,t),d=(o,e,t,s)=>(m(o,e,"write to private field"),s?s.call(o,t):e.set(o,t),t),C=(o,e,t)=>(m(o,e,"access private method"),t);var h,l,y,r;const i=class i extends ui.view.DefaultTheme.ThanksUI{constructor(){super();u(this,l);u(this,r);this.btnBack.on(Laya.Event.CLICK,this,()=>$ui.switchView(UI.pages.MAIN)),this.listSupports.renderHandler=Laya.Handler.create(this,this.renderSupport,null,!1),this.panelTopSupports.vScrollBar.elasticDistance=150,this.listSupports.scrollBar.elasticDistance=150,this.btnAFD.on(Laya.Event.CLICK,this,goto,["sponsor_afd"]),this.btnDDF.on(Laya.Event.CLICK,this,goto,["sponsor_ddf"])}init(){const t=[];d(this,r,[]),core.specialThanks.sort(()=>.5-Math.random()).forEach(({group:s,name:a,comment:p,color:c})=>s==2?t.push({name:a,color:c}):this.renderTopSupport(a,p,c)),this.listSupports.array=t}renderTopSupport(t,s,a){const p=C(this,l,y).call(this);p.name.text=t,p.comment.text=s,p.name.color=a||"#000000",this.vboxTopSupports.addChild(p),n(this,r).push(p),n(this,r).forEach((c,x)=>c.y=x)}renderSupport(t){const{name:s,color:a}=t.dataSource;t.text=s,t.color=a||$ui.common.defaultFontColor}close(){n(this,r).forEach(t=>{t.removeSelf(),t.destroy()}),d(this,r,null)}};h=new WeakMap,l=new WeakSet,y=function(){var s;const t=n(s=i,h).call(s,"boxTopSupport");return t.name=t.getChildByName("name"),t.comment=t.getChildByName("comment"),$_.deepMapSet(t,$ui.common.topSupportItem),t},r=new WeakMap,u(i,h,Laya.plugin.extractComponents(i.uiView,["boxTopSupport"]));let f=i;export{f as default};
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
class a extends ui.view.ThemesUI{constructor(){super(),this.btnClose.on(Laya.Event.CLICK,this,()=>this.close()),this.btnOK.on(Laya.Event.CLICK,this,async()=>{const t=this.selected;if(!t==$ui.theme)return this.close();$ui.theme=t,await this.close(),$ui.switchView(UI.pages.MAIN)})}static load(){return["images/atlas/images/radio.atlas"]}init(){this.selected=localStorage.getItem("theme")}get selected(){switch(this.radioTheme.selectedIndex){case 0:return"cyber";case 1:return"dark";case 2:return"light";default:return"default"}}set selected(t){let e;switch(t){case"cyber":e=0;break;case"dark":e=1;break;case"light":e=2;break;default:e=-1;break}this.radioTheme.selectedIndex=e}}export{a as default};
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
var U=s=>{throw TypeError(s)};var g=(s,i,t)=>i.has(s)||U("Cannot "+t);var h=(s,i,t)=>(g(s,i,"read from private field"),t?t.call(s):i.get(s)),l=(s,i,t)=>i.has(s)?U("Cannot add the same private member more than once"):i instanceof WeakSet?i.add(s):i.set(s,t),o=(s,i,t,e)=>(g(s,i,"write to private field"),e?e.call(s,t):i.set(s,t),t),f=(s,i,t)=>(g(s,i,"access private method"),t);var m,p,T,E,L,b,c,S,x;const v=class v extends ui.view.CyberTheme.CyberTrajectoryUI{constructor(){super();l(this,E);l(this,m);l(this,p);l(this,b);l(this,c);l(this,S);l(this,x);let t=[0,0];this.panelTrajectory.on(Laya.Event.MOUSE_DOWN,this,n=>t=[n.stageX,n.stageY]),this.panelTrajectory.on(Laya.Event.MOUSE_UP,this,n=>{const r=n.stageX-t[0],j=n.stageY-t[1];Math.sqrt(Math.abs(r)+Math.abs(j))>10||this.onNext()}),this.btnSummary.on(Laya.Event.CLICK,this,this.onSummary),this.panelTrajectory.vScrollBar.elasticDistance=150;let e=null,a=null;const y=n=>{let r=this.panelTrajectory.vScrollBar.value+n;r<0&&(r=0),r>this.panelTrajectory.vScrollBar.max&&(r=this.panelTrajectory.vScrollBar.max),this.panelTrajectory.scrollTo(0,r)},u=(n,r)=>{n.off(Laya.Event.CLICK,this,y),n.on(Laya.Event.CLICK,this,y,[100*r]),a=setTimeout(()=>{n.off(Laya.Event.CLICK,this,y),e=setInterval(()=>y(10*r),10)},100)},d=()=>{e&&(clearInterval(e),e=null),a&&(clearTimeout(a),a=null)};this.btnUp.on(Laya.Event.MOUSE_DOWN,this,u,[this.btnUp,-1]),this.btnDown.on(Laya.Event.MOUSE_DOWN,this,u,[this.btnDown,1]),this.btnUp.on(Laya.Event.MOUSE_UP,this,d),this.btnUp.on(Laya.Event.MOUSE_OUT,this,d),this.btnDown.on(Laya.Event.MOUSE_UP,this,d),this.btnDown.on(Laya.Event.MOUSE_OUT,this,d),this.scbSpeed.on(Laya.Event.CHANGE,this,()=>this.speed=this.scbSpeed.value),this.scbSpeed.on(Laya.Event.MOUSE_UP,this,()=>this.onNext())}init({propertyAllocate:t,talents:e,enableExtend:a}){o(this,x,a),this.boxParticle.visible=!1,this.boxSpeed.visible=!0,this.btnSummary.visible=!1,o(this,c,[]),o(this,b,!1),o(this,S,e),core.start(t),this.updateProperty(),this.onNext()}close(){this.scbSpeed.value=0,this.speed=0,h(this,c).forEach(t=>{t.removeSelf(),t.destroy()}),o(this,c,null)}updateProperty(){const t=core.PropertyTypes,e=core.propertys;this.labCharm.text=e[t.CHR],this.labIntelligence.text=e[t.INT],this.labStrength.text=e[t.STR],this.labMoney.text=e[t.MNY],this.labSpirit.text=e[t.SPR]}onNext(){if(h(this,b))return;const{age:t,content:e,isEnd:a}=core.next();o(this,b,a),a&&(this.boxSpeed.visible=!1,this.btnSummary.visible=!0,Laya.timer.frameOnce(1,this,()=>{this.panelTrajectory.scrollTo(0,this.panelTrajectory.contentHeight)})),this.panelTrajectory.scrollTo(0,this.panelTrajectory.contentHeight),this.renderTrajectory(t,e),t>=100&&(this.boxParticle.visible=!0),this.updateProperty()}renderTrajectory(t,e){const a=f(this,E,L).call(this);a.labAge.text=""+t,a.labContent.text=e.map(({type:y,description:u,grade:d,name:n,postEvent:r})=>{switch(y){case"TLT":return`天赋【${n}】发动:${u}`;case"EVT":return u+(r?`
|
||||||
|
${r}`:"")}}).join(`
|
||||||
|
`),$_.deepMapSet(a.boxGrade,$ui.common.gradeBlk[e[e.length-1].grade||0]),this.vboxTrajectory.addChild(a),h(this,c).push(a),a.y=this.vboxTrajectory.height}onSummary(){const t=h(this,S);$ui.switchView(UI.pages.SUMMARY,{talents:t,enableExtend:h(this,x)})}get speed(){return h(this,m)}set speed(t){o(this,m,t),this.prgSpeed.value=t/this.scbSpeed.max,clearInterval(h(this,p)),o(this,p,null),t&&o(this,p,setInterval(()=>this.onNext(),3e3*(1-this.prgSpeed.value)+300))}};m=new WeakMap,p=new WeakMap,T=new WeakMap,E=new WeakSet,L=function(){var e;const t=h(e=v,T).call(e,"boxTrajectoryItem");return t.labContent=t.getChildByName("labContent"),t.labAge=t.getChildByName("hboxAge").getChildByName("labAge"),t.boxGrade=t.getChildByName("boxGrade"),t},b=new WeakMap,c=new WeakMap,S=new WeakMap,x=new WeakMap,l(v,T,Laya.plugin.extractComponents(v.uiView,["boxTrajectoryItem"]));let C=v;export{C as default};
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
var v=s=>{throw TypeError(s)};var x=(s,i,t)=>i.has(s)||v("Cannot "+t);var o=(s,i,t)=>(x(s,i,"read from private field"),t?t.call(s):i.get(s)),n=(s,i,t)=>i.has(s)?v("Cannot add the same private member more than once"):i instanceof WeakSet?i.add(s):i.set(s,t),r=(s,i,t,e)=>(x(s,i,"write to private field"),e?e.call(s,t):i.set(s,t),t),C=(s,i,t)=>(x(s,i,"access private method"),t);var y,c,u,m,j,p,l,b,g;const d=class d extends ui.view.DefaultTheme.TrajectoryUI{constructor(){super();n(this,m);n(this,y);n(this,c);n(this,p);n(this,l);n(this,b);n(this,g);let t=[0,0];this.panelTrajectory.on(Laya.Event.MOUSE_DOWN,this,e=>t=[e.stageX,e.stageY]),this.panelTrajectory.on(Laya.Event.MOUSE_UP,this,e=>{const a=e.stageX-t[0],h=e.stageY-t[1];Math.sqrt(Math.abs(a)+Math.abs(h))>10||this.onNext()}),this.btnSummary.on(Laya.Event.CLICK,this,this.onSummary),this.panelTrajectory.vScrollBar.elasticDistance=150,this.scbSpeed.on(Laya.Event.CHANGE,this,()=>this.speed=this.scbSpeed.value),this.scbSpeed.on(Laya.Event.MOUSE_UP,this,()=>this.onNext())}static load(){return["images/atlas/images/progress.atlas","images/atlas/images/slider.atlas"]}init({propertyAllocate:t,talents:e,enableExtend:a}){r(this,g,a),this.boxParticle.visible=!1,this.boxSpeed.visible=!0,this.btnSummary.visible=!1,r(this,l,[]),r(this,p,!1),r(this,b,e),core.start(t),this.updateProperty(),this.onNext()}close(){this.scbSpeed.value=0,this.speed=0,o(this,l).forEach(t=>{t.removeSelf(),t.destroy()}),r(this,l,null)}updateProperty(){const t=core.PropertyTypes,e=core.propertys;this.labCharm.text=e[t.CHR],this.labIntelligence.text=e[t.INT],this.labStrength.text=e[t.STR],this.labMoney.text=e[t.MNY],this.labSpirit.text=e[t.SPR]}onNext(){if(o(this,p))return;const{age:t,content:e,isEnd:a}=core.next();r(this,p,a),a&&(this.boxSpeed.visible=!1,this.btnSummary.visible=!0,Laya.timer.frameOnce(1,this,()=>{this.panelTrajectory.scrollTo(0,this.panelTrajectory.contentHeight)})),this.panelTrajectory.scrollTo(0,this.panelTrajectory.contentHeight),this.renderTrajectory(t,e),t>=100&&(this.boxParticle.visible=!0),this.updateProperty()}renderTrajectory(t,e){const a=C(this,m,j).call(this);a.labAge.text=""+t,a.labContent.text=e.map(({type:h,description:S,grade:N,name:E,postEvent:T})=>{switch(h){case"TLT":return`天赋【${E}】发动:${S}`;case"EVT":return S+(T?`
|
||||||
|
${T}`:"")}}).join(`
|
||||||
|
`),a.grade(e[e.length-1].grade),this.vboxTrajectory.addChild(a),o(this,l).push(a),a.y=this.vboxTrajectory.height}onSummary(){const t=o(this,b);$ui.switchView(UI.pages.SUMMARY,{talents:t,enableExtend:o(this,g)})}get speed(){return o(this,y)}set speed(t){r(this,y,t),this.prgSpeed.value=t/this.scbSpeed.max,clearInterval(o(this,c)),r(this,c,null),t&&r(this,c,setInterval(()=>this.onNext(),3e3*(1-this.prgSpeed.value)+300))}};y=new WeakMap,c=new WeakMap,u=new WeakMap,m=new WeakSet,j=function(){var a;const t=o(a=d,u).call(a,"boxTrajectoryItem");t.labContent=t.getChildByName("labContent"),t.labAge=t.getChildByName("hboxAge").getChildByName("labAge");const e=$ui.common.trajectoryItem;return $_.deepMapSet(t,e.box),t.grade=h=>{$_.deepMapSet(t,e.grade[h||0])},t.getChildByName("hboxAge")._childs.forEach(h=>h.color=e.ageColor),t.labContent.color=e.contentColor,t},p=new WeakMap,l=new WeakMap,b=new WeakMap,g=new WeakMap,n(d,u,Laya.plugin.extractComponents(d.uiView,["boxTrajectoryItem"]));let f=d;export{f as default};
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
const e={UI_Next:"下一步",UI_Back:"返回",UI_Skip:"跳过",UI_Done:"完成",UI_Cancel:"取消",UI_Confirm:"确认",UI_Retry:"重试",UI_Yes:"是",UI_No:"否",UI_OK:"确定",UI_Close:"关闭",UI_Open:"打开",UI_Search:"搜索",UI_Loading:"加载中...",UI_Error:"错误",UI_BackupBtn:"上面没有效果就试试这个吧",UI_Colon:":",UI_Times:"次",UI_Count:"个",UI_Property_Charm:"颜值",UI_Property_Intelligence:"智力",UI_Property_Strength:"体质",UI_Property_Money:"家境",UI_Property_Spirit:"快乐",UI_Title_Remake:"人生重开模拟器",UI_Title_Subsequent:"这垃圾人生一秒也不想待了",UI_Remake:"↻立即重开",UI_Thanks:"感谢",UI_Achievement:"成就",UI_Cyber_Theme_Art_Design:"UI 设计 by 晰晰",UI_Banner:`作者的新作《纸上谈亲》已上线小程序
|
||||||
|
微信/抖音搜索“纸上谈亲”即可游玩~`,UI_Title_Talent:"天赋抽卡",UI_Talent_Draw:"10连抽!",UI_Talent_Select_Uncomplete:"请选取 3 个天赋",UI_Title_Property:"调整初始属性",UI_Left_Property_Point:"剩余属性点",UI_Selected_Talent:"已选天赋",UI_Random_Allocate:"随机分配",UI_Make_New_Life:"开始新人生",UI_Manual:"手动",UI_Auto:"自动",UI_Goto_Summary:"人生总结",UI_Title_Summary:"人生总结",UI_Talent_Extend:"天赋:你可以选择一个,下辈子还能抽到",UI_Remake_Again:"再次重开",UI_Final_Age:"享年",UI_Total_Judge:"总评",UI_Achievement_Count:"获得成就",UI_Remake_Times:"重开次数",UI_Event_Collection_Rate:"事件收集率",UI_Talent_Collection_Rate:"天赋收集率",UI_Statistics:"统计",UI_Rank:"排行榜",UI_Achievement_Achieve:"获得成就",UI_Judge_Level_0:"地狱",UI_Judge_Level_1:"折磨",UI_Judge_Level_2:"不佳",UI_Judge_Level_3:"普通",UI_Judge_Level_4:"优秀",UI_Judge_Level_5:"罕见",UI_Judge_Level_6:"逆天",UI_Judge_Level_7:"传说",UI_Spirit_Judge_Level_0:"地狱",UI_Spirit_Judge_Level_1:"折磨",UI_Spirit_Judge_Level_2:"不幸",UI_Spirit_Judge_Level_3:"普通",UI_Spirit_Judge_Level_4:"幸福",UI_Spirit_Judge_Level_5:"极乐",UI_Spirit_Judge_Level_6:"天命",UI_AGE_Judge_Level_0:"胎死腹中",UI_AGE_Judge_Level_1:"早夭",UI_AGE_Judge_Level_2:"少年",UI_AGE_Judge_Level_3:"盛年",UI_AGE_Judge_Level_4:"中年",UI_AGE_Judge_Level_5:"花甲",UI_AGE_Judge_Level_6:"古稀",UI_AGE_Judge_Level_7:"杖朝",UI_AGE_Judge_Level_8:"南山",UI_AGE_Judge_Level_9:"不老",UI_AGE_Judge_Level_10:"修仙",UI_AGE_Judge_Level_11:"仙寿",UI_Intelligence_Judge_Level_7:"识海",UI_Intelligence_Judge_Level_8:"元神",UI_Intelligence_Judge_Level_9:"仙魂",UI_Strength_Judge_Level_7:"凝气",UI_Strength_Judge_Level_8:"筑基",UI_Strength_Judge_Level_9:"金丹",UI_Strength_Judge_Level_10:"元婴",UI_Strength_Judge_Level_11:"仙体",UI_Remake_Times_Judge_Level_0:"抽到紫色概率不变",UI_Remake_Times_Judge_Level_1:"抽到紫色概率翻倍",UI_Remake_Times_Judge_Level_2:"抽到紫色概率三倍",UI_Remake_Times_Judge_Level_3:"抽到紫色概率四倍",UI_Remake_Times_Judge_Level_4:"抽到紫色概率五倍",UI_Remake_Times_Judge_Level_5:"抽到紫色概率六倍",UI_Achievement_Count_Judge_Level_0:"抽到橙色概率不变",UI_Achievement_Count_Judge_Level_1:"抽到橙色概率翻倍",UI_Achievement_Count_Judge_Level_2:"抽到橙色概率三倍",UI_Achievement_Count_Judge_Level_3:"抽到橙色概率四倍",UI_Achievement_Count_Judge_Level_4:"抽到橙色概率五倍",UI_Achievement_Count_Judge_Level_5:"抽到橙色概率六倍",UI_Support_Programmer:"打赏程序(顿顿饭)",UI_Support_Designer:"打赏策划(爱发电)",UI_Save:"存档",UI_Load:"读档",UI_Read:"复制",UI_Write:"粘贴",UI_LoadSuccess:"读档成功!",UI_LoadFailed:"读档失败!",UI_CopySuccess:"成功复制存档到剪贴板",UI_CopyFailed:"复制存档到剪贴板失败,请手动复制存档内容",UI_PasteSuccessDecodeSuccess:"读档成功!",UI_PasteSuccessDecodeFailed:"粘贴剪贴板存档内容成功,但剪贴板内容读档失败",UI_PasteFailedDecodeSuccess:"粘贴剪贴板存档内容失败,使用输入的内容读档成功",UI_PasteFailedDecodeFailed:"粘贴剪贴板存档内容失败,使用输入的内容读档失败",UI_Title_Celebrity:"你的前世是...",UI_CustomMode:"经典模式",UI_CustomModeDescription:`10连抽天赋
|
||||||
|
自由分配属性`,UI_CelebrityMode:"名人模式",UI_CelebrityModeDescription:`前世是古代名人
|
||||||
|
重开到了现代`,UI_AllNot:"↻都不是",UI_UniqueWaTaShi:"独一无二的我",UI_UniqueWaTaShiContent:`
|
||||||
|
6000万玩家中独一无二的角色卡
|
||||||
|
所有属性 所有天赋 随机生成
|
||||||
|
每人只能生成一次`,UI_GenerateNow:"立即生成",M_NoRank:"别卷了,没有排行榜",M_PleaseSelectOne:"请选择一个名人",M_UnGenerate:"独一无二的我还没有生成",M_DisableExtendTalent:"名人模式不能继承天赋",F_RemakeTimes:"已重开{0}次",F_AchievementCount:"成就达成{0}个",F_TalentSelection:"{name}({description})",F_TalentConflict:"与已选的「{0}」天赋冲突",F_TalentSelectLimit:"只能选 {0} 个天赋",F_TalentSelectNotComplect:"要选满{0}个天赋",F_PropertyPointLeft:"你还有 {0} 属性点没有分配完",F_TalentReplace:"天赋替换【{source.name}】->【{target.name}】",F_PropertyStr:"颜值{CHR} 智力{INT} 体质{STR} 家境{MNY}"};export{e as default};
|
||||||
@@ -0,0 +1,180 @@
|
|||||||
|
颜值: <input class="prop" name="CHR" style="width:300px;" value="5" >(CHR)<br/>
|
||||||
|
智力: <input class="prop" name="INT" style="width:300px;" value="5" >(INT)<br/>
|
||||||
|
体质: <input class="prop" name="STR" style="width:300px;" value="5" >(STR)<br/>
|
||||||
|
家境: <input class="prop" name="MNY" style="width:300px;" value="5" >(MNY)<br/>
|
||||||
|
快乐: <input class="prop" name="SPR" style="width:300px;" value="5" >(SPR)<br/>
|
||||||
|
生命: <input class="prop" name="LIF" style="width:300px;" value="5" >(LIF)<br/>
|
||||||
|
天赋: <input class="prop" name="TLT" style="width:300px;" value="[5]" >(TLT)<br/>
|
||||||
|
事件: <input class="prop" name="EVT" style="width:300px;" value="[5]" >(EVT)<br/>
|
||||||
|
<br/><br/>
|
||||||
|
表达式:<input id="conditions" style="width:500px;"><br/><br/>
|
||||||
|
结果:<span id="result" style="color:red;"></span><br/><br/>
|
||||||
|
<button id="submit"> 测 试 </button><br/>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
const DEFAULT_PROP = {
|
||||||
|
CHR: 5, // 颜值 charm CHR
|
||||||
|
INT: 5, // 智力 intelligence INT
|
||||||
|
STR: 5, // 体质 strength STR
|
||||||
|
MNY: 5, // 家境 money MNY
|
||||||
|
SPR: 5, // 快乐 spirit SPR
|
||||||
|
LIF: 5, // 生命 life LIF
|
||||||
|
TLT: [5], // 天赋 talent TLT
|
||||||
|
EVT: [5], // 事件 event EVT
|
||||||
|
};
|
||||||
|
document.querySelector("#submit").onclick = function() {
|
||||||
|
document.querySelectorAll('.prop').forEach(({name, value})=>DEFAULT_PROP[name] = JSON.parse(value));
|
||||||
|
conditions = document.querySelector("#conditions").value;
|
||||||
|
const result = check(conditions);
|
||||||
|
document.querySelector("#result").textContent = result;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getProp(prop) {
|
||||||
|
switch(prop) {
|
||||||
|
case 'CHR':
|
||||||
|
case 'INT':
|
||||||
|
case 'STR':
|
||||||
|
case 'MNY':
|
||||||
|
case 'SPR':
|
||||||
|
case 'LIF':
|
||||||
|
case 'TLT':
|
||||||
|
case 'EVT': return DEFAULT_PROP[prop];
|
||||||
|
default: return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function check(condition) {
|
||||||
|
const conditions = parseCondition(condition);
|
||||||
|
return checkParsedCondition(conditions);
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkParsedCondition(conditions) {
|
||||||
|
if(!Array.isArray(conditions)) return checkLogic(conditions);
|
||||||
|
if(conditions.length == 0) return true;
|
||||||
|
if(conditions.length == 1) return checkParsedCondition(conditions[0]);
|
||||||
|
|
||||||
|
let ret = checkParsedCondition(conditions[0]);
|
||||||
|
for(let i=1; i<conditions.length; i+=2) {
|
||||||
|
switch(conditions[i]) {
|
||||||
|
case '&':
|
||||||
|
if(ret) ret = checkParsedCondition(conditions[i+1]);
|
||||||
|
break;
|
||||||
|
case '|':
|
||||||
|
if(ret) return true;
|
||||||
|
ret = checkParsedCondition(conditions[i+1]);
|
||||||
|
break;
|
||||||
|
default: return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkLogic(condition) {
|
||||||
|
const length = condition.length;
|
||||||
|
let i = condition.search(/[><\!\?=]/);
|
||||||
|
|
||||||
|
const prop = condition.substring(0,i);
|
||||||
|
const symbol = condition.substring(i, i+=(condition[i+1]=='='?2:1));
|
||||||
|
const d = condition.substring(i, length);
|
||||||
|
|
||||||
|
const propData = getProp(prop);
|
||||||
|
const conditionData = d[0]=='['? JSON.parse(d): Number(d);
|
||||||
|
|
||||||
|
switch(symbol) {
|
||||||
|
case '>': return propData > conditionData;
|
||||||
|
case '<': return propData < conditionData;
|
||||||
|
case '>=': return propData >= conditionData;
|
||||||
|
case '<=': return propData <= conditionData;
|
||||||
|
case '=':
|
||||||
|
if(Array.isArray(propData))
|
||||||
|
return propData.includes(conditionData);
|
||||||
|
return propData == conditionData;
|
||||||
|
case '!=':
|
||||||
|
if(Array.isArray(propData))
|
||||||
|
return !propData.includes(conditionData);
|
||||||
|
return propData == conditionData;
|
||||||
|
case '?':
|
||||||
|
if(Array.isArray(propData)) {
|
||||||
|
for(const p of propData)
|
||||||
|
if(conditionData.includes(p)) return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return conditionData.includes(propData);
|
||||||
|
case '!':
|
||||||
|
if(Array.isArray(propData)) {
|
||||||
|
for(const p of propData)
|
||||||
|
if(conditionData.includes(p)) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return !conditionData.includes(propData);
|
||||||
|
|
||||||
|
default: return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function parseCondition(condition) {
|
||||||
|
const conditions = [];
|
||||||
|
const length = condition.length;
|
||||||
|
const stack = [];
|
||||||
|
stack.unshift(conditions);
|
||||||
|
let cursor = 0;
|
||||||
|
const catchString = i => {
|
||||||
|
const str = condition.substring(cursor, i).trim();
|
||||||
|
cursor = i;
|
||||||
|
if(str) stack[0].push(str);
|
||||||
|
};
|
||||||
|
|
||||||
|
for(let i=0; i<length; i++) {
|
||||||
|
switch(condition[i]) {
|
||||||
|
case ' ': continue;
|
||||||
|
|
||||||
|
case '(':
|
||||||
|
catchString(i);
|
||||||
|
cursor ++;
|
||||||
|
const sub = [];
|
||||||
|
stack[0].push(sub);
|
||||||
|
stack.unshift(sub);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ')':
|
||||||
|
catchString(i);
|
||||||
|
cursor ++;
|
||||||
|
stack.shift();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case '|':
|
||||||
|
case '&':
|
||||||
|
catchString(i);
|
||||||
|
catchString(i+1);
|
||||||
|
break;
|
||||||
|
default: continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
catchString(length);
|
||||||
|
|
||||||
|
return conditions;
|
||||||
|
}
|
||||||
|
|
||||||
|
// function debug(...conditions) {
|
||||||
|
// for(const condition of conditions)
|
||||||
|
// console.debug(check(condition), '\t', condition);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// debug(
|
||||||
|
// '(STR<2&MNY>3)|(MNY<2&CHR<2)',
|
||||||
|
// '(STR<2&MNY>3)',
|
||||||
|
// '(STR>2&MNY>3)',
|
||||||
|
// '((((STR>2&MNY>2))))',
|
||||||
|
// '((((STR>2&MNY>2)|(MNY<2&CHR<2))))',
|
||||||
|
// '((((STR>2&MNY>2)|(MNY<2&CHR<2)&(STR>2&MNY>3))))',
|
||||||
|
// '((((STR>2&MNY>2)|(MNY<2&CHR<2))&(STR>2&MNY>3)))',
|
||||||
|
// 'EVT![1,2,3]',
|
||||||
|
// 'EVT![1,2]',
|
||||||
|
// 'EVT?[1,2,3]',
|
||||||
|
// 'EVT?[1,2]',
|
||||||
|
// );
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
After Width: | Height: | Size: 6.0 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 99 KiB |
|
After Width: | Height: | Size: 84 KiB |
@@ -0,0 +1,69 @@
|
|||||||
|
D .
|
||||||
|
D fonts
|
||||||
|
R 39B4F491 方正像素12.ttf
|
||||||
|
D images
|
||||||
|
D images/accessories
|
||||||
|
P ADDDCB66 cardicon@3x.png
|
||||||
|
R 0E2F6E7F insert_coin@3x.png
|
||||||
|
R B45325FC title@3x.png
|
||||||
|
P 074FEF52 title_left@3x.png
|
||||||
|
R 97E72B92 title_neon@3x.png
|
||||||
|
P 2BA0101A title_right@3x.png
|
||||||
|
R E1602E15 titlebar@3x.png
|
||||||
|
D images/background
|
||||||
|
R 9343F3BB background_1@3x.png
|
||||||
|
R 0B49B27D background_2@3x.png
|
||||||
|
D images/border
|
||||||
|
P A2B33396 achievement@3x.png
|
||||||
|
R 45A1A604 achievement_complete@3x.png
|
||||||
|
R 6CF3EE8E border_1@3x.png
|
||||||
|
R AAEA6308 border_2@3x.png
|
||||||
|
R A57A026E card@3x.png
|
||||||
|
P C1EDDBED property@3x.png
|
||||||
|
R A8C7A5A5 talent_item@3x.png
|
||||||
|
R DCE4E73A talent_item_selected@3x.png
|
||||||
|
R 373CDF45 up@3x.png
|
||||||
|
D images/button
|
||||||
|
P 69FF5572 button_back@3x.png
|
||||||
|
R 441BFE78 button_main@3x.png
|
||||||
|
P F2B85B54 button_small@3x.png
|
||||||
|
D images/icons
|
||||||
|
P C677F3AE icon_achievement@3x.png
|
||||||
|
P 3D072134 icon_chr@3x.png
|
||||||
|
P C663FAF5 icon_discord.png
|
||||||
|
P 3FA91C13 icon_github.png
|
||||||
|
P AB934AEA icon_int@3x.png
|
||||||
|
P F1A0724B icon_mny@3x.png
|
||||||
|
P D5AADAC9 icon_rank@3x.png
|
||||||
|
P 0806E5F3 icon_save.png
|
||||||
|
P 2DB0325D icon_spr@3x.png
|
||||||
|
P 2EFA541B icon_str@3x.png
|
||||||
|
P 804842C9 icon_thanks@3x.png
|
||||||
|
P 96DD5D94 icon_themes.png
|
||||||
|
P 6ECB5FEC icon_up@3x.png
|
||||||
|
D images/progress
|
||||||
|
P E2BF0C93 progress_1@3x$bar.png
|
||||||
|
P B86E1D0F progress_1@3x.png
|
||||||
|
P E7F15BA7 progress_2$bar.png
|
||||||
|
P 641A22BF progress_2.png
|
||||||
|
P AF80A9AF progress_s$bar.png
|
||||||
|
P 41417E8D progress_s.png
|
||||||
|
D images/radio
|
||||||
|
P CCF63014 radio_cyber.png
|
||||||
|
P 040DE73C radio_dark.png
|
||||||
|
P BA975F5A radio_light.png
|
||||||
|
D images/resource
|
||||||
|
P F3659301 bottombreath.png
|
||||||
|
P 496D6FB9 circle.png
|
||||||
|
P B5087365 circleflash.png
|
||||||
|
D images/slider
|
||||||
|
P 9682C590 hslider_s$bar.png
|
||||||
|
P F6238BD4 hslider_s$down.png
|
||||||
|
P F4198287 hslider_s$up.png
|
||||||
|
P 2A785866 hslider_s.png
|
||||||
|
R 8B95E6D3 vslider_1@3x$bar.png
|
||||||
|
P 6581FBA8 vslider_1@3x$down.png
|
||||||
|
P 6581FBA8 vslider_1@3x$up.png
|
||||||
|
R C9587878 vslider_1@3x.png
|
||||||
|
D images/texture
|
||||||
|
P FD231754 texture_1.png
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{"frames":{"cardicon@3x.png":{"frame":{"h":466,"idx":0,"w":455,"x":0,"y":0},"sourceSize":{"h":466,"w":455},"spriteSourceSize":{"x":0,"y":0}},"title_left@3x.png":{"frame":{"h":27,"idx":0,"w":48,"x":456,"y":0},"sourceSize":{"h":27,"w":48},"spriteSourceSize":{"x":0,"y":0}},"title_right@3x.png":{"frame":{"h":27,"idx":0,"w":48,"x":456,"y":28},"sourceSize":{"h":27,"w":48},"spriteSourceSize":{"x":0,"y":0}}},"meta":{"image":"accessories.png","prefix":"images/accessories/"}}
|
||||||
|
After Width: | Height: | Size: 76 KiB |
@@ -0,0 +1 @@
|
|||||||
|
{"frames":{"achievement@3x.png":{"frame":{"h":412,"idx":0,"w":486,"x":0,"y":0},"sourceSize":{"h":412,"w":486},"spriteSourceSize":{"x":0,"y":0}},"property@3x.png":{"frame":{"h":84,"idx":0,"w":257,"x":0,"y":413},"sourceSize":{"h":84,"w":257},"spriteSourceSize":{"x":0,"y":0}}},"meta":{"image":"border.png","prefix":"images/border/"}}
|
||||||
|
After Width: | Height: | Size: 3.4 KiB |
@@ -0,0 +1 @@
|
|||||||
|
{"frames":{"button_back@3x.png":{"frame":{"h":114,"idx":0,"w":147,"x":0,"y":91},"sourceSize":{"h":114,"w":147},"spriteSourceSize":{"x":0,"y":0}},"button_small@3x.png":{"frame":{"h":90,"idx":0,"w":225,"x":0,"y":0},"sourceSize":{"h":90,"w":225},"spriteSourceSize":{"x":0,"y":0}}},"meta":{"image":"button.png","prefix":"images/button/"}}
|
||||||
|
After Width: | Height: | Size: 5.9 KiB |
@@ -0,0 +1 @@
|
|||||||
|
{"frames":{"icon_achievement@3x.png":{"frame":{"h":69,"idx":0,"w":65,"x":188,"y":385},"sourceSize":{"h":69,"w":65},"spriteSourceSize":{"x":0,"y":0}},"icon_chr@3x.png":{"frame":{"h":61,"idx":0,"w":57,"x":320,"y":448},"sourceSize":{"h":61,"w":57},"spriteSourceSize":{"x":0,"y":0}},"icon_discord.png":{"frame":{"h":384,"idx":0,"w":384,"x":0,"y":0},"sourceSize":{"h":384,"w":384},"spriteSourceSize":{"x":0,"y":0}},"icon_github.png":{"frame":{"h":384,"idx":0,"w":384,"x":385,"y":0},"sourceSize":{"h":384,"w":384},"spriteSourceSize":{"x":0,"y":0}},"icon_int@3x.png":{"frame":{"h":57,"idx":0,"w":54,"x":188,"y":455},"sourceSize":{"h":57,"w":54},"spriteSourceSize":{"x":0,"y":0}},"icon_mny@3x.png":{"frame":{"h":57,"idx":0,"w":54,"x":243,"y":455},"sourceSize":{"h":57,"w":54},"spriteSourceSize":{"x":0,"y":0}},"icon_rank@3x.png":{"frame":{"h":62,"idx":0,"w":72,"x":320,"y":385},"sourceSize":{"h":62,"w":72},"spriteSourceSize":{"x":0,"y":0}},"icon_save.png":{"frame":{"h":90,"idx":0,"w":90,"x":97,"y":385},"sourceSize":{"h":90,"w":90},"spriteSourceSize":{"x":0,"y":0}},"icon_spr@3x.png":{"frame":{"h":60,"idx":0,"w":57,"x":378,"y":448},"sourceSize":{"h":60,"w":57},"spriteSourceSize":{"x":0,"y":0}},"icon_str@3x.png":{"frame":{"h":57,"idx":0,"w":54,"x":393,"y":385},"sourceSize":{"h":57,"w":54},"spriteSourceSize":{"x":0,"y":0}},"icon_thanks@3x.png":{"frame":{"h":69,"idx":0,"w":65,"x":254,"y":385},"sourceSize":{"h":69,"w":65},"spriteSourceSize":{"x":0,"y":0}},"icon_themes.png":{"frame":{"h":96,"idx":0,"w":96,"x":0,"y":385},"sourceSize":{"h":96,"w":96},"spriteSourceSize":{"x":0,"y":0}},"icon_up@3x.png":{"frame":{"h":18,"idx":0,"w":33,"x":97,"y":476},"sourceSize":{"h":18,"w":33},"spriteSourceSize":{"x":0,"y":0}}},"meta":{"image":"icons.png","prefix":"images/icons/"}}
|
||||||
|
After Width: | Height: | Size: 53 KiB |
@@ -0,0 +1 @@
|
|||||||
|
{"frames":{"progress_1@3x$bar.png":{"frame":{"h":36,"idx":0,"w":203,"x":0,"y":262},"sourceSize":{"h":36,"w":203},"spriteSourceSize":{"x":0,"y":0}},"progress_1@3x.png":{"frame":{"h":36,"idx":0,"w":203,"x":204,"y":262},"sourceSize":{"h":36,"w":203},"spriteSourceSize":{"x":0,"y":0}},"progress_2$bar.png":{"frame":{"h":200,"idx":0,"w":200,"x":0,"y":0},"sourceSize":{"h":200,"w":200},"spriteSourceSize":{"x":0,"y":0}},"progress_2.png":{"frame":{"h":200,"idx":0,"w":200,"x":201,"y":0},"sourceSize":{"h":200,"w":200},"spriteSourceSize":{"x":0,"y":0}},"progress_s$bar.png":{"frame":{"h":60,"idx":0,"w":226,"x":0,"y":201},"sourceSize":{"h":60,"w":226},"spriteSourceSize":{"x":0,"y":0}},"progress_s.png":{"frame":{"h":60,"idx":0,"w":226,"x":227,"y":201},"sourceSize":{"h":60,"w":226},"spriteSourceSize":{"x":0,"y":0}}},"meta":{"image":"progress.png","prefix":"images/progress/"}}
|
||||||
|
After Width: | Height: | Size: 15 KiB |
@@ -0,0 +1 @@
|
|||||||
|
{"frames":{"radio_cyber.png":{"frame":{"h":300,"idx":0,"w":300,"x":0,"y":0},"sourceSize":{"h":300,"w":300},"spriteSourceSize":{"x":0,"y":0}},"radio_dark.png":{"frame":{"h":300,"idx":0,"w":300,"x":0,"y":301},"sourceSize":{"h":300,"w":300},"spriteSourceSize":{"x":0,"y":0}},"radio_light.png":{"frame":{"h":300,"idx":0,"w":300,"x":301,"y":0},"sourceSize":{"h":300,"w":300},"spriteSourceSize":{"x":0,"y":0}}},"meta":{"image":"radio.png","prefix":"images/radio/"}}
|
||||||
|
After Width: | Height: | Size: 83 KiB |
@@ -0,0 +1 @@
|
|||||||
|
{"frames":{"bottombreath.png":{"frame":{"h":200,"idx":0,"w":200,"x":0,"y":0},"sourceSize":{"h":200,"w":200},"spriteSourceSize":{"x":0,"y":0}},"circle.png":{"frame":{"h":200,"idx":0,"w":200,"x":0,"y":201},"sourceSize":{"h":200,"w":200},"spriteSourceSize":{"x":0,"y":0}},"circleflash.png":{"frame":{"h":200,"idx":0,"w":200,"x":201,"y":0},"sourceSize":{"h":200,"w":200},"spriteSourceSize":{"x":0,"y":0}}},"meta":{"image":"resource.png","prefix":"images/resource/"}}
|
||||||
|
After Width: | Height: | Size: 28 KiB |
@@ -0,0 +1 @@
|
|||||||
|
{"frames":{"hslider_s$bar.png":{"frame":{"h":180,"idx":0,"w":47,"x":0,"y":61},"sourceSize":{"h":180,"w":47},"spriteSourceSize":{"x":0,"y":0}},"hslider_s$down.png":{"frame":{"h":1,"idx":0,"w":1,"x":0,"y":242},"sourceSize":{"h":1,"w":1},"spriteSourceSize":{"x":0,"y":0}},"hslider_s$up.png":{"frame":{"h":1,"idx":0,"w":1,"x":0,"y":244},"sourceSize":{"h":1,"w":1},"spriteSourceSize":{"x":0,"y":0}},"hslider_s.png":{"frame":{"h":60,"idx":0,"w":226,"x":0,"y":0},"sourceSize":{"h":60,"w":226},"spriteSourceSize":{"x":0,"y":0}},"vslider_1@3x$down.png":{"frame":{"h":1,"idx":0,"w":1,"x":0,"y":246},"sourceSize":{"h":1,"w":1},"spriteSourceSize":{"x":0,"y":0}},"vslider_1@3x$up.png":{"frame":{"h":1,"idx":0,"w":1,"x":0,"y":248},"sourceSize":{"h":1,"w":1},"spriteSourceSize":{"x":0,"y":0}}},"meta":{"image":"slider.png","prefix":"images/slider/"}}
|
||||||
|
After Width: | Height: | Size: 5.0 KiB |
@@ -0,0 +1 @@
|
|||||||
|
{"frames":{"texture_1.png":{"frame":{"h":400,"idx":0,"w":400,"x":0,"y":0},"sourceSize":{"h":400,"w":400},"spriteSourceSize":{"x":0,"y":0}}},"meta":{"image":"texture.png","prefix":"images/texture/"}}
|
||||||
|
After Width: | Height: | Size: 32 KiB |
|
After Width: | Height: | Size: 426 KiB |
|
After Width: | Height: | Size: 502 KiB |
|
After Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 39 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 36 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 22 KiB |
|
After Width: | Height: | Size: 71 KiB |
|
After Width: | Height: | Size: 114 KiB |
|
After Width: | Height: | Size: 5.4 KiB |
|
After Width: | Height: | Size: 8.1 KiB |
|
After Width: | Height: | Size: 2.2 KiB |
|
After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 31 KiB |
@@ -0,0 +1,72 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||||
|
<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no">
|
||||||
|
<meta name="description" content="やり直すんだ。そして、次はうまくやる。"/>
|
||||||
|
<meta name="keywords" content="人生重开模拟器 liferestart life restart remake 人生重来"/>
|
||||||
|
<meta name="renderer" content="webkit"/>
|
||||||
|
<meta name="apple-mobile-web-app-capable" content="yes"/>
|
||||||
|
<meta name="full-screen" content="true"/>
|
||||||
|
<meta name="x5-fullscreen" content="true"/>
|
||||||
|
<meta name="360-fullscreen" content="true"/>
|
||||||
|
<meta name="theme-color" content="#157878"/>
|
||||||
|
<meta name="laya" screenorientation ="landscape"/>
|
||||||
|
<meta http-equiv="expires" content="0"/>
|
||||||
|
<meta http-equiv="Cache-Control" content="no-siteapp"/>
|
||||||
|
<font-face font-family="方正像素12" src="fonts/方正像素12.ttf"/>
|
||||||
|
<title>Life Restart</title>
|
||||||
|
<!--以下引用了常用类库,如果不使用,可以删除-->
|
||||||
|
|
||||||
|
<!--核心包,封装了显示对象渲染,事件,时间管理,时间轴动画,缓动,消息交互,socket,本地存储,鼠标触摸,声音,加载,颜色滤镜,位图字体等-->
|
||||||
|
<script type="text/javascript" src="libs/laya/laya.core.js"></script>
|
||||||
|
<!--提供了微信小游戏的适配-->
|
||||||
|
<!-- <script type="text/javascript" src="libs/laya/laya.wxmini.js"></script> -->
|
||||||
|
<!--提供了百度小游戏的适配-->
|
||||||
|
<!-- <script type="text/javascript" src="libs/laya/laya.bdmini.js"></script> -->
|
||||||
|
<!--提供了小米小游戏的适配-->
|
||||||
|
<!-- <script type="text/javascript" src="libs/laya/laya.xmmini.js"></script> -->
|
||||||
|
<!--提供了OPPO小游戏的适配-->
|
||||||
|
<!-- <script type="text/javascript" src="libs/laya/laya.quickgamemini.js"></script> -->
|
||||||
|
<!--提供了bilibili小游戏的适配-->
|
||||||
|
<!-- <script type="text/javascript" src="libs/laya/laya.bilimini.js"></script> -->
|
||||||
|
<!--提供了Alipay小游戏的适配-->
|
||||||
|
<!-- <script type="text/javascript" src="libs/laya/laya.Alipaymini.js"></script> -->
|
||||||
|
<!--提供了qq小游戏的适配-->
|
||||||
|
<!-- <script type="text/javascript" src="libs/laya/laya.qqmini.js"></script> -->
|
||||||
|
<!--提供了字节跳动小游戏的适配-->
|
||||||
|
<!-- <script type="text/javascript" src="libs/laya/laya.ttmini.js"></script> -->
|
||||||
|
<!--提供了华为快游戏的适配-->
|
||||||
|
<!-- <script type="text/javascript" src="libs/laya/laya.hwmini.js"></script> -->
|
||||||
|
<!--提供了淘宝商家应用的适配-->
|
||||||
|
<!-- <script type="text/javascript" src="libs/laya/laya.tbmini.js"></script> -->
|
||||||
|
<!--提供了淘宝小部件的适配-->
|
||||||
|
<!-- <script type="text/javascript" src="libs/laya/laya.tbplugin.js"></script> -->
|
||||||
|
<!--封装了webgl渲染管线,如果使用webgl渲染,可以在初始化时调用Laya.init(1000,800,laya.webgl.WebGL);-->
|
||||||
|
<script type="text/javascript" src="libs/laya/laya.webgl.js"></script>
|
||||||
|
<!--提供了VIVO小游戏的适配-->
|
||||||
|
<!-- <script type="text/javascript" src="libs/laya/laya.vvmini.js"></script> -->
|
||||||
|
<!--是动画模块,包含了swf动画,骨骼动画等-->
|
||||||
|
<!-- <script type="text/javascript" src="libs/laya/laya.ani.js"></script> -->
|
||||||
|
<!--包含更多webgl滤镜,比如外发光,阴影,模糊以及更多-->
|
||||||
|
<script type="text/javascript" src="libs/laya/laya.filter.js"></script>
|
||||||
|
<!--封装了html动态排版功能-->
|
||||||
|
<script type="text/javascript" src="libs/laya/laya.html.js"></script>
|
||||||
|
<!--粒子类库-->
|
||||||
|
<script type="text/javascript" src="libs/laya/laya.particle.js"></script>
|
||||||
|
<!--提供tileMap解析支持-->
|
||||||
|
<!-- <script type="text/javascript" src="libs/laya/laya.tiledmap.js"></script> -->
|
||||||
|
<!--提供了制作UI的各种组件实现-->
|
||||||
|
<script type="text/javascript" src="libs/laya/laya.ui.js"></script>
|
||||||
|
<!-- 提供LayaAir3d接口 -->
|
||||||
|
<!-- <script type="text/javascript" src="libs/laya/laya.d3.js"></script> -->
|
||||||
|
|
||||||
|
<!-- 物理引擎matter.js -->
|
||||||
|
<!--自定义的js(src文件夹下)文件自动添加到下面jsfile模块标签里面里,js的顺序可以手动修改,修改后保留修改的顺序,新增加的js会默认依次追加到标签里-->
|
||||||
|
<!--删除标签,ide不会自动添加js文件,请谨慎操作-->
|
||||||
|
|
||||||
|
<script type="module" crossorigin src="/assets/index-B7uEeUMa.js"></script>
|
||||||
|
</head>
|
||||||
|
<body style="background:black"></body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,425 @@
|
|||||||
|
/**
|
||||||
|
* Matter.js 渲染器在 LayaAir 的实现。
|
||||||
|
*/
|
||||||
|
(function()
|
||||||
|
{
|
||||||
|
var LayaRender = {};
|
||||||
|
|
||||||
|
var Common = Matter.Common;
|
||||||
|
var Composite = Matter.Composite;
|
||||||
|
var Bounds = Matter.Bounds;
|
||||||
|
var Events = Matter.Events;
|
||||||
|
var Grid = Matter.Grid;
|
||||||
|
var Vector = Matter.Vector;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建新的渲染器。
|
||||||
|
* @param {object} options 所有属性都有默认值,options中的属性会覆盖默认属性。
|
||||||
|
* @return {render} 返回创建的旋绕器
|
||||||
|
*/
|
||||||
|
LayaRender.create = function(options)
|
||||||
|
{
|
||||||
|
var defaults = {
|
||||||
|
controller: LayaRender,
|
||||||
|
engine: null,
|
||||||
|
element: null,
|
||||||
|
canvas: null,
|
||||||
|
mouse: null,
|
||||||
|
frameRequestId: null,
|
||||||
|
options:
|
||||||
|
{
|
||||||
|
width: 800,
|
||||||
|
height: 600,
|
||||||
|
pixelRatio: 1,
|
||||||
|
background: '#fafafa',
|
||||||
|
wireframeBackground: '#222222',
|
||||||
|
hasBounds: !!options.bounds,
|
||||||
|
enabled: true,
|
||||||
|
wireframes: true,
|
||||||
|
showSleeping: true,
|
||||||
|
showDebug: false,
|
||||||
|
showBroadphase: false,
|
||||||
|
showBounds: false,
|
||||||
|
showVelocity: false,
|
||||||
|
showCollisions: false,
|
||||||
|
showSeparations: false,
|
||||||
|
showAxes: false,
|
||||||
|
showPositions: false,
|
||||||
|
showAngleIndicator: false,
|
||||||
|
showIds: false,
|
||||||
|
showShadows: false,
|
||||||
|
showVertexNumbers: false,
|
||||||
|
showConvexHulls: false,
|
||||||
|
showInternalEdges: false,
|
||||||
|
showMousePosition: false
|
||||||
|
}
|
||||||
|
};
|
||||||
|
var render = Common.extend(defaults, options);
|
||||||
|
render.mouse = options.mouse;
|
||||||
|
render.engine = options.engine;
|
||||||
|
// 如果用户没有指定contaienr,默认使用stage
|
||||||
|
render.container = render.container || Laya.stage;
|
||||||
|
render.bounds = render.bounds ||
|
||||||
|
{
|
||||||
|
min:
|
||||||
|
{
|
||||||
|
x: 0,
|
||||||
|
y: 0
|
||||||
|
},
|
||||||
|
max:
|
||||||
|
{
|
||||||
|
x: render.width,
|
||||||
|
y: render.height
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return render;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 运行渲染器。
|
||||||
|
* @param {render} render 渲染的目标是LayaRender.create()返回的对象
|
||||||
|
* @return {void}
|
||||||
|
*/
|
||||||
|
LayaRender.run = function(render)
|
||||||
|
{
|
||||||
|
Laya.timer.frameLoop(1, this, LayaRender.world, [render]);
|
||||||
|
Events.on(render.engine.world, 'afterRemove', LayaRender.onRemoveSprite);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 停止渲染器。
|
||||||
|
* @param {render} LayaRender.create()返回的对象
|
||||||
|
* @return {void}
|
||||||
|
*/
|
||||||
|
LayaRender.stop = function(render)
|
||||||
|
{
|
||||||
|
Laya.timer.clear(this, LayaRender.world);
|
||||||
|
Events.off(render.engine.world, 'afterRemove', LayaRender.onRemoveSprite);
|
||||||
|
}
|
||||||
|
|
||||||
|
LayaRender.onRemoveSprite = function(args)
|
||||||
|
{
|
||||||
|
var sprite = args.object.layaSprite;
|
||||||
|
if (sprite && sprite.parent)
|
||||||
|
sprite.parent.removeChild(sprite);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 渲染给定的 engine 的 Matter.World 对象。
|
||||||
|
* 这是渲染的入口,每次场景改变时都应该被调用。
|
||||||
|
* @param {render} render
|
||||||
|
* @return {void}
|
||||||
|
*/
|
||||||
|
LayaRender.world = function(render)
|
||||||
|
{
|
||||||
|
var engine = render.engine,
|
||||||
|
world = engine.world,
|
||||||
|
renderer = render.renderer,
|
||||||
|
container = render.container,
|
||||||
|
options = render.options,
|
||||||
|
bodies = Composite.allBodies(world),
|
||||||
|
allConstraints = Composite.allConstraints(world),
|
||||||
|
constraints = [],
|
||||||
|
i;
|
||||||
|
|
||||||
|
if (options.wireframes)
|
||||||
|
{
|
||||||
|
LayaRender.setBackground(render, options.wireframeBackground);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LayaRender.setBackground(render, options.background);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 处理 bounds
|
||||||
|
var boundsWidth = render.bounds.max.x - render.bounds.min.x,
|
||||||
|
boundsHeight = render.bounds.max.y - render.bounds.min.y,
|
||||||
|
boundsScaleX = boundsWidth / render.options.width,
|
||||||
|
boundsScaleY = boundsHeight / render.options.height;
|
||||||
|
|
||||||
|
if (options.hasBounds)
|
||||||
|
{
|
||||||
|
// 隐藏不在视口内的bodies
|
||||||
|
for (i = 0; i < bodies.length; i++)
|
||||||
|
{
|
||||||
|
var body = bodies[i];
|
||||||
|
body.render.sprite.visible = Bounds.overlaps(body.bounds, render.bounds);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 过滤掉不在视口内的 constraints
|
||||||
|
for (i = 0; i < allConstraints.length; i++)
|
||||||
|
{
|
||||||
|
var constraint = allConstraints[i],
|
||||||
|
bodyA = constraint.bodyA,
|
||||||
|
bodyB = constraint.bodyB,
|
||||||
|
pointAWorld = constraint.pointA,
|
||||||
|
pointBWorld = constraint.pointB;
|
||||||
|
|
||||||
|
if (bodyA) pointAWorld = Vector.add(bodyA.position, constraint.pointA);
|
||||||
|
if (bodyB) pointBWorld = Vector.add(bodyB.position, constraint.pointB);
|
||||||
|
|
||||||
|
if (!pointAWorld || !pointBWorld)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (Bounds.contains(render.bounds, pointAWorld) || Bounds.contains(render.bounds, pointBWorld))
|
||||||
|
constraints.push(constraint);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 改变视口
|
||||||
|
container.scale(1 / boundsScaleX, 1 / boundsScaleY);
|
||||||
|
container.pos(-render.bounds.min.x * (1 / boundsScaleX), -render.bounds.min.y * (1 / boundsScaleY));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
constraints = allConstraints;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < bodies.length; i++)
|
||||||
|
LayaRender.body(render, bodies[i]);
|
||||||
|
|
||||||
|
for (i = 0; i < constraints.length; i++)
|
||||||
|
LayaRender.constraint(render, constraints[i]);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置背景色或者背景图片。
|
||||||
|
* @param {render} render
|
||||||
|
* @param {string} background 16进制颜色字符串或者图片路径
|
||||||
|
*/
|
||||||
|
LayaRender.setBackground = function(render, background)
|
||||||
|
{
|
||||||
|
if (render.currentBackground !== background)
|
||||||
|
{
|
||||||
|
var isColor = background.indexOf && background.indexOf('#') !== -1;
|
||||||
|
|
||||||
|
render.container.graphics.clear();
|
||||||
|
|
||||||
|
if (isColor)
|
||||||
|
{
|
||||||
|
// 使用纯色背景
|
||||||
|
render.container.bgColor = background;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
render.container.loadImage(background);
|
||||||
|
// 使用背景图片时把背景色设置为白色
|
||||||
|
render.container.bgColor = "#FFFFFF";
|
||||||
|
}
|
||||||
|
|
||||||
|
render.currentBackground = background;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 渲染 body
|
||||||
|
* @param {render} render
|
||||||
|
* @param {body} body
|
||||||
|
* @return {void}
|
||||||
|
*/
|
||||||
|
LayaRender.body = function(render, body)
|
||||||
|
{
|
||||||
|
var engine = render.engine,
|
||||||
|
bodyRender = body.render;
|
||||||
|
|
||||||
|
if (!bodyRender.visible)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// 有纹理的body
|
||||||
|
if (bodyRender.sprite && bodyRender.sprite.texture)
|
||||||
|
{
|
||||||
|
var spriteId = 'b-' + body.id,
|
||||||
|
sprite = body.layaSprite,
|
||||||
|
container = render.container;
|
||||||
|
|
||||||
|
// 如果sprite不存在,则初始化一个
|
||||||
|
if (!sprite)
|
||||||
|
sprite = body.layaSprite = _createBodySprite(render, body);
|
||||||
|
|
||||||
|
// 如果sprite未在显示列表,则添加至显示列表
|
||||||
|
if (!container.contains(sprite))
|
||||||
|
container.addChild(sprite);
|
||||||
|
|
||||||
|
// 更新sprite位置
|
||||||
|
sprite.x = body.position.x;
|
||||||
|
sprite.y = body.position.y;
|
||||||
|
sprite.rotation = body.angle * 180 / Math.PI;
|
||||||
|
sprite.scaleX = bodyRender.sprite.xScale || 1;
|
||||||
|
sprite.scaleY = bodyRender.sprite.yScale || 1;
|
||||||
|
}
|
||||||
|
else // 没有纹理的body
|
||||||
|
{
|
||||||
|
var primitiveId = 'b-' + body.id,
|
||||||
|
sprite = body.layaSprite,
|
||||||
|
container = render.container;
|
||||||
|
|
||||||
|
// 如果sprite不存在,则初始化一个
|
||||||
|
if (!sprite)
|
||||||
|
{
|
||||||
|
sprite = body.layaSprite = _createBodyPrimitive(render, body);
|
||||||
|
sprite.initialAngle = body.angle;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 如果sprite未在显示列表,则添加至显示列表
|
||||||
|
if (!container.contains(sprite))
|
||||||
|
container.addChild(sprite);
|
||||||
|
// 更新sprite位置
|
||||||
|
sprite.x = body.position.x;
|
||||||
|
sprite.y = body.position.y;
|
||||||
|
sprite.rotation = (body.angle - sprite.initialAngle) * 180 / Math.PI;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建使用纹理的Sprite对象。
|
||||||
|
* @param {render} render
|
||||||
|
* @param {body} body
|
||||||
|
* @return {void}
|
||||||
|
*/
|
||||||
|
var _createBodySprite = function(render, body)
|
||||||
|
{
|
||||||
|
var bodyRender = body.render,
|
||||||
|
texturePath = bodyRender.sprite.texture,
|
||||||
|
sprite = new Laya.Sprite();
|
||||||
|
|
||||||
|
sprite.loadImage(texturePath);
|
||||||
|
sprite.pivotX = body.render.sprite.xOffset;
|
||||||
|
sprite.pivotY = body.render.sprite.yOffset;
|
||||||
|
|
||||||
|
return sprite;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建使用矢量绘图的Sprite对象。
|
||||||
|
* @param {render} render
|
||||||
|
* @param {body} body
|
||||||
|
* @return {void}
|
||||||
|
*/
|
||||||
|
var _createBodyPrimitive = function(render, body)
|
||||||
|
{
|
||||||
|
var bodyRender = body.render,
|
||||||
|
options = render.options,
|
||||||
|
sprite = new Laya.Sprite(),
|
||||||
|
fillStyle, strokeStyle, lineWidth,
|
||||||
|
part, points = [];
|
||||||
|
|
||||||
|
var primitive = sprite.graphics;
|
||||||
|
primitive.clear();
|
||||||
|
|
||||||
|
// 处理 compound parts
|
||||||
|
for (var k = body.parts.length > 1 ? 1 : 0; k < body.parts.length; k++)
|
||||||
|
{
|
||||||
|
part = body.parts[k];
|
||||||
|
|
||||||
|
if (!options.wireframes)
|
||||||
|
{
|
||||||
|
fillStyle = bodyRender.fillStyle;
|
||||||
|
strokeStyle = bodyRender.strokeStyle;
|
||||||
|
lineWidth = bodyRender.lineWidth;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fillStyle = null;
|
||||||
|
strokeStyle = '#bbbbbb';
|
||||||
|
lineWidth = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
points.push(part.vertices[0].x - body.position.x, part.vertices[0].y - body.position.y);
|
||||||
|
|
||||||
|
for (var j = 1; j < part.vertices.length; j++)
|
||||||
|
{
|
||||||
|
points.push(part.vertices[j].x - body.position.x, part.vertices[j].y - body.position.y);
|
||||||
|
}
|
||||||
|
|
||||||
|
points.push(part.vertices[0].x - body.position.x, part.vertices[0].y - body.position.y);
|
||||||
|
|
||||||
|
primitive.drawPoly(0, 0, points, fillStyle, strokeStyle, lineWidth);
|
||||||
|
|
||||||
|
// 角度指示器
|
||||||
|
if (options.showAngleIndicator || options.showAxes)
|
||||||
|
{
|
||||||
|
lineWidth = 1;
|
||||||
|
if (options.wireframes)
|
||||||
|
{
|
||||||
|
strokeStyle = '#CD5C5C';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
strokeStyle = bodyRender.strokeStyle;
|
||||||
|
}
|
||||||
|
|
||||||
|
primitive.drawLine(part.position.x - body.position.x, part.position.y - body.position.y,
|
||||||
|
((part.vertices[0].x + part.vertices[part.vertices.length - 1].x) / 2 - body.position.x),
|
||||||
|
((part.vertices[0].y + part.vertices[part.vertices.length - 1].y) / 2 - body.position.y));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return sprite;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 绘制 constraint。
|
||||||
|
* @param {render} render
|
||||||
|
* @param {constraint} constraint
|
||||||
|
* @return {void}
|
||||||
|
*/
|
||||||
|
LayaRender.constraint = function(render, constraint)
|
||||||
|
{
|
||||||
|
var engine = render.engine,
|
||||||
|
bodyA = constraint.bodyA,
|
||||||
|
bodyB = constraint.bodyB,
|
||||||
|
pointA = constraint.pointA,
|
||||||
|
pointB = constraint.pointB,
|
||||||
|
container = render.container,
|
||||||
|
constraintRender = constraint.render,
|
||||||
|
primitiveId = 'c-' + constraint.id,
|
||||||
|
sprite = constraint.layaSprite;
|
||||||
|
|
||||||
|
// 如果sprite不存在,则初始化一个
|
||||||
|
if (!sprite)
|
||||||
|
sprite = constraint.layaSprite = new Laya.Sprite();
|
||||||
|
|
||||||
|
var primitive = sprite.graphics;
|
||||||
|
|
||||||
|
// constraint 没有两个终点时不渲染
|
||||||
|
if (!constraintRender.visible || !constraint.pointA || !constraint.pointB)
|
||||||
|
{
|
||||||
|
primitive.clear();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 如果sprite未在显示列表,则添加至显示列表
|
||||||
|
if (!container.contains(sprite))
|
||||||
|
container.addChild(sprite);
|
||||||
|
|
||||||
|
// 渲染 constraint
|
||||||
|
primitive.clear();
|
||||||
|
|
||||||
|
var fromX, fromY, toX, toY;
|
||||||
|
if (bodyA)
|
||||||
|
{
|
||||||
|
fromX = bodyA.position.x + pointA.x;
|
||||||
|
fromY = bodyA.position.y + pointA.y;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fromX = pointA.x;
|
||||||
|
fromY = pointA.y;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bodyB)
|
||||||
|
{
|
||||||
|
toX = bodyB.position.x + pointB.x;
|
||||||
|
toY = bodyB.position.y + pointB.y;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
toX = pointB.x;
|
||||||
|
toY = pointB.y;
|
||||||
|
}
|
||||||
|
|
||||||
|
primitive.drawLine(fromX, fromY, toX, toY, constraintRender.strokeStyle, constraintRender.lineWidth);
|
||||||
|
};
|
||||||
|
|
||||||
|
window.LayaRender = LayaRender;
|
||||||
|
})();
|
||||||
@@ -0,0 +1,117 @@
|
|||||||
|
|
||||||
|
(function(window,document,Laya){
|
||||||
|
var __un=Laya.un,__uns=Laya.uns,__static=Laya.static,__class=Laya.class,__getset=Laya.getset,__newvec=Laya.__newvec;
|
||||||
|
|
||||||
|
var Component3D=laya.d3.component.Component3D,ComponentNode=laya.d3.core.ComponentNode,MeshTerrainSprite3D=laya.d3.core.MeshTerrainSprite3D;
|
||||||
|
var Sprite3D=laya.d3.core.Sprite3D;
|
||||||
|
/**
|
||||||
|
*<code>PathFinding</code> 类用于创建寻路。
|
||||||
|
*/
|
||||||
|
//class laya.d3.component.PathFind extends laya.d3.component.Component3D
|
||||||
|
var PathFind=(function(_super){
|
||||||
|
function PathFind(){
|
||||||
|
/**@private */
|
||||||
|
this._meshTerrainSprite3D=null;
|
||||||
|
/**@private */
|
||||||
|
this._finder=null;
|
||||||
|
/**@private */
|
||||||
|
this._setting=null;
|
||||||
|
/**寻路网格。*/
|
||||||
|
this.grid=null;
|
||||||
|
PathFind.__super.call(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
__class(PathFind,'laya.d3.component.PathFind',_super);
|
||||||
|
var __proto=PathFind.prototype;
|
||||||
|
/**
|
||||||
|
*@private
|
||||||
|
*初始化载入蒙皮动画组件。
|
||||||
|
*@param owner 所属精灵对象。
|
||||||
|
*/
|
||||||
|
__proto._load=function(owner){
|
||||||
|
if (! (owner instanceof laya.d3.core.MeshTerrainSprite3D ))
|
||||||
|
throw new Error("PathFinding: The owner must MeshTerrainSprite3D!");
|
||||||
|
_super.prototype._load.call(this,owner);
|
||||||
|
this._meshTerrainSprite3D=owner;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*寻找路径。
|
||||||
|
*@param startX 开始X。
|
||||||
|
*@param startZ 开始Z。
|
||||||
|
*@param endX 结束X。
|
||||||
|
*@param endZ 结束Z。
|
||||||
|
*@return 路径。
|
||||||
|
*/
|
||||||
|
__proto.findPath=function(startX,startZ,endX,endZ){
|
||||||
|
var minX=this._meshTerrainSprite3D.minX;
|
||||||
|
var minZ=this._meshTerrainSprite3D.minZ;
|
||||||
|
var cellX=this._meshTerrainSprite3D.width / this.grid.width;
|
||||||
|
var cellZ=this._meshTerrainSprite3D.depth / this.grid.height;
|
||||||
|
var halfCellX=cellX / 2;
|
||||||
|
var halfCellZ=cellZ / 2;
|
||||||
|
var gridStartX=Math.floor((startX-minX)/ cellX);
|
||||||
|
var gridStartZ=Math.floor((startZ-minZ)/ cellZ);
|
||||||
|
var gridEndX=Math.floor((endX-minX)/ cellX);
|
||||||
|
var gridEndZ=Math.floor((endZ-minZ)/ cellZ);
|
||||||
|
var boundWidth=this.grid.width-1;
|
||||||
|
var boundHeight=this.grid.height-1;
|
||||||
|
(gridStartX > boundWidth)&& (gridStartX=boundWidth);
|
||||||
|
(gridStartZ > boundHeight)&& (gridStartZ=boundHeight);
|
||||||
|
(gridStartX < 0)&& (gridStartX=0);
|
||||||
|
(gridStartZ < 0)&& (gridStartZ=0);
|
||||||
|
(gridEndX > boundWidth)&& (gridEndX=boundWidth);
|
||||||
|
(gridEndZ > boundHeight)&& (gridEndZ=boundHeight);
|
||||||
|
(gridEndX < 0)&& (gridEndX=0);
|
||||||
|
(gridEndZ < 0)&& (gridEndZ=0);
|
||||||
|
var path=this._finder.findPath(gridStartX,gridStartZ,gridEndX,gridEndZ,this.grid);
|
||||||
|
this.grid.reset();
|
||||||
|
for (var i=1;i < path.length-1;i++){
|
||||||
|
var gridPos=path[i];
|
||||||
|
gridPos[0]=gridPos[0] *cellX+halfCellX+minX;
|
||||||
|
gridPos[1]=gridPos[1] *cellZ+halfCellZ+minZ;
|
||||||
|
}
|
||||||
|
if (path.length==1){
|
||||||
|
path[0][0]=endX;
|
||||||
|
path[0][1]=endX;
|
||||||
|
}else if (path.length > 1){
|
||||||
|
path[0][0]=startX;
|
||||||
|
path[0][1]=startZ;
|
||||||
|
path[path.length-1][0]=endX;
|
||||||
|
path[path.length-1][1]=endZ;
|
||||||
|
}
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*设置寻路设置。
|
||||||
|
*@param value 寻路设置。
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
*获取寻路设置。
|
||||||
|
*@return 寻路设置。
|
||||||
|
*/
|
||||||
|
__getset(0,__proto,'setting',function(){
|
||||||
|
return this._setting;
|
||||||
|
},function(value){
|
||||||
|
(value)&& (this._finder=new PathFinding.finders.AStarFinder(value));
|
||||||
|
this._setting=value;
|
||||||
|
});
|
||||||
|
|
||||||
|
return PathFind;
|
||||||
|
})(Component3D)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
})(window,document,Laya);
|
||||||
|
|
||||||
|
if (typeof define === 'function' && define.amd){
|
||||||
|
define('laya.core', ['require', "exports"], function(require, exports) {
|
||||||
|
'use strict';
|
||||||
|
Object.defineProperty(exports, '__esModule', { value: true });
|
||||||
|
for (var i in Laya) {
|
||||||
|
var o = Laya[i];
|
||||||
|
o && o.__isclass && (exports[i] = o);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -0,0 +1,974 @@
|
|||||||
|
|
||||||
|
(function(window,document,Laya){
|
||||||
|
var __un=Laya.un,__uns=Laya.uns,__static=Laya.static,__class=Laya.class,__getset=Laya.getset,__newvec=Laya.__newvec;
|
||||||
|
|
||||||
|
var Bitmap=laya.resource.Bitmap,Browser=laya.utils.Browser,Event=laya.events.Event,EventDispatcher=laya.events.EventDispatcher;
|
||||||
|
var Handler=laya.utils.Handler,Rectangle=laya.maths.Rectangle,Render=laya.renders.Render,Sprite=laya.display.Sprite;
|
||||||
|
var Stage=laya.display.Stage,Texture=laya.resource.Texture,Utils=laya.utils.Utils,WebGL=laya.webgl.WebGL;
|
||||||
|
var WebGLContext=laya.webgl.WebGLContext;
|
||||||
|
/**
|
||||||
|
*使用前可用<code>supported</code>查看浏览器支持。
|
||||||
|
*/
|
||||||
|
//class laya.device.geolocation.Geolocation
|
||||||
|
var Geolocation=(function(){
|
||||||
|
function Geolocation(){}
|
||||||
|
__class(Geolocation,'laya.device.geolocation.Geolocation');
|
||||||
|
Geolocation.getCurrentPosition=function(onSuccess,onError){
|
||||||
|
Geolocation.navigator.geolocation.getCurrentPosition(function(pos){
|
||||||
|
Geolocation.position.setPosition(pos);
|
||||||
|
onSuccess.runWith(Geolocation.position);
|
||||||
|
},
|
||||||
|
function(error){
|
||||||
|
onError.runWith(error);
|
||||||
|
},{
|
||||||
|
enableHighAccuracy :laya.device.geolocation.Geolocation.enableHighAccuracy,
|
||||||
|
timeout :laya.device.geolocation.Geolocation.timeout,
|
||||||
|
maximumAge :laya.device.geolocation.Geolocation.maximumAge
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
Geolocation.watchPosition=function(onSuccess,onError){
|
||||||
|
return Geolocation.navigator.geolocation.watchPosition(function(pos){
|
||||||
|
Geolocation.position.setPosition(pos);
|
||||||
|
onSuccess.runWith(Geolocation.position);
|
||||||
|
},
|
||||||
|
function(error){
|
||||||
|
onError.runWith(error);
|
||||||
|
},{
|
||||||
|
enableHighAccuracy :Geolocation.enableHighAccuracy,
|
||||||
|
timeout :Geolocation.timeout,
|
||||||
|
maximumAge :Geolocation.maximumAge
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
Geolocation.clearWatch=function(id){
|
||||||
|
Geolocation.navigator.geolocation.clearWatch(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
Geolocation.PERMISSION_DENIED=1;
|
||||||
|
Geolocation.POSITION_UNAVAILABLE=2;
|
||||||
|
Geolocation.TIMEOUT=3;
|
||||||
|
Geolocation.enableHighAccuracy=false;
|
||||||
|
Geolocation.maximumAge=0;
|
||||||
|
__static(Geolocation,
|
||||||
|
['navigator',function(){return this.navigator=Browser.window.navigator;},'position',function(){return this.position=new GeolocationInfo();},'supported',function(){return this.supported=!!Geolocation.navigator.geolocation;},'timeout',function(){return this.timeout=1E10;}
|
||||||
|
]);
|
||||||
|
return Geolocation;
|
||||||
|
})()
|
||||||
|
|
||||||
|
|
||||||
|
//class laya.device.geolocation.GeolocationInfo
|
||||||
|
var GeolocationInfo=(function(){
|
||||||
|
function GeolocationInfo(){
|
||||||
|
this.pos=null;
|
||||||
|
this.coords=null;
|
||||||
|
}
|
||||||
|
|
||||||
|
__class(GeolocationInfo,'laya.device.geolocation.GeolocationInfo');
|
||||||
|
var __proto=GeolocationInfo.prototype;
|
||||||
|
__proto.setPosition=function(pos){
|
||||||
|
this.pos=pos;
|
||||||
|
this.coords=pos.coords;
|
||||||
|
}
|
||||||
|
|
||||||
|
__getset(0,__proto,'heading',function(){
|
||||||
|
return this.coords.heading;
|
||||||
|
});
|
||||||
|
|
||||||
|
__getset(0,__proto,'latitude',function(){
|
||||||
|
return this.coords.latitude;
|
||||||
|
});
|
||||||
|
|
||||||
|
__getset(0,__proto,'altitudeAccuracy',function(){
|
||||||
|
return this.coords.altitudeAccuracy;
|
||||||
|
});
|
||||||
|
|
||||||
|
__getset(0,__proto,'longitude',function(){
|
||||||
|
return this.coords.longitude;
|
||||||
|
});
|
||||||
|
|
||||||
|
__getset(0,__proto,'altitude',function(){
|
||||||
|
return this.coords.altitude;
|
||||||
|
});
|
||||||
|
|
||||||
|
__getset(0,__proto,'accuracy',function(){
|
||||||
|
return this.coords.accuracy;
|
||||||
|
});
|
||||||
|
|
||||||
|
__getset(0,__proto,'speed',function(){
|
||||||
|
return this.coords.speed;
|
||||||
|
});
|
||||||
|
|
||||||
|
__getset(0,__proto,'timestamp',function(){
|
||||||
|
return this.pos.timestamp;
|
||||||
|
});
|
||||||
|
|
||||||
|
return GeolocationInfo;
|
||||||
|
})()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*Media用于捕捉摄像头和麦克风。可以捕捉任意之一,或者同时捕捉两者。<code>getCamera</code>前可以使用<code>supported()</code>检查当前浏览器是否支持。
|
||||||
|
*<b>NOTE:</b>
|
||||||
|
*<p>目前Media在移动平台只支持Android,不支持IOS。只可在FireFox完整地使用,Chrome测试时无法捕捉视频。</p>
|
||||||
|
*/
|
||||||
|
//class laya.device.media.Media
|
||||||
|
var Media=(function(){
|
||||||
|
function Media(){}
|
||||||
|
__class(Media,'laya.device.media.Media');
|
||||||
|
Media.supported=function(){
|
||||||
|
return !!Browser.window.navigator.getUserMedia;
|
||||||
|
}
|
||||||
|
|
||||||
|
Media.getMedia=function(options,onSuccess,onError){
|
||||||
|
if (Browser.window.navigator.getUserMedia){
|
||||||
|
Browser.window.navigator.getUserMedia(options,function(stream){
|
||||||
|
onSuccess.runWith(Browser.window.URL.createObjectURL(stream));
|
||||||
|
},function(err){
|
||||||
|
onError.runWith(err);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Media.__init$=function(){
|
||||||
|
/*__JS__ */navigator.getUserMedia=navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia;;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Media;
|
||||||
|
})()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*加速度x/y/z的单位均为m/s²。
|
||||||
|
*在硬件(陀螺仪)不支持的情况下,alpha、beta和gamma值为null。
|
||||||
|
*
|
||||||
|
*@author Survivor
|
||||||
|
*/
|
||||||
|
//class laya.device.motion.AccelerationInfo
|
||||||
|
var AccelerationInfo=(function(){
|
||||||
|
function AccelerationInfo(){
|
||||||
|
/**
|
||||||
|
*x轴上的加速度值。
|
||||||
|
*/
|
||||||
|
this.x=NaN;
|
||||||
|
/**
|
||||||
|
*y轴上的加速度值。
|
||||||
|
*/
|
||||||
|
this.y=NaN;
|
||||||
|
/**
|
||||||
|
*z轴上的加速度值。
|
||||||
|
*/
|
||||||
|
this.z=NaN;
|
||||||
|
}
|
||||||
|
|
||||||
|
__class(AccelerationInfo,'laya.device.motion.AccelerationInfo');
|
||||||
|
return AccelerationInfo;
|
||||||
|
})()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*保存旋转信息的类。请勿修改本类的属性。
|
||||||
|
*@author Survivor
|
||||||
|
*/
|
||||||
|
//class laya.device.motion.RotationInfo
|
||||||
|
var RotationInfo=(function(){
|
||||||
|
function RotationInfo(){
|
||||||
|
/**
|
||||||
|
*<p>
|
||||||
|
*指示设备是否可以提供绝对方位数据(指向地球坐标系),或者设备决定的任意坐标系。
|
||||||
|
*关于坐标系参见<i>https://developer.mozilla.org/en-US/docs/Web/Guide/Events/Orientation_and_motion_data_explained</i>。
|
||||||
|
*</p>
|
||||||
|
*需要注意的是,IOS环境下,该值始终为false。即使如此,你依旧可以从<code>alpha</code>中取得正确的值。
|
||||||
|
*/
|
||||||
|
this.absolute=false;
|
||||||
|
/**
|
||||||
|
*Z轴旋转角度,其值范围从0至360。
|
||||||
|
*若<code>absolute</code>为true或者在IOS中,alpha值是从北方到当前设备方向的角度值。
|
||||||
|
*/
|
||||||
|
this.alpha=NaN;
|
||||||
|
/**
|
||||||
|
*X轴旋转角度,其值范围从-180至180。代表设备从前至后的运动。
|
||||||
|
*/
|
||||||
|
this.beta=NaN;
|
||||||
|
/**
|
||||||
|
*Y轴旋转角度,其值范围从-90至90。代表设备从左至右的运动。
|
||||||
|
*/
|
||||||
|
this.gamma=NaN;
|
||||||
|
/**
|
||||||
|
*罗盘数据的精确度(角度)。仅IOS可用。
|
||||||
|
*/
|
||||||
|
this.compassAccuracy=NaN;
|
||||||
|
}
|
||||||
|
|
||||||
|
__class(RotationInfo,'laya.device.motion.RotationInfo');
|
||||||
|
return RotationInfo;
|
||||||
|
})()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*Accelerator.instance获取唯一的Accelerator引用,请勿调用构造函数。
|
||||||
|
*
|
||||||
|
*<p>
|
||||||
|
*listen()的回调处理器接受四个参数:
|
||||||
|
*<ol>
|
||||||
|
*<li><b>acceleration</b>:表示用户给予设备的加速度。</li>
|
||||||
|
*<li><b>accelerationIncludingGravity</b>:设备受到的总加速度(包含重力)。</li>
|
||||||
|
*<li><b>rotationRate</b>:设备的自转速率。</li>
|
||||||
|
*<li><b>interval</b>:加速度获取的时间间隔(毫秒)。</li>
|
||||||
|
*</ol>
|
||||||
|
*</p>
|
||||||
|
*<p>
|
||||||
|
*<b>NOTE</b><br/>
|
||||||
|
*如,rotationRate的alpha在apple和moz文档中都是z轴旋转角度,但是实测是x轴旋转角度。为了使各属性表示的值与文档所述相同,实际值与其他属性进行了对调。
|
||||||
|
*其中:
|
||||||
|
*<ul>
|
||||||
|
*<li>alpha使用gamma值。</li>
|
||||||
|
*<li>beta使用alpha值。</li>
|
||||||
|
*<li>gamma使用beta。</li>
|
||||||
|
*</ul>
|
||||||
|
*目前孰是孰非尚未可知,以此为注。
|
||||||
|
*</p>
|
||||||
|
*/
|
||||||
|
//class laya.device.motion.Accelerator extends laya.events.EventDispatcher
|
||||||
|
var Accelerator=(function(_super){
|
||||||
|
function Accelerator(singleton){
|
||||||
|
Accelerator.__super.call(this);
|
||||||
|
/*__JS__ */this.onDeviceOrientationChange=this.onDeviceOrientationChange.bind(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
__class(Accelerator,'laya.device.motion.Accelerator',_super);
|
||||||
|
var __proto=Accelerator.prototype;
|
||||||
|
/**
|
||||||
|
*侦听加速器运动。
|
||||||
|
*@param observer 回调函数接受4个参数,见类说明。
|
||||||
|
*/
|
||||||
|
__proto.on=function(type,caller,listener,args){
|
||||||
|
_super.prototype.on.call(this,type,caller,listener,args);
|
||||||
|
Browser.window.addEventListener('devicemotion',this.onDeviceOrientationChange);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*取消侦听加速器。
|
||||||
|
*@param handle 侦听加速器所用处理器。
|
||||||
|
*/
|
||||||
|
__proto.off=function(type,caller,listener,onceOnly){
|
||||||
|
(onceOnly===void 0)&& (onceOnly=false);
|
||||||
|
if (!this.hasListener(type))
|
||||||
|
Browser.window.removeEventListener('devicemotion',this.onDeviceOrientationChange)
|
||||||
|
return _super.prototype.off.call(this,type,caller,listener,onceOnly);
|
||||||
|
}
|
||||||
|
|
||||||
|
__proto.onDeviceOrientationChange=function(e){
|
||||||
|
var interval=e.interval;
|
||||||
|
Accelerator.acceleration.x=e.acceleration.x;
|
||||||
|
Accelerator.acceleration.y=e.acceleration.y;
|
||||||
|
Accelerator.acceleration.z=e.acceleration.z;
|
||||||
|
Accelerator.accelerationIncludingGravity.x=e.accelerationIncludingGravity.x;
|
||||||
|
Accelerator.accelerationIncludingGravity.y=e.accelerationIncludingGravity.y;
|
||||||
|
Accelerator.accelerationIncludingGravity.z=e.accelerationIncludingGravity.z;
|
||||||
|
Accelerator.rotationRate.alpha=e.rotationRate.gamma *-1;
|
||||||
|
Accelerator.rotationRate.beta=e.rotationRate.alpha *-1;
|
||||||
|
Accelerator.rotationRate.gamma=e.rotationRate.beta;
|
||||||
|
if (Browser.onAndroid){
|
||||||
|
if (Accelerator.onChrome){
|
||||||
|
Accelerator.rotationRate.alpha *=180 / Math.PI;
|
||||||
|
Accelerator.rotationRate.beta *=180 / Math.PI;
|
||||||
|
Accelerator.rotationRate.gamma *=180 / Math.PI;
|
||||||
|
}
|
||||||
|
Accelerator.acceleration.x *=-1;
|
||||||
|
Accelerator.accelerationIncludingGravity.x *=-1;
|
||||||
|
}
|
||||||
|
else if (Browser.onIOS){
|
||||||
|
Accelerator.acceleration.y *=-1;
|
||||||
|
Accelerator.acceleration.z *=-1;
|
||||||
|
Accelerator.accelerationIncludingGravity.y *=-1;
|
||||||
|
Accelerator.accelerationIncludingGravity.z *=-1;
|
||||||
|
interval *=1000;
|
||||||
|
}
|
||||||
|
this.event(/*laya.events.Event.CHANGE*/"change",[Accelerator.acceleration,Accelerator.accelerationIncludingGravity,Accelerator.rotationRate,interval]);
|
||||||
|
}
|
||||||
|
|
||||||
|
__getset(1,Accelerator,'instance',function(){Accelerator._instance=Accelerator._instance|| new Accelerator(0)
|
||||||
|
return Accelerator._instance;
|
||||||
|
},laya.events.EventDispatcher._$SET_instance);
|
||||||
|
|
||||||
|
Accelerator.getTransformedAcceleration=function(acceleration){Accelerator.transformedAcceleration=Accelerator.transformedAcceleration|| new AccelerationInfo();
|
||||||
|
Accelerator.transformedAcceleration.z=acceleration.z;
|
||||||
|
if (Browser.window.orientation==90){
|
||||||
|
Accelerator.transformedAcceleration.x=acceleration.y;
|
||||||
|
Accelerator.transformedAcceleration.y=-acceleration.x;
|
||||||
|
}
|
||||||
|
else if (Browser.window.orientation==-90){
|
||||||
|
Accelerator.transformedAcceleration.x=-acceleration.y;
|
||||||
|
Accelerator.transformedAcceleration.y=acceleration.x;
|
||||||
|
}
|
||||||
|
else if (!Browser.window.orientation){
|
||||||
|
Accelerator.transformedAcceleration.x=acceleration.x;
|
||||||
|
Accelerator.transformedAcceleration.y=acceleration.y;
|
||||||
|
}
|
||||||
|
else if (Browser.window.orientation==180){
|
||||||
|
Accelerator.transformedAcceleration.x=-acceleration.x;
|
||||||
|
Accelerator.transformedAcceleration.y=-acceleration.y;
|
||||||
|
};
|
||||||
|
var tx=NaN;
|
||||||
|
if (Laya.stage.canvasDegree==-90){
|
||||||
|
tx=Accelerator.transformedAcceleration.x;
|
||||||
|
Accelerator.transformedAcceleration.x=-Accelerator.transformedAcceleration.y;
|
||||||
|
Accelerator.transformedAcceleration.y=tx;
|
||||||
|
}
|
||||||
|
else if (Laya.stage.canvasDegree==90){
|
||||||
|
tx=Accelerator.transformedAcceleration.x;
|
||||||
|
Accelerator.transformedAcceleration.x=Accelerator.transformedAcceleration.y;
|
||||||
|
Accelerator.transformedAcceleration.y=-tx;
|
||||||
|
}
|
||||||
|
return Accelerator.transformedAcceleration;
|
||||||
|
}
|
||||||
|
|
||||||
|
Accelerator._instance=null;
|
||||||
|
Accelerator.transformedAcceleration=null;
|
||||||
|
__static(Accelerator,
|
||||||
|
['acceleration',function(){return this.acceleration=new AccelerationInfo();},'accelerationIncludingGravity',function(){return this.accelerationIncludingGravity=new AccelerationInfo();},'rotationRate',function(){return this.rotationRate=new RotationInfo();},'onChrome',function(){return this.onChrome=(Browser.userAgent.indexOf("Chrome")>-1);}
|
||||||
|
]);
|
||||||
|
return Accelerator;
|
||||||
|
})(EventDispatcher)
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*使用Gyroscope.instance获取唯一的Gyroscope引用,请勿调用构造函数。
|
||||||
|
*
|
||||||
|
*<p>
|
||||||
|
*listen()的回调处理器接受两个参数:
|
||||||
|
*<code>function onOrientationChange(absolute:Boolean,info:RotationInfo):void</code>
|
||||||
|
*<ol>
|
||||||
|
*<li><b>absolute</b>:指示设备是否可以提供绝对方位数据(指向地球坐标系),或者设备决定的任意坐标系。关于坐标系参见<i>https://developer.mozilla.org/en-US/docs/Web/Guide/Events/Orientation_and_motion_data_explained</i>。</li>
|
||||||
|
*<li><b>info</b>:<code>RotationInfo</code>类型参数,保存设备的旋转值。</li>
|
||||||
|
*</ol>
|
||||||
|
*</p>
|
||||||
|
*
|
||||||
|
*<p>
|
||||||
|
*浏览器兼容性参见:<i>http://caniuse.com/#search=deviceorientation</i>
|
||||||
|
*</p>
|
||||||
|
*/
|
||||||
|
//class laya.device.motion.Gyroscope extends laya.events.EventDispatcher
|
||||||
|
var Gyroscope=(function(_super){
|
||||||
|
function Gyroscope(singleton){
|
||||||
|
Gyroscope.__super.call(this);
|
||||||
|
/*__JS__ */this.onDeviceOrientationChange=this.onDeviceOrientationChange.bind(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
__class(Gyroscope,'laya.device.motion.Gyroscope',_super);
|
||||||
|
var __proto=Gyroscope.prototype;
|
||||||
|
/**
|
||||||
|
*监视陀螺仪运动。
|
||||||
|
*@param observer 回调函数接受一个Boolean类型的<code>absolute</code>和<code>GyroscopeInfo</code>类型参数。
|
||||||
|
*/
|
||||||
|
__proto.on=function(type,caller,listener,args){
|
||||||
|
_super.prototype.on.call(this,type,caller,listener,args);
|
||||||
|
Browser.window.addEventListener('deviceorientation',this.onDeviceOrientationChange);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*取消指定处理器对陀螺仪的监视。
|
||||||
|
*@param observer
|
||||||
|
*/
|
||||||
|
__proto.off=function(type,caller,listener,onceOnly){
|
||||||
|
(onceOnly===void 0)&& (onceOnly=false);
|
||||||
|
if (!this.hasListener(type))
|
||||||
|
Browser.window.removeEventListener('deviceorientation',this.onDeviceOrientationChange);
|
||||||
|
return _super.prototype.off.call(this,type,caller,listener,onceOnly);
|
||||||
|
}
|
||||||
|
|
||||||
|
__proto.onDeviceOrientationChange=function(e){
|
||||||
|
Gyroscope.info.alpha=e.alpha;
|
||||||
|
Gyroscope.info.beta=e.beta;
|
||||||
|
Gyroscope.info.gamma=e.gamma;
|
||||||
|
if (e.webkitCompassHeading){
|
||||||
|
Gyroscope.info.alpha=e.webkitCompassHeading *-1;
|
||||||
|
Gyroscope.info.compassAccuracy=e.webkitCompassAccuracy;
|
||||||
|
}
|
||||||
|
this.event(/*laya.events.Event.CHANGE*/"change",[e.absolute,Gyroscope.info]);
|
||||||
|
}
|
||||||
|
|
||||||
|
__getset(1,Gyroscope,'instance',function(){Gyroscope._instance=Gyroscope._instance|| new Gyroscope(0);
|
||||||
|
return Gyroscope._instance;
|
||||||
|
},laya.events.EventDispatcher._$SET_instance);
|
||||||
|
|
||||||
|
Gyroscope._instance=null;
|
||||||
|
__static(Gyroscope,
|
||||||
|
['info',function(){return this.info=new RotationInfo();}
|
||||||
|
]);
|
||||||
|
return Gyroscope;
|
||||||
|
})(EventDispatcher)
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*Shake只能在支持此操作的设备上有效。
|
||||||
|
*
|
||||||
|
*@author Survivor
|
||||||
|
*/
|
||||||
|
//class laya.device.Shake extends laya.events.EventDispatcher
|
||||||
|
var Shake=(function(_super){
|
||||||
|
function Shake(){
|
||||||
|
this.throushold=0;
|
||||||
|
this.shakeInterval=0;
|
||||||
|
this.callback=null;
|
||||||
|
this.lastX=NaN;
|
||||||
|
this.lastY=NaN;
|
||||||
|
this.lastZ=NaN;
|
||||||
|
this.lastMillSecond=NaN;
|
||||||
|
Shake.__super.call(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
__class(Shake,'laya.device.Shake',_super);
|
||||||
|
var __proto=Shake.prototype;
|
||||||
|
/**
|
||||||
|
*开始响应设备摇晃。
|
||||||
|
*@param throushold 响应的瞬时速度阈值,轻度摇晃的值约在5~10间。
|
||||||
|
*@param timeout 设备摇晃的响应间隔时间。
|
||||||
|
*@param callback 在设备摇晃触发时调用的处理器。
|
||||||
|
*/
|
||||||
|
__proto.start=function(throushold,interval){
|
||||||
|
this.throushold=throushold;
|
||||||
|
this.shakeInterval=interval;
|
||||||
|
this.lastX=this.lastY=this.lastZ=NaN;
|
||||||
|
Accelerator.instance.on(/*laya.events.Event.CHANGE*/"change",this,this.onShake);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*停止响应设备摇晃。
|
||||||
|
*/
|
||||||
|
__proto.stop=function(){
|
||||||
|
Accelerator.instance.off(/*laya.events.Event.CHANGE*/"change",this,this.onShake);
|
||||||
|
}
|
||||||
|
|
||||||
|
__proto.onShake=function(acceleration,accelerationIncludingGravity,rotationRate,interval){
|
||||||
|
if(isNaN(this.lastX)){
|
||||||
|
this.lastX=accelerationIncludingGravity.x;
|
||||||
|
this.lastY=accelerationIncludingGravity.y;
|
||||||
|
this.lastZ=accelerationIncludingGravity.z;
|
||||||
|
this.lastMillSecond=Browser.now();
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
var deltaX=Math.abs(this.lastX-accelerationIncludingGravity.x);
|
||||||
|
var deltaY=Math.abs(this.lastY-accelerationIncludingGravity.y);
|
||||||
|
var deltaZ=Math.abs(this.lastZ-accelerationIncludingGravity.z);
|
||||||
|
if(this.isShaked(deltaX,deltaY,deltaZ)){
|
||||||
|
var deltaMillSecond=Browser.now()-this.lastMillSecond;
|
||||||
|
if (deltaMillSecond > this.shakeInterval){
|
||||||
|
this.event(/*laya.events.Event.CHANGE*/"change");
|
||||||
|
this.lastMillSecond=Browser.now();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.lastX=accelerationIncludingGravity.x;
|
||||||
|
this.lastY=accelerationIncludingGravity.y;
|
||||||
|
this.lastZ=accelerationIncludingGravity.z;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 通过任意两个分量判断是否满足摇晃设定。
|
||||||
|
__proto.isShaked=function(deltaX,deltaY,deltaZ){
|
||||||
|
return (deltaX > this.throushold && deltaY > this.throushold)||
|
||||||
|
(deltaX > this.throushold && deltaZ > this.throushold)||
|
||||||
|
(deltaY > this.throushold && deltaZ > this.throushold)
|
||||||
|
}
|
||||||
|
|
||||||
|
__getset(1,Shake,'instance',function(){Shake._instance=Shake._instance|| new Shake();
|
||||||
|
return Shake._instance;
|
||||||
|
},laya.events.EventDispatcher._$SET_instance);
|
||||||
|
|
||||||
|
Shake._instance=null;
|
||||||
|
return Shake;
|
||||||
|
})(EventDispatcher)
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*<code>Video</code>将视频显示到Canvas上。<code>Video</code>可能不会在所有浏览器有效。
|
||||||
|
*<p>关于Video支持的所有事件参见:<i>http://www.w3school.com.cn/tags/html_ref_audio_video_dom.asp</i>。</p>
|
||||||
|
*<p>
|
||||||
|
*<b>注意:</b><br/>
|
||||||
|
*在PC端可以在任何时机调用<code>play()</code>因此,可以在程序开始运行时就使Video开始播放。但是在移动端,只有在用户第一次触碰屏幕后才可以调用play(),所以移动端不可能在程序开始运行时就自动开始播放Video。
|
||||||
|
*</p>
|
||||||
|
*
|
||||||
|
*<p>MDN Video链接: <i>https://developer.mozilla.org/en-US/docs/Web/HTML/Element/video</i></p>
|
||||||
|
*/
|
||||||
|
//class laya.device.media.Video extends laya.display.Sprite
|
||||||
|
var Video=(function(_super){
|
||||||
|
function Video(width,height){
|
||||||
|
this.htmlVideo=null;
|
||||||
|
this.videoElement=null;
|
||||||
|
this.internalTexture=null;
|
||||||
|
(width===void 0)&& (width=320);
|
||||||
|
(height===void 0)&& (height=240);
|
||||||
|
Video.__super.call(this);
|
||||||
|
if (Render.isWebGL)
|
||||||
|
this.htmlVideo=new WebGLVideo();
|
||||||
|
else
|
||||||
|
this.htmlVideo=new HtmlVideo();
|
||||||
|
this.videoElement=this.htmlVideo.getVideo();
|
||||||
|
this.videoElement.layaTarget=this;
|
||||||
|
this.internalTexture=new Texture(this.htmlVideo);
|
||||||
|
this.videoElement.addEventListener("abort",Video.onAbort);
|
||||||
|
this.videoElement.addEventListener("canplay",Video.onCanplay);
|
||||||
|
this.videoElement.addEventListener("canplaythrough",Video.onCanplaythrough);
|
||||||
|
this.videoElement.addEventListener("durationchange",Video.onDurationchange);
|
||||||
|
this.videoElement.addEventListener("emptied",Video.onEmptied);
|
||||||
|
this.videoElement.addEventListener("error",Video.onError);
|
||||||
|
this.videoElement.addEventListener("loadeddata",Video.onLoadeddata);
|
||||||
|
this.videoElement.addEventListener("loadedmetadata",Video.onLoadedmetadata);
|
||||||
|
this.videoElement.addEventListener("loadstart",Video.onLoadstart);
|
||||||
|
this.videoElement.addEventListener("pause",Video.onPause);
|
||||||
|
this.videoElement.addEventListener("play",Video.onPlay);
|
||||||
|
this.videoElement.addEventListener("playing",Video.onPlaying);
|
||||||
|
this.videoElement.addEventListener("progress",Video.onProgress);
|
||||||
|
this.videoElement.addEventListener("ratechange",Video.onRatechange);
|
||||||
|
this.videoElement.addEventListener("seeked",Video.onSeeked);
|
||||||
|
this.videoElement.addEventListener("seeking",Video.onSeeking);
|
||||||
|
this.videoElement.addEventListener("stalled",Video.onStalled);
|
||||||
|
this.videoElement.addEventListener("suspend",Video.onSuspend);
|
||||||
|
this.videoElement.addEventListener("timeupdate",Video.onTimeupdate);
|
||||||
|
this.videoElement.addEventListener("volumechange",Video.onVolumechange);
|
||||||
|
this.videoElement.addEventListener("waiting",Video.onWaiting);
|
||||||
|
this.videoElement.addEventListener("ended",this.onPlayComplete['bind'](this));
|
||||||
|
this.size(width,height);
|
||||||
|
if (Browser.onMobile){
|
||||||
|
/*__JS__ */this.onDocumentClick=this.onDocumentClick.bind(this);
|
||||||
|
Browser.document.addEventListener("touchend",this.onDocumentClick);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
__class(Video,'laya.device.media.Video',_super);
|
||||||
|
var __proto=Video.prototype;
|
||||||
|
__proto.onPlayComplete=function(e){
|
||||||
|
Laya.timer.clear(this,this.renderCanvas);
|
||||||
|
this.event("ended");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*设置播放源。
|
||||||
|
*@param url 播放源路径。
|
||||||
|
*/
|
||||||
|
__proto.load=function(url){
|
||||||
|
if (url.indexOf("blob:")==0)
|
||||||
|
this.videoElement.src=url;
|
||||||
|
else
|
||||||
|
this.htmlVideo.setSource(url,laya.device.media.Video.MP4);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*开始播放视频。
|
||||||
|
*/
|
||||||
|
__proto.play=function(){
|
||||||
|
this.videoElement.play();
|
||||||
|
Laya.timer.frameLoop(1,this,this.renderCanvas);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*暂停视频播放。
|
||||||
|
*/
|
||||||
|
__proto.pause=function(){
|
||||||
|
this.videoElement.pause();
|
||||||
|
Laya.timer.clear(this,this.renderCanvas);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*重新加载视频。
|
||||||
|
*/
|
||||||
|
__proto.reload=function(){
|
||||||
|
this.videoElement.load();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*检测是否支持播放指定格式视频。
|
||||||
|
*@param type 参数为Video.MP4 / Video.OGG / Video.WEBM之一。
|
||||||
|
*@return 表示支持的级别。可能的值:
|
||||||
|
*<ul>
|
||||||
|
*<li>"probably",Video.SUPPORT_PROBABLY-浏览器最可能支持该音频/视频类型</li>
|
||||||
|
*<li>"maybe",Video.SUPPORT_MAYBY-浏览器也许支持该音频/视频类型</li>
|
||||||
|
*<li>"",Video.SUPPORT_NO-(空字符串)浏览器不支持该音频/视频类型</li>
|
||||||
|
*</ul>
|
||||||
|
*/
|
||||||
|
__proto.canPlayType=function(type){
|
||||||
|
var typeString;
|
||||||
|
switch (type){
|
||||||
|
case laya.device.media.Video.MP4:
|
||||||
|
typeString="video/mp4";
|
||||||
|
break ;
|
||||||
|
case laya.device.media.Video.OGG:
|
||||||
|
typeString="video/ogg";
|
||||||
|
break ;
|
||||||
|
case laya.device.media.Video.WEBM:
|
||||||
|
typeString="video/webm";
|
||||||
|
break ;
|
||||||
|
}
|
||||||
|
return this.videoElement.canPlayType(typeString);
|
||||||
|
}
|
||||||
|
|
||||||
|
__proto.renderCanvas=function(){
|
||||||
|
if (this.readyState===0)
|
||||||
|
return;
|
||||||
|
if (Render.isWebGL)
|
||||||
|
this.htmlVideo['updateTexture']();
|
||||||
|
this.graphics.clear();
|
||||||
|
this.graphics.drawTexture(this.internalTexture,0,0,this.width,this.height);
|
||||||
|
}
|
||||||
|
|
||||||
|
__proto.onDocumentClick=function(){
|
||||||
|
this.videoElement.play();
|
||||||
|
this.videoElement.pause();
|
||||||
|
Browser.document.removeEventListener("touchend",this.onDocumentClick);
|
||||||
|
}
|
||||||
|
|
||||||
|
__proto.size=function(width,height){
|
||||||
|
_super.prototype.size.call(this,width,height)
|
||||||
|
this.videoElement.width=width / Browser.pixelRatio;
|
||||||
|
if (this.paused)this.renderCanvas();
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*销毁内部事件绑定。
|
||||||
|
*/
|
||||||
|
__proto.destroy=function(detroyChildren){
|
||||||
|
(detroyChildren===void 0)&& (detroyChildren=true);
|
||||||
|
_super.prototype.destroy.call(this,detroyChildren);
|
||||||
|
this.videoElement.removeEventListener("abort",Video.onAbort);
|
||||||
|
this.videoElement.removeEventListener("canplay",Video.onCanplay);
|
||||||
|
this.videoElement.removeEventListener("canplaythrough",Video.onCanplaythrough);
|
||||||
|
this.videoElement.removeEventListener("durationchange",Video.onDurationchange);
|
||||||
|
this.videoElement.removeEventListener("emptied",Video.onEmptied);
|
||||||
|
this.videoElement.removeEventListener("error",Video.onError);
|
||||||
|
this.videoElement.removeEventListener("loadeddata",Video.onLoadeddata);
|
||||||
|
this.videoElement.removeEventListener("loadedmetadata",Video.onLoadedmetadata);
|
||||||
|
this.videoElement.removeEventListener("loadstart",Video.onLoadstart);
|
||||||
|
this.videoElement.removeEventListener("pause",Video.onPause);
|
||||||
|
this.videoElement.removeEventListener("play",Video.onPlay);
|
||||||
|
this.videoElement.removeEventListener("playing",Video.onPlaying);
|
||||||
|
this.videoElement.removeEventListener("progress",Video.onProgress);
|
||||||
|
this.videoElement.removeEventListener("ratechange",Video.onRatechange);
|
||||||
|
this.videoElement.removeEventListener("seeked",Video.onSeeked);
|
||||||
|
this.videoElement.removeEventListener("seeking",Video.onSeeking);
|
||||||
|
this.videoElement.removeEventListener("stalled",Video.onStalled);
|
||||||
|
this.videoElement.removeEventListener("suspend",Video.onSuspend);
|
||||||
|
this.videoElement.removeEventListener("timeupdate",Video.onTimeupdate);
|
||||||
|
this.videoElement.removeEventListener("volumechange",Video.onVolumechange);
|
||||||
|
this.videoElement.removeEventListener("waiting",Video.onWaiting);
|
||||||
|
this.videoElement.removeEventListener("ended",this.onPlayComplete);
|
||||||
|
this.pause();
|
||||||
|
this.videoElement=null;
|
||||||
|
}
|
||||||
|
|
||||||
|
__proto.syncVideoPosition=function(){
|
||||||
|
var stage=Laya.stage;
|
||||||
|
var rec;
|
||||||
|
rec=Utils.getGlobalPosAndScale(this);
|
||||||
|
var a=stage._canvasTransform.a,d=stage._canvasTransform.d;
|
||||||
|
var x=rec.x *stage.clientScaleX *a+stage.offset.x;
|
||||||
|
var y=rec.y *stage.clientScaleY *d+stage.offset.y;
|
||||||
|
this.videoElement.style.left=x+'px';;
|
||||||
|
this.videoElement.style.top=y+'px';
|
||||||
|
this.videoElement.width=this.width / Browser.pixelRatio;
|
||||||
|
this.videoElement.height=this.height / Browser.pixelRatio;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*buffered 属性返回 TimeRanges(JS)对象。TimeRanges 对象表示用户的音视频缓冲范围。缓冲范围指的是已缓冲音视频的时间范围。如果用户在音视频中跳跃播放,会得到多个缓冲范围。
|
||||||
|
*<p>buffered.length返回缓冲范围个数。如获取第一个缓冲范围则是buffered.start(0)和buffered.end(0)。以秒计。</p>
|
||||||
|
*@return TimeRanges(JS)对象
|
||||||
|
*/
|
||||||
|
__getset(0,__proto,'buffered',function(){
|
||||||
|
return this.videoElement.buffered;
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
*获取视频源尺寸。ready事件触发后可用。
|
||||||
|
*/
|
||||||
|
__getset(0,__proto,'videoWidth',function(){
|
||||||
|
return this.videoElement.videoWidth;
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
*获取当前播放源路径。
|
||||||
|
*/
|
||||||
|
__getset(0,__proto,'currentSrc',function(){
|
||||||
|
return this.videoElement.currentSrc;
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
*设置和获取当前播放头位置。
|
||||||
|
*/
|
||||||
|
__getset(0,__proto,'currentTime',function(){
|
||||||
|
return this.videoElement.currentTime;
|
||||||
|
},function(value){
|
||||||
|
this.videoElement.currentTime=value;
|
||||||
|
this.renderCanvas();
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
*返回音频/视频的播放是否已结束
|
||||||
|
*/
|
||||||
|
__getset(0,__proto,'ended',function(){
|
||||||
|
return this.videoElement.ended;
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
*设置和获取当前音量。
|
||||||
|
*/
|
||||||
|
__getset(0,__proto,'volume',function(){
|
||||||
|
return this.videoElement.volume;
|
||||||
|
},function(value){
|
||||||
|
this.videoElement.volume=value;
|
||||||
|
});
|
||||||
|
|
||||||
|
__getset(0,__proto,'videoHeight',function(){
|
||||||
|
return this.videoElement.videoHeight;
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
*表示视频元素的就绪状态:
|
||||||
|
*<ul>
|
||||||
|
*<li>0=HAVE_NOTHING-没有关于音频/视频是否就绪的信息</li>
|
||||||
|
*<li>1=HAVE_METADATA-关于音频/视频就绪的元数据</li>
|
||||||
|
*<li>2=HAVE_CURRENT_DATA-关于当前播放位置的数据是可用的,但没有足够的数据来播放下一帧/毫秒</li>
|
||||||
|
*<li>3=HAVE_FUTURE_DATA-当前及至少下一帧的数据是可用的</li>
|
||||||
|
*<li>4=HAVE_ENOUGH_DATA-可用数据足以开始播放</li>
|
||||||
|
*</ul>
|
||||||
|
*/
|
||||||
|
__getset(0,__proto,'readyState',function(){
|
||||||
|
return this.videoElement.readyState;
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
*获取视频长度(秒)。ready事件触发后可用。
|
||||||
|
*/
|
||||||
|
__getset(0,__proto,'duration',function(){
|
||||||
|
return this.videoElement.duration;
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
*返回表示音频/视频错误状态的 MediaError(JS)对象。
|
||||||
|
*/
|
||||||
|
__getset(0,__proto,'error',function(){
|
||||||
|
return this.videoElement.error;
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
*设置或返回音频/视频是否应在结束时重新播放。
|
||||||
|
*/
|
||||||
|
__getset(0,__proto,'loop',function(){
|
||||||
|
return this.videoElement.loop;
|
||||||
|
},function(value){
|
||||||
|
this.videoElement.loop=value;
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
*playbackRate 属性设置或返回音频/视频的当前播放速度。如:
|
||||||
|
*<ul>
|
||||||
|
*<li>1.0 正常速度</li>
|
||||||
|
*<li>0.5 半速(更慢)</li>
|
||||||
|
*<li>2.0 倍速(更快)</li>
|
||||||
|
*<li>-1.0 向后,正常速度</li>
|
||||||
|
*<li>-0.5 向后,半速</li>
|
||||||
|
*</ul>
|
||||||
|
*<p>只有 Google Chrome 和 Safari 支持 playbackRate 属性。</p>
|
||||||
|
*/
|
||||||
|
__getset(0,__proto,'playbackRate',function(){
|
||||||
|
return this.videoElement.playbackRate;
|
||||||
|
},function(value){
|
||||||
|
this.videoElement.playbackRate=value;
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
*获取和设置静音状态。
|
||||||
|
*/
|
||||||
|
__getset(0,__proto,'muted',function(){
|
||||||
|
return this.videoElement.muted;
|
||||||
|
},function(value){
|
||||||
|
this.videoElement.muted=value;
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
*返回视频是否暂停
|
||||||
|
*/
|
||||||
|
__getset(0,__proto,'paused',function(){
|
||||||
|
return this.videoElement.paused;
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
*preload 属性设置或返回是否在页面加载后立即加载视频。可赋值如下:
|
||||||
|
*<ul>
|
||||||
|
*<li>auto 指示一旦页面加载,则开始加载视频。</li>
|
||||||
|
*<li>metadata 指示当页面加载后仅加载音频/视频的元数据。</li>
|
||||||
|
*<li>none 指示页面加载后不应加载音频/视频。</li>
|
||||||
|
*</ul>
|
||||||
|
*/
|
||||||
|
__getset(0,__proto,'preload',function(){
|
||||||
|
return this.videoElement.preload;
|
||||||
|
},function(value){
|
||||||
|
this.videoElement.preload=value;
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
*参见 <i>http://www.w3school.com.cn/tags/av_prop_seekable.asp</i>。
|
||||||
|
*/
|
||||||
|
__getset(0,__proto,'seekable',function(){
|
||||||
|
return this.videoElement.seekable;
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
*seeking 属性返回用户目前是否在音频/视频中寻址。
|
||||||
|
*寻址中(Seeking)指的是用户在音频/视频中移动/跳跃到新的位置。
|
||||||
|
*/
|
||||||
|
__getset(0,__proto,'seeking',function(){
|
||||||
|
return this.videoElement.seeking;
|
||||||
|
});
|
||||||
|
|
||||||
|
__getset(0,__proto,'height',_super.prototype._$get_height,function(value){
|
||||||
|
Laya.superSet(Sprite,this,'height',value);
|
||||||
|
if (this.paused)this.renderCanvas();
|
||||||
|
});
|
||||||
|
|
||||||
|
__getset(0,__proto,'width',_super.prototype._$get_width,function(value){
|
||||||
|
this.videoElement.width=this.width / Browser.pixelRatio;
|
||||||
|
Laya.superSet(Sprite,this,'width',value);
|
||||||
|
if (this.paused)this.renderCanvas();
|
||||||
|
});
|
||||||
|
|
||||||
|
Video.onAbort=function(e){e.target.layaTarget.event("abort")}
|
||||||
|
Video.onCanplay=function(e){e.target.layaTarget.event("canplay")}
|
||||||
|
Video.onCanplaythrough=function(e){e.target.layaTarget.event("canplaythrough")}
|
||||||
|
Video.onDurationchange=function(e){e.target.layaTarget.event("durationchange")}
|
||||||
|
Video.onEmptied=function(e){e.target.layaTarget.event("emptied")}
|
||||||
|
Video.onError=function(e){e.target.layaTarget.event("error")}
|
||||||
|
Video.onLoadeddata=function(e){e.target.layaTarget.event("loadeddata")}
|
||||||
|
Video.onLoadedmetadata=function(e){e.target.layaTarget.event("loadedmetadata")}
|
||||||
|
Video.onLoadstart=function(e){e.target.layaTarget.event("loadstart")}
|
||||||
|
Video.onPause=function(e){e.target.layaTarget.event("pause")}
|
||||||
|
Video.onPlay=function(e){e.target.layaTarget.event("play")}
|
||||||
|
Video.onPlaying=function(e){e.target.layaTarget.event("playing")}
|
||||||
|
Video.onProgress=function(e){e.target.layaTarget.event("progress")}
|
||||||
|
Video.onRatechange=function(e){e.target.layaTarget.event("ratechange")}
|
||||||
|
Video.onSeeked=function(e){e.target.layaTarget.event("seeked")}
|
||||||
|
Video.onSeeking=function(e){e.target.layaTarget.event("seeking")}
|
||||||
|
Video.onStalled=function(e){e.target.layaTarget.event("stalled")}
|
||||||
|
Video.onSuspend=function(e){e.target.layaTarget.event("suspend")}
|
||||||
|
Video.onTimeupdate=function(e){e.target.layaTarget.event("timeupdate")}
|
||||||
|
Video.onVolumechange=function(e){e.target.layaTarget.event("volumechange")}
|
||||||
|
Video.onWaiting=function(e){e.target.layaTarget.event("waiting")}
|
||||||
|
Video.MP4=1;
|
||||||
|
Video.OGG=2;
|
||||||
|
Video.CAMERA=4;
|
||||||
|
Video.WEBM=8;
|
||||||
|
Video.SUPPORT_PROBABLY="probably";
|
||||||
|
Video.SUPPORT_MAYBY="maybe";
|
||||||
|
Video.SUPPORT_NO="";
|
||||||
|
return Video;
|
||||||
|
})(Sprite)
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*@private
|
||||||
|
*/
|
||||||
|
//class laya.device.media.HtmlVideo extends laya.resource.Bitmap
|
||||||
|
var HtmlVideo=(function(_super){
|
||||||
|
function HtmlVideo(){
|
||||||
|
this.video=null;
|
||||||
|
HtmlVideo.__super.call(this);
|
||||||
|
this._w=1;
|
||||||
|
this._h=1;
|
||||||
|
this.createDomElement();
|
||||||
|
}
|
||||||
|
|
||||||
|
__class(HtmlVideo,'laya.device.media.HtmlVideo',_super);
|
||||||
|
var __proto=HtmlVideo.prototype;
|
||||||
|
__proto.createDomElement=function(){
|
||||||
|
var _$this=this;
|
||||||
|
this._source=this.video=Browser.createElement("video");
|
||||||
|
var style=this.video.style;
|
||||||
|
style.position='absolute';
|
||||||
|
style.top='0px';
|
||||||
|
style.left='0px';
|
||||||
|
this.video.addEventListener("loadedmetadata",(function(){
|
||||||
|
this._w=_$this.video.videoWidth;
|
||||||
|
this._h=_$this.video.videoHeight;
|
||||||
|
})['bind'](this));
|
||||||
|
}
|
||||||
|
|
||||||
|
__proto.setSource=function(url,extension){
|
||||||
|
while(this.video.childElementCount)
|
||||||
|
this.video.firstChild.remove();
|
||||||
|
if (extension & Video.MP4)
|
||||||
|
this.appendSource(url,"video/mp4");
|
||||||
|
if (extension & Video.OGG)
|
||||||
|
this.appendSource(url+".ogg","video/ogg");
|
||||||
|
}
|
||||||
|
|
||||||
|
__proto.appendSource=function(source,type){
|
||||||
|
var sourceElement=Browser.createElement("source");
|
||||||
|
sourceElement.src=source;
|
||||||
|
sourceElement.type=type;
|
||||||
|
this.video.appendChild(sourceElement);
|
||||||
|
}
|
||||||
|
|
||||||
|
__proto.getVideo=function(){
|
||||||
|
return this.video;
|
||||||
|
}
|
||||||
|
|
||||||
|
HtmlVideo.create=function(){
|
||||||
|
return new HtmlVideo();
|
||||||
|
}
|
||||||
|
|
||||||
|
return HtmlVideo;
|
||||||
|
})(Bitmap)
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*@private
|
||||||
|
*/
|
||||||
|
//class laya.device.media.WebGLVideo extends laya.device.media.HtmlVideo
|
||||||
|
var WebGLVideo=(function(_super){
|
||||||
|
function WebGLVideo(){
|
||||||
|
this.gl=null;
|
||||||
|
this.preTarget=null;
|
||||||
|
this.preTexture=null;
|
||||||
|
WebGLVideo.__super.call(this);
|
||||||
|
if(Browser.onIPhone)
|
||||||
|
return;
|
||||||
|
this.gl=WebGL.mainContext;
|
||||||
|
this._source=this.gl.createTexture();
|
||||||
|
this.preTarget=WebGLContext.curBindTexTarget;
|
||||||
|
this.preTexture=WebGLContext.curBindTexValue;
|
||||||
|
WebGLContext.bindTexture(this.gl,/*laya.webgl.WebGLContext.TEXTURE_2D*/0x0DE1,this._source);
|
||||||
|
this.gl.texParameteri(/*laya.webgl.WebGLContext.TEXTURE_2D*/0x0DE1,/*laya.webgl.WebGLContext.TEXTURE_WRAP_S*/0x2802,/*laya.webgl.WebGLContext.CLAMP_TO_EDGE*/0x812F);
|
||||||
|
this.gl.texParameteri(/*laya.webgl.WebGLContext.TEXTURE_2D*/0x0DE1,/*laya.webgl.WebGLContext.TEXTURE_WRAP_T*/0x2803,/*laya.webgl.WebGLContext.CLAMP_TO_EDGE*/0x812F);
|
||||||
|
this.gl.texParameteri(/*laya.webgl.WebGLContext.TEXTURE_2D*/0x0DE1,/*laya.webgl.WebGLContext.TEXTURE_MAG_FILTER*/0x2800,/*laya.webgl.WebGLContext.LINEAR*/0x2601);
|
||||||
|
this.gl.texParameteri(/*laya.webgl.WebGLContext.TEXTURE_2D*/0x0DE1,/*laya.webgl.WebGLContext.TEXTURE_MIN_FILTER*/0x2801,/*laya.webgl.WebGLContext.LINEAR*/0x2601);
|
||||||
|
(this.preTarget && this.preTexture)&& (WebGLContext.bindTexture(this.gl,this.preTarget,this.preTexture));
|
||||||
|
}
|
||||||
|
|
||||||
|
__class(WebGLVideo,'laya.device.media.WebGLVideo',_super);
|
||||||
|
var __proto=WebGLVideo.prototype;
|
||||||
|
__proto.updateTexture=function(){
|
||||||
|
if(Browser.onIPhone)
|
||||||
|
return;
|
||||||
|
WebGLContext.bindTexture(this.gl,/*laya.webgl.WebGLContext.TEXTURE_2D*/0x0DE1,this._source);
|
||||||
|
this.gl.texImage2D(/*laya.webgl.WebGLContext.TEXTURE_2D*/0x0DE1,0,/*laya.webgl.WebGLContext.RGB*/0x1907,/*laya.webgl.WebGLContext.RGB*/0x1907,/*laya.webgl.WebGLContext.UNSIGNED_BYTE*/0x1401,this.video);
|
||||||
|
}
|
||||||
|
|
||||||
|
return WebGLVideo;
|
||||||
|
})(HtmlVideo)
|
||||||
|
|
||||||
|
|
||||||
|
Laya.__init([Media]);
|
||||||
|
})(window,document,Laya);
|
||||||
|
|
||||||
|
if (typeof define === 'function' && define.amd){
|
||||||
|
define('laya.core', ['require', "exports"], function(require, exports) {
|
||||||
|
'use strict';
|
||||||
|
Object.defineProperty(exports, '__esModule', { value: true });
|
||||||
|
for (var i in Laya) {
|
||||||
|
var o = Laya[i];
|
||||||
|
o && o.__isclass && (exports[i] = o);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||