/// <summary> /// Adds the outfit. /// </summary> /// <param name="outfit">The outfit.</param> public void AddOutfit(IOutfit outfit) { // TODO: Change Type to ushort AddUInt16(outfit.SpriteId); AddString(outfit.Name); AddByte(outfit.Addons); }
public AGSCharacter(string id, Resolver resolver, IOutfit outfit) : base(id, resolver) { _hasRoom = AddComponent <IHasRoom>(); _animationContainer = AddComponent <IAnimationContainer>(); _inObjectTree = AddComponent <IInObjectTree>(); _collider = AddComponent <ICollider>(); _visibleComponent = AddComponent <IVisibleComponent>(); _enabledComponent = AddComponent <IEnabledComponent>(); _customProperties = AddComponent <ICustomPropertiesComponent>(); _drawableInfo = AddComponent <IDrawableInfo>(); _hotspotComponent = AddComponent <IHotspotComponent>(); _shaderComponent = AddComponent <IShaderComponent>(); _translateComponent = AddComponent <ITranslateComponent>(); _imageComponent = AddComponent <IImageComponent>(); _scaleComponent = AddComponent <IScaleComponent>(); _rotateComponent = AddComponent <IRotateComponent>(); _pixelPerfectComponent = AddComponent <IPixelPerfectComponent>(); _faceDirectionBehavior = AddComponent <IFaceDirectionBehavior>(); _hasOutfit = AddComponent <IHasOutfit>(); _hasInventory = AddComponent <IHasInventory>(); _followBehavior = AddComponent <IFollowBehavior>(); _modelMatrixComponent = AddComponent <IModelMatrixComponent>(); beforeInitComponents(resolver, outfit); InitComponents(); afterInitComponents(resolver, outfit); }
public AGSCharacter(string id, Resolver resolver, IOutfit outfit) : base(id, resolver) { _hasRoom = AddComponent<IHasRoom>(); _animationContainer = AddComponent<IAnimationContainer>(); _inObjectTree = AddComponent<IInObjectTree>(); _collider = AddComponent<ICollider>(); _visibleComponent = AddComponent<IVisibleComponent>(); _enabledComponent = AddComponent<IEnabledComponent>(); _customProperties = AddComponent<ICustomPropertiesComponent>(); _drawableInfo = AddComponent<IDrawableInfo>(); _hotspotComponent = AddComponent<IHotspotComponent>(); _shaderComponent = AddComponent<IShaderComponent>(); _transformComponent = AddComponent<ITranslateComponent>(); _imageComponent = AddComponent<IImageComponent>(); _scaleComponent = AddComponent<IScaleComponent>(); _rotateComponent = AddComponent<IRotateComponent>(); _pixelPerfectComponent = AddComponent<IPixelPerfectComponent>(); _faceDirectionBehavior = AddComponent<IFaceDirectionBehavior>(); _hasOutfit = AddComponent<IHasOutfit>(); _hasInventory = AddComponent<IHasInventory>(); _followBehavior = AddComponent<IFollowBehavior>(); beforeInitComponents(resolver, outfit); InitComponents(); afterInitComponents(resolver, outfit); }
partial void afterInitComponents(Resolver resolver, IOutfit outfit) { RenderLayer = AGSLayers.Foreground; IgnoreScalingArea = false; _hasOutfit.Outfit = outfit; }
/// <summary> /// Adds the specified message. /// </summary> /// <param name="message">The message.</param> /// <param name="currentOutfit">The current outfit.</param> /// <param name="currentMount">The current mount.</param> /// <param name="outfits">The outfits.</param> /// <param name="mounts">The mounts.</param> public static void Add(NetworkMessage message, IOutfit currentOutfit, IMount currentMount, ICollection <IOutfit> outfits, ICollection <IMount> mounts) { message.AddPacketType(GamePacketType.AppearanceWindow); message.AddAppearance(currentOutfit, currentMount); AddOutfits(message, outfits); AddMounts(message, mounts); }
public ICharacter GetCharacter(string id, IOutfit outfit, IAnimationContainer container) { TypedParameter outfitParam = new TypedParameter (typeof(IOutfit), outfit); TypedParameter idParam = new TypedParameter (typeof(string), id); TypedParameter animationParam = new TypedParameter (typeof(IAnimationContainer), container); ICharacter character = _resolver.Resolve<ICharacter>(outfitParam, idParam, animationParam); return character; }
public ICharacter GetCharacter(string id, IOutfit outfit, string[] sayWhenLook = null, string[] sayWhenInteract = null) { ICharacter character = GetCharacter(id, outfit, _resolver.Container.Resolve <IAnimationComponent>()); subscribeSentences(sayWhenLook, character.Interactions.OnInteract(AGSInteractions.LOOK)); subscribeSentences(sayWhenInteract, character.Interactions.OnInteract(AGSInteractions.INTERACT)); return(character); }
public ICharacter GetCharacter(string id, IOutfit outfit, IAnimationComponent container) { TypedParameter outfitParam = new TypedParameter(typeof(IOutfit), outfit); TypedParameter idParam = new TypedParameter(typeof(string), id); TypedParameter animationParam = new TypedParameter(typeof(IAnimationComponent), container); ICharacter character = _resolver.Container.Resolve <ICharacter>(outfitParam, idParam, animationParam); return(character); }
public ICharacter GetCharacter(string id, IOutfit outfit, string[] sayWhenLook = null, string[] sayWhenInteract = null) { ICharacter character = GetCharacter(id, outfit, _resolver.Resolve<IAnimationContainer>()); subscribeSentences(sayWhenLook, character.Interactions.OnInteract(AGSInteractions.LOOK)); subscribeSentences(sayWhenInteract, character.Interactions.OnInteract(AGSInteractions.INTERACT)); return character; }
public async Task <ICharacter> LoadAsync(IGame game) { AGSLoadImageConfig loadConfig = new AGSLoadImageConfig(new Point(0, 0)); var footstep = await game.Factory.Sound.LoadAudioClipAsync("Sounds/151238__owlstorm__hard-female-footstep-2.wav"); ISoundEmitter emitter = new AGSSoundEmitter(game); emitter.AudioClip = footstep; IOutfit outfit = await game.Factory.Outfit.LoadOutfitFromFoldersAsync(_baseFolder, walkLeftFolder : "Walk/left", walkDownFolder : "Walk/front", idleLeftFolder : "Idle/left", idleDownFolder : "Idle/front", speakLeftFolder : "Talk", loadConfig : loadConfig); _character = game.Factory.Object.GetCharacter("Cris", outfit).Remember(game, c => _character = c); _character.SpeechConfig.TextConfig = AGSTextConfig.ChangeColor(_character.SpeechConfig.TextConfig, Colors.OrangeRed, Colors.Black, 1f); var approach = _character.AddComponent <IApproachComponent>(); approach.ApproachStyle.ApproachWhenVerb["Talk"] = ApproachHotspots.WalkIfHaveWalkPoint; emitter.Object = _character; _character.AddComponent <ISaturationEffectComponent>(); var movement = _character.AddComponent <KeyboardMovement>(); movement.AddArrows(); movement.AddWASD(); //Uncomment for portrait /* * var portrait = game.Factory.Object.GetObject("CrisPortrait"); * portrait.StartAnimation(game.Factory.Graphics.LoadAnimationFromFolder(_baseFolder + "Talk")); * portrait.Border = game.Factory.Graphics.Borders.SolidColor(Colors.AliceBlue, 3f, true); * portrait.Visible = false; * portrait.RenderLayer = AGSLayers.Speech; * portrait.IgnoreViewport = true; * portrait.IgnoreScalingArea = true; * game.State.UI.Add(portrait); * _character.SpeechConfig.PortraitConfig = new AGSPortraitConfig { Portrait = portrait, Positioning = PortraitPositioning.Alternating }; */ var speakAnimation = _character.Outfit[AGSOutfit.Speak]; Characters.RandomAnimationDelay(speakAnimation.Left); Characters.RandomAnimationDelay(speakAnimation.Right); emitter.Assign(_character.Outfit[AGSOutfit.Walk], 1, 5); _character.StartAnimation(_character.Outfit[AGSOutfit.Idle].Down); _character.DisplayName = "Cris"; _character.IsPixelPerfect = true; Characters.Cris = _character; return(_character); }
public ICharacter GetCharacter(string id, IOutfit outfit, [MethodParam(Browsable = false)] IRoom room = null, string[] sayWhenLook = null, string[] sayWhenInteract = null) { ICharacter character = GetCharacter(id, outfit, _resolver.Container.Resolve <IAnimationComponent>()); subscribeSentences(sayWhenLook, character.Interactions.OnInteract(AGSInteractions.LOOK)); subscribeSentences(sayWhenInteract, character.Interactions.OnInteract(AGSInteractions.INTERACT)); room?.Objects.Add(character); return(character); }
public AGSCharacter(string id, Resolver resolver, IOutfit outfit) : base(id, resolver) { _hasRoomComponent = AddComponent <IHasRoomComponent>(); Bind <IHasRoomComponent>(c => _hasRoomComponent = c, _ => {}); _animationComponent = AddComponent <IAnimationComponent>(); Bind <IAnimationComponent>(c => _animationComponent = c, _ => {}); _inObjectTreeComponent = AddComponent <IInObjectTreeComponent>(); Bind <IInObjectTreeComponent>(c => _inObjectTreeComponent = c, _ => {}); _colliderComponent = AddComponent <IColliderComponent>(); Bind <IColliderComponent>(c => _colliderComponent = c, _ => {}); _visibleComponent = AddComponent <IVisibleComponent>(); Bind <IVisibleComponent>(c => _visibleComponent = c, _ => {}); _enabledComponent = AddComponent <IEnabledComponent>(); Bind <IEnabledComponent>(c => _enabledComponent = c, _ => {}); _customPropertiesComponent = AddComponent <ICustomPropertiesComponent>(); Bind <ICustomPropertiesComponent>(c => _customPropertiesComponent = c, _ => {}); _drawableInfoComponent = AddComponent <IDrawableInfoComponent>(); Bind <IDrawableInfoComponent>(c => _drawableInfoComponent = c, _ => {}); _shaderComponent = AddComponent <IShaderComponent>(); Bind <IShaderComponent>(c => _shaderComponent = c, _ => {}); _translateComponent = AddComponent <ITranslateComponent>(); Bind <ITranslateComponent>(c => _translateComponent = c, _ => {}); _imageComponent = AddComponent <IImageComponent>(); Bind <IImageComponent>(c => _imageComponent = c, _ => {}); _borderComponent = AddComponent <IBorderComponent>(); Bind <IBorderComponent>(c => _borderComponent = c, _ => { }); _scaleComponent = AddComponent <IScaleComponent>(); Bind <IScaleComponent>(c => _scaleComponent = c, _ => {}); _rotateComponent = AddComponent <IRotateComponent>(); Bind <IRotateComponent>(c => _rotateComponent = c, _ => {}); _pixelPerfectComponent = AddComponent <IPixelPerfectComponent>(); Bind <IPixelPerfectComponent>(c => _pixelPerfectComponent = c, _ => {}); _modelMatrixComponent = AddComponent <IModelMatrixComponent>(); Bind <IModelMatrixComponent>(c => _modelMatrixComponent = c, _ => {}); _boundingBoxComponent = AddComponent <IBoundingBoxComponent>(); Bind <IBoundingBoxComponent>(c => _boundingBoxComponent = c, _ => {}); _worldPositionComponent = AddComponent <IWorldPositionComponent>(); Bind <IWorldPositionComponent>(c => _worldPositionComponent = c, _ => {}); _faceDirectionComponent = AddComponent <IFaceDirectionComponent>(); Bind <IFaceDirectionComponent>(c => _faceDirectionComponent = c, _ => {}); _outfitComponent = AddComponent <IOutfitComponent>(); Bind <IOutfitComponent>(c => _outfitComponent = c, _ => {}); _inventoryComponent = AddComponent <IInventoryComponent>(); Bind <IInventoryComponent>(c => _inventoryComponent = c, _ => {}); _followComponent = AddComponent <IFollowComponent>(); Bind <IFollowComponent>(c => _followComponent = c, _ => {}); _hotspotComponent = AddComponent <IHotspotComponent>(); Bind <IHotspotComponent>(c => _hotspotComponent = c, _ => {}); beforeInitComponents(resolver, outfit); InitComponents(); afterInitComponents(resolver, outfit); }
partial void beforeInitComponents(Resolver resolver, IOutfit outfit) { TypedParameter objParameter = new TypedParameter(typeof(IObject), this); if (outfit != null) _faceDirectionBehavior.CurrentDirectionalAnimation = outfit[AGSOutfit.Idle]; TypedParameter outfitParameter = new TypedParameter(typeof(IHasOutfit), this); ISayLocationProvider location = resolver.Container.Resolve<ISayLocationProvider>(objParameter); TypedParameter locationParameter = new TypedParameter(typeof(ISayLocationProvider), location); TypedParameter faceDirectionParameter = new TypedParameter(typeof(IFaceDirectionBehavior), _faceDirectionBehavior); _sayBehavior = resolver.Container.Resolve<ISayBehavior>(locationParameter, outfitParameter, faceDirectionParameter); _walkBehavior = resolver.Container.Resolve<IWalkBehavior>(objParameter, outfitParameter, faceDirectionParameter); AddComponent(_sayBehavior); AddComponent(_walkBehavior); }
public async Task <ICharacter> LoadAsync(IGame game) { _game = game; IGameFactory factory = game.Factory; AGSLoadImageConfig loadConfig = new AGSLoadImageConfig(new Point(0, 0)); IOutfit outfit = await factory.Outfit.LoadOutfitFromFoldersAsync(_baseFolder, walkLeftFolder : "Walk/left", walkDownFolder : "Walk/down", walkRightFolder : "Walk/right", walkUpFolder : "Walk/up", idleLeftFolder : "Idle/left", idleDownFolder : "Idle/down", idleRightFolder : "Idle/right", idleUpFolder : "Idle/up", speakLeftFolder : "Talk/left", speakDownFolder : "Talk/down", speakRightFolder : "Talk/right", speakUpFolder : "Talk/up", loadConfig : loadConfig); _character = factory.Object.GetCharacter("Beman", outfit).Remember(_game, character => { _character = character; subscribeEvents(); }); _character.SpeechConfig.TextConfig = AGSTextConfig.ChangeColor(_character.SpeechConfig.TextConfig, Colors.CornflowerBlue, Colors.Black, 1f); _character.SpeechConfig.TextOffset = (0f, -10f); //Uncomment for portrait /* * var portrait = game.Factory.Object.GetObject("BemanPortrait"); * portrait.StartAnimation(game.Factory.Graphics.LoadAnimationFromFolder(_baseFolder + "Talk/down")); * portrait.Border = game.Factory.Graphics.Borders.SolidColor(Colors.AliceBlue, 3f, true); * portrait.Visible = false; * portrait.RenderLayer = AGSLayers.Speech; * portrait.IgnoreViewport = true; * portrait.IgnoreScalingArea = true; * game.State.UI.Add(portrait); * _character.SpeechConfig.PortraitConfig = new AGSPortraitConfig { Portrait = portrait, Positioning = PortraitPositioning.Alternating }; */ var speakAnimation = _character.Outfit[AGSOutfit.Speak]; Characters.RandomAnimationDelay(speakAnimation.Left); Characters.RandomAnimationDelay(speakAnimation.Right); Characters.RandomAnimationDelay(speakAnimation.Down); Characters.RandomAnimationDelay(speakAnimation.Up); _character.StartAnimation(_character.Outfit[AGSOutfit.Idle].Down); _character.DisplayName = "Beman"; _character.IsPixelPerfect = true; Characters.Beman = _character; _dialogs.Load(game); return(_character); }
public void DeepCopyIn( IOutfit item, IOutfitGetter rhs, ErrorMaskBuilder?errorMask, TranslationCrystal?copyMask, bool deepCopy) { base.DeepCopyIn( (IFallout4MajorRecord)item, (IFallout4MajorRecordGetter)rhs, errorMask, copyMask, deepCopy: deepCopy); }
partial void beforeInitComponents(Resolver resolver, IOutfit outfit) { TypedParameter objParameter = new TypedParameter(typeof(IObject), this); if (outfit != null) { _faceDirectionComponent.CurrentDirectionalAnimation = outfit[AGSOutfit.Idle]; } ISayLocationProvider location = resolver.Container.Resolve <ISayLocationProvider>(objParameter); TypedParameter locationParameter = new TypedParameter(typeof(ISayLocationProvider), location); _sayComponent = resolver.Container.Resolve <ISayComponent>(locationParameter); //todo: refactor ISayLocationProvider into a component, then bind to it from say behavior, then add walk & say to the template and remove from here _walkComponent = AddComponent <IWalkComponent>(); AddComponent <ISayComponent>(_sayComponent); }
/// <summary> /// Adds the appearance. /// </summary> /// <param name="outfit">The outfit.</param> /// <param name="mount">The mount.</param> public void AddAppearance(IOutfit outfit, IMount mount) { AddUInt16(outfit.SpriteId); if (outfit.SpriteId != 0) { AddByte(outfit.Head); AddByte(outfit.Body); AddByte(outfit.Legs); AddByte(outfit.Feet); AddByte(outfit.Addons); } else { AddUInt16(outfit.Item); } AddUInt16(mount?.SpriteId ?? 0); }
partial void beforeInitComponents(Resolver resolver, IOutfit outfit) { TypedParameter objParameter = new TypedParameter(typeof(IObject), this); if (outfit != null) { _faceDirectionBehavior.CurrentDirectionalAnimation = outfit[AGSOutfit.Idle]; } TypedParameter outfitParameter = new TypedParameter(typeof(IHasOutfit), this); ISayLocationProvider location = resolver.Container.Resolve <ISayLocationProvider>(objParameter); TypedParameter locationParameter = new TypedParameter(typeof(ISayLocationProvider), location); TypedParameter faceDirectionParameter = new TypedParameter(typeof(IFaceDirectionBehavior), _faceDirectionBehavior); _sayBehavior = resolver.Container.Resolve <ISayBehavior>(locationParameter, outfitParameter, faceDirectionParameter); _walkBehavior = resolver.Container.Resolve <IWalkBehavior>(objParameter, outfitParameter, faceDirectionParameter); AddComponent(_sayBehavior); AddComponent(_walkBehavior); }
public async Task <IOutfit> LoadOutfitFromFoldersAsync(string baseFolder, string walkLeftFolder = null, string walkRightFolder = null, string walkDownFolder = null, string walkUpFolder = null, string idleLeftFolder = null, string idleRightFolder = null, string idleDownFolder = null, string idleUpFolder = null, string speakLeftFolder = null, string speakRightFolder = null, string speakDownFolder = null, string speakUpFolder = null, IAnimationConfiguration animationConfig = null, ILoadImageConfig loadConfig = null) { IOutfit outfit = _resolver.Resolve <IOutfit> (); outfit[AGSOutfit.Idle] = await _graphics.LoadDirectionalAnimationFromFoldersAsync(baseFolder, idleLeftFolder, idleRightFolder, idleDownFolder, idleUpFolder, animationConfig, loadConfig); outfit[AGSOutfit.Walk] = await _graphics.LoadDirectionalAnimationFromFoldersAsync(baseFolder, walkLeftFolder, walkRightFolder, walkDownFolder, walkUpFolder, animationConfig, loadConfig); outfit[AGSOutfit.Speak] = await _graphics.LoadDirectionalAnimationFromFoldersAsync(baseFolder, speakLeftFolder, speakRightFolder, speakDownFolder, speakUpFolder, animationConfig, loadConfig); return(outfit); }
/// <inheritdoc /> /// <summary> /// Initializes a new instance of the <see cref="T:Tibia.Network.Game.RequestingAppearanceChangeEventArgs" /> /// class. /// </summary> /// <param name="characterSpawn">The character spawn.</param> /// <param name="outfit">The outfit.</param> /// <param name="mount">The mount.</param> public RequestingAppearanceChangeEventArgs(CharacterSpawn characterSpawn, IOutfit outfit, IMount mount) { CharacterSpawn = characterSpawn; Outfit = outfit; Mount = mount; }
partial void beforeInitComponents(Resolver resolver, IOutfit outfit);
partial void afterInitComponents(Resolver resolver, IOutfit outfit);
/// <summary> /// Adds the specified message. /// </summary> /// <param name="message">The message.</param> /// <param name="creatureSpawnId">The creature spawn identifier.</param> /// <param name="outfit">The outfit.</param> /// <param name="mount">The mount.</param> public static void Add(NetworkMessage message, uint creatureSpawnId, IOutfit outfit, IMount mount) { message.AddPacketType(GamePacketType.CreatureChangeAppearance); message.AddUInt32(creatureSpawnId); message.AddAppearance(outfit, mount); }
public void RemapLinks(IOutfit obj, IReadOnlyDictionary <FormKey, FormKey> mapping) { base.RemapLinks(obj, mapping); }