예제 #1
0
        public ServerShipManager(World serverWorld, EventManager eventManager, YmfasServer _server)
        {
            serverShipLog = Mogre.LogManager.Singleton.CreateLog("server-ship.log");
            serverShipLog.LogMessage("creating ssm");

            world = serverWorld;
            eventMgr = eventManager;
            server = _server;

            //init ships
            ShipTypeData curShipType = new ShipTypeData();
            curShipType.Class = ShipClass.Interceptor;
            curShipType.Model = ShipModel.MogreFighter;

            //player ships
            foreach (int id in server.PlayerIds )
            {
                Vector3 curPosition = Vector3.ZERO;//new Vector3(Mogre.Math.RangeRandom(-TestEngine.WorldSizeParam / 1.5f, TestEngine.WorldSizeParam / 1.5f), Mogre.Math.RangeRandom(-TestEngine.WorldSizeParam / 1.5f, TestEngine.WorldSizeParam / 1.5f), Mogre.Math.RangeRandom(-TestEngine.WorldSizeParam / 1.5f, TestEngine.WorldSizeParam / 1.5f));
                Quaternion curOrientation = Quaternion.IDENTITY;

                ShipInit curShipInit = new ShipInit(id, curShipType, curPosition, curOrientation,
                    server.GetPlayerName(id));
                eventMgr.SendEvent(curShipInit);

                Util.Log("sent init for ship " + id);

                //put them in world
                Ship s = new Ship(world, id, curPosition, curOrientation);
                shipTable.Add(id, s);
            }

            //init listeners
            ShipControlStatus.FiringEvent += new GameEventFiringHandler(handleShipControlStatus);
        }
예제 #2
0
        public frmGameLobby(YmfasClient _client, YmfasServer _server)
        {
            client    = _client;
            server    = _server;
            lobbyMode = LobbyMode.Hosting;
            Initialize();

            chkReady.Visible    = false;
            cmbGameMode.Enabled = true;
            idTicketCounter     = 1;
        }
예제 #3
0
        public frmGameLobby(YmfasClient _client, YmfasServer _server)
        {
            client = _client;
            server = _server;
            lobbyMode = LobbyMode.Hosting;
            Initialize();

            chkReady.Visible = false;
            cmbGameMode.Enabled = true;
            idTicketCounter = 1;
        }
예제 #4
0
        public void Dispose()
        {
            // destroy the server
            if (netServer != null)
            {
                netServer.Dispose();
                netServer = null;
            }

            // destroy all instance-specific information
            if (world != null)
            {
                world.Dispose();
                world = null;
            }
        }
예제 #5
0
        public void Dispose()
        {
            // destroy the server
            if (netServer != null)
            {
                netServer.Dispose();
                netServer = null;
            }

            // destroy all instance-specific information
            if (world != null)
            {
                world.Dispose();
                world = null;
            }
        }
예제 #6
0
파일: Program.cs 프로젝트: andyhebear/ymfas
        /// <summary>
        /// Launches the form to configure networking 
        /// upon return, the network engine should be fully initialized
        /// </summary>
        public static bool ConfigureNetwork()
        {
            // launch the main splash window
            frmMainSplash networkForm = new frmMainSplash();
            Console.Out.WriteLine("Running the form");
            networkForm.ShowDialog();
            Console.Out.WriteLine("Form done running");

            System.Console.Write(networkForm.DialogResult);

            if (networkForm.DialogResult == System.Windows.Forms.DialogResult.Cancel)
                return false;

            // check to see if we have a host as well
            client = networkForm.Client;
            server = networkForm.Server;

            return true;
        }
예제 #7
0
        /// <summary>
        /// Launches the form to configure networking
        /// upon return, the network engine should be fully initialized
        /// </summary>
        public static bool ConfigureNetwork()
        {
            // launch the main splash window
            frmMainSplash networkForm = new frmMainSplash();

            Console.Out.WriteLine("Running the form");
            networkForm.ShowDialog();
            Console.Out.WriteLine("Form done running");

            System.Console.Write(networkForm.DialogResult);

            if (networkForm.DialogResult == System.Windows.Forms.DialogResult.Cancel)
            {
                return(false);
            }

            // check to see if we have a host as well
            client = networkForm.Client;
            server = networkForm.Server;

            return(true);
        }
예제 #8
0
        public ServerShipManager(World serverWorld, EventManager eventManager, YmfasServer _server)
        {
            serverShipLog = Mogre.LogManager.Singleton.CreateLog("server-ship.log");
            serverShipLog.LogMessage("creating ssm");

            world    = serverWorld;
            eventMgr = eventManager;
            server   = _server;

            //init ships
            ShipTypeData curShipType = new ShipTypeData();

            curShipType.Class = ShipClass.Interceptor;
            curShipType.Model = ShipModel.MogreFighter;

            //player ships
            foreach (int id in server.PlayerIds)
            {
                Vector3    curPosition    = Vector3.ZERO;          //new Vector3(Mogre.Math.RangeRandom(-TestEngine.WorldSizeParam / 1.5f, TestEngine.WorldSizeParam / 1.5f), Mogre.Math.RangeRandom(-TestEngine.WorldSizeParam / 1.5f, TestEngine.WorldSizeParam / 1.5f), Mogre.Math.RangeRandom(-TestEngine.WorldSizeParam / 1.5f, TestEngine.WorldSizeParam / 1.5f));
                Quaternion curOrientation = Quaternion.IDENTITY;

                ShipInit curShipInit = new ShipInit(id, curShipType, curPosition, curOrientation,
                                                    server.GetPlayerName(id));
                eventMgr.SendEvent(curShipInit);

                Util.Log("sent init for ship " + id);


                //put them in world
                Ship s = new Ship(world, id, curPosition, curOrientation);
                shipTable.Add(id, s);
            }

            //init listeners
            ShipControlStatus.FiringEvent += new GameEventFiringHandler(handleShipControlStatus);
        }
예제 #9
0
        private void btnHost_Click(object sender, EventArgs e)
        {
            //Host a game
            // create a client and a server for the game lobby to use
            ymfasServer = new YmfasServer(txtName.Text);
            ymfasClient = new YmfasClient(txtName.Text);

            ymfasClient.Update();
            ymfasClient.Connect(IPAddress.Loopback);

            //Enter lobby
            GameLobby = new frmGameLobby(ymfasClient, ymfasServer);

            GameLobby.ShowDialog();
            // if we actually started a game
            if (GameLobby.DialogResult == DialogResult.OK)
            {
                ymfasClient = GameLobby.Client;
                ymfasServer = GameLobby.Server;

                this.DialogResult = DialogResult.OK;
                this.Close();
            }
        }
예제 #10
0
 public TestEngineServer(YmfasServer _server)
 {
     netServer = _server;
     eventMgr  = new EventManager(_server);
 }
예제 #11
0
        private void btnHost_Click(object sender, EventArgs e)
        {
            //Host a game
            // create a client and a server for the game lobby to use
            ymfasServer = new YmfasServer(txtName.Text);
            ymfasClient = new YmfasClient(txtName.Text);

            ymfasClient.Update();
            ymfasClient.Connect(IPAddress.Loopback);

            //Enter lobby
            GameLobby = new frmGameLobby(ymfasClient, ymfasServer);

            GameLobby.ShowDialog();
            // if we actually started a game
            if (GameLobby.DialogResult == DialogResult.OK) {
                ymfasClient = GameLobby.Client;
                ymfasServer = GameLobby.Server;

                this.DialogResult = DialogResult.OK;
                this.Close();
            }
        }
예제 #12
0
 public TestEngineServer(YmfasServer _server)
 {
     netServer = _server;
     eventMgr = new EventManager(_server);
 }