Skip to content

Commit

Permalink
rebuild, because of errors
Browse files Browse the repository at this point in the history
  • Loading branch information
GER-Space committed Aug 23, 2019
1 parent 91c2a6a commit dcd29dc
Show file tree
Hide file tree
Showing 9 changed files with 210 additions and 11 deletions.
Binary file modified GameData/CustomPreLaunchChecks/CustomPreLaunchChecks.dll
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"MAJOR":1,
"MINOR":7,
"PATCH":3,
"BUILD":0
"BUILD":1
},
"KSP_VERSION":
{
Expand Down
Binary file modified GameData/KerbalKonstructs/KerbalKonstructs.dll
Binary file not shown.
2 changes: 1 addition & 1 deletion GameData/KerbalKonstructs/KerbalKonstructs.version
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"MAJOR":1,
"MINOR":7,
"PATCH":3,
"BUILD":0
"BUILD":1
},
"KSP_VERSION":
{
Expand Down
8 changes: 4 additions & 4 deletions src/KerbalKonstructs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -737,10 +737,10 @@ void LateUpdate()
CareerState.FixKSCFacilities();
}

//if (Input.GetKeyDown(KeyCode.L) && (Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl)))
//{
// UI2.EditorModeSelector.Toggle();
//}
if (Input.GetKeyDown(KeyCode.L) && (Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl)))
{
UI2.EditorModeSelector.Toggle();
}


if (HighLogic.LoadedScene == GameScenes.FLIGHT)
Expand Down
1 change: 1 addition & 0 deletions src/KerbalKonstructs.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@
<Compile Include="UI2\Editor2.cs" />
<Compile Include="UI2\Editor\Group\GroupEditorToolbar.cs" />
<Compile Include="UI2\Editor\Instance\InstanceEditorToolbar.cs" />
<Compile Include="UI2\Editor\Instance\ModelList.cs" />
<Compile Include="UI2\Editor\Terrain\TerrainEditorToolbar.cs" />
<Compile Include="UI2\KKStyle.cs" />
<Compile Include="UI2\KKWindow2.cs" />
Expand Down
4 changes: 2 additions & 2 deletions src/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.0.0.0")]
[assembly: AssemblyFileVersion("1.7.3.0")]
[assembly: AssemblyInformationalVersion("1.7.3.0")]
[assembly: AssemblyFileVersion("1.7.3.1")]
[assembly: AssemblyInformationalVersion("1.7.3.1")]
[assembly: KSPAssembly("KerbalKonstructs", 0, 9)]
11 changes: 8 additions & 3 deletions src/UI2/Editor/Instance/InstanceEditorToolbar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class InstanceEditorToolbar
internal static MultiOptionDialog optionDialog;
internal static List<DialogGUIBase> content;

internal static string windowName = "EditorToolbar";
internal static string windowName = "InstanceToolbar";
internal static string windowMessage = null;
internal static string windowTitle = "Instance Toolbar";

Expand All @@ -26,7 +26,7 @@ class InstanceEditorToolbar
internal static float windowHeight = 30f;

internal static bool showTitle = false;
internal static bool showKKTitle = false;
internal static bool showKKTitle = true;
internal static bool isModal = false;


Expand All @@ -40,7 +40,7 @@ internal static void CreateContent()
{
content.Add(new DialogGUIHorizontalLayout(
new DialogGUILabel("Hallo", HighLogic.UISkin.label),
new DialogGUIButton("show models", null, false),
new DialogGUIButton("show models", delegate { ModelList.Open(); }, false),
new DialogGUIButton("show nearby instances", null, false),
new DialogGUIFlexibleSpace()

Expand Down Expand Up @@ -153,6 +153,11 @@ internal static bool isOpen
}
}

internal static bool IsOpen()
{
return (dialog != null);
}

internal static void Toggle()
{
if (isOpen)
Expand Down
193 changes: 193 additions & 0 deletions src/UI2/Editor/Instance/ModelList.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,193 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;
using UnityEngine.UI;
using KerbalKonstructs.Core;


namespace KerbalKonstructs.UI2
{
class ModelList
{
internal static PopupDialog dialog;
internal static MultiOptionDialog optionDialog;
internal static List<DialogGUIBase> content;

internal static string windowName = "ModelList";
internal static string windowMessage = null;
internal static string windowTitle = "Model List";

internal static Rect windowRect;

//internal static float windowWidth = Screen.width * 0.9f;
internal static float windowWidth = 300f;
internal static float windowHeight = 600f;

internal static bool showTitle = false;
internal static bool showKKTitle = true;
internal static bool isModal = false;


internal static bool placeToParent = false;
internal static bool checkForParent = true;

internal static Func<bool> parentWindow = InstanceEditorToolbar.IsOpen;


internal static void CreateContent()
{
content.Add(new DialogGUIHorizontalLayout(
new DialogGUILabel("All Models", HighLogic.UISkin.label),
new DialogGUIFlexibleSpace()
));
content.Add(VaiantList);
}



internal static DialogGUIScrollList VaiantList
{
get
{
List<DialogGUIBase> list = new List<DialogGUIBase>();
list.Add(new DialogGUIContentSizer(ContentSizeFitter.FitMode.Unconstrained, ContentSizeFitter.FitMode.PreferredSize, true));
list.Add(new DialogGUIFlexibleSpace());
//list.Add(new DialogGUIButton("Default", delegate { SetVariant(null);}, 140.0f, 30.0f, true));

foreach (var model in StaticDatabase.allStaticModels)
{
list.Add(new DialogGUIButton(model.name, delegate { SpawnModel(model); }, 140.0f, 25.0f, false));
}
list.Add(new DialogGUIFlexibleSpace());
var layout = new DialogGUIVerticalLayout(10, 100, 4, new RectOffset(6, 24, 10, 10), TextAnchor.MiddleCenter, list.ToArray());
var scroll = new DialogGUIScrollList(new Vector2(200, 300), new Vector2(200, 23f * list.Count), false, true, layout);
return scroll;
}
}


internal static void KKTitle()
{
if (!showKKTitle)
{
return;
}
content.Add(new DialogGUIHorizontalLayout(
new DialogGUILabel("-KK-", KKStyle.windowTitle),
new DialogGUIFlexibleSpace(),

new DialogGUILabel(windowTitle, KKStyle.windowTitle),
new DialogGUIFlexibleSpace(),
new DialogGUIButton("X", delegate { Close(); }, 21f, 21.0f, true, KKStyle.DeadButtonRed)

));
}





internal static void CreateMultiOptionDialog()
{
windowRect = new Rect(WindowManager.GetPosition(windowName), new Vector2(windowWidth, windowHeight));
optionDialog = new MultiOptionDialog(windowName, windowMessage, windowTitle, null, windowRect, content.ToArray());

}


internal static void CreatePopUp()
{
dialog = PopupDialog.SpawnPopupDialog(new Vector2(0.5f, 0.5f),
new Vector2(0.5f, 0.5f), optionDialog,
false,
null, isModal);
if (!showTitle)
{
dialog.gameObject.GetChild("Title").SetActive(false);
}
if (checkForParent)
{
dialog.dialogToDisplay.OnUpdate += CheckForParent;
}
if (placeToParent)
{
dialog.dialogToDisplay.OnUpdate += PlaceToParent;
}

}

internal static void PlaceToParent()
{

}


internal static void CheckForParent()
{
if (checkForParent)
{
if (parentWindow != null && !parentWindow.Invoke())
{
Close();
}
}
}




internal static void Open()
{
KKStyle.Init();
//windowRect = new Rect(CreateBesidesMainwindow(), new Vector2(windowWidth, windowHeight));
content = new List<DialogGUIBase>();
KKTitle();
CreateContent();
CreateMultiOptionDialog();
CreatePopUp();

}


internal static void Close()
{
if (dialog != null)
{
WindowManager.SavePosition(dialog);
dialog.Dismiss();
}
dialog = null;
optionDialog = null;
}


internal static bool isOpen
{
get
{
return (dialog != null);
}
}

internal static void Toggle()
{
if (isOpen)
{
Close();
}
else
{
Open();
}
}


internal static void SpawnModel(StaticModel model)
{
Log.Normal("Model selected: " + model.name);
}

}
}

0 comments on commit dcd29dc

Please sign in to comment.