Elin Decompiled Documentation EA 23.357 Nightly
Loading...
Searching...
No Matches
Steam Class Reference
Inheritance diagram for Steam:

Public Member Functions

void Init ()
 
void CheckUpdate ()
 
void CheckDLC ()
 
void TestHasDLC ()
 
void CreateUserContent (BaseModPackage p)
 
void UpdateUserContent (PublishedFileId_t fileId)
 
WorkshopItemData CreateItemData (BaseModPackage p)
 

Static Public Member Functions

static bool HasDLC (ID_DLC id)
 
static void GetAchievement (ID_Achievement id)
 
static void ResetAllAchievement ()
 
static void ResetAchievement (ID_Achievement id)
 
static void QueryAllMyPublished (Action< List< WorkshopItem > > onComplete, Action< string > onFail=null, float timeout=10f)
 

Public Attributes

SteamworksBehaviour steamworks
 
UserGeneratedContentQueryManager ugc
 
WorkshopItem testData
 
BaseModPackage currentPackage
 

Static Public Attributes

static Steam Instance
 

Private Member Functions

void Awake ()
 
void CreateOrUpdateUserContent (List< WorkshopItem > items)
 

Detailed Description

Definition at line 11 of file Steam.cs.

Member Function Documentation

◆ Awake()

void Steam.Awake ( )
inlineprivate

Definition at line 23 of file Steam.cs.

24 {
25 Instance = this;
26 }
static Steam Instance
Definition: Steam.cs:13

References Instance.

◆ CheckDLC()

void Steam.CheckDLC ( )
inline

Definition at line 38 of file Steam.cs.

39 {
40 Debug.Log(HasDLC(ID_DLC.Test));
41 }
ID_DLC
Definition: ID_DLC.cs:2
static bool HasDLC(ID_DLC id)
Definition: Steam.cs:43

References Debug, and HasDLC().

◆ CheckUpdate()

void Steam.CheckUpdate ( )
inline

Definition at line 34 of file Steam.cs.

35 {
36 }

Referenced by CoreDebug.UpdateInput().

◆ CreateItemData()

WorkshopItemData Steam.CreateItemData ( BaseModPackage  p)
inline

Definition at line 279 of file Steam.cs.

280 {
281 FileInfo fileInfo = new FileInfo(p.dirInfo.FullName + "/preview.jpg");
282 DirectoryInfo directoryInfo = new DirectoryInfo(p.dirInfo.FullName);
283 WorkshopItemData result = new WorkshopItemData
284 {
285 appId = steamworks.settings.applicationId,
286 title = p.title,
287 description = p.description,
288 content = directoryInfo,
289 preview = fileInfo,
290 metadata = (p.id ?? ""),
291 tags = p.tags,
292 visibility = ERemoteStoragePublishedFileVisibility.k_ERemoteStoragePublishedFileVisibilityPublic
293 };
294 switch (p.visibility)
295 {
296 case "Unlisted":
297 result.visibility = ERemoteStoragePublishedFileVisibility.k_ERemoteStoragePublishedFileVisibilityUnlisted;
298 break;
299 case "Private":
300 result.visibility = ERemoteStoragePublishedFileVisibility.k_ERemoteStoragePublishedFileVisibilityPrivate;
301 break;
302 case "FriendsOnly":
303 result.visibility = ERemoteStoragePublishedFileVisibility.k_ERemoteStoragePublishedFileVisibilityFriendsOnly;
304 break;
305 }
306 Debug.Log(App.Client.Owner.id);
307 Debug.Log(result.appId);
308 Debug.Log(p.id);
309 Debug.Log(directoryInfo.Exists + "/" + directoryInfo.FullName);
310 Debug.Log(fileInfo.Exists + "/" + fileInfo.FullName);
311 return result;
312 }
item3. title
Definition: UIBook.cs:640
DirectoryInfo dirInfo
SteamworksBehaviour steamworks
Definition: Steam.cs:15

References Debug, BaseModPackage.description, BaseModPackage.dirInfo, BaseModPackage.id, steamworks, BaseModPackage.tags, BaseModPackage.title, title, and BaseModPackage.visibility.

Referenced by CreateOrUpdateUserContent(), and UpdateUserContent().

◆ CreateOrUpdateUserContent()

void Steam.CreateOrUpdateUserContent ( List< WorkshopItem >  items)
inlineprivate

Definition at line 208 of file Steam.cs.

209 {
210 Debug.Log("Creating Content2");
211 BaseModPackage baseModPackage = currentPackage;
212 Debug.Log(items.Count);
213 foreach (WorkshopItem item in items)
214 {
215 if (item.keyValueTags.IsEmpty())
216 {
217 continue;
218 }
219 StringKeyValuePair[] keyValueTags = item.keyValueTags;
220 for (int i = 0; i < keyValueTags.Length; i++)
221 {
222 StringKeyValuePair stringKeyValuePair = keyValueTags[i];
223 if (stringKeyValuePair.key == "id" && stringKeyValuePair.value == baseModPackage.id && item.Owner.IsMe)
224 {
225 Debug.Log("Updating Content");
226 UpdateUserContent(item.FileId);
227 return;
228 }
229 }
230 }
231 Debug.Log("Creating Content");
232 CreateItemData(baseModPackage).Create(null, null, new WorkshopItemKeyValueTag[1]
233 {
234 new WorkshopItemKeyValueTag
235 {
236 key = "id",
237 value = baseModPackage.id
238 }
239 }, delegate(WorkshopItemDataCreateStatus result)
240 {
241 LayerProgress.completed = true;
242 if (result.hasError)
243 {
244 Dialog.Ok("mod_publish_error");
245 EClass.ui.Say(result.errorMessage);
246 Debug.Log("error:" + result.errorMessage);
247 }
248 else
249 {
250 Dialog.Ok("mod_created");
251 Debug.Log("created");
252 }
253 });
254 }
Definition: Dialog.cs:7
static Dialog Ok(string langDetail, Action action=null)
Definition: Dialog.cs:230
Definition: EClass.cs:6
static UI ui
Definition: EClass.cs:17
void UpdateUserContent(PublishedFileId_t fileId)
Definition: Steam.cs:256
BaseModPackage currentPackage
Definition: Steam.cs:21
WorkshopItemData CreateItemData(BaseModPackage p)
Definition: Steam.cs:279

References CreateItemData(), currentPackage, Debug, item, Dialog.Ok(), EClass.ui, and UpdateUserContent().

Referenced by CreateUserContent().

◆ CreateUserContent()

void Steam.CreateUserContent ( BaseModPackage  p)
inline

Definition at line 117 of file Steam.cs.

118 {
119 LayerProgress.Start("Uploading").onCancel = delegate
120 {
121 };
122 p.UpdateMeta(updateOnly: true);
123 currentPackage = p;
124 QueryAllMyPublished(CreateOrUpdateUserContent, delegate(string error)
125 {
126 LayerProgress.completed = true;
127 Debug.LogError(error);
128 Dialog.Ok("mod_publish_error");
129 });
130 }
void UpdateMeta(bool updateOnly=false)
static LayerProgress Start(string text, Action onComplete=null)
static void QueryAllMyPublished(Action< List< WorkshopItem > > onComplete, Action< string > onFail=null, float timeout=10f)
Definition: Steam.cs:132
void CreateOrUpdateUserContent(List< WorkshopItem > items)
Definition: Steam.cs:208

References CreateOrUpdateUserContent(), currentPackage, Debug, Dialog.Ok(), LayerProgress.onCancel, QueryAllMyPublished(), LayerProgress.Start(), and BaseModPackage.UpdateMeta().

◆ GetAchievement()

static void Steam.GetAchievement ( ID_Achievement  id)
inlinestatic

Definition at line 53 of file Steam.cs.

54 {
56 {
57 return;
58 }
59 try
60 {
61 foreach (AchievementObject achievement in Instance.steamworks.settings.achievements)
62 {
63 if (achievement.Id == id.ToString())
64 {
65 if (achievement.IsAchieved)
66 {
67 return;
68 }
69 try
70 {
71 achievement.Unlock();
72 achievement.Store();
73 EClass.ui.Say("sys_acv".lang(achievement.Name), Resources.Load<Sprite>("Media/Graphics/Icon/Achievement/acv_" + id));
74 SE.Play("achievement");
75 return;
76 }
77 catch (Exception ex)
78 {
79 Debug.LogError("Error Achievement 1:" + ex);
80 return;
81 }
82 }
83 }
84 }
85 catch (Exception ex2)
86 {
87 Debug.LogError("Error Achievement 2:" + ex2);
88 }
89 Debug.Log("Achievement not found:" + id);
90 }
static bool IsOffline
Definition: BaseCore.cs:9

References Debug, Instance, BaseCore.IsOffline, steamworks, and EClass.ui.

Referenced by Chara._ShowDialog(), FactionBranch.AddMemeber(), Chara.Die(), Religion.JoinFaith(), Player.ModKarma(), Trait.OnBarter(), UIHangIcon.OnClickCorner(), TraitDrink.OnDrink(), Chara.OnInsulted(), Trait.OnLockOpen(), AI_Fish.ProgressFish.OnProgressComplete(), TraitDiary.OnRead(), ConSmoking.OnStart(), DramaManager.ParseLine(), FoodEffect.Proc(), ActEffect.Proc(), AI_Eat.Run(), AI_Idle.Run(), Chara.ShowDialog(), Chara.Slap(), CoreDebug.UpdateAlways(), Player.UpdateNyan(), and DramaOutcome.upgrade_miscreation().

◆ HasDLC()

static bool Steam.HasDLC ( ID_DLC  id)
inlinestatic

Definition at line 43 of file Steam.cs.

44 {
45 return id switch
46 {
47 ID_DLC.CursedManor => true,
48 ID_DLC.BackerReward => EClass.core.config.HasBackerRewardCode(),
50 };
51 }
bool HasBackerRewardCode()
Definition: CoreConfig.cs:761
CoreConfig config
Definition: Core.cs:70
static Core core
Definition: EClass.cs:7

References Core.config, EClass.core, and CoreConfig.HasBackerRewardCode().

Referenced by CheckDLC(), FactionBranch.ReceivePackages(), and TestHasDLC().

◆ Init()

void Steam.Init ( )
inline

Definition at line 28 of file Steam.cs.

29 {
30 SteamAPI.Init();
31 BaseCore.IsOffline = !App.Client.LoggedOn || SteamSettings.behaviour == null;
32 }

Referenced by Core.Start().

◆ QueryAllMyPublished()

static void Steam.QueryAllMyPublished ( Action< List< WorkshopItem > >  onComplete,
Action< string >  onFail = null,
float  timeout = 10f 
)
inlinestatic

Definition at line 132 of file Steam.cs.

133 {
134 List<WorkshopItem> results = new List<WorkshopItem>();
135 HashSet<PublishedFileId_t> ids = new HashSet<PublishedFileId_t>();
136 uint page = 1u;
137 bool done = false;
138 UgcQuery query = UgcQuery.GetMyPublished();
139 ExecutePage();
140 if (!done && (bool)Instance)
141 {
142 Instance.StartCoroutine(Timeout());
143 }
144 void ExecutePage()
145 {
146 query.SetReturnKeyValueTags(tags: true);
147 query.SetReturnMetadata(metadata: true);
148 if (!query.Execute(HandleResults))
149 {
150 ReportError("UgcQuery.Execute failed at page " + page);
151 }
152 }
153 void HandleResults(UgcQuery q)
154 {
155 if (!done)
156 {
157 results.AddRange(q.ResultsList.Where((WorkshopItem r) => ids.Add(r.FileId)));
158 if (q.ResultsList.Count == 0 || page >= q.pageCount)
159 {
160 done = true;
161 query.Dispose();
162 onComplete?.Invoke(results);
163 }
164 else
165 {
166 query.SetPage(++page);
167 EClass.core.actionsNextFrame.Add(ExecutePage);
168 }
169 }
170 }
171 void ReportError(string error)
172 {
173 if (!done)
174 {
175 done = true;
176 query.Dispose();
177 if (onFail != null)
178 {
179 onFail(error);
180 }
181 else
182 {
183 Debug.LogError(error);
184 }
185 }
186 }
187 IEnumerator Timeout()
188 {
189 uint lastPage = page;
190 float time = Time.realtimeSinceStartup;
191 while (!done)
192 {
193 if (lastPage != page)
194 {
195 lastPage = page;
196 time = Time.realtimeSinceStartup;
197 }
198 if (Time.realtimeSinceStartup - time > timeout)
199 {
200 ReportError("UgcQuery timed out at page " + page + " (" + results.Count + " items fetched)");
201 break;
202 }
203 yield return null;
204 }
205 }
206 }
List< Action > actionsNextFrame
Definition: BaseCore.cs:31

References BaseCore.actionsNextFrame, EClass.core, Debug, and Instance.

Referenced by CreateUserContent().

◆ ResetAchievement()

static void Steam.ResetAchievement ( ID_Achievement  id)
inlinestatic

Definition at line 101 of file Steam.cs.

102 {
103 AchievementObject achievementObject = Instance.steamworks.settings.achievements.FirstOrDefault((AchievementObject a) => a.Id == id.ToString());
104 if (achievementObject != null)
105 {
106 achievementObject.ClearAchievement();
107 achievementObject.Store();
108 }
109 }

References Instance, and steamworks.

Referenced by CoreDebug.ResetAchievement().

◆ ResetAllAchievement()

static void Steam.ResetAllAchievement ( )
inlinestatic

Definition at line 92 of file Steam.cs.

93 {
94 foreach (AchievementObject achievement in Instance.steamworks.settings.achievements)
95 {
96 achievement.ClearAchievement();
97 achievement.Store();
98 }
99 }

References Instance, and steamworks.

Referenced by CoreDebug.ResetAllAchievement().

◆ TestHasDLC()

void Steam.TestHasDLC ( )
inline

Definition at line 111 of file Steam.cs.

112 {
113 Debug.Log(HasDLC(ID_DLC.Test));
114 Debug.Log(HasDLC(ID_DLC.CursedManor));
115 }

References Debug, and HasDLC().

◆ UpdateUserContent()

void Steam.UpdateUserContent ( PublishedFileId_t  fileId)
inline

Definition at line 256 of file Steam.cs.

257 {
258 Debug.Log("Updating Content");
260 WorkshopItemData workshopItemData = CreateItemData(p);
261 workshopItemData.publishedFileId = fileId;
262 workshopItemData.Update(delegate(WorkshopItemDataUpdateStatus result)
263 {
264 LayerProgress.completed = true;
265 if (result.hasError)
266 {
267 Dialog.Ok("mod_publish_error");
268 EClass.ui.Say(result.errorMessage);
269 Debug.Log("error:" + result.errorMessage);
270 }
271 else
272 {
273 Dialog.Ok("mod_updated");
274 Debug.Log("updated");
275 }
276 });
277 }

References CreateItemData(), currentPackage, and Debug.

Referenced by CreateOrUpdateUserContent().

Member Data Documentation

◆ currentPackage

BaseModPackage Steam.currentPackage

Definition at line 21 of file Steam.cs.

Referenced by CreateOrUpdateUserContent(), CreateUserContent(), and UpdateUserContent().

◆ Instance

Steam Steam.Instance
static

◆ steamworks

SteamworksBehaviour Steam.steamworks

◆ testData

WorkshopItem Steam.testData

Definition at line 19 of file Steam.cs.

◆ ugc

UserGeneratedContentQueryManager Steam.ugc

Definition at line 17 of file Steam.cs.


The documentation for this class was generated from the following file: