public override void Create(Character character, AptContext context, SpriteItem parent = null) { _sprite = (Playable)character; _currentFrame = 0; _actionList = new List <Action>(); FrameLabels = new Dictionary <string, uint>(); State = PlayState.PLAYING; Name = ""; Visible = true; Character = _sprite; Context = context; Content = new DisplayList(); Parent = parent; ScriptObject = new ObjectContext(this); // Fill the frameLabels in advance foreach (var frame in _sprite.Frames) { foreach (var item in frame.FrameItems) { switch (item) { case FrameLabel fl: FrameLabels[fl.Name] = fl.FrameId; break; } } } }
internal AptWindow(Game game, ContentManager contentManager, AptFile aptFile) { _game = game; ContentManager = contentManager; AssetStore = game.AssetStore; AptFile = aptFile; //Create our context _context = new AptContext(this); //First thing to do here is to initialize the display list Root = new SpriteItem { Transform = ItemTransform.None, SetBackgroundColor = (c) => _backgroundColor = c }; Root.Create(aptFile.Movie, _context); _context.Root = Root; _context.Avm.CommandHandler = HandleCommand; var m = Root.Character as Movie; _movieSize = new Vector2(m.ScreenWidth, m.ScreenHeight); Renderer = new AptRenderer(this, contentManager); _resolver = new AptCallbackResolver(game); }
private void PlaceItem(PlaceObject po) { if (Content.Items.ContainsKey(po.Depth)) { return; } var character = Context.GetCharacter(po.Character, _sprite); var itemTransform = CreateTransform(po); DisplayItem displayItem; if (character is Playable) { displayItem = new SpriteItem(); } else if (character is Button) { displayItem = new ButtonItem(); } else { displayItem = new RenderItem(); } displayItem.Transform = itemTransform; displayItem.Create(character, Context, this); //add this object as an AS property if (po.Flags.HasFlag(PlaceObjectFlags.HasName)) { ScriptObject.Variables[po.Name] = Value.FromObject(displayItem.ScriptObject); displayItem.Name = po.Name; } if (po.Flags.HasFlag(PlaceObjectFlags.HasClipAction)) { if (po.ClipEvents != null) { foreach (var clipEvent in po.ClipEvents) { if (clipEvent.Flags.HasFlag(ClipEventFlags.Initialize)) { Context.Avm.Execute(clipEvent.Instructions, displayItem.ScriptObject, Character.Container.Constants.Entries); } } } } if (po.Flags.HasFlag(PlaceObjectFlags.HasClipDepth)) { displayItem.ClipDepth = po.ClipDepth; // TODO: Need to dispose this. displayItem.ClipMask = new RenderTarget(Context.Window.ContentManager.GraphicsDevice); } Content.AddItem(po.Depth, displayItem); }
private void PlaceItem(PlaceObject po) { var character = _context.GetCharacter(po.Character, _sprite); var itemTransform = CreateTransform(po); IDisplayItem displayItem; if (character is Playable) { displayItem = new SpriteItem() { Transform = itemTransform } } ; else { displayItem = new RenderItem() { Transform = itemTransform } }; displayItem.Create(character, _context, this); //add this object as an AS property if (po.Flags.HasFlag(PlaceObjectFlags.HasName)) { _scriptObject.Variables[po.Name] = Value.FromObject(displayItem.ScriptObject); displayItem.Name = po.Name; } _content.Items[po.Depth] = displayItem; }
public AptWindow(Game game, ContentManager contentManager, AptFile aptFile) { _contentManager = contentManager; //Create our context _context = new AptContext(aptFile, contentManager); //First thing to do here is to initialize the display list Root = new SpriteItem { Transform = ItemTransform.None }; Root.SetBackgroundColor = (c) => _backgroundColor = c; Root.Create(aptFile.Movie, _context); _context.Root = Root; _context.Avm.CommandHandler = HandleCommand; AptFile = aptFile; Renderer = new AptRenderer(contentManager); ImageLoader = new MappedImageLoader(contentManager); _resolver = new AptCallbackResolver(game); }
public void Create(Character chararacter, AptContext context, SpriteItem parent = null) { _character = chararacter; _context = context; _parent = parent; _scriptObject = new ObjectContext(this); Name = ""; Visible = true; }
public override void Create(Character character, AptContext context, SpriteItem parent = null) { Character = character; Context = context; Parent = parent; ScriptObject = new ObjectContext(this); Name = ""; Visible = true; IsHovered = false; }
public override void Create(Character chararacter, AptContext context, SpriteItem parent = null) { Character = chararacter; Context = context; Parent = parent; Name = ""; Visible = true; var button = Character as Button; _actionList = new List <InstructionCollection>(); }
public override void Create(Character character, AptContext context, SpriteItem parent = null) { Character = character; Context = context; Parent = parent; ScriptObject = new ObjectContext(this); Name = ""; Visible = true; TextValue = character is Text text?LocalizedString.CreateApt(text.Content) : null; IsHovered = false; }
private void PlaceItem(PlaceObject po) { if (_content.Items.ContainsKey(po.Depth)) { return; } var character = Context.GetCharacter(po.Character, _sprite); var itemTransform = CreateTransform(po); IDisplayItem displayItem; if (character is Playable) { displayItem = new SpriteItem() { Transform = itemTransform } } ; else { displayItem = new RenderItem() { Transform = itemTransform } }; displayItem.Create(character, Context, this); //add this object as an AS property if (po.Flags.HasFlag(PlaceObjectFlags.HasName)) { ScriptObject.Variables[po.Name] = Value.FromObject(displayItem.ScriptObject); displayItem.Name = po.Name; } if (po.Flags.HasFlag(PlaceObjectFlags.HasClipAction)) { if (po.ClipEvents != null) { foreach (var clipEvent in po.ClipEvents) { if (clipEvent.Flags.HasFlag(ClipEventFlags.Initialize)) { Context.Avm.Execute(clipEvent.Instructions, displayItem.ScriptObject); } } } } _content.Items[po.Depth] = displayItem; }
public AptWindow(ContentManager contentManager, AptFile aptFile) { _contentManager = contentManager; //Create our context _context = new AptContext(aptFile, contentManager); //First thing to do here is to initialize the display list Root = new SpriteItem { Transform = ItemTransform.None }; Root.Create(aptFile.Movie, _context); _context.Root = Root; }