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 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); }