当前位置: 首页>>代码示例>>C#>>正文


C# GameServer类代码示例

本文整理汇总了C#中GameServer的典型用法代码示例。如果您正苦于以下问题:C# GameServer类的具体用法?C# GameServer怎么用?C# GameServer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


GameServer类属于命名空间,在下文中一共展示了GameServer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: UnitBase

        public UnitBase(GameServer _server, Player player)
            : base(_server, player)
        {
            EntityType = Entity.EntityType.Unit;
            UnitType = UnitTypes.Default;

            EntityToAttack = null;

            Speed = .01f;
            Range = 50;
            AttackDelay = 100;
            AttackRechargeTime = 1000;
            SupplyUsage = 1;
            RangedUnit = false;

            StandardAttackDamage = 1;
            StandardAttackElement = Entity.DamageElement.Normal;

            State = UnitState.Agro;
            allowMovement = false;
            _moveXCompleted = false;
            _moveYCompleted = false;

            attackTimer = new Stopwatch();
            attackTimer.Reset();
            attackTimer.Stop();

            rechargeTimer = new Stopwatch();
            rechargeTimer.Restart();

            updatedMovePositionTimer = new Stopwatch();
            updatedMovePositionTimer.Start();
        }
开发者ID:Austech,项目名称:HGlueSim,代码行数:33,代码来源:UnitBase.cs

示例2: Main

        public static void Main()
        {
            server = new GameServer(9958);
            server.Ennable();

            Console.ReadKey();
        }
开发者ID:matheus2984,项目名称:ConquerTradingCards,代码行数:7,代码来源:Program.cs

示例3: Main

        static void Main(string[] args)
        {
            var settings = ReadSettings(Program.Location + "Settings.xml");

            Console.WriteLine("Name: " + settings.Name);
            Console.WriteLine("Port: " + settings.Port);
            Console.WriteLine("Player Limit: " + settings.MaxPlayers);
            Console.WriteLine("Starting...");

            ServerInstance = new GameServer(settings.Port, settings.Name, settings.Gamemode);
            ServerInstance.PasswordProtected = settings.PasswordProtected;
            ServerInstance.Password = settings.Password;
            ServerInstance.AnnounceSelf = settings.Announce;
            ServerInstance.MasterServer = settings.MasterServer;
            ServerInstance.MaxPlayers = settings.MaxPlayers;
            ServerInstance.AllowDisplayNames = settings.AllowDisplayNames;

            ServerInstance.Start(settings.Filterscripts);

            Console.WriteLine("Started! Waiting for connections.");

            while (true)
            {
                ServerInstance.Tick();
                System.Threading.Thread.Sleep(10); // Reducing CPU Usage (Win7 from average 15 % to 0-1 %, Linux from 100 % to 0-2 %)
            }
        }
开发者ID:butich,项目名称:GTACoop,代码行数:27,代码来源:Program.cs

示例4: Main

        static void Main(string[] args)
        {
            var settings = ReadSettings(Program.Location + "Settings.xml");

            Console.WriteLine("Name: " + settings.Name);
            Console.WriteLine("Port: " + settings.Port);
            Console.WriteLine("Player Limit: " + settings.MaxPlayers);
            Console.WriteLine("Starting...");

            ServerInstance = new GameServer(settings.Port, settings.Name, settings.Gamemode);
            ServerInstance.PasswordProtected = settings.PasswordProtected;
            ServerInstance.Password = settings.Password;
            ServerInstance.AnnounceSelf = settings.Announce;
            ServerInstance.MasterServer = settings.MasterServer;
            ServerInstance.MaxPlayers = settings.MaxPlayers;

            ServerInstance.Start(settings.Filterscripts);

            Console.WriteLine("Started! Waiting for connections.");

            while (true)
            {
                ServerInstance.Tick();
            }
        }
开发者ID:Mercurial,项目名称:GTACoop,代码行数:25,代码来源:Program.cs

示例5: IsMatch

	public bool IsMatch(GameServer server)
	{
		if (server.IsConnected == _isConnected)
			return true;
		else
			return false;
	}
开发者ID:viticm,项目名称:pap2,代码行数:7,代码来源:GameServerFilter.cs

示例6: NetworkMultiplayer

        public NetworkMultiplayer(bool createServer = false)
            : base(GameModes.Network)
        {
            if(createServer)
                GameServer = new GameServer();

            //read network on each update
            Game.Instance.OnUpdate += ReadNetwork;

            //server config
            NetPeerConfiguration config = new NetPeerConfiguration("tank");
            config.EnableMessageType(NetIncomingMessageType.DiscoveryResponse);

            //server creation
            Client = new NetClient(config);
            Client.Start();

            if (!createServer)
            {
                //check whether the user has a known server
                ListMenu serverMenu = new ListMenu("Do you want to connect to a given IP (if yes, enter in console)?", "tank.Code.YESORNOCHOOSENOW", ConnectionMethodSelectionCallback);
                Scene.Add(serverMenu);
            }
            else//we know that a local server must exist
                Client.DiscoverLocalPeers(14242);
            //register handler for receiving data
            OnClientData += IncomingHandler;

            //are we client, or are we dancer?
            if(!createServer)
                Console.WriteLine("client");
        }
开发者ID:JOCP9733,项目名称:tank,代码行数:32,代码来源:NetworkMultiplayer.cs

示例7: Initialize

		public override void Initialize(GameServer server)
		{
			base.Initialize(server);

			_queryCount = 1;
			_queryResultCache = Hashtable.Synchronized(new Hashtable());
			_server.MessageReceived += new MessageReceivedEventHandler(this.MessageReceived);
		}
开发者ID:viticm,项目名称:pap2,代码行数:8,代码来源:GameServerDb.cs

示例8: RegisterResult

        /// <summary>
        /// Sends the result of server register
        /// </summary>
        /// <param name="server"></param>
        /// <param name="result">0 = success; 1 = duplicated index</param>
        public void RegisterResult(GameServer server, ushort result)
        {
            AG.RegisterResult registerResult = new AG.RegisterResult();
            registerResult.Result = result;

            registerResult.CreateChecksum();
            GameManager.Instance.Send(server, PacketManager.ToArray(registerResult));
        }
开发者ID:KirieZ,项目名称:Tartarus,代码行数:13,代码来源:GamePackets.cs

示例9: GameServerMultiplayer

        public GameServerMultiplayer(GameServerSettings settings)
        {
            server = new GameServer<IServerPlayPacket, IClientPlayPacket>(
                serverPort, IPAddress.Parse(GameClientMultiplayer.multicastAddress));
            server.OnReceiveClientPacket += OnReceiveClientPacket;

            this.settings = settings;
            connectedPlayers = new Dictionary<int, Player>();
        }
开发者ID:NiklasVd,项目名称:Assemblify,代码行数:9,代码来源:GameServerMultiplayer.cs

示例10: GameManager

 public GameManager(RealmCore rCore)
 {
     RCore = rCore;
     Server = new GameServer();
     Server.ClientDisconnected += Server_ClientDisconnected;
     Server.NewClientConntected += Server_NewClientConntected;
     Server.NewDataReceived += Server_NewDataReceived;
     Server.NewDataSended += Server_NewDataSended;
     Server.Started += Server_Started;
     Server.Stoped += Server_Stoped;
 }
开发者ID:Knps,项目名称:Edden,代码行数:11,代码来源:GameManager.cs

示例11: Initialize

        protected override void Initialize()
        {
            if (AppSettings.Default.EnableServer)
            {
                GameServer server = new GameServer(new MapGenerator().Generate(30, 16), AppSettings.Default.ListenPort);
                server.Start();
            }
            ApplyGraphicsSettings();

            base.Initialize();
        }
开发者ID:NobodysNightmare,项目名称:BlockDefender,代码行数:11,代码来源:BlockDefenderGame.cs

示例12: MessageReceived

		private void MessageReceived(GameServer server, IProtocol message)
		{
			if ((ProtocolDef)message.ProtocolId == ProtocolDef.g2e_exesql_def)
			{
				g2e_exesql protocol = message as g2e_exesql;
				bool success = ((FSEyeResult)protocol.nRetCode == FSEyeResult.fseye_success);
				bool done = ((FSEyeResult)protocol.nRetCode != FSEyeResult.mydb_more_result);
								
				UpdateQueryResultCache(protocol.nSessionID, protocol.szResult, done, success);
			}
		}
开发者ID:viticm,项目名称:pap2,代码行数:11,代码来源:GameServerDb.cs

示例13: LLApiServer

 public LLApiServer(GameServer gameServer, int port, ushort maxConnections, ushort maxMessages)
 {
     GameServer = gameServer;
     Port = port;
     MaxConnections = maxConnections;
     MaxMessages = maxMessages;
     isConnected = false;
     Config = new ConnectionConfig();
     int ReliableChannelId = Config.AddChannel(QosType.Reliable);
     int NonReliableChannelId = Config.AddChannel(QosType.Unreliable);
     Topology = new HostTopology(Config, MaxConnections);
 }
开发者ID:buronix,项目名称:LLApi-Basic-Implementation,代码行数:12,代码来源:LLApiServer.cs

示例14: Query

    protected FS2RoleDataInfo Query(GameServer server, int roleId)
    {
        FS2RoleDataInfo roleInfo = null;
        ArrayList paramList = new ArrayList();
        paramList.Add(roleId);
        string selectedFiled = string.Format("{0},{1},{2},{3},{4}",
            FS2TableString.RolesfirstFieldMoney,FS2TableString.RolesfirstFieldMoneyInBox,
            FS2TableString.RolesfirstFieldItemList,FS2TableString.RolesfirstFieldRoleName,
            FS2TableString.RolesfirstFieldId);
        string sqlCmdText = string.Format("SELECT {0} FROM {1} WHERE {2}='?';" ,selectedFiled,
            FS2TableString.RolesfirstTableName, FS2TableString.RolesfirstFieldId);
        SqlCommand cmd = new SqlCommand(sqlCmdText, paramList.ToArray());
        if (!server.IsConnected)
        {
            LabelOpMsg.Visible = true;
            LabelOpMsg.Text = StringDef.NoConnectionAlert;
            return null;
        }
        SqlResult result = WebUtil.QueryGameServerDb(CurrentUser.Id,server,cmd);
        if (result != null && result.Success)
        {
            result.SetFieldType(new SqlDataType[]{
                SqlDataType.UInt32,
                SqlDataType.UInt32,
                SqlDataType.Blob,
                SqlDataType.String,
                SqlDataType.Int32
                });
            object[] record;
            byte[] itemData;

            roleInfo = new FS2RoleDataInfo();
            while ((record = result.ReadRecord())!=null)
            {
                if (record != null)
                {
                    roleInfo.Money = (uint)record[0];
                    roleInfo.MoneyInBox = (uint)record[1];                    
                    itemData = (byte[])record[2];
                    if (itemData != null)
                    {
                        roleInfo.ItemList = FS2ItemDataInfo.Parse(itemData);
                        //if (info != null) ItemList.Add(info);
                    }
                    roleInfo.RoleName = record[3] as string;
                    roleInfo.RoleId = (int)record[4];
                }
            }
            //RenderView(roleInfo);
        }
        return roleInfo;
    }
开发者ID:viticm,项目名称:pap2,代码行数:52,代码来源:RoleItemInfo.aspx.cs

示例15: ProjectileBase

        public ProjectileBase(GameServer _server, Player player, Vector2f startPosition, EntityBase target, float dmg, Entity.DamageElement element, float speed = 1)
            : base(_server, player)
        {
            EntityType = Entity.EntityType.Projectile;
            Start = startPosition;
            Target = target;
            Position = Start;
            BoundsSize = new Vector2f(5, 5);

            Damage = dmg;
            Element = element;
            Speed = speed;
            RemoveOnNoHealth = false;
        }
开发者ID:Austech,项目名称:HGlueSim,代码行数:14,代码来源:ProjectileBase.cs


注:本文中的GameServer类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。