public static void SetVariable(string name, StoryVar val) { if (instance.globals.ContainsKey(name)) { instance.globals[name] = val.Duplicate(); } else { instance.globals.Add(name, val.Duplicate()); } //Save Game }
public override void SetMember(StoryVar member, StoryVar value) { var memberName = member.ToString().ToLower(); if (memberName == "length") { throw new VarTypeMemberException("'length' cannot be modified."); } int index; if (HarloweUtils.TryPositionToIndex(memberName, Values.Count, out index)) { try { Values[index] = value.Duplicate(); } catch (System.IndexOutOfRangeException) { throw new VarTypeMemberException(string.Format("The array doesn't have a {0} position.", memberName)); } } else { throw new VarTypeMemberException(string.Format("The array doesn't have a member called {0}.", memberName)); } }
public override void SetMember(StoryVar member, StoryVar value) { var memberName = member.ToString(); Dictionary[memberName] = value.Duplicate(); }