index.js 12 KB

1234567891011121314151617181920212223242526
  1. System.register("chunks:///_virtual/MouseMoveCamera.ts",["./_rollupPluginModLoBabelHelpers.js","cc"],(function(o){"use strict";var e,n,t,i,s,c,r,u,l,a,f,h,p;return{setters:[function(o){e=o.applyDecoratedDescriptor,n=o.inheritsLoose,t=o.initializerDefineProperty,i=o.assertThisInitialized},function(o){s=o.cclegacy,c=o._decorator,r=o.math,u=o.Node,l=o.UITransform,a=o.systemEvent,f=o.SystemEventType,h=o.macro,p=o.Component}],execute:function(){var y,E,m,g,_,U,M;s._RF.push({},"56a49UHlh1Efpm7PoqaoX/L","MouseMoveCamera",void 0);var v=c.ccclass,O=c.property;r.Vec2,r.Vec3,r.Quat,o("MouseMoveCamera",(y=v("MouseMoveCamera"),E=O({type:u}),m=O({type:l}),y((U=e((_=function(o){function e(){for(var e,n=arguments.length,s=new Array(n),c=0;c<n;c++)s[c]=arguments[c];return e=o.call.apply(o,[this].concat(s))||this,t(e,"goNode",U,i(e)),t(e,"uiTransform",M,i(e)),e}n(e,o);var s=e.prototype;return s.onLoad=function(){a.on(f.KEY_DOWN,this.onKeyDown,this),a.on(f.KEY_UP,this.onKeyUp,this),a.on(f.MOUSE_DOWN,(function(o){console.log("mouse down")}),this),a.on(f.MOUSE_ENTER,(function(o){console.log("mouse enter")}),this),a.on(f.MOUSE_LEAVE,(function(o){console.log("mouse leave")}),this),a.on(f.MOUSE_MOVE,(function(o){console.log("mouse move")}),this),a.on(f.MOUSE_UP,(function(o){console.log("mouse up")}),this),a.on(f.MOUSE_WHEEL,(function(o){console.log("mouse wheel")}),this),a.on(f.TOUCH_MOVE,(function(o){console.log("touch move")}),this),a.on(f.TOUCH_START,(function(o){console.log("touch start")}),this),a.on(f.TOUCH_END,(function(o){console.log("touch end")}),this),a.on(f.TOUCH_CANCEL,(function(o){console.log("touch cancel")}),this)},s.onDestroy=function(){a.off(f.KEY_DOWN,this.onKeyDown,this),a.off(f.KEY_UP,this.onKeyUp,this)},s.onKeyDown=function(o){switch(o.keyCode){case h.KEY.a:console.log("Press a key")}},s.onKeyUp=function(o){switch(o.keyCode){case h.KEY.a:console.log("Release a key")}},s.update=function(o){},e}(p)).prototype,"goNode",[E],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),M=e(_.prototype,"uiTransform",[m],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),g=_))||g));s._RF.pop()}}}));
  2. System.register("chunks:///_virtual/FrontLabel.ts",["./_rollupPluginModLoBabelHelpers.js","cc"],(function(e){"use strict";var t,i,n,o,r,a,l,s,c,u;return{setters:[function(e){t=e.applyDecoratedDescriptor,i=e.inheritsLoose,n=e.initializerDefineProperty,o=e.assertThisInitialized},function(e){r=e.cclegacy,a=e._decorator,l=e.geometry,s=e.Node,c=e.Vec3,u=e.Component}],execute:function(){var p,h,f,m,d,y,b,g,w,z,L,M,_;r._RF.push({},"63f0f2Yq81LNZ+dqJR5cnNA","FrontLabel",void 0);var v=a.ccclass,x=a.property;l.ray,e("FrontLabel",(p=v("FrontLabel"),h=x({type:s}),f=x({type:s}),m=x(),d=x(),y=x(),p((w=t((g=function(e){function t(){for(var t,i=arguments.length,r=new Array(i),a=0;a<i;a++)r[a]=arguments[a];return t=e.call.apply(e,[this].concat(r))||this,n(t,"camera_3d",w,o(t)),n(t,"model",z,o(t)),n(t,"isLookAtCam",L,o(t)),n(t,"isCanClick",M,o(t)),n(t,"websiteUrl",_,o(t)),t}i(t,e);var r=t.prototype;return r.onLoad=function(){},r.start=function(){},r.update=function(){if(this.camera_3d&&this.model&&this.isLookAtCam){var e=new c(this.camera_3d.getPosition().x-this.model.getPosition().x,0,this.camera_3d.getPosition().z-this.model.getPosition().z),t=this.getDistance(new c(0,0,0),e),i=new c(0,0,-1),n=(e.x*i.x+e.y*i.y+e.z*i.z)/t;e.x*i.z-e.z*i.x>0?this.node.setRotationFromEuler(0,180*-Math.acos(-n)/Math.PI,0):this.node.setRotationFromEuler(0,180*Math.acos(-n)/Math.PI,0)}},r.OnClickEvent=function(){console.log(this.node.name),window.parent.postMessage({type:"toScene",key:this.node.name},"*")},r.getDistance=function(e,t){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2)+Math.pow(t.z-e.z,2))},t}(u)).prototype,"camera_3d",[h],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),z=t(g.prototype,"model",[f],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),L=t(g.prototype,"isLookAtCam",[m],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),M=t(g.prototype,"isCanClick",[d],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!1}}),_=t(g.prototype,"websiteUrl",[y],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return""}}),b=g))||b));r._RF.pop()}}}));
  3. System.register("chunks:///_virtual/typescript.ts",["./_rollupPluginModLoBabelHelpers.js","cc","./FrontLabel.ts"],(function(e){"use strict";var t,i,n,o,s,a,r,l,g,c,h,u,m,d,F,p,P,f,y,Y;return{setters:[function(e){t=e.applyDecoratedDescriptor,i=e.inheritsLoose,n=e.initializerDefineProperty,o=e.assertThisInitialized},function(e){s=e.cclegacy,a=e._decorator,r=e.Node,l=e.CCInteger,g=e.systemEvent,c=e.SystemEventType,h=e.Layers,u=e.game,m=e.Vec2,d=e.geometry,F=e.CameraComponent,p=e.math,P=e.Vec3,f=e.PhysicsSystem,y=e.Component},function(e){Y=e.FrontLabel}],execute:function(){var S,v,M,x,C,w,_,D,L,E;e("Axis",void 0),s._RF.push({},"db84aBtpFpEGq0hVnSgIqtJ","typescript",void 0);var b,I=a.ccclass,O=a.property;!function(e){e[e.PositiveX=0]="PositiveX",e[e.PositiveY=1]="PositiveY",e[e.NegativeX=2]="NegativeX",e[e.NegativeY=3]="NegativeY"}(b||(b=e("Axis",{})));e("Typescript",(S=I("Typescript"),v=O({type:r,tooltip:"围绕旋转的目标"}),M=O({type:l,tooltip:"手指移动控制模型移动的速度"}),x=O({type:l,tooltip:"模型移动的速度最大值"}),S((_=t((w=function(e){function t(){for(var t,i=arguments.length,s=new Array(i),a=0;a<i;a++)s[a]=arguments[a];return t=e.call.apply(e,[this].concat(s))||this,n(t,"target",_,o(t)),t.camera_3d=null,n(t,"radius",D,o(t)),t.angle=45,t.angleY=90,t.anglePerFrame=6,t.anglePerFrameY=0,t.ray=new d.Ray,t.mouseX=0,t.mouseY=0,t.mouseScrollY=0,t.maxScroll=300,t.minScroll=50,t.firstStart=!0,t.oneFinger=-1,t.twoFinger=-1,t.oneFingerPosition=new m,t.twoFingerPosition=new m,t.distance=0,n(t,"speed",L,o(t)),n(t,"maxSpeed",E,o(t)),t.isMultiFinger=!1,t}i(t,e);var s=t.prototype;return s.onLoad=function(){var e=this;g.on(c.MOUSE_MOVE,(function(t){e.mouseX=t.getLocationX(),e.mouseY=t.getLocationY(),e.camera_3d&&e.rayCheck(e.ray,e.camera_3d,e.mouseX,e.mouseY,(function(e){e.collider.node.layer==h.Enum.UI_3D&&null!=u.canvas&&"pointer"!=u.canvas.style.cursor&&(u.canvas.style.cursor="pointer")}),(function(){null!=u.canvas&&"default"!=u.canvas.style.cursor&&(u.canvas.style.cursor="default")}))}),this),g.on(c.MOUSE_DOWN,(function(t){g.off(c.TOUCH_START),e.mouseX=t.getLocationX(),e.mouseY=t.getLocationY(),e.camera_3d&&e.rayCheck(e.ray,e.camera_3d,e.mouseX,e.mouseY,(function(e){if(e.collider.node.layer==h.Enum.UI_3D){var t=e.collider.getComponent(Y);(null==t?void 0:t.isCanClick)&&(null==t||t.OnClickEvent())}}))}),this),g.on(c.TOUCH_START,(function(t){if(-1!=e.oneFinger&&e.oneFinger!=t.getID())e.twoFinger=t.getID(),e.twoFingerPosition=t.getLocation(),e.distance=m.distance(e.oneFingerPosition,e.twoFingerPosition);else if(-1!=e.twoFinger&&e.oneFinger!=t.getID())e.oneFinger=t.getID(),e.oneFingerPosition=t.getLocation(),e.distance=m.distance(e.oneFingerPosition,e.twoFingerPosition);else{if(e.oneFinger=t.getID(),e.oneFingerPosition=t.getLocation(),e.mouseX=t.getLocationX(),e.mouseY=t.getLocationY(),!e.camera_3d)return;e.rayCheck(e.ray,e.camera_3d,e.mouseX,e.mouseY,(function(e){if(e.collider.node.layer==h.Enum.UI_3D){var t=e.collider.getComponent(Y);(null==t?void 0:t.isCanClick)&&(null==t||t.OnClickEvent())}}))}}),this),g.on(c.TOUCH_END,(function(t){t.getID()==e.oneFinger?e.oneFinger=-1:t.getID()==e.twoFinger&&(e.twoFinger=-1)}),this),g.on(c.TOUCH_MOVE,(function(t){-1!=e.oneFinger&&-1!=e.twoFinger?(e.isMultiFinger=!0,e.oneFinger==t.getID()&&(e.oneFingerPosition=t.getLocation()),e.twoFinger==t.getID()&&(e.twoFingerPosition=t.getLocation()),e.setMultiFingerScale()):(e.isMultiFinger=!1,e.anglePerFrame=t.getDelta().x/(10/e.speed),e.anglePerFrameY=t.getDelta().y/(10/e.speed))}),this),g.on(c.MOUSE_WHEEL,(function(t){e.mouseScrollY=t.getScrollY()}),this)},s.start=function(){this.run(),this.ray=new d.Ray,this.camera_3d=this.getComponent(F)},s.FixedUpdate=function(){},s.update=function(e){this.startFunc(),-1==this.oneFinger&&-1==this.twoFinger&&(this.isMultiFinger=!1),this.mouseScrollFunc(),this.setCamPostion(),this.LimitMaxSpeed(),this.LimitYMove(),this.SpeedDamping(e),this.ResetAngle()},s.onDestroy=function(){g.off(c.TOUCH_MOVE),g.off(c.MOUSE_MOVE)},s.setMultiFingerScale=function(){var e=m.distance(this.oneFingerPosition,this.twoFingerPosition);this.radius=this.radius/(e/this.distance),this.distance=e,this.radius=p.clamp(this.radius,this.minScroll,this.maxScroll)},s.setCamPostion=function(){if(this.target){var e=Math.PI/180*this.angle,t=Math.PI/180*this.angleY,i=this.target.getPosition().z+this.radius*Math.cos(t),n=this.target.getPosition().y+this.radius*Math.sin(t),o=this.target.getPosition().x+Math.abs(i-this.target.getPosition().z)*Math.cos(e),s=this.target.getPosition().z+Math.abs(i-this.target.getPosition().z)*Math.sin(e);this.node.setPosition(o,n,s),this.node.lookAt(this.target.getPosition(),P.UP)}},s.startFunc=function(){this.firstStart&&this.anglePerFrame<=3&&(this.firstStart=!1,this.anglePerFrameY=2.5)},s.rayCheck=function(e,t,i,n,o,s){e&&(t.screenPointToRay(i,n,e),f.instance.raycastClosest(e)?o(f.instance.raycastClosestResult):null!=s&&s())},s.LimitMaxSpeed=function(){this.anglePerFrame>this.maxSpeed&&(this.anglePerFrame=this.maxSpeed),this.anglePerFrameY>this.maxSpeed&&(this.anglePerFrameY=this.maxSpeed),this.anglePerFrame<-this.maxSpeed&&(this.anglePerFrame=-this.maxSpeed),this.anglePerFrameY<-this.maxSpeed&&(this.anglePerFrameY=-this.maxSpeed),this.angle+=this.anglePerFrame},s.mouseScrollFunc=function(){this.mouseScrollY>0?(this.mouseScrollY=0,this.radius-=20,this.radius=p.clamp(this.radius,this.minScroll,this.maxScroll)):this.mouseScrollY<0&&(this.mouseScrollY=0,this.radius+=20,this.radius=p.clamp(this.radius,this.minScroll,this.maxScroll))},s.LimitYMove=function(){this.node.getPosition().y>=this.radius-.05*this.radius?this.anglePerFrameY<=0||(this.angleY+=this.anglePerFrameY):this.node.getPosition().y<=.2*this.radius&&this.anglePerFrameY>=0||(this.angleY+=this.anglePerFrameY)},s.SpeedDamping=function(e){this.anglePerFrame>.1?this.anglePerFrame-=.08:this.anglePerFrame<-.1?this.anglePerFrame+=.08:this.anglePerFrame=0,this.anglePerFrameY>.1?this.anglePerFrameY-=.08:this.anglePerFrameY<-.1?this.anglePerFrameY+=.08:this.anglePerFrameY=0},s.ResetAngle=function(){this.angle>=360?this.angle%=360:this.angle<=-360&&(this.angle%=-360),this.angleY>=360?this.angleY%=360:this.angleY<=-360&&(this.angleY%=-360)},s.run=function(e){e&&(this.target=e),this.target||console.log("No target!")},s.getAngle=function(e,t){return t.x-e.x==0?t.z>e.z?90:-90:Math.atan(t.y-e.y/t.x-e.x)},s.getDistance=function(e,t){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2)+Math.pow(t.z-e.z,2))},t}(y)).prototype,"target",[v],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),D=t(w.prototype,"radius",[O],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),L=t(w.prototype,"speed",[M,O],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),E=t(w.prototype,"maxSpeed",[x],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 5}}),C=w))||C));s._RF.pop()}}}));
  4. System.register("chunks:///_virtual/main",["./MouseMoveCamera.ts","./FrontLabel.ts","./typescript.ts"],(function(){"use strict";return{setters:[null,null,null],execute:function(){}}}));
  5. (function(r) {
  6. r('virtual:///prerequisite-imports/main', 'chunks:///_virtual/main');
  7. })(function(mid, cid) {
  8. System.register(mid, [cid], function (_export, _context) {
  9. return {
  10. setters: [function(_m) {
  11. var _exportObj = {};
  12. for (var _key in _m) {
  13. if (_key !== "default" && _key !== "__esModule") _exportObj[_key] = _m[_key];
  14. }
  15. _export(_exportObj);
  16. }],
  17. execute: function () { }
  18. };
  19. });
  20. });