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; }
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) { 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; }