private SelectGamePageViewModel(GameChoiceServiceClient gameService) { _gameService = gameService; Games = new ObservableCollection <CGameInfo>(); ConnectCommand = new CRelayCommand(ConnectExecute, ConnectCanExecute); RefreshCommand = new CRelayCommand(RefreshExecute); }
public CNodeEntryViewModel(CKlaxScriptNodeFactory nodeFactory, CAddNodeViewModel parentViewModel, CCategoryViewModel parentCategory) { NodeFactory = nodeFactory; Name = nodeFactory.Name; m_parentCategory = parentCategory; m_parentViewModel = parentViewModel; LeftDoubleClickCommand = new CRelayCommand(OnLeftDoubleClick); if (nodeFactory.TargetType != null) { Tooltip = "Target is " + nodeFactory.TargetType.Name; } if (!string.IsNullOrWhiteSpace(nodeFactory.Tooltip)) { if (Tooltip != null) { Tooltip = Tooltip + System.Environment.NewLine + nodeFactory.Tooltip; } else { Tooltip = nodeFactory.Tooltip; } } }
public CNodeGraphViewModel() : base("NodeGraph") { SetIconSourcePath("Resources/Images/Tabs/assetbrowser.png"); Content = new NodeGraphView(); MouseDownCommand = new CRelayCommand(OnMouseDown); PreviewMouseDownCommand = new CRelayCommand(OnPreviewMouseDown); PreviewMouseUpCommand = new CRelayCommand(OnPreviewMouseUp); StartDragContentCommand = new CRelayCommand(OnStartDragContent); DeleteNodesCommand = new CRelayCommand(OnDeleteCommand); CopyNodesCommand = new CRelayCommand(OnCopyNodes); PasteNodesCommand = new CRelayCommand(OnPasteNodes); CutNodesCommand = new CRelayCommand(OnCutNodes); DuplicateNodesCommand = new CRelayCommand(OnDuplicateNodes); DragEnterCommand = new CRelayCommand(OnDragEnter); DragOverCommand = new CRelayCommand(OnDragOver); DropCommand = new CRelayCommand(OnDrop); CreateNewGraph(); m_lodLevels.Add(1.0); m_lodLevels.Add(0.7); m_lodLevels.Add(0.5); m_lodLevels.Add(0.3); m_lodLevels.Add(0.1); AddNodeViewModel = new CAddNodeViewModel(CKlaxScriptNodeQueryContext.Empty); AddNodeViewModel.NodeSelected += OnNodeAddNodePopupSelected; VariablePopup = new CVariableDragPopupViewModel(this); }
private GameViewModel(IGameServiceProvider gameServiceProvider, CGameNavigator navigator) { _gameServiceProvider = gameServiceProvider; _navigator = navigator; СGameServiceCallback serviceCallback = gameServiceProvider.ServiceCallback; serviceCallback.GameStarted += OnGameStarted; serviceCallback.RoundStarted += OnRoundStarted; serviceCallback.RoundEnded += OnRoundEnded; _gameServiceClient = gameServiceProvider.GameClient; FinishRoundCommand = new CRelayCommand(FinishRoundExecuted); _countdownTimer = new Timer(); _countdownTimer.Elapsed += OnCountdown; _countdownTimer.Interval = 1000; _countdownTimer.AutoReset = true; var heroSelectionView = new HeroSelectionView(); CGameNavigator.Instance.Register(heroSelectionView, EAreaType.HeroSelection); heroSelectionView.ViewModel.OnHeroSelected += OnHeroSelected; CGameNavigator.Instance.Register(new EndRoundControl(), EAreaType.RoundEnded); CGameNavigator.Instance.Register(new TradingPage(), EAreaType.Trading); CGameNavigator.Instance.Register(new BattleView(), EAreaType.Battle); }
public CVariableDragPopupViewModel(CNodeGraphViewModel nodeGraphViewModel) { AddSetVariableNodeCommand = new CRelayCommand(OnAddSetVariableNode); AddGetVariableNodeCommand = new CRelayCommand(OnAddGetVariableNode); m_nodeGraphViewModel = nodeGraphViewModel; }
private CreateGamePageViewModel(GameChoiceServiceClient gameService, MapServiceClient mapService) { _gameService = gameService; _mapService = mapService; Maps = new ObservableCollection <CMapInfo>(); CreateGameCommand = new CRelayCommand(CreateGameExecute, CreateGameCanExecute); }
public DictionaryInspector() { AddElementCommand = new CRelayCommand((arg) => { if (m_addKeyValue == null) { LogUtility.Log("The dictionary {0}", PropertyInfo.Name); return; } if (m_displayedList.Any(vm => SafeEquals(m_addKeyValue, vm.Key))) { LogUtility.Log("The dictionary {0} already contains an element with a default key! You cannot add a new element as long as the default key exists.", PropertyInfo.Name); return; } object defaultValueObject = EditorKlaxScriptUtility.GetTypeDefault(m_valueType); m_displayedList.Add(new CDictionaryEntryViewModel(m_displayedList.Count, m_addKeyValue, defaultValueObject, m_keyType, m_valueType)); if (PropertyInfo.Value == null) { IDictionary newDictionary = (IDictionary)Activator.CreateInstance(PropertyInfo.ValueType); foreach (var viewModel in m_displayedList) { newDictionary.Add(viewModel.Key, viewModel.Value); } SetInspectorValue(PropertyInfo, null, newDictionary, true); } else { if (m_inspector.DispatchSetter) { CEngine.Instance.Dispatch(EEngineUpdatePriority.BeginFrame, () => { IDictionary dictionary = PropertyInfo.GetOriginalValue <IDictionary>(); dictionary.Add(m_addKeyValue, defaultValueObject); }); } else { IDictionary dictionary = PropertyInfo.GetOriginalValue <IDictionary>(); dictionary.Add(m_addKeyValue, defaultValueObject); } } CollectionList.ItemsSource = null; CollectionList.ItemsSource = m_displayedList; HeaderText = m_displayedList.Count + " Elements"; }); ClearCommand = new CRelayCommand(arg => { ClearCollection(); }); InitializeComponent(); }
private void InitCommands() { DeleteCommand = new CRelayCommand(OnDeleteCommand); DetachCommand = new CRelayCommand(OnDetachCommand); DragEnterCommand = new CRelayCommand(OnDragEnter); DragOverCommand = new CRelayCommand(OnDragOver); DropCommand = new CRelayCommand(OnDrop); CreateEntityAssetCommand = new CRelayCommand(OnCreateAssetFromEntity); }
private GamePlayersListPageViewModel(IGameChoiceProvider gameProvider, CGameInfo game) { _gameProvider = gameProvider; _game = game; _gameProvider.Callback.PlayerConnected += OnPlayerConnected; _gameProvider.Callback.PlayerDisconnected += OnPlayerDisconnected; Players = new ObservableCollection <CPlayer>(_game.Players); LeaveCommand = new CRelayCommand(LeaveExecute); gameProvider.Service.Ready(_game.Id); }
public CLayoutPresetViewModel(CLayoutManagerViewModel viewModel, string name, string path) { m_name = name; m_path = path; m_viewModel = viewModel; Load = new CRelayCommand((param) => { m_viewModel.LoadLayout(m_path); }); }
public CAddNodeViewModel(CKlaxScriptNodeQueryContext context) { m_queryContext = context; CKlaxScriptRegistry.Instance.GetNodeSuggestions(m_queryContext, m_nodeFactories); EnterCommand = new CRelayCommand(OnEnterPressed); PreviewKeyDownCommand = new CRelayCommand(OnPreviewKeyDown); TreeGotFocusCommand = new CRelayCommand(OnTreeGotFocus); TreeLostFocusCommand = new CRelayCommand(OnTreeLostFocus); PopulatePossibleNodes(); }
public CInspectorEntityComponentViewModel(IInspectorViewModel viewModel, string name, SEntityComponentId componentId) : base(viewModel, name) { ComponentId = componentId; DeleteComponentCommand = new CRelayCommand(arg => { EditorEntityUtility.DestroyComponent(ComponentId); m_viewModel.QueueEntityInformationUpdate(ComponentId.EntityId, true); }); }
public CInspectorSceneComponentViewModel(IInspectorViewModel viewModel, string name, SEntityComponentId componentId, string dragIdentifier) : base(viewModel, name) { ComponentId = componentId; MakeRootCommand = new CRelayCommand(OnMakeRoot); DeleteComponentCommand = new CRelayCommand(OnDeleteComponent); DragEnterCommand = new CRelayCommand(OnDragEnter); DragOverCommand = new CRelayCommand(OnDragOver); DropCommand = new CRelayCommand(OnDrop); m_dragIdentifier = dragIdentifier; }
public CAssetBrowserViewModel() : base("AssetBrowser") { SetIconSourcePath("Resources/Images/Tabs/assetbrowser.png"); Content = new AssetBrowserView(); m_rootDirectory = new CDirectoryEntry("", this); // Start at the project root RootFolders.Add(m_rootDirectory); SelectedFolderPath.Add(m_rootDirectory); ImportCommand = new CRelayCommand(OnImport); DeleteAssetCommand = new CRelayCommand(OnDeleteAsset); CreateMaterialCommand = new CRelayCommand(OnCreateMaterial); CreateEntityCommand = new CRelayCommand(OnCreateEntity); CreateInterfaceCommand = new CRelayCommand(OnCreateInterface); }
public BattlefieldViewModel(CMap map, CHeroBase hero, IGameServiceProvider provider) { _provider = provider; MyHero = hero; Map = map; MoveCommand = new CRelayCommand(MoveCommandExecuted); TradeCommand = new CRelayCommand(TradeCommandExecuted, TradeCanExecute); BattleCommand = new CRelayCommand(BattleExecute, BattleCanExecute); UseItemCommand = new CRelayCommand(UseItemExecute, UseItemCanExecute); provider.ServiceCallback.HeroMoved += OnHeroMoved; provider.ServiceCallback.UnitDied += OnUnitDied; MyHeroViewModel = new HeroViewModel(hero); }
public CAssetEntryViewModel(CAsset asset, CAssetBrowserViewModel viewModel) { Asset = asset; m_viewModel = viewModel; TypeName = asset.GetTypeName(); Color = EditorConversionUtility.ConvertEngineColorToSystem(asset.GetTypeColor()); BorderColor = new SolidColorBrush(Color); Name = Asset.Name; EditName = Name; DeleteAssetCommand = new CRelayCommand(OnDeleteAsset); MouseLeftDownCommand = new CRelayCommand(OnMouseLeftDown); }
public CInspectorViewModel() : base("Inspector") { SetIconSourcePath("Resources/Images/Tabs/inspector.png"); Content = new Inspector(); m_view = Content as IInspectorView; InitializeEntityMenues(); RenameEntityCommand = new CRelayCommand(InternalRenameEntity); AddComponentCommand = new CRelayCommand(InternalAddComponent); ToggleAddComponentMenuCommand = new CRelayCommand((obj) => AddComponentMenuOpen = !AddComponentMenuOpen); ToggleEntityCommandsMenuCommand = new CRelayCommand((obj) => EntityCommandsMenuOpen = !EntityCommandsMenuOpen); CWorkspace.Instance.OnSelectedEditableObjectChanged += (oldObj, newObj) => { m_view?.ClearInspector(); m_view?.LockInspector(true); if (newObj != null) { m_view.SetInspectorVisible(true); switch (newObj.Type) { case CEditableObject.EObjectType.Entity: InspectEntity(newObj.EntityId); if (oldObj?.GetTargetEntityId() != newObj?.GetTargetEntityId()) { QueueEntityInformationUpdate(newObj.GetTargetEntityId(), true); } EditorEntityUtility.PickRootComponent(newObj.EntityId); break; case CEditableObject.EObjectType.Component: InspectComponent(newObj.ComponentId); break; } } else { m_view?.SetInspectorVisible(false); Reset(); EditorEntityUtility.PickComponent(SEntityComponentId.Invalid); } }; }
public CNodeConnectionViewModel(CPinViewModel sourcePin, CPinViewModel targetPin, CNodeGraphViewModel nodeGraph) { MouseDownCommand = new CRelayCommand(OnMouseDown); m_nodeGraph = nodeGraph; m_sourceNode = sourcePin.NodeViewModel; m_targetNode = targetPin.NodeViewModel; m_sourcePin = sourcePin; m_targetPin = targetPin; m_sourceNode.OnNodeMoved += OnSourceMoved; m_sourcePin.ConnectionPointChanged += OnSourcePinChanged; m_targetNode.OnNodeMoved += OnTargetMoved; m_targetPin.ConnectionPointChanged += OnTargetPinChanged; StrokeColor = m_sourcePin.PinOuterColor; }
private void InitCommands() { NewLevelCommand = new CRelayCommand(OnNewLevel); SaveLevelCommand = new CRelayCommand(OnSaveLevel, obj => OpenedLevelAsset != null); SaveLevelAsCommand = new CRelayCommand(OnSaveLevelAs); CloseCommand = new CRelayCommand(OnClose); SpawnEmptyEntity = new CRelayCommand(OnSpawnEmptyEntity); SpawnCubeEntity = new CRelayCommand(OnSpawnCubeEntity); UndoCommand = new CRelayCommand((arg) => { UndoRedoModel.Undo(); }, (arg) => { return(UndoRedoModel.CanUndo); }); RedoCommand = new CRelayCommand((arg) => { UndoRedoModel.Redo(); }, (arg) => { return(UndoRedoModel.CanRedo); }); PlayGameCommand = new CRelayCommand(OnPlayGame, CanPlayGame); StopGameCommand = new CRelayCommand(OnStopGame, CanStopGame); }
public CViewportViewModel() : base("Scene Viewer") { SetIconSourcePath("Resources/Images/Tabs/viewport.png"); var viewport = new Viewport(); m_hostControl = viewport.RendererHostControl; m_hostControl.Loaded += OnHostControlLoaded; Content = viewport; DragEnterCommand = new CRelayCommand(OnDragEnter); DragOverCommand = new CRelayCommand(OnDragOver); DropCommand = new CRelayCommand(OnDrop); KeyDownCommand = new CRelayCommand(OnKeyDown); }
public CConsoleViewModel() : base("Console") { SetIconSourcePath("Resources/Images/Tabs/console.png"); Content = new Views.Console(); SetConsoleView = new CRelayCommand(obj => ConsoleView = obj as IConsoleView); CommandEntered = new CRelayCommand(OnConsoleCommandEntered); SuggestionChangedUp = new CRelayCommand(OnSuggestionChangedUp); SuggestionChangedDown = new CRelayCommand(OnSuggestionChangedDown); ClearSuggestions = new CRelayCommand(OnClearSuggestions); UpdateSuggestions = new CRelayCommand(OnUpdateSuggestions); LogUtility.Logged += OnLogged; }
public CLayoutManagerViewModel(DockingManager manager, CWorkspace workspace) { m_dockingManager = manager; m_workspace = workspace; m_userLayoutFileFolder = Paths.UserDirectory + "\\Layouts\\"; m_layoutFilePath = m_userLayoutFileFolder + "layout.cfg"; m_builtinLayoutFileFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\Resources\\Layouts\\"; Directory.CreateDirectory(m_userLayoutFileFolder); LoadLayoutCommand = new CRelayCommand(OnLoadLayout, (arg) => m_dockingManager != null); LoadLayoutAtIndexCommand = new CRelayCommand(OnLoadAtIndexLayout, (arg) => m_dockingManager != null); SaveLayoutCommand = new CRelayCommand(OnSaveLayout, (arg) => m_dockingManager != null); SaveLayoutAsCommand = new CRelayCommand(OnSaveLayoutAs, (arg) => m_dockingManager != null); InitLayouts(); }
public ListInspector() { InitializeComponent(); AddElementCommand = new CRelayCommand((arg) => { object defaultObject = EditorKlaxScriptUtility.GetTypeDefault(m_collectionElementType); m_displayedList.Add(new CListEntryViewModel(m_displayedList.Count, defaultObject, m_collectionElementType)); if (PropertyInfo.Value == null) { IList newList = (IList)Activator.CreateInstance(PropertyInfo.ValueType); foreach (var value in m_displayedList) { newList.Add(value.Value); } SetInspectorValue(PropertyInfo, null, newList, true); } else { if (m_inspector.DispatchSetter) { CEngine.Instance.Dispatch(EEngineUpdatePriority.BeginFrame, () => { IList list = PropertyInfo.GetOriginalValue <IList>(); list.Add(defaultObject); }); } else { IList list = PropertyInfo.GetOriginalValue <IList>(); list.Add(defaultObject); } } CollectionList.ItemsSource = null; CollectionList.ItemsSource = m_displayedList; ListExpander.Header = m_displayedList.Count + " Elements"; }); ClearCommand = new CRelayCommand(arg => { ClearCollection(); }); }
public CCategoryViewModel(string name, CAddNodeViewModel parentViewModel, CCategoryViewModel parentCategory) { Name = name; m_combinedCollection = new CompositeCollection(); CollectionContainer categoriesContainer = new CollectionContainer(); categoriesContainer.Collection = SubCategories; CollectionContainer nodesContainer = new CollectionContainer(); nodesContainer.Collection = Nodes; CombinedCollection.Add(categoriesContainer); CombinedCollection.Add(nodesContainer); MouseDownCommand = new CRelayCommand(OnMouseDown); m_parentCategory = parentCategory; m_parentViewModel = parentViewModel; }
public CInterfaceFunctionViewModel(CKlaxScriptInterfaceFunction interfaceFunction, CInterfaceEditorViewmodel parentViewModel) { m_parentViewModel = parentViewModel; m_interfaceFunction = interfaceFunction; m_name = interfaceFunction.Name; foreach (CKlaxVariable inputParameter in m_interfaceFunction.InputParameters) { AddInput(inputParameter, false); } foreach (CKlaxVariable outputParameter in m_interfaceFunction.OutputParameters) { AddOutput(outputParameter, false); } AddInputCommand = new CRelayCommand(OnAddInput); AddOutputCommand = new CRelayCommand(OnAddOutput); DeleteCommand = new CRelayCommand(OnDelete); }
public CDirectoryEntry(string directoryPath, CAssetBrowserViewModel viewModel, CDirectoryEntry parent = null) { ParentDirectory = parent; m_viewModel = viewModel; Path = directoryPath; string absolutePath = ProjectDefinitions.GetAbsolutePath(directoryPath); DirectoryInfo dirInfo = new DirectoryInfo(absolutePath); Name = string.IsNullOrWhiteSpace(directoryPath) ? "Project" : dirInfo.Name; EditName = Name; UpdateSubDirectories(); SelectCommand = new CRelayCommand(OnDirectoryClicked); DragEnterCommand = new CRelayCommand(OnDragEnter); DragOverCommand = new CRelayCommand(OnDragOver); DropCommand = new CRelayCommand(OnDrop); AddFolderCommand = new CRelayCommand(OnAddFolder); DeleteFolderCommand = new CRelayCommand(OnDeleteFolder); }
public CWorldOutlinerViewModel() : base("World Outliner") { SetIconSourcePath("Resources/Images/Tabs/outliner.png"); Content = new WorldOutliner(); m_view = Content as IOutlinerView; CWorkspace.Instance.OnSelectedEditableObjectChanged += (oldObj, newObj) => { if (newObj != null) { switch (newObj.Type) { case CEditableObject.EObjectType.Entity: HighlightEntity(newObj.EntityId); break; case CEditableObject.EObjectType.Component: HighlightEntity(newObj.ComponentId.EntityId); break; } } else { SelectedEntityViewModel?.MarkInOutliner(false); } }; KeyDownCommand = new CRelayCommand(param => { KeyEventArgs args = (KeyEventArgs)param; if (IsActive && args.Key == Key.Delete) { if (SelectedEntityViewModel != null) { EditorEntityUtility.DestroyEntity(SelectedEntityViewModel.EntityId); } } }); }
public CScriptNodeViewmodel(CNode scriptNode, CNodeGraphViewModel graphViewModel) { ScriptNode = scriptNode; NodeGraph = graphViewModel; Name = scriptNode.Name; ScriptNode.NodeRebuilt += OnNodeRebuilt; m_bCanAddInputPins = scriptNode.CanAddInputPins; m_bCanAddOutputPins = scriptNode.CanAddOutputPins; m_bIsUpdatingNode = true; PosX = scriptNode.NodePosX; PosY = scriptNode.NodePosY; for (var i = 0; i < scriptNode.InputPins.Count; i++) { m_inputPins.Add(new CInputPinViewModel(scriptNode.InputPins[i], this, i)); } for (var i = 0; i < scriptNode.OutputPins.Count; i++) { m_outputPins.Add(new COutputPinViewModel(scriptNode.OutputPins[i], this, i)); } for (var i = 0; i < scriptNode.InExecutionPins.Count; i++) { m_inExecutionPins.Add(new CExecutionPinViewModel(scriptNode.InExecutionPins[i], this, i, true)); } for (var i = 0; i < scriptNode.OutExecutionPins.Count; i++) { m_outExecutionPins.Add(GetOutExecutionPinViewModel(scriptNode.OutExecutionPins[i], i)); } m_bIsUpdatingNode = false; MouseDownCommand = new CRelayCommand(OnMouseDown); AddInputPinCommand = new CRelayCommand(OnAddInputPin); AddOutputPinCommand = new CRelayCommand(OnAddOutputPin); }
public TradingViewModel() { MoveToBuyCommand = new CRelayCommand(BuyItem); MoveToSellCommand = new CRelayCommand(SellItem); BackCommand = new CRelayCommand(BackExecute); }
protected CPinViewModel(CScriptNodeViewmodel nodeViewModel, int pinIndex) { NodeViewModel = nodeViewModel; MouseDownCommand = new CRelayCommand(OnMouseDown); PinIndex = pinIndex; }