public void Init(IBIWOutlinerController outlinerController, IBIWInputHandler inputHandler, IBIWInputWrapper inputWrapper, IBIWPublishController publishController, IBIWCreatorController creatorController, IBIWModeController modeController, IBIWFloorHandler floorHandler, IBIWEntityHandler entityHandler, IBIWActionController actionController, IBIWSaveController saveController, IBIWRaycastController raycastController, IBIWGizmosController gizmosController, InitialSceneReferences sceneReferences) { projectReferencesAsset = Resources.Load <BIWProjectReferences>(PROJECT_REFERENCES_PATH); godModeDynamicVariablesAsset = Resources.Load <BIWGodModeDynamicVariables>(GOD_MODE_DYNAMIC_VARIABLE_PATH); firstPersonDynamicVariablesAsset = Resources.Load <BIWFirstPersonDynamicVariables>(FIRST_PERSON_DYNAMIC_VARIABLE_PATH); inputsReferencesAsset = Resources.Load <BIWInputsReferences>(INPUTS_PATH); this.outlinerController = outlinerController; this.inputHandler = inputHandler; this.inputWrapper = inputWrapper; this.publishController = publishController; this.creatorController = creatorController; this.modeController = modeController; this.floorHandler = floorHandler; this.entityHandler = entityHandler; this.actionController = actionController; this.saveController = saveController; this.raycastController = raycastController; this.gizmosController = gizmosController; this.sceneReferences = sceneReferences; }
public override void Init(BIWContext context) { base.Init(context); lookAtT = new GameObject("BIWGodModeTransform").transform; maxDistanceToSelectEntitiesValue = context.godModeDynamicVariablesAsset.maxDistanceToSelectEntities; snapFactor = context.godModeDynamicVariablesAsset.snapFactor; snapRotationDegresFactor = context.godModeDynamicVariablesAsset.snapRotationDegresFactor; snapScaleFactor = context.godModeDynamicVariablesAsset.snapScaleFactor; snapDistanceToActivateMovement = context.godModeDynamicVariablesAsset.snapDistanceToActivateMovement; initialEagleCameraHeight = context.godModeDynamicVariablesAsset.initialEagleCameraHeight; initialEagleCameraDistance = context.godModeDynamicVariablesAsset.initialEagleCameraDistance; initialEagleCameraLookAtHeight = context.godModeDynamicVariablesAsset.initialEagleCameraLookAtHeight; snapDragFactor = context.godModeDynamicVariablesAsset.snapDragFactor; outlinerController = context.outlinerController; gizmoManager = context.gizmosController; if (HUDController.i.builderInWorldMainHud != null) { HUDController.i.builderInWorldMainHud.OnTranslateSelectedAction += TranslateMode; HUDController.i.builderInWorldMainHud.OnRotateSelectedAction += RotateMode; HUDController.i.builderInWorldMainHud.OnScaleSelectedAction += ScaleMode; HUDController.i.builderInWorldMainHud.OnSelectedObjectPositionChange += UpdateSelectionPosition; HUDController.i.builderInWorldMainHud.OnSelectedObjectRotationChange += UpdateSelectionRotation; HUDController.i.builderInWorldMainHud.OnSelectedObjectScaleChange += UpdateSelectionScale; HUDController.i.builderInWorldMainHud.OnResetCameraAction += ResetCamera; HUDController.i.builderInWorldMainHud.OnPublishAction += TakeSceneScreenshotForPublish; } if (context.sceneReferences.cameraController.TryGetCameraStateByType <FreeCameraMovement>(out CameraStateBase cameraState)) { freeCameraController = (FreeCameraMovement)cameraState; } mouseCatcher = context.sceneReferences.mouseCatcher; avatarRenderer = context.sceneReferences.playerAvatarController; cameraController = context.sceneReferences.cameraController; BIWInputWrapper.OnMouseDown += OnInputMouseDown; BIWInputWrapper.OnMouseUp += OnInputMouseUp; BIWInputWrapper.OnMouseUpOnUI += OnInputMouseUpOnUi; BIWInputWrapper.OnMouseDrag += OnInputMouseDrag; focusOnSelectedEntitiesInputAction = context.inputsReferencesAsset.focusOnSelectedEntitiesInputAction; multiSelectionInputAction = context.inputsReferencesAsset.multiSelectionInputAction; focusOnSelectedEntitiesInputAction.OnTriggered += (o) => FocusOnSelectedEntitiesInput(); multiSelectionInputAction.OnStarted += (o) => ChangeSnapTemporaryActivated(); multiSelectionInputAction.OnFinished += (o) => ChangeSnapTemporaryDeactivated(); gizmoManager.OnChangeTransformValue += EntitiesTransfromByGizmos; gizmoManager.OnGizmoTransformObjectEnd += OnGizmosTransformEnd; gizmoManager.OnGizmoTransformObjectStart += OnGizmosTransformStart; }
public override void Init(BIWContext context) { base.Init(context); if (HUDController.i.builderInWorldMainHud != null) { hudController = HUDController.i.builderInWorldMainHud; hudController.OnEntityDelete += DeleteSingleEntity; hudController.OnDuplicateSelectedAction += DuplicateSelectedEntitiesInput; hudController.OnDeleteSelectedAction += DeleteSelectedEntitiesInput; hudController.OnEntityClick += ChangeEntitySelectionFromList; hudController.OnEntityLock += ChangeEntityLockStatus; hudController.OnEntityChangeVisibility += ChangeEntityVisibilityStatus; hudController.OnEntityRename += SetEntityName; hudController.OnEntitySmartItemComponentUpdate += UpdateSmartItemComponentInKernel; } BIWInputWrapper.OnMouseDown += OnInputMouseDown; BIWInputWrapper.OnMouseUp += OnInputMouseUp; DCL.Environment.i.world.sceneBoundsChecker.OnEntityBoundsCheckerStatusChanged += ChangeEntityBoundsCheckerStatus; bridge = context.sceneReferences.builderInWorldBridge; outlinerController = context.outlinerController; modeController = context.modeController; actionController = context.actionController; creatorController = context.creatorController; raycastController = context.raycastController; editMaterial = context.projectReferencesAsset.editMaterial; hideSelectedEntitiesAction = context.inputsReferencesAsset.hideSelectedEntitiesAction; showAllEntitiesAction = context.inputsReferencesAsset.showAllEntitiesAction; hideSelectedEntitiesDelegate = (action) => ChangeShowStateSelectedEntities(); showAllEntitiesDelegate = (action) => ShowAllEntities(); hideSelectedEntitiesAction.OnTriggered += hideSelectedEntitiesDelegate; showAllEntitiesAction.OnTriggered += showAllEntitiesDelegate; actionController.OnRedo += ReSelectEntities; actionController.OnUndo += ReSelectEntities; }
public override void Init(BIWContext biwContext) { base.Init(biwContext); actionController = biwContext.actionController; modeController = biwContext.modeController; inputWrapper = biwContext.inputWrapper; outlinerController = biwContext.outlinerController; entityHandler = biwContext.entityHandler; toggleRedoActionInputAction = biwContext.inputsReferencesAsset.toggleRedoActionInputAction; toggleUndoActionInputAction = biwContext.inputsReferencesAsset.toggleUndoActionInputAction; multiSelectionInputAction = biwContext.inputsReferencesAsset.multiSelectionInputAction; if (HUDController.i.builderInWorldMainHud != null) { HUDController.i.builderInWorldMainHud.OnStopInput += StopInput; HUDController.i.builderInWorldMainHud.OnResumeInput += ResumeInput; } redoDelegate = (action) => RedoAction(); undoDelegate = (action) => UndoAction(); toggleRedoActionInputAction.OnTriggered += redoDelegate; toggleUndoActionInputAction.OnTriggered += undoDelegate; multiSelectionStartDelegate = (action) => StartMultiSelection(); multiSelectionFinishedDelegate = (action) => EndMultiSelection(); BIWInputWrapper.OnMouseClick += MouseClick; BIWInputWrapper.OnMouseClickOnUI += MouseClickOnUI; modeController.OnInputDone += InputDone; multiSelectionInputAction.OnStarted += multiSelectionStartDelegate; multiSelectionInputAction.OnFinished += multiSelectionFinishedDelegate; }
public static BIWContext CreateReferencesControllerWithGenericMocks(params object[] mocks) { IBIWOutlinerController outliner = Substitute.For <IBIWOutlinerController>(); IBIWInputHandler inputHandler = Substitute.For <IBIWInputHandler>(); IBIWInputWrapper inputWrapper = Substitute.For <IBIWInputWrapper>(); IBIWPublishController publishController = Substitute.For <IBIWPublishController>(); IBIWCreatorController creatorController = Substitute.For <IBIWCreatorController>(); IBIWModeController modeController = Substitute.For <IBIWModeController>(); IBIWFloorHandler floorHandler = Substitute.For <IBIWFloorHandler>(); IBIWEntityHandler entityHandler = Substitute.For <IBIWEntityHandler>(); IBIWActionController actionController = Substitute.For <IBIWActionController>(); IBIWSaveController saveController = Substitute.For <IBIWSaveController>(); IBIWRaycastController raycastController = Substitute.For <IBIWRaycastController>(); IBIWGizmosController gizmosController = Substitute.For <IBIWGizmosController>(); InitialSceneReferences sceneReferences = new InitialSceneReferences(); foreach (var mock in mocks) { switch (mock) { case IBIWOutlinerController oc: outliner = oc; break; case IBIWInputHandler ih: inputHandler = ih; break; case IBIWInputWrapper iw: inputWrapper = iw; break; case IBIWPublishController pc: publishController = pc; break; case IBIWCreatorController cc: creatorController = cc; break; case IBIWModeController mc: modeController = mc; break; case IBIWFloorHandler fh: floorHandler = fh; break; case IBIWEntityHandler eh: entityHandler = eh; break; case IBIWActionController ac: actionController = ac; break; case IBIWSaveController sc: saveController = sc; break; case IBIWRaycastController rc: raycastController = rc; break; case IBIWGizmosController gc: gizmosController = gc; break; case InitialSceneReferences isr: sceneReferences = isr; break; } } BIWContext context = new BIWContext(); context.Init( outliner, inputHandler, inputWrapper, publishController, creatorController, modeController, floorHandler, entityHandler, actionController, saveController, raycastController, gizmosController, sceneReferences ); return(context); }