Skip to content

Commit

Permalink
Detached StoreCam from UI; Store Units& Buttons now correctly positioned
Browse files Browse the repository at this point in the history
StoreCam was scaled with UI when the screen size changed, which caused weird behaviour. This means storecam will have to be deactivated seperately when Store is hidden (not yet implemented). Now store units and buttons display correctly on all 16:9 screen sizes (other ratios not yet tested)
  • Loading branch information
mariuskilian committed May 2, 2020
1 parent ab75a2e commit 51913f0
Show file tree
Hide file tree
Showing 36 changed files with 190 additions and 81 deletions.
4 changes: 2 additions & 2 deletions Assets/Photon/PhotonBolt/resources/BoltRuntimeSettings.asset
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ MonoBehaviour:
debugClientCount: 4
debugStartPort: 50538
debugStartMapName: Ingame
debugPlayAsServer: 1
debugPlayAsServer: 0
showDebugInfo: 1
overrideTimeScale: 1
logUncaughtExceptions: 0
debugEditorMode: 1
debugEditorMode: 2
consoleToggleKey: 9
consoleVisibleByDefault: 0
compilationWarnLevel: 4
Expand Down
8 changes: 7 additions & 1 deletion Assets/Photon/PhotonBolt/scripts/BoltDebugStart.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Bolt;
using UdpKit;
using UnityEngine;
using System.Collections;
using Process = System.Diagnostics.Process;

public partial class BoltDebugStart : BoltInternal.GlobalEventListenerBase
Expand Down Expand Up @@ -82,10 +83,15 @@ public override void BoltStartDone()
}
else if (BoltNetwork.IsClient)
{
BoltNetwork.Connect((ushort)BoltRuntimeSettings.instance.debugStartPort);
StartCoroutine(WaitThenStartClient());
}
}

private IEnumerator WaitThenStartClient() {
yield return new WaitForSeconds(5);
BoltNetwork.Connect((ushort)BoltRuntimeSettings.instance.debugStartPort);
}

public override void SceneLoadLocalDone(string scene, IProtocolToken token)
{
Destroy(gameObject);
Expand Down
133 changes: 62 additions & 71 deletions Assets/Scenes/Ingame.unity
Original file line number Diff line number Diff line change
Expand Up @@ -344,8 +344,8 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: d42f4b990490f7c46b9fdf3937fe987a, type: 3}
m_Name:
m_EditorClassIdentifier:
CamOffset: {x: 5, y: 7.275, z: 0}
CamRotationEulers: {x: 50, y: 0, z: 0}
CamOffset: {x: 5, y: 8.6, z: -5.75}
CamRotationEulers: {x: 47.5, y: 0, z: 0}
--- !u!1 &1558936934
GameObject:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -412,7 +412,7 @@ GameObject:
- component: {fileID: 2047686404}
- component: {fileID: 2047686403}
m_Layer: 5
m_Name: Text
m_Name: DebugLoadTime
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
Expand All @@ -430,7 +430,7 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 8362027053301982919}
m_RootOrder: 6
m_RootOrder: 5
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0}
m_AnchorMax: {x: 0.5, y: 0}
Expand Down Expand Up @@ -481,7 +481,7 @@ MonoBehaviour:
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: New Text
m_Text:
--- !u!222 &2047686405
CanvasRenderer:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -721,9 +721,8 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 8362027055000261299}
- {fileID: 8362027053467231216}
m_Father: {fileID: 8362027053301982919}
m_RootOrder: 2
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 1}
m_AnchorMax: {x: 0.5, y: 1}
Expand Down Expand Up @@ -1105,14 +1104,13 @@ RectTransform:
m_LocalScale: {x: 0, y: 0, z: 0}
m_Children:
- {fileID: 8362027054428556969}
- {fileID: 8362027055058915774}
- {fileID: 8362027053115061446}
- {fileID: 8362027054317005764}
- {fileID: 8362027054184608460}
- {fileID: 8362027054968041473}
- {fileID: 2047686402}
m_Father: {fileID: 0}
m_RootOrder: 3
m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
Expand Down Expand Up @@ -1359,30 +1357,46 @@ GameObject:
- component: {fileID: 8362027053467231216}
- component: {fileID: 8362027053467231219}
- component: {fileID: 8362027053467231217}
- component: {fileID: 8362027053467230992}
m_Layer: 5
m_Name: Store Cam
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &8362027053467230992
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8362027053467230991}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 01d37a37776683d49b32a0d4a4d8d76f, type: 3}
m_Name:
m_EditorClassIdentifier:
yOffset: 0.3
zOffset: 2
xOffsetMax: 1.8
--- !u!224 &8362027053467231216
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8362027053467230991}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
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: 8362027053115061446}
m_RootOrder: 1
m_Father: {fileID: 0}
m_RootOrder: 3
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: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 500}
m_SizeDelta: {x: 100, y: 100}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &8362027053467231217
Expand Down Expand Up @@ -1778,6 +1792,7 @@ GameObject:
serializedVersion: 6
m_Component:
- component: {fileID: 8362027054026766782}
- component: {fileID: 8362027054026766783}
m_Layer: 5
m_Name: Catch Buttons
m_TagString: Untagged
Expand All @@ -1800,11 +1815,25 @@ RectTransform:
m_Father: {fileID: 8362027055000261299}
m_RootOrder: 0
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: 0, y: -140}
m_AnchorMin: {x: 0.5, y: 0}
m_AnchorMax: {x: 0.5, y: 0}
m_AnchoredPosition: {x: 0, y: 120}
m_SizeDelta: {x: 100, y: 100}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &8362027054026766783
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8362027054026766781}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: a3ced0cdeff98bf418acfb89999272a8, type: 3}
m_Name:
m_EditorClassIdentifier:
CatchButtonTemplate: {fileID: 8362027054157513074}
xOffsetMax: 523
--- !u!1 &8362027054157513074
GameObject:
m_ObjectHideFlags: 0
Expand All @@ -1817,6 +1846,7 @@ GameObject:
- component: {fileID: 8362027054157513079}
- component: {fileID: 8362027054157513078}
- component: {fileID: 8362027054157513077}
- component: {fileID: 8362027054157513076}
m_Layer: 5
m_Name: Catch Button Template
m_TagString: Untagged
Expand Down Expand Up @@ -1844,6 +1874,18 @@ RectTransform:
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 160, y: 30}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &8362027054157513076
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8362027054157513074}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: be70538f98d634e479056ea888abe495, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!114 &8362027054157513077
MonoBehaviour:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -1887,7 +1929,7 @@ MonoBehaviour:
m_OnClick:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 0}
- m_Target: {fileID: 8362027054157513076}
m_MethodName: OnButtonClick
m_Mode: 1
m_Arguments:
Expand Down Expand Up @@ -1964,7 +2006,7 @@ RectTransform:
- {fileID: 8362027054529743000}
- {fileID: 8362027054853782683}
m_Father: {fileID: 8362027053301982919}
m_RootOrder: 4
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
Expand Down Expand Up @@ -2003,7 +2045,7 @@ RectTransform:
m_Children:
- {fileID: 8362027054492277063}
m_Father: {fileID: 8362027053301982919}
m_RootOrder: 3
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
Expand Down Expand Up @@ -2502,7 +2544,7 @@ RectTransform:
- {fileID: 8362027053592016076}
- {fileID: 8362027054753283696}
m_Father: {fileID: 8362027053301982919}
m_RootOrder: 5
m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 1}
m_AnchorMax: {x: 0.5, y: 1}
Expand Down Expand Up @@ -2584,54 +2626,3 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8362027055000261298}
m_CullTransparentMesh: 0
--- !u!1 &8362027055058915773
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 8362027055058915774}
- component: {fileID: 8362027055058915775}
m_Layer: 5
m_Name: Store Unit Container
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &8362027055058915774
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8362027055058915773}
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: 8362027053301982919}
m_RootOrder: 1
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: 0, y: 0}
m_SizeDelta: {x: 100, y: 100}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &8362027055058915775
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8362027055058915773}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 01d37a37776683d49b32a0d4a4d8d76f, type: 3}
m_Name:
m_EditorClassIdentifier:
yOffset: 0.5
zOffset: 3
xOffsetMax: 4
20 changes: 14 additions & 6 deletions Assets/Scripts/Client/StoreUnitContainerMan.cs
Original file line number Diff line number Diff line change
@@ -1,23 +1,31 @@
using System.Collections;
using System;
using System.Collections.Generic;
using UnityEngine;
using Bolt;

public class StoreUnitContainerMan : GlobalEventListener {

public static StoreUnitContainerMan Instance { get; private set; }
private void Awake() { if (Instance == null) Instance = this; }

#region Local Events
public Action<int> UnitArrivedInStoreEvent;
#endregion

[SerializeField] private float
yOffset = 0.5f,
zOffset = 3f,
xOffsetMax = 4f
yOffset = 0.3f,
zOffset = 2f,
xOffsetMax = 1.8f
;

public static StoreUnitContainerMan Instance { get; private set; }
private void Awake() { if (Instance == null) Instance = this; }
private Unit[] StoreUnits = new Unit[StoreMan.StoreSize];

public override void OnEvent(EventManClientInitializedEvent evnt) { if (evnt.RaisedBy == null) SubscribeLocalEventHandlers(); }

private void PositionNewStore(Unit[] Units) {
for (int idx = 0; idx < Units.Length; idx++) {
StoreUnits[idx] = Units[idx];
StartCoroutine(WaitThenSpawn(Units[idx], idx));
}
}
Expand All @@ -31,7 +39,7 @@ private IEnumerator WaitThenSpawn(Unit unit, int index) {
float normalizedIndex = (float)index / (float)(5 - 1); // 0 <= normalizedIndex <= 1
yield return new WaitForSeconds(normalizedIndex * 0.67f);
unit.gameObject.transform.Translate(Vector3.down * 1000); //reshow unit
// NewUnitInStoreEvent?.Invoke(unit, index);
UnitArrivedInStoreEvent?.Invoke(index);
}

//Positions unit accordingly on camera so it shows in store
Expand Down
8 changes: 8 additions & 0 deletions Assets/Scripts/Client/UI.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 51913f0

Please sign in to comment.