Exemplo n.º 1
0
        public static JsonData SerializeRoom(RoomInfo room, LazyArray <BackgroundInfo> bgs, LazyArray <ObjectInfo> objs)
        {
            var r = CreateObj();

            r["caption"]     = room.Caption;
            r["size"]        = SerializeSize(room.Size);
            r["speed"]       = room.Speed;
            r["persist"]     = room.IsPersistent;
            r["colour"]      = room.Colour.ToHexString();
            r["enableviews"] = room.EnableViews;
            r["showcolour"]  = room.ShowColour;
            r["clearbuf"]    = room.ClearDisplayBuffer;
            r["flag"]        = room.UnknownFlag;
            r["world"]       = room.World;
            r["bounding"]    = SerializeRect(room.Bounding);
            r["gravity"]     = SerializePoint(room.Gravity);
            r["metresperpx"] = room.MetresPerPixel;

            r["drawbgcol"] = room.DrawBackgroundColour;
            r["unknown"]   = room._unknown;

            r["bgs"]   = SerializeArray(room.Backgrounds, b => SerializeRoomBg(b, bgs));
            r["views"] = SerializeArray(room.Views, v => SerializeRoomView(v, objs));
            r["objs"]  = SerializeArray(room.Objects, o => SerializeRoomObj(o, objs));
            r["tiles"] = SerializeArray(room.Tiles, t => SerializeRoomTile(t, bgs));
            if (room.ObjInst != null)
            {
                r["objinst"] = SerializeArray(room.ObjInst, i => SerializeRoomObjInst(i));
            }

            return(r);
        }
Exemplo n.º 2
0
        public static JsonData SerializeScript(ScriptInfo scpt, LazyArray <CodeInfo> code)
        {
            var r = CreateObj();

            r["code"] = scpt.CodeId == UInt32.MaxValue ? String.Empty : code[scpt.CodeId].Name;

            return(r);
        }
Exemplo n.º 3
0
        public SourceItem(ITextBuffer textBuffer)
            : this()
        {
            _textBuffer = textBuffer;
            SnapshotSpan entireSnapSpan = Smartmobili.JavaTools.Editor.Core.EditorExtensions.CreateEntireBufferSnapshotSpan(_textBuffer);

            Length = _textBuffer.CurrentSnapshot.Length;
            LineCount = _textBuffer.CurrentSnapshot.LineCount;

            Func<int, TokenLine> itemCreator = itemCreator = index => new TokenLine(); ;
            TokenLines = new LazyArray<TokenLine>(LineCount, itemCreator);

            StartLexicalAnalysis(entireSnapSpan);
        }
Exemplo n.º 4
0
        static JsonData SerializeRoomObj(RoomObject obj, LazyArray <ObjectInfo> objs)
        {
            var r = CreateObj();

            r["pos"]      = SerializePoint(obj.Position);
            r["obj"]      = objs[obj.DefIndex].Name;
            r["scale"]    = SerializePoint(obj.Scale);
            r["colour"]   = obj.Colour.ToHexString();
            r["rotation"] = obj.Rotation;

            r["instanceid"]   = obj.InstanceID;
            r["createcodeid"] = obj.CreateCodeID;

            return(r);
        }
Exemplo n.º 5
0
        static JsonData SerializeRoomTile(RoomTile tile, LazyArray <BackgroundInfo> bgs)
        {
            var r = CreateObj();

            r["pos"]       = SerializePoint(tile.Position);
            r["bg"]        = bgs[tile.DefIndex].Name;
            r["sourcepos"] = SerializePoint(tile.SourcePosition);
            r["size"]      = SerializeSize(tile.Size);
            r["scale"]     = SerializePoint(tile.Scale);
            r["colour"]    = tile.Colour.ToHexString();

            r["tiledepth"]  = tile.Depth;
            r["instanceid"] = tile.InstanceID;

            return(r);
        }
Exemplo n.º 6
0
        static JsonData SerializeRoomView(RoomView view, LazyArray <ObjectInfo> objs)
        {
            var r = CreateObj();

            r["enabled"] = view.IsEnabled;
            r["view"]    = SerializeRect(view.View);
            r["port"]    = SerializeRect(view.Port);
            r["border"]  = SerializePoint(view.Border);
            r["speed"]   = SerializePoint(view.Speed);

            if (view.ObjectId.HasValue)
            {
                r["obj"] = objs[view.ObjectId.Value].Name;
            }

            return(r);
        }
Exemplo n.º 7
0
        public SourceItem(string entireBuffer, int length, int linecount)
            : this()
        {
            if (string.IsNullOrEmpty(entireBuffer))
                return;

            EntireBuffer = entireBuffer;
            Length = length;
            LineCount = linecount;

            Func<int, TokenLine> itemCreator = itemCreator = index => new TokenLine(); ;
            TokenLines = new LazyArray<TokenLine>(linecount, itemCreator);

            //BuildLineMapping(entireBuffer);

            //StartLexicalAnalysis();
        }
        public UiEncodingCharactersControl()
        {
            #region Construct

            RowDefinitions.Add(new RowDefinition {Height = GridLength.Auto});
            RowDefinitions.Add(new RowDefinition {Height = GridLength.Auto});
            ColumnDefinitions.Add(new ColumnDefinition {Width = GridLength.Auto});

            _mainControls = new LazyArray<UiEncodingMainCharacterControl>(ProvideMainControl);
            _mainPanel = UiStackPanelFactory.Create(Orientation.Vertical);
            AddUiElement(_mainPanel, 0, 0);

            _additionalControls = new LazyArray<UiEncodingAdditionalCharacterControl>(ProvideAdditionalControl);
            _additionalPanel = UiStackPanelFactory.Create(Orientation.Vertical);
            AddUiElement(_additionalPanel, 1, 0);

            #endregion
        }
Exemplo n.º 9
0
        static JsonData SerializeRoomBg(RoomBackground bg, LazyArray <BackgroundInfo> bgs)
        {
            var r = CreateObj();

            r["enabled"]    = bg.IsEnabled;
            r["foreground"] = bg.IsForeground;
            r["pos"]        = SerializePoint(bg.Position);
            r["tilex"]      = bg.TileX;
            r["tiley"]      = bg.TileY;
            r["speed"]      = SerializePoint(bg.Speed);
            r["stretch"]    = bg.StretchSprite;

            if (bg.BgIndex.HasValue)
            {
                r["bg"] = bgs[bg.BgIndex.Value].Name;
            }

            return(r);
        }
Exemplo n.º 10
0
        public UiEncodingCharactersControl()
        {
            #region Construct

            RowDefinitions.Add(new RowDefinition {
                Height = GridLength.Auto
            });
            RowDefinitions.Add(new RowDefinition {
                Height = GridLength.Auto
            });
            ColumnDefinitions.Add(new ColumnDefinition {
                Width = GridLength.Auto
            });

            _mainControls = new LazyArray <UiEncodingMainCharacterControl>(ProvideMainControl);
            _mainPanel    = UiStackPanelFactory.Create(Orientation.Vertical);
            AddUiElement(_mainPanel, 0, 0);

            _additionalControls = new LazyArray <UiEncodingAdditionalCharacterControl>(ProvideAdditionalControl);
            _additionalPanel    = UiStackPanelFactory.Create(Orientation.Vertical);
            AddUiElement(_additionalPanel, 1, 0);

            #endregion
        }
Exemplo n.º 11
0
        public static JsonData SerializeObj(ObjectInfo objt, LazyArray <SpriteInfo> sprites, LazyArray <ObjectInfo> objs)
        {
            var r = CreateObj();

            r["sprite"]  = objt.SpriteIndex == UInt32.MaxValue ? String.Empty : sprites[objt.SpriteIndex].Name;
            r["visible"] = objt.IsVisible;
            r["solid"]   = objt.IsSolid;
            r["depth"]   = objt.Depth;
            r["persist"] = objt.IsPersistent;

            if (objt.ParentId.HasValue)
            {
                r["parent"] = objs[objt.ParentId.Value].Name;
            }
            if (objt.TexMaskId.HasValue)
            {
                r["texmask"] = objt.TexMaskId.Value;
            }

            if (objt.Physics.HasValue)
            {
                r["physics"] = SerializeObjPhysics(objt.Physics.Value);
            }

            r["sensor"]   = objt.IsSensor;
            r["colshape"] = objt.CollisionShape.ToString().ToLowerInvariant();

            r["data"] = SerializeArray(objt.OtherFloats, Utils.Identity);

            if (objt.ShapePoints != null)
            {
                r["points"] = SerializeArray(objt.ShapePoints, x => SerializeArray(x, y => SerializeArray(y, Utils.Identity)));
            }

            return(r);
        }
Exemplo n.º 12
0
 public DynamicCompositePrice(RawNode node, IContext context) : base(node, context)
 {
     prices = new LazyArray <DynamicPrice>(node.GetNode("prices"), context);
 }
Exemplo n.º 13
0
 protected CompositeRequirement(RawNode node, IContext context)
     : base(node, context)
 {
     requirements = new LazyArray <Requirement>(node.GetNode("requirements"), context);
 }
Exemplo n.º 14
0
 public CompositePrice(RawNode rawNode, IContext context)
     : base(rawNode, context)
 {
     prices = new LazyArray <Price>(rawNode.GetNode("prices"), context);
 }
Exemplo n.º 15
0
 public CompositeReward(RawNode rawNode, IContext context)
     : base(rawNode, context)
 {
     rewards = new LazyArray <Reward>(rawNode.GetNode("rewards"), context);
 }
Exemplo n.º 16
0
 public Enumerator(LazyArray <T> baseList)
 {
     this.baseList = baseList;
 }
 public DynamicCompositeReward(RawNode node, IContext context) : base(node, context)
 {
     rewards = new LazyArray <DynamicReward>(node.GetNode("rewards"), context);
 }