Browse Source

Client Scene changes

master
MB 5 years ago
parent
commit
082a349146
2 changed files with 269 additions and 8 deletions
  1. +233
    -4
      Assets/Scenes/ClientScene.unity
  2. +36
    -4
      Assets/Scipts/HomeScreenManager.cs

+ 233
- 4
Assets/Scenes/ClientScene.unity View File

@ -285,6 +285,83 @@ CanvasRenderer:
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 8710119}
m_CullTransparentMesh: 0
--- !u!1 &103385406
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 103385407}
- component: {fileID: 103385409}
- component: {fileID: 103385408}
m_Layer: 5
m_Name: Text
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &103385407
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 103385406}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 1517204062}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &103385408
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 103385406}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 708705254, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 14
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 10
m_MaxSize: 40
m_Alignment: 4
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: 'New Name
'
--- !u!222 &103385409
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 103385406}
m_CullTransparentMesh: 0
--- !u!1 &123269578
GameObject:
m_ObjectHideFlags: 0
@ -435,7 +512,18 @@ MonoBehaviour:
m_TargetGraphic: {fileID: 148659516}
m_OnClick:
m_PersistentCalls:
m_Calls: []
m_Calls:
- m_Target: {fileID: 1574517161}
m_MethodName: Host
m_Mode: 1
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
m_TypeName: UnityEngine.UI.Button+ButtonClickedEvent, UnityEngine.UI, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=null
--- !u!114 &148659516
@ -620,6 +708,7 @@ RectTransform:
m_Children:
- {fileID: 1508595221}
- {fileID: 1250475355}
- {fileID: 1517204062}
m_Father: {fileID: 152908413}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@ -1183,12 +1272,12 @@ MonoBehaviour:
m_OnClick:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 914867460}
m_MethodName:
- m_Target: {fileID: 1574517161}
m_MethodName: Connect
m_Mode: 1
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName:
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
@ -2747,6 +2836,129 @@ CanvasRenderer:
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1508595220}
m_CullTransparentMesh: 0
--- !u!1 &1517204061
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1517204062}
- component: {fileID: 1517204065}
- component: {fileID: 1517204064}
- component: {fileID: 1517204063}
m_Layer: 5
m_Name: NewName
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1517204062
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1517204061}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 103385407}
m_Father: {fileID: 247805081}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 223, y: 0}
m_SizeDelta: {x: 160, y: 30}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1517204063
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1517204061}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 1392445389, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Navigation:
m_Mode: 3
m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0}
m_SelectOnLeft: {fileID: 0}
m_SelectOnRight: {fileID: 0}
m_Transition: 1
m_Colors:
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
m_ColorMultiplier: 1
m_FadeDuration: 0.1
m_SpriteState:
m_HighlightedSprite: {fileID: 0}
m_PressedSprite: {fileID: 0}
m_DisabledSprite: {fileID: 0}
m_AnimationTriggers:
m_NormalTrigger: Normal
m_HighlightedTrigger: Highlighted
m_PressedTrigger: Pressed
m_DisabledTrigger: Disabled
m_Interactable: 1
m_TargetGraphic: {fileID: 1517204064}
m_OnClick:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 1574517161}
m_MethodName: ChangeName
m_Mode: 1
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
m_TypeName: UnityEngine.UI.Button+ButtonClickedEvent, UnityEngine.UI, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=null
--- !u!114 &1517204064
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1517204061}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: -765806418, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 1
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
--- !u!222 &1517204065
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1517204061}
m_CullTransparentMesh: 0
--- !u!1 &1522488334
GameObject:
m_ObjectHideFlags: 0
@ -2967,6 +3179,23 @@ MonoBehaviour:
IP: {fileID: 574996016}
Port: {fileID: 651669416}
Name: {fileID: 883227279}
Server: {fileID: 555203924}
DefaultNames:
- Trolly Mc Trollton
- The Trolliest Troll
- Trolly Troll Troll
- Mr T. R. Oll
- The Second Trolliest Troll
- Lord Troll of Troll Manor
- Paco
- The Droll Troll
- Ellie
- Matt
- Tash
- Josh
- Troll Mc Trollson
- Sir Trollington of House Troll
- Troll
--- !u!4 &1574517162
Transform:
m_ObjectHideFlags: 0

+ 36
- 4
Assets/Scipts/HomeScreenManager.cs View File

@ -7,11 +7,23 @@ using TMPro;
public class HomeScreenManager : MonoBehaviour {
public TextMeshProUGUI IP;
public TextMeshProUGUI Port;
public TextMeshProUGUI Name;
public TMP_InputField IP;
public TMP_InputField Port;
public TMP_InputField Name;
public GameObject Server;
public string[] DefaultNames;
public void Start()
{
int rand = Random.Range(0, DefaultNames.Length);
IP.text = PlayerPrefs.GetString("IP", "");
Port.text = PlayerPrefs.GetString("PORT", "4444");
Name.text = PlayerPrefs.GetString("NAME", DefaultNames[rand]);
}
public void Connect()
{
int intVal = 0;
@ -21,15 +33,35 @@ public class HomeScreenManager : MonoBehaviour {
Destroy(ServerManager.Instance.gameObject);
ClientManager.Instance.StartClient(IP.text, intVal);
}
PlayerPrefs.SetString("IP", IP.text);
PlayerPrefs.SetString("PORT", Port.text);
PlayerPrefs.SetString("NAME", Name.text);
}
public void Host()
{
Server.SetActive(true);
int intVal = 0;
bool Succeeded = int.TryParse(Port.text, out intVal);
if (Succeeded)
{
ServerManager.Instance.StartServer();
}
else
{
Server.SetActive(false);
}
PlayerPrefs.SetString("PORT", Port.text);
PlayerPrefs.SetString("NAME", Name.text);
}
public void ChangeName()
{
int rand = Random.Range(0, DefaultNames.Length);
Name.text = DefaultNames[rand];
Debug.Log("Name" + DefaultNames[rand]);
}
}

Loading…
Cancel
Save