com.beamable 5.1.0-PREVIEW.RC3 → 5.1.0-PREVIEW.RC4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.attestation.p7m CHANGED
Binary file
@@ -12,7 +12,8 @@ MonoBehaviour:
12
12
  m_Script: {fileID: 11500000, guid: b13dd78d032d942468126fb6bad6c9df, type: 3}
13
13
  m_Name: ConsoleConfiguration
14
14
  m_EditorClassIdentifier:
15
- UISize: 1.5
15
+ UISize: 1.25
16
+ Height: 0.5
16
17
  EnableAdminConsole: 1
17
18
  ForceEnabled: 1
18
19
  ToggleAction:
@@ -5,5 +5,5 @@
5
5
  "beamMongoExpressUrl": "https://storage.beamable.com",
6
6
  "dockerRegistryUrl": "https://microservices.beamable.com/v2/",
7
7
  "isUnityVsp": "false",
8
- "sdkVersion": "5.1.0-PREVIEW.RC3"
8
+ "sdkVersion": "5.1.0-PREVIEW.RC4"
9
9
  }
@@ -37,6 +37,11 @@ namespace Beamable.Console
37
37
  // Virtual keyboard state tracking
38
38
  private bool _wasVirtualKeyboardOpen;
39
39
 
40
+ // Drag-to-scroll state
41
+ private bool _isDraggingScroll;
42
+ private float _dragLastMouseY;
43
+ private Rect _scrollViewRect;
44
+
40
45
  private readonly Dictionary<string, ConsoleCommandEntry> _commands =
41
46
  new Dictionary<string, ConsoleCommandEntry>(StringComparer.OrdinalIgnoreCase);
42
47
 
@@ -52,7 +57,6 @@ namespace Beamable.Console
52
57
  private GUIStyle _promptStyle;
53
58
  private GUIStyle _suggestionStyle;
54
59
  private readonly Color _backgroundColor = new Color(0f, 0f, 0f, 0.85f);
55
- private readonly float _heightRatio = 0.8f;
56
60
 
57
61
  private const string InputControlName = "SAConsoleInput";
58
62
 
@@ -87,18 +91,6 @@ namespace Beamable.Console
87
91
  if (!_isActive){ShowConsole();}
88
92
  else{HideConsole();}
89
93
  }
90
-
91
- // Handle virtual keyboard confirmation (any platform)
92
- if (_isActive && !string.IsNullOrEmpty(_inputText))
93
- {
94
- bool isKeyboardOpen = TouchScreenKeyboard.visible;
95
- if (_wasVirtualKeyboardOpen && !isKeyboardOpen)
96
- {
97
- // Keyboard was open and is now closed — user pressed confirm
98
- SubmitInput(_inputText);
99
- }
100
- _wasVirtualKeyboardOpen = isKeyboardOpen;
101
- }
102
94
  }
103
95
 
104
96
  private bool CheckToggleKey()
@@ -240,7 +232,7 @@ namespace Beamable.Console
240
232
  // Guard: Hide() might have been called by Escape above
241
233
  if (!_isActive) return;
242
234
 
243
- var windowRect = new Rect(0f, 0f, Screen.width, Screen.height * _heightRatio);
235
+ var windowRect = new Rect(0f, 0f, Screen.width, Screen.height * ConsoleConfiguration.Instance.Height);
244
236
  var prevColor = GUI.color;
245
237
  GUI.color = _backgroundColor;
246
238
  GUI.DrawTexture(windowRect, Texture2D.whiteTexture);
@@ -279,7 +271,7 @@ namespace Beamable.Console
279
271
 
280
272
  // Scrollable output area — reserved space for title + input row
281
273
  float reservedHeight = scaledTitleHeight + scaledInputHeight + Mathf.RoundToInt(2 * _screenScale);
282
- float outputHeight = Mathf.Max(Mathf.RoundToInt(40 * _screenScale), Screen.height * _heightRatio - reservedHeight);
274
+ float outputHeight = Mathf.Max(Mathf.RoundToInt(40 * _screenScale), Screen.height * ConsoleConfiguration.Instance.Height - reservedHeight);
283
275
  _scrollPosition = GUILayout.BeginScrollView(
284
276
  _scrollPosition, GUILayout.Height(outputHeight), GUILayout.ExpandWidth(true));
285
277
  {
@@ -287,10 +279,16 @@ namespace Beamable.Console
287
279
  }
288
280
  GUILayout.EndScrollView();
289
281
 
282
+ if (Event.current.type == EventType.Repaint)
283
+ _scrollViewRect = GUILayoutUtility.GetLastRect();
284
+
285
+ HandleScrollViewDrag();
286
+
290
287
  // Input row: ">" [text field] [suggestion hint]
291
288
  GUILayout.BeginHorizontal(GUILayout.Height(scaledInputHeight));
292
289
  {
293
- GUILayout.Label(">", _promptStyle, GUILayout.Width(scaledPromptWidth));
290
+ if (GUILayout.Button("Run", _promptStyle, GUILayout.Width(scaledPromptWidth * 2f), GUILayout.Height(scaledInputMinHeight)) && !string.IsNullOrEmpty(_inputText))
291
+ SubmitInput(_inputText);
294
292
 
295
293
  GUI.SetNextControlName(InputControlName);
296
294
  var prevBg = GUI.backgroundColor;
@@ -321,12 +319,39 @@ namespace Beamable.Console
321
319
  var suggestion = _autoCompleter.CurrentSuggestion;
322
320
  if (!string.IsNullOrEmpty(suggestion))
323
321
  {
324
- GUILayout.Label($"↹ {suggestion}", _suggestionStyle, GUILayout.ExpandWidth(false));
322
+ if (GUILayout.Button($"↹ {suggestion}", _suggestionStyle, GUILayout.ExpandWidth(false)))
323
+ {
324
+ _autoCompleter.Accept(ref _inputText);
325
+ _moveCursorToEndNextFrame = true;
326
+ _focusInputNextFrame = true;
327
+ }
325
328
  }
326
329
  }
327
330
  GUILayout.EndHorizontal();
328
331
  }
329
332
 
333
+ private void HandleScrollViewDrag()
334
+ {
335
+ var e = Event.current;
336
+ switch (e.type)
337
+ {
338
+ case EventType.MouseDown when _scrollViewRect.Contains(e.mousePosition):
339
+ _isDraggingScroll = true;
340
+ _dragLastMouseY = e.mousePosition.y;
341
+ e.Use();
342
+ break;
343
+ case EventType.MouseDrag when _isDraggingScroll:
344
+ _scrollPosition.y += _dragLastMouseY - e.mousePosition.y;
345
+ _dragLastMouseY = e.mousePosition.y;
346
+ e.Use();
347
+ break;
348
+ case EventType.MouseUp when _isDraggingScroll:
349
+ _isDraggingScroll = false;
350
+ e.Use();
351
+ break;
352
+ }
353
+ }
354
+
330
355
  private void MakeStyle()
331
356
  {
332
357
  if (Mathf.Abs(_lastScreenScale - _screenScale) < 0.01f) return;
@@ -359,11 +384,12 @@ namespace Beamable.Console
359
384
 
360
385
  _inputStyle = new GUIStyle(GUI.skin.textField)
361
386
  {
362
- fontSize = scaledFontSize,
363
- normal = { textColor = Color.white },
364
- hover = { textColor = Color.white },
365
- focused = { textColor = Color.white },
366
- active = { textColor = Color.white }
387
+ fontSize = scaledFontSize,
388
+ alignment = TextAnchor.MiddleLeft,
389
+ normal = { textColor = Color.white },
390
+ hover = { textColor = Color.white },
391
+ focused = { textColor = Color.white },
392
+ active = { textColor = Color.white }
367
393
  };
368
394
 
369
395
  _promptStyle = new GUIStyle(GUI.skin.label)
@@ -11,6 +11,8 @@ namespace Beamable.Console
11
11
  public static ConsoleConfiguration Instance => Get<ConsoleConfiguration>();
12
12
 
13
13
  public float UISize = 1.0f;
14
+ [Range(0f, 1f)]
15
+ public float Height = 0.8f;
14
16
  public bool EnableAdminConsole = true;
15
17
  public bool ForceEnabled = true;
16
18
 
@@ -40,6 +40,7 @@ namespace Beamable.Runtime.LightBeams
40
40
  CanvasGroup loadingBlocker,
41
41
  Action<IDependencyBuilder> scopeConfiguration)
42
42
  {
43
+
43
44
  var lightContext = new LightBeam
44
45
  {
45
46
  BeamContext = ctx,
@@ -52,7 +53,10 @@ namespace Beamable.Runtime.LightBeams
52
53
  scopeConfiguration?.Invoke(builder);
53
54
  });
54
55
  lightContext.Scope = scope;
55
-
56
+
57
+ // Check and convert Input
58
+ LightBeam.CheckConvertSampleToNewInputSystem();
59
+
56
60
  await ctx.OnReady.ShowLoading(lightContext);
57
61
  return lightContext;
58
62
  }
@@ -12,6 +12,11 @@ using UnityEngine.UI;
12
12
  using Component = UnityEngine.Component;
13
13
  using Object = UnityEngine.Object;
14
14
 
15
+ #if ENABLE_INPUT_SYSTEM
16
+ using UnityEngine.InputSystem.UI;
17
+ using UnityEngine.EventSystems;
18
+ #endif
19
+
15
20
  namespace Beamable.Runtime.LightBeams
16
21
  {
17
22
  /// <summary>
@@ -133,6 +138,28 @@ namespace Beamable.Runtime.LightBeams
133
138
  Application.OpenURL(url);
134
139
  }
135
140
 
141
+ public static void CheckConvertSampleToNewInputSystem()
142
+ {
143
+ #if ENABLE_INPUT_SYSTEM
144
+ EventSystem eventSystem = EventSystem.current;
145
+ if (eventSystem == null)
146
+ return;
147
+
148
+ // Remove old module
149
+ var oldModule = eventSystem.GetComponent<StandaloneInputModule>();
150
+
151
+ if (oldModule != null)
152
+ {
153
+ Object.Destroy(oldModule);
154
+ }
155
+
156
+ // Add new module if missing
157
+ if (eventSystem.GetComponent<InputSystemUIInputModule>() == null)
158
+ {
159
+ eventSystem.gameObject.AddComponent<InputSystemUIInputModule>();
160
+ }
161
+ #endif
162
+ }
136
163
  }
137
164
 
138
165
  public interface ILightRoot
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "name": "Unity.Beamable.LightBeams",
3
+ "rootNamespace": "",
3
4
  "references": [
4
5
  "Beamable.Coroutines",
5
6
  "Beamable.Platform",
@@ -10,14 +11,16 @@
10
11
  "Unity.ResourceManager",
11
12
  "Unity.TextMeshPro",
12
13
  "Unity.Beamable.Runtime.Common",
13
- "Unity.Beamable"
14
+ "Unity.Beamable",
15
+ "Unity.InputSystem"
14
16
  ],
15
- "optionalUnityReferences": [],
16
17
  "includePlatforms": [],
17
18
  "excludePlatforms": [],
18
19
  "allowUnsafeCode": false,
19
20
  "overrideReferences": true,
20
21
  "precompiledReferences": [],
21
22
  "autoReferenced": true,
22
- "defineConstraints": []
23
- }
23
+ "defineConstraints": [],
24
+ "versionDefines": [],
25
+ "noEngineReferences": false
26
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "com.beamable",
3
- "version": "5.1.0-PREVIEW.RC3",
3
+ "version": "5.1.0-PREVIEW.RC4",
4
4
  "displayName": "Beamable",
5
5
  "description": "A better way to build games in Unity\n",
6
6
  "unity": "2021.3",