示例#1
0
        public override void SerializeBlock(SerializerObject s)
        {
            Data = s.SerializeArray <byte>(Data, BlockSize, name: nameof(Data));

            // Serialize sub-blocks
            if (SubBlocks == null)
            {
                SubBlocks = new GBC_DummyBlock[DependencyTable.DependenciesCount];
            }

            // Get all root pointers
            var rootBlock    = ((GBC_BaseManager)s.GameSettings.GetGameManager).GetLevelList(s.Context);
            var rootTable    = rootBlock.DependencyTable;
            var rootPointers = Enumerable.Range(0, rootTable.Dependencies.Length).Select(x => rootTable.GetPointer(x)).ToArray();

            for (int i = 0; i < DependencyTable.Dependencies.Length; i++)
            {
                var p = DependencyTable.GetPointer(i);

                if (rootPointers.Contains(p) && Offset != rootBlock.Offset)
                {
                    continue;
                }

                SubBlocks[i] = s.DoAt(p, () => s.SerializeObject <GBC_DummyBlock>(SubBlocks[i], name: $"{nameof(SubBlocks)}[{i}]"));
            }
        }
示例#2
0
        public override void SerializeBlock(SerializerObject s)
        {
            if (DependencyTable.DependenciesCount > 0)
            {
                if (Vignettes == null)
                {
                    Vignettes = new GBC_Vignette[DependencyTable.DependenciesCount];
                }

                for (int i = 0; i < Vignettes.Length; i++)
                {
                    Vignettes[i] = s.DoAt(DependencyTable.GetPointer(i), () => s.SerializeObject <GBC_Vignette>(Vignettes[i], name: $"{nameof(Vignettes)}[{i}]"));
                }
            }
            else
            {
                // Serialize data
                Width      = s.Serialize <byte>(Width, name: nameof(Width));
                Height     = s.Serialize <byte>(Height, name: nameof(Height));
                UnkData    = s.SerializeArray <byte>(UnkData, 14, name: nameof(UnkData));
                Palette    = s.SerializeObjectArray <RGBA5551Color>(Palette, 4 * 8, name: nameof(Palette));
                TileSet    = s.SerializeArray <byte>(TileSet, Width * Height * 0x10, name: nameof(TileSet));
                PalIndices = s.SerializeArray <byte>(PalIndices, Width * Height, name: nameof(PalIndices));
            }
        }
 public override void SerializeBlock(SerializerObject s)
 {
     s.DoEndian(R1Engine.Serialize.BinaryFile.Endian.Little, () => {
         ActionTable = s.SerializeObject <GBC_ActionTable>(ActionTable, name: nameof(ActionTable));
     });
     Puppet = s.DoAt(DependencyTable.GetPointer(0), () => s.SerializeObject <GBC_Puppet>(Puppet, name: $"{nameof(Puppet)}"));
 }
示例#4
0
        public override void SerializeBlock(SerializerObject s)
        {
            // This block has no data

            // Parse data from pointers (first pointer leads to scene list, remaining pointers lead to the level scenes)
            LevelList = s.DoAt(DependencyTable.GetPointer(0), () => s.SerializeObject <GBC_LevelList>(LevelList, name: nameof(LevelList)));
        }
示例#5
0
        public override void SerializeBlock(SerializerObject s)
        {
            if (s.GameSettings.EngineVersion == EngineVersion.GBC_R1_PocketPC)
            {
                FileOffsets = s.SerializeArraySize <uint, uint>(FileOffsets, name: nameof(FileOffsets));
                FileOffsets = s.SerializeArray <uint>(FileOffsets, FileOffsets.Length, name: nameof(FileOffsets));
                if (Files == null)
                {
                    Files = new SoundFile_PPC[FileOffsets.Length];
                }
                for (int i = 0; i < FileOffsets.Length; i++)
                {
                    if (FileOffsets[i] == 0)
                    {
                        continue;
                    }
                    s.Goto(BlockStartPointer + FileOffsets[i]);
                    Files[i] = s.SerializeObject <SoundFile_PPC>(Files[i], name: $"{nameof(Files)}[{i}]");
                }
            }
            else
            {
                DataOffsetsOffset  = s.Serialize <ushort>(DataOffsetsOffset, name: nameof(DataOffsetsOffset));
                UShort_02          = s.Serialize <ushort>(UShort_02, name: nameof(UShort_02));
                SoundIDOffsetCount = s.Serialize <ushort>(SoundIDOffsetCount, name: nameof(SoundIDOffsetCount));
                SoundOffsetCount   = s.Serialize <ushort>(SoundOffsetCount, name: nameof(SoundOffsetCount));

                s.DoAt(BlockStartPointer + DataOffsetsOffset, () => {
                    SoundIDOffsets = s.SerializeArray <ushort>(SoundIDOffsets, SoundIDOffsetCount, name: nameof(SoundIDOffsets));
                    SoundOffsets   = s.SerializeArray <ushort>(SoundOffsets, SoundOffsetCount, name: nameof(SoundOffsets));
                });
                if (SoundIDs == null)
                {
                    SoundIDs = new SoundID[SoundIDOffsetCount];
                }
                if (Sounds == null)
                {
                    Sounds = new Sound[SoundOffsetCount];
                }
                for (int i = 0; i < SoundIDs.Length; i++)
                {
                    s.Goto(BlockStartPointer + SoundIDOffsets[i]);
                    SoundIDs[i] = s.SerializeObject <SoundID>(SoundIDs[i], name: $"{nameof(SoundIDs)}[{i}]");
                }
                for (int i = 0; i < Sounds.Length; i++)
                {
                    int nextOff = i < Sounds.Length - 1 ? SoundOffsets[i + 1] : (int)BlockSize;
                    int length  = nextOff - SoundOffsets[i];
                    s.Goto(BlockStartPointer + SoundOffsets[i]);
                    Sounds[i] = s.SerializeObject <Sound>(Sounds[i], onPreSerialize: d => d.Length = length, name: $"{nameof(Sounds)}[{i}]");
                    if (Sounds[i].SoundProgramID.HasValue)
                    {
                        Sounds[i].SoundProgram = s.DoAt(DependencyTable.GetPointer(Sounds[i].SoundProgramID.Value - 1), () => {
                            return(s.SerializeObject <GBC_SoundProgram>(Sounds[i].SoundProgram, name: nameof(Sound.SoundProgram)));
                        });
                    }
                }
            }
        }
 internal static DependencyTableCacheEntry GetCachedEntry(string tLogRootingMarker)
 {
     if (DependencyTable.ContainsKey(tLogRootingMarker))
     {
         DependencyTableCacheEntry dependencyTable = DependencyTable[tLogRootingMarker];
         if (DependencyTableIsUpToDate(dependencyTable))
         {
             return(dependencyTable);
         }
         DependencyTable.Remove(tLogRootingMarker);
     }
     return(null);
 }
示例#7
0
        public override void SerializeBlock(SerializerObject s)
        {
            // Serialize blocks
            if (Blocks == null)
            {
                Blocks = new T[DependencyTable.DependenciesCount];
            }

            for (int i = 0; i < Blocks.Length; i++)
            {
                Blocks[i] = s.DoAt(DependencyTable.GetPointer(i), () => s.SerializeObject <T>(Blocks[i], name: $"{nameof(Blocks)}[{i}]"));
            }
        }
示例#8
0
        public override void SerializeBlock(SerializerObject s)
        {
            Byte_00        = s.Serialize <byte>(Byte_00, name: nameof(Byte_00));
            Byte_01        = s.Serialize <byte>(Byte_01, name: nameof(Byte_01));
            Byte_02        = s.Serialize <byte>(Byte_02, name: nameof(Byte_02));
            Index_FirstMap = s.Serialize <byte>(Index_FirstMap, name: nameof(Index_FirstMap));
            Index_LastMap  = s.Serialize <byte>(Index_LastMap, name: nameof(Index_LastMap));
            Index_WorldMap = s.Serialize <byte>(Index_WorldMap, name: nameof(Index_WorldMap));
            Index_UbiCliff = s.Serialize <byte>(Index_UbiCliff, name: nameof(Index_UbiCliff));
            Index_Unknown  = s.Serialize <byte>(Index_Unknown, name: nameof(Index_Unknown));

            // Parse data from pointers
            Level = s.DoAt(DependencyTable.GetPointer(s.GameSettings.Level), () => s.SerializeObject <GBC_Level>(Level, name: nameof(Level)));
        }
示例#9
0
        public override void SerializeBlock(SerializerObject s)
        {
            var blockOffset = s.CurrentPointer;

            // Serialize data (always little endian)
            s.DoEndian(R1Engine.Serialize.BinaryFile.Endian.Little, () =>
            {
                // Parse data
                GameObjectsCount     = s.Serialize <ushort>(GameObjectsCount, name: nameof(GameObjectsCount));
                GameObjectsOffset    = s.Serialize <ushort>(GameObjectsOffset, name: nameof(GameObjectsOffset));
                KnotsHeight          = s.Serialize <byte>(KnotsHeight, name: nameof(KnotsHeight));
                KnotsWidth           = s.Serialize <byte>(KnotsWidth, name: nameof(KnotsWidth));
                KnotsOffset          = s.Serialize <ushort>(KnotsOffset, name: nameof(KnotsOffset));
                Height               = s.Serialize <ushort>(Height, name: nameof(Height));
                Width                = s.Serialize <ushort>(Width, name: nameof(Width));
                Timeout              = s.Serialize <byte>(Timeout, name: nameof(Timeout));
                Index_PlayField      = s.Serialize <byte>(Index_PlayField, name: nameof(Index_PlayField));
                IndexMin_ActorModels = s.Serialize <byte>(IndexMin_ActorModels, name: nameof(IndexMin_ActorModels));
                IndexMax_ActorModels = s.Serialize <byte>(IndexMax_ActorModels, name: nameof(IndexMax_ActorModels));
                ObjPalette           = s.SerializeObjectArray <RGBA5551Color>(ObjPalette, 8 * 4, name: nameof(ObjPalette));
                TilePalette          = s.SerializeObjectArray <RGBA5551Color>(TilePalette, 8 * 4, name: nameof(TilePalette));
                MainActor_0          = s.Serialize <ushort>(MainActor_0, name: nameof(MainActor_0));
                MainActor_1          = s.Serialize <ushort>(MainActor_1, name: nameof(MainActor_1));
                MainActor_2          = s.Serialize <ushort>(MainActor_2, name: nameof(MainActor_2));
                Index_SoundBank      = s.Serialize <byte>(Index_SoundBank, name: nameof(Index_SoundBank));

                // TODO: Parse data (UnkActorStructs?)
                UnknownData = s.SerializeArray <byte>(UnknownData, (blockOffset + GameObjectsOffset).AbsoluteOffset - s.CurrentPointer.AbsoluteOffset, name: nameof(UnknownData));

                // Parse from pointers
                GameObjects = s.DoAt(blockOffset + GameObjectsOffset, () => s.SerializeObjectArray <GBC_GameObject>(GameObjects, GameObjectsCount, name: nameof(GameObjects)));
                Knots       = s.DoAt(blockOffset + KnotsOffset, () => s.SerializeObjectArray <GBC_Knot>(Knots, KnotsHeight * KnotsWidth, name: nameof(Knots)));
                s.Goto(Knots.Last().Offset + Knots.Last().ActorsCount * 2 + 1); // Go to end of the block
            });

            // Parse data from pointers
            PlayField = s.DoAt(DependencyTable.GetPointer(Index_PlayField - 1), () => s.SerializeObject <GBC_PlayField>(PlayField, name: nameof(PlayField)));
            SoundBank = s.DoAt(DependencyTable.GetPointer(Index_SoundBank - 1), () => s.SerializeObject <GBC_SoundBank>(SoundBank, name: nameof(SoundBank)));

            // Parse actor models
            foreach (var actor in GameObjects.Where(x => x.Index_ActorModel > 1))
            {
                actor.ActorModel = s.DoAt(DependencyTable.GetPointer(actor.Index_ActorModel - 1), () => s.SerializeObject <GBC_ActorModelBlock>(actor.ActorModel, name: $"{nameof(actor.ActorModel)}[{actor.Index_ActorModel}]"));
            }
        }
示例#10
0
        public override void SerializeBlock(SerializerObject s)
        {
            FrameCount = s.Serialize <byte>(FrameCount, name: nameof(FrameCount));
            Width      = s.Serialize <byte>(Width, name: nameof(Width));
            Height     = s.Serialize <byte>(Height, name: nameof(Height));
            Byte_03    = s.Serialize <byte>(Byte_03, name: nameof(Byte_03));
            Byte_04    = s.Serialize <byte>(Byte_04, name: nameof(Byte_04));
            Byte_05    = s.Serialize <byte>(Byte_05, name: nameof(Byte_05));

            if (Frames == null)
            {
                Frames = new GBC_VideoFrame[DependencyTable.DependenciesCount];
            }

            for (int i = 0; i < Frames.Length; i++)
            {
                Frames[i] = s.DoAt(DependencyTable.GetPointer(i), () => s.SerializeObject <GBC_VideoFrame>(Frames[i], name: $"{nameof(Frames)}[{i}]"));
            }
        }
示例#11
0
        public override void SerializeBlock(SerializerObject s)
        {
            PuppetData = s.SerializeArray <byte>(PuppetData, BlockSize, name: nameof(PuppetData));

            if (s.GameSettings.EngineVersion == EngineVersion.GBC_R1 || PuppetData.Length != 0)
            {
                TileKit = s.DoAt(DependencyTable.GetPointer(0), () => s.SerializeObject <GBC_TileKit>(TileKit, name: nameof(TileKit)));
            }
            else
            {
                BasePuppet = s.DoAt(DependencyTable.GetPointer(0), () => s.SerializeObject <GBC_Puppet>(BasePuppet, name: nameof(BasePuppet)));
            }
            if (Animations == null)
            {
                Animations = new GBC_RomChannel[DependencyTable.DependenciesCount - 1];
            }
            for (int i = 0; i < Animations.Length; i++)
            {
                Animations[i] = s.DoAt(DependencyTable.GetPointer(i + 1), () => s.SerializeObject <GBC_RomChannel>(Animations[i], name: $"{nameof(Animations)}[{i}]"));
            }
        }
示例#12
0
        public override void SerializeBlock(SerializerObject s)
        {
            if (s.GameSettings.EngineVersion == EngineVersion.GBC_R1)
            {
                Width             = s.Serialize <byte>((byte)Width, name: nameof(Width));
                Height            = s.Serialize <byte>((byte)Height, name: nameof(Height));
                PaletteCount      = s.Serialize <byte>(PaletteCount, name: nameof(PaletteCount));
                VRAMBank1MapCount = s.Serialize <byte>(VRAMBank1MapCount, name: nameof(VRAMBank1MapCount));
                VRAMBank2MapCount = s.Serialize <byte>(VRAMBank2MapCount, name: nameof(VRAMBank2MapCount));
                VRAMBank1Map      = s.SerializeObjectArray <GBC_TileVRAMMap>(VRAMBank1Map, VRAMBank1MapCount, name: nameof(VRAMBank1Map));
                VRAMBank2Map      = s.SerializeObjectArray <GBC_TileVRAMMap>(VRAMBank2Map, VRAMBank2MapCount, name: nameof(VRAMBank2Map));
                Palette           = s.SerializeObjectArray <RGBA5551Color>(Palette, PaletteCount * 4, name: nameof(Palette));


                BGMapTileNumbers = s.DoAt(DependencyTable.GetPointer(1), () => s.SerializeObject <GBC_MapBlock>(BGMapTileNumbers, onPreSerialize: b => {
                    b.Width  = (byte)Width;
                    b.Height = (byte)Height;
                    b.Type   = MapTile.GBC_TileType.BGMapTileNumbers;
                }, name: nameof(BGMapTileNumbers)));
                BGMapAttributes = s.DoAt(DependencyTable.GetPointer(2), () => s.SerializeObject <GBC_MapBlock>(BGMapAttributes, onPreSerialize: b => {
                    b.Width  = (byte)Width;
                    b.Height = (byte)Height;
                    b.Type   = MapTile.GBC_TileType.BGMapAttributes;
                }, name: nameof(BGMapTileNumbers)));
                Collision = s.DoAt(DependencyTable.GetPointer(3), () => s.SerializeObject <GBC_MapBlock>(Collision, onPreSerialize: b => {
                    b.Width  = (byte)Width;
                    b.Height = (byte)Height;
                    b.Type   = MapTile.GBC_TileType.Collision;
                }, name: nameof(BGMapTileNumbers)));
            }
            else
            {
                Width    = s.Serialize <uint>(Width, name: nameof(Width));
                Height   = s.Serialize <uint>(Height, name: nameof(Height));
                MapTiles = s.SerializeObjectArray <MapTile>(MapTiles, Width * Height, name: nameof(MapTiles));
            }

            TileKit = s.DoAt(DependencyTable.GetPointer(0), () => s.SerializeObject <GBC_TileKit>(TileKit, name: nameof(TileKit)));
        }
示例#13
0
        public override void SerializeBlock(SerializerObject s)
        {
            LevelIndex             = s.Serialize <byte>(LevelIndex, name: nameof(LevelIndex));
            InGameLevelIndex       = s.Serialize <sbyte>(InGameLevelIndex, name: nameof(InGameLevelIndex));
            Byte_02                = s.Serialize <byte>(Byte_02, name: nameof(Byte_02));
            Type                   = s.Serialize <MapType>(Type, name: nameof(Type));
            LinkedLevelsCount      = s.Serialize <byte>(LinkedLevelsCount, name: nameof(LinkedLevelsCount));
            IsGift                 = s.Serialize <bool>(IsGift, name: nameof(IsGift));
            LinkedLevelsStartIndex = s.Serialize <sbyte>(LinkedLevelsStartIndex, name: nameof(LinkedLevelsStartIndex));
            TimeOut                = s.Serialize <sbyte>(TimeOut, name: nameof(TimeOut));
            NbTings                = s.Serialize <sbyte>(NbTings, name: nameof(NbTings));
            UnkData0               = s.SerializeArray <byte>(UnkData0, 21, name: nameof(UnkData0));
            Cages                  = s.SerializeObjectArray <CageUID>(Cages, 10, name: nameof(Cages));
            VignetteIntro          = s.SerializeObject <VignetteReference>(VignetteIntro, name: nameof(VignetteIntro));
            VignetteOutro          = s.SerializeObject <VignetteReference>(VignetteOutro, name: nameof(VignetteOutro));
            VignetteLevelName      = s.SerializeObject <VignetteReference>(VignetteLevelName, name: nameof(VignetteLevelName));
            UnkData1               = s.SerializeArray <byte>(UnkData1, 1, name: nameof(UnkData1));
            LinkedLevels           = s.SerializeArray <byte>(LinkedLevels, LinkedLevelsCount, name: nameof(LinkedLevels));

            // TODO: Parse remaining data

            // Parse data from pointers
            Scene = s.DoAt(DependencyTable.GetPointer(0), () => s.SerializeObject <GBC_Scene>(Scene, name: nameof(Scene)));
        }
示例#14
0
 public void Init()
 {
     _table = new DependencyTable();
     _table.AddDependency(typeof(ITestInterface), typeof(TestClass));
 }
        private void CreateDependencyTable(StateTableViewModel vm)
        {
            foreach (var node in ViewModel.Nodes)
            {
                node.WarSmokeMode = true;
            }

            foreach (var node in vm.Nodes)
            {
                node.WarSmokeMode = false;
            }

            DependencyTable.ColumnDefinitions.Clear();
            DependencyTable.RowDefinitions.Clear();
            DependencyTable.Children.Clear();

            for (int i = 0, count = vm.Count + 4; i < count; i++)
            {
                DependencyTable.ColumnDefinitions.Add(new ColumnDefinition()
                {
                    Width = GridLength.Auto
                });
            }
            for (int i = 0, count = vm.Count + 3; i < count; i++)
            {
                DependencyTable.RowDefinitions.Add(new RowDefinition()
                {
                    Height = GridLength.Auto
                });
            }

            DependencyTable.AddChildren(new TextBlock
            {
                Text                = vm.TableDescription,
                FontFamily          = TimesNewRoman,
                FontSize            = 14,
                HorizontalAlignment = HorizontalAlignment.Center,
                VerticalAlignment   = VerticalAlignment.Center,
                TextAlignment       = TextAlignment.Center
            }, 0, 0, vm.Count + 4, 1, default(Color), false);

            DependencyTable.AddChildren(new TextBlock
            {
                Text                = "Zi",
                FontFamily          = TimesNewRoman,
                FontSize            = 14,
                Width               = 30,
                HorizontalAlignment = HorizontalAlignment.Center,
                VerticalAlignment   = VerticalAlignment.Center,
                TextAlignment       = TextAlignment.Center
            }, 0, 1);


            DependencyTable.AddChildren(new TextBlock
            {
                Text                = "Состояние блока Si",
                FontSize            = 14,
                FontFamily          = TimesNewRoman,
                HorizontalAlignment = HorizontalAlignment.Center,
                VerticalAlignment   = VerticalAlignment.Center
            }, 1, 1, vm.Count);
            DependencyTable.AddChildren(new TextBlock
            {
                Text                = "Число\nсостояний",
                FontFamily          = TimesNewRoman,
                FontSize            = 14,
                HorizontalAlignment = HorizontalAlignment.Center,
                TextAlignment       = TextAlignment.Center,
                Margin              = new Thickness(5, 0, 5, 0)
            }, vm.Count + 1, 1, 2);
            DependencyTable.AddChildren(new TextBlock
            {
                Text                = "Wi",
                FontFamily          = TimesNewRoman,
                FontSize            = 14,
                Width               = 25,
                HorizontalAlignment = HorizontalAlignment.Center,
                VerticalAlignment   = VerticalAlignment.Center,
                TextAlignment       = TextAlignment.Center
            }, vm.Count + 3, 1);

            DependencyTable.AddChildren(new TextBlock {
                Text = ""
            }, 0, 1);
            for (int i = 0; i < vm.Count; i++)
            {
                var zindexTextBlock = new TextBlock
                {
                    Text              = $"{vm.Nodes[i].Zindex + 1}",
                    FontFamily        = TimesNewRoman,
                    FontSize          = 14,
                    MinWidth          = 25,
                    VerticalAlignment = VerticalAlignment.Center,
                    TextAlignment     = TextAlignment.Center
                };
                int zindexI = i;
                zindexTextBlock.MouseEnter += (o, e) =>
                {
                    vm.Nodes[zindexI].ParentMode = true;
                    vm.Nodes[zindexI].ChildMode  = true;
                };
                zindexTextBlock.MouseLeave += (o, e) =>
                {
                    vm.Nodes[zindexI].ParentMode = false;
                    vm.Nodes[zindexI].ChildMode  = false;
                };
                DependencyTable.AddChildren(zindexTextBlock, i + 1, 2);
            }
            DependencyTable.AddChildren(new TextBlock
            {
                Text                = "0",
                FontFamily          = TimesNewRoman,
                FontSize            = 14,
                HorizontalAlignment = HorizontalAlignment.Center,
                VerticalAlignment   = VerticalAlignment.Center
            }, vm.Count + 1, 2);
            DependencyTable.AddChildren(new TextBlock
            {
                Text                = "1",
                FontFamily          = TimesNewRoman,
                FontSize            = 14,
                HorizontalAlignment = HorizontalAlignment.Center,
                VerticalAlignment   = VerticalAlignment.Center
            }, vm.Count + 2, 2);
            DependencyTable.AddChildren(new TextBlock {
                Text = ""
            }, vm.Count + 3, 2);

            var wIntexOfMin = vm.W.IndexOfMin();

            for (int i = 0; i < vm.Count; i++)
            {
                var color = i == wIntexOfMin?Color.FromArgb(255, 173, 216, 230) : default(Color);

                var zindexTextBlock = new TextBlock
                {
                    Text       = $"Z{vm.Nodes[i].Zindex + 1}",
                    FontSize   = 14,
                    FontFamily = TimesNewRoman,
                    Margin     = new Thickness(3, 0, 0, 0)
                };
                int zindexI = i;
                zindexTextBlock.MouseEnter += (o, e) =>
                {
                    vm.Nodes[zindexI].ParentMode = true;
                    vm.Nodes[zindexI].ChildMode  = true;
                };
                zindexTextBlock.MouseLeave += (o, e) =>
                {
                    vm.Nodes[zindexI].ParentMode = false;
                    vm.Nodes[zindexI].ChildMode  = false;
                };

                DependencyTable.AddChildren(zindexTextBlock, 0, i + 3, 1, 1, color);


                for (int j = 0; j < vm.Count; j++)
                {
                    var dependTextBlock = new TextBlock
                    {
                        Text          = $"{vm.IsWorkMatrix[i, j]}",
                        FontFamily    = TimesNewRoman,
                        FontSize      = 14,
                        TextAlignment = TextAlignment.Center,
                        MinWidth      = 25,
                        Margin        = new Thickness(1, 0.5, 0.5, 1),
                        Background    = new SolidColorBrush(vm.IsWorkMatrix[i, j] == 1
                            ? Color.Add(Color.FromArgb(255, 245, 245, 220), color) : color)
                    };

                    if (vm.IsWorkMatrix[i, j] == 0)
                    {
                        var i1 = i;
                        var j1 = j;
                        dependTextBlock.MouseEnter += (o, e) =>
                        {
                            vm.Nodes[j1].ParentMode = true;
                            vm.Nodes[i1].ChildMode  = true;
                        };
                        dependTextBlock.MouseLeave += (o, e) =>
                        {
                            vm.Nodes[j1].ParentMode = false;
                            vm.Nodes[i1].ChildMode  = false;
                        };
                    }

                    DependencyTable.AddChildren(dependTextBlock, j + 1, i + 3);
                }
                DependencyTable.AddChildren(new TextBlock
                {
                    Text                = $"{vm.Zeros[i]}",
                    FontFamily          = TimesNewRoman,
                    FontSize            = 14,
                    HorizontalAlignment = HorizontalAlignment.Right,
                    VerticalAlignment   = VerticalAlignment.Center,
                    Margin              = new Thickness(0, 0, 3, 0)
                }, vm.Count + 1, i + 3, 1, 1, color);
                DependencyTable.AddChildren(new TextBlock
                {
                    Text                = $"{vm.Ones[i]}",
                    FontFamily          = TimesNewRoman,
                    FontSize            = 14,
                    HorizontalAlignment = HorizontalAlignment.Right,
                    VerticalAlignment   = VerticalAlignment.Center,
                    Margin              = new Thickness(0, 0, 3, 0)
                }, vm.Count + 2, i + 3, 1, 1, color);
                DependencyTable.AddChildren(new TextBlock
                {
                    Text                = $"{vm.W[i]}",
                    FontSize            = 14,
                    FontFamily          = TimesNewRoman,
                    HorizontalAlignment = HorizontalAlignment.Right,
                    VerticalAlignment   = VerticalAlignment.Center,
                    Margin              = new Thickness(0, 0, 3, 0)
                }, vm.Count + 3, i + 3, 1, 1, color);
            }
        }
 private void SaveToPictureDependencyTable_OnClick(object sender, RoutedEventArgs e)
 {
     DependencyTable.SaveAsPictureViaDialog();
 }
示例#17
0
 public override void SerializeBlock(SerializerObject s)
 {
     ActorModel  = s.SerializeObject <GBC_ActorModel>(ActorModel, name: nameof(ActorModel));
     ActionTable = s.DoAt(DependencyTable.GetPointer(0), () => s.SerializeObject <GBC_ActionTableBlock>(ActionTable, name: $"{nameof(ActionTable)}"));
 }
 private void CopyAsPictureDependencyTable_OnClick(object sender, RoutedEventArgs e)
 {
     DependencyTable.ToClipboardAsPicture();
 }