Updated Basic Example

This commit is contained in:
MrGadget1024 2022-12-06 08:13:29 -05:00 committed by vis2k
parent c4f7ebf3b9
commit 05e18380c0
3 changed files with 97 additions and 15 deletions

View File

@ -43,7 +43,7 @@ RenderSettings:
--- !u!157 &3
LightmapSettings:
m_ObjectHideFlags: 0
serializedVersion: 11
serializedVersion: 12
m_GIWorkflowMode: 0
m_GISettings:
serializedVersion: 2
@ -98,7 +98,7 @@ LightmapSettings:
m_TrainingDataDestination: TrainingData
m_LightProbeSampleCountMultiplier: 4
m_LightingDataAsset: {fileID: 0}
m_UseShadowmask: 1
m_LightingSettings: {fileID: 2034431047}
--- !u!196 &4
NavMeshSettings:
serializedVersion: 2
@ -118,6 +118,8 @@ NavMeshSettings:
manualTileSize: 0
tileSize: 256
accuratePlacement: 0
maxJobWorkers: 0
preserveTilesOutsideBounds: 0
debug:
m_Flags: 0
m_NavMeshData: {fileID: 0}
@ -175,8 +177,10 @@ MonoBehaviour:
CongestionWindow: 0
SendWindowSize: 4096
ReceiveWindowSize: 4096
NonAlloc: 0
ReliableMaxMessageSize: 4811624
MaxRetransmit: 40
NonAlloc: 1
MaximizeSendReceiveBuffersToOSLimit: 1
ReliableMaxMessageSize: 298449
UnreliableMaxMessageSize: 1199
debugLog: 0
statisticsGUI: 0
@ -196,18 +200,19 @@ MonoBehaviour:
dontDestroyOnLoad: 0
runInBackground: 1
autoStartServerBuild: 1
serverTickRate: 30
autoConnectClientBuild: 0
sendRate: 30
offlineScene:
onlineScene:
transport: {fileID: 249891955}
networkAddress: localhost
maxConnections: 100
authenticator: {fileID: 0}
playerPrefab: {fileID: 897184729387425976, guid: dc2c4328591bef748abb8df795c17202,
type: 3}
playerPrefab: {fileID: 897184729387425976, guid: dc2c4328591bef748abb8df795c17202, type: 3}
autoCreatePlayer: 1
playerSpawnMethod: 1
spawnPrefabs: []
timeInterpolationGui: 0
--- !u!4 &249891957
Transform:
m_ObjectHideFlags: 0
@ -218,6 +223,7 @@ Transform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -10, y: 4, z: 5}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 1
@ -292,6 +298,7 @@ Transform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 1, z: -1}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
@ -326,6 +333,7 @@ RectTransform:
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_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 864730913}
m_RootOrder: 0
@ -382,6 +390,7 @@ MonoBehaviour:
m_Material: {fileID: 0}
m_Color: {r: 0, g: 0, b: 0, a: 0.039215688}
m_RaycastTarget: 0
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
@ -464,6 +473,7 @@ MonoBehaviour:
m_FallbackScreenDPI: 96
m_DefaultSpriteDPI: 96
m_DynamicPixelsPerUnit: 1
m_PresetInfoIsWorld: 0
--- !u!223 &533055203
Canvas:
m_ObjectHideFlags: 0
@ -495,6 +505,7 @@ RectTransform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0, y: 0, z: 0}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 1712119861}
m_Father: {fileID: 0}
@ -533,6 +544,7 @@ RectTransform:
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_ConstrainProportionsScale: 0
m_Children:
- {fileID: 379082679}
m_Father: {fileID: 1712119861}
@ -558,6 +570,7 @@ MonoBehaviour:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 0
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
@ -610,6 +623,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 4f231c4fb786f3946a6b90b886c48677, type: 3}
m_Name:
m_EditorClassIdentifier:
m_SendPointerHoverToParent: 1
m_HorizontalAxis: Horizontal
m_VerticalAxis: Vertical
m_SubmitButton: Submit
@ -642,6 +656,7 @@ Transform:
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_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 3
@ -674,6 +689,7 @@ RectTransform:
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_ConstrainProportionsScale: 0
m_Children:
- {fileID: 864730913}
m_Father: {fileID: 533055204}
@ -699,6 +715,7 @@ MonoBehaviour:
m_Material: {fileID: 0}
m_Color: {r: 0, g: 0, b: 0, a: 0}
m_RaycastTarget: 0
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
@ -721,3 +738,65 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1712119860}
m_CullTransparentMesh: 0
--- !u!850595691 &2034431047
LightingSettings:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Settings.lighting
serializedVersion: 4
m_GIWorkflowMode: 0
m_EnableBakedLightmaps: 0
m_EnableRealtimeLightmaps: 0
m_RealtimeEnvironmentLighting: 1
m_BounceScale: 1
m_AlbedoBoost: 1
m_IndirectOutputScale: 1
m_UsingShadowmask: 1
m_BakeBackend: 1
m_LightmapMaxSize: 1024
m_BakeResolution: 40
m_Padding: 2
m_LightmapCompression: 3
m_AO: 0
m_AOMaxDistance: 1
m_CompAOExponent: 1
m_CompAOExponentDirect: 0
m_ExtractAO: 0
m_MixedBakeMode: 2
m_LightmapsBakeMode: 1
m_FilterMode: 1
m_LightmapParameters: {fileID: 15204, guid: 0000000000000000f000000000000000, type: 0}
m_ExportTrainingData: 0
m_TrainingDataDestination: TrainingData
m_RealtimeResolution: 2
m_ForceWhiteAlbedo: 0
m_ForceUpdates: 0
m_FinalGather: 0
m_FinalGatherRayCount: 256
m_FinalGatherFiltering: 1
m_PVRCulling: 1
m_PVRSampling: 1
m_PVRDirectSampleCount: 32
m_PVRSampleCount: 500
m_PVREnvironmentSampleCount: 500
m_PVREnvironmentReferencePointCount: 2048
m_LightProbeSampleCountMultiplier: 4
m_PVRBounces: 2
m_PVRMinBounces: 2
m_PVREnvironmentMIS: 0
m_PVRFilteringMode: 2
m_PVRDenoiserTypeDirect: 0
m_PVRDenoiserTypeIndirect: 0
m_PVRDenoiserTypeAO: 0
m_PVRFilterTypeDirect: 0
m_PVRFilterTypeIndirect: 0
m_PVRFilterTypeAO: 0
m_PVRFilteringGaussRadiusDirect: 1
m_PVRFilteringGaussRadiusIndirect: 5
m_PVRFilteringGaussRadiusAO: 2
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
m_PVRFilteringAtrousPositionSigmaIndirect: 2
m_PVRFilteringAtrousPositionSigmaAO: 1
m_PVRTiledBaking: 0

View File

@ -11,11 +11,18 @@ public class CanvasUI : MonoBehaviour
public RectTransform playersPanel;
// static instance that can be referenced directly from Player script
public static CanvasUI instance;
static CanvasUI instance;
void Awake()
{
instance = this;
}
public static void SetActive(bool active)
{
instance.mainPanel.gameObject.SetActive(active);
}
public static RectTransform GetPlayersPanel() => instance.playersPanel;
}
}

View File

@ -122,10 +122,8 @@ public override void OnStopServer()
/// </summary>
public override void OnStartClient()
{
Debug.Log("OnStartClient");
// Instantiate the player UI as child of the Players Panel
playerUIObject = Instantiate(playerUIPrefab, CanvasUI.instance.playersPanel);
playerUIObject = Instantiate(playerUIPrefab, CanvasUI.GetPlayersPanel());
playerUI = playerUIObject.GetComponent<PlayerUI>();
// wire up all events to handlers in PlayerUI
@ -145,13 +143,11 @@ public override void OnStartClient()
/// </summary>
public override void OnStartLocalPlayer()
{
Debug.Log("OnStartLocalPlayer");
// Set isLocalPlayer for this Player in UI for background shading
playerUI.SetLocalPlayer();
// Activate the main panel
CanvasUI.instance.mainPanel.gameObject.SetActive(true);
CanvasUI.SetActive(true);
}
/// <summary>
@ -161,7 +157,7 @@ public override void OnStartLocalPlayer()
public override void OnStopLocalPlayer()
{
// Disable the main panel for local player
CanvasUI.instance.mainPanel.gameObject.SetActive(false);
CanvasUI.SetActive(false);
}
/// <summary>