Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 97421db

Browse files
Fix compiler errors for non-editor builds (thanks, @hanbim520!)
Upgrade to 2017年4月1日f1
1 parent 4af0351 commit 97421db

File tree

6 files changed

+105
-34
lines changed

6 files changed

+105
-34
lines changed

‎Unity/Assets/NativeScript/Bindings.cs

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -491,11 +491,11 @@ static T GetDelegate<T>(
491491
typeof(T)) as T;
492492
}
493493
#else
494-
[DllImport(PluginName)]
494+
[DllImport(NativeScriptConstants.PluginName)]
495495
static extern void Init(
496496
IntPtr memory,
497497
int memorySize,
498-
initMode initMode,
498+
InitMode initMode,
499499
IntPtr releaseObject,
500500
IntPtr stringNew,
501501
IntPtr setException,
@@ -555,21 +555,21 @@ static extern void Init(
555555
IntPtr unboxDouble
556556
/*END INIT PARAMS*/);
557557

558-
[DllImport(PluginName)]
558+
[DllImport(NativeScriptConstants.PluginName)]
559559
static extern void SetCsharpException(int handle);
560560

561561
/*BEGIN IMPORTS*/
562-
[DllImport(Constants.PluginName)]
563-
public static extern void NewBaseBallScript(int thisHandle,intparam0);
562+
[DllImport(NativeScriptConstants.PluginName)]
563+
public static extern int NewBaseBallScript(int thisHandle);
564564

565-
[DllImport(Constants.PluginName)]
566-
public static extern void DestroyBaseBallScript(int thisHandle,intparam0);
565+
[DllImport(NativeScriptConstants.PluginName)]
566+
public static extern void DestroyBaseBallScript(int thisHandle);
567567

568-
[DllImport(Constants.PluginName)]
568+
[DllImport(NativeScriptConstants.PluginName)]
569569
public static extern void MyGameAbstractBaseBallScriptUpdate(int thisHandle);
570570

571-
[DllImport(Constants.PluginName)]
572-
public static extern void SetCsharpExceptionSystemNullReferenceException(int thisHandle,intparam0);
571+
[DllImport(NativeScriptConstants.PluginName)]
572+
public static extern void SetCsharpExceptionSystemNullReferenceException(int thisHandle);
573573
/*END IMPORTS*/
574574
#endif
575575

@@ -631,13 +631,15 @@ IntPtr unboxDouble
631631
delegate int BoxDoubleDelegate(double val);
632632
delegate double UnboxDoubleDelegate(int valHandle);
633633
/*END DELEGATE TYPES*/
634-
635-
private static readonly string pluginPath = Application.dataPath + PLUGIN_PATH;
634+
636635
#if UNITY_EDITOR_WIN
637636
private static readonly string pluginTempPath = Application.dataPath + PLUGIN_TEMP_PATH;
638637
#endif
639638
public static Exception UnhandledCppException;
639+
#if UNITY_EDITOR
640+
private static readonly string pluginPath = Application.dataPath + PLUGIN_PATH;
640641
public static SetCsharpExceptionDelegate SetCsharpException;
642+
#endif
641643
static IntPtr memory;
642644
static int memorySize;
643645
static DestroyEntry[] destroyQueue;

‎Unity/Assets/NativeScript/Editor/GenerateBindings.cs

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7550,7 +7550,8 @@ static void AppendBaseType(
75507550
GetTypeName(string.Empty, string.Empty),
75517551
null,
75527552
cppDefaultConstructorBindingFunctionName,
7553-
cppDefaultConstructorBindingFunctionParams,
7553+
ConvertParameters(Type.EmptyTypes),
7554+
typeof(int),
75547555
builders.CsharpImports);
75557556
AppendCsharpGetDelegateCall(
75567557
GetTypeName(string.Empty, string.Empty),
@@ -7607,11 +7608,14 @@ static void AppendBaseType(
76077608
typeof(void),
76087609
TypeKind.None,
76097610
builders.CsharpDelegates);
7611+
ParameterInfo[] cppDestroyImportFunctionParams = ConvertParameters(
7612+
new Type[0]);
76107613
AppendCsharpImport(
76117614
GetTypeName(string.Empty, string.Empty),
76127615
null,
76137616
cppDestroyBindingFunctionName,
7614-
cppDestroyBindingFunctionParams,
7617+
cppDestroyImportFunctionParams,
7618+
typeof(void),
76157619
builders.CsharpImports);
76167620
AppendCsharpGetDelegateCall(
76177621
GetTypeName(string.Empty, string.Empty),
@@ -8685,6 +8689,7 @@ static ParameterInfo[] AppendBaseTypeCppNativeInvokeCall(
86858689
typeParams,
86868690
funcName,
86878691
invokeParams,
8692+
typeof(void),
86888693
builders.CsharpImports);
86898694

86908695
return invokeParams;
@@ -10639,11 +10644,14 @@ static void AppendCsharpImport(
1063910644
Type[] typeParams,
1064010645
string funcName,
1064110646
ParameterInfo[] parameters,
10647+
Type returnType,
1064210648
StringBuilder output
1064310649
)
1064410650
{
10645-
output.Append("\t\t[DllImport(Constants.PluginName)]\n");
10646-
output.Append("\t\tpublic static extern void ");
10651+
output.Append("\t\t[DllImport(NativeScriptConstants.PluginName)]\n");
10652+
output.Append("\t\tpublic static extern ");
10653+
AppendCsharpTypeFullName(returnType, output);
10654+
output.Append(' ');
1064710655
AppendCsharpDelegateName(
1064810656
typeTypeName,
1064910657
typeParams,
@@ -10857,7 +10865,8 @@ static void AppendExceptions(
1085710865
GetTypeName(string.Empty, string.Empty),
1085810866
null,
1085910867
funcName,
10860-
parameters,
10868+
ConvertParameters(Type.EmptyTypes),
10869+
typeof(void),
1086110870
builders.CsharpImports);
1086210871

1086310872
// C# delegate

‎Unity/Assets/NativeScriptConstants.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@
1010
/// </license>
1111
public static class NativeScriptConstants
1212
{
13+
/// <summary>
14+
/// Name of the plugin used by [DllImport] when running outside the editor
15+
/// </summary>
16+
public const string PluginName = "NativeScript";
17+
1318
/// <summary>
1419
/// Path within the Unity project to the exposed types JSON file
1520
/// </summary>

‎Unity/ProjectSettings/GraphicsSettings.asset

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ GraphicsSettings:
3636
- {fileID: 10770, guid: 0000000000000000f000000000000000, type: 0}
3737
- {fileID: 10782, guid: 0000000000000000f000000000000000, type: 0}
3838
- {fileID: 16000, guid: 0000000000000000f000000000000000, type: 0}
39-
- {fileID: 16002, guid: 0000000000000000f000000000000000, type: 0}
39+
- {fileID: 17000, guid: 0000000000000000f000000000000000, type: 0}
40+
- {fileID: 16001, guid: 0000000000000000f000000000000000, type: 0}
4041
m_PreloadedShaders: []
4142
m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000,
4243
type: 0}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /