com.amanotes.gdk 0.2.38 → 0.2.39

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/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.2.39 - 2023-11-27]
4
+ - Fix variable name and variable value of "ChangeDevMode"
5
+ - Fix Timeout = 0 should cancel the wait for Ad
6
+
3
7
  ## [0.2.38 - 2023-11-22]
4
8
  - Improve Ads API
5
9
  - Add Ad Quality
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -529,7 +529,7 @@ namespace Amanotes.Core.Internal
529
529
  int timeout = Ads._adConfig.adLoadTimeoutInSecs;
530
530
  var counter = 0;
531
531
 
532
- while (counter < timeout || timeout == 0)
532
+ while (counter < timeout || timeout == -1)
533
533
  {
534
534
  yield return wait1Sec;
535
535
  counter++;
package/Runtime/AmaGDK.cs CHANGED
@@ -9,12 +9,13 @@ using Amanotes.Core.Internal;
9
9
  using UnityEngine;
10
10
  using static Amanotes.Core.Internal.Logging;
11
11
  using static Amanotes.Core.Internal.Messsage;
12
+ using Debug = UnityEngine.Debug;
12
13
 
13
14
  namespace Amanotes.Core
14
15
  {
15
16
  public partial class AmaGDK : MonoBehaviour
16
17
  {
17
- public const string VERSION = "0.2.38";
18
+ public const string VERSION = "0.2.39";
18
19
 
19
20
  internal static AmaGDK _instance;
20
21
  internal static Status _status = Status.None;
@@ -291,17 +292,45 @@ namespace Amanotes.Core
291
292
  public void ChangeDevMode()
292
293
  {
293
294
  string variableName = "GDK_HOME";
294
- string output = RunShellCommand($"source ~/.zshrc && echo file:${variableName}");
295
- output = output.Trim();
296
-
297
- if (string.IsNullOrEmpty(output))
295
+ string zshrcPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".zshrc");
296
+ string zshrcContent;
297
+
298
+ try
299
+ {
300
+ zshrcContent = File.ReadAllText(zshrcPath);
301
+ }
302
+ catch (FileNotFoundException)
303
+ {
304
+ Debug.LogWarning($"Zsh configuration file {zshrcPath} not found.");
305
+ return;
306
+ }
307
+
308
+ if (!zshrcContent.Contains($"export {variableName}="))
298
309
  {
299
- LogWarning($"{variableName} environment variable is not set.");
310
+ Debug.LogWarning($"{variableName} environment variable is not set in {zshrcPath}.");
300
311
  return;
301
312
  }
313
+
314
+ int startIndex = zshrcContent.IndexOf($"export {variableName}=");
315
+ if (startIndex >= 0)
316
+ {
317
+ startIndex += $"export {variableName}=".Length;
318
+ int endIndex = zshrcContent.IndexOfAny(new char[] { '\n', '\r' }, startIndex);
319
+ string gdkHomeValue = endIndex >= 0
320
+ ? zshrcContent.Substring(startIndex, endIndex - startIndex).Trim()
321
+ : zshrcContent.Substring(startIndex).Trim();
302
322
 
303
- UpdateManifest(output);
304
- Log("AmaGDK changes to dev mode successfully");
323
+ if (string.IsNullOrEmpty(gdkHomeValue))
324
+ {
325
+ Debug.LogWarning($"{variableName} environment variable is set but has an empty value in {zshrcPath}.");
326
+ return;
327
+ }
328
+ }
329
+
330
+ string output = RunShellCommand($"source ~/.zshrc && echo file:${variableName}");
331
+ output = output.Trim();
332
+ UpdateManifest(output);
333
+ Debug.Log("AmaGDK changes to dev mode successfully");
305
334
  }
306
335
 
307
336
  private string RunShellCommand(string command)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "com.amanotes.gdk",
3
- "version": "0.2.38",
3
+ "version": "0.2.39",
4
4
  "displayName": "AmaGDK",
5
5
  "description": "Amanotes Game Development Kit",
6
6
  "unity": "2019.4",