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

hangarCameraController.py (2674B)


      1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\camera\hangarCameraController.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 HangarCameraController(BaseCameraController):
     11     cameraID = evecamera.CAM_HANGAR
     12     enablePickTransparent = True
     13 
     14     def __init__(self):
     15         BaseCameraController.__init__(self)
     16         self.isRotating = False
     17 
     18     def OnMouseMove(self, *args):
     19         camera = self.GetCamera()
     20         kOrbit = evecamera.ORBIT_MOVE_DIST
     21         if uicore.uilib.leftbtn and uicore.uilib.rightbtn:
     22             kZoom = 0.005
     23             self._Zoom(-self.GetMouseDY(), kZoom)
     24             if math.fabs(self.GetMouseDX()) > 1:
     25                 if self.IsCameraRotated():
     26                     camera.Rotate(0.01 * self.GetMouseDX(), 0.0)
     27                 else:
     28                     camera.Orbit(0.01 * self.GetMouseDX(), 0.0)
     29         elif uicore.uilib.leftbtn:
     30             camera.Orbit(kOrbit * self.GetMouseDX(), kOrbit * self.GetMouseDY())
     31         elif uicore.uilib.rightbtn and self.isRotating:
     32             kRotate = 0.005 * camera.fov
     33             camera.Rotate(kRotate * self.GetMouseDX(), kRotate * self.GetMouseDY())
     34 
     35     def OnMouseWheel(self, *args):
     36         k = 0.0005
     37         self._Zoom(uicore.uilib.dz, k)
     38 
     39     def GetAreaName(self, areaID):
     40         if areaID == TRINITY_PICKABLE_HANGARVIEO_BUFFER_ID:
     41             return 'billboard'
     42         else:
     43             return BaseCameraController.GetAreaName(self, areaID)
     44 
     45     def _Zoom(self, dz, k):
     46         camera = self.GetCamera()
     47         dz = CheckInvertZoom(dz)
     48         dz = GetPowerOfWithSign(dz)
     49         if uicore.uilib.Key(uiconst.VK_MENU) or self.IsCameraRotated():
     50             camera.FovZoom(k * dz)
     51         else:
     52             camera.Zoom(k * dz)
     53 
     54     def OnGlobalRightMouseUp(self, obj, eventID, param):
     55         vkey, flag = param
     56         if vkey != 1:
     57             return True
     58         camera = self.GetCamera()
     59         camera.ResetRotate()
     60         camera.ResetFOV()
     61         self.isRotating = False
     62 
     63     def OnMouseDown(self, button, *args):
     64         ret = BaseCameraController.OnMouseDown(self, button, *args)
     65         if button == 1:
     66             self.isRotating = True
     67             uicore.event.RegisterForTriuiEvents(uiconst.UI_MOUSEUP, self.OnGlobalRightMouseUp)
     68         return ret
     69 
     70     def IsCameraRotated(self):
     71         return uicore.uilib.rightbtn and self.GetCamera().IsRotated()