示例#1
0
 private int GetFlagStart(EventVarType type)
 {
     return(type switch
     {
         EventVarType.Zone => ZoneFlagStart,
         EventVarType.System => SystemFlagStart,
         EventVarType.Vanish => VanishFlagStart,
         EventVarType.Event => EventFlagStart,
         _ => throw new ArgumentException(nameof(type))
     });
        public int GetWorkRawIndex(EventVarType type, int index)
        {
            int max = GetWorkCount(type);

            if ((uint)index > max)
            {
                throw new ArgumentException(nameof(index));
            }
            var start = GetWorkStart(type);

            return(start + index);
        }
示例#3
0
        public int GetFlagRawIndex(EventVarType type, int index)
        {
            int max = GetFlagCount(type);

            if ((uint)index > max)
            {
                throw new ArgumentOutOfRangeException(nameof(index));
            }
            var start = GetFlagStart(type);

            return(start + index);
        }
        private int GetWorkCount(EventVarType type)
        {
            switch (type)
            {
            case EventVarType.Zone: return(ZoneWorkCount);

            case EventVarType.System: return(SystemWorkCount);

            case EventVarType.Scene: return(SceneWorkCount);

            case EventVarType.Event: return(EventWorkCount);
            }
            throw new ArgumentException(nameof(type));
        }
        private int GetFlagCount(EventVarType type)
        {
            switch (type)
            {
            case EventVarType.Zone: return(ZoneFlagCount);

            case EventVarType.System: return(SystemFlagCount);

            case EventVarType.Vanish: return(VanishFlagCount);

            case EventVarType.Event: return(EventFlagCount);
            }
            throw new ArgumentException(nameof(type));
        }
示例#6
0
 private static bool GetIndex(string l, out int index, out EventVarType type)
 {
     if (!TypeDict.TryGetValue(l[0], out type))
     {
         Debug.WriteLine($"Rejected line due to bad type. {l[0]}");
         index = -1;
         return(false);
     }
     if (!int.TryParse(l.Substring(1), out index))
     {
         Debug.WriteLine($"Rejected line due to bad index. {l[0]}");
         return(false);
     }
     return(true);
 }
示例#7
0
        public EventWork(int index, EventVarType t, IReadOnlyList <string> pieces) : base(index, t, pieces[1])
        {
            if (pieces.Count < 3)
            {
                return;
            }

            var items = pieces[2]
                        .Split(',')
                        .Select(z => z.Split(':'))
                        .Where(z => z.Length == 2);

            foreach (var s in items)
            {
                if (int.TryParse(s[0], out var val))
                {
                    Options.Add(new EventWorkVal(s[1], val));
                }
            }
        }
示例#8
0
 public EventFlag(int index, EventVarType t, IReadOnlyList <string> pieces) : base(index, t, pieces[1])
 {
 }
示例#9
0
 protected EventVar(int index, EventVarType t, string name)
 {
     RelativeIndex = index;
     Type          = t;
     Name          = name;
 }
 public void SetFlag(EventVarType type, int index, bool value = true) => SetFlag(GetFlagRawIndex(type, index), value);
 public bool GetFlag(EventVarType type, int index) => GetFlag(GetFlagRawIndex(type, index));
 public void SetWork(EventVarType type, int index, int value) => SetWork(GetWorkRawIndex(type, index), value);
 public int GetWork(EventVarType type, int index) => GetWork(GetWorkRawIndex(type, index));
示例#14
0
 public EventVarGroup(EventVarType type) => Type = type;
示例#15
0
 private static int GetFlagStart(EventVarType type) => type switch
 {