Esempio n. 1
0
    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
    }
Esempio n. 2
0
        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));
            }
        }
Esempio n. 3
0
        public override void SetMember(StoryVar member, StoryVar value)
        {
            var memberName = member.ToString();

            Dictionary[memberName] = value.Duplicate();
        }