Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
CoreSocialModule.cs
Go to the documentation of this file.
1using System;
3using System.Windows.Forms;
4using ReLogic.OS;
5using Steamworks;
7
9
11{
13
14 public const int SteamAppId = 105600;
15
16 private bool IsSteamValid;
17
18 private object _steamTickLock = new object();
19
20 private object _steamCallbackLock = new object();
21
22 private Callback<GameOverlayActivated_t> _onOverlayActivated;
23
24 private bool _skipPulsing;
25
26 public static event Action OnTick;
27
28 public static void SetSkipPulsing(bool shouldSkipPausing)
29 {
30 }
31
32 public void Initialize()
33 {
34 //IL_0012: Unknown result type (might be due to invalid IL or missing references)
35 _instance = this;
36 if (!Main.dedServ && SteamAPI.RestartAppIfNecessary(new AppId_t(105600u)))
37 {
39 return;
40 }
41 if (!SteamAPI.Init())
42 {
43 MessageBox.Show(Language.GetTextValue("Error.LaunchFromSteam"), Language.GetTextValue("Error.Error"));
45 }
46 IsSteamValid = true;
47 Thread thread = new Thread(SteamCallbackLoop);
48 thread.IsBackground = true;
49 thread.Start();
50 Thread thread2 = new Thread(SteamTickLoop);
51 thread2.IsBackground = true;
52 thread2.Start();
53 Main.OnTickForThirdPartySoftwareOnly += PulseSteamTick;
54 Main.OnTickForThirdPartySoftwareOnly += PulseSteamCallback;
55 if (Platform.IsOSX && !Main.dedServ)
56 {
57 _onOverlayActivated = Callback<GameOverlayActivated_t>.Create((DispatchDelegate<GameOverlayActivated_t>)OnOverlayActivated);
58 }
59 }
60
69
78
79 public static void Pulse()
80 {
81 _instance.PulseSteamTick();
82 _instance.PulseSteamCallback();
83 }
84
85 private void SteamTickLoop(object context)
86 {
88 while (IsSteamValid)
89 {
90 if (_skipPulsing)
91 {
93 continue;
94 }
95 if (CoreSocialModule.OnTick != null)
96 {
98 }
100 }
102 }
103
104 private void SteamCallbackLoop(object context)
105 {
107 while (IsSteamValid)
108 {
109 if (_skipPulsing)
110 {
112 continue;
113 }
114 SteamAPI.RunCallbacks();
116 }
118 SteamAPI.Shutdown();
119 }
120
121 public void Shutdown()
122 {
123 IsSteamValid = false;
124 }
125
126 public void OnOverlayActivated(GameOverlayActivated_t result)
127 {
128 //IL_0005: Unknown result type (might be due to invalid IL or missing references)
129 Main.instance.IsMouseVisible = result.m_bActive == 1;
130 }
131}
static bool IsOSX
Definition Platform.cs:21
static void Exit(int exitCode)
static void Exit(object obj)
static bool Wait(object obj, int millisecondsTimeout)
Definition Monitor.cs:87
static bool TryEnter(object obj)
Definition Monitor.cs:36
static void Enter(object obj)
static void Pulse(object obj)
Definition Monitor.cs:103
void Start(object? parameter)
Definition Thread.cs:574
static string GetTextValue(string key)
Definition Language.cs:15
static bool dedServ
Definition Main.cs:1226
Callback< GameOverlayActivated_t > _onOverlayActivated
void OnOverlayActivated(GameOverlayActivated_t result)
static void SetSkipPulsing(bool shouldSkipPausing)