Elin Modding Docs Doc
Loading...
Searching...
No Matches
Steam.cs
1using System;
2using System.IO;
3using HeathenEngineering.SteamworksIntegration;
4using HeathenEngineering.SteamworksIntegration.API;
5using Steamworks;
6using UnityEngine;
7using UnityEngine.Events;
8
9// Token: 0x020001B2 RID: 434
10public class Steam : MonoBehaviour
11{
12 // Token: 0x06000C66 RID: 3174 RVA: 0x0005CB37 File Offset: 0x0005AD37
13 private void Awake()
14 {
15 Steam.Instance = this;
16 }
17
18 // Token: 0x06000C67 RID: 3175 RVA: 0x0005CB3F File Offset: 0x0005AD3F
19 public void Init()
20 {
21 SteamAPI.Init();
22 BaseCore.IsOffline = (!App.Client.LoggedOn || SteamSettings.behaviour == null);
23 }
24
25 // Token: 0x06000C68 RID: 3176 RVA: 0x0005CB61 File Offset: 0x0005AD61
26 public void CheckUpdate()
27 {
28 }
29
30 // Token: 0x06000C69 RID: 3177 RVA: 0x0005CB63 File Offset: 0x0005AD63
31 public void CheckDLC()
32 {
33 Debug.Log(Steam.HasDLC(ID_DLC.Test));
34 }
35
36 // Token: 0x06000C6A RID: 3178 RVA: 0x0005CB7C File Offset: 0x0005AD7C
37 public static bool HasDLC(ID_DLC id)
38 {
39 if (id != ID_DLC.BackerReward)
40 {
41 }
42 return EClass.core.config.HasBackerRewardCode();
43 }
44
45 // Token: 0x06000C6B RID: 3179 RVA: 0x0005CBA4 File Offset: 0x0005ADA4
46 public static void GetAchievement(ID_Achievement id)
47 {
48 string text = "acv_" + id.ToString();
49 foreach (AchievementObject achievementObject in Steam.Instance.steamworks.settings.achievements)
50 {
51 if (achievementObject.Id == text)
52 {
53 if (achievementObject.IsAchieved)
54 {
55 return;
56 }
57 achievementObject.Unlock();
58 EClass.ui.Say("sys_acv".lang(text.lang(), null, null, null, null), Resources.Load<Sprite>("Media/Graphics/Icon/Achievement/" + text));
59 return;
60 }
61 }
62 Debug.Log("Achievement not found:" + text);
63 }
64
65 // Token: 0x06000C6C RID: 3180 RVA: 0x0005CC74 File Offset: 0x0005AE74
66 public void TestHasDLC()
67 {
68 Debug.Log(Steam.HasDLC(ID_DLC.Test));
69 Debug.Log(Steam.HasDLC(ID_DLC.CursedManor));
70 }
71
72 // Token: 0x06000C6D RID: 3181 RVA: 0x0005CCA0 File Offset: 0x0005AEA0
73 public void CreateUserContent(BaseModPackage p)
74 {
75 LayerProgress.Start("Uploading", null).onCancel = delegate()
76 {
77 };
78 p.UpdateMeta(true);
79 this.currentPackage = p;
80 UgcQuery myPublished = UgcQuery.GetMyPublished();
81 myPublished.SetReturnKeyValueTags(true);
82 myPublished.Execute(new UnityAction<UgcQuery>(this.CreateUserContent2));
83 }
84
85 // Token: 0x06000C6E RID: 3182 RVA: 0x0005CD0C File Offset: 0x0005AF0C
86 private void CreateUserContent2(UgcQuery query)
87 {
88 Debug.Log("Creating Content2");
89 BaseModPackage baseModPackage = this.currentPackage;
90 if (query.ResultsList != null)
91 {
92 Debug.Log(query.ResultsList.Count);
93 }
94 foreach (WorkshopItem workshopItem in query.ResultsList)
95 {
96 if (workshopItem.keyValueTags != null)
97 {
98 foreach (StringKeyValuePair stringKeyValuePair in workshopItem.keyValueTags)
99 {
100 if (stringKeyValuePair.key == "id" && stringKeyValuePair.value == baseModPackage.id && workshopItem.Owner.id == App.Client.Owner.id)
101 {
102 Debug.Log("Updating Content");
103 this.UpdateUserContent(workshopItem.FileId);
104 return;
105 }
106 }
107 }
108 }
109 Debug.Log("Creating Content");
110 FileInfo fileInfo = new FileInfo(baseModPackage.dirInfo.FullName + "/preview.jpg");
111 DirectoryInfo directoryInfo = new DirectoryInfo(baseModPackage.dirInfo.FullName);
112 WorkshopItemData workshopItemData = new WorkshopItemData
113 {
114 appId = this.steamworks.settings.applicationId,
115 title = baseModPackage.title,
116 description = baseModPackage.description,
117 content = directoryInfo,
118 preview = fileInfo,
119 metadata = (baseModPackage.id ?? ""),
120 tags = new string[0]
121 };
122 Debug.Log(App.Client.Owner.id);
123 Debug.Log(workshopItemData.appId);
124 Debug.Log(baseModPackage.id);
125 Debug.Log(directoryInfo.Exists.ToString() + "/" + directoryInfo.FullName);
126 Debug.Log(fileInfo.Exists.ToString() + "/" + fileInfo.FullName);
127 workshopItemData.Create(null, null, new WorkshopItemKeyValueTag[]
128 {
129 new WorkshopItemKeyValueTag
130 {
131 key = "id",
132 value = baseModPackage.id
133 }
134 }, delegate(WorkshopItemDataCreateStatus result)
135 {
136 LayerProgress.completed = true;
137 if (result.hasError)
138 {
139 Dialog.Ok("mod_publish_error");
140 Debug.Log("error:" + result.errorMessage);
141 return;
142 }
143 Dialog.Ok("mod_created");
144 Debug.Log("created");
145 }, null, null);
146 }
147
148 // Token: 0x06000C6F RID: 3183 RVA: 0x0005CFA0 File Offset: 0x0005B1A0
149 public void UpdateUserContent(PublishedFileId_t fileId)
150 {
151 Debug.Log("Updating Content");
152 BaseModPackage baseModPackage = this.currentPackage;
153 WorkshopItemData workshopItemData = new WorkshopItemData
154 {
155 appId = this.steamworks.settings.applicationId,
156 title = baseModPackage.title,
157 description = baseModPackage.description,
158 content = new DirectoryInfo(baseModPackage.dirInfo.FullName),
159 preview = new FileInfo(baseModPackage.dirInfo.FullName + "/preview.jpg"),
160 metadata = (baseModPackage.id ?? ""),
161 tags = new string[0]
162 };
163 workshopItemData.publishedFileId = new PublishedFileId_t?(fileId);
164 workshopItemData.Update(delegate(WorkshopItemDataUpdateStatus result)
165 {
166 LayerProgress.completed = true;
167 if (result.hasError)
168 {
169 Dialog.Ok("mod_publish_error");
170 Debug.Log("error:" + result.errorMessage);
171 return;
172 }
173 Dialog.Ok("mod_updated");
174 Debug.Log("updated");
175 }, null);
176 }
177
178 // Token: 0x04000C36 RID: 3126
179 public static Steam Instance;
180
181 // Token: 0x04000C37 RID: 3127
182 public SteamworksBehaviour steamworks;
183
184 // Token: 0x04000C38 RID: 3128
185 public UserGeneratedContentQueryManager ugc;
186
187 // Token: 0x04000C39 RID: 3129
188 public WorkshopItem testData;
189
190 // Token: 0x04000C3A RID: 3130
191 public BaseModPackage currentPackage;
192}
Definition Steam.cs:11