Exemplo n.º 1
0
        protected override void OnUpdating()
        {
            base.OnUpdating();

            if (!MapEvents.Any(obj => obj.IsUpdated))
            {
                foreach (MapObject item in Objects.Where(obj => obj is MapObject mapObject && (mapObject.GetGlobalPosition() - Player.Position).Length > 2500 && mapObject.IsUpdated))
                {
                    item.IsUpdated = false;
                    if (item.CollisionShape is PhysicalRectangleShape shape)
                    {
                        shape.IsActive = false;
                    }
                }

                foreach (MapObject item in Objects.Where(obj => obj is MapObject mapObject && (mapObject.GetGlobalPosition() - Player.Position).Length <= 2500 && !mapObject.IsUpdated))
                {
                    item.IsUpdated = true;
                    if (item.CollisionShape is PhysicalRectangleShape shape)
                    {
                        shape.IsActive = true;
                    }
                }
            }

            UpdateOtherPlayers();

            if (!SavePoints.Any(obj => obj.IsActive))
            {
                PhysicalWorld?.Update();
            }

            UpdateCollision();
        }
        public static void RestartGame()
        {
            EntityManager manager = World.DefaultGameObjectInjectionWorld.EntityManager;

            //Toggle PlayerWeapons
            ChangeWorldDelaySystem.OnChangeWorld += () =>
            {
                //Reset UI
                UIManager.ResetPlayerHealth();
                UIManager.ToggleHellTimers(false);
            };

            //Reset Life
            LifeComponent playerLife = manager.GetComponentData <LifeComponent>(GameVariables.Player.Entity);

            playerLife.Reset();
            manager.SetComponentData(GameVariables.Player.Entity, playerLife);
            //Reset Weapons ammo
            WeaponInitializer.Initialize();
            UIManager.ReloadAllWeapons();
            UIManager.SetWeaponType(WeaponType.Pistol);
            //Reset Death count
            //TODO
            //Load Menu MapType
            MapEvents.LoadMap(MapType.LevelMenu, true);
        }
Exemplo n.º 3
0
 private void Start()
 {
     mapEvents = mapEvents != null ? mapEvents : MapEvents.GetMapEvents;
     owner     = owner != null ? owner : PlayerMain.GetPlayer;
     leaveBtn.onClick.AddListener(LeaveHome);
     BuildButtons();
 }
Exemplo n.º 4
0
    private static void OnEnterPortal(InteractableInfo info)
    {
#if UNITY_EDITOR
        Debug.Log("Entered Portal");
#endif
        //Get PortalComponent
        PortalData data =
            World.DefaultGameObjectInjectionWorld.EntityManager
            .GetComponentData <PortalData>(info.TriggerEntity);

        //Get PortalInfo
        MapInfo.Portal portal = MapHolder.MapsInfo[MapEvents.CurrentTypeLoaded].Portals[data.Value];

        if (!TryEnterPortal(portal.MapTypeLeadingTo, portal.PortalIdLeadingTo))
        {
#if UNITY_EDITOR
            Debug.Log("The Portal ur trying to teleport to doesnt exist yet...");
#endif
            return;
        }

        //Get PortalInfo of other map
        MapInfo.Portal objectivePortal = MapHolder.MapsInfo[portal.MapTypeLeadingTo].Portals[portal.PortalIdLeadingTo];

        //Change Map
        MapEvents.LoadMap(portal.MapTypeLeadingTo);

        //Set player position/rotation
        GlobalEvents.PlayerEvents.SetPlayerPosition(objectivePortal.Position);
        GlobalEvents.PlayerEvents.SetPlayerRotation(objectivePortal.Rotation);
    }
Exemplo n.º 5
0
    private void OnLoadHellLevel(ref LifeComponent playerLife)
    {
        //Keep hand on CurrentWeapon / Map
        WeaponTypeToGoBackTo = GameVariables.Player.CurrentWeaponHeld;
        LastMap = EventsHolder.LevelEvents.CurrentLevel;

        FadeSystem.OnFadeEnd += () =>
        {
            //Toggle PlayerWeapons
            SwapWeaponSystem.SwapWeaponBetweenWorld(WeaponType.HellShotgun, LastMap,
                                                    MapType.Level_Hell);
        };

        ChangeWorldDelaySystem.OnChangeWorld += () =>
        {
            //Start HellWorldSystem
            World.GetExistingSystem <HellWorldSystem>().Enabled = true;

            //Set UI info
            UIManager.ResetPlayerHealth();
            UIManager.ToggleHellTimers(true);
            UIManager.SetWeaponType(WeaponType.HellShotgun);
        };

        //Reset Player Life
        playerLife.Reset();
        EntityManager.SetComponentData(GameVariables.Player.Entity, playerLife);

        //Set new MapType
        MapEvents.LoadMap(MapType.Level_Hell, true);

        //??
        EventsHolder.LevelEvents.LevelEvent = LevelInfo.LevelEventType.OnStart;
    }
 public MapTeleportSelector(string path, TilePosition startPosition, MapEvents events, string editorMap)
 {
     _path          = path;
     _startPosition = startPosition;
     _events        = events;
     _editorMap     = editorMap;
 }
Exemplo n.º 7
0
        /// <inheritdoc />
        public override void OnDisabled()
        {
            MapEvents.UnsubscribeEvents();
            PlayerEvents.UnsubscribeEvents();
            ServerEvents.UnsubscribeEvents();

            harmony.UnpatchAll();

            base.OnDisabled();
        }
Exemplo n.º 8
0
    public override void OnPointerClick(UnityEngine.EventSystems.PointerEventData eventData)
    {
        base.OnPointerClick(eventData);
        isEnabled = !isEnabled;
        GetComponent <Image>().sprite = isEnabled ? enabledImage : disabledImage;

        MapEvents.SendEvent("CLEARDATA");
        MapEvents.SendEvent(visualizerName + ": " + (isEnabled ? "active" : "inactive"));
        MapEvents.SendEvent("BUILDDATA");
    }
        public static void StartHellLevel(int difficulty, int deathCount)
        {
            //TODO explain to player he needs to survive X amount of time to respawn
#if UNITY_EDITOR
            Debug.Log("Current Difficulty : " + difficulty + ", Current Death Count : " + deathCount);
#endif

            //TODO start Soundtrack for hell level
            MapEvents.LoadMap(MapType.Level_Hell, true);
            UIManager.ResetPlayerHealth();
        }
Exemplo n.º 10
0
        /// <inheritdoc />
        public override void OnEnabled()
        {
            MapEvents.SubscribeEvents();
            PlayerEvents.SubscribeEvents();
            ServerEvents.SubscribeEvents();

            harmony = new Harmony($"build.scp457.{DateTime.UtcNow.Ticks}");
            harmony.PatchAll();

            base.OnEnabled();
        }
    public static void InitializeSystemWorkflow()
    {
        GameVariables.EntityManager = World.DefaultGameObjectInjectionWorld.EntityManager;

        //GameVariables.PlayerVars.Default.PlayerAudioSource = MonoGameVariables.instance.playerAudioSource;
        //Game Initializer?

        UIManager.Initialize();
        PlayerInitializer.Initialize();
        WeaponInitializer.Initialize();
        MapEvents.Initialize();

        InitializeSystems();
    }
Exemplo n.º 12
0
        /// <summary>
        /// Clears all layers and events
        /// </summary>
        private void btnClear_Click_1(object sender, EventArgs e)
        {
            axMap1.RemoveAllLayers();
            axMap1.ClearDrawings();
            axMap1.CursorMode = MapWinGIS.tkCursorMode.cmZoomIn;
            MapEvents.Clear();

            axMap1.Projection             = tkMapProjection.PROJECTION_GOOGLE_MERCATOR;
            axMap1.ZoomBehavior           = tkZoomBehavior.zbUseTileLevels;
            axMap1.TileProvider           = tkTileProvider.OpenStreetMap;
            axMap1.GrabProjectionFromData = false;

            m_examples.m_timer.Stop();
        }
Exemplo n.º 13
0
        /// <summary>
        /// Creates a new instance of the form1
        /// </summary>
        public TestForm()
        {
            InitializeComponent();
            MapEvents.AttachMap(axMap1);
            m_examples        = new MapExamples();
            m_examples.axMap1 = axMap1;
            m_description     = new Description();
            FillList();
            this.treeView1.SelectedNode = this.treeView1.Nodes[0];
            GenerateExamples();
            btnClear_Click_1(null, null);

            axMap1.ProjectionMismatch += axMap1_ProjectionMismatch;
            axMap1.LayerReprojected   += axMap1_LayerReprojected;
        }
Exemplo n.º 14
0
        protected override void OnUpdated()
        {
            //イベント開始判定
            if (!MapEvents.Any(obj => obj.IsUpdated))
            {
                foreach (var item in MapEvents)
                {
                    if (Player.CollisionShape.GetIsCollidedWith(item.Shape))
                    {
                        item.IsUpdated = true;
                    }
                }
            }

            UpdateDamage();

            base.OnUpdated();
        }
Exemplo n.º 15
0
        private void GenerateDynamicItems()
        {
            // TODO: i really need to stop making program when i'm sleepy
            foreach (var pairs in GameMapInfo.MapEvents)
            {
                var mapInfo = pairs.Key;
                var events  = pairs.Value;
                var names   = mapInfo.ReflectField <List <string> >("MapNames");
                var mapId   = mapInfo.ReflectField("No", -1);

                _bundleTargets.Add(
                    new AssetList(this, $"adv/eventcg/{mapId}.unity3d", null)
                    .AddAsset(
                        events
                        .Where(x => x > 0)
                        .Select(id => MapEvents.GenerateMapEvent(AssetFolder, names.Last(), id))
                        .Where(x => !x.IsNullOrEmpty())
                        )
                    );
            }
        }
Exemplo n.º 16
0
    public static void OnExitHellLevel()
    {
        //Set UI info
        UIManager.ResetPlayerHealth();
        UIManager.ToggleHellTimers(false);

        FadeSystem.OnFadeEnd += () =>
        {
            //Toggle PlayerWeapons
            SwapWeaponSystem.SwapWeaponBetweenWorld(WeaponTypeToGoBackTo, MapType.Level_Hell, LastMap);
        };

        ChangeWorldDelaySystem.OnChangeWorld += () =>
        {
            //Set UI info
            UIManager.ResetPlayerHealth();
            UIManager.SetWeaponType(WeaponTypeToGoBackTo);
        };

        //Set new MapType
        MapEvents.LoadMap(LastMap, true);
    }
Exemplo n.º 17
0
 public TelePortLocation(CanTelePortTo canTele, MapEvents mapEvents)
 {
     CanTelePortTo  = canTele;
     landPlatform   = canTele.LandCordinations;
     this.mapEvents = mapEvents;
 }
Exemplo n.º 18
0
 public void Start() => mapEvents = mapEvents != null ? mapEvents : MapEvents.GetMapEvents;
        /*public MapEvent GetMapEvent(Vector2Int pos) {
         *      int index = SceneManager.GetActiveScene().buildIndex;
         *      return MapEvents.SingleOrDefault(val => val.SceneNumber == index)[pos];
         * }*/
        public MapEventData GetMapEventData()
        {
            int index = SceneManager.GetActiveScene().buildIndex;

            return(MapEvents.SingleOrDefault(val => val.SceneNumber == index));
        }
Exemplo n.º 20
0
        public void Run()
        {
            Element rootElement = Document.GetElementById("map");

            MapOptions mapOptions = new MapOptions();

            mapOptions.Credentials         = (string)rootElement.GetAttribute("data-credentials");
            mapOptions.Width               = 640;
            mapOptions.Height              = 480;
            mapOptions.ShowCopyright       = false;
            mapOptions.ShowMapTypeSelector = false;
            mapOptions.ShowLogo            = false;
            mapOptions.ShowScalebar        = false;
            mapOptions.ShowNavControl      = false;
            mapOptions.ShowDashboard       = false;
            mapOptions.Center              = new MapLocation(47.610377, -122.2006786);
            mapOptions.Zoom    = 10;
            mapOptions.MapType = MapType.Road;

            MapPushpinOptions pushpinOptions = new MapPushpinOptions();

            _pushpin = new MapPushpin(mapOptions.Center, pushpinOptions);

            MapInfoboxOptions infoboxOptions = new MapInfoboxOptions();

            infoboxOptions.Title           = "Bellevue";
            infoboxOptions.Visible         = false;
            infoboxOptions.Offset          = new MapPoint(0, 20);
            infoboxOptions.Height          = 48;
            infoboxOptions.Width           = 80;
            infoboxOptions.ShowCloseButton = false;
            _infobox = new MapInfobox(mapOptions.Center, infoboxOptions);

            _map = new Map(rootElement, mapOptions);
            _map.Entities.Push(_pushpin);
            _map.Entities.Push(_infobox);

            MapEvents.AddHandler(_pushpin, "click", OnPushpinClick);
            MapEvents.AddHandler(_map, "viewchange", OnViewChanged);

            MapModuleOptions trafficOptions = new MapModuleOptions();

            trafficOptions.Callback = delegate() {
                TrafficLayer trafficLayer = new TrafficLayer(_map);
                trafficLayer.Show();
            };
            Map.LoadModule(MapModule.Traffic, trafficOptions);

            MapModuleOptions venueMapOptions = new MapModuleOptions();

            venueMapOptions.Callback = delegate() {
                VenueMapFactory venueMapFactory = new VenueMapFactory(_map);

                VenueMapSearchOptions searchOptions = new VenueMapSearchOptions();
                searchOptions.Map      = _map;
                searchOptions.Location = mapOptions.Center;
                searchOptions.Radius   = 1000;
                searchOptions.Callback = delegate(Venue[] venues) {
                    if (venues.Length != 0)
                    {
                        VenueMapOptions venueOptions = new VenueMapOptions();
                        venueOptions.VenueMapID      = venues[0].Metadata.ID;
                        venueOptions.SuccessCallback = delegate(VenueMap venueMap, VenueMapOptions options) {
                            venueMap.Show();
                            if (Window.Confirm("Zoom to " + venueMap.Name + "?"))
                            {
                                _map.SetView(venueMap.BestMapView);
                            }
                        };

                        venueMapFactory.Create(venueOptions);
                    }
                };

                venueMapFactory.Search(searchOptions);
            };
            Map.LoadModule(MapModule.VenueMaps, venueMapOptions);

            Element locateMeButton = Document.GetElementById("locateMeButton");

            locateMeButton.AddEventListener("click", OnLocateMeClick, false);
        }
Exemplo n.º 21
0
        private static void UpdatePhotos(bool newPhotos)
        {
            if (newPhotos)
            {
                if (_mapEntities != null)
                {
                    _map.Entities.Remove(_mapEntities);
                }

                _mapEntities = new MapEntityCollection();
                _map.Entities.Push(_mapEntities);

                _photoViews = new Dictionary <string, PhotoView>();
            }

            if (_model.Photos.Count == 0)
            {
                Document.Body.ClassName = MapModeClassName;
                return;
            }

            Document.Body.ClassName = PhotosModeClassName;

            _graph = new Graph();
            _model.Photos.ForEach(delegate(Photo photo) {
                MapLocation location = new MapLocation(photo.latitude, photo.longitude);
                MapPoint point       = _map.TryLocationToPixel(location, MapPointReference.Control);

                PhotoView photoView;
                if (newPhotos)
                {
                    MapPolylineOptions connectorOptions = new MapPolylineOptions();
                    connectorOptions.StrokeColor        = new MapColor(255, 0x4E, 0xD3, 0x4E);
                    connectorOptions.StrokeThickness    = 2;

                    MapInfoboxOptions calloutOptions = new MapInfoboxOptions();
                    calloutOptions.Width             = 50;
                    calloutOptions.Height            = 50;
                    calloutOptions.ShowPointer       = false;
                    calloutOptions.ShowCloseButton   = false;
                    calloutOptions.Offset            = new MapPoint(-25, -25);
                    calloutOptions.HtmlContent       =
                        "<div class=\"photoInfobox\" style=\"background-image: url(" + photo.thumbnailUrl + ")\"" +
                        " title=\"" + photo.title.HtmlEncode() + "\"></div>";
                    calloutOptions.Visible = true;

                    MapPushpinOptions pushpinOptions = new MapPushpinOptions();
                    pushpinOptions.Icon     = "Dot.png";
                    pushpinOptions.Width    = 10;
                    pushpinOptions.Height   = 10;
                    pushpinOptions.Anchor   = new MapPoint(5, 5);
                    pushpinOptions.TypeName = "locationPushpin";

                    photoView              = new PhotoView();
                    photoView.pushpin      = new MapPushpin(location, pushpinOptions);
                    photoView.connector    = new MapPolyline(new MapLocation[] { location, location }, connectorOptions);
                    photoView.callout      = new MapInfobox(location, calloutOptions);
                    photoView.callout.Data = photo;
                    _photoViews[photo.id]  = photoView;

                    _mapEntities.Insert(photoView.connector, 0);
                    _mapEntities.Insert(photoView.callout, 0);
                    _mapEntities.Insert(photoView.pushpin, 0);
                    MapEvents.AddHandler(photoView.callout, "click", delegate(MapEventArgs e) {
                        ShowPhoto(photo);
                    });
                }
                else
                {
                    photoView = _photoViews[photo.id];
                }

                photoView.pushpinNode          = new GraphNode();
                photoView.pushpinNode.x        = point.X;
                photoView.pushpinNode.y        = point.Y;
                photoView.pushpinNode.moveable = false;

                photoView.calloutNode   = new GraphNode();
                photoView.calloutNode.x = point.X;
                photoView.calloutNode.y = point.Y;

                GraphEdge connectorEdge = new GraphEdge(photoView.pushpinNode,
                                                        photoView.calloutNode,
                                                        10 + Math.Random() * 15);

                _graph.AddNode(photoView.pushpinNode);
                _graph.AddNode(photoView.calloutNode);
                _graph.AddEdge(connectorEdge);
            });

            Window.SetTimeout(UpdateLayout, 30);
        }
Exemplo n.º 22
0
        static Page()
        {
            if (Document.Body.GetAttribute("data-app") == null)
            {
                return;
            }

            string flickrKey = (string)Document.Body.GetAttribute("data-flickr-key");

            Debug.Assert(String.IsNullOrEmpty(flickrKey) == false);

            string bingMapsKey = (string)Document.Body.GetAttribute("data-bingmaps-key");

            Debug.Assert(String.IsNullOrEmpty(bingMapsKey) == false);

            _tileUrlFormat = (string)Document.Body.GetAttribute("data-tile-url");
            Debug.Assert(String.IsNullOrEmpty(_tileUrlFormat) == false);

            _model = new PageModel(new FlickrService(flickrKey), new HtmlStorageService());
            _model.PropertyChanged += delegate(object sender, PropertyChangedEventArgs e) {
                if (e.PropertyName == "Searching")
                {
                    Element progressElement = Utility.GetElement("searchProgress");
                    if (_model.Searching)
                    {
                        progressElement.ClassName = "active";
                    }
                    else
                    {
                        progressElement.ClassName = "";
                    }
                }
                else if (e.PropertyName == "Photos")
                {
                    if (_model.SelectedPhoto != null)
                    {
                        ShowPhoto(null);
                    }

                    UpdatePhotos(/* newPhotos */ true);
                }
            };

            MapOptions mapOptions = new MapOptions();

            mapOptions.Credentials         = bingMapsKey;
            mapOptions.ShowMapTypeSelector = false;
            mapOptions.ShowDashboard       = false;
            mapOptions.ShowScalebar        = false;
            mapOptions.ShowCopyright       = false;
            mapOptions.ShowLogo            = false;
            mapOptions.MapType             = MapType.Custom;
            mapOptions.Zoom            = 2;
            mapOptions.BackgroundColor = new MapColor(255, 255, 255, 255);
            _map = new Map(Utility.GetElement("mapContainer"), mapOptions);

            MapTileSourceOptions sourceOptions = new MapTileSourceOptions();

            sourceOptions.UriGenerator = CreateTileUrl;

            MapTileLayerOptions layerOptions = new MapTileLayerOptions();

            layerOptions.Mercator = new MapTileSource(sourceOptions);
            _map.Entities.Push(new MapTileLayer(layerOptions));

            MapEvents.AddHandler(_map, "viewchangestart", delegate(MapEventArgs e) {
                _viewChanging = true;
                _zoomLevel    = _map.GetZoom();
            });
            MapEvents.AddThrottledHandler(_map, "viewchangeend", delegate(MapEventArgs e) {
                _viewChanging = false;

                if (_zoomLevel != _map.GetZoom())
                {
                    UpdatePhotos(/* newPhotos */ false);
                }
            }, 250);
            MapEvents.AddHandler(_map, "mousedown", delegate(MapEventArgs e) {
                _oldMode = Document.Body.ClassName;
                Document.Body.ClassName = MapModeClassName;
            });
            MapEvents.AddHandler(_map, "mouseup", delegate(MapEventArgs e) {
                Document.Body.ClassName = _oldMode;
            });

            Utility.SubscribeKey("searchBox", delegate(ElementEvent e) {
                Window.SetTimeout(delegate() {
                    Document.GetElementById("searchButton").ClassName =
                        String.IsNullOrEmpty(Utility.GetElement("searchBox").As <InputElement>().Value) ? "reset" : "";
                }, 0);
            });
            Utility.SubscribeBlur("searchBox", delegate(ElementEvent e) {
                Window.SetTimeout(delegate() {
                    Document.GetElementById("searchButton").ClassName = "";
                }, 0);
            });
            Utility.SubscribeClick("searchButton", delegate(ElementEvent e) {
                Search(Utility.GetElement("searchBox").As <InputElement>().Value);
                Document.ActiveElement.Blur();
            });
            Utility.SubscribeClick("locateMeButton", delegate(ElementEvent e) {
                ShowLocation();
            });
            Utility.SubscribeClick("favButton", delegate(ElementEvent e) {
                ShowFavorites();
            });

            Utility.SubscribeClick("photoAroundButton", delegate(ElementEvent e) {
                SearchSimilar();
            });
            Utility.SubscribeClick("photoCloseButton", delegate(ElementEvent e) {
                HidePhoto();
            });
            Utility.SubscribeClick("photoSaveButton", delegate(ElementEvent e) {
                FavoritePhoto();
            });
            Utility.SubscribeClick("photoShareButton", delegate(ElementEvent e) {
                SharePhoto();
            });
            Utility.SubscribeClick("photoSourceButton", delegate(ElementEvent e) {
                ShowPhotoFlickrPage();
            });

            ShowLocation();
        }
Exemplo n.º 23
0
 public MapEditor(string path, MapEvents events)
 {
     _path   = path;
     _events = events;
 }
Exemplo n.º 24
0
 public void SetInactive()
 {
     isEnabled = false;
     GetComponent <Image>().sprite = disabledImage;
     MapEvents.SendEvent(visualizerName + ": " + (isEnabled ? "active" : "inactive"));
 }