public List <PartsSelectionTreeElement> SelectPartsFromSplitXml(Stream xmlFile, List <PartsSelectionTreeElement> parts)
        {
            Split         splitXml;
            XmlSerializer serializer = new XmlSerializer(typeof(Split));

            splitXml = (Split)serializer.Deserialize(xmlFile);
            var splitDocument = (SplitExcel)splitXml.Items.Where(it => it is SplitExcel && string.Equals(((SplitExcel)it).Name, DocumentName)).SingleOrDefault();

            if (splitDocument == null)
            {
                throw new SplitNameDifferenceExcception(string.Format("This split xml describes a different document."));
            }

            foreach (var person in splitDocument.Person)
            {
                foreach (var universalMarker in person.UniversalMarker)
                {
                    var selectedPartsIndexes = MarkerHelper <PartsSelectionTreeElement> .GetCrossedElements(universalMarker.ElementId, universalMarker.SelectionLastelementId, parts, element => element.ElementId);

                    foreach (var index in selectedPartsIndexes)
                    {
                        parts[index].OwnerName = person.Email;
                        parts[index].Selected  = true;
                    }
                }
            }

            return(parts);
        }
示例#2
0
        public async Task Spawn(bool respawnNew = false) => await AltAsync.Do(async() =>
        {
            if (respawnNew)
            {
                Save(true);
            }

            ColShape = Alt.CreateColShapeCylinder(new Position(DbModel.PosX, DbModel.PosY, DbModel.PosZ), 1f, 2f);

            MarkerModel = new MarkerModel()
            {
                Type         = 27,
                Dimension    = 0,
                PosX         = DbModel.PosX,
                PosY         = DbModel.PosY,
                PosZ         = DbModel.PosZ,
                DirX         = 0,
                DirY         = 0,
                DirZ         = 0,
                RotX         = 0,
                RotY         = 0,
                RotZ         = 0,
                ScaleX       = 1f,
                ScaleY       = 1f,
                ScaleZ       = 1f,
                Red          = 0,
                Green        = 153,
                Blue         = 0,
                Alpha        = 100,
                BobUpAndDown = false,
                FaceCamera   = false,
                P19          = 2,
                Rotate       = false,
                TextureDict  = null,
                TextureName  = null,
                DrawOnEnts   = false,
                UniqueID     = $"ATM_MARKER{DbModel.Id}"
            };

            BlipModel = new BlipModel()
            {
                PosX       = DbModel.PosX,
                PosY       = DbModel.PosY,
                PosZ       = DbModel.PosZ + 1,
                Blip       = 277,
                Color      = 25,
                Size       = EBlipSize.Medium,
                Name       = "ATM",
                ShortRange = true,
                UniqueID   = $"ATM{DbModel.Id}"
            };

            await MarkerHelper.CreateGlobalMarker(MarkerModel);
            await BlipHelper.CreateGlobalBlip(BlipModel);

            ColShape.SetData("atm:data", this);

            EntityHelper.Add(this);
        });
示例#3
0
 private static void UpdateMarkerLayer(Viewport viewport, List <IMarker> markers)
 {
     foreach (var marker in markers)
     {
         var screenPosition = viewport.WorldToScreen(marker.GeoPosition.X, marker.GeoPosition.Y);
         MarkerHelper.SetScreenPosition(marker.View, screenPosition, marker.HorizontalAlignment, marker.VerticalAlignment);
     }
 }
示例#4
0
        private void ZoomToCurrentTrackEnd()
        {
            long             selectionLength = CurrentTrack.FadeOutEndMarker.Start - MarkerHelper.GetMarkerEnd(CurrentTrack.TrackRegion);
            SfAudioSelection selection       = new SfAudioSelection(MarkerHelper.GetMarkerEnd(CurrentTrack.TrackRegion), selectionLength);

            _fileTasks.SetSelection(selection);
            _fileTasks.ZoomToShow(_fileTasks.ExpandSelectionAround(selection, ZoomPadding));
            _fileTasks.RedrawWindow();
        }
示例#5
0
 public void MoveStartBy(long samples)
 {
     TrackRegion.Start  += samples;
     TrackRegion.Length -= samples;
     if (!CanMoveFadeInBy(samples))
     {
         samples = MarkerHelper.GetMarkerEnd(TrackRegion) - FadeInEndMarker.Start;
     }
     MoveFadeInBy(samples);
 }
示例#6
0
        public async Task Spawn() => await AltAsync.Do(async() =>
        {
            ColShape = Alt.CreateColShapeCylinder(new Position(DbModel.PosX, DbModel.PosY, DbModel.PosZ - 0.9f), 1f, 2f);

            MarkerModel = new MarkerModel()
            {
                Type         = 27,
                Dimension    = 0,
                PosX         = DbModel.PosX,
                PosY         = DbModel.PosY,
                PosZ         = DbModel.PosZ - 0.9f,
                DirX         = 0,
                DirY         = 0,
                DirZ         = 0,
                RotX         = 0,
                RotY         = 0,
                RotZ         = 0,
                ScaleX       = 1f,
                ScaleY       = 1f,
                ScaleZ       = 1f,
                Red          = 0,
                Green        = 153,
                Blue         = 0,
                Alpha        = 100,
                BobUpAndDown = false,
                FaceCamera   = false,
                P19          = 2,
                Rotate       = false,
                TextureDict  = null,
                TextureName  = null,
                DrawOnEnts   = false,
                UniqueID     = $"SHOP{DbModel.Id}"
            };

            BlipModel = new BlipModel()
            {
                PosX       = DbModel.PosX,
                PosY       = DbModel.PosY,
                PosZ       = DbModel.PosZ + 1,
                Blip       = 52,
                Color      = 38,
                Size       = EBlipSize.Medium,
                Name       = ShopEntityFactory.CreateShopName(DbModel.ShopEntityType),
                ShortRange = true,
                UniqueID   = $"SHOP{DbModel.Id}"
            };

            await MarkerHelper.CreateGlobalMarker(MarkerModel);
            await BlipHelper.CreateGlobalBlip(BlipModel);
            EntityHelper.Add(this);
            ColShape.SetData("shop:data", this);
        });
示例#7
0
        public bool CanMoveFadeInBy(long samples)
        {
            if (FadeInEndMarker.Start + samples < TrackRegion.Start)
            {
                return(false);
            }

            if (FadeInEndMarker.Start + samples > MarkerHelper.GetMarkerEnd(TrackRegion))
            {
                return(false);
            }

            return(true);
        }
示例#8
0
        public bool CanMoveEndBy(long samples)
        {
            var newEndPosition = MarkerHelper.GetMarkerEnd(TrackRegion) + samples;

            if (IsLastTrack && newEndPosition > _originalFile.Length)
            {
                return(false);
            }

            if (!IsLastTrack && newEndPosition > _splitTrackList.GetTrack(Number + 1).TrackRegion.Start)
            {
                return(false);
            }

            return(newEndPosition > TrackRegion.Start);
        }
示例#9
0
        public void Spawn()
        {
            Alt.Log($"[WAREHOUSE-ENTITY] Warehouse dla grupy {GroupEntity.DbModel.Id} został stworzony");

            ColShape = Alt.CreateColShapeCylinder(new Position(DbModel.PosX, DbModel.PosY, DbModel.PosZ - 0.9f), 5f, 2f);
            ColShape.SetData("warehouse:data", this);


            Marker = new MarkerModel()
            {
                Type         = 1,
                Dimension    = 0,
                PosX         = DbModel.PosX,
                PosY         = DbModel.PosY,
                PosZ         = DbModel.PosZ - 0.9f,
                DirX         = 0,
                DirY         = 0,
                DirZ         = 0,
                RotX         = 0,
                RotY         = 0,
                RotZ         = 0,
                ScaleX       = 1f,
                ScaleY       = 1f,
                ScaleZ       = 1f,
                Red          = 0,
                Green        = 153,
                Blue         = 0,
                Alpha        = 100,
                BobUpAndDown = false,
                FaceCamera   = false,
                P19          = 2,
                Rotate       = false,
                TextureDict  = null,
                TextureName  = null,
                DrawOnEnts   = false,
                UniqueID     = $"WAREHOUSE_MARKER{DbModel.Id}"
            };

            // Do testów później nie będzie
            AltAsync.Do(async() =>
            {
                await MarkerHelper.CreateGlobalMarker(Marker);
            });

            EntityHelper.Add(this);
        }
示例#10
0
        public void MoveEndBy(long samples)
        {
            TrackRegion.Length += samples;

            if (CanMoveFadeOutBy(samples))
            {
                MoveFadeOutBy(samples);
            }
            else
            {
                FadeOutEndMarker.Start = IsLastTrack
                    ? _originalFile.Length
                    : _splitTrackList.GetTrack(Number + 1).TrackRegion.Start;
            }

            if (MarkerHelper.GetMarkerEnd(TrackRegion) < FadeInEndMarker.Start)
            {
                FadeInEndMarker.Start = MarkerHelper.GetMarkerEnd(TrackRegion);
            }
        }
示例#11
0
        public bool CanMoveStartBy(long samples)
        {
            if (TrackRegion.Start + samples >= MarkerHelper.GetMarkerEnd(TrackRegion))
            {
                return(false);
            }

            if (Number > 1)
            {
                if (TrackRegion.Start + samples < _splitTrackList.GetTrack(Number - 1).FadeOutEndMarker.Start)
                {
                    return(false);
                }
            }
            else
            {
                if (TrackRegion.Start + samples < 0)
                {
                    return(false);
                }
            }

            return(true);
        }
示例#12
0
        public async Task Spawn()
        {
            InteriorColshape           = Alt.CreateColShapeCylinder(new Position(DbModel.InternalPickupPositionX, DbModel.InternalPickupPositionY, DbModel.InternalPickupPositionZ - 0.9f), 1f, 2f);
            ExteriorColshape           = Alt.CreateColShapeCylinder(new Position(DbModel.ExternalPickupPositionX, DbModel.ExternalPickupPositionY, DbModel.ExternalPickupPositionZ - 0.9f), 1f, 2f);
            ExteriorColshape.Dimension = DbModel.Id;

            InteriorMarker = new MarkerModel()
            {
                Type         = 1,
                Dimension    = 0,
                PosX         = DbModel.InternalPickupPositionX,
                PosY         = DbModel.InternalPickupPositionY,
                PosZ         = DbModel.InternalPickupPositionZ - 0.9f,
                DirX         = 0,
                DirY         = 0,
                DirZ         = 0,
                RotX         = 0,
                RotY         = 0,
                RotZ         = 0,
                ScaleX       = 1f,
                ScaleY       = 1f,
                ScaleZ       = 1f,
                Red          = 0,
                Green        = 153,
                Blue         = 0,
                Alpha        = 100,
                BobUpAndDown = false,
                FaceCamera   = false,
                P19          = 2,
                Rotate       = false,
                TextureDict  = null,
                TextureName  = null,
                DrawOnEnts   = false,
                UniqueID     = $"BUILDING_MARKER{DbModel.Id}"
            };

            ExteriorMarker = new MarkerModel()
            {
                Type         = 1,
                Dimension    = DbModel.Id,
                PosX         = DbModel.ExternalPickupPositionX,
                PosY         = DbModel.ExternalPickupPositionY,
                PosZ         = DbModel.ExternalPickupPositionZ - 0.9f,
                DirX         = 0,
                DirY         = 0,
                DirZ         = 0,
                RotX         = 0,
                RotY         = 0,
                RotZ         = 0,
                ScaleX       = 1f,
                ScaleY       = 1f,
                ScaleZ       = 1f,
                Red          = 0,
                Green        = 153,
                Blue         = 0,
                Alpha        = 100,
                BobUpAndDown = false,
                FaceCamera   = false,
                P19          = 2,
                Rotate       = false,
                TextureDict  = null,
                TextureName  = null,
                DrawOnEnts   = false,
                UniqueID     = $"BUILDING_MARKER{DbModel.Id}"
            };

            await MarkerHelper.CreateGlobalMarker(InteriorMarker);

            await MarkerHelper.CreateGlobalMarker(ExteriorMarker);

            // Później to zmienić i dodać do bazy może, ale to się zobaczy
            if (DbModel.BuildingType == BuildingType.Apartament)
            {
                BlipVisable = false;
            }


            if (BlipVisable)
            {
                string blipName = BuildingFactory.CreateName(DbModel.BuildingType);
                int    blip     = BuildingFactory.CreateBlip(DbModel.BuildingType, DbModel.OnSale);
                int    color    = BuildingFactory.CreateColor(DbModel.OnSale, DbModel.BuildingType);
                Blip = new BlipModel()
                {
                    PosX       = DbModel.InternalPickupPositionX,
                    PosY       = DbModel.InternalPickupPositionY,
                    PosZ       = DbModel.InternalPickupPositionZ + 1,
                    Blip       = blip,
                    Color      = color, // Kolor pózniej do zmiany jak budynek będzie kupiony
                    Size       = EBlipSize.Medium,
                    Name       = blipName,
                    ShortRange = true,
                    UniqueID   = $"BUILDING{DbModel.Id}"
                };
                Alt.Log("Tworze blipa z budynkiem");
                await BlipHelper.CreateGlobalBlip(Blip);
            }
            EntityHelper.Add(this);
            InteriorColshape.SetData("building:data", this);
            ExteriorColshape.SetData("building:data", this);
        }