public override object Call(params object[] args) { string msg = (string)args[0]; switch (msg) { case "AddAchievement": if (Main.netMode != 0) { break; } GenerateAchievement((Mod)args[1], (string)args[2], (string)args[3], (Texture2D)args[4], (Texture2D)args[5], (AchievementCategory)args[6]); //GetSaveData(); break; case "UnlockLocal": ModAchievement.UnlockLocal((string)args[1], (string)args[2], (Player)args[3]); break; case "UnlockGlobal": ModAchievement.UnlockGlobal((string)args[1], (string)args[2]); break; case "GetAchievement": for (int k = 0; k < lines.Count; k++) { if (lines[k] == (string)args[1] && lines[k + 1] == (string)args[2]) { return(lines[k + 2] == "True" ? true : false); } } break; } return("success"); }
public void AutoLoad(Type type, Mod mod) { ModAchievement achievement = (ModAchievement)Activator.CreateInstance(type); Achievements.Add(achievement); achievement.mod = mod; }
internal void setProperties(ModAchievement achievement, int i) { this.achievement = achievement; picture = new UIImage(achievement.texture); index = i; }
public void addAchievementToList(ModAchievement achievement) { foreach (string s in doneAchievementList) { if (s == achievement.name) { return; } } doneAchievementList.Add(achievement.name); }
private void GenerateAchievement(Mod mod, string name, string description, Texture2D lockedtex, Texture2D unlockedtex, AchievementCategory category) { ModAchievement ach = new ModAchievement(); ach.mod = mod; ach.Name = name; ach.Description = description; ach.LockedTexture = lockedtex; ach.UnlockedTexture = unlockedtex; ach.Category = category; Achievement cheev = ach.GetAchievement(); FieldInfo cat = typeof(Achievement).GetField("_category", BindingFlags.NonPublic | BindingFlags.Instance); cat.SetValue(cheev, ach.Category); Achievements.Add(ach); }
public override bool CanUseItem(Player player) { ModAchievement.UnlockLocal <ExampleAchievement>(player); //This unlocks the "AchievementLib Tester" achievement when the item is used, for the player that used it. return(true); }
public void AddAchievement(ModAchievement achievement) { achievementsList.Add(achievement); }