com.backnd.database 0.0.2 → 0.0.4

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.
@@ -8,7 +8,7 @@
8
8
  "overrideReferences": false,
9
9
  "precompiledReferences": [],
10
10
  "autoReferenced": true,
11
- "defineConstraints": [],
11
+ "defineConstraints": ["BACKND_SDK_INSTALLED"],
12
12
  "versionDefines": [],
13
13
  "noEngineReferences": false
14
14
  }
@@ -1,9 +1,7 @@
1
1
  {
2
2
  "name": "BACKND.Database.Editor",
3
3
  "rootNamespace": "BACKND.Database.Editor",
4
- "references": [
5
- "BACKND.Database"
6
- ],
4
+ "references": [],
7
5
  "includePlatforms": [
8
6
  "Editor"
9
7
  ],
@@ -1,6 +1,7 @@
1
1
  using UnityEngine;
2
2
  using UnityEditor;
3
3
  using UnityEditor.PackageManager;
4
+ using UnityEditor.Build;
4
5
  using System.IO;
5
6
 
6
7
  namespace BACKND.Database.Editor
@@ -11,9 +12,7 @@ namespace BACKND.Database.Editor
11
12
  private const string PackageName = "com.backnd.database";
12
13
  private const string SourceFolderName = "TheBackend~";
13
14
  private const string TargetFolderName = "TheBackend";
14
-
15
- private const string InstalledPrefsKey = "BACKND_Database_PluginsInstalled";
16
- private const string SkippedPrefsKey = "BACKND_Database_PluginsSkipped";
15
+ private const string DefineSymbol = "BACKND_SDK_INSTALLED";
17
16
 
18
17
  static PackageAssetInstaller()
19
18
  {
@@ -22,20 +21,13 @@ namespace BACKND.Database.Editor
22
21
 
23
22
  private static void TryInstallAssets()
24
23
  {
25
- // 이미 설치 완료 또는 스킵한 경우
26
- if (EditorPrefs.GetBool(InstalledPrefsKey, false) ||
27
- EditorPrefs.GetBool(SkippedPrefsKey, false))
28
- {
29
- return;
30
- }
31
-
32
24
  string targetPath = Path.Combine("Assets", TargetFolderName);
33
25
 
34
- // 이미 Assets/TheBackend 폴더가 존재하면 설치 완료로 처리
35
- // 핵심 파일들이 모두 존재하는지 확인
26
+ // 이미 설치 완료된 경우
36
27
  if (IsAlreadyInstalled(targetPath))
37
28
  {
38
- EditorPrefs.SetBool(InstalledPrefsKey, true);
29
+ // 파일은 있지만 심볼이 없는 경우 심볼만 추가
30
+ EnsureScriptingDefineSymbol();
39
31
  return;
40
32
  }
41
33
 
@@ -48,28 +40,18 @@ namespace BACKND.Database.Editor
48
40
  return;
49
41
  }
50
42
 
51
- // 사용자에게 설치 확인
52
- int result = EditorUtility.DisplayDialogComplex(
53
- "BACKND Database",
54
- "BACKND SDK 플러그인을 설치하시겠습니까?\n\n" +
55
- "이 플러그인은 BACKND Database 패키지 사용에 필요합니다.\n\n" +
56
- $"설치 위치: Assets/{TargetFolderName}",
57
- "설치",
58
- "나중에",
59
- "다시 묻지 않기"
60
- );
61
-
62
- switch (result)
43
+ // 자동 설치
44
+ InstallAssets(sourcePath, targetPath);
45
+ }
46
+
47
+ private static void EnsureScriptingDefineSymbol()
48
+ {
49
+ var buildTarget = NamedBuildTarget.FromBuildTargetGroup(EditorUserBuildSettings.selectedBuildTargetGroup);
50
+ string defines = PlayerSettings.GetScriptingDefineSymbols(buildTarget);
51
+
52
+ if (!defines.Contains(DefineSymbol))
63
53
  {
64
- case 0: // 설치
65
- InstallAssets(sourcePath, targetPath);
66
- break;
67
- case 1: // 나중에
68
- // 다음 에디터 실행 시 다시 물음
69
- break;
70
- case 2: // 다시 묻지 않기
71
- EditorPrefs.SetBool(SkippedPrefsKey, true);
72
- break;
54
+ AddScriptingDefineSymbol();
73
55
  }
74
56
  }
75
57
 
@@ -145,17 +127,11 @@ namespace BACKND.Database.Editor
145
127
 
146
128
  AssetDatabase.Refresh();
147
129
 
148
- EditorPrefs.SetBool(InstalledPrefsKey, true);
130
+ // 스크립팅 심볼 추가 (BACKND.Database 어셈블리 컴파일 활성화)
131
+ AddScriptingDefineSymbol();
149
132
 
150
133
  EditorUtility.ClearProgressBar();
151
134
 
152
- EditorUtility.DisplayDialog(
153
- "BACKND Database",
154
- "플러그인 설치가 완료되었습니다!\n\n" +
155
- $"설치 위치: {targetPath}",
156
- "확인"
157
- );
158
-
159
135
  Debug.Log($"[BACKND Database] 플러그인이 설치되었습니다: {targetPath}");
160
136
  }
161
137
  catch (System.Exception e)
@@ -171,6 +147,27 @@ namespace BACKND.Database.Editor
171
147
  }
172
148
  }
173
149
 
150
+ private static void AddScriptingDefineSymbol()
151
+ {
152
+ var buildTarget = NamedBuildTarget.FromBuildTargetGroup(EditorUserBuildSettings.selectedBuildTargetGroup);
153
+ string defines = PlayerSettings.GetScriptingDefineSymbols(buildTarget);
154
+
155
+ if (!defines.Contains(DefineSymbol))
156
+ {
157
+ if (string.IsNullOrEmpty(defines))
158
+ {
159
+ defines = DefineSymbol;
160
+ }
161
+ else
162
+ {
163
+ defines = defines + ";" + DefineSymbol;
164
+ }
165
+
166
+ PlayerSettings.SetScriptingDefineSymbols(buildTarget, defines);
167
+ Debug.Log($"[BACKND Database] 스크립팅 심볼 추가됨: {DefineSymbol}");
168
+ }
169
+ }
170
+
174
171
  private static void CopyDirectory(string sourceDir, string targetDir)
175
172
  {
176
173
  var dir = new DirectoryInfo(sourceDir);
@@ -205,7 +202,7 @@ namespace BACKND.Database.Editor
205
202
  }
206
203
 
207
204
  // 메뉴에서 수동 설치
208
- [MenuItem("BACKND/Database/Install SDK Plugins")]
205
+ [MenuItem("The Backend/Database/Install SDK Plugins")]
209
206
  private static void ManualInstall()
210
207
  {
211
208
  string sourcePath = FindSourcePath();
@@ -239,13 +236,5 @@ namespace BACKND.Database.Editor
239
236
  InstallAssets(sourcePath, targetPath);
240
237
  }
241
238
 
242
- // 설치 상태 초기화 (디버그용)
243
- [MenuItem("BACKND/Database/Reset Install State")]
244
- private static void ResetInstallState()
245
- {
246
- EditorPrefs.DeleteKey(InstalledPrefsKey);
247
- EditorPrefs.DeleteKey(SkippedPrefsKey);
248
- Debug.Log("[BACKND Database] 설치 상태가 초기화되었습니다.");
249
- }
250
239
  }
251
240
  }
package/README.md.meta ADDED
@@ -0,0 +1,7 @@
1
+ fileFormatVersion: 2
2
+ guid: 9208b4f4037724955abb6ab4358ba1f2
3
+ TextScriptImporter:
4
+ externalObjects: {}
5
+ userData:
6
+ assetBundleName:
7
+ assetBundleVariant:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "com.backnd.database",
3
- "version": "0.0.2",
3
+ "version": "0.0.4",
4
4
  "displayName": "BACKND Database",
5
5
  "description": "BACKND Database is a Unity SDK for seamless integration with BACKND cloud database services.\n\nEasily manage and synchronize game data such as player profiles, game states, and leaderboards across multiple platforms.\nIdeal for Unity developers looking to implement robust database solutions without complex backend setups.",
6
6
  "unity": "2021.3",