Elin Decompiled Documentation EA 23.334 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 278 of file Steam.cs.

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

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

Referenced by CreateOrUpdateUserContent(), and UpdateUserContent().

◆ CreateOrUpdateUserContent()

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

Definition at line 207 of file Steam.cs.

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

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:207

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:751
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 if (!query.Execute(HandleResults))
148 {
149 ReportError("UgcQuery.Execute failed at page " + page);
150 }
151 }
152 void HandleResults(UgcQuery q)
153 {
154 if (!done)
155 {
156 results.AddRange(q.ResultsList.Where((WorkshopItem r) => ids.Add(r.FileId)));
157 if (q.ResultsList.Count == 0 || page >= q.pageCount)
158 {
159 done = true;
160 query.Dispose();
161 onComplete?.Invoke(results);
162 }
163 else
164 {
165 query.SetPage(++page);
166 ExecutePage();
167 }
168 }
169 }
170 void ReportError(string error)
171 {
172 if (!done)
173 {
174 done = true;
175 query.Dispose();
176 if (onFail != null)
177 {
178 onFail(error);
179 }
180 else
181 {
182 Debug.LogError(error);
183 }
184 }
185 }
186 IEnumerator Timeout()
187 {
188 uint lastPage = page;
189 float time = Time.realtimeSinceStartup;
190 while (!done)
191 {
192 if (lastPage != page)
193 {
194 lastPage = page;
195 time = Time.realtimeSinceStartup;
196 }
197 if (Time.realtimeSinceStartup - time > timeout)
198 {
199 ReportError("UgcQuery timed out at page " + page + " (" + results.Count + " items fetched)");
200 break;
201 }
202 yield return null;
203 }
204 }
205 }

References 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 255 of file Steam.cs.

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

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: