Commit 02677de6 authored by Ru Cindrea's avatar Ru Cindrea

Merge branch '177-add-pop-up-to-altunityprefab' into 'master'

Resolve "Add pop-up to AltUnityPrefab"

Closes #177

See merge request !106
parents 5d58b42c 8f6d6587
......@@ -88,7 +88,7 @@ public class TestForScene1TestSample
listOfElements=element.name+"; ";
}
Debug.Log(listOfElements);
Assert.AreEqual(18, altElements.Count);
Assert.AreEqual(19, altElements.Count);
Assert.IsNotNull(altElements.Where(p => p.name == "Capsule"));
Assert.IsNotNull(altElements.Where(p => p.name == "Main Camera"));
Assert.IsNotNull(altElements.Where(p => p.name == "Directional Light"));
......@@ -110,7 +110,7 @@ public class TestForScene1TestSample
listOfElements=element.name+"; ";
}
Debug.Log(listOfElements);
Assert.AreEqual(19, altElements.Count);
Assert.AreEqual(25, altElements.Count);
Assert.IsNotNull(altElements.Where(p => p.name == "Capsule"));
Assert.IsNotNull(altElements.Where(p => p.name == "Main Camera"));
Assert.IsNotNull(altElements.Where(p => p.name == "Directional Light"));
......
......@@ -119,6 +119,7 @@ public class AltClientSocketHandler
finally
{
Client.Close();
ToBeKilled = true;
UnityEngine.Debug.Log("AltClientSocketHandler - Client closed");
}
......
......@@ -42,7 +42,6 @@ public class AltSocketServer {
protected readonly int portNumber;
protected readonly System.Net.IPEndPoint localEndPoint;
protected readonly int maxClients;
public int PortNumber {
get {
return portNumber;
......@@ -66,6 +65,10 @@ public class AltSocketServer {
return ClientHandlerThreads.Count;
}
}
public bool IsServerStopped()
{
return ClientHandlerThreads == null || (ClientHandlerThreads.Count!=0 &&((AltSocketClientThreadHolder)ClientHandlerThreads[0]).Handler.ToBeKilled);
}
public AltSocketServer(AltIClientSocketHandlerDelegate clientSocketHandlerDelegate,
int portNumber = 13000,
......
......@@ -4,6 +4,10 @@ using System.Linq;
public class AltUnityRunner : UnityEngine.MonoBehaviour, AltIClientSocketHandlerDelegate
{
public UnityEngine.GameObject AltUnityPopUp;
public UnityEngine.UI.Image AltUnityIcon;
public UnityEngine.UI.Text AltUnityPopUpText;
public bool AltUnityIconPressed=false;
private static AltUnityRunner _altUnityRunner;
private UnityEngine.Vector3 _position;
......@@ -40,6 +44,8 @@ public class AltUnityRunner : UnityEngine.MonoBehaviour, AltIClientSocketHandler
public string requestSeparatorString=";";
public string requestEndingString="&";
private static AltResponseQueue _responseQueue;
void Awake()
......@@ -150,7 +156,7 @@ public class AltUnityRunner : UnityEngine.MonoBehaviour, AltIClientSocketHandler
clientSocketHandlerDelegate, SocketPortNumber, maxClients, requestEndingString, encoding);
_socketServer.StartListeningForConnections();
AltUnityPopUpText.text = "Waiting for connection"+System.Environment.NewLine+"on port " + _socketServer.PortNumber + "...";
UnityEngine.Debug.Log(string.Format(
"AltUnity Server at {0} on port {1}",
_socketServer.LocalEndPoint.Address, _socketServer.PortNumber));
......@@ -1648,9 +1654,41 @@ public class AltUnityRunner : UnityEngine.MonoBehaviour, AltIClientSocketHandler
handler.SendResponse(errorCouldNotPerformOperationMessage);
});
}
public void ServerRestartPressed()
{
AltUnityIconPressed = false;
_socketServer.Cleanup();
StartSocketServer();
AltUnityPopUp.SetActive(true);
}
public void IconPressed()
{
AltUnityPopUp.SetActive(!AltUnityPopUp.activeSelf);
AltUnityIconPressed = !AltUnityIconPressed;
}
void Update()
{
if (!AltUnityIconPressed)
{
if (_socketServer.ClientCount != 0)
{
AltUnityPopUp.SetActive(false);
}
else
{
AltUnityPopUp.SetActive(true);
}
}
if (!_socketServer.IsServerStopped())
{
AltUnityIcon.color = UnityEngine.Color.white;
}
else
{
AltUnityIcon.color = UnityEngine.Color.red;
AltUnityPopUpText.text = "Server stopped working."+System.Environment.NewLine+" Please restart the server";
}
_responseQueue.Cycle();
}
......
fileFormatVersion: 2
guid: 0f1a80f61f5b88b4e936cd2851440318
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}
serializedVersion: 5
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -1
wrapU: 1
wrapV: 1
wrapW: -1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- serializedVersion: 2
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- serializedVersion: 2
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment