Skip to content

Instantly share code, notes, and snippets.

@fingerboxes
fingerboxes / EditorModule.cs
Created October 7, 2016 23:29
fuck ui code
public void OnLaunchClick()
{
PopupDialog.SpawnPopupDialog(new Vector2(0.5f, 0.5f),
new Vector2(0.5f, 0.5f),
new MultiOptionDialog("",
"Vessel Build Summary",
HighLogic.UISkin,
new Rect(0.5f, 0.5f, 300f, 300f),
new DialogGUIFlexibleSpace(),
new DialogGUIHorizontalLayout(
@fingerboxes
fingerboxes / SpawnVessel.cs
Created September 29, 2016 20:04
Trying to spawn a vessel directly without pitching to flight
namespace SomeAssemblyRequired
{
[KSPAddon(KSPAddon.Startup.EditorAny, true)]
public class EditorModule : MonoBehaviour
{
void Start()
{
EditorLogic.fetch.launchBtn.onClick.RemoveAllListeners();
EditorLogic.fetch.launchBtn.onClick.AddListener(delegate { OnLaunchClick(); });
}
@fingerboxes
fingerboxes / IPAddressText.java
Last active April 8, 2024 12:56
Android widget for inputting numeric IP addresses
/**
* EditText that only allows input of IP Addresses, using the Phone
* input type, and automatically inserts periods at the earliest appropriate
* interval.
*/
// Note; this probably isn't the best pattern for this - a Factory of Decorator
// pattern would have made more sense, rather than inheritance. However, this
// pattern is consistent with how other android Widgets are invoked, so I went
// with this to prevent confusion
@fingerboxes
fingerboxes / IPAddressPreference.java
Last active July 23, 2021 20:55
Android Preference widget based on EditTextPreference for inputting numeric IP Addresses.
/**
* EditTextPreference that only allows input of IP Addresses, using the Phone
* input type, and automatically inserts periods at the earliest appropriate
* interval.
*/
// Note; this probably isn't the best pattern for this - a Factory of Decorator
// pattern would have made more sense, rather than inheritance. However, this
// pattern is consistent with how other android Widgets are invoked, so I went
// with this to prevent confusion