Skip to content

Commit 5945c7f

Browse files
author
Unity Technologies
committed
Unity 2017.4.2f2 C# reference source code
1 parent ba3d17e commit 5945c7f

File tree

19 files changed

+121
-16
lines changed

19 files changed

+121
-16
lines changed
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

Modules/Physics2D/ScriptBindings/Physics2D.bindings.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -544,16 +544,27 @@ public bool IsFilteringNormalAngle(float angle)
544544
return result;
545545
}
546546

547+
[NativeName("m_UseTriggers")]
547548
public bool useTriggers;
549+
[NativeName("m_UseLayerMask")]
548550
public bool useLayerMask;
551+
[NativeName("m_UseDepth")]
549552
public bool useDepth;
553+
[NativeName("m_UseOutsideDepth")]
550554
public bool useOutsideDepth;
555+
[NativeName("m_UseNormalAngle")]
551556
public bool useNormalAngle;
557+
[NativeName("m_UseOutsideNormalAngle")]
552558
public bool useOutsideNormalAngle;
559+
[NativeName("m_LayerMask")]
553560
public LayerMask layerMask;
561+
[NativeName("m_MinDepth")]
554562
public float minDepth;
563+
[NativeName("m_MaxDepth")]
555564
public float maxDepth;
565+
[NativeName("m_MinNormalAngle")]
556566
public float minNormalAngle;
567+
[NativeName("m_MaxNormalAngle")]
557568
public float maxNormalAngle;
558569

559570
public const float NormalAngleUpperLimit = 359.9999f;

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## Unity 2017.4.1f1 C# reference source code
1+
## Unity 2017.4.2f2 C# reference source code
22

33
The C# part of the Unity engine and editor source code.
44
May be used for reference purposes only.

Runtime/Export/GraphicsComponents.bindings.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,9 @@ public struct LightBakingOutput
5555
{
5656
public int probeOcclusionLightIndex;
5757
public int occlusionMaskChannel;
58+
[NativeName("lightmapBakeMode.lightmapBakeType")]
5859
public LightmapBakeType lightmapBakeType;
60+
[NativeName("lightmapBakeMode.mixedLightingMode")]
5961
public MixedLightingMode mixedLightingMode;
6062
public bool isBaked;
6163
}

Runtime/Export/MouseEvents.cs

Lines changed: 42 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -98,19 +98,55 @@ static void DoSendMouseEvents(int skipRTCameras)
9898
if (camera == null || skipRTCameras != 0 && camera.targetTexture != null)
9999
continue;
100100

101-
// Is the mouse inside the cameras viewport?
102-
var rect = camera.pixelRect;
103-
if (!rect.Contains(mousePosition))
104-
continue;
101+
int displayIndex = camera.targetDisplay;
102+
103+
var eventPosition = Display.RelativeMouseAt(mousePosition);
104+
if (eventPosition != Vector3.zero)
105+
{
106+
// We support multiple display and display identification based on event position.
107+
int eventDisplayIndex = (int)eventPosition.z;
108+
109+
// Discard events that are not part of this display so the user does not interact with multiple displays at once.
110+
if (eventDisplayIndex != displayIndex)
111+
continue;
112+
113+
// Multiple display support only when not the main display. For display 0 the reported
114+
// resolution is always the desktop resolution since it's part of the display API,
115+
// so we use the standard non multiple display method.
116+
float w = Screen.width;
117+
float h = Screen.height;
118+
if (displayIndex > 0 && displayIndex < Display.displays.Length)
119+
{
120+
w = Display.displays[displayIndex].systemWidth;
121+
h = Display.displays[displayIndex].systemHeight;
122+
}
123+
124+
Vector2 pos = new Vector2(eventPosition.x / w, eventPosition.y / h);
125+
126+
// If it's outside the camera's viewport, do nothing
127+
if (pos.x < 0f || pos.x > 1f || pos.y < 0f || pos.y > 1f)
128+
continue;
129+
}
130+
else
131+
{
132+
// The multiple display system is not supported on all platforms, when it is not supported the returned position
133+
// will be all zeros so when the returned index is 0 we will default to the mouse position to be safe.
134+
eventPosition = mousePosition;
135+
136+
// Is the mouse inside the cameras viewport?
137+
var rect = camera.pixelRect;
138+
if (!rect.Contains(eventPosition))
139+
continue;
140+
}
105141

106-
HitTestLegacyGUI(camera, mousePosition, ref m_CurrentHit[m_HitIndexGUI]);
142+
HitTestLegacyGUI(camera, eventPosition, ref m_CurrentHit[m_HitIndexGUI]);
107143

108144
// There is no need to continue if the camera shouldn't be sending out events
109145
if (camera.eventMask == 0)
110146
continue;
111147

112148
// Calculate common physics projection and distance.
113-
var screenProjectionRay = camera.ScreenPointToRay(mousePosition);
149+
var screenProjectionRay = camera.ScreenPointToRay(eventPosition);
114150
var projectionDirection = screenProjectionRay.direction.z;
115151
var distanceToClipPlane = Mathf.Approximately(0.0f, projectionDirection) ? Mathf.Infinity : Mathf.Abs((camera.farClipPlane - camera.nearClipPlane) / projectionDirection);
116152

Runtime/UnityConnect/Managed/AnalyticsSessionInfo.bindings.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ public enum AnalyticsSessionState
2121
}
2222

2323
[RequiredByNativeCode]
24+
[NativeHeader("UnityConnectScriptingClasses.h")]
2425
[NativeHeader("Runtime/UnityConnect/UnityConnectClient.h")]
2526
public static class AnalyticsSessionInfo
2627
{

artifacts/generated/common/editor/PlayerSettingsAndroidBindings.gen.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ public enum AndroidSdkVersions
5656
AndroidApiLevel24 = 24,
5757

5858
AndroidApiLevel25 = 25,
59+
60+
AndroidApiLevel26 = 26,
61+
62+
AndroidApiLevel27 = 27,
5963
}
6064

6165
public enum AndroidPreferredInstallLocation

artifacts/generated/common/modules/Animation/AnimatorBindings.gen.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,6 @@ public partial struct AnimatorTransitionInfo
212212
internal bool exit { get { return (m_TransitionType & (int)TransitionType.Exit) != 0; }}
213213

214214

215-
216215
private int m_FullPath;
217216
private int m_UserName;
218217
private int m_Name;
@@ -763,9 +762,17 @@ public extern int layerCount
763762
[System.Runtime.CompilerServices.MethodImplAttribute((System.Runtime.CompilerServices.MethodImplOptions)0x1000)]
764763
extern public AnimatorStateInfo GetNextAnimatorStateInfo (int layerIndex) ;
765764

765+
public AnimatorTransitionInfo GetAnimatorTransitionInfo(int layerIndex)
766+
{
767+
AnimatorTransitionInfo info;
768+
GetAnimatorTransitionInfo(layerIndex, out info);
769+
return info;
770+
}
771+
772+
766773
[UnityEngine.Scripting.GeneratedByOldBindingsGeneratorAttribute] // Temporarily necessary for bindings migration
767774
[System.Runtime.CompilerServices.MethodImplAttribute((System.Runtime.CompilerServices.MethodImplOptions)0x1000)]
768-
extern public AnimatorTransitionInfo GetAnimatorTransitionInfo (int layerIndex) ;
775+
extern private void GetAnimatorTransitionInfo (int layerIndex, out AnimatorTransitionInfo info) ;
769776

770777
[UnityEngine.Scripting.GeneratedByOldBindingsGeneratorAttribute] // Temporarily necessary for bindings migration
771778
[System.Runtime.CompilerServices.MethodImplAttribute((System.Runtime.CompilerServices.MethodImplOptions)0x1000)]

artifacts/generated/common/modules/UNET/UNETworkingBindings.gen.cs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
using UnityEngineInternal;
1616
using UnityEngine.Networking.Types;
1717
using System.Collections.Generic;
18+
using System.Net.Sockets;
1819

1920
namespace UnityEngine.Networking
2021
{
@@ -654,6 +655,34 @@ private static void CheckTopology(HostTopology topology)
654655
[System.Runtime.CompilerServices.MethodImplAttribute((System.Runtime.CompilerServices.MethodImplOptions)0x1000)]
655656
extern private static int AddWsHostWrapperWithoutIp (HostTopologyInternal topologyInt, int port) ;
656657

658+
659+
private static bool IsPortOpen(string ip, int port)
660+
{
661+
TimeSpan timeout = TimeSpan.FromMilliseconds(500);
662+
string testedEndpoint = (ip == null) ? "127.0.0.1" : ip;
663+
try
664+
{
665+
using (var client = new TcpClient())
666+
{
667+
var result = client.BeginConnect(testedEndpoint, port, null, null);
668+
var success = result.AsyncWaitHandle.WaitOne(timeout);
669+
670+
if (!success)
671+
{
672+
return false;
673+
}
674+
client.EndConnect(result);
675+
}
676+
}
677+
catch
678+
{
679+
return false;
680+
}
681+
return true;
682+
}
683+
684+
685+
657686
[uei.ExcludeFromDocs]
658687
public static int AddWebsocketHost (HostTopology topology, int port) {
659688
string ip = null;
@@ -662,6 +691,11 @@ public static int AddWebsocketHost (HostTopology topology, int port) {
662691

663692
public static int AddWebsocketHost(HostTopology topology, int port, [uei.DefaultValue("null")] string ip )
664693
{
694+
if (port != 0)
695+
{
696+
if (IsPortOpen(ip, port))
697+
throw new InvalidOperationException("Cannot open web socket on port " + port + " It has been already occupied.");
698+
}
665699
if (topology == null)
666700
throw new NullReferenceException("topology is not defined");
667701
CheckTopology(topology);

artifacts/generated/common/runtime/SpritesBindings.gen.cs

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -70,43 +70,53 @@ public enum SpriteMaskInteraction
7070

7171
public sealed partial class Sprite : Object
7272
{
73-
public static Sprite Create (Texture2D texture, Rect rect, Vector2 pivot, [uei.DefaultValue("100.0f")] float pixelsPerUnit , [uei.DefaultValue("0")] uint extrude , [uei.DefaultValue("SpriteMeshType.Tight")] SpriteMeshType meshType , [uei.DefaultValue("Vector4.zero")] Vector4 border ) {
74-
return INTERNAL_CALL_Create ( texture, ref rect, ref pivot, pixelsPerUnit, extrude, meshType, ref border );
73+
public static Sprite Create (Texture2D texture, Rect rect, Vector2 pivot, [uei.DefaultValue("100.0f")] float pixelsPerUnit , [uei.DefaultValue("0")] uint extrude , [uei.DefaultValue("SpriteMeshType.Tight")] SpriteMeshType meshType , [uei.DefaultValue("Vector4.zero")] Vector4 border , [uei.DefaultValue("false")] bool generateFallbackPhysicsShape ) {
74+
return INTERNAL_CALL_Create ( texture, ref rect, ref pivot, pixelsPerUnit, extrude, meshType, ref border, generateFallbackPhysicsShape );
75+
}
76+
77+
[uei.ExcludeFromDocs]
78+
public static Sprite Create (Texture2D texture, Rect rect, Vector2 pivot, float pixelsPerUnit , uint extrude , SpriteMeshType meshType , Vector4 border ) {
79+
bool generateFallbackPhysicsShape = false;
80+
return INTERNAL_CALL_Create ( texture, ref rect, ref pivot, pixelsPerUnit, extrude, meshType, ref border, generateFallbackPhysicsShape );
7581
}
7682

7783
[uei.ExcludeFromDocs]
7884
public static Sprite Create (Texture2D texture, Rect rect, Vector2 pivot, float pixelsPerUnit , uint extrude , SpriteMeshType meshType ) {
85+
bool generateFallbackPhysicsShape = false;
7986
Vector4 border = Vector4.zero;
80-
return INTERNAL_CALL_Create ( texture, ref rect, ref pivot, pixelsPerUnit, extrude, meshType, ref border );
87+
return INTERNAL_CALL_Create ( texture, ref rect, ref pivot, pixelsPerUnit, extrude, meshType, ref border, generateFallbackPhysicsShape );
8188
}
8289

8390
[uei.ExcludeFromDocs]
8491
public static Sprite Create (Texture2D texture, Rect rect, Vector2 pivot, float pixelsPerUnit , uint extrude ) {
92+
bool generateFallbackPhysicsShape = false;
8593
Vector4 border = Vector4.zero;
8694
SpriteMeshType meshType = SpriteMeshType.Tight;
87-
return INTERNAL_CALL_Create ( texture, ref rect, ref pivot, pixelsPerUnit, extrude, meshType, ref border );
95+
return INTERNAL_CALL_Create ( texture, ref rect, ref pivot, pixelsPerUnit, extrude, meshType, ref border, generateFallbackPhysicsShape );
8896
}
8997

9098
[uei.ExcludeFromDocs]
9199
public static Sprite Create (Texture2D texture, Rect rect, Vector2 pivot, float pixelsPerUnit ) {
100+
bool generateFallbackPhysicsShape = false;
92101
Vector4 border = Vector4.zero;
93102
SpriteMeshType meshType = SpriteMeshType.Tight;
94103
uint extrude = 0;
95-
return INTERNAL_CALL_Create ( texture, ref rect, ref pivot, pixelsPerUnit, extrude, meshType, ref border );
104+
return INTERNAL_CALL_Create ( texture, ref rect, ref pivot, pixelsPerUnit, extrude, meshType, ref border, generateFallbackPhysicsShape );
96105
}
97106

98107
[uei.ExcludeFromDocs]
99108
public static Sprite Create (Texture2D texture, Rect rect, Vector2 pivot) {
109+
bool generateFallbackPhysicsShape = false;
100110
Vector4 border = Vector4.zero;
101111
SpriteMeshType meshType = SpriteMeshType.Tight;
102112
uint extrude = 0;
103113
float pixelsPerUnit = 100.0f;
104-
return INTERNAL_CALL_Create ( texture, ref rect, ref pivot, pixelsPerUnit, extrude, meshType, ref border );
114+
return INTERNAL_CALL_Create ( texture, ref rect, ref pivot, pixelsPerUnit, extrude, meshType, ref border, generateFallbackPhysicsShape );
105115
}
106116

107117
[UnityEngine.Scripting.GeneratedByOldBindingsGeneratorAttribute] // Temporarily necessary for bindings migration
108118
[System.Runtime.CompilerServices.MethodImplAttribute((System.Runtime.CompilerServices.MethodImplOptions)0x1000)]
109-
private extern static Sprite INTERNAL_CALL_Create (Texture2D texture, ref Rect rect, ref Vector2 pivot, float pixelsPerUnit, uint extrude, SpriteMeshType meshType, ref Vector4 border);
119+
private extern static Sprite INTERNAL_CALL_Create (Texture2D texture, ref Rect rect, ref Vector2 pivot, float pixelsPerUnit, uint extrude, SpriteMeshType meshType, ref Vector4 border, bool generateFallbackPhysicsShape);
110120
public Bounds bounds
111121
{
112122
get { Bounds tmp; INTERNAL_get_bounds(out tmp); return tmp; }

0 commit comments

Comments
 (0)