Ejemplo n.º 1
0
        public static BlockArgsType GetBlockArgsType(ForegroundType type)
        {
            switch (type)
            {
            case ForegroundType.Normal:
                return(BlockArgsType.None);

            case ForegroundType.Goal:
            case ForegroundType.Toggle:
            case ForegroundType.ToggleGoal:
            case ForegroundType.Morphable:
            case ForegroundType.Team:
                return(BlockArgsType.Number);

            case ForegroundType.Note:
                return(BlockArgsType.SignedNumber);

            case ForegroundType.WorldPortal:
                return(BlockArgsType.String);

            case ForegroundType.Portal:
                return(BlockArgsType.Portal);

            case ForegroundType.Label:
                return(BlockArgsType.Label);

            case ForegroundType.Sign:
                return(BlockArgsType.Sign);

            default:
                throw new ArgumentException("Invalid BlockType.", nameof(type));
            }
        }
Ejemplo n.º 2
0
        public ForegroundBlock(Foreground.Id id, string text, string textColor)
        {
            ForegroundType type = WorldUtils.GetForegroundType(id);

            if (WorldUtils.GetBlockArgsType(type) != BlockArgsType.Label)
            {
                throw new ArgumentException("Invalid arguments for the specified block.", "id");
            }

            this._args = new LabelArgs(text, textColor);
            this._type = type;
            this._id   = id;
        }
Ejemplo n.º 3
0
        public ForegroundBlock(Foreground.Id id, uint args)
        {
            ForegroundType type = WorldUtils.GetForegroundType(id);

            if (WorldUtils.GetBlockArgsType(type) != BlockArgsType.Number)
            {
                throw new ArgumentException("Invalid arguments for the specified block.", "id");
            }

            this._args = args;
            this._type = type;
            this._id   = id;
        }
Ejemplo n.º 4
0
        public ForegroundBlock(Foreground.Id id)
        {
            ForegroundType type = WorldUtils.GetForegroundType(id);

            if (WorldUtils.GetBlockArgsType(type) != BlockArgsType.None)
            {
                throw new ArgumentException("The given block is missing required arguments.", "id");
            }

            this._args = null;
            this._type = ForegroundType.Normal;
            this._id   = id;
        }
Ejemplo n.º 5
0
        public ForegroundBlock(Foreground.Id id, uint portalId, uint portalTarget, Morph.Id portalRotation)
        {
            ForegroundType type = WorldUtils.GetForegroundType(id);

            if (WorldUtils.GetBlockArgsType(type) != BlockArgsType.Portal)
            {
                throw new ArgumentException("The given block is not a portal.", "id");
            }

            this._args = new PortalArgs(portalId, portalTarget, portalRotation);
            this._type = ForegroundType.Portal;
            this._id   = id;
        }
Ejemplo n.º 6
0
 /// <summary> Initializes a new instance of the <see cref="Binarization"/> class with specified settings. </summary>
 /// <param name="foregroundType"></param>
 /// <param name="binThreshold">Use this threshold value instead of iteratively calculating it. Range from 0 to 1</param>
 public Binarization(ForegroundType foregroundType, double?binThreshold)
 {
     this.foregroundType = foregroundType;
     this.binThreshold   = binThreshold;
     //this.Output(FeatureDescriptor.Get<bool[,]>("Binarized"));
 }