wip map importer stuff

This commit is contained in:
GoaLitiuM
2021-07-05 15:52:51 +03:00
parent edbb0f9742
commit d94a2544a0
18 changed files with 1969 additions and 71 deletions

View File

@@ -22,7 +22,15 @@ namespace Cabrito
protected TextLayoutOptions _layout;
public FontReference Font;
private FontReference Font;
public int FontHeight
{
get
{
return Font.GetFont().Height;
}
}
public float LineSpacing = 1.0f;
@@ -65,12 +73,14 @@ namespace Cabrito
{
}
public ConsoleContentTextBox(ConsoleInputTextBox inputBox, float x, float y, float width, float height) : base(
public ConsoleContentTextBox(FontReference font, ConsoleInputTextBox inputBox, float x, float y, float width, float height) : base(
x, y, width, height)
{
this.inputBox = inputBox;
Height = height;
Font = font;
_layout = TextLayoutOptions.Default;
_layout.VerticalAlignment = TextAlignment.Near;
_layout.TextWrapping = TextWrapping.WrapChars;

View File

@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using FlaxEditor;
using FlaxEngine;
using FlaxEngine.Assertions;
using FlaxEngine.GUI;
namespace Cabrito
@@ -85,13 +86,12 @@ namespace Cabrito
if (consoleBox == null)
{
//consoleBox = new ConsoleContentTextBox(null, 0, 0, consoleSize.X, consoleSize.Y - fontHeight);
consoleBox = new ConsoleContentTextBox(null, 0, 0, 0, 0);
consoleBox = new ConsoleContentTextBox(fontReference, null, 0, 0, 0, 0);
consoleBox.SetAnchorPreset(AnchorPresets.HorizontalStretchTop, true);
//consoleBox.AnchorMax = new Vector2(1.0f, ConsoleHeight);
//consoleBox.Height = consoleSize.Y - fontHeight;
consoleBox.Font = fontReference;
//consoleBox.HorizontalAlignment = TextAlignment.Near;
//consoleBox.VerticalAlignment = TextAlignment.Near;
@@ -113,14 +113,12 @@ namespace Cabrito
if (consoleNotifyBox == null)
{
//consoleBox = new ConsoleContentTextBox(null, 0, 0, consoleSize.X, consoleSize.Y - fontHeight);
consoleNotifyBox = new ConsoleContentTextBox(null, 0, 0, 0, 0);
consoleNotifyBox = new ConsoleContentTextBox(fontReference, null, 0, 0, 0, 0);
consoleNotifyBox.HeightMultiplier = 0;
consoleNotifyBox.Height = ConsoleNotifyLines * fontHeight;
consoleNotifyBox.SetAnchorPreset(AnchorPresets.HorizontalStretchTop, true);
//consoleBox.AnchorMax = new Vector2(1.0f, ConsoleHeight);
consoleNotifyBox.Font = fontReference;
//consoleBox.HorizontalAlignment = TextAlignment.Near;
//consoleBox.VerticalAlignment = TextAlignment.Near;
//consoleNotifyBox.HeightMultiplier = ConsoleHeight;
@@ -263,11 +261,23 @@ namespace Cabrito
private void OnSendExceptionLog(Exception exception, FlaxEngine.Object obj)
{
Console.Print("[EXCEP] " + exception.Message);
AssertionException assert = exception as AssertionException;
if (assert != null)
{
var assertLines = assert.Message.Split('\n');
if (assertLines.Length > 2)
Console.Print("Assert Failure: " + assertLines[2]);
else
Console.Print("Assert Failure: " + assert.Message);
}
else
Console.Print("[EXCEP] " + exception.Message);
}
public override void OnDestroy()
{
base.OnDestroy();
//consoleInputEvent.Triggered -= OnConsoleInputEvent;
consoleInputEvent?.Dispose();
consoleBox?.Dispose();
@@ -325,7 +335,6 @@ namespace Cabrito
public void OnConsoleClose()
{
Console.Print("closed console");
Screen.CursorVisible = false;
Screen.CursorLock = CursorLockMode.Locked;
@@ -383,7 +392,7 @@ namespace Cabrito
}
else if (!Console.IsOpen)
{
int fontHeight = (int) (consoleNotifyBox.Font.GetFont().Height / Platform.DpiScale);
int fontHeight = (int) (consoleNotifyBox.FontHeight / Platform.DpiScale);
if (location.Y < (-conHeight * ConsoleHeight) + fontHeight)
{
consoleNotifyBox.Visible = true;
@@ -395,7 +404,7 @@ namespace Cabrito
public void OnPrint(string text)
{
int fontHeight = (int) (consoleNotifyBox.Font.GetFont().Height / Platform.DpiScale);
int fontHeight = (int) (consoleNotifyBox.FontHeight / Platform.DpiScale);
consoleNotifyBox.Height = Math.Min(ConsoleNotifyLines, Console.Lines.Count) * fontHeight;
}