protected override void OnDestroy() { WPFAppWorld.WorldDestroy(); Client_DisconnectFromServer(); base.OnDestroy(); instance = null; }
private void buttonDestroy_Click(object sender, RoutedEventArgs e) { WPFAppWorld.WorldDestroy(); if (ExampleEngineApp.Instance != null) { ExampleEngineApp.Instance.Client_DisconnectFromServer(); } }
private void Window_Loaded(object sender, RoutedEventArgs e) { //NeoAxis initialization if (!WPFAppWorld.Init(new ExampleEngineApp(EngineApp.ApplicationTypes.Simulation), this, "user:Logs/WPFAppExample.log", true, null, null, null, null)) { Close(); return; } UpdateVolume(); renderTargetUserControl1.AutomaticUpdateFPS = 60; renderTargetUserControl1.KeyDown += renderTargetUserControl1_KeyDown; renderTargetUserControl1.KeyUp += renderTargetUserControl1_KeyUp; renderTargetUserControl1.MouseDown += renderTargetUserControl1_MouseDown; renderTargetUserControl1.MouseUp += renderTargetUserControl1_MouseUp; renderTargetUserControl1.MouseMove += renderTargetUserControl1_MouseMove; renderTargetUserControl1.Tick += renderTargetUserControl1_Tick; renderTargetUserControl1.Render += renderTargetUserControl1_Render; renderTargetUserControl1.RenderUI += renderTargetUserControl1_RenderUI; const string startMapName = "Maps\\MainMenu\\Map.map"; //generate map list { string[] mapList = VirtualDirectory.GetFiles("", "*.map", SearchOption.AllDirectories); foreach (string mapName in mapList) { comboBoxMaps.Items.Add(mapName); if (mapName == startMapName) { comboBoxMaps.SelectedIndex = comboBoxMaps.Items.Count - 1; } } } //load map WPFAppWorld.MapLoad(startMapName, true); //set camera position if (Map.Instance != null) { MapCamera mapCamera = FindFirstMapCamera(); if (mapCamera != null) { freeCameraPosition = mapCamera.Position; freeCameraDirection = SphereDir.FromVector(mapCamera.Rotation.GetForward()); } else { freeCameraPosition = Map.Instance.EditorCameraPosition; freeCameraDirection = Map.Instance.EditorCameraDirection; } } }
private void buttonLoadMap_Click(object sender, RoutedEventArgs e) { if (comboBoxMaps.SelectedIndex == -1) { return; } string mapName = (string)comboBoxMaps.SelectedItem; WPFAppWorld.MapLoad(mapName, true); }
private void buttonConnect_Click(object sender, RoutedEventArgs e) { WPFAppWorld.WorldDestroy(); if (ExampleEngineApp.Instance != null) { ExampleEngineApp.Instance.Client_DisconnectFromServer(); } string host = textBoxServerAddress.Text; int port = 56565; string userName = textBoxUserName.Text; string password = ""; ExampleEngineApp.Instance.TryConnectToServer(host, port, userName, password); }
private void Window_Loaded(object sender, RoutedEventArgs e) { //NeoAxis initialization if (!WPFAppWorld.Init(this, "user:Logs/WPFAppExample.log")) { Close(); return; } UpdateVolume(); //load map WPFAppWorld.MapLoad("Maps\\WindowsAppExample\\Map.map", true); renderTargetUserControl1.AutomaticUpdateFPS = 60; renderTargetUserControl1.Render += renderTargetUserControl1_Render; renderTargetUserControl1.RenderUI += renderTargetUserControl1_RenderUI; }
private void Window_Loaded(object sender, RoutedEventArgs e) { //NeoAxis initialization if (!WPFAppWorld.Init(new WPFAppEngineApp(EngineApp.ApplicationTypes.Simulation), this, "user:Logs/WPFSimpleExample.log", true, null, null, null, null)) { Close(); return; } renderTargetUserControl1.AutomaticUpdateFPS = 60; renderTargetUserControl1.KeyDown += renderTargetUserControl1_KeyDown; renderTargetUserControl1.KeyUp += renderTargetUserControl1_KeyUp; renderTargetUserControl1.MouseDown += renderTargetUserControl1_MouseDown; renderTargetUserControl1.MouseUp += renderTargetUserControl1_MouseUp; renderTargetUserControl1.MouseMove += renderTargetUserControl1_MouseMove; renderTargetUserControl1.Tick += renderTargetUserControl1_Tick; renderTargetUserControl1.Render += renderTargetUserControl1_Render; renderTargetUserControl1.RenderUI += renderTargetUserControl1_RenderUI; const string startMapName = "Maps\\MainMenu\\Map.map"; //generate map list { string[] mapList = VirtualDirectory.GetFiles("", "*.map", SearchOption.AllDirectories); foreach (string mapName in mapList) { comboBoxMaps.Items.Add(mapName); if (mapName == startMapName) { comboBoxMaps.SelectedIndex = comboBoxMaps.Items.Count - 1; } } } //load map WPFAppWorld.MapLoad(startMapName, true); }
void Client_ConnectionStatusChanged(NetworkClient sender, NetworkConnectionStatuses status) { switch (status) { case NetworkConnectionStatuses.Disconnected: { //string text = "Unable to connect"; //if( sender.DisconnectionReason != "" ) // text += ". " + sender.DisconnectionReason; //Log.Error( text ); WPFAppWorld.WorldDestroy(); Client_DisconnectFromServer(); } break; case NetworkConnectionStatuses.Connecting: break; case NetworkConnectionStatuses.Connected: break; } }
private void buttonLoadMap_Click(object sender, RoutedEventArgs e) { if (comboBoxMaps.SelectedIndex == -1) { return; } string mapName = (string)comboBoxMaps.SelectedItem; if (GameNetworkClient.Instance != null) { //network mode. //send request message "Example_MapLoad" to the server. GameNetworkClient.Instance.CustomMessagesService.SendToServer("Example_MapLoad", mapName); } else { //load map in single mode. WPFAppWorld.MapLoad(mapName, true); //set camera position if (Map.Instance != null) { MapCamera mapCamera = FindFirstMapCamera(); if (mapCamera != null) { freeCameraPosition = mapCamera.Position; freeCameraDirection = SphereDir.FromVector(mapCamera.Rotation.GetForward()); } else { freeCameraPosition = Map.Instance.EditorCameraPosition; freeCameraDirection = Map.Instance.EditorCameraDirection; } } } }
private void Window_Closed(object sender, EventArgs e) { //NeoAxis shutdown WPFAppWorld.Shutdown(); }
public static void Shutdown() { WPFAppWorld.Shutdown(); }
public static bool Init(Window mainWindow, WorldViewModel worldViewModel) { WorldViewModel = worldViewModel; return(WPFAppWorld.Init(mainWindow, "user:Logs/Strive.log") && WPFAppWorld.MapLoad("Maps/Gr1d/Map.map", true)); }
private void Window_Loaded(object sender, RoutedEventArgs e) { //D3DImage support //D3DImage feature is a new level of interoperability between WPF and DirectX by allowing a custom Direct3D (D3D) //surface to be blended with WPF's native D3D surface. { string[] args = Environment.GetCommandLineArgs(); for (int n = 1; n < args.Length; n++) { string arg = args[n]; if (arg.ToLower() == "/d3dimage") { RendererWorld.InitializationOptions.AllowDirectX9Ex = true; } } } //NeoAxis initialization if (!WPFAppWorld.Init(new ExampleEngineApp(EngineApp.ApplicationTypes.Simulation), this, "user:Logs/WPFAppExample.log", true, null, null, null, null)) { Close(); return; } UpdateVolume(); renderTargetUserControl1.AutomaticUpdateFPS = 60; renderTargetUserControl1.KeyDown += renderTargetUserControl1_KeyDown; renderTargetUserControl1.KeyUp += renderTargetUserControl1_KeyUp; renderTargetUserControl1.MouseDown += renderTargetUserControl1_MouseDown; renderTargetUserControl1.MouseUp += renderTargetUserControl1_MouseUp; renderTargetUserControl1.MouseMove += renderTargetUserControl1_MouseMove; renderTargetUserControl1.Tick += renderTargetUserControl1_Tick; renderTargetUserControl1.Render += renderTargetUserControl1_Render; renderTargetUserControl1.RenderUI += renderTargetUserControl1_RenderUI; const string startMapName = "Maps\\MainMenu\\Map.map"; //generate map list { string[] mapList = VirtualDirectory.GetFiles("", "*.map", SearchOption.AllDirectories); foreach (string mapName in mapList) { comboBoxMaps.Items.Add(mapName); if (mapName == startMapName) { comboBoxMaps.SelectedIndex = comboBoxMaps.Items.Count - 1; } } } //load map WPFAppWorld.MapLoad(startMapName, true); //set camera position if (Map.Instance != null) { MapCamera mapCamera = FindFirstMapCamera(); if (mapCamera != null) { freeCameraPosition = mapCamera.Position; freeCameraDirection = SphereDir.FromVector(mapCamera.Rotation.GetForward()); } else { freeCameraPosition = Map.Instance.EditorCameraPosition; freeCameraDirection = Map.Instance.EditorCameraDirection; } } if (!RendererWorld.InitializationOptions.AllowDirectX9Ex) { //checkBoxUseD3DImage.IsEnabled = false; checkBoxUseD3DImage.IsChecked = false; } initialized = true; }
private void buttonDestroy_Click(object sender, RoutedEventArgs e) { WPFAppWorld.WorldDestroy(); }
void Client_EntitySystemService_WorldDestroy(EntitySystemClientNetworkService sender, bool newMapWillBeLoaded) { WPFAppWorld.WorldDestroy(); }