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


C# ClientGCMsgProtobuf类代码示例

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


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

示例1: OnNotification

        void OnNotification( ClientGCMsgProtobuf<CMsgGCTFSpecificItemBroadcast> msg, uint gcAppId )
        {
            string itemName = GetItemName( msg.Body.item_def_index, gcAppId );

            if ( msg.Body.was_destruction )
            {
                IRC.Instance.SendToTag( "gc-tf2", "{0} GC item notification: {1} has destroyed their {2}!", Steam.Instance.GetAppName( gcAppId ), msg.Body.user_name, itemName );
            }
            else
            {
                IRC.Instance.SendToTag( "gc-tf2", "{0} GC item notification: {1} just received a {2}!", Steam.Instance.GetAppName( gcAppId ), msg.Body.user_name, itemName );
            }
        }
开发者ID:Markusyatina,项目名称:steam-irc-bot,代码行数:13,代码来源:TF2GCHandlers.cs

示例2: OnNotification

        void OnNotification( ClientGCMsgProtobuf<CMsgGCTFSpecificItemBroadcast> msg )
        {
            string itemName = GetItemName( msg.Body.item_def_index );

            if ( msg.Body.was_destruction )
            {
                IRC.Instance.SendToTag( "tf2-gc", "Item notification: {0} has destroyed their {1}!", msg.Body.user_name, itemName );
            }
            else
            {
                IRC.Instance.SendToTag( "tf2-gc", "Item notification: {0} just received a {1}!", msg.Body.user_name, itemName );
            }
        }
开发者ID:Netshroud,项目名称:steam-irc-bot,代码行数:13,代码来源:TF2GCHandlers.cs

示例3: OnWelcome

        void OnWelcome( ClientGCMsgProtobuf<CMsgClientWelcome> msg )
        {
            if ( msg.Body.version != lastGcVersion && lastGcVersion != 0 )
            {
                IRC.Instance.SendToTag( "gc", "New {0} GC session (version: {1}, previous version: {2})", Steam.Instance.GetAppName( Settings.Current.GCApp ), msg.Body.version, lastGcVersion );
            }
            else
            {
                IRC.Instance.SendToTag( "gc", "New {0} GC session (version: {1})", Steam.Instance.GetAppName( Settings.Current.GCApp ), msg.Body.version );
            }

            lastGcVersion = msg.Body.version;
        }
开发者ID:Netshroud,项目名称:steam-irc-bot,代码行数:13,代码来源:GCHandlers.cs

示例4: OnItemSchema

        void OnItemSchema( ClientGCMsgProtobuf<CMsgUpdateItemSchema> msg )
        {
            if ( lastSchemaVersion != msg.Body.item_schema_version && lastSchemaVersion != 0 )
            {
                IRC.Instance.SendToTag( "gc", "New {0} GC item schema (version: {1:X4}): {2}", Steam.Instance.GetAppName( Settings.Current.GCApp ), lastSchemaVersion, msg.Body.items_game_url );
            }

            lastSchemaVersion = msg.Body.item_schema_version;

            using ( var webClient = new WebClient() )
            {
                webClient.DownloadFileAsync( new Uri( msg.Body.items_game_url ), Path.Combine( Application.StartupPath, "items_game.txt" ) );
            }
        }
开发者ID:Netshroud,项目名称:steam-irc-bot,代码行数:14,代码来源:GCHandlers.cs

示例5: OnItemSchema

        void OnItemSchema( ClientGCMsgProtobuf<CMsgUpdateItemSchema> msg, uint gcAppId )
        {
            string ircTag = string.Format( "gc-{0}", Settings.Current.GetTagForGCApp( gcAppId ) );

            if ( lastSchemaVersion != msg.Body.item_schema_version && lastSchemaVersion != 0 )
            {
                IRC.Instance.SendToTag( ircTag, "New {0} GC item schema (version: {1:X4}): {2}", Steam.Instance.GetAppName( gcAppId ), lastSchemaVersion, msg.Body.items_game_url );
            }

            lastSchemaVersion = msg.Body.item_schema_version;

            using ( var webClient = new WebClient() )
            {
                string itemsGameFile = string.Format( "items_game_{0}.txt", gcAppId );

                webClient.DownloadFileAsync( new Uri( msg.Body.items_game_url ), Path.Combine( Application.StartupPath, itemsGameFile ) );
            }
        }
开发者ID:Markusyatina,项目名称:steam-irc-bot,代码行数:18,代码来源:GCHandlers.cs

示例6: OnItemSchemaUpdate

        private void OnItemSchemaUpdate(uint appID, IPacketGCMsg packetMsg)
        {
            var msg = new ClientGCMsgProtobuf<CMsgUpdateItemSchema>(packetMsg).Body;

            var info = GetSessionInfo(appID);

            if (info.SchemaVersion != 0 && info.SchemaVersion != msg.item_schema_version)
            {
                IRC.Instance.SendMain("{0}{1}{2} item schema updated: {3}{4}{5} -{6} {7}", Colors.BLUE, Steam.GetAppName(appID), Colors.NORMAL, Colors.DARKGRAY, msg.item_schema_version.ToString("X4"), Colors.NORMAL, Colors.DARKBLUE, msg.items_game_url);
            }

            info.SchemaVersion = msg.item_schema_version;
        }
开发者ID:GoeGaming,项目名称:SteamDatabaseBackend,代码行数:13,代码来源:GameCoordinator.cs

示例7: OnSessionTick

        private void OnSessionTick(object sender, ElapsedEventArgs e)
        {
            if (!Steam.Instance.Client.IsConnected)
            {
                return;
            }

            foreach (var appID in Settings.Current.GameCoordinatorIdlers)
            {
                var info = GetSessionInfo(appID);

                if (info.Status == GCConnectionStatus.GCConnectionStatus_NO_SESSION
                ||  info.Status == GCConnectionStatus.GCConnectionStatus_GC_GOING_DOWN)
                {
                    var hello = new ClientGCMsgProtobuf<CMsgClientHello>((uint)EGCBaseClientMsg.k_EMsgGCClientHello);

                    if (info.AppID == 570)
                    {
                        hello.Body.engine = ESourceEngine.k_ESE_Source2;
                    }

                    SteamGameCoordinator.Send(hello, appID);
                }
            }
        }
开发者ID:GoeGaming,项目名称:SteamDatabaseBackend,代码行数:25,代码来源:GameCoordinator.cs

示例8: Connect

		public Task<uint> Connect(bool autoReconect, CancellationToken cancellationToken)
		{
			return Task.Run<uint>(() => {
				bool completed = false;
				uint version = 0;

				// get the GC handler, which is used for messaging DOTA
				var gcHandler = this.SteamClient.GetHandler<SteamGameCoordinator>();

				// register a few callbacks we're interested in
				var cbManager = new CallbackManager(this.SteamClient);

				// these are registered upon creation to a callback manager, 
				// which will then route the callbacks to the functions specified
				cbManager.Subscribe<SteamClient.ConnectedCallback>((SteamClient.ConnectedCallback callback) => {
					cancellationToken.ThrowIfCancellationRequested();

					if (callback.Result == EResult.OK)
					{
						Trace.TraceInformation("Connected to Steam, Logging in '{0}'", this.Username);

						// get the steamuser handler, which is used for logging on after successfully connecting
						var UserHandler = this.SteamClient.GetHandler<SteamUser>();
						UserHandler.LogOn(new SteamUser.LogOnDetails
						{
							Username = this.Username,
							Password = this.Password,
							SentryFileHash = this.Sentry,
						});
					}
					else
					{
						Trace.TraceError("Unable to connect to Steam");

						throw new Exception("Failed to Connect");
					}
				});

				cbManager.Subscribe<SteamClient.DisconnectedCallback>((SteamClient.DisconnectedCallback callback) => {
					cancellationToken.ThrowIfCancellationRequested();

					Trace.TraceInformation("Disconnected from Steam.");

					if (autoReconect)
					{
						// delay a little to give steam some time to finalize the DC
						Thread.Sleep(TimeSpan.FromSeconds(1));

						// reconect
						this.SteamClient.Connect();
					}
				});

				cbManager.Subscribe<SteamUser.LoggedOnCallback>((SteamUser.LoggedOnCallback callback) => {
					cancellationToken.ThrowIfCancellationRequested();

					if (callback.Result == EResult.OK)
					{
						Trace.TraceInformation("Successfully logged on!");

						// we've logged into the account
						// now we need to inform the steam server that we're playing dota (in order to receive GC messages)
						// steamkit doesn't expose the "play game" message through any handler, so we'll just send the message manually
						var gameMsg = new ClientMsgProtobuf<CMsgClientGamesPlayed>(EMsg.ClientGamesPlayed);
						gameMsg.Body.games_played.Add(new CMsgClientGamesPlayed.GamePlayed
						{
							game_id = new GameID(APPID), // or game_id = APPID,
						});

						// send it off - notice here we're sending this message directly using the SteamClient
						this.SteamClient.Send(gameMsg);

						// delay a little to give steam some time to establish a GC connection to us
						Thread.Sleep(TimeSpan.FromSeconds(1));

						// inform the dota GC that we want a session
						var helloMsg = new ClientGCMsgProtobuf<CMsgClientHello>((uint)EGCBaseClientMsg.k_EMsgGCClientHello);
						helloMsg.Body.engine = ESourceEngine.k_ESE_Source2;
						gcHandler.Send(helloMsg, APPID);
					}
					else if (callback.Result == EResult.AccountLogonDenied)
					{
						Trace.TraceInformation("Account {0}@{1} is denied.", this.Username, callback.EmailDomain);

						throw new Exception(string.Format("Account {0}@{1} is denied.", this.Username, callback.EmailDomain));
					}
					else
					{
						Trace.TraceError("Failed to Login; Result {0}", callback.Result);

						throw new Exception("Failed to Login.");
					}
				});

				cbManager.Subscribe<SteamGameCoordinator.MessageCallback>((SteamGameCoordinator.MessageCallback callback) =>
				{
					cancellationToken.ThrowIfCancellationRequested();

					if (callback.EMsg == (uint)EGCBaseClientMsg.k_EMsgGCClientWelcome)
					{
//.........这里部分代码省略.........
开发者ID:HighGroundVision,项目名称:Crystalys,代码行数:101,代码来源:DotaGameClient.cs

示例9: OnItemBroadcast

        private void OnItemBroadcast(uint appID, IPacketGCMsg packetMsg)
        {
            if (appID != 440)
            {
                // This message should be TF2 specific, but just in case
                return;
            }

            var msg = new ClientGCMsgProtobuf<CMsgGCTFSpecificItemBroadcast>(packetMsg).Body;

            var itemName = GetItemName(441, msg.item_def_index);

            IRC.Instance.SendMain("{0}{1}{2} item notification: {3}{4}{5} {6} {7}{8}{9}!",
                Colors.BLUE, Steam.GetAppName(appID), Colors.NORMAL,
                Colors.BLUE, msg.user_name, Colors.NORMAL,
                msg.was_destruction ? "has destroyed their" : "just received a",
                Colors.OLIVE, itemName, Colors.NORMAL
            );
        }
开发者ID:GoeGaming,项目名称:SteamDatabaseBackend,代码行数:19,代码来源:GameCoordinator.cs

示例10: OnSystemMessage

 void OnSystemMessage( ClientGCMsgProtobuf<CMsgSystemBroadcast> msg )
 {
     IRC.Instance.SendToTag( "gc", "{0} GC system message: {1}", Steam.Instance.GetAppName( Settings.Current.GCApp ), msg.Body.message );
 }
开发者ID:Netshroud,项目名称:steam-irc-bot,代码行数:4,代码来源:GCHandlers.cs

示例11: OnConnectionStatus

 void OnConnectionStatus( ClientGCMsgProtobuf<CMsgConnectionStatus> msg )
 {
     IRC.Instance.SendToTag( "gc", "{0} GC status: {1}", Steam.Instance.GetAppName( Settings.Current.GCApp ), msg.Body.status );
 }
开发者ID:Netshroud,项目名称:steam-irc-bot,代码行数:4,代码来源:GCHandlers.cs

示例12: OnItemSchemaUpdate

        private void OnItemSchemaUpdate(IPacketGCMsg packetMsg)
        {
            var msg = new ClientGCMsgProtobuf<CMsgUpdateItemSchema>(packetMsg).Body;

            if (LastSchemaVersion != 0 && LastSchemaVersion != msg.item_schema_version)
            {
                Log.WriteInfo(Name, "Schema change from {0} to {1}", LastSchemaVersion, msg.item_schema_version);

                IRC.SendMain("{0}{1}{2} item schema updated: {3}{4}{5} -{6} {7}", Colors.OLIVE, SteamProxy.GetAppName(AppID), Colors.NORMAL, Colors.DARK_GRAY, msg.item_schema_version.ToString("X4"), Colors.NORMAL, Colors.DARK_BLUE, msg.items_game_url);
            }

            LastSchemaVersion = msg.item_schema_version;
        }
开发者ID:TomasDuda,项目名称:SteamDatabaseBackend,代码行数:13,代码来源:GameCoordinator.cs

示例13: OnWelcome

        private void OnWelcome(uint appID, IPacketGCMsg packetMsg)
        {
            var msg = new ClientGCMsgProtobuf<CMsgClientWelcome>(packetMsg).Body;

            var info = GetSessionInfo(appID);

            string message = string.Format("{0}{1}{2} new GC session", Colors.BLUE, Steam.GetAppName(appID), Colors.NORMAL);

            if (info.Version == 0 || info.Version == msg.version)
            {
                message += string.Format(" {0}(version {1})", Colors.DARKGRAY, msg.version);
            }
            else
            {
                message += string.Format(" {0}(version changed from {1} to {2})", Colors.DARKGRAY, info.Version, msg.version);

                IRC.Instance.SendMain(message);
            }

            IRC.Instance.SendAnnounce(message);

            info.Version = msg.version;
            info.Status = GCConnectionStatus.GCConnectionStatus_HAVE_SESSION;
        }
开发者ID:GoeGaming,项目名称:SteamDatabaseBackend,代码行数:24,代码来源:GameCoordinator.cs

示例14: OnClientConnectionStatus

        private void OnClientConnectionStatus(IPacketGCMsg packetMsg)
        {
            var msg = new ClientGCMsgProtobuf<CMsgConnectionStatus>(packetMsg).Body;

            LastStatus = msg.status;

            Log.WriteInfo(Name, "Status: {0}", LastStatus);

            string message = string.Format("{0}{1}{2} GC status:{3} {4}", Colors.OLIVE, SteamProxy.GetAppName(AppID), Colors.NORMAL, Colors.OLIVE, LastStatus);

            IRC.SendAnnounce(message);

            if (LastStatus == GCConnectionStatus.GCConnectionStatus_NO_SESSION)
            {
                Timer.Interval = TimeSpan.FromSeconds(5).TotalMilliseconds;
                Timer.Start();
            }

            UpdateStatus(AppID, LastStatus.ToString());
        }
开发者ID:TomasDuda,项目名称:SteamDatabaseBackend,代码行数:20,代码来源:GameCoordinator.cs

示例15: OnClientWelcome

        private void OnClientWelcome(IPacketGCMsg packetMsg)
        {
            Timer.Stop();

            var msg = new ClientGCMsgProtobuf<CMsgClientWelcome>(packetMsg).Body;

            Log.WriteInfo(Name, "New GC session ({0} -> {1})", LastVersion, msg.version);

            string message = string.Format("New {0}{1}{2} GC session", Colors.OLIVE, SteamProxy.GetAppName(AppID), Colors.NORMAL);

            if (LastVersion == -1 || LastVersion == msg.version)
            {
                message += string.Format(" {0}(version {1})", Colors.DARK_GRAY, msg.version);
            }
            else
            {
                message += string.Format(" {0}(version changed from {1} to {2})", Colors.DARK_GRAY, LastVersion, msg.version);
            }

            if (LastVersion != -1 && (LastVersion != msg.version || LastStatus != GCConnectionStatus.GCConnectionStatus_HAVE_SESSION))
            {
                IRC.SendMain(message);
            }

            IRC.SendAnnounce(message);

            LastVersion = (int)msg.version;
            LastStatus = GCConnectionStatus.GCConnectionStatus_HAVE_SESSION;

            UpdateStatus(AppID, LastStatus.ToString());
        }
开发者ID:TomasDuda,项目名称:SteamDatabaseBackend,代码行数:31,代码来源:GameCoordinator.cs


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