Example #1
0
        internal static void Dispose()
        {
            ItemTexture.Dispose();
            TerrainTexture.Dispose();
            EntityTexture.Dispose();

            ButtonTex.Dispose();
            LabelTex.Dispose();
            TextboxTex.Dispose();

            GameBackgroundTex.Dispose();
            DesertBackgroundTex.Dispose();
            NightBackgroundTex.Dispose();
            TitleBackgroundTex.Dispose();

            FontCenturyGothicTex.Dispose();
            FontChillerTex.Dispose();
            FontDialogInputTex.Dispose();
            FontLucidaConsoleTex.Dispose();
        }
Example #2
0
        public override void Construct()
        {
            PreviewPanel = AddChild(new Gui.Widget
            {
                AutoLayout = Gui.AutoLayout.DockFill,
                OnLayout   = (sender) =>
                {
                    Camera.Rect = sender.Rect;
                },
                OnClick = (sender, args) =>
                {
                    if (Generator.CurrentState != OverworldGenerator.GenerationState.Finished)
                    {
                        return;
                    }

                    if (args.MouseButton == 0)
                    {
                        var clickPoint = Camera.ScreenToWorld(new Vector2(args.X, args.Y));

                        var colonyCell = Overworld.ColonyCells.GetCellAt(clickPoint.X, clickPoint.Y);
                        if (colonyCell != null)
                        {
                            Overworld.InstanceSettings.Cell = colonyCell;
                            previewText = Generator.GetSpawnStats();
                            Camera.SetGoalFocus(new Vector3((float)colonyCell.Bounds.Center.X / (float)Overworld.Width, 0, (float)colonyCell.Bounds.Center.Y / (float)Overworld.Height));
                        }

                        UpdatePreview = true;


                        OnCellSelectionMade?.Invoke();
                    }
                },
                OnMouseMove = (sender, args) =>
                {
                    if (Generator.CurrentState != OverworldGenerator.GenerationState.Finished)
                    {
                        return;
                    }
                    Camera.OnMouseMove(args);
                },
                OnScroll = (sender, args) =>
                {
                    if (Generator.CurrentState != OverworldGenerator.GenerationState.Finished)
                    {
                        return;
                    }

                    Camera.OnScroll(args);
                }
            });

            OnClose += (sender) =>
            {
                Mesh.Dispose();
                TerrainTexture.Dispose();
                PreviewTexture.Dispose();
            };

            Camera.Overworld = Overworld;
        }