NovaBryan/EVE_Dump
Log | Files | 📦 下载最新源码 (.zip) | Refs | README

modularHangarCameraController.py (3720B)


      1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\camera\modularHangarCameraController.py
      2 import evecamera
      3 import math
      4 from eve.client.script.ui.camera.baseCameraController import BaseCameraController
      5 from eve.client.script.ui.camera.cameraUtil import CheckInvertZoom, GetPowerOfWithSign
      6 import carbonui.const as uiconst
      7 from carbonui.uicore import uicore
      8 TRINITY_PICKABLE_HANGARVIEO_BUFFER_ID = 100
      9 
     10 class ModularHangarCameraController(BaseCameraController):
     11     cameraID = evecamera.CAM_MODULARHANGAR
     12     enablePickTransparent = True
     13 
     14     def __init__(self):
     15         BaseCameraController.__init__(self)
     16         self.isRotating = False
     17         self.isTraveling = False
     18 
     19     def OnMouseMove(self, *args):
     20         camera = self.GetCamera()
     21         kOrbit = evecamera.ORBIT_MOVE_DIST
     22         if uicore.uilib.leftbtn and uicore.uilib.rightbtn:
     23             kZoom = 0.005
     24             self._Zoom(-self.GetMouseDY(), kZoom)
     25             if math.fabs(self.GetMouseDX()) > 1:
     26                 if self.IsCameraRotated():
     27                     camera.Rotate(0.01 * self.GetMouseDX(), 0.0)
     28                 else:
     29                     camera.Orbit(0.01 * self.GetMouseDX(), 0.0)
     30         elif uicore.uilib.leftbtn:
     31             if self.isRotating:
     32                 kRotate = 0.005 * camera.fov
     33                 camera.Rotate(kRotate * self.GetMouseDX(), kRotate * self.GetMouseDY())
     34                 if not camera.GetIsChangingShip():
     35                     camera.ResetRotate()
     36                     camera.ResetFOV()
     37                     camera.SetRotating(False)
     38                     self.isRotating = False
     39             else:
     40                 camera.Orbit(kOrbit * self.GetMouseDX(), kOrbit * self.GetMouseDY())
     41         elif uicore.uilib.rightbtn and self.isRotating:
     42             kRotate = 0.005 * camera.fov
     43             camera.Rotate(kRotate * self.GetMouseDX(), kRotate * self.GetMouseDY())
     44 
     45     def OnMouseWheel(self, *args):
     46         k = 0.0005
     47         self._Zoom(uicore.uilib.dz, k)
     48 
     49     def GetAreaName(self, areaID):
     50         if areaID == TRINITY_PICKABLE_HANGARVIEO_BUFFER_ID:
     51             return 'billboard'
     52         else:
     53             return BaseCameraController.GetAreaName(self, areaID)
     54 
     55     def _Zoom(self, dz, k):
     56         camera = self.GetCamera()
     57         dz = CheckInvertZoom(dz)
     58         dz = GetPowerOfWithSign(dz)
     59         if uicore.uilib.Key(uiconst.VK_MENU) or self.IsCameraRotated():
     60             camera.FovZoom(k * dz)
     61         else:
     62             camera.Zoom(k * dz)
     63 
     64     def OnGlobalRightMouseUp(self, obj, eventID, param):
     65         vkey, flag = param
     66         if vkey != 1:
     67             return True
     68         camera = self.GetCamera()
     69         camera.ResetRotate()
     70         camera.ResetFOV()
     71         camera.SetRotating(False)
     72         self.isRotating = False
     73 
     74     def OnMouseDown(self, button, *args):
     75         ret = BaseCameraController.OnMouseDown(self, button, *args)
     76         camera = self.GetCamera()
     77         if camera.GetIsChangingShip():
     78             self.isRotating = True
     79             camera.SetRotating(True)
     80         if button == 1:
     81             self.isRotating = True
     82             camera = self.GetCamera()
     83             camera.SetRotating(True)
     84             uicore.event.RegisterForTriuiEvents(uiconst.UI_MOUSEUP, self.OnGlobalRightMouseUp)
     85         return ret
     86 
     87     def OnMouseUp(self, button, *args):
     88         BaseCameraController.OnMouseUp(self, button, *args)
     89         camera = self.GetCamera()
     90         if self.isRotating and camera.GetIsChangingShip():
     91             camera.ResetRotate()
     92             camera.ResetFOV()
     93             camera.SetRotating(False)
     94             self.isRotating = False
     95 
     96     def IsCameraRotated(self):
     97         return uicore.uilib.rightbtn and self.GetCamera().IsRotated()