示例#1
0
        public async Task <IObject> GetHotspotAsync(string maskPath, string hotspot, string [] sayWhenLook = null,
                                                    string [] sayWhenInteract = null, string id = null)
        {
            _maskLoader = _maskLoader ?? _resolver.Container.Resolve <IMaskLoader>();
            IMask mask = await _maskLoader.LoadAsync(maskPath, debugDrawColor : Colors.White, id : id ?? hotspot);

            if (mask == null)
            {
                return(new AGSObject(id ?? hotspot, _resolver));
            }
            setMask(mask, hotspot, sayWhenLook, sayWhenInteract);
            return(mask.DebugDraw);
        }
示例#2
0
        public IObject GetHotspot(string maskPath, string hotspot, IRoom room = null, string[] sayWhenLook = null,
                                  string[] sayWhenInteract = null, string id = null)
        {
            _maskLoader = _maskLoader ?? _resolver.Container.Resolve <IMaskLoader>();
            IMask mask = _maskLoader.Load(maskPath, debugDrawColor:  Colors.White, id: id ?? hotspot);

            if (mask == null)
            {
                return(newAdventureObject(id ?? hotspot));
            }
            setMask(mask, hotspot, room, sayWhenLook, sayWhenInteract);
            return(mask.DebugDraw);
        }
示例#3
0
        public IObject GetHotspot(string maskPath, string hotspot, string[] sayWhenLook = null,
                                  string[] sayWhenInteract = null, string id = null)
        {
            IMaskLoader maskLoader = _resolver.Resolve <IMaskLoader>();
            IMask       mask       = maskLoader.Load(maskPath, debugDrawColor:  Colors.White, id: id ?? hotspot);

            if (mask == null)
            {
                return(new AGSObject(id ?? hotspot, _resolver.Resolve <Resolver>()));
            }
            setMask(mask, hotspot, sayWhenLook, sayWhenInteract);
            return(mask.DebugDraw);
        }
示例#4
0
        public async Task <IObject> GetHotspotAsync(string maskPath, string hotspot, IRoom room = null, string[] sayWhenLook = null,
                                                    string[] sayWhenInteract = null, string id = null)
        {
            id          = id ?? $"{hotspot} {maskPath}";
            _maskLoader = _maskLoader ?? _resolver.Container.Resolve <IMaskLoader>();
            IMask mask = await _maskLoader.LoadAsync(maskPath, debugDrawColor : Colors.White, id : id);

            if (mask == null)
            {
                return(newAdventureObject(id));
            }
            setMask(mask, hotspot, room, sayWhenLook, sayWhenInteract);
            return(mask.DebugDraw);
        }
示例#5
0
		public AGSSprite (Resolver resolver, IMaskLoader maskLoader)
		{
            _maskLoader = maskLoader;
            _resolver = resolver;

            //todo: abstract it to the constructor
            _translate = new AGSTranslate();
            _hasImage = new AGSHasImage();
            _hasImage.Anchor = new PointF();                        
            _rotate = new AGSRotate();

            ScaleX = 1;
            ScaleY = 1;
            _hasImage.OnImageChanged.Subscribe((sender, args) => ScaleBy(ScaleX, ScaleY));
        }
示例#6
0
        public AGSSprite(Resolver resolver, IMaskLoader maskLoader)
        {
            _maskLoader    = maskLoader;
            _resolver      = resolver;
            OnScaleChanged = new AGSEvent <AGSEventArgs>();

            //todo: abstract it to the constructor
            _translate       = new AGSTranslate();
            _hasImage        = new AGSHasImage();
            _hasImage.Anchor = new PointF();
            _rotate          = new AGSRotate();

            ScaleX = 1;
            ScaleY = 1;
            _hasImage.OnImageChanged.Subscribe((sender, args) => ScaleBy(ScaleX, ScaleY));
        }
示例#7
0
        public AGSSprite(Resolver resolver, IMaskLoader maskLoader)
        {
            _id         = Interlocked.Increment(ref _lastId);
            _maskLoader = maskLoader;
            _resolver   = resolver;

            //todo: abstract it to the constructor
            _translate      = new AGSTranslate();
            _hasImage       = new AGSHasImage();
            _hasImage.Pivot = new PointF();
            _scale          = new AGSScale(_hasImage);
            _rotate         = new AGSRotate();

            _scale.PropertyChanged     += onPropertyChanged;
            _hasImage.PropertyChanged  += onPropertyChanged;
            _translate.PropertyChanged += onPropertyChanged;
        }
示例#8
0
        public AGSSprite(Resolver resolver, IMaskLoader maskLoader)
        {
            _id = Interlocked.Increment(ref _lastId);
            _pixelPerfectArea = new Lazy <IArea>(generatePixelPerfectArea);
            _maskLoader       = maskLoader;
            _resolver         = resolver;

            //todo: abstract it to the constructor
            _translate      = new AGSTranslate();
            _hasImage       = new AGSHasImage();
            _hasImage.Pivot = new PointF();
            _scale          = new AGSScale();
            AGSScale.BindSizeToImage(_hasImage, _scale);
            _rotate = new AGSRotate();

            _scale.PropertyChanged     += onPropertyChanged;
            _hasImage.PropertyChanged  += onPropertyChanged;
            _translate.PropertyChanged += onPropertyChanged;
        }