Skip to content

Commit bc7430b

Browse files
Localization of the mod
Added ChangeLog.cfg for Kerbal Changelog support
1 parent 372b8cf commit bc7430b

29 files changed

+1945
-940
lines changed

ChangeLog.cfg

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
KERBALCHANGELOG
2+
{
3+
showChangelog = True /
4+
modName = Editor Extensions Redux
5+
license = GPLv3
6+
author = Linuxgurugamer
7+
8+
VERSION
9+
{
10+
version = 3.4.7
11+
CHANGE
12+
{
13+
change = Localization of the mod
14+
type = update
15+
}
16+
}
17+
}

ChangeLog.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
ChangeLog
22

3+
3.4.7
4+
Localization of the mod
5+
Added ChangeLog.cfg for Kerbal Changelog support
6+
37
3.4.6.1
48
Fixed mistake in version file
59

EditorExtensionsRedux.sln

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ EndProject
88
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{C8B1248D-CC43-43E1-926E-EA62E44A2364}"
99
ProjectSection(SolutionItems) = preProject
1010
buildRelease.bat = buildRelease.bat
11+
ChangeLog.cfg = ChangeLog.cfg
1112
ChangeLog.txt = ChangeLog.txt
1213
deploy.bat = deploy.bat
1314
EditorExtensionsRedux.version = EditorExtensionsRedux.version

EditorExtensionsRedux.version

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
"VERSION": {
66
"MAJOR": 3,
77
"MINOR": 4,
8-
"PATCH": 6,
9-
"BUILD": 1
8+
"PATCH": 7,
9+
"BUILD": 0
1010
},
1111
"KSP_VERSION": {
1212
"MAJOR": 1,

EditorExtensionsRedux/AppLauncherButton.cs

Lines changed: 148 additions & 108 deletions
Original file line numberDiff line numberDiff line change
@@ -1,121 +1,161 @@
1-
using System;
1+
using KSP.UI.Screens;
2+
using System;
23
using UnityEngine;
3-
using KSP.UI.Screens;
44

55
namespace EditorExtensionsRedux
66
{
7-
[KSPAddon (KSPAddon.Startup.EditorAny, false)]
8-
public class AppLauncherButton : MonoBehaviour
9-
{
10-
private ApplicationLauncherButton button = null;
11-
12-
public static AppLauncherButton Instance;
13-
14-
const string texPathDefault = "EditorExtensionsRedux/Textures/AppLauncherIcon";
15-
const string texPathOn = "EditorExtensionsRedux/Textures/AppLauncherIcon-On";
16-
const string texPathOff = "EditorExtensionsRedux/Textures/AppLauncherIcon-Off";
17-
18-
private void Start ()
19-
{
20-
if (button == null) {
21-
OnGuiAppLauncherReady ();
22-
}
23-
}
24-
25-
private void Awake ()
26-
{
27-
if (AppLauncherButton.Instance == null) {
28-
GameEvents.onGUIApplicationLauncherReady.Add (this.OnGuiAppLauncherReady);
29-
Instance = this;
30-
}
31-
}
32-
33-
private void OnDestroy ()
34-
{
35-
GameEvents.onGUIApplicationLauncherReady.Remove (this.OnGuiAppLauncherReady);
36-
if (this.button != null) {
37-
ApplicationLauncher.Instance.RemoveModApplication (this.button);
38-
}
39-
}
40-
41-
private void ButtonState (bool state)
42-
{
43-
Log.Debug ("ApplicationLauncher on" + state.ToString ());
44-
EditorExtensions.Instance.Visible = state;
45-
}
7+
[KSPAddon(KSPAddon.Startup.EditorAny, false)]
8+
public class AppLauncherButton : MonoBehaviour
9+
{
10+
private ApplicationLauncherButton button = null;
11+
12+
public static AppLauncherButton Instance;
13+
14+
const string texPathDefault = "EditorExtensionsRedux/Textures/AppLauncherIcon";
15+
const string texPathOn = "EditorExtensionsRedux/Textures/AppLauncherIcon-On";
16+
const string texPathOff = "EditorExtensionsRedux/Textures/AppLauncherIcon-Off";
17+
18+
private void Start()
19+
{
20+
if (button == null)
21+
{
22+
OnGuiAppLauncherReady();
23+
}
24+
}
25+
26+
private void Awake()
27+
{
28+
if (AppLauncherButton.Instance == null)
29+
{
30+
GameEvents.onGUIApplicationLauncherReady.Add(this.OnGuiAppLauncherReady);
31+
Instance = this;
32+
}
33+
}
34+
35+
private void OnDestroy()
36+
{
37+
GameEvents.onGUIApplicationLauncherReady.Remove(this.OnGuiAppLauncherReady);
38+
if (this.button != null)
39+
{
40+
ApplicationLauncher.Instance.RemoveModApplication(this.button);
41+
}
42+
}
43+
44+
private void ButtonState(bool state)
45+
{
46+
Log.Debug("ApplicationLauncher on" + state.ToString());
47+
EditorExtensions.Instance.Visible = state;
48+
}
4649
/// <summary>
4750
/// Copied from ToolbarController
4851
/// </summary>
4952
///
50-
// // The following function was initially copied from @JPLRepo's AmpYear mod, which is covered by the GPL, as is this mod // // This function will attempt to load either a PNG or a JPG from the specified path. // It first checks to see if the actual file is there, if not, it then looks for either a PNG or a JPG // // easier to specify different cases than to change case to lower. This will fail on MacOS and Linux // if a suffix has mixed case
51-
static string[] imgSuffixes = new string[] { ".png", ".jpg", ".gif", ".PNG", ".JPG", ".GIF" }; public static Boolean LoadImageFromFile(ref Texture2D tex, String fileNamePath) { Boolean blnReturn = false; try { string path = fileNamePath; if (!System.IO.File.Exists(fileNamePath)) { // Look for the file with an appended suffix. for (int i = 0; i < imgSuffixes.Length; i++) if (System.IO.File.Exists(fileNamePath + imgSuffixes[i])) { path = fileNamePath + imgSuffixes[i]; break; } }
53+
//
54+
// The following function was initially copied from @JPLRepo's AmpYear mod, which is covered by the GPL, as is this mod
55+
//
56+
// This function will attempt to load either a PNG or a JPG from the specified path.
57+
// It first checks to see if the actual file is there, if not, it then looks for either a PNG or a JPG
58+
//
59+
// easier to specify different cases than to change case to lower. This will fail on MacOS and Linux
60+
// if a suffix has mixed case
61+
62+
#region NO_LOCALIZATION
63+
64+
static string[] imgSuffixes = new string[] { ".png", ".jpg", ".gif", ".PNG", ".JPG", ".GIF" };
65+
66+
#endregion
67+
public static Boolean LoadImageFromFile(ref Texture2D tex, String fileNamePath) { Boolean blnReturn = false; try { string path = fileNamePath; if (!System.IO.File.Exists(fileNamePath)) {
68+
// Look for the file with an appended suffix.
69+
for (int i = 0; i < imgSuffixes.Length; i++) if (System.IO.File.Exists(fileNamePath + imgSuffixes[i])) { path = fileNamePath + imgSuffixes[i]; break; } }
5270
//File Exists check
5371
if (System.IO.File.Exists(path)) { try { tex.LoadImage(System.IO.File.ReadAllBytes(path)); blnReturn = true; } catch (Exception ex) { Log.Error("Failed to load the texture:" + path); Log.Error(ex.Message); } } else { Log.Error("Cannot find texture to load:" + fileNamePath); } } catch (Exception ex) { Log.Error("Failed to load (are you missing a file):" + fileNamePath); Log.Error(ex.Message); } return blnReturn; }
5472
Texture2D GetTexture(string path, bool b) { Texture2D tex = new Texture2D(16, 16, TextureFormat.ARGB32, false);
5573
if (LoadImageFromFile(ref tex, KSPUtil.ApplicationRootPath + "GameData/" + path)) return tex; return tex; }
56-
/// <summary>
57-
/// End of copy
58-
/// </summary>
59-
60-
private void OnGuiAppLauncherReady ()
61-
{
62-
if (this.button == null) {
63-
try {
64-
this.button = ApplicationLauncher.Instance.AddModApplication (
65-
() => {
66-
EditorExtensions.Instance.Show ();
67-
}, //RUIToggleButton.onTrue
68-
() => {
69-
EditorExtensions.Instance.Hide ();
70-
}, //RUIToggleButton.onFalse
71-
() => {
72-
EditorExtensions.Instance.ShowMenu ();
73-
}, //RUIToggleButton.OnHover
74-
() => {
75-
EditorExtensions.Instance.HideMenu ();
76-
}, //RUIToggleButton.onHoverOut
77-
null, //RUIToggleButton.onEnable
78-
null, //RUIToggleButton.onDisable
79-
ApplicationLauncher.AppScenes.VAB | ApplicationLauncher.AppScenes.SPH, //visibleInScenes
80-
GetTexture (texPathDefault, false) //texture
81-
);
82-
Log.Debug ("Added ApplicationLauncher button");
83-
} catch (Exception ex) {
84-
Log.Error ("Error adding ApplicationLauncher button: " + ex.Message);
85-
}
86-
}
87-
88-
}
89-
90-
private void Update ()
91-
{
92-
if (this.button == null) {
93-
return;
94-
}
95-
96-
// if(this.button.State != RUIToggleButton.ButtonState.TRUE)
97-
// this.button.SetTexture(GameDatabase.Instance.GetTexture (texPathOn, false));
98-
// else
99-
// this.button.SetTexture(GameDatabase.Instance.GetTexture (texPathOff, false));
100-
101-
try {
102-
if (EditorLogic.fetch != null) {
103-
// if (EditorExtensions.Instance.Visible && this.button.State != RUIToggleButton.ButtonState.TRUE) {
104-
if (EditorExtensions.Instance.Visible && !this.button.enabled) {
105-
this.button.SetTrue ();
106-
//this.button.SetTexture(GameDatabase.Instance.GetTexture (texPathOn, false));
107-
// } else if (!EditorExtensions.Instance.Visible && this.button.State != RUIToggleButton.ButtonState.FALSE) {
108-
} else if (!EditorExtensions.Instance.Visible && this.button.enabled) {
109-
this.button.SetFalse ();
110-
//this.button.SetTexture(GameDatabase.Instance.GetTexture (texPathOff, false));
111-
}
112-
// } else if (this.button.State != RUIToggleButton.ButtonState.DISABLED) {
113-
} else if (this.button.enabled) {
114-
this.button.Disable ();
115-
}
116-
} catch (Exception ex) {
117-
Log.Error ("Error updating ApplicationLauncher button: " + ex.Message);
118-
}
119-
}
120-
}
74+
/// <summary>
75+
/// End of copy
76+
/// </summary>
77+
78+
#region NO_LOCALIZATION
79+
80+
private void OnGuiAppLauncherReady()
81+
{
82+
if (this.button == null)
83+
{
84+
try
85+
{
86+
this.button = ApplicationLauncher.Instance.AddModApplication(
87+
() =>
88+
{
89+
EditorExtensions.Instance.Show();
90+
}, //RUIToggleButton.onTrue
91+
() =>
92+
{
93+
EditorExtensions.Instance.Hide();
94+
}, //RUIToggleButton.onFalse
95+
() =>
96+
{
97+
EditorExtensions.Instance.ShowMenu();
98+
}, //RUIToggleButton.OnHover
99+
() =>
100+
{
101+
EditorExtensions.Instance.HideMenu();
102+
}, //RUIToggleButton.onHoverOut
103+
null, //RUIToggleButton.onEnable
104+
null, //RUIToggleButton.onDisable
105+
ApplicationLauncher.AppScenes.VAB | ApplicationLauncher.AppScenes.SPH, //visibleInScenes
106+
GetTexture(texPathDefault, false) //texture
107+
);
108+
Log.Debug("Added ApplicationLauncher button");
109+
}
110+
catch (Exception ex)
111+
{
112+
Log.Error("Error adding ApplicationLauncher button: " + ex.Message);
113+
}
114+
}
115+
116+
}
117+
118+
#endregion
119+
120+
private void Update()
121+
{
122+
if (this.button == null)
123+
{
124+
return;
125+
}
126+
127+
// if(this.button.State != RUIToggleButton.ButtonState.TRUE)
128+
// this.button.SetTexture(GameDatabase.Instance.GetTexture (texPathOn, false));
129+
// else
130+
// this.button.SetTexture(GameDatabase.Instance.GetTexture (texPathOff, false));
131+
132+
try
133+
{
134+
if (EditorLogic.fetch != null)
135+
{
136+
// if (EditorExtensions.Instance.Visible && this.button.State != RUIToggleButton.ButtonState.TRUE) {
137+
if (EditorExtensions.Instance.Visible && !this.button.enabled)
138+
{
139+
this.button.SetTrue();
140+
//this.button.SetTexture(GameDatabase.Instance.GetTexture (texPathOn, false));
141+
// } else if (!EditorExtensions.Instance.Visible && this.button.State != RUIToggleButton.ButtonState.FALSE) {
142+
}
143+
else if (!EditorExtensions.Instance.Visible && this.button.enabled)
144+
{
145+
this.button.SetFalse();
146+
//this.button.SetTexture(GameDatabase.Instance.GetTexture (texPathOff, false));
147+
}
148+
// } else if (this.button.State != RUIToggleButton.ButtonState.DISABLED) {
149+
}
150+
else if (this.button.enabled)
151+
{
152+
this.button.Disable();
153+
}
154+
}
155+
catch (Exception ex)
156+
{
157+
Log.Error("Error updating ApplicationLauncher button: " + ex.Message);
158+
}
159+
}
160+
}
121161
}

EditorExtensionsRedux/AssemblyVersion.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@
1010

1111
using System.Reflection;
1212

13-
[assembly: AssemblyVersion("3.4.4.1")]
14-
[assembly: AssemblyFileVersion("3.4.4.1")]
13+
[assembly: AssemblyVersion("3.4.7.0")]
14+
[assembly: AssemblyFileVersion("3.4.7.0")]

0 commit comments

Comments
 (0)