Beispiel #1
0
        void ProcessSteamEvents()
        {
            CallbackMsg msg = SteamClient.GetCallback();

            SteamClient.FreeLastCallback();

            while (msg != null)
            {
                HandleSteamCallback(msg);

                msg = SteamClient.GetCallback();
                SteamClient.FreeLastCallback();
            }
        }
Beispiel #2
0
        public static void Update()
        {
            CallbackMsg msg = SteamClient.GetCallback();

            if (msg == null)
            {
                return;
            }

            SteamClient.FreeLastCallback();

            if (msg.IsType <SteamClient.ConnectedCallback>())
            {
                SteamUser.LogOn(new SteamUser.LogOnDetails()
                {
                    Username = Steam3.UserName,
                    Password = Steam3.Password,

                    AuthCode = Steam3.AuthCode,
                });
            }

            List <ICallbackHandler> tempHandlers = new List <ICallbackHandler>(callbackHandlers);

            // push it along to anyone who wants to handle this
            foreach (ICallbackHandler handler in tempHandlers)
            {
                handler.HandleCallback(msg);
            }
        }
Beispiel #3
0
            protected override void OnPostExecute(CallbackMsg result)
            {
                base.OnPostExecute(result);

                SteamClient client = SteamService.GetClient().Client;

                if (result != null)
                {
                    client.FreeLastCallback();

                    SteamService.GetClient().ProcessCallback(result);
                }

                new SteamCallback().Execute();
            }
Beispiel #4
0
        /// <summary>
        /// Updates the Steam client and passes any pending callbacks
        /// </summary>
        public void Update()
        {
            while (true)
            {
                CallbackMsg msg = client.WaitForCallback(true);

                if (msg == null)
                {
                    return;
                }

                client.FreeLastCallback();

                if (msg.IsType <SteamClient.ConnectCallback>())
                {
                    user.LogOn(new SteamUser.LogOnDetails()
                    {
                        Username = username,
                        Password = password,
                        AuthCode = authcode
                    });
                }

                if (msg.IsType <SteamClient.DisconnectCallback>())
                {
                    loggedIn = false;
                }

                if (msg.IsType <SteamUser.LogOnCallback>())
                {
                    SteamUser.LogOnCallback callback = (SteamUser.LogOnCallback)msg;

                    if (callback.Result == EResult.OK)
                    {
                        this.loggedIn = true;
                        this.authcode = null;
                    }

                    Friends.SetPersonaState(EPersonaState.Online);
                }

                Push(msg);
            }
        }
Beispiel #5
0
        void HandleCallback()
        {
            var msg = client.GetCallback();

            if (msg == null)
            {
                return;
            }

            client.FreeLastCallback();

            msg.Handle <SteamFriends.FriendMsgCallback>(friendMsg => {
                switch (friendMsg.EntryType)
                {
                case EChatEntryType.ChatMsg:
                case EChatEntryType.Emote:
                case EChatEntryType.InviteGame:
                    NotifyMessage(friendMsg.Sender, friendMsg.Message);
                    break;
                }
            });
        }