Skip to content

Commit

Permalink
Merge pull request #9 from DMagic1/dev
Browse files Browse the repository at this point in the history
Version 2.2
  • Loading branch information
DMagic1 committed May 2, 2016
2 parents d41429c + 5e3a6bd commit 130d5a7
Show file tree
Hide file tree
Showing 9 changed files with 147 additions and 102 deletions.
8 changes: 4 additions & 4 deletions GameData/CapCom/CapCom.version
@@ -1,7 +1,7 @@
{
"NAME":"CapCom Mission Control On The Go",
"URL":"https://raw.githubusercontent.com/DMagic1/CapCom/master/GameData/DMagicUtilities/CapCom/CapCom.version",
"DOWNLOAD":"http://spacedock.info/mod/131/CapCom%20-%20Mission%20Control%20On%20The%20Go/download/2.1",
"DOWNLOAD":"http://spacedock.info/mod/131/CapCom%20-%20Mission%20Control%20On%20The%20Go/download/2.2",
"GITHUB":{
"USERNAME":"DMagic1",
"REPOSITORY":"CapCom",
Expand All @@ -11,17 +11,17 @@
"MAJOR":1,
"MINOR":0,
"PATCH":2,
"BUILD":1
"BUILD":2
},
"KSP_VERSION":{
"MAJOR":1,
"MINOR":1,
"PATCH":0
"PATCH":2
},
"KSP_VERSION_MIN":{
"MAJOR":1,
"MINOR":1,
"PATCH":0
"PATCH":2
},
"KSP_VERSION_MAX":{
"MAJOR":1,
Expand Down
8 changes: 4 additions & 4 deletions GameData/DMagicUtilities/CapCom/CapCom.version
@@ -1,7 +1,7 @@
{
"NAME":"CapCom Mission Control On The Go",
"URL":"https://raw.githubusercontent.com/DMagic1/CapCom/master/GameData/DMagicUtilities/CapCom/CapCom.version",
"DOWNLOAD":"http://spacedock.info/mod/131/CapCom%20-%20Mission%20Control%20On%20The%20Go/download/2.1",
"DOWNLOAD":"http://spacedock.info/mod/131/CapCom%20-%20Mission%20Control%20On%20The%20Go/download/2.2",
"GITHUB":{
"USERNAME":"DMagic1",
"REPOSITORY":"CapCom",
Expand All @@ -11,17 +11,17 @@
"MAJOR":1,
"MINOR":0,
"PATCH":2,
"BUILD":1
"BUILD":2
},
"KSP_VERSION":{
"MAJOR":1,
"MINOR":1,
"PATCH":0
"PATCH":2
},
"KSP_VERSION_MIN":{
"MAJOR":1,
"MINOR":1,
"PATCH":0
"PATCH":2
},
"KSP_VERSION_MAX":{
"MAJOR":1,
Expand Down
2 changes: 2 additions & 0 deletions GameData/DMagicUtilities/CapCom/Settings.cfg
Expand Up @@ -12,6 +12,8 @@ CapComSettings
activeLimit = True
forceDecline = False
forceCancel = False
useShortcuts = True
acceptDeclineKeys = True
windowHeight = 600
windowPosX = 50
windowPosY = 50
Expand Down
Binary file not shown.
4 changes: 4 additions & 0 deletions Source/CapComSettings.cs
Expand Up @@ -60,6 +60,10 @@ public class CapComSettings : CC_ConfigNodeStorage
[Persistent]
public bool forceCancel = false;
[Persistent]
public bool useShortcuts = true;
[Persistent]
public bool acceptDeclineKeys = true;
[Persistent]
public float windowHeight = 600;
[Persistent]
public float windowPosX = 50;
Expand Down
186 changes: 101 additions & 85 deletions Source/CapComSettingsWindow.cs
Expand Up @@ -38,7 +38,7 @@ namespace CapCom
class CapComSettingsWindow : CC_MBW
{
private bool controlLock;
private bool hideBriefing, hideNotes, warnDecline, warnCancel, stockToolbar, tooltips, style;
private bool hideBriefing, hideNotes, warnDecline, warnCancel, stockToolbar, tooltips, style, shortcuts, acceptDecline;
private bool oldToolbar, oldTooltips, oldStyle;
private bool dropdown, dup, ddown, dleft, dright, daccept, ddecline, dmulti;
public float scale;
Expand Down Expand Up @@ -77,6 +77,8 @@ protected override void Start()
oldToolbar = stockToolbar = CapCom.Settings.stockToolbar;
oldTooltips = tooltips = CapCom.Settings.tooltipsEnabled;
scale = CapCom.Settings.windowScale;
shortcuts = CapCom.Settings.useShortcuts;
acceptDecline = CapCom.Settings.acceptDeclineKeys;
//oldStyle = style = CapCom.Settings.useKSPStyle;
up = CapCom.Settings.scrollUp;
down = CapCom.Settings.scrollDown;
Expand Down Expand Up @@ -217,110 +219,120 @@ protected override void DrawWindow(int id)
}
GUILayout.EndHorizontal();

GUILayout.BeginHorizontal();
GUILayout.Label("Scroll Up:", GUILayout.Width(100));
GUILayout.Label(up.ToString(), GUILayout.Width(100));
if (!dropdown)
{
if (GUILayout.Button(up.ToString(), CapComSkins.keycodeButton, GUILayout.Width(100)))
{
dropdown = true;
dup = true;
}
}
else
GUILayout.Label(up.ToString(), CapComSkins.keycodeButton, GUILayout.Width(100));
GUILayout.EndHorizontal();
CapCom.Settings.useShortcuts = GUILayout.Toggle(CapCom.Settings.useShortcuts, "Use Keyboard Shortcuts", GUILayout.Width(160));

GUILayout.BeginHorizontal();
GUILayout.Label("Scroll Down:", GUILayout.Width(100));
GUILayout.Label(down.ToString(), GUILayout.Width(100));
if (!dropdown)
if (CapCom.Settings.useShortcuts)
{
if (GUILayout.Button(down.ToString(), CapComSkins.keycodeButton, GUILayout.Width(100)))
CapCom.Settings.acceptDeclineKeys = GUILayout.Toggle(CapCom.Settings.acceptDeclineKeys, "Use Accept/Decline Keys", GUILayout.Width(170));

GUILayout.BeginHorizontal();
GUILayout.Label("Scroll Up:", GUILayout.Width(100));
GUILayout.Label(up.ToString(), GUILayout.Width(100));
if (!dropdown)
{
dropdown = true;
ddown = true;
if (GUILayout.Button(up.ToString(), CapComSkins.keycodeButton, GUILayout.Width(100)))
{
dropdown = true;
dup = true;
}
}
}
else
GUILayout.Label(down.ToString(), CapComSkins.keycodeButton, GUILayout.Width(100));
GUILayout.EndHorizontal();
else
GUILayout.Label(up.ToString(), CapComSkins.keycodeButton, GUILayout.Width(100));
GUILayout.EndHorizontal();

GUILayout.BeginHorizontal();
GUILayout.Label("Scroll Left:", GUILayout.Width(100));
GUILayout.Label(left.ToString(), GUILayout.Width(100));
if (!dropdown)
{
if (GUILayout.Button(left.ToString(), CapComSkins.keycodeButton, GUILayout.Width(100)))
GUILayout.BeginHorizontal();
GUILayout.Label("Scroll Down:", GUILayout.Width(100));
GUILayout.Label(down.ToString(), GUILayout.Width(100));
if (!dropdown)
{
dropdown = true;
dleft = true;
if (GUILayout.Button(down.ToString(), CapComSkins.keycodeButton, GUILayout.Width(100)))
{
dropdown = true;
ddown = true;
}
}
}
else
GUILayout.Label(left.ToString(), CapComSkins.keycodeButton, GUILayout.Width(100));
GUILayout.EndHorizontal();
else
GUILayout.Label(down.ToString(), CapComSkins.keycodeButton, GUILayout.Width(100));
GUILayout.EndHorizontal();

GUILayout.BeginHorizontal();
GUILayout.Label("Scroll Right:", GUILayout.Width(100));
GUILayout.Label(right.ToString(), GUILayout.Width(100));
if (!dropdown)
{
if (GUILayout.Button(right.ToString(), CapComSkins.keycodeButton, GUILayout.Width(100)))
GUILayout.BeginHorizontal();
GUILayout.Label("Scroll Left:", GUILayout.Width(100));
GUILayout.Label(left.ToString(), GUILayout.Width(100));
if (!dropdown)
{
dropdown = true;
dright = true;
if (GUILayout.Button(left.ToString(), CapComSkins.keycodeButton, GUILayout.Width(100)))
{
dropdown = true;
dleft = true;
}
}
}
else
GUILayout.Label(right.ToString(), CapComSkins.keycodeButton, GUILayout.Width(100));
GUILayout.EndHorizontal();
else
GUILayout.Label(left.ToString(), CapComSkins.keycodeButton, GUILayout.Width(100));
GUILayout.EndHorizontal();

GUILayout.BeginHorizontal();
GUILayout.Label("Accept:", GUILayout.Width(100));
GUILayout.Label(accept.ToString(), GUILayout.Width(100));
if (!dropdown)
{
if (GUILayout.Button(accept.ToString(), CapComSkins.keycodeButton, GUILayout.Width(100)))
GUILayout.BeginHorizontal();
GUILayout.Label("Scroll Right:", GUILayout.Width(100));
GUILayout.Label(right.ToString(), GUILayout.Width(100));
if (!dropdown)
{
dropdown = true;
daccept = true;
if (GUILayout.Button(right.ToString(), CapComSkins.keycodeButton, GUILayout.Width(100)))
{
dropdown = true;
dright = true;
}
}
}
else
GUILayout.Label(accept.ToString(), CapComSkins.keycodeButton, GUILayout.Width(100));
GUILayout.EndHorizontal();
else
GUILayout.Label(right.ToString(), CapComSkins.keycodeButton, GUILayout.Width(100));
GUILayout.EndHorizontal();

GUILayout.BeginHorizontal();
GUILayout.Label("Cancel/Decline:", GUILayout.Width(100));
GUILayout.Label(decline.ToString(), GUILayout.Width(100));
if (!dropdown)
{
if (GUILayout.Button(decline.ToString(), CapComSkins.keycodeButton, GUILayout.Width(100)))
if (CapCom.Settings.acceptDeclineKeys)
{
dropdown = true;
ddecline = true;
GUILayout.BeginHorizontal();
GUILayout.Label("Accept:", GUILayout.Width(100));
GUILayout.Label(accept.ToString(), GUILayout.Width(100));
if (!dropdown)
{
if (GUILayout.Button(accept.ToString(), CapComSkins.keycodeButton, GUILayout.Width(100)))
{
dropdown = true;
daccept = true;
}
}
else
GUILayout.Label(accept.ToString(), CapComSkins.keycodeButton, GUILayout.Width(100));
GUILayout.EndHorizontal();

GUILayout.BeginHorizontal();
GUILayout.Label("Cancel/Decline:", GUILayout.Width(100));
GUILayout.Label(decline.ToString(), GUILayout.Width(100));
if (!dropdown)
{
if (GUILayout.Button(decline.ToString(), CapComSkins.keycodeButton, GUILayout.Width(100)))
{
dropdown = true;
ddecline = true;
}
}
else
GUILayout.Label(decline.ToString(), CapComSkins.keycodeButton, GUILayout.Width(100));
GUILayout.EndHorizontal();
}
}
else
GUILayout.Label(decline.ToString(), CapComSkins.keycodeButton, GUILayout.Width(100));
GUILayout.EndHorizontal();

GUILayout.BeginHorizontal();
GUILayout.Label("Multi Select:", GUILayout.Width(100));
GUILayout.Label(multiSelect.ToString(), GUILayout.Width(100));
if (!dropdown)
{
if (GUILayout.Button(multiSelect.ToString(), CapComSkins.keycodeButton, GUILayout.Width(100)))
GUILayout.BeginHorizontal();
GUILayout.Label("Multi Select:", GUILayout.Width(100));
GUILayout.Label(multiSelect.ToString(), GUILayout.Width(100));
if (!dropdown)
{
dropdown = true;
dmulti = true;
if (GUILayout.Button(multiSelect.ToString(), CapComSkins.keycodeButton, GUILayout.Width(100)))
{
dropdown = true;
dmulti = true;
}
}
else
GUILayout.Label(multiSelect.ToString(), CapComSkins.keycodeButton, GUILayout.Width(100));
GUILayout.EndHorizontal();
}
else
GUILayout.Label(multiSelect.ToString(), CapComSkins.keycodeButton, GUILayout.Width(100));
GUILayout.EndHorizontal();

GUILayout.BeginHorizontal();
GUILayout.FlexibleSpace();
Expand All @@ -330,6 +342,8 @@ protected override void DrawWindow(int id)
hideNotes = CapCom.Settings.hideNotes;
warnDecline = CapCom.Settings.showDeclineWarning;
warnCancel = CapCom.Settings.showCancelWarning;
shortcuts = CapCom.Settings.useShortcuts;
acceptDecline = CapCom.Settings.acceptDeclineKeys;
scale = CapCom.Settings.windowScale;
CapCom.Settings.tooltipsEnabled = tooltips;
//CapCom.Settings.useKSPStyle = style;
Expand All @@ -352,6 +366,8 @@ protected override void DrawWindow(int id)
CapCom.Settings.showDeclineWarning = warnDecline;
CapCom.Settings.showCancelWarning = warnCancel;
CapCom.Settings.windowScale = scale;
CapCom.Settings.useShortcuts = shortcuts;
CapCom.Settings.acceptDeclineKeys = acceptDecline;
Scale = CapCom.Settings.windowScale;
CapCom.Instance.Window.Scale = CapCom.Settings.windowScale;
tooltips = CapCom.Settings.tooltipsEnabled;
Expand Down
25 changes: 24 additions & 1 deletion Source/CapComWindow.cs
Expand Up @@ -129,6 +129,12 @@ private int getMaxContracts()

protected override void Update()
{
if (!Visible)
return;

if (!CapCom.Settings.useShortcuts)
return;

Vector2 mousePos = Input.mousePosition;
mousePos.y = Screen.height - mousePos.y;
if (WindowRect.Contains(mousePos))
Expand Down Expand Up @@ -175,6 +181,13 @@ protected override void Update()

selectContract(0);
}

if (!CapCom.Settings.acceptDeclineKeys)
return;

if (dropdown)
return;

if (Input.GetKeyDown(CapCom.Settings.accept))
{
if (currentContract == null)
Expand Down Expand Up @@ -623,7 +636,17 @@ private void contractTabs(int id)
GUILayout.Label("Offered", listStyle(0), GUILayout.Width(98), GUILayout.Height(22));
GUILayout.Label("Active", listStyle(1), GUILayout.Width(98), GUILayout.Height(22));
GUILayout.Label("Completed", listStyle(2), GUILayout.Width(98), GUILayout.Height(22));
GUILayout.Label(CapComSkins.progressIconOn, listStyle(3), GUILayout.Width(32), GUILayout.Height(32));

Rect r = GUILayoutUtility.GetLastRect();

GUILayout.Space(36);

r.x += r.width + 4;
r.y -= 4;
r.width = 32;
r.height = 32;

GUI.Label(r, currentList == 3 ? CapComSkins.progressIconOn : CapComSkins.progressIconOff, listStyle(3));

}
else
Expand Down
4 changes: 2 additions & 2 deletions Source/Framework/CC_MonoBehaviourWindow.cs
Expand Up @@ -87,7 +87,7 @@ protected override void Start()
GameEvents.onShowUI.Add(UIOn);
GameEvents.onHideUI.Add(UIOff);
GameEvents.onGUIMissionControlSpawn.Add(UIOff);
GameEvents.onGUIMissionControlDespawn.Add(UIOff);
GameEvents.onGUIMissionControlDespawn.Add(UIOn);
GameEvents.onGUIRnDComplexSpawn.Add(UIOff);
GameEvents.onGUIRnDComplexDespawn.Add(UIOn);
GameEvents.onGUIAdministrationFacilitySpawn.Add(UIOff);
Expand All @@ -103,7 +103,7 @@ protected override void OnDestroy()
GameEvents.onShowUI.Remove(UIOn);
GameEvents.onHideUI.Remove(UIOff);
GameEvents.onGUIMissionControlSpawn.Remove(UIOff);
GameEvents.onGUIMissionControlDespawn.Remove(UIOff);
GameEvents.onGUIMissionControlDespawn.Remove(UIOn);
GameEvents.onGUIRnDComplexSpawn.Remove(UIOff);
GameEvents.onGUIRnDComplexDespawn.Remove(UIOn);
GameEvents.onGUIAdministrationFacilitySpawn.Remove(UIOff);
Expand Down

0 comments on commit 130d5a7

Please sign in to comment.