Beispiel #1
0
        private ForegroundBlock(Foreground.Id id, BlockArgsType requiredArgsType)
        {
            this.Id    = id;
            this._args = null;

            var argsType = WorldUtils.GetBlockArgsType(this.Type);

            if (argsType != requiredArgsType)
            {
                throw WorldUtils.GetMissingArgsErrorMessage(argsType, nameof(id));
            }
        }
Beispiel #2
0
        public ForegroundBlock(Foreground.Id id, uint args)
        {
            var type     = WorldUtils.GetForegroundType(id);
            var argsType = WorldUtils.GetBlockArgsType(type);

            switch (argsType)
            {
            case BlockArgsType.Number:
                this._args = args;
                break;

            case BlockArgsType.SignedNumber:
                this._args = (int)args;
                break;

            default:
                throw WorldUtils.GetMissingArgsErrorMessage(argsType, nameof(id));
            }

            this.Type = type;
            this.Id   = id;
        }