Exemplo n.º 1
0
 public virtual void EditSimulation(Simulation simulation, CreationMode creationMode)
 {
     Clear();
     _simulation = simulation;
     AddSubPresentersFor(simulation);
     _configurableLayoutPresenter.AddViews(AllSubCompoundPresenters().Where(ShouldBeDisplayed).Select(x => x.BaseView));
 }
Exemplo n.º 2
0
    public void SetCreationMode(bool enabled)
    {
        currentCreationMode = enabled ? CreationMode.CREATE : CreationMode.NONE;

        onButton.interactable  = !(currentCreationMode == CreationMode.CREATE);
        offButton.interactable = !onButton.interactable;
    }
Exemplo n.º 3
0
 protected virtual void btnUseExisting_Click(object sender, System.EventArgs e)
 {
     creationMode = CreationMode.UseExisting;
     CallMatchFieldDialogs();
     //this.DialogResult = DialogResult.OK;
     //this.Hide();
 }
 public void EditSimulation(Simulation simulation, CreationMode creationMode)
 {
     Simulation = simulation;
     _subPresenterItemManager.AllSubPresenters.Each(x => x.EditSimulation(simulation, creationMode));
     SimulationCreated = true;
     OnStatusChanged();
 }
Exemplo n.º 5
0
    public void SetManipulationMode(CreationMode mode)
    {
        GameObject colObj = currentObject.GetComponentInChildren <Collider>().gameObject;

        colObj.layer = (mode == CreationMode.CREATE) ? LayerMask.NameToLayer("Default") : LayerMask.NameToLayer("Ignore Raycast");

        currentCreationMode = mode;

        switch (currentCreationMode)
        {
        case CreationMode.ROTATE:
        {
            prevRot = Camera.main.transform.localEulerAngles;
            break;
        }

        case CreationMode.RESIZE:
        {
            iniScale = currentObject.transform.localScale;
            prevRot  = Camera.main.transform.forward;
            break;
        }
        }

        manipulationMenu.SetActive(false);
    }
Exemplo n.º 6
0
        /// <summary>
        /// Called by CreationCubeTrigger when hand hovers into a node of the creation cube
        /// </summary>
        public void OnTriggerEnter(bool right, CreationMode hoveredMode, MeshRenderer highlightRenderer)
        {
            //Debug.Log(((right) ? " right ":" left ") + "hoveredMode: " + hoveredMode + " highlightRenderer: " + highlightRenderer.name);

            if (right)
            {
                _rightCollisionTally++;
            }
            else
            {
                _leftCollisionTally++;
            }
            if (right && _currentRightHoveredMode != hoveredMode)
            {
                _currentRightHoveredMode = hoveredMode;
                if (currentRightCreationMode != hoveredMode)
                {
                    _currentRightHighlightRenderer = highlightRenderer;
                }
            }
            else if (!right && _currentLeftHoveredMode != hoveredMode)
            {
                _currentLeftHoveredMode = hoveredMode;
                if (currentLeftCreationMode != hoveredMode)
                {
                    _currentLeftHighlightRenderer = highlightRenderer;
                }
            }
            highlightRenderer.enabled = true;
        }
 public void EditSimulation(Simulation simulation, CreationMode creationMode)
 {
     _simulation      = simulation;
     _eventProperties = simulation.EventProperties;
     _allEventsMappingDTO.Clear();
     _eventProperties.EventMappings.Each(addEventMapping);
     _view.BindTo(_allEventsMappingDTO);
 }
Exemplo n.º 8
0
 public void EditSimulation(Simulation simulation, CreationMode creationMode)
 {
     _simulation            = simulation;
     _observerSetProperties = simulation.ObserverSetProperties;
     _allObserverSetMappingDTOs.Clear();
     _observerSetProperties.ObserverSetMappings.Each(addObserverSetMapping);
     _view.BindTo(_allObserverSetMappingDTOs);
 }
Exemplo n.º 9
0
 void Start()
 {
     clickGesture           = false;
     distanceBetweenPinches = 1.0f;
     mode      = CreationMode.Ready;
     EntryWarp = Resources.Load("Prefabs/ProxyNode", typeof(GameObject)) as GameObject;
     ExitWarp  = Resources.Load("Prefabs/MarkNode", typeof(GameObject)) as GameObject;
 }
        public override void EditSimulation(Simulation simulation, CreationMode creationMode)
        {
            base.EditSimulation(simulation, creationMode);
            bool emptyProtocolSelectionAllowed = simulation.Compounds.Count > 1;

            AllSubCompoundPresenters().Each(p => p.AllowEmptyProtocolSelection = emptyProtocolSelectionAllowed);
            refreshView();
        }
Exemplo n.º 11
0
 protected ConfigureSimulationPresenterBase(TSimulationView view, ISubPresenterItemManager <ISimulationItemPresenter> subPresenterItemManager,
                                            ISimulationModelCreator simulationModelCreator, IHeavyWorkManager heavyWorkManager,
                                            ICloner cloner, IDialogCreator dialogCreator, ISimulationParametersUpdater simulationParametersUpdater, IFullPathDisplayResolver fullPathDisplayResolver, IBuildingBlockInSimulationSynchronizer buildingBlockInSimulationSynchronizer, CreationMode creationMode)
     : base(view, subPresenterItemManager, simulationModelCreator, heavyWorkManager, dialogCreator)
 {
     _cloner = cloner;
     _simulationParametersUpdater           = simulationParametersUpdater;
     _fullPathDisplayResolver               = fullPathDisplayResolver;
     _buildingBlockInSimulationSynchronizer = buildingBlockInSimulationSynchronizer;
     _creationMode    = creationMode;
     AllowQuickFinish = true;
 }
Exemplo n.º 12
0
        public void EditSimulation(Simulation simulation, CreationMode creationMode)
        {
            _allMolecules            = simulation.Individual.AllDefinedMolecules().ToList();
            _interactionProperties   = simulation.InteractionProperties;
            _allInteractionProcesses = simulation.Compounds.SelectMany(x => x.AllProcesses <InteractionProcess>()).ToList();
            _allInteractionProcesses.Insert(0, _noInteractionProcessSelection);
            var shouldAddDefaultMapping = creationMode == CreationMode.New;

            _allPartialProcesses        = _interactionProcessRetriever.AllFor(simulation, simulation.InteractionProperties.Interactions, shouldAddDefaultMapping);
            _allInteractionProcessesDTO = mapPartialProcesses(_allPartialProcesses);
            rebind();
        }
        public void EditSimulation(Simulation simulation, CreationMode creationMode)
        {
            _simulationSubjectDTO = new SimulationSubjectDTO
            {
                BuildingBlock = _buildingBlockInSimulationManager.TemplateBuildingBlocksUsedBy <ISimulationSubject>(simulation).SingleOrDefault(),
                AllowAging    = simulation.AllowAging
            };

            _view.BindTo(_simulationSubjectDTO);

            _lazyLoadTask.Load(SelectedSubject);
            OnStatusChanged();
        }
Exemplo n.º 14
0
        public FieldTreeStructure(int width, int height, NodeType root_node, int capacity = 2, bool allow_overflow = true, CreationMode creation_mode = CreationMode.LAZY)
        {
            region_height  = height;
            region_width   = width;
            field_capacity = capacity;

            root      = root_node;
            allObjs   = new List <RectangleObj>();
            numlayers = 0;
            descendent_creation_mode = creation_mode;
            if (allow_overflow)
            {
                field_capacity *= 2;
            }
        }
Exemplo n.º 15
0
    public override void OnInspectorGUI()
    {
        EditorGUILayout.BeginVertical();

        var oldSize = map.mapSize;

        //map.mapSize = EditorGUILayout.Vector2Field("Map Size:", map.mapSize);

        creationMode = (CreationMode)EditorGUILayout.EnumPopup("Creation mode:", creationMode);

        if (creationMode == CreationMode.LevelDesign)
        {
            Tile = (GameObject)Resources.Load("Prefabs/Environment/Tiles/ForestGround/ForestGround_Center");
            if (GUILayout.Button("Update Tiles Visu"))
            {
                updateTileVisu();
            }
        }
        else if (creationMode == CreationMode.Artist)
        {
            if (GUILayout.Button("Search in Cave Zone"))
            {
                int controlID = EditorGUIUtility.GetControlID(FocusType.Passive);
                EditorGUIUtility.ShowObjectPicker <GameObject>(null, false, "BackGround_Cave", controlID);
            }

            if (GUILayout.Button("Search in Forest Zone"))
            {
                int controlID = EditorGUIUtility.GetControlID(FocusType.Passive);
                EditorGUIUtility.ShowObjectPicker <GameObject>(null, false, "Forest", controlID);
            }

            string commandName = Event.current.commandName;
            if (commandName == "ObjectSelectorUpdated")
            {
                var currentObject = EditorGUIUtility.GetObjectPickerObject();
                Repaint();
            }
            else if (commandName == "ObjectSelectorClosed")
            {
                Tile = (GameObject)EditorGUIUtility.GetObjectPickerObject();
            }

            Tile = (GameObject)EditorGUILayout.ObjectField(Tile, typeof(GameObject), false);
        }

        EditorGUILayout.EndVertical();
    }
Exemplo n.º 16
0
        // ----------------------------------
        static public UnityEngine.EventSystems.EventSystem CreateEventSystem(
            string name,
            CreationMode creationMode,
            string undoName = null)
        {
            int eventSysPresence = IsThereEventSystemInTheScene();

            if ((eventSysPresence != 0) && (creationMode == CreationMode.OnlyIfNotPresent))
            {
                return(null);
            }

            if ((eventSysPresence != 0) && (creationMode == CreationMode.AskIfPresent))
            {
                if (!EditorUtility.DisplayDialog("Control Freak 2 - Create Event System", (eventSysPresence == 1) ?
                                                 "There's a CF2 Event System in the scene already. Do you want to create a new one anyway?" :
                                                 "There's an Event System in the scene, but it isn't using CF2 Input Module. Do you want to create a new one anyway?", "Yes", "No"))
                {
                    return(null);
                }
            }

            UnityEngine.EventSystems.EventSystem eventSys =
                (UnityEngine.EventSystems.EventSystem)TouchControlWizardUtils.CreateObjectWithComponent(name, typeof(UnityEngine.EventSystems.EventSystem));

            eventSys.gameObject.AddComponent(typeof(ControlFreak2.GamepadInputModule));
            //eventSys.gameObject.AddComponent(typeof(ControlFreak2.MouseInputModule));

#if UNITY_PRE_5_3
            eventSys.gameObject.AddComponent(typeof(UnityEngine.EventSystems.TouchInputModule));
#endif

            UnityEngine.EventSystems.StandaloneInputModule standaloneModule =
                (UnityEngine.EventSystems.StandaloneInputModule)eventSys.gameObject.AddComponent(typeof(UnityEngine.EventSystems.StandaloneInputModule));

            standaloneModule.horizontalAxis = InputRig.CF_EMPTY_AXIS;
            standaloneModule.verticalAxis   = InputRig.CF_EMPTY_AXIS;
            standaloneModule.submitButton   = InputRig.CF_EMPTY_AXIS;
            standaloneModule.cancelButton   = InputRig.CF_EMPTY_AXIS;


            if (undoName != null)
            {
                Undo.RegisterCreatedObjectUndo(eventSys.gameObject, undoName);
            }

            return(eventSys);
        }
Exemplo n.º 17
0
        // ----------------------
        static public ControlFreak2.GamepadManager CreateGamepadManager(
            bool withNotifier,
            CreationMode creationMode,
            string undoLabel = null)
        {
            int gmPresence = IsThereGamepadManagerInTheScene();

            if ((gmPresence != 0) && (creationMode == CreationMode.OnlyIfNotPresent))
            {
                return(null);
            }

            if ((gmPresence != 0) && (creationMode == CreationMode.AskIfPresent))
            {
                string msg = null;
                msg = "There's a CF2 Gamepad Manager in the scene already. Do you want to create a new one anyway?";
                if (!EditorUtility.DisplayDialog("Control Freak 2 - Create Gamepad Manager", msg, "Yes", "No"))
                {
                    return(null);
                }
            }

            GamepadManager gm = null;

            gm = (GamepadManager)TouchControlWizardUtils.CreateObjectWithComponent("CF2-Gamepad-Manager", typeof(ControlFreak2.GamepadManager));
            if (gm == null)
            {
                return(null);
            }

            if (withNotifier)
            {
                ControlFreak2.GamepadNotifier gn = CreateGamepadNotifer("CF2-Gamepad-Notifier", null);
                if (gn != null)
                {
                    gn.transform.SetParent(gm.transform, false);
                }
            }

            if (undoLabel != null)
            {
                Undo.RegisterCreatedObjectUndo(gm.gameObject, undoLabel);
            }

            return(gm);
        }
Exemplo n.º 18
0
        public CrowdControlCreateTaskViewModel(ConnectionManager connectionManager, string title,
                                               CreationMode creationModes)
        {
            _titlePrefix       = title;
            _connectionManager = connectionManager;
            Conditions         = new ObservableCollection <Condition>();

            if ((creationModes & CreationMode.NoTarget) == CreationMode.NoTarget)
            {
                NoTarget = true;
            }

            if ((creationModes & CreationMode.WithName) == CreationMode.WithName)
            {
                RequestName = true;
            }
        }
Exemplo n.º 19
0
        public LegalValuesDialog(TableBasedDropDownField field, MainForm frm, string name, Page currentPage) : base(frm)
        {
            InitializeComponent();
            fieldName    = name;
            page         = currentPage;
            creationMode = CreationMode.Edit;
            //dgCodes.CaptionText += "  " + name;
            //dgCodes.PreferredColumnWidth = Convert.ToInt32(dgCodes.Width * COLUMN_WIDTH_MULTIPLE);
            ddlField = field;

            if (!string.IsNullOrEmpty(field.SourceTableName))
            {
                codeTable       = field.GetSourceData();
                sourceTableName = field.SourceTableName;
                textColumnName  = field.TextColumnName;
            }

            InitContextMenu();
        }
Exemplo n.º 20
0
    void Awake()
    {
        if (instance != null)
        {
            Destroy(instance);
        }

        currentCreationMode = CreationMode.NONE;
        instance            = this;

        manipulationMenu = GameObject.Instantiate(manipulationMenuPrefab, transform.position, transform.rotation);
        manipulationMenu.SetActive(false);

        creationMenu = GameObject.Instantiate(creationMenuPrefab, transform.position, transform.rotation);
        creationMenu.SetActive(false);

        minScaleVec = new Vector3(minScale, minScale, minScale);
        maxScaleVec = new Vector3(maxScale, maxScale, maxScale);
    }
Exemplo n.º 21
0
        public AddConnectionDialog(AdjacentEdgesGraphSource graphSource, CreationMode mode)
        {
            InitializeComponent();

            this.mode = mode;
            ApplyMode();

            dataItems = new List <EntityData>();
            // fill data items list with all the nodes available in the graph
            foreach (var node in graphSource.Graph.Nodes)
            {
                EntityData data = graphSource.GetBusinessObject(node) as EntityData;
                if (data != null)
                {
                    dataItems.Add(data);
                }
            }
            targetCombobox.SelectionChanged += TargetComboboxOnSelectionChanged;
            targetCombobox.ItemsSource       = dataItems;
            targetCombobox.SelectedIndex     = 0;
        }
Exemplo n.º 22
0
    public void SetLocomotionMode(int lm)
    {
        if (currentLocomotionMode != (LocomotionMode)lm)
        {
            if (currentLocomotionMode == LocomotionMode.NONE)
            {
                teleportButton.interactable = !((LocomotionMode)lm == LocomotionMode.TELEPORT);
                walkButton.interactable     = !((LocomotionMode)lm == LocomotionMode.WALK);
            }
            else
            {
                teleportButton.interactable = currentLocomotionMode == LocomotionMode.TELEPORT;
                walkButton.interactable     = currentLocomotionMode == LocomotionMode.WALK;
            }

            currentLocomotionMode = (LocomotionMode)lm;

            // Disable Creation Mode
            onButton.interactable  = true;
            offButton.interactable = false;
            currentCreationMode    = CreationMode.NONE;
        }
    }
Exemplo n.º 23
0
        /// <summary>
        /// Called by CreationCubeTrigger when hand hovers out of a node of the creation cube
        /// </summary>
        public void OnTriggerExit(bool right, CreationMode hoveredMode, MeshRenderer highlightRenderer)
        {
            if (right && _rightCollisionTally > 0)
            {
                _rightCollisionTally--;
            }
            else if (!right && _leftCollisionTally > 0)
            {
                _leftCollisionTally--;
            }

            if (right && _rightCollisionTally == 0 && _currentRightHoveredMode != CreationMode.neutral && currentRightCreationMode != _currentRightHoveredMode)
            {
                _currentRightHoveredMode       = CreationMode.neutral;
                _currentRightHighlightRenderer = null;
                highlightRenderer.enabled      = false;
            }
            else if (!right && _leftCollisionTally == 0 && _currentLeftHoveredMode != CreationMode.neutral && currentLeftCreationMode != _currentLeftHoveredMode)
            {
                _currentLeftHoveredMode       = CreationMode.neutral;
                _currentLeftHighlightRenderer = null;
                highlightRenderer.enabled     = false;
            }
        }
Exemplo n.º 24
0
 protected virtual void btnUseExisting_Click(object sender, System.EventArgs e)
 {
     creationMode = CreationMode.UseExisting;
     CallMatchFieldDialogs();
     //this.DialogResult = DialogResult.OK;
     //this.Hide();
 }
Exemplo n.º 25
0
 public static extern IntPtr CreateFile(string fileName,
   AccessMode desiredAccess, ShareMode shareMode, IntPtr securityAttributes,
   CreationMode creationDisposition, FileAttribute flagsAndAttributes,
   IntPtr templateFilehandle);
Exemplo n.º 26
0
 private void AfterTimeDuration()
 {
     CreateMode = CreationMode.NORMAL;
     UpdateLevelParameters();
 }
Exemplo n.º 27
0
 protected virtual void btnFromExisting_Click(object sender, System.EventArgs e)
 {
     creationMode = CreationMode.CreateNewFromExisting;
     CallMatchFieldDialogs();
 }
Exemplo n.º 28
0
        public static void CreateFile(string directory, string filename, string content, CreationMode mode)
        {
            CheckPathValidity(directory);
            var path = Path.Combine(directory, filename);

            switch (mode)
            {
            case CreationMode.Create:
            {
                File.Create(path);
                Console.WriteLine($"\n-- File \'{filename}\' created in \'{directory}\'");
            }
            break;

            case CreationMode.Append:
            {
                File.AppendAllText(path, content);
                Console.WriteLine($"\n-- Added text to \'{filename}\' in \'{directory}\'");
            }
            break;

            case CreationMode.Exists:
            {
                if (File.Exists(path))
                {
                    throw new DirectoryNotFoundException(
                              $"CreateFile(mode Exists): \'{Path.Combine(directory, filename)}\' already exists");
                }

                goto case CreationMode.Create;
            }

            default:
                throw new ArgumentOutOfRangeException(nameof(mode), mode, null);
            }
        }
Exemplo n.º 29
0
 public void EditSimulation(Simulation simulation, CreationMode creationMode)
 {
     _originData = simulation.BuildingBlock <ISimulationSubject>().OriginData;
     editModelProperties(simulation.ModelProperties);
 }
Exemplo n.º 30
0
 protected virtual void btnFromExisting_Click(object sender, System.EventArgs e)
 {
     creationMode = CreationMode.CreateNewFromExisting;
     CallMatchFieldDialogs();
 }
Exemplo n.º 31
0
    // State system
    void ProcessForPortals()
    {
        if (!bothHandsActive)
        {
            return;
        }

        switch (mode)
        {
        case (CreationMode.Ready):
            if (clickGesture &&
                distanceBetweenPinches < 0.1f &&
                Time.time - timeClickGestureStarted > 1.0f &&
                pointingToEachOther)
            {
                // If gestures are on, create proxy if ready (i.e., not interacting)
                mode = CreationMode.CreatingProxy;
                CreateProxy();
                Debug.Log("Creating proxy...");
                timeCreated = Time.time;
            }
            break;

        case (CreationMode.CreatingProxy):



            // If gesture is no longer, for a period of time, finish creation
            if (!clickGesture && Time.time - timeSinceLastClickGesture > 0.7f)
            {
                mode = CreationMode.Ready;
                //proxySpace.GetComponentInChildren<InteractionZone>().enabled = true;
                //portals.Add(new Tuple<GameObject, GameObject>(selectionSphere, proxySphere));
                Debug.Log("Proxy finished");
                SetActiveNodes(true);
                floorMarker.SetActive(true);
                proxyNode.SetCreationMode(false);
            }
            if (clickGesture && Time.time - timeSinceLastClickGesture < 0.05f)
            {
                UpdateProxyAndMarked();
            }

            // Update spheres during creation
            //if (Time.time - timeSinceLastClickGesture < 0.1f)

            break;

        case (CreationMode.HoveringProxy):
            break;

        case (CreationMode.MovingProxy):

            // Update proxy after creation
            //UpdateProxyOnly();
            break;

        case (CreationMode.MovingMarked):
            Debug.Log("Moving marked");
            //UpdateMarkedOnly();
            break;
        }
    }
Exemplo n.º 32
0
        public PlayScreen(string bgResname)
            : base(bgResname)
        {
            random = new Random(System.DateTime.UtcNow.Millisecond);
            freqDivider = 0;
            scorePos = new Vector2(5, 3);
            MinBalloonSpeed = -1.5f;
            isBannerOn = false;
            Level = 0;
            CreateMode = CreationMode.NORMAL;

            UpdateLevelParameters();
            explosionsRequired = 5;
            gameState = GameState.PLAY;
            lastPauseTouch = 0;

            // pause button
            pauseObj = new GameObj();
            pauseObj.SpriteName = "pause";
            pauseObj.TouchNotifier = PauseTouchEvent;
            this.addScreenObject(pauseObj);

            pauseTextObj = new GameObj();
            pauseTextObj.SpriteName = "pausetext";
            pauseTextObj.TouchNotifier = PauseTextTouchEvent;
            pauseTextObj.Visible = false;
            this.addScreenObject(pauseTextObj);

            quitButton = new ButtonObj("Quit");
            quitButton.SpriteName = "buttonBg";
            quitButton.TouchNotifier = delegate(TouchLocation loc, GameObj go)
            {
                reset();
                game.UnPauseGame();
                game.SetCurrentScreen(1);
            };
            quitButton.Visible = false;
            this.addScreenObject(quitButton);

            gameOverObj = new GameObj();
            gameOverObj.SpriteName = "gameover";
            gameOverObj.TouchNotifier = delegate(TouchLocation loc, GameObj go)
            {
                int screen = 1;
                if (Guide.IsVisible) return;

                if (game.ScoreManager.IsHighScore(Score))
                {
                    startInput();
                    // show input.. get name
                    // save high score..
                    // screen = 3;
                }
                else
                {
                    reset();
                    game.UnPauseGame();
                    game.SetCurrentScreen(screen);
                }
            };
            gameOverObj.Visible = false;
            this.addScreenObject(gameOverObj);
        }
 public void EditSimulation(Simulation simulation, CreationMode creationMode)
 {
     bindToCompounds(_buildingBlockInSimulationManager.TemplateBuildingBlocksUsedBy <Compound>(simulation));
 }
Exemplo n.º 34
0
        public LegalValuesDialog(TableBasedDropDownField field, MainForm frm, string name, Page currentPage)
            : base(frm)
        {
            InitializeComponent();
            fieldName = name;
            page = currentPage;
            creationMode = CreationMode.Edit;
            //dgCodes.CaptionText += "  " + name;
            //dgCodes.PreferredColumnWidth = Convert.ToInt32(dgCodes.Width * COLUMN_WIDTH_MULTIPLE);
            ddlField = field;

            if (!string.IsNullOrEmpty(field.SourceTableName))
            {
                codeTable = field.GetSourceData();
                sourceTableName = field.SourceTableName;
                textColumnName = field.TextColumnName;
            }

            InitContextMenu();
        }
Exemplo n.º 35
0
 private void goToSpecialMode(CreationMode NewMode)
 {
     CreateMode = NewMode;
     UpdateLevelParameters();
 }
Exemplo n.º 36
0
 public static extern IntPtr CreateFile(string fileName,
                                        AccessMode desiredAccess, ShareMode shareMode, IntPtr securityAttributes,
                                        CreationMode creationDisposition, FileAttribute flagsAndAttributes,
                                        IntPtr templateFilehandle);
 public override void EditSimulation(Simulation simulation, CreationMode creationMode)
 {
     base.EditSimulation(simulation, creationMode);
     _interactionSelectionPresenter.EditSimulation(simulation, creationMode);
     _view.ShowInteractionView = inhibitionCanBeDefinedIn(simulation);
 }