shipPOVCameraController.py (2341B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\camera\shipPOVCameraController.py 2 from eve.client.script.ui.camera.cameraUtil import SetShipDirection, GetZoomDz 3 from eve.client.script.ui.camera.baseCameraController import BaseCameraController 4 import carbonui.const as uiconst 5 import evecamera 6 from carbonui.uicore import uicore 7 FOV_LEVELS = [1.0, 0.625, 0.25] 8 9 class ShipPOVCameraController(BaseCameraController): 10 cameraID = evecamera.CAM_SHIPPOV 11 12 def __init__(self): 13 BaseCameraController.__init__(self) 14 self.fovLevel = 0 15 self.dzAccumulated = 0 16 self.GetCamera().fov = FOV_LEVELS[self.fovLevel] 17 18 def OnMouseMove(self, *args): 19 if uicore.uilib.leftbtn: 20 k = 0.002 * self.GetCamera().fov 21 self.GetCamera().Rotate(k * self.GetMouseDX(), k * self.GetMouseDY()) 22 23 def OnMouseWheel(self, *args): 24 camera = self.GetCamera() 25 dz = GetZoomDz() 26 self.dzAccumulated += dz 27 if self.dzAccumulated < -120: 28 dz = -1 29 self.dzAccumulated = 0 30 elif self.dzAccumulated > 120: 31 dz = 1 32 self.dzAccumulated = 0 33 else: 34 return 35 if dz < 0: 36 if self.fovLevel == len(FOV_LEVELS) - 1: 37 return 38 self._ChangeFov(1) 39 elif self.fovLevel > 0: 40 self._ChangeFov(-1) 41 42 def _ChangeFov(self, fovLevelDiff): 43 self.fovLevel += fovLevelDiff 44 sm.GetService('audio').SendUIEvent('ship_interior_cam_zoom_play') 45 fov = FOV_LEVELS[self.fovLevel] 46 camera = self.GetCamera() 47 uicore.animations.MorphScalar(camera, 'fov', camera.fov, fov, duration=0.35, curveType=uiconst.ANIM_OVERSHOT) 48 49 def OnDblClick(self, *args): 50 if uicore.uilib.rightbtn or uicore.uilib.mouseTravel > 6: 51 return 52 SetShipDirection(self.GetCamera()) 53 54 def OnMouseDown(self, button, *args): 55 ret = BaseCameraController.OnMouseDown(self, button, *args) 56 if button == 0: 57 uicore.event.RegisterForTriuiEvents(uiconst.UI_MOUSEUP, self.OnGlobalRightMouseUp) 58 return ret 59 60 def OnGlobalRightMouseUp(self, obj, eventID, param): 61 vkey, flag = param 62 if vkey != 0: 63 return True 64 self.GetCamera().ResetRotate()