Example #1
0
        private void OnInitialLoadDone()
        {
            float height;

            if (GetLandHeight(mEntryPoint.X, 64.0f * Metrics.TileSize - mEntryPoint.Y, out height))
            {
                height += 50.0f;
                SkyManager.Instance.UpdatePosition(new Vector3(mEntryPoint, height));

                var entryPoint = new Vector3(mEntryPoint, height);
                if (FileManager.Instance.Version > FileDataVersion.Mists)
                {
                    entryPoint.Y = 64.0f * Metrics.TileSize - mEntryPoint.Y;
                }

                SkyManager.Instance.AsyncUpdate();
                EditorWindowController.Instance.OnEnterWorld();
                WorldFrame.Instance.OnEnterWorld(entryPoint);
                WorldFrame.Instance.Dispatcher.BeginInvoke(
                    () =>
                {
                    SkySphere.UpdatePosition(new Vector3(mEntryPoint, height));
                    SkyManager.Instance.SyncUpdate();
                    WorldFrame.Instance.CamControl.ForceUpdate(WorldFrame.Instance.ActiveCamera.Position);
                    WorldFrame.Instance.M2Manager.ViewChanged();
                });
            }

            GC.Collect();
            GC.WaitForPendingFinalizers();
        }
Example #2
0
        public void UpdatePosition(Vector3 position, bool updateTerrain)
        {
            WorldFrame.Instance.UpdatePosition(position);
            SkySphere.UpdatePosition(position);

            if (updateTerrain)
            {
                SkyManager.Instance.UpdatePosition(position);
                var pos2D = new Vector2(position.X, position.Y);
                mAreaLowManager.UpdatePosition(ref pos2D);
                UpdateVisibility(ref position);
            }

            EditorWindowController.Instance.OnUpdatePosition(position);

            var x = position.X;
            var y = position.Y;

            if (FileManager.Instance.Version <= FileDataVersion.Warlords)
            {
                y = 64.0f * Metrics.TileSize - y;
            }

            var tilex = (int)Math.Floor(x / Metrics.TileSize);
            var tiley = (int)Math.Floor(y / Metrics.TileSize);

            EditorWindowController.Instance.OnUpdateTileIndex(tilex, tiley);
        }