protected override void OnDestroy()
        {
            WPFAppWorld.WorldDestroy();
            Client_DisconnectFromServer();

            base.OnDestroy();
            instance = null;
        }
예제 #2
0
 private void buttonDestroy_Click(object sender, RoutedEventArgs e)
 {
     WPFAppWorld.WorldDestroy();
     if (ExampleEngineApp.Instance != null)
     {
         ExampleEngineApp.Instance.Client_DisconnectFromServer();
     }
 }
예제 #3
0
        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;
                }
            }
        }
예제 #4
0
        private void buttonLoadMap_Click(object sender, RoutedEventArgs e)
        {
            if (comboBoxMaps.SelectedIndex == -1)
            {
                return;
            }
            string mapName = (string)comboBoxMaps.SelectedItem;

            WPFAppWorld.MapLoad(mapName, true);
        }
예제 #5
0
        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);
        }
예제 #6
0
        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;
        }
예제 #7
0
        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;
            }
        }
예제 #9
0
        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;
                    }
                }
            }
        }
예제 #10
0
 private void Window_Closed(object sender, EventArgs e)
 {
     //NeoAxis shutdown
     WPFAppWorld.Shutdown();
 }
예제 #11
0
 public static void Shutdown()
 {
     WPFAppWorld.Shutdown();
 }
예제 #12
0
 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));
 }
예제 #13
0
        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;
        }
예제 #14
0
 private void buttonDestroy_Click(object sender, RoutedEventArgs e)
 {
     WPFAppWorld.WorldDestroy();
 }
예제 #15
0
 void Client_EntitySystemService_WorldDestroy(EntitySystemClientNetworkService sender,
                                              bool newMapWillBeLoaded)
 {
     WPFAppWorld.WorldDestroy();
 }