Skip to content

Commit

Permalink
使能工作在unity 2021.
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoyu.wu committed Nov 25, 2021
1 parent b1b5f69 commit 986223f
Show file tree
Hide file tree
Showing 32 changed files with 73 additions and 27 deletions.
28 changes: 28 additions & 0 deletions ASCR/compiler/builds/ExpressionBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -885,6 +885,34 @@ public void buildAssigning(CompileEnv env, ASTool.AS3.Expr.AS3ExprStep step)

}
}

else if (step.OpCode == "@*")
{
RightValueBase rv = getRightValue(env, step.Arg2, step.token, builder);

if (rv is PackagePathGetter)
{
throw new BuildException(
new BuildError(step.token.line, step.token.ptr, step.token.sourceFile,
"Package cannot be used as a value: '" + ((PackagePathGetter)rv).path + "'."));
}

//尝试读值
StackSlotAccessor eax = env.createASTRegister(step.Arg1.Reg);
eax.valueType = rv.valueType;


OpStep op = new OpStep(OpCode.assigning, new SourceToken(step.token.line, step.token.ptr, step.token.sourceFile));
op.reg = eax;
op.regType = eax.valueType;
op.arg1 = rv;
op.arg1Type = rv.valueType;
op.arg2 = null;
op.arg2Type = RunTimeDataType.unknown;

env.block.opSteps.Add(op);

}
else
{
throw new BuildException(
Expand Down
2 changes: 1 addition & 1 deletion ASCR/obj/Debug/ASCompiler.csproj.FileListAbsolute.txt
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ F:\GitHub\apple-juice-actionscript\ASCR\bin\Debug\ASTool.dll
F:\GitHub\apple-juice-actionscript\ASCR\bin\Debug\ASRuntime.pdb
F:\GitHub\apple-juice-actionscript\ASCR\bin\Debug\ASTool.pdb
F:\GitHub\apple-juice-actionscript\ASCR\bin\Debug\ASTool.xml
F:\GitHub\apple-juice-actionscript\ASCR\obj\Debug\ASCompiler.csprojAssemblyReference.cache
F:\GitHub\apple-juice-actionscript\ASCR\obj\Debug\ASCompiler.Properties.Resources.resources
F:\GitHub\apple-juice-actionscript\ASCR\obj\Debug\ASCompiler.csproj.GenerateResource.cache
F:\GitHub\apple-juice-actionscript\ASCR\obj\Debug\ASCompiler.csproj.CoreCompileInputs.cache
Expand All @@ -96,3 +95,4 @@ F:\GitHub\apple-juice-actionscript\ASCR\obj\Debug\ASCompiler.pdb
E:\ASTool\ASCR\obj\Debug\ASCompiler.csprojAssemblyReference.cache
E:\ASTool\ASCR\obj\Debug\ASCompiler.csproj.CoreCompileInputs.cache
E:\ASTool\ASCR\obj\Debug\ASCompiler.csproj.CopyComplete
F:\GitHub\apple-juice-actionscript\ASCR\obj\Debug\ASCompiler.csproj.AssemblyReference.cache
Binary file modified ASCR/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache
Binary file not shown.
Binary file modified ASCTest/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache
Binary file not shown.
Binary file modified ASRuntime/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache
Binary file not shown.
Binary file modified BuildOutSDK/1.0.0/linkcodegencli_v4/ASCompiler.dll
Binary file not shown.
Binary file modified BuildOutSDK/1.0.0/linkcodegencli_v4/ASRuntime.dll
Binary file not shown.
Binary file modified BuildOutSDK/1.0.0/linkcodegencli_v4/ASTool.dll
Binary file not shown.
Binary file modified BuildOutSDK/1.0.0/linkcodegencli_v4/LinkCodeGen.dll
Binary file not shown.
Binary file modified BuildOutSDK/1.0.0/linkcodegencli_v4/LinkCodeGenCLI.exe
Binary file not shown.
4 changes: 2 additions & 2 deletions LinkCodeGen/MethodNativeCodeCreator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public string GetCode()
bool hasref = false;
foreach (var item in paras)
{
if (item.ParameterType.IsByRef)
if (item.ParameterType.IsByRef && !item.IsIn)
{
paracount += 1;
hasref = true;
Expand Down Expand Up @@ -331,7 +331,7 @@ public string GetCode()

for (int i = 0; i < paras.Length; i++)
{
if (paras[i].ParameterType.IsByRef)
if (paras[i].ParameterType.IsByRef && !paras[i].IsIn)
{
toreplace += storetemplate.Replace("[storeidx]",paras.Length.ToString()).Replace("[argidx]",i.ToString());
}
Expand Down
2 changes: 1 addition & 1 deletion LinkCodeGen/MethodNativeCodeCreatorBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ protected string GetInvokeMethodString(string storeresult, ParameterInfo[] paras
{
storeresult += string.Format( CreatorBase.GetOutKeyWord(paras[i],method) + " arg{0}", i);
}
else if (paras[i].ParameterType.IsByRef)
else if (paras[i].ParameterType.IsByRef && !paras[i].IsIn)
{
storeresult += string.Format("ref arg{0}", i);
}
Expand Down
3 changes: 1 addition & 2 deletions LinkCodeGen/NativeCodeCreatorBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,9 @@ public static ASBinCode.RunTimeDataType GetAS3Runtimetype(Type type)

protected string GetLoadArgementString(Type parameterType,int position)
{
bool isbyRef=false;

if (parameterType.IsByRef)
{
isbyRef = true;
parameterType = parameterType.GetElementType();
}

Expand Down
4 changes: 2 additions & 2 deletions LinkCodeGen/StaticMethodNativeCodeCreator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public string GetCode()
bool hasref = false;
foreach (var item in paras)
{
if (item.ParameterType.IsByRef)
if (item.ParameterType.IsByRef && !item.IsIn)
{
paracount += 1;
hasref = true;
Expand Down Expand Up @@ -219,7 +219,7 @@ public string GetCode()
toreplace = toreplace.Replace("[storeidx]", paras.Length.ToString());
for (int i = 0; i < paras.Length; i++)
{
if (paras[i].ParameterType.IsByRef)
if (paras[i].ParameterType.IsByRef && !paras[i].IsIn)
{
toreplace += storetemplate.Replace("[storeidx]", paras.Length.ToString()).Replace("[argidx]", i.ToString());
}
Expand Down
48 changes: 33 additions & 15 deletions LinkCodeGenCLI/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -209,29 +209,47 @@ static void Main(string[] args)
}
}

foreach (var type in dll.GetExportedTypes())
{
if (definetypes.Count == 0 && definenamespaces.Count == 0
//||
//definetypes.Contains(type.FullName)
)
{
types.Add(type);
}
else
try
{
foreach (var type in dll.GetExportedTypes())
{
if (definetypes.Contains(type.FullName))
if (definetypes.Count == 0 && definenamespaces.Count == 0
//||
//definetypes.Contains(type.FullName)
)
{
types.Add(type);
}
else if (definenamespaces.Contains(type.Namespace))
else
{
types.Add(type);
if (definetypes.Contains(type.FullName))
{
types.Add(type);
}
else if (definenamespaces.Contains(type.Namespace))
{
types.Add(type);
}
}
}
}
}
catch (TypeLoadException)
{
if (types.Count == 0)
{
types.Add(dll.GetType("UnityEngine.GameObject"));
types.Add(dll.GetType("UnityEngine.Time"));
types.Add(dll.GetType("UnityEngine.Random"));
types.Add(dll.GetType("UnityEngine.MeshRenderer"));
types.Add(dll.GetType("UnityEngine.SpriteRenderer"));
}
}

}




}
catch (System.IO.FileLoadException e)
{
Console.WriteLine(e.ToString());
Expand Down
Binary file modified LinkCodeGenCLI_v4/bin/Debug/ASCompiler.dll
Binary file not shown.
Binary file modified LinkCodeGenCLI_v4/bin/Debug/ASRuntime.dll
Binary file not shown.
Binary file modified LinkCodeGenCLI_v4/bin/Debug/ASTool.dll
Binary file not shown.
Binary file modified LinkCodeGenCLI_v4/bin/Debug/LinkCodeGen.dll
Binary file not shown.
Binary file modified LinkCodeGenCLI_v4/bin/Debug/LinkCodeGenCLI.exe
Binary file not shown.
Binary file modified LinkCodeGenCLI_v4/bin/Release/ASCompiler.dll
Binary file not shown.
Binary file modified LinkCodeGenCLI_v4/bin/Release/ASRuntime.dll
Binary file not shown.
Binary file modified LinkCodeGenCLI_v4/bin/Release/ASTool.dll
Binary file not shown.
Binary file modified LinkCodeGenCLI_v4/bin/Release/LinkCodeGen.dll
Binary file not shown.
Binary file modified LinkCodeGenCLI_v4/bin/Release/LinkCodeGenCLI.exe
Binary file not shown.
Binary file modified LinkCodeGenCLI_v4/obj/Debug/LinkCodeGenCLI.exe
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ F:\GitHub\apple-juice-actionscript\LinkCodeGenCLI_v4\bin\Debug\ASRuntime.pdb
F:\GitHub\apple-juice-actionscript\LinkCodeGenCLI_v4\bin\Debug\ASTool.pdb
F:\GitHub\apple-juice-actionscript\LinkCodeGenCLI_v4\bin\Debug\ASTool.xml
F:\GitHub\apple-juice-actionscript\LinkCodeGenCLI_v4\bin\Debug\LinkCodeGen.pdb
F:\GitHub\apple-juice-actionscript\LinkCodeGenCLI_v4\obj\Debug\LinkCodeGenCLI_v4.csprojAssemblyReference.cache
F:\GitHub\apple-juice-actionscript\LinkCodeGenCLI_v4\obj\Debug\LinkCodeGenCLI_v4.csproj.CoreCompileInputs.cache
F:\GitHub\apple-juice-actionscript\LinkCodeGenCLI_v4\obj\Debug\LinkCodeGenCLI_v4.csproj.CopyComplete
F:\GitHub\apple-juice-actionscript\LinkCodeGenCLI_v4\obj\Debug\LinkCodeGenCLI.exe
F:\GitHub\apple-juice-actionscript\LinkCodeGenCLI_v4\obj\Debug\LinkCodeGenCLI.pdb
F:\GitHub\apple-juice-actionscript\LinkCodeGenCLI_v4\obj\Debug\LinkCodeGenCLI_v4.csproj.AssemblyReference.cache
Empty file.
Binary file modified LinkCodeGenCLI_v4/obj/Release/LinkCodeGenCLI.exe
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ F:\GitHub\apple-juice-actionscript\LinkCodeGenCLI_v4\bin\Release\ASRuntime.pdb
F:\GitHub\apple-juice-actionscript\LinkCodeGenCLI_v4\bin\Release\ASTool.pdb
F:\GitHub\apple-juice-actionscript\LinkCodeGenCLI_v4\bin\Release\ASTool.xml
F:\GitHub\apple-juice-actionscript\LinkCodeGenCLI_v4\bin\Release\LinkCodeGen.pdb
F:\GitHub\apple-juice-actionscript\LinkCodeGenCLI_v4\obj\Release\LinkCodeGenCLI_v4.csprojAssemblyReference.cache
F:\GitHub\apple-juice-actionscript\LinkCodeGenCLI_v4\obj\Release\LinkCodeGenCLI_v4.csproj.CoreCompileInputs.cache
F:\GitHub\apple-juice-actionscript\LinkCodeGenCLI_v4\obj\Release\LinkCodeGenCLI_v4.csproj.CopyComplete
F:\GitHub\apple-juice-actionscript\LinkCodeGenCLI_v4\obj\Release\LinkCodeGenCLI.exe
F:\GitHub\apple-juice-actionscript\LinkCodeGenCLI_v4\obj\Release\LinkCodeGenCLI.pdb
F:\GitHub\apple-juice-actionscript\LinkCodeGenCLI_v4\obj\Release\LinkCodeGenCLI_v4.csproj.AssemblyReference.cache
Empty file.
5 changes: 3 additions & 2 deletions publish/UnityScript/ASRuntimePlayer/Editor/ASRuntimeMenus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,10 @@ static void MakeHotFixProject()
string testlocation = typeof(UnityEditorInternal.AssetStore).Assembly.Location;
string dir = System.IO.Path.GetDirectoryName(testlocation).Replace('\\', '/');
string unityInstallEditorDir = string.Empty;
if (dir.EndsWith("Editor/Data/Managed"))
int pathidx = dir.IndexOf("Editor/Data/Managed");
if (pathidx>0)
{
dir = System.IO.Path.GetDirectoryName(System.IO.Path.GetDirectoryName(dir));
dir = System.IO.Path.GetDirectoryName( dir.Substring(0,pathidx + 11) );

if (System.IO.File.Exists(dir + "/Unity.exe"))
{
Expand Down

0 comments on commit 986223f

Please sign in to comment.