@ -0,0 +1,3 @@ | |||||
version https://git-lfs.github.com/spec/v1 | |||||
oid sha256:2f155976e5e630ea823177f26a8061c85933c25ecdbba65eadca7013bf9dda20 | |||||
size 443 |
@ -1,5 +1,5 @@ | |||||
fileFormatVersion: 2 | fileFormatVersion: 2 | ||||
guid: a994940378bdf5d439f7e86d8fa19d63 | |||||
guid: ded0b21c3ef1e7049a1128c12e9401fe | |||||
NativeFormatImporter: | NativeFormatImporter: | ||||
externalObjects: {} | externalObjects: {} | ||||
mainObjectFileID: 11400000 | mainObjectFileID: 11400000 |
@ -1,3 +0,0 @@ | |||||
version https://git-lfs.github.com/spec/v1 | |||||
oid sha256:0a9810d89ee914d74c6ef7b34d27893d6d5d4389c9f18abbabf5201e41d585de | |||||
size 440 |
@ -1,3 +1,3 @@ | |||||
version https://git-lfs.github.com/spec/v1 | version https://git-lfs.github.com/spec/v1 | ||||
oid sha256:1d8f9477fd04a5984630bcb6b57ce3b9ecc55b844123eac3ce7ed198b0b3d3a5 | |||||
oid sha256:b79400c63f907550e1cd21c157f2745ed5a483daf6f454465e332def68b794de | |||||
size 489 | size 489 |
@ -1,5 +1,5 @@ | |||||
fileFormatVersion: 2 | fileFormatVersion: 2 | ||||
guid: 296bd90e667df1f4697823a0aa45acf0 | |||||
guid: 0f5a591f7694943469cd20e2a36690c6 | |||||
folderAsset: yes | folderAsset: yes | ||||
DefaultImporter: | DefaultImporter: | ||||
externalObjects: {} | externalObjects: {} |
@ -0,0 +1,7 @@ | |||||
fileFormatVersion: 2 | |||||
guid: c972b9dd7e08c874084a85d4890a369b | |||||
DefaultImporter: | |||||
externalObjects: {} | |||||
userData: | |||||
assetBundleName: | |||||
assetBundleVariant: |
@ -1,5 +1,5 @@ | |||||
fileFormatVersion: 2 | fileFormatVersion: 2 | ||||
guid: 8936b441d7647f74884c94f97bfb8931 | |||||
guid: 283cfa68c973f754b91b4ee906802870 | |||||
folderAsset: yes | folderAsset: yes | ||||
DefaultImporter: | DefaultImporter: | ||||
externalObjects: {} | externalObjects: {} |
@ -0,0 +1,7 @@ | |||||
fileFormatVersion: 2 | |||||
guid: 05efb2e3826a5db47ad6a8626df99e0b | |||||
DefaultImporter: | |||||
externalObjects: {} | |||||
userData: | |||||
assetBundleName: | |||||
assetBundleVariant: |
@ -0,0 +1,8 @@ | |||||
fileFormatVersion: 2 | |||||
guid: 8d7394d70ec233849a60a26da5f23b75 | |||||
folderAsset: yes | |||||
DefaultImporter: | |||||
externalObjects: {} | |||||
userData: | |||||
assetBundleName: | |||||
assetBundleVariant: |
@ -0,0 +1,8 @@ | |||||
fileFormatVersion: 2 | |||||
guid: 67f72e529786a1f4b8930da816837291 | |||||
folderAsset: yes | |||||
DefaultImporter: | |||||
externalObjects: {} | |||||
userData: | |||||
assetBundleName: | |||||
assetBundleVariant: |
@ -0,0 +1,42 @@ | |||||
using System.Collections; | |||||
using System.Collections.Generic; | |||||
using UnityEngine; | |||||
using Networking.Client; | |||||
using TMPro; | |||||
public class LoginUIManager : MonoBehaviour | |||||
{ | |||||
[SerializeField] | |||||
private ClientLoginManager clientManager; | |||||
private string serverAddress; | |||||
private int serverPort; | |||||
private void Start() | |||||
{ | |||||
serverAddress = PlayerPrefs.GetString("LastUsedAddress", ""); | |||||
serverPort = PlayerPrefs.GetInt("LastUsedPort", 2222); | |||||
} | |||||
public void OnChange_ServerAddress(string serverAddress) | |||||
{ | |||||
this.serverAddress = serverAddress; | |||||
} | |||||
public void OnChange_ServerPort(string serverPort) | |||||
{ | |||||
this.serverPort = int.Parse(serverPort); | |||||
} | |||||
public void OnClickConnect() | |||||
{ | |||||
clientManager.StartClient(serverAddress, serverPort); | |||||
PlayerPrefs.SetString("LastUsedAddress", serverAddress); | |||||
PlayerPrefs.SetInt("LastUsedPort", serverPort); | |||||
PlayerPrefs.Save(); | |||||
} | |||||
} |
@ -0,0 +1,11 @@ | |||||
fileFormatVersion: 2 | |||||
guid: 93c34370cc9964a43ac0915dda8d9318 | |||||
MonoImporter: | |||||
externalObjects: {} | |||||
serializedVersion: 2 | |||||
defaultReferences: [] | |||||
executionOrder: 0 | |||||
icon: {instanceID: 0} | |||||
userData: | |||||
assetBundleName: | |||||
assetBundleVariant: |
@ -0,0 +1,8 @@ | |||||
fileFormatVersion: 2 | |||||
guid: d276afa3c7eff6744a05696c72af6e3e | |||||
folderAsset: yes | |||||
DefaultImporter: | |||||
externalObjects: {} | |||||
userData: | |||||
assetBundleName: | |||||
assetBundleVariant: |
@ -0,0 +1,71 @@ | |||||
using System.Collections; | |||||
using System.Collections.Generic; | |||||
using UnityEngine; | |||||
using TMPro; | |||||
using Networking; | |||||
using Networking.Server; | |||||
public class LobbyUIController : MonoBehaviour | |||||
{ | |||||
[SerializeField] | |||||
private ConnectionHandler Clients; | |||||
[SerializeField] | |||||
private string SceneToStart; | |||||
[Header("UI Elements")] | |||||
[SerializeField] | |||||
private TextMeshProUGUI IPText; | |||||
[SerializeField] | |||||
private Transform Content; | |||||
[SerializeField] | |||||
private GameObject ClientTag; | |||||
// Start is called before the first frame update | |||||
void Start() | |||||
{ | |||||
IPText.text = "Lobby - " + Networking.Utility.GetIP(Networking.Utility.ADDRESSFAM.IPv4); | |||||
} | |||||
private void OnEnable() | |||||
{ | |||||
Clients.OnClientsChange += DisplayClients; | |||||
DisplayClients(Clients.ConnectedClients); | |||||
} | |||||
private void OnDisable() | |||||
{ | |||||
Clients.OnClientsChange -= DisplayClients; | |||||
} | |||||
private void DisplayClients(List<ClientData> data) | |||||
{ | |||||
Debug.Log("Updating Connected Clients"); | |||||
foreach (Transform child in Content) | |||||
if (child.gameObject != ClientTag) | |||||
Destroy(child.gameObject); | |||||
foreach (ClientData client in Clients.ConnectedClients) | |||||
{ | |||||
GameObject clientObject = Instantiate(ClientTag, Content); | |||||
TextMeshProUGUI clientText = clientObject.GetComponent<TextMeshProUGUI>(); | |||||
clientText.text = client.Name; | |||||
clientText.color = client.Color; | |||||
clientObject.SetActive(true); | |||||
} | |||||
} | |||||
public void OnClick_StartGame() | |||||
{ | |||||
UnityEngine.SceneManagement.SceneManager.LoadScene(SceneToStart); | |||||
} | |||||
} |
@ -0,0 +1,11 @@ | |||||
fileFormatVersion: 2 | |||||
guid: 3663f6a8c2633124b97ae328b82ad3fd | |||||
MonoImporter: | |||||
externalObjects: {} | |||||
serializedVersion: 2 | |||||
defaultReferences: [] | |||||
executionOrder: 0 | |||||
icon: {instanceID: 0} | |||||
userData: | |||||
assetBundleName: | |||||
assetBundleVariant: |
@ -0,0 +1,48 @@ | |||||
using System.Collections; | |||||
using System.Collections.Generic; | |||||
using UnityEngine; | |||||
using TMPro; | |||||
public class PreFilledText : MonoBehaviour | |||||
{ | |||||
[System.Serializable] | |||||
private enum Action {String, Int, Float}; | |||||
[SerializeField] | |||||
private TMP_InputField text; | |||||
[Header("Player Prefs")] | |||||
[SerializeField] | |||||
private Action Type; | |||||
[SerializeField] | |||||
private string Key; | |||||
[SerializeField] | |||||
private string DefaultValue; | |||||
private void Awake() | |||||
{ | |||||
SetText(); | |||||
} | |||||
private void SetText() | |||||
{ | |||||
switch (Type) | |||||
{ | |||||
case Action.String: | |||||
text.text = PlayerPrefs.GetString(Key, DefaultValue); | |||||
break; | |||||
case Action.Int: | |||||
text.text = PlayerPrefs.GetFloat(Key, int.Parse(DefaultValue)).ToString(); | |||||
break; | |||||
case Action.Float: | |||||
text.text = PlayerPrefs.GetFloat(Key, float.Parse(DefaultValue)).ToString(); | |||||
break; | |||||
} | |||||
} | |||||
} |
@ -0,0 +1,11 @@ | |||||
fileFormatVersion: 2 | |||||
guid: 1e07d2fd06b7e5d4eb614bb7fea7f676 | |||||
MonoImporter: | |||||
externalObjects: {} | |||||
serializedVersion: 2 | |||||
defaultReferences: [] | |||||
executionOrder: 0 | |||||
icon: {instanceID: 0} | |||||
userData: | |||||
assetBundleName: | |||||
assetBundleVariant: |
@ -0,0 +1,40 @@ | |||||
{ | |||||
"dependencies": { | |||||
"com.unity.ads": "2.0.8", | |||||
"com.unity.analytics": "3.2.2", | |||||
"com.unity.collab-proxy": "1.2.15", | |||||
"com.unity.package-manager-ui": "2.0.3", | |||||
"com.unity.purchasing": "2.0.3", | |||||
"com.unity.textmeshpro": "1.3.0", | |||||
"com.unity.modules.ai": "1.0.0", | |||||
"com.unity.modules.animation": "1.0.0", | |||||
"com.unity.modules.assetbundle": "1.0.0", | |||||
"com.unity.modules.audio": "1.0.0", | |||||
"com.unity.modules.cloth": "1.0.0", | |||||
"com.unity.modules.director": "1.0.0", | |||||
"com.unity.modules.imageconversion": "1.0.0", | |||||
"com.unity.modules.imgui": "1.0.0", | |||||
"com.unity.modules.jsonserialize": "1.0.0", | |||||
"com.unity.modules.particlesystem": "1.0.0", | |||||
"com.unity.modules.physics": "1.0.0", | |||||
"com.unity.modules.physics2d": "1.0.0", | |||||
"com.unity.modules.screencapture": "1.0.0", | |||||
"com.unity.modules.terrain": "1.0.0", | |||||
"com.unity.modules.terrainphysics": "1.0.0", | |||||
"com.unity.modules.tilemap": "1.0.0", | |||||
"com.unity.modules.ui": "1.0.0", | |||||
"com.unity.modules.uielements": "1.0.0", | |||||
"com.unity.modules.umbra": "1.0.0", | |||||
"com.unity.modules.unityanalytics": "1.0.0", | |||||
"com.unity.modules.unitywebrequest": "1.0.0", | |||||
"com.unity.modules.unitywebrequestassetbundle": "1.0.0", | |||||
"com.unity.modules.unitywebrequestaudio": "1.0.0", | |||||
"com.unity.modules.unitywebrequesttexture": "1.0.0", | |||||
"com.unity.modules.unitywebrequestwww": "1.0.0", | |||||
"com.unity.modules.vehicles": "1.0.0", | |||||
"com.unity.modules.video": "1.0.0", | |||||
"com.unity.modules.vr": "1.0.0", | |||||
"com.unity.modules.wind": "1.0.0", | |||||
"com.unity.modules.xr": "1.0.0" | |||||
} | |||||
} |