Exemplo n.º 1
0
    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;
    }
Exemplo n.º 2
0
 public virtual void Init(BIWContext context)
 {
     entityHandler                  = context.entityHandler;
     saveController                 = context.saveController;
     actionController               = context.actionController;
     raycastController              = context.raycastController;
     entityHandler.OnEntityDeleted += OnDeleteEntity;
 }
Exemplo n.º 3
0
    public override void Init(BIWContext context)
    {
        base.Init(context);
        actionController = context.actionController;

        entityHandler = context.entityHandler;

        creatorController = context.creatorController;
        saveController    = context.saveController;
        mainCamera        = context.sceneReferences.mainCamera;

        floorPrefab = context.projectReferencesAsset.floorPlaceHolderPrefab;

        entityHandler.OnEntityDeleted += OnFloorEntityDeleted;
    }
    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 context)
    {
        base.Init(context);

        cursorGO = context.sceneReferences.cursorCanvas;
        cameraParentGO = context.sceneReferences.cameraParent;
        InitGameObjects();

        firstPersonMode = new BiwFirstPersonMode();
        godMode = new BiwGodMode();

        firstPersonMode.Init(context);
        godMode.Init(context);

        firstPersonMode.OnInputDone += InputDone;
        godMode.OnInputDone += InputDone;

        if (HUDController.i.builderInWorldMainHud != null)
        {
            HUDController.i.builderInWorldMainHud.OnChangeModeAction += ChangeAdvanceMode;
            HUDController.i.builderInWorldMainHud.OnResetAction += ResetScaleAndRotation;
            HUDController.i.builderInWorldMainHud.OnChangeSnapModeAction += ChangeSnapMode;
        }

        actionController = context.actionController;
        entityHandler = context.entityHandler;
        toggleSnapModeInputAction = context.inputsReferencesAsset.toggleSnapModeInputAction;

        snapModeDelegate = (action) => ChangeSnapMode();
        toggleSnapModeInputAction.OnTriggered += snapModeDelegate;

        firstPersonMode.OnActionGenerated += actionController.AddAction;
        godMode.OnActionGenerated += actionController.AddAction;

        SetEditorGameObjects();
    }
    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;
    }
Exemplo n.º 7
0
    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);
    }