Exemplo n.º 1
0
        public override IBox Clone()
        {
            IconImgEntry img = Hardcoded.IconImages.Get(hardcodedImgDataIndex);
            IconImgBox   box = new IconImgBox(img.Name, hardcodedImgDataIndex);
            Point        loc = box.Location;

            loc.Offset(10, 10);
            box.Location = loc;
            return(box);
        }
Exemplo n.º 2
0
        public IconImgBox(IconImgEntry imgEntry)
        {
            screenTopLeft         = Point.Empty;
            name                  = imgEntry.Name;
            hardcodedImgDataIndex = imgEntry.Id;
            Size imgSize = imgEntry.ImageSize;

            cornerAnchors = new Rectangle[4];
            UpdateAnchorPositions(Bounds);
            DoAfterConstruction();
        }
Exemplo n.º 3
0
        public override void Serialize(BinaryWriter stream)
        {
            IconImgEntry img = Hardcoded.IconImages.Get(hardcodedImgDataIndex);

            stream.Write((ushort)screenTopLeft.X);
            stream.Write((ushort)screenTopLeft.Y);
            stream.Write((byte)img.ImageLocation.X);
            stream.Write((byte)img.ImageLocation.Y);
            stream.Write((byte)img.ImageSize.Width);
            stream.Write((byte)img.ImageSize.Height);
            stream.Write(img.Unk3);
            stream.Write(img.Mod1);
        }
Exemplo n.º 4
0
        private List <IBox> ConvertGMFileBoxes(List <GTMP.GMFile.DrawRectInfo> boxes)
        {
            List <IBox> newBoxes = new List <IBox>(boxes.Count);
            Dictionary <string, int> iconImages = Hardcoded.IconImages.GetNamesAndIndexes();

            foreach (GTMP.GMFile.DrawRectInfo dri in boxes)
            {
                IBox toAdd;
                if (dri.infoBox != null)
                {
                    GTMP.GMFile.InfoBox infoBox = dri.infoBox;
                    Box newBox = new Box(dri.rect);
                    newBox.BehaviourAttributes = infoBox.attributes;
                    newBox.LinkToScreen        = infoBox.GetScreenLink();
                    newBox.PrizeMoneyPosition  = infoBox.GetSpecificPlaceNumber();
                    newBox.RaceOrWheelOrCarId  = infoBox.GetWheelRaceOrCarIdName();
                    newBox.Contents            = infoBox.contents;
                    newBox.QueryAttributes     = infoBox.queryType;
                    newBox.ArrowEnabler        = infoBox.GetArrowEnablingLicense();
                    toAdd = newBox;
                }
                else
                {
                    Debug.Assert(dri.iconImgBox != null);
                    GTMP.GMFile.IconImageBox imgBox    = dri.iconImgBox;
                    IconImgEntry             foundIcon = Hardcoded.IconImages.FindFromData(imgBox.imgMapX, imgBox.imgMapY);
                    if (foundIcon != null)
                    {
                        IconImgBox newBox = new IconImgBox(foundIcon);
                        newBox.Location = new Point(imgBox.screenX, imgBox.screenY);
                        toAdd           = newBox;
                    }
                    else
                    {
                        DebugLogger.Log("GMFileLoader", "Couldn't find iconimg with location {0}x{1}, not adding", imgBox.imgMapX, imgBox.imgMapY);
                        DisplayMsgBox(
                            MessageBoxButtons.OK,
                            MessageBoxIcon.Warning,
                            "Loading the foreground file has stopped because it contained an unknown icon image at image map location {0}. " +
                            "Did you forget to change the GT2 Version in Settings before loading?",
                            new Point(imgBox.imgMapX, imgBox.imgMapY)
                            );
                        break;
                    }
                }
                toAdd.DisplayChanged += new BoxDisplayChange(BoxInvalidation);
                newBoxes.Add(toAdd);
            }
            return(newBoxes);
        }