// handles UI elements for mode switching : shell togglemode public void switchModes() { // use a string we need anyway to track the mode bool fov = _text != fv; //attention, NOT equals here because we are switching text.text = fov ? fv : ls; _text = text.text; toggleMode(fov? "fov" : "laserscan"); //button.SetActive(fov ? true : false); CountText.SetActive(fov ? true : false); Cams.SetActive(fov ? true : false); SpreadSlider.SetActive(!fov ? true : false); CountSlider.SetActive(!fov ? true : false); //LinePanel.SetActive(!fov ? true : false); flipButton.SetActive(!fov ? true : false); obsButton.SetActive(!fov ? true : false); tutorialButton.SetActive(!fov ? true : false); LaserLinesToggle.SetActive(!fov ? true : false); // turn graph on in laserscan mode, off in fov mode if (fov && LinePanel.activeSelf || !fov && !LinePanel.activeSelf) { toggleGraph(); } }
public void leaveLSC(Client player) { API.sendNativeToPlayer(player, Hash.DO_SCREEN_FADE_OUT, 1); API.sendNativeToPlayer(player, Hash.DO_SCREEN_FADE_IN, 1000); API.triggerClientEvent(player, "kill_camera", new Vector3(-335.06, -134.72, 39.67)); player.vehicle.freezePosition = false; DimensionManager.DismissPrivateDimension(player); player.dimension = 0; player.vehicle.dimension = 0; Cams.clearCameras(player); }
public void leaveLSC(Client player) { API.sendNativeToPlayer(player, Hash.DO_SCREEN_FADE_OUT, 1); API.sendNativeToPlayer(player, Hash.DO_SCREEN_FADE_IN, 1000); API.triggerClientEvent(player, "kill_camera", new Vector3(-335.06, -134.72, 39.67)); player.vehicle.position = new Vector3(-361.3611, -113.6485, 38.2084); player.vehicle.rotation = new Vector3(0.008012898, -0.0270533, 72.70694); player.vehicle.freezePosition = false; DimensionManager.DismissPrivateDimension(player); player.dimension = 0; player.vehicle.dimension = 0; Cams.clearCameras(player); }
public void SetCam(Cams cam) { if (this.enabled) { if (cam == Cams.defaultCamEnum) { SetCam(defaultCam); } if (cam == Cams.environmentCrashLeftEnum) { SetCam(environmentCrashLeft); } if (cam == Cams.environmentCrashCentreEnum) { SetCam(environmentCrashCentre); } if (cam == Cams.environmentCrashRightEnum) { SetCam(environmentCrashRight); } if (cam == Cams.environmentWarning1LeftEnum) { SetCam(environmentWarning1Left); } if (cam == Cams.environmentWarning1CentreEnum) { SetCam(environmentWarning1Centre); } if (cam == Cams.environmentWarning1RightEnum) { SetCam(environmentWarning1Right); } if (cam == Cams.carCrashBackLeftEnum) { SetCam(carCrashBackLeft); } if (cam == Cams.carCrashBackRightEnum) { SetCam(carCrashBackRight); } if (cam == Cams.carCrashFrontLeftEnum) { SetCam(carCrashFrontLeft); } if (cam == Cams.carCrashFrontRightEnum) { SetCam(carCrashFrontRight); } } }
private void EnterColshape(ColShape colshape, NetHandle entity) { if (colshape.hasData("LSC")) { var player = API.getPlayerFromHandle(entity); if (player == null) { return; } if (!player.isInVehicle) { return; } if (player.vehicleSeat != -1) { return; } else { API.sendNativeToPlayer(player, Hash.DO_SCREEN_FADE_OUT, 200); Task t = Task.Run(() => getVehicleModSlots(player, player.vehicle)); int dimension = DimensionManager.RequestPrivateDimension(player); player.dimension = dimension; player.vehicle.dimension = dimension; Cams.createCameraAtGamecam(player); API.delay(3000, true, () => { API.sendNativeToPlayer(player, Hash.DO_SCREEN_FADE_IN, 200); if (t.IsCompleted) { //API.triggerClientEvent(player, "activate_camera", new Vector3(-335.06, -134.72, 39.67)); player.vehicle.position = new Vector3(-338.24, -136.36, 38.66); player.vehicle.rotation = new Vector3(0, 0, -108); player.vehicle.freezePosition = true; Cams.createCameraActive(player, new Vector3(-335.06, -134.72, 39.67), new Vector3(0, 0, 0)); Cams.pointCameraAtLocalPlayer(player, 1, new Vector3(0, 0, 0)); // Cams.interpolateCamera(player, 1, 1000, true, true); menuRoot(player, player.vehicle); } }); } } }
// the function which en/disables the whole UI, uses _text to test mode so as not to turn on the wrong buttons public void toggleUI() { uiActive = !uiActive; // use a string we need anyway to track the mode bool fov = _text == fv; //attention, equals here because we are returning modeText.SetActive(uiActive); modeButton.SetActive(uiActive); FoVButton.SetActive(uiActive); CountText.SetActive(fov && uiActive ? true : false); Cams.SetActive(fov && uiActive ? true : false); SpreadSlider.SetActive(!fov && uiActive ? true : false); CountSlider.SetActive(!fov && uiActive ? true : false); flipButton.SetActive(!fov && uiActive ? true : false); obsButton.SetActive(!fov && uiActive ? true : false); tutorialButton.SetActive(!fov && uiActive ? true : false); LaserLinesToggle.SetActive(!fov && uiActive ? true : false); //LinePanel.SetActive(!fov && uiActive ? true : false); }
internal Vector3 GetMousePosition(Cams cam) { Vector3 mousePos = new Vector3(0,0); switch(cam) { case Cams.Main: mousePos = MainCamera.ScreenPointToRay(Input.mousePosition).origin; break; case Cams.Menu: mousePos = MenuCamera.ScreenPointToRay(Input.mousePosition).origin; break; } return mousePos; }
internal RaycastHit[] GetHitObjects(Cams cam) { Ray ray = new Ray(); switch (cam) { case (Cams.Main): ray = MainCamera.ScreenPointToRay(Input.mousePosition); break; case (Cams.Menu): ray = MenuCamera.ScreenPointToRay(Input.mousePosition); break; } RaycastHit[] hitArray; hitArray = Physics.RaycastAll(ray); return hitArray; }