示例#1
0
        private void TrolhaTimer_Tick(object sender, EventArgs e)
        {
            string FriendPersonaState = steamfriends002.GetFriendPersonaState(steamid.ConvertToUint64()).ToString().Replace("k_EPersonaState", "");

            switch (FriendPersonaState)
            {
            case "Offline":
                lbl_currentSteamState.ForeColor = Color.Gray;
                lbl_currentSteamState.Text      = FriendPersonaState;
                break;

            case "Online":
                lbl_currentSteamState.ForeColor = Color.DodgerBlue;
                lbl_currentSteamState.Text      = FriendPersonaState;
                break;

            case "Away":
            case "Busy":
            case "Snooze":
                lbl_currentSteamState.ForeColor = Color.Orange;
                lbl_currentSteamState.Text      = FriendPersonaState;
                break;

            case "LookingToTrade":
            case "LookingToPlay":
                lbl_currentSteamState.ForeColor = Color.DodgerBlue;
                lbl_currentSteamState.Text      = FriendPersonaState;
                break;

            default:
                lbl_currentSteamState.ForeColor = Color.White;
                lbl_currentSteamState.Text      = FriendPersonaState;
                break;
            }
        }
示例#2
0
        private int LoadSteam()
        {
            if (Steamworks.Load(true))
            {
                Console.WriteLine("Ok, Steam Works!");
            }
            else
            {
                MessageBox.Show("Failed, Steam Works!");
                Console.WriteLine("Failed, Steam Works!");

                return(-1);
            }

            steam006 = Steamworks.CreateSteamInterface <ISteam006>();

            steamclient     = Steamworks.CreateInterface <ISteamClient012>();
            pipe            = steamclient.CreateSteamPipe();
            user            = steamclient.ConnectToGlobalUser(pipe);
            steamuser       = steamclient.GetISteamUser <ISteamUser016>(user, pipe);
            steamfriends013 = steamclient.GetISteamFriends <ISteamFriends013>(user, pipe);
            steamfriends002 = steamclient.GetISteamFriends <ISteamFriends002>(user, pipe);
            CSteamID steamID = steamuser.GetSteamID();

            CurrentState = steamfriends002.GetFriendPersonaState(steamID);

            string ConvertTo64 = steamID.ConvertToUint64().ToString();

            txtBox_steamID.Text = ConvertTo64;
            steamid             = steamID;
            if (steam006 == null)
            {
                Console.WriteLine("steam006 is null !");
                return(-1);
            }
            if (steamclient == null)
            {
                Console.WriteLine("steamclient is null !");
                return(-1);
            }


            return(0);
        }