Skip to content

Commit

Permalink
2.1b13
Browse files Browse the repository at this point in the history
  • Loading branch information
innominata committed Aug 30, 2021
1 parent eea9f15 commit ec39eb3
Show file tree
Hide file tree
Showing 8 changed files with 183 additions and 210 deletions.
2 changes: 2 additions & 0 deletions GalacticScale.sln.DotSettings
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=GSUI/@EntryIndexedValue">GSUI</s:String></wpf:ResourceDictionary>
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public static void ConsoleSplash()
BCE.Console.Write("│\n", ConsoleColor.Red);
BCE.Console.Write("│", ConsoleColor.Red);
BCE.Console.Write(" ╚═╝┴ ┴┴─┘┴ ┴└─┘ ┴ ┴└─┘ ╚═╝└─┘┴ ┴┴─┘└─┘ ", ConsoleColor.DarkGray);
BCE.Console.Write("Version " + Version + " Initializing ", ConsoleColor.White);
BCE.Console.Write("Version " + Version + " Initializing ", ConsoleColor.White);
BCE.Console.Write("│\n", ConsoleColor.Red);
BCE.Console.WriteLine("└─────────────────────────────────────────────────────────────────────────┘",
ConsoleColor.Red);
Expand Down
199 changes: 83 additions & 116 deletions GalacticScale2/Scripts/GalacticScale2.0/Models/GSUI/GSUI-Constructors.cs

Large diffs are not rendered by default.

11 changes: 10 additions & 1 deletion GalacticScale2/Scripts/GalacticScale2.0/Models/GSUI/GSUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,15 @@ public Val DefaultValue
if (comboDefault >= 0) return comboDefault;
GS2.Warn($"No default value found for Combobox {Label}");
return false;
case "Selector":
List<string> list = Data as List<string>;
if (comboDefault >= 0)
{
if (list.Count > comboDefault)
return list[comboDefault];
}
GS2.Warn($"No default value found for Combobox {Label}");
return false;
}

GS2.Error($"Failed to return default value for {Type} {Label}");
Expand Down Expand Up @@ -522,7 +531,7 @@ private GSOptionPostfix CreateDefaultPostfix()
// GS2.Log($"{key} Value:{value} is null?:{value == null}");
if (value == null)
{
GS2.Warn($"Setting value which was null for {key} to {DefaultValue}");
// GS2.Warn($"Setting value which was null for {key} to {DefaultValue}");
value = DefaultValue;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Xml.Schema;
Expand Down Expand Up @@ -103,7 +104,6 @@ public void Import(GSGenPreferences preferences)
// GS2.Log("*");
}

public static GSUI xx;
public void Init()
{
// GS2.Warn("!");
Expand All @@ -114,11 +114,7 @@ public void Init()
RefreshFileNames();

// Options.Add(GSUI.Checkbox("Vanilla Grid (200r)".Translate(), false, "Vanilla Grid", VanillaGridCheckboxCallback, "Use the vanilla grid for 200 size planets".Translate()));
var xOptions = new GSOptions();
xOptions.Add(GSUI.Checkbox("Show Iron Vein Labels".Translate(), true, "veinTip1", UpdateVeinDetail, "When show vein markers is enabled".Translate()));
xOptions.Add(GSUI.Checkbox("Show Copper Vein Labels".Translate(), true, "veinTip2", UpdateVeinDetail, "When show vein markers is enabled".Translate()));

xx = Options.Add(GSUI.Group("TEST", xOptions, "keyey", false, "Testy", true, (o)=>Warn(xx.DefaultValue)));
var VeinOptions = new GSOptions();
VeinOptions.Add(GSUI.Spacer());
VeinOptions.Add(GSUI.Checkbox("Show Iron Vein Labels".Translate(), true, "veinTip1", UpdateVeinDetail, "When show vein markers is enabled".Translate()));
Expand Down Expand Up @@ -181,7 +177,7 @@ public void Init()

public void ResetBinaryStars(Val o)
{
var random = new Random(GSSettings.Seed);
var random = new GS2.Random(GSSettings.Seed);
foreach (var star in GSSettings.Stars)
if (star.BinaryCompanion != null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,11 @@ public GSUIDropdown AddDropdown()
var go = AddItem(templates.dropdown);
go.SetActive(true);
return go.GetComponent<GSUIDropdown>();
} public GSUISelector AddSelector()
{
var go = AddItem(templates.selector);
go.SetActive(true);
return go.GetComponent<GSUISelector>();
}
public GSUIButton AddButton()
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Steamworks;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Experimental.PlayerLoop;
using UnityEngine.UI;

namespace GalacticScale
Expand All @@ -12,20 +8,18 @@ public class GSUISelector : MonoBehaviour
{
public Button lbutton;
public Button rButton;
public GSOptionCallback OnLeftClick;
public GSOptionCallback OnRightClick;
public GSOptionCallback OnChange;
public Text _labelText;
public Text _hintText;
public Text _itemText;
public List<string> Items = new List<string>() {"Test", "Test2", "test3!"};
public List<string> Items = new List<string> { "Test", "Test2", "test3!" };
private int _index = 0;
public GSOptionCallback OnChange;
public GSOptionCallback OnLeftClick;
public GSOptionCallback OnRightClick;

public int index
{
get
{
return _index;
}
get => _index;
set
{
_index = value;
Expand All @@ -35,10 +29,7 @@ public int index

public string value
{
get
{
return Items[_index];
}
get => Items[_index];
set
{
if (!Items.Contains(value)) GS2.Error($"Trying to set an invalid value of {value}");
Expand All @@ -47,23 +38,26 @@ public string value
}
}

public void UpdateItem()
{
if (Items.Count == 0) return;
if (_index < 0 || _index >= Items.Count) index = 0;
_itemText.text = Items[_index];
}
public string Hint
{
get => _hintText.text;
set => _hintText.text = value;
}

public string Label
{
get => _labelText.text;
set => _labelText.text = value;
}

public void UpdateItem()
{
if (Items.Count == 0) return;
if (_index < 0 || _index >= Items.Count) index = 0;
_itemText.text = Items[_index];
OnChange.Invoke(Items[_index]);
}


public void LeftClick()
{
Expand All @@ -72,25 +66,22 @@ public void LeftClick()
if (_index < 0) _index = Items.Count - 1;
UpdateItem();
}

public void RightClick()
{
Debug.Log("LeftClick");
_index--;
if (_index > Items.Count -1) _index = 0;
Debug.Log("RightClick");
_index++;
if (_index > Items.Count - 1) _index = 0;
UpdateItem();
}

public void initialize(GSUI options)
{
// GS2.Log("Initializing");
//_dropdown.AddOptions(options.Data as List<string>);
// Caption = (string)options.Data;
Canvas.ForceUpdateCanvases();
Items = options.Data as List<string>;
// Canvas.ForceUpdateCanvases();
Label = options.Label;
Hint = options.Hint;
OnChange = options.callback;
//options.postfix?.Invoke();

}
}

}
Loading

0 comments on commit ec39eb3

Please sign in to comment.