This repository has been archived by the owner on Aug 18, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit ddcef4f
Showing
16 changed files
with
1,110 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
bin | ||
obj | ||
ksp_lib | ||
GameData | ||
NameTag-*.zip | ||
*.userprefs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
### 1.0.0 | ||
|
||
* Separated out from kOS. |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
.PHONY: all install clean | ||
|
||
all: | ||
xbuild /p:Configuration=Release NameTag.sln | ||
mkdir -p GameData/NameTag | ||
python tools/ksp-avc.py `tools/version.sh` > GameData/NameTag/NameTag.version | ||
cp LICENSE.md CHANGELOG.md src/bin/Release/NameTag.dll src/module-manager.cfg GameData/NameTag/ | ||
zip -r NameTag-`tools/version.sh`.zip GameData | ||
|
||
install: | ||
tools/install.sh | ||
|
||
clean: | ||
rm -rf src/bin src/obj GameData NameTag-*.zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio 2012 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NameTag", "src/NameTag.csproj", "{01C60DD4-0B7A-4A63-8A3B-E4962E8E16A1}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{01C60DD4-0B7A-4A63-8A3B-E4962E8E16A1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{01C60DD4-0B7A-4A63-8A3B-E4962E8E16A1}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{01C60DD4-0B7A-4A63-8A3B-E4962E8E16A1}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{01C60DD4-0B7A-4A63-8A3B-E4962E8E16A1}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
1.0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
using System.Reflection; | ||
|
||
[assembly: AssemblyTitle ("NameTag")] | ||
[assembly: AssemblyVersion ("1.0.0")] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
namespace NameTag | ||
{ | ||
public static class Career | ||
{ | ||
/// <summary> | ||
/// Detect whether we'll allow you to add a NameTag to a part during the editor. | ||
/// You can always add one post-editor during flight, but during editing it will | ||
/// depend on building level. | ||
/// </summary> | ||
/// <param name="whichEditor">Pass in whether you are checking from the VAB or SPH.</param> | ||
/// <param name="reason">returns a string describing what would need upgrading to change the answer.</param> | ||
/// <returns>true if it can. false if it cannot.</returns> | ||
public static bool CanTagInEditor (EditorFacility whichEditor, out string reason) | ||
{ | ||
float buildingLevel; | ||
switch (whichEditor) { | ||
case EditorFacility.VAB: | ||
reason = "vehicle assembly building"; | ||
buildingLevel = ScenarioUpgradeableFacilities.GetFacilityLevel (SpaceCenterFacility.VehicleAssemblyBuilding); | ||
break; | ||
case EditorFacility.SPH: | ||
reason = "space plane hangar"; | ||
buildingLevel = ScenarioUpgradeableFacilities.GetFacilityLevel (SpaceCenterFacility.SpaceplaneHangar); | ||
break; | ||
default: | ||
reason = "unknown editor building"; | ||
return false; // not even sure how you could get here. | ||
} | ||
// We'll attach it to the same point where the game starts unlocking basic action groups: | ||
return GameVariables.Instance.UnlockedActionGroupsStock (buildingLevel, false); | ||
} | ||
|
||
/// <summary> | ||
/// Same as CanTagInEditor, but without the 'reason' parameter. (This is a separate method | ||
/// only because you can't default out parameters like 'out string reason' to make them optional.) | ||
/// </summary> | ||
/// <returns>true if you can. false if you cannot.</returns> | ||
public static bool CanTagInEditor (EditorFacility whichEditor) | ||
{ | ||
string dummy; | ||
return CanTagInEditor (whichEditor, out dummy); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
using UnityEngine; | ||
|
||
namespace NameTag | ||
{ | ||
// Note: name kept as KOSNameTag for backward compatibility | ||
public class KOSNameTag : PartModule | ||
{ | ||
Window typingWindow; | ||
|
||
[KSPField (isPersistant = true, guiActive = true, guiActiveEditor = true, guiName = "Name Tag")] | ||
public string nameTag = ""; | ||
|
||
[KSPEvent (guiActive = true, guiActiveEditor = true, guiName = "Change Name Tag")] | ||
public void PopupNameTagChanger () | ||
{ | ||
if (typingWindow != null) | ||
typingWindow.Close (); | ||
if (HighLogic.LoadedSceneIsEditor) { | ||
EditorFacility whichEditor = EditorLogic.fetch.ship.shipFacility; | ||
if (!(Career.CanTagInEditor (whichEditor))) { | ||
var formattedString = string.Format ("The {0} requires an upgrade to assign name tags", whichEditor); | ||
ScreenMessages.PostScreenMessage (formattedString, 6, ScreenMessageStyle.UPPER_CENTER); | ||
return; | ||
} | ||
} | ||
var gObj = new GameObject ("nametag", typeof(Window)); | ||
DontDestroyOnLoad (gObj); | ||
typingWindow = (Window)gObj.GetComponent (typeof(Window)); | ||
typingWindow.Invoke (this, nameTag); | ||
} | ||
|
||
public void TypingDone (string newValue) | ||
{ | ||
nameTag = newValue; | ||
TypingCancel (); | ||
} | ||
|
||
public void TypingCancel () | ||
{ | ||
typingWindow.Close (); | ||
typingWindow = null; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<PropertyGroup> | ||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
<ProjectGuid>{01C60DD4-0B7A-4A63-8A3B-E4962E8E16A1}</ProjectGuid> | ||
<OutputType>Library</OutputType> | ||
<RootNamespace>NameTag</RootNamespace> | ||
<AssemblyName>NameTag</AssemblyName> | ||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
<DebugSymbols>true</DebugSymbols> | ||
<DebugType>full</DebugType> | ||
<Optimize>false</Optimize> | ||
<OutputPath>bin\Debug</OutputPath> | ||
<DefineConstants>DEBUG;</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
<ConsolePause>false</ConsolePause> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
<DebugType>full</DebugType> | ||
<Optimize>true</Optimize> | ||
<OutputPath>bin\Release</OutputPath> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
<ConsolePause>false</ConsolePause> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Reference Include="System" /> | ||
<Reference Include="Assembly-CSharp"> | ||
<HintPath>..\ksp_lib\KSP_Data\Managed\Assembly-CSharp.dll</HintPath> | ||
</Reference> | ||
<Reference Include="Assembly-CSharp-firstpass"> | ||
<HintPath>..\ksp_lib\KSP_Data\Managed\Assembly-CSharp-firstpass.dll</HintPath> | ||
</Reference> | ||
<Reference Include="UnityEngine"> | ||
<HintPath>..\ksp_lib\KSP_Data\Managed\UnityEngine.dll</HintPath> | ||
</Reference> | ||
<Reference Include="UnityEngine.UI"> | ||
<HintPath>..\ksp_lib\KSP_Data\Managed\UnityEngine.UI.dll</HintPath> | ||
</Reference> | ||
<Reference Include="KSPUtil"> | ||
<HintPath>..\ksp_lib\KSP_Data\Managed\KSPUtil.dll</HintPath> | ||
</Reference> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Compile Include="AssemblyInfo.cs" /> | ||
<Compile Include="NameTag.cs" /> | ||
<Compile Include="Window.cs" /> | ||
<Compile Include="Career.cs" /> | ||
</ItemGroup> | ||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"spec_version" : 1, | ||
"identifier" : "NameTag", | ||
"$kref" : "#/ckan/github/krpc/NameTag", | ||
"name" : "NameTag", | ||
"abstract" : "Tag parts with a string.", | ||
"license" : "GPL-3.0", | ||
"$vref" : "#/ckan/ksp-avc", | ||
} |
Oops, something went wrong.