├── Assets
├── ClientDataBase
│ ├── GameTable
│ │ └── .gitkeep
│ ├── Templates
│ │ ├── TableClassProperty.txt
│ │ ├── Scriptable.txt.meta
│ │ ├── TableClass.txt.meta
│ │ ├── ScriptableEditor.txt.meta
│ │ ├── TableClassProperty.txt.meta
│ │ ├── TableClass.txt
│ │ ├── ScriptableEditor.txt
│ │ └── Scriptable.txt
│ ├── Scripts.meta
│ ├── GameTable.meta
│ ├── Resources.meta
│ ├── Resources
│ │ ├── Client DataBase Config.asset.meta
│ │ └── Client DataBase Config.asset
│ ├── Scripts
│ │ ├── Base.meta
│ │ ├── Config.meta
│ │ ├── Editor.meta
│ │ ├── Utility.meta
│ │ ├── Base
│ │ │ ├── TableClassBase.cs
│ │ │ ├── TableClassBase.cs.meta
│ │ │ ├── ScriptableObjectBase.cs.meta
│ │ │ └── ScriptableObjectBase.cs
│ │ ├── Utility
│ │ │ ├── Utility.cs.meta
│ │ │ ├── Singleton.cs.meta
│ │ │ ├── SerializableDictionary.cs.meta
│ │ │ ├── Singleton.cs
│ │ │ ├── Utility.cs
│ │ │ └── SerializableDictionary.cs
│ │ ├── ClientDataBaseManager.cs.meta
│ │ ├── Editor
│ │ │ ├── UtilityEditor.cs.meta
│ │ │ ├── ClientDataBaseParse.cs.meta
│ │ │ ├── ClientDataBaseConfigEditor.cs.meta
│ │ │ ├── ClientDataBaseEditorWindow.cs.meta
│ │ │ ├── ClientDataBaseConfigEditor.cs
│ │ │ ├── UtilityEditor.cs
│ │ │ ├── ClientDataBaseEditorWindow.cs
│ │ │ └── ClientDataBaseParse.cs
│ │ ├── Config
│ │ │ ├── ClientDataBaseConfig.cs.meta
│ │ │ └── ClientDataBaseConfig.cs
│ │ └── ClientDataBaseManager.cs
│ └── Templates.meta
└── ClientDataBase.meta
├── Documentation
├── en
│ └── en.md
├── 04_Sample_1.png
├── 05_Sample_2.png
├── 02_Client DataBase Config.PNG
├── 03_Client DataBase Window.PNG
├── 01_Excel to ScriptableObject Asset.png
└── zh-tw
│ └── zh-tw.md
├── ProjectSettings
├── ProjectVersion.txt
├── ClusterInputManager.asset
├── EditorBuildSettings.asset
├── NetworkManager.asset
├── TimeManager.asset
├── UnityAdsSettings.asset
├── UnityConnectSettings.asset
├── AudioManager.asset
├── EditorSettings.asset
├── TagManager.asset
├── DynamicsManager.asset
├── Physics2DSettings.asset
├── NavMeshAreas.asset
├── GraphicsSettings.asset
├── QualitySettings.asset
├── InputManager.asset
└── ProjectSettings.asset
├── README.md
├── .gitignore
└── LICENCE
/Assets/ClientDataBase/GameTable/.gitkeep:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/Documentation/en/en.md:
--------------------------------------------------------------------------------
1 | #:warning: Building...
2 |
--------------------------------------------------------------------------------
/ProjectSettings/ProjectVersion.txt:
--------------------------------------------------------------------------------
1 | m_EditorVersion: 5.3.6f1
2 | m_StandardAssetsVersion: 0
3 |
--------------------------------------------------------------------------------
/Documentation/04_Sample_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/k79k06k02k/ClientDataBase/HEAD/Documentation/04_Sample_1.png
--------------------------------------------------------------------------------
/Documentation/05_Sample_2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/k79k06k02k/ClientDataBase/HEAD/Documentation/05_Sample_2.png
--------------------------------------------------------------------------------
/Documentation/02_Client DataBase Config.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/k79k06k02k/ClientDataBase/HEAD/Documentation/02_Client DataBase Config.PNG
--------------------------------------------------------------------------------
/Documentation/03_Client DataBase Window.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/k79k06k02k/ClientDataBase/HEAD/Documentation/03_Client DataBase Window.PNG
--------------------------------------------------------------------------------
/Documentation/01_Excel to ScriptableObject Asset.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/k79k06k02k/ClientDataBase/HEAD/Documentation/01_Excel to ScriptableObject Asset.png
--------------------------------------------------------------------------------
/ProjectSettings/ClusterInputManager.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!236 &1
4 | ClusterInputManager:
5 | m_ObjectHideFlags: 0
6 | m_Inputs: []
7 |
--------------------------------------------------------------------------------
/ProjectSettings/EditorBuildSettings.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!1045 &1
4 | EditorBuildSettings:
5 | m_ObjectHideFlags: 0
6 | serializedVersion: 2
7 | m_Scenes: []
8 |
--------------------------------------------------------------------------------
/ProjectSettings/NetworkManager.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!149 &1
4 | NetworkManager:
5 | m_ObjectHideFlags: 0
6 | m_DebugLevel: 0
7 | m_Sendrate: 15
8 | m_AssetToPrefab: {}
9 |
--------------------------------------------------------------------------------
/Assets/ClientDataBase/Templates/TableClassProperty.txt:
--------------------------------------------------------------------------------
1 | ///
2 | /// $Summary
3 | ///
4 | $Modifier $Type $Name { get { return _$Name; } set { _$Name = value; } }
5 | [SerializeField]
6 | private $Type _$Name;
--------------------------------------------------------------------------------
/ProjectSettings/TimeManager.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!5 &1
4 | TimeManager:
5 | m_ObjectHideFlags: 0
6 | Fixed Timestep: .0199999996
7 | Maximum Allowed Timestep: .333333343
8 | m_TimeScale: 1
9 |
--------------------------------------------------------------------------------
/Assets/ClientDataBase/Templates/Scriptable.txt.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 025d9160d1158ff498999e666ce40dd1
3 | timeCreated: 1463470260
4 | licenseType: Free
5 | TextScriptImporter:
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Assets/ClientDataBase/Templates/TableClass.txt.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 91daab70a1e6d0a4c9ecc715d1eaee9a
3 | timeCreated: 1463383192
4 | licenseType: Free
5 | TextScriptImporter:
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Assets/ClientDataBase.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 24b4538ca0941c04d9d2dfbdc72f4335
3 | folderAsset: yes
4 | timeCreated: 1472726503
5 | licenseType: Free
6 | DefaultImporter:
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/Assets/ClientDataBase/Templates/ScriptableEditor.txt.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 569fd3161df574e4e82e54f730b643df
3 | timeCreated: 1463561346
4 | licenseType: Free
5 | TextScriptImporter:
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Assets/ClientDataBase/Scripts.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: cf995c77da9775247a7a2e6e2e288915
3 | folderAsset: yes
4 | timeCreated: 1463768453
5 | licenseType: Free
6 | DefaultImporter:
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/Assets/ClientDataBase/Templates/TableClassProperty.txt.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 4aa9f2f5e0b42214d85e139d69be1857
3 | timeCreated: 1463468450
4 | licenseType: Free
5 | TextScriptImporter:
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Assets/ClientDataBase/GameTable.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: a7aa35b937effb8498c453ddbf627da9
3 | folderAsset: yes
4 | timeCreated: 1473144459
5 | licenseType: Free
6 | DefaultImporter:
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/Assets/ClientDataBase/Resources.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 7ae6252161c06ff419b0429320cb6d18
3 | folderAsset: yes
4 | timeCreated: 1473133933
5 | licenseType: Free
6 | DefaultImporter:
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/Assets/ClientDataBase/Resources/Client DataBase Config.asset.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: ec71cb72b7053b549981181f87f2c862
3 | timeCreated: 1472716792
4 | licenseType: Free
5 | NativeFormatImporter:
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Assets/ClientDataBase/Scripts/Base.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 83701d9ebc84eb948aff4d5adca85acf
3 | folderAsset: yes
4 | timeCreated: 1472930864
5 | licenseType: Free
6 | DefaultImporter:
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/Assets/ClientDataBase/Templates.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 55eb7b6fa62e14345984e3b6ee5a472f
3 | folderAsset: yes
4 | timeCreated: 1463383148
5 | licenseType: Free
6 | DefaultImporter:
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/Assets/ClientDataBase/Scripts/Config.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 463355a6738b9df41a3db666d2c8a126
3 | folderAsset: yes
4 | timeCreated: 1472930836
5 | licenseType: Free
6 | DefaultImporter:
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/Assets/ClientDataBase/Scripts/Editor.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: d7aa343e68b7d944aaef800a3a23ca05
3 | folderAsset: yes
4 | timeCreated: 1463382554
5 | licenseType: Free
6 | DefaultImporter:
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/Assets/ClientDataBase/Scripts/Utility.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 078897440e63a4a48b459d60f445953a
3 | folderAsset: yes
4 | timeCreated: 1470975960
5 | licenseType: Free
6 | DefaultImporter:
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/ProjectSettings/UnityAdsSettings.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!292 &1
4 | UnityAdsSettings:
5 | m_ObjectHideFlags: 0
6 | m_Enabled: 0
7 | m_InitializeOnStartup: 1
8 | m_TestMode: 0
9 | m_EnabledPlatforms: 4294967295
10 | m_IosGameId:
11 | m_AndroidGameId:
12 |
--------------------------------------------------------------------------------
/Assets/ClientDataBase/Scripts/Base/TableClassBase.cs:
--------------------------------------------------------------------------------
1 | /**********************************************************
2 | // Author : K.(k79k06k02k)
3 | // FileName : TableClassBase.cs
4 | **********************************************************/
5 | namespace ClientDataBase
6 | {
7 | public class TableClassBase { }
8 | }
9 |
--------------------------------------------------------------------------------
/Assets/ClientDataBase/Scripts/Utility/Utility.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 22dedecb94f134245b51ffac3854c9a6
3 | timeCreated: 1470975946
4 | licenseType: Free
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/Assets/ClientDataBase/Scripts/Base/TableClassBase.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: c04d73d0bb1888b478d0ab1a2fea47a6
3 | timeCreated: 1472228148
4 | licenseType: Free
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/Assets/ClientDataBase/Scripts/ClientDataBaseManager.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: f8396b8ef45a31041bd940fc27cefbb4
3 | timeCreated: 1473134207
4 | licenseType: Free
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/Assets/ClientDataBase/Scripts/Editor/UtilityEditor.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: c45296efb4aecd2409e0bc3838bb6ebf
3 | timeCreated: 1470975871
4 | licenseType: Free
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/Assets/ClientDataBase/Scripts/Utility/Singleton.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 1a082ba5efadaad4f8cf0fd3b7a12f68
3 | timeCreated: 1470975952
4 | licenseType: Free
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/Assets/ClientDataBase/Scripts/Base/ScriptableObjectBase.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: be02cc984091bed4ca343b3428367f71
3 | timeCreated: 1463768298
4 | licenseType: Free
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/Assets/ClientDataBase/Scripts/Editor/ClientDataBaseParse.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: e4f4e344e3689e648a638e87bd4fde45
3 | timeCreated: 1463938499
4 | licenseType: Free
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/Assets/ClientDataBase/Scripts/Config/ClientDataBaseConfig.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 0e5c24b43a199654aa132f2da4e5ac8a
3 | timeCreated: 1472716910
4 | licenseType: Free
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/Assets/ClientDataBase/Scripts/Utility/SerializableDictionary.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 4517f655433205b4db64b221711e8339
3 | timeCreated: 1464036612
4 | licenseType: Free
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/Assets/ClientDataBase/Scripts/Editor/ClientDataBaseConfigEditor.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 4d373a81f9786dc4b96d2d8dbc4f6045
3 | timeCreated: 1472717499
4 | licenseType: Free
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/Assets/ClientDataBase/Scripts/Editor/ClientDataBaseEditorWindow.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 1232fd08b83b9814396d4310f7de760d
3 | timeCreated: 1463382301
4 | licenseType: Free
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/ProjectSettings/UnityConnectSettings.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!310 &1
4 | UnityConnectSettings:
5 | m_ObjectHideFlags: 0
6 | UnityPurchasingSettings:
7 | m_Enabled: 0
8 | m_TestMode: 0
9 | UnityAnalyticsSettings:
10 | m_Enabled: 0
11 | m_InitializeOnStartup: 1
12 | m_TestMode: 0
13 | m_TestEventUrl:
14 | m_TestConfigUrl:
15 |
--------------------------------------------------------------------------------
/ProjectSettings/AudioManager.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!11 &1
4 | AudioManager:
5 | m_ObjectHideFlags: 0
6 | m_Volume: 1
7 | Rolloff Scale: 1
8 | Doppler Factor: 1
9 | Default Speaker Mode: 2
10 | m_SampleRate: 0
11 | m_DSPBufferSize: 0
12 | m_VirtualVoiceCount: 512
13 | m_RealVoiceCount: 32
14 | m_SpatializerPlugin:
15 | m_DisableAudio: 0
16 |
--------------------------------------------------------------------------------
/Assets/ClientDataBase/Scripts/Base/ScriptableObjectBase.cs:
--------------------------------------------------------------------------------
1 | /**********************************************************
2 | // Author : K.(k79k06k02k)
3 | // FileName : ScriptableObjectBase.cs
4 | **********************************************************/
5 | namespace ClientDataBase
6 | {
7 | public abstract class ScriptableObjectBase : UnityEngine.ScriptableObject
8 | {
9 | public abstract bool LoadGameTable();
10 | }
11 | }
12 |
13 |
--------------------------------------------------------------------------------
/Assets/ClientDataBase/Templates/TableClass.txt:
--------------------------------------------------------------------------------
1 | /*****************************************************************************/
2 | /****************** Auto Generate Script, Do Not Modify! *********************/
3 | /*****************************************************************************/
4 | using UnityEngine;
5 | using System.Collections;
6 | using ClientDataBase;
7 |
8 | [System.Serializable]
9 | public class $ClassName : TableClassBase
10 | {
11 | $MemberFields
12 | }
--------------------------------------------------------------------------------
/ProjectSettings/EditorSettings.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!159 &1
4 | EditorSettings:
5 | m_ObjectHideFlags: 0
6 | serializedVersion: 3
7 | m_ExternalVersionControlSupport: Visible Meta Files
8 | m_SerializationMode: 2
9 | m_WebSecurityEmulationEnabled: 0
10 | m_WebSecurityEmulationHostUrl: http://www.mydomain.com/mygame.unity3d
11 | m_DefaultBehaviorMode: 1
12 | m_SpritePackerMode: 2
13 | m_SpritePackerPaddingPower: 1
14 | m_ProjectGenerationIncludedExtensions: txt;xml;fnt;cd
15 | m_ProjectGenerationRootNamespace:
16 |
--------------------------------------------------------------------------------
/ProjectSettings/TagManager.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!78 &1
4 | TagManager:
5 | serializedVersion: 2
6 | tags: []
7 | layers:
8 | - Default
9 | - TransparentFX
10 | - Ignore Raycast
11 | -
12 | - Water
13 | - UI
14 | -
15 | -
16 | -
17 | -
18 | -
19 | -
20 | -
21 | -
22 | -
23 | -
24 | -
25 | -
26 | -
27 | -
28 | -
29 | -
30 | -
31 | -
32 | -
33 | -
34 | -
35 | -
36 | -
37 | -
38 | -
39 | -
40 | m_SortingLayers:
41 | - name: Default
42 | uniqueID: 0
43 | locked: 0
44 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Client DataBase 本地資料庫系統 V0.0.1b
2 |

3 |
4 |
5 | ## Documentation
6 | + [繁體中文](https://github.com/k79k06k02k/ClientDataBase/blob/master/Documentation/zh-tw/zh-tw.md)
7 | + [Engilsh](https://github.com/k79k06k02k/ClientDataBase/blob/master/Documentation/en/en.md)
8 |
9 |
10 | ## Support & Feedback
11 | Blog:[http://k79k06k02k.com/blog](http://k79k06k02k.com/blog)
12 | Facebook:[https://www.facebook.com/k79k06k02k](https://www.facebook.com/k79k06k02k)
13 | Email:k79k06k02k@gmail.com
14 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # =============== #
2 | # Unity generated #
3 | # =============== #
4 | [Tt]emp/
5 | [Oo]bj/
6 | [Bb]uild
7 | [Ll]ibrary/
8 | sysinfo.txt
9 | *.stackdump
10 |
11 | # ===================================== #
12 | # Visual Studio / MonoDevelop generated #
13 | # ===================================== #
14 | [Ee]xported[Oo]bj/
15 | .vs/
16 | /*.userprefs
17 | /*.csproj
18 | /*.pidb
19 | /*.suo
20 | /*.sln*
21 | /*.user
22 | /*.unityproj
23 | /*.booproj
24 |
25 | # ============ #
26 | # OS generated #
27 | # ============ #
28 | .DS_Store*
29 | ._*
30 | .Spotlight-V100
31 | .Trashes
32 | Icon?
33 | ehthumbs.db
34 | [Tt]humbs.db
35 |
36 | # ===== #
37 | # Other #
38 | # ===== #
39 | *.TMP
40 |
--------------------------------------------------------------------------------
/Assets/ClientDataBase/Templates/ScriptableEditor.txt:
--------------------------------------------------------------------------------
1 | /*****************************************************************************/
2 | /****************** Auto Generate Script, Do Not Modify! *********************/
3 | /*****************************************************************************/
4 | using UnityEditor;
5 | using UnityEngine;
6 |
7 | [CustomEditor(typeof($ScriptableName))]
8 | public class $ScriptableEditorName : Editor
9 | {
10 | public override void OnInspectorGUI()
11 | {
12 | $ScriptableName script = ($ScriptableName)target;
13 |
14 | if (GUILayout.Button("Update"))
15 | script.LoadGameTable();
16 |
17 | GUILayout.Space(20);
18 |
19 | DrawDefaultInspector();
20 | }
21 | }
--------------------------------------------------------------------------------
/ProjectSettings/DynamicsManager.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!55 &1
4 | PhysicsManager:
5 | m_ObjectHideFlags: 0
6 | serializedVersion: 2
7 | m_Gravity: {x: 0, y: -9.81000042, z: 0}
8 | m_DefaultMaterial: {fileID: 0}
9 | m_BounceThreshold: 2
10 | m_SleepThreshold: .00499999989
11 | m_DefaultContactOffset: .00999999978
12 | m_SolverIterationCount: 6
13 | m_QueriesHitTriggers: 1
14 | m_EnableAdaptiveForce: 0
15 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
16 |
--------------------------------------------------------------------------------
/Assets/ClientDataBase/Scripts/Utility/Singleton.cs:
--------------------------------------------------------------------------------
1 | /**********************************************************
2 | // Author : K.(k79k06k02k)
3 | // FileName : Singleton.cs
4 | // Reference: http://wiki.unity3d.com/index.php/Singleton
5 | **********************************************************/
6 |
7 | namespace ClientDataBase
8 | {
9 | public class Singleton where T : class, new()
10 | {
11 | private static T _instance;
12 |
13 | private static object _lock = new object();
14 |
15 | public static T Instance
16 | {
17 | get
18 | {
19 | //多執行緒
20 | lock (_lock)
21 | {
22 | if (_instance == null)
23 | {
24 | _instance = new T();
25 | }
26 |
27 | return _instance;
28 | }
29 | }
30 | }
31 | }
32 | }
--------------------------------------------------------------------------------
/Assets/ClientDataBase/Resources/Client DataBase Config.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!114 &11400000
4 | MonoBehaviour:
5 | m_ObjectHideFlags: 0
6 | m_PrefabParentObject: {fileID: 0}
7 | m_PrefabInternal: {fileID: 0}
8 | m_GameObject: {fileID: 0}
9 | m_Enabled: 1
10 | m_EditorHideFlags: 0
11 | m_Script: {fileID: 11500000, guid: 0e5c24b43a199654aa132f2da4e5ac8a, type: 3}
12 | m_Name: Client DataBase Config
13 | m_EditorClassIdentifier:
14 | GameTableCheck: '##'
15 | ROOT: Assets/ClientDataBase/
16 | ScriptTemplatesPath: Templates/
17 | GameTablePath: GameTable/
18 | TableClassPath: Generate/TableClass/
19 | ScriptableAssetPath: Generate/Resources/ClientDataBase/
20 | ScriptableScriptsPath: Generate/Scriptable/Script/
21 | ScriptableEditorPath: Generate/Scriptable/Editor/
22 | ClassNamePrefix: Table
23 | ScriptableAssetSuffix: Asset
24 | ScriptableScriptSuffix: Scriptable
25 | ScriptableEditorSuffix: ScriptableEditor
26 | FileExtensionTXT: .txt
27 | FileExtensionCS: .cs
28 | FileExtensionASSET: .asset
29 |
--------------------------------------------------------------------------------
/ProjectSettings/Physics2DSettings.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!19 &1
4 | Physics2DSettings:
5 | m_ObjectHideFlags: 0
6 | serializedVersion: 2
7 | m_Gravity: {x: 0, y: -9.81000042}
8 | m_DefaultMaterial: {fileID: 0}
9 | m_VelocityIterations: 8
10 | m_PositionIterations: 3
11 | m_VelocityThreshold: 1
12 | m_MaxLinearCorrection: .200000003
13 | m_MaxAngularCorrection: 8
14 | m_MaxTranslationSpeed: 100
15 | m_MaxRotationSpeed: 360
16 | m_MinPenetrationForPenalty: .00999999978
17 | m_BaumgarteScale: .200000003
18 | m_BaumgarteTimeOfImpactScale: .75
19 | m_TimeToSleep: .5
20 | m_LinearSleepTolerance: .00999999978
21 | m_AngularSleepTolerance: 2
22 | m_QueriesHitTriggers: 1
23 | m_QueriesStartInColliders: 1
24 | m_ChangeStopsCallbacks: 0
25 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
26 |
--------------------------------------------------------------------------------
/LICENCE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2016 Arkai
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/ProjectSettings/NavMeshAreas.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!126 &1
4 | NavMeshAreas:
5 | m_ObjectHideFlags: 0
6 | serializedVersion: 2
7 | areas:
8 | - name: Walkable
9 | cost: 1
10 | - name: Not Walkable
11 | cost: 1
12 | - name: Jump
13 | cost: 2
14 | - name:
15 | cost: 1
16 | - name:
17 | cost: 1
18 | - name:
19 | cost: 1
20 | - name:
21 | cost: 1
22 | - name:
23 | cost: 1
24 | - name:
25 | cost: 1
26 | - name:
27 | cost: 1
28 | - name:
29 | cost: 1
30 | - name:
31 | cost: 1
32 | - name:
33 | cost: 1
34 | - name:
35 | cost: 1
36 | - name:
37 | cost: 1
38 | - name:
39 | cost: 1
40 | - name:
41 | cost: 1
42 | - name:
43 | cost: 1
44 | - name:
45 | cost: 1
46 | - name:
47 | cost: 1
48 | - name:
49 | cost: 1
50 | - name:
51 | cost: 1
52 | - name:
53 | cost: 1
54 | - name:
55 | cost: 1
56 | - name:
57 | cost: 1
58 | - name:
59 | cost: 1
60 | - name:
61 | cost: 1
62 | - name:
63 | cost: 1
64 | - name:
65 | cost: 1
66 | - name:
67 | cost: 1
68 | - name:
69 | cost: 1
70 | - name:
71 | cost: 1
72 |
--------------------------------------------------------------------------------
/ProjectSettings/GraphicsSettings.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!30 &1
4 | GraphicsSettings:
5 | m_ObjectHideFlags: 0
6 | serializedVersion: 4
7 | m_Deferred:
8 | m_Mode: 1
9 | m_Shader: {fileID: 69, guid: 0000000000000000f000000000000000, type: 0}
10 | m_DeferredReflections:
11 | m_Mode: 1
12 | m_Shader: {fileID: 74, guid: 0000000000000000f000000000000000, type: 0}
13 | m_LegacyDeferred:
14 | m_Mode: 1
15 | m_Shader: {fileID: 63, guid: 0000000000000000f000000000000000, type: 0}
16 | m_AlwaysIncludedShaders:
17 | - {fileID: 7, guid: 0000000000000000f000000000000000, type: 0}
18 | - {fileID: 15104, guid: 0000000000000000f000000000000000, type: 0}
19 | - {fileID: 15105, guid: 0000000000000000f000000000000000, type: 0}
20 | - {fileID: 15106, guid: 0000000000000000f000000000000000, type: 0}
21 | - {fileID: 10770, guid: 0000000000000000f000000000000000, type: 0}
22 | - {fileID: 10782, guid: 0000000000000000f000000000000000, type: 0}
23 | m_PreloadedShaders: []
24 | m_LightmapStripping: 0
25 | m_LightmapKeepPlain: 1
26 | m_LightmapKeepDirCombined: 1
27 | m_LightmapKeepDirSeparate: 1
28 | m_LightmapKeepDynamicPlain: 1
29 | m_LightmapKeepDynamicDirCombined: 1
30 | m_LightmapKeepDynamicDirSeparate: 1
31 | m_FogStripping: 0
32 | m_FogKeepLinear: 1
33 | m_FogKeepExp: 1
34 | m_FogKeepExp2: 1
35 |
--------------------------------------------------------------------------------
/Assets/ClientDataBase/Scripts/ClientDataBaseManager.cs:
--------------------------------------------------------------------------------
1 | /**********************************************************
2 | // Author : K.(k79k06k02k)
3 | // FileName : ClientDataBaseManager.cs
4 | **********************************************************/
5 | using System.Collections.Generic;
6 | using System;
7 | using ClientDataBase;
8 |
9 | public class ClientDataBaseManager : Singleton
10 | {
11 | const string c_pathConfig = "Client DataBase Config";
12 | const string c_pathScriptableAssetRoot = "ClientDataBase/";
13 |
14 | ClientDataBaseConfig _config;
15 | public ClientDataBaseConfig m_config
16 | {
17 | get
18 | {
19 | if (_config == null)
20 | _config = Utility.AssetRelate.ResourcesLoadCheckNull(c_pathConfig);
21 |
22 | return _config;
23 | }
24 | }
25 |
26 |
27 | public Dictionary m_tableList = new Dictionary();
28 |
29 | public ClientDataBaseManager()
30 | {
31 | }
32 |
33 | ScriptableObjectBase LoadTable(string fileName)
34 | {
35 | return Utility.AssetRelate.ResourcesLoadCheckNull(c_pathScriptableAssetRoot + m_config.GetScriptableAssetName(fileName));
36 | }
37 |
38 | void Register(Type type, ScriptableObjectBase dataBase)
39 | {
40 | m_tableList.Add(type, dataBase);
41 | }
42 |
43 | public T GetTable() where T : ScriptableObjectBase, new()
44 | {
45 | if (m_tableList.ContainsKey(typeof(T)))
46 | {
47 | return (T)m_tableList[typeof(T)];
48 | }
49 |
50 | return default(T);
51 | }
52 | }
53 |
54 |
--------------------------------------------------------------------------------
/Assets/ClientDataBase/Scripts/Utility/Utility.cs:
--------------------------------------------------------------------------------
1 | /**********************************************************
2 | // Author : K.(k79k06k02k)
3 | // FileName : Utility.cs
4 | **********************************************************/
5 | using UnityEngine;
6 |
7 | namespace ClientDataBase
8 | {
9 | public class Utility
10 | {
11 | public struct TypeRelate
12 | {
13 | public static bool StringToBool(string value)
14 | {
15 | if (value == "T")
16 | return true;
17 | else if (value == "F")
18 | return false;
19 | else
20 | {
21 | Debug.LogError(string.Format("Unable to convert value:[{0}]", value));
22 | return false;
23 | }
24 | }
25 | public static Vector2 StringToVector2(string value)
26 | {
27 | string[] str = value.Split(',');
28 | return new Vector2(float.Parse(str[0]), float.Parse(str[1]));
29 | }
30 | public static Vector3 StringToVector3(string value)
31 | {
32 | string[] str = value.Split(',');
33 | return new Vector3(float.Parse(str[0]), float.Parse(str[1]), float.Parse(str[2]));
34 | }
35 | }
36 |
37 |
38 | public struct AssetRelate
39 | {
40 | ///
41 | /// Resources.Load 並檢查是否null
42 | ///
43 | public static T ResourcesLoadCheckNull(string name) where T : UnityEngine.Object
44 | {
45 | T loadGo = Resources.Load(name);
46 |
47 | if (loadGo == null)
48 | {
49 | Debug.LogError("Resources.Load [ " + name + " ] is Null !!");
50 | return default(T);
51 | }
52 |
53 | return loadGo;
54 | }
55 | }
56 | }
57 | }
--------------------------------------------------------------------------------
/Assets/ClientDataBase/Templates/Scriptable.txt:
--------------------------------------------------------------------------------
1 | /*****************************************************************************/
2 | /****************** Auto Generate Script, Do Not Modify! *********************/
3 | /*****************************************************************************/
4 | using System;
5 | using UnityEngine;
6 | using ClientDataBase;
7 |
8 | #if UNITY_EDITOR
9 | using System.IO;
10 | using UnityEditor;
11 | #endif
12 |
13 | [Serializable]
14 | public class Dictionary$ClassName : SerializableDictionary { }
15 |
16 |
17 | public class $ScriptableName : ScriptableObjectBase
18 | {
19 | public static string m_gameTableName = "$GameTableName";
20 | public Dictionary$ClassName m_tableDict = new Dictionary$ClassName();
21 |
22 | ClientDataBaseConfig _clientDataBaseConfig;
23 |
24 | #if UNITY_EDITOR
25 | string path;
26 |
27 | public override bool LoadGameTable()
28 | {
29 | m_tableDict.Clear();
30 |
31 | _clientDataBaseConfig = ClientDataBaseManager.Instance.m_config;
32 | path = _clientDataBaseConfig.GetGameTablePathName(m_gameTableName);
33 |
34 | TextAsset data = AssetDatabase.LoadAssetAtPath(path);
35 | StringReader reader = null;
36 | int index = 0;
37 | string strTemp;
38 |
39 | if (data == null)
40 | {
41 | Debug.LogError(string.Format("Can't found GameTable txt file in [Path:{0}]", path));
42 | return false;
43 | }
44 |
45 | reader = new StringReader(data.text);
46 |
47 | if (reader != null)
48 | {
49 | while ((strTemp = reader.ReadLine()) != null)
50 | {
51 | if (index <= 2)
52 | {
53 | index++;
54 | continue;
55 | }
56 |
57 | string[] splitStr = strTemp.Split("\t"[0]);
58 |
59 | $ClassName table = new $ClassName();
60 | try
61 | {
62 | $DataLoad
63 | }
64 | catch (FormatException e)
65 | {
66 | string obvious = string.Empty;
67 | string[] log = e.StackTrace.Split('\n');
68 | for (int i = 0; i < log.Length; i++)
69 | {
70 | if (log[i].IndexOf(this.GetType().Name) > 0)
71 | {
72 | obvious = log[i];
73 | break;
74 | }
75 | }
76 |
77 | Debug.LogError(string.Format("{0} \n{1} \n\nStackTrace:{2}", e.Message, obvious, e.StackTrace));
78 | return false;
79 | }
80 |
81 | m_tableDict.Add(table.id, table);
82 |
83 | index++;
84 | }
85 |
86 | reader.Close();
87 | }
88 |
89 | EditorUtility.SetDirty(this);
90 | AssetDatabase.SaveAssets();
91 |
92 | Debug.Log(string.Format("[{0}] GameTable Asset is Update. Source:[{1}]", this.name, path));
93 | return true;
94 | }
95 |
96 | #else
97 | public override bool LoadGameTable() { return false; }
98 | #endif
99 |
100 | public $ClassName GetData(string id)
101 | {
102 | if (m_tableDict.ContainsKey(id))
103 | {
104 | return m_tableDict[id];
105 | }
106 | else
107 | {
108 | Debug.LogWarning(string.Format("[{0}] GameTable Asset Dictionary Can't found key [{1}]", this.name, id));
109 | return null;
110 | }
111 | }
112 | }
--------------------------------------------------------------------------------
/Assets/ClientDataBase/Scripts/Editor/ClientDataBaseConfigEditor.cs:
--------------------------------------------------------------------------------
1 | /**********************************************************
2 | // Author : K.(k79k06k02k)
3 | // FileName : ClientDataBaseConfigEditor.cs
4 | **********************************************************/
5 | using UnityEngine;
6 | using UnityEditor;
7 |
8 | namespace ClientDataBase
9 | {
10 | [CustomEditor(typeof(ClientDataBaseConfig))]
11 | public class ClientDataBaseConfigEditor : Editor
12 | {
13 | ClientDataBaseConfig _script;
14 |
15 | public override void OnInspectorGUI()
16 | {
17 | _script = target as ClientDataBaseConfig;
18 |
19 | GUILayout.Space(15);
20 | EditorGUILayout.BeginVertical(GUI.skin.box);
21 | EditorGUILayout.LabelField("Check", EditorStyles.boldLabel);
22 | _script.m_gameTableCheck = DrawNormalField("Game Table Check", _script.m_gameTableCheck);
23 | EditorGUILayout.EndVertical();
24 |
25 |
26 | GUILayout.Space(15);
27 | EditorGUILayout.BeginVertical(GUI.skin.box);
28 | EditorGUILayout.LabelField("Path", EditorStyles.boldLabel);
29 | _script.m_root = DrawNormalField("ROOT", _script.m_root);
30 | _script.m_pathScriptTemplates = DrawPathField("Script Templates Path", _script.m_pathScriptTemplates);
31 | _script.m_pathGameTable = DrawPathField("Game Table Path", _script.m_pathGameTable);
32 | _script.m_pathTableClass = DrawPathField("Table Class Path", _script.m_pathTableClass);
33 | _script.m_pathScriptableAsset = DrawPathField("Scriptable Asset Path", _script.m_pathScriptableAsset);
34 | _script.m_pathScriptableScripts = DrawPathField("Scriptable Scripts Path", _script.m_pathScriptableScripts);
35 | _script.m_pathScriptableEditor = DrawPathField("Scriptable Editor Path", _script.m_pathScriptableEditor);
36 | EditorGUILayout.EndVertical();
37 |
38 |
39 | GUILayout.Space(15);
40 | EditorGUILayout.BeginVertical(GUI.skin.box);
41 | EditorGUILayout.LabelField("Name", EditorStyles.boldLabel);
42 | _script.m_nameClassPrefix = DrawNameField("Class Name Prefix", "Preview: " + _script.m_nameClassPrefix + "[FileName]", _script.m_nameClassPrefix);
43 | _script.m_nameScriptableAssetSuffix = DrawNameField("Scriptable Asset Suffix", "Preview: " + _script.m_nameClassPrefix + "[FileName]" + _script.m_nameScriptableAssetSuffix, _script.m_nameScriptableAssetSuffix);
44 | _script.m_nameScriptableScriptSuffix = DrawNameField("Scriptable Script Suffix", "Preview: " + _script.m_nameClassPrefix + "[FileName]" + _script.m_nameScriptableScriptSuffix, _script.m_nameScriptableScriptSuffix);
45 | _script.m_nameScriptableEditorSuffix = DrawNameField("Scriptable Editor Suffix", "Preview: " + _script.m_nameClassPrefix + "[FileName]" + _script.m_nameScriptableEditorSuffix, _script.m_nameScriptableEditorSuffix);
46 | EditorGUILayout.EndVertical();
47 |
48 | EditorUtility.SetDirty(_script);
49 | }
50 |
51 | string DrawNormalField(string name, string field)
52 | {
53 | EditorGUILayout.BeginHorizontal();
54 | EditorGUILayout.LabelField(name, GUILayout.Width(160));
55 | field = EditorGUILayout.TextField(field);
56 | EditorGUILayout.EndHorizontal();
57 |
58 | return field;
59 | }
60 |
61 | string DrawPathField(string name, string field)
62 | {
63 | EditorGUILayout.BeginHorizontal();
64 | EditorGUILayout.LabelField(name, GUILayout.Width(160));
65 | EditorGUILayout.LabelField("ROOT +", GUILayout.Width(50));
66 | field = EditorGUILayout.TextField(field);
67 | EditorGUILayout.EndHorizontal();
68 |
69 | return field;
70 | }
71 |
72 | string DrawNameField(string name, string preview, string field)
73 | {
74 | EditorGUILayout.BeginHorizontal();
75 | EditorGUILayout.LabelField(name, GUILayout.Width(160));
76 | field = EditorGUILayout.TextField(field);
77 | EditorGUILayout.EndHorizontal();
78 |
79 |
80 | EditorGUILayout.BeginHorizontal();
81 | EditorGUILayout.LabelField("", GUILayout.Width(160));
82 | EditorGUILayout.LabelField(preview);
83 | EditorGUILayout.EndHorizontal();
84 |
85 | GUILayout.Space(10);
86 |
87 |
88 | return field;
89 | }
90 |
91 | }
92 | }
--------------------------------------------------------------------------------
/Assets/ClientDataBase/Scripts/Config/ClientDataBaseConfig.cs:
--------------------------------------------------------------------------------
1 | /**********************************************************
2 | // Author : K.(k79k06k02k)
3 | // FileName : ClientDataBaseConfig.cs
4 | **********************************************************/
5 | namespace ClientDataBase
6 | {
7 | public class ClientDataBaseConfig : UnityEngine.ScriptableObject
8 | {
9 | ///
10 | /// GameTable 識別字串,判斷方式是與資料一開始的字串做比對
11 | ///
12 | public string m_gameTableCheck = "##";
13 |
14 |
15 | public string m_root = "Assets/ClientDataBase/";
16 |
17 | ///
18 | /// Script Templates 存放路徑
19 | ///
20 | public string m_pathScriptTemplates = "Templates/";
21 |
22 | ///
23 | /// 資料表(txt) 存放路徑
24 | ///
25 | public string m_pathGameTable = "GameTable/";
26 |
27 | ///
28 | /// 資料類別 存放路徑
29 | ///
30 | public string m_pathTableClass = "Generate/TableClass/";
31 |
32 | ///
33 | /// Scriptable Asset 存放路徑
34 | ///
35 | public string m_pathScriptableAsset = "Generate/Resources/ClientDataBase/";
36 |
37 | ///
38 | /// Scriptable Script 存放路徑
39 | ///
40 | public string m_pathScriptableScripts = "Generate/Scriptable/Script/";
41 |
42 | ///
43 | /// Scriptable Editor Script 存放路徑
44 | ///
45 | public string m_pathScriptableEditor = "Generate/Scriptable/Editor/";
46 |
47 |
48 | ///
49 | /// 類別名稱 前綴
50 | /// EX: Table[FileName]
51 | ///
52 | public string m_nameClassPrefix = "Table";
53 |
54 | ///
55 | /// Scriptable Asset 後綴
56 | /// EX: Table[FileName]Asset
57 | ///
58 | public string m_nameScriptableAssetSuffix = "Asset";
59 |
60 | ///
61 | /// Scriptable Script 後綴
62 | /// EX: Table[FileName]Scriptable
63 | ///
64 | public string m_nameScriptableScriptSuffix = "Scriptable";
65 |
66 | ///
67 | /// Scriptable Editor 後綴
68 | /// EX: Table[FileName]ScriptableEditor
69 | ///
70 | public string m_nameScriptableEditorSuffix = "ScriptableEditor";
71 |
72 |
73 | ///
74 | /// 附檔名 .cs
75 | ///
76 | public string m_extensionTxt = ".txt";
77 |
78 | ///
79 | /// 附檔名 .cs
80 | ///
81 | public string m_extensionCs = ".cs";
82 |
83 | ///
84 | /// 附檔名 .asset
85 | ///
86 | public string m_extensionAsset = ".asset";
87 |
88 |
89 | public string GetTemplatePathName(string name)
90 | {
91 | return m_root + m_pathScriptTemplates + name + m_extensionTxt;
92 | }
93 |
94 | public string GetGameTablePathName(string name)
95 | {
96 | return m_root + m_pathGameTable + name + m_extensionTxt;
97 | }
98 |
99 | public string GetGameTablePath()
100 | {
101 | return m_root + m_pathGameTable;
102 | }
103 |
104 | public string GetTableClassPath()
105 | {
106 | return m_root + m_pathTableClass;
107 | }
108 |
109 | public string GetScriptableAssetPath()
110 | {
111 | return m_root + m_pathScriptableAsset;
112 | }
113 |
114 | public string GetScriptableScriptsPath()
115 | {
116 | return m_root + m_pathScriptableScripts;
117 | }
118 |
119 | public string GetScriptableEditorPath()
120 | {
121 | return m_root + m_pathScriptableEditor;
122 | }
123 |
124 |
125 |
126 | public string GetTableClassScriptName(string fileName, bool boolExtension = false)
127 | {
128 | return m_nameClassPrefix + fileName + (boolExtension ? m_extensionCs : "");
129 | }
130 |
131 | public string GetScriptableScriptName(string fileName, bool boolExtension = false)
132 | {
133 | return m_nameClassPrefix + fileName + m_nameScriptableScriptSuffix + (boolExtension ? m_extensionCs : "");
134 | }
135 |
136 | public string GetScriptableScriptEditorName(string fileName, bool boolExtension = false)
137 | {
138 | return m_nameClassPrefix + fileName + m_nameScriptableEditorSuffix + (boolExtension ? m_extensionCs : "");
139 | }
140 |
141 | public string GetScriptableAssetName(string fileName, bool boolExtension = false)
142 | {
143 | return m_nameClassPrefix + fileName + m_nameScriptableAssetSuffix + (boolExtension ? m_extensionAsset : "");
144 | }
145 | }
146 | }
147 |
--------------------------------------------------------------------------------
/ProjectSettings/QualitySettings.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!47 &1
4 | QualitySettings:
5 | m_ObjectHideFlags: 0
6 | serializedVersion: 5
7 | m_CurrentQuality: 5
8 | m_QualitySettings:
9 | - serializedVersion: 2
10 | name: Fastest
11 | pixelLightCount: 0
12 | shadows: 0
13 | shadowResolution: 0
14 | shadowProjection: 1
15 | shadowCascades: 1
16 | shadowDistance: 15
17 | shadowNearPlaneOffset: 2
18 | shadowCascade2Split: .333333343
19 | shadowCascade4Split: {x: .0666666701, y: .200000003, z: .466666669}
20 | blendWeights: 1
21 | textureQuality: 1
22 | anisotropicTextures: 0
23 | antiAliasing: 0
24 | softParticles: 0
25 | softVegetation: 0
26 | realtimeReflectionProbes: 0
27 | billboardsFaceCameraPosition: 0
28 | vSyncCount: 0
29 | lodBias: .300000012
30 | maximumLODLevel: 0
31 | particleRaycastBudget: 4
32 | excludedTargetPlatforms: []
33 | - serializedVersion: 2
34 | name: Fast
35 | pixelLightCount: 0
36 | shadows: 0
37 | shadowResolution: 0
38 | shadowProjection: 1
39 | shadowCascades: 1
40 | shadowDistance: 20
41 | shadowNearPlaneOffset: 2
42 | shadowCascade2Split: .333333343
43 | shadowCascade4Split: {x: .0666666701, y: .200000003, z: .466666669}
44 | blendWeights: 2
45 | textureQuality: 0
46 | anisotropicTextures: 0
47 | antiAliasing: 0
48 | softParticles: 0
49 | softVegetation: 0
50 | realtimeReflectionProbes: 0
51 | billboardsFaceCameraPosition: 0
52 | vSyncCount: 0
53 | lodBias: .400000006
54 | maximumLODLevel: 0
55 | particleRaycastBudget: 16
56 | excludedTargetPlatforms: []
57 | - serializedVersion: 2
58 | name: Simple
59 | pixelLightCount: 1
60 | shadows: 1
61 | shadowResolution: 0
62 | shadowProjection: 1
63 | shadowCascades: 1
64 | shadowDistance: 20
65 | shadowNearPlaneOffset: 2
66 | shadowCascade2Split: .333333343
67 | shadowCascade4Split: {x: .0666666701, y: .200000003, z: .466666669}
68 | blendWeights: 2
69 | textureQuality: 0
70 | anisotropicTextures: 1
71 | antiAliasing: 0
72 | softParticles: 0
73 | softVegetation: 0
74 | realtimeReflectionProbes: 0
75 | billboardsFaceCameraPosition: 0
76 | vSyncCount: 0
77 | lodBias: .699999988
78 | maximumLODLevel: 0
79 | particleRaycastBudget: 64
80 | excludedTargetPlatforms: []
81 | - serializedVersion: 2
82 | name: Good
83 | pixelLightCount: 2
84 | shadows: 2
85 | shadowResolution: 1
86 | shadowProjection: 1
87 | shadowCascades: 2
88 | shadowDistance: 40
89 | shadowNearPlaneOffset: 2
90 | shadowCascade2Split: .333333343
91 | shadowCascade4Split: {x: .0666666701, y: .200000003, z: .466666669}
92 | blendWeights: 2
93 | textureQuality: 0
94 | anisotropicTextures: 1
95 | antiAliasing: 0
96 | softParticles: 0
97 | softVegetation: 1
98 | realtimeReflectionProbes: 1
99 | billboardsFaceCameraPosition: 1
100 | vSyncCount: 1
101 | lodBias: 1
102 | maximumLODLevel: 0
103 | particleRaycastBudget: 256
104 | excludedTargetPlatforms: []
105 | - serializedVersion: 2
106 | name: Beautiful
107 | pixelLightCount: 3
108 | shadows: 2
109 | shadowResolution: 2
110 | shadowProjection: 1
111 | shadowCascades: 2
112 | shadowDistance: 70
113 | shadowNearPlaneOffset: 2
114 | shadowCascade2Split: .333333343
115 | shadowCascade4Split: {x: .0666666701, y: .200000003, z: .466666669}
116 | blendWeights: 4
117 | textureQuality: 0
118 | anisotropicTextures: 2
119 | antiAliasing: 2
120 | softParticles: 1
121 | softVegetation: 1
122 | realtimeReflectionProbes: 1
123 | billboardsFaceCameraPosition: 1
124 | vSyncCount: 1
125 | lodBias: 1.5
126 | maximumLODLevel: 0
127 | particleRaycastBudget: 1024
128 | excludedTargetPlatforms: []
129 | - serializedVersion: 2
130 | name: Fantastic
131 | pixelLightCount: 4
132 | shadows: 2
133 | shadowResolution: 2
134 | shadowProjection: 1
135 | shadowCascades: 4
136 | shadowDistance: 150
137 | shadowNearPlaneOffset: 2
138 | shadowCascade2Split: .333333343
139 | shadowCascade4Split: {x: .0666666701, y: .200000003, z: .466666669}
140 | blendWeights: 4
141 | textureQuality: 0
142 | anisotropicTextures: 2
143 | antiAliasing: 2
144 | softParticles: 1
145 | softVegetation: 1
146 | realtimeReflectionProbes: 1
147 | billboardsFaceCameraPosition: 1
148 | vSyncCount: 1
149 | lodBias: 2
150 | maximumLODLevel: 0
151 | particleRaycastBudget: 4096
152 | excludedTargetPlatforms: []
153 | m_PerPlatformDefaultQuality:
154 | Android: 2
155 | BlackBerry: 2
156 | GLES Emulation: 5
157 | Nintendo 3DS: 5
158 | PS3: 5
159 | PS4: 5
160 | PSM: 5
161 | PSP2: 2
162 | Samsung TV: 2
163 | Standalone: 5
164 | Tizen: 2
165 | WP8: 5
166 | Web: 5
167 | WebGL: 3
168 | Wii U: 5
169 | Windows Store Apps: 5
170 | XBOX360: 5
171 | XboxOne: 5
172 | iPhone: 2
173 |
--------------------------------------------------------------------------------
/Assets/ClientDataBase/Scripts/Editor/UtilityEditor.cs:
--------------------------------------------------------------------------------
1 | /**********************************************************
2 | // Author : K.(k79k06k02k)
3 | // FileName : UtilityEditor.cs
4 | **********************************************************/
5 | using UnityEngine;
6 | using UnityEditor;
7 |
8 | namespace ClientDataBase
9 | {
10 | public class UtilityEditor
11 | {
12 | ///
13 | /// 建立資料夾,自動建子資料夾
14 | /// EX: GameResources/Prefabs/Sprites/Enemy
15 | ///
16 | /// 路徑層級,從 Assets 下一層資料夾開始
17 | /// 資料夾是否存在
18 | public static bool CreateFolder(string name)
19 | {
20 | //路徑字串開頭如果是 Assets,進行剃除
21 | if (name.StartsWith("Assets/"))
22 | name = name.Replace("Assets/", "");
23 |
24 | //路徑字串最後如果有 / ,進行剃除
25 | if (name[name.Length - 1] == '/')
26 | name = name.Substring(0, name.Length - 1);
27 |
28 |
29 | if (System.IO.Directory.Exists(Application.dataPath + "/" + name))
30 | {
31 | //Debug.Log("Folder [ Assets/" + name + " ] is Exist!!");
32 | return false;
33 | }
34 | else
35 | {
36 | System.IO.Directory.CreateDirectory(Application.dataPath + "/" + name);
37 | AssetDatabase.Refresh();
38 |
39 | //Debug.Log("Folder [ Assets/" + name + " ] is Create!!");
40 | return true;
41 | }
42 | }
43 |
44 |
45 | ///
46 | /// 通用按鈕
47 | ///
48 | /// 按鈕名稱
49 | /// 是否按下
50 | public static bool GetCommonButton(string btnName)
51 | {
52 | GUIStyle BtnStyle = new GUIStyle(GUI.skin.button);
53 | BtnStyle.fontSize = 25;
54 | BtnStyle.fixedHeight = 50;
55 |
56 | return GUILayout.Button(btnName, BtnStyle);
57 | }
58 |
59 |
60 | ///
61 | /// 橫向頁籤
62 | ///
63 | /// 名稱
64 | /// 選擇的index
65 | /// 選擇的index
66 | public static int Tabs(string[] options, int selected)
67 | {
68 | const float DarkGray = 0.6f;
69 | const float LightGray = 0.9f;
70 | const float StartSpace = 10;
71 |
72 | GUILayout.Space(StartSpace);
73 | Color storeColor = GUI.backgroundColor;
74 | Color highlightCol = new Color(LightGray, LightGray, LightGray);
75 | Color bgCol = new Color(DarkGray, DarkGray, DarkGray);
76 |
77 | GUIStyle buttonStyle = new GUIStyle(GUI.skin.button);
78 | buttonStyle.padding.bottom = 8;
79 |
80 | GUILayout.BeginHorizontal();
81 | {
82 | for (int i = 0; i < options.Length; ++i)
83 | {
84 | GUI.backgroundColor = i == selected ? highlightCol : bgCol;
85 | if (GUILayout.Button(options[i], buttonStyle))
86 | {
87 | selected = i;
88 | }
89 | }
90 | }
91 | GUILayout.EndHorizontal();
92 |
93 | GUI.backgroundColor = storeColor;
94 |
95 | var texture = new Texture2D(1, 1);
96 | texture.SetPixel(0, 0, highlightCol);
97 | texture.Apply();
98 | GUI.DrawTexture(new Rect(0, buttonStyle.lineHeight + buttonStyle.border.top + buttonStyle.margin.top + StartSpace, Screen.width, 4), texture);
99 |
100 | return selected;
101 | }
102 |
103 | ///
104 | /// 顯示Loading畫面
105 | ///
106 | public static void ShowLoading()
107 | {
108 | var texture = new Texture2D(1, 1);
109 | texture.SetPixel(0, 0, new Color(0, 0, 0, 0.6f));
110 | texture.Apply();
111 | GUI.DrawTexture(new Rect(0, 0, Screen.width, Screen.height), texture);
112 |
113 | GUIStyle LableStyle = new GUIStyle(GUI.skin.label);
114 | LableStyle.fontSize = 40;
115 | LableStyle.alignment = TextAnchor.MiddleCenter;
116 | GUI.Label(new Rect(0, 0, Screen.width, Screen.height), "Loading...", LableStyle);
117 | }
118 |
119 | ///
120 | /// 讀取路徑下所有資料
121 | ///
122 | /// 路徑
123 | public static Object[] LoadAllAssetsAtPath(string path)
124 | {
125 | if (path.EndsWith("/"))
126 | {
127 | path = path.TrimEnd('/');
128 | }
129 | string[] GUIDs = AssetDatabase.FindAssets("", new string[] { path });
130 | Object[] objectList = new Object[GUIDs.Length];
131 | for (int index = 0; index < GUIDs.Length; index++)
132 | {
133 | string guid = GUIDs[index];
134 | string assetPath = AssetDatabase.GUIDToAssetPath(guid);
135 | Object asset = AssetDatabase.LoadAssetAtPath(assetPath, typeof(Object)) as Object;
136 | objectList[index] = asset;
137 | }
138 |
139 | return objectList;
140 | }
141 |
142 | }
143 | }
144 |
145 |
--------------------------------------------------------------------------------
/Assets/ClientDataBase/Scripts/Utility/SerializableDictionary.cs:
--------------------------------------------------------------------------------
1 | /**********************************************************
2 | // Author : K.(k79k06k02k)
3 | // FileName : SerializableDictionary.cs
4 | **********************************************************/
5 | using System.Collections.Generic;
6 | using System.Linq;
7 |
8 | namespace ClientDataBase
9 | {
10 | [System.Serializable()]
11 | public class SerializableDictionary : IDictionary, UnityEngine.ISerializationCallbackReceiver
12 | {
13 |
14 | #region Fields
15 |
16 | [System.NonSerialized()]
17 | private Dictionary _dict;
18 |
19 | #endregion
20 |
21 | #region IDictionary Interface
22 |
23 | public int Count
24 | {
25 | get { return (_dict != null) ? _dict.Count : 0; }
26 | }
27 |
28 | public void Add(TKey key, TValue value)
29 | {
30 | if (_dict == null) _dict = new Dictionary();
31 | _dict.Add(key, value);
32 | }
33 |
34 | public bool ContainsKey(TKey key)
35 | {
36 | if (_dict == null) return false;
37 | return _dict.ContainsKey(key);
38 | }
39 |
40 | public ICollection Keys
41 | {
42 | get
43 | {
44 | if (_dict == null) _dict = new Dictionary();
45 | return _dict.Keys;
46 | }
47 | }
48 |
49 | public bool Remove(TKey key)
50 | {
51 | if (_dict == null) return false;
52 | return _dict.Remove(key);
53 | }
54 |
55 | public bool TryGetValue(TKey key, out TValue value)
56 | {
57 | if (_dict == null)
58 | {
59 | value = default(TValue);
60 | return false;
61 | }
62 | return _dict.TryGetValue(key, out value);
63 | }
64 |
65 | public ICollection Values
66 | {
67 | get
68 | {
69 | if (_dict == null) _dict = new Dictionary();
70 | return _dict.Values;
71 | }
72 | }
73 |
74 | public TValue this[TKey key]
75 | {
76 | get
77 | {
78 | if (_dict == null) throw new KeyNotFoundException();
79 | return _dict[key];
80 | }
81 | set
82 | {
83 | if (_dict == null) _dict = new Dictionary();
84 | _dict[key] = value;
85 | }
86 | }
87 |
88 | public void Clear()
89 | {
90 | if (_dict != null) _dict.Clear();
91 | }
92 |
93 | void ICollection>.Add(KeyValuePair item)
94 | {
95 | if (_dict == null) _dict = new Dictionary();
96 | (_dict as ICollection>).Add(item);
97 | }
98 |
99 | bool ICollection>.Contains(KeyValuePair item)
100 | {
101 | if (_dict == null) return false;
102 | return (_dict as ICollection>).Contains(item);
103 | }
104 |
105 | void ICollection>.CopyTo(KeyValuePair[] array, int arrayIndex)
106 | {
107 | if (_dict == null) return;
108 | (_dict as ICollection>).CopyTo(array, arrayIndex);
109 | }
110 |
111 | bool ICollection>.Remove(KeyValuePair item)
112 | {
113 | if (_dict == null) return false;
114 | return (_dict as ICollection>).Remove(item);
115 | }
116 |
117 | bool ICollection>.IsReadOnly
118 | {
119 | get { return false; }
120 | }
121 |
122 | public Dictionary.Enumerator GetEnumerator()
123 | {
124 | if (_dict == null) return default(Dictionary.Enumerator);
125 | return _dict.GetEnumerator();
126 | }
127 |
128 | System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
129 | {
130 | if (_dict == null) return Enumerable.Empty>().GetEnumerator();
131 | return _dict.GetEnumerator();
132 | }
133 |
134 | IEnumerator> IEnumerable>.GetEnumerator()
135 | {
136 | if (_dict == null) return Enumerable.Empty>().GetEnumerator();
137 | return _dict.GetEnumerator();
138 | }
139 |
140 | #endregion
141 |
142 | #region ISerializationCallbackReceiver
143 |
144 | [UnityEngine.SerializeField()]
145 | private TKey[] _keys;
146 | [UnityEngine.SerializeField()]
147 | private TValue[] _values;
148 |
149 | void UnityEngine.ISerializationCallbackReceiver.OnAfterDeserialize()
150 | {
151 | if (_keys != null && _values != null)
152 | {
153 | if (_dict == null) _dict = new Dictionary(_keys.Length);
154 | else _dict.Clear();
155 | for (int i = 0; i < _keys.Length; i++)
156 | {
157 | if (i < _values.Length)
158 | _dict[_keys[i]] = _values[i];
159 | else
160 | _dict[_keys[i]] = default(TValue);
161 | }
162 | }
163 |
164 | _keys = null;
165 | _values = null;
166 | }
167 |
168 | void UnityEngine.ISerializationCallbackReceiver.OnBeforeSerialize()
169 | {
170 | if (_dict == null || _dict.Count == 0)
171 | {
172 | _keys = null;
173 | _values = null;
174 | }
175 | else
176 | {
177 | int cnt = _dict.Count;
178 | _keys = new TKey[cnt];
179 | _values = new TValue[cnt];
180 | int i = 0;
181 | var e = _dict.GetEnumerator();
182 | while (e.MoveNext())
183 | {
184 | _keys[i] = e.Current.Key;
185 | _values[i] = e.Current.Value;
186 | i++;
187 | }
188 | }
189 | }
190 |
191 | #endregion
192 |
193 | }
194 | }
--------------------------------------------------------------------------------
/ProjectSettings/InputManager.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!13 &1
4 | InputManager:
5 | m_ObjectHideFlags: 0
6 | serializedVersion: 2
7 | m_Axes:
8 | - serializedVersion: 3
9 | m_Name: Horizontal
10 | descriptiveName:
11 | descriptiveNegativeName:
12 | negativeButton: left
13 | positiveButton: right
14 | altNegativeButton: a
15 | altPositiveButton: d
16 | gravity: 3
17 | dead: .00100000005
18 | sensitivity: 3
19 | snap: 1
20 | invert: 0
21 | type: 0
22 | axis: 0
23 | joyNum: 0
24 | - serializedVersion: 3
25 | m_Name: Vertical
26 | descriptiveName:
27 | descriptiveNegativeName:
28 | negativeButton: down
29 | positiveButton: up
30 | altNegativeButton: s
31 | altPositiveButton: w
32 | gravity: 3
33 | dead: .00100000005
34 | sensitivity: 3
35 | snap: 1
36 | invert: 0
37 | type: 0
38 | axis: 0
39 | joyNum: 0
40 | - serializedVersion: 3
41 | m_Name: Fire1
42 | descriptiveName:
43 | descriptiveNegativeName:
44 | negativeButton:
45 | positiveButton: left ctrl
46 | altNegativeButton:
47 | altPositiveButton: mouse 0
48 | gravity: 1000
49 | dead: .00100000005
50 | sensitivity: 1000
51 | snap: 0
52 | invert: 0
53 | type: 0
54 | axis: 0
55 | joyNum: 0
56 | - serializedVersion: 3
57 | m_Name: Fire2
58 | descriptiveName:
59 | descriptiveNegativeName:
60 | negativeButton:
61 | positiveButton: left alt
62 | altNegativeButton:
63 | altPositiveButton: mouse 1
64 | gravity: 1000
65 | dead: .00100000005
66 | sensitivity: 1000
67 | snap: 0
68 | invert: 0
69 | type: 0
70 | axis: 0
71 | joyNum: 0
72 | - serializedVersion: 3
73 | m_Name: Fire3
74 | descriptiveName:
75 | descriptiveNegativeName:
76 | negativeButton:
77 | positiveButton: left shift
78 | altNegativeButton:
79 | altPositiveButton: mouse 2
80 | gravity: 1000
81 | dead: .00100000005
82 | sensitivity: 1000
83 | snap: 0
84 | invert: 0
85 | type: 0
86 | axis: 0
87 | joyNum: 0
88 | - serializedVersion: 3
89 | m_Name: Jump
90 | descriptiveName:
91 | descriptiveNegativeName:
92 | negativeButton:
93 | positiveButton: space
94 | altNegativeButton:
95 | altPositiveButton:
96 | gravity: 1000
97 | dead: .00100000005
98 | sensitivity: 1000
99 | snap: 0
100 | invert: 0
101 | type: 0
102 | axis: 0
103 | joyNum: 0
104 | - serializedVersion: 3
105 | m_Name: Mouse X
106 | descriptiveName:
107 | descriptiveNegativeName:
108 | negativeButton:
109 | positiveButton:
110 | altNegativeButton:
111 | altPositiveButton:
112 | gravity: 0
113 | dead: 0
114 | sensitivity: .100000001
115 | snap: 0
116 | invert: 0
117 | type: 1
118 | axis: 0
119 | joyNum: 0
120 | - serializedVersion: 3
121 | m_Name: Mouse Y
122 | descriptiveName:
123 | descriptiveNegativeName:
124 | negativeButton:
125 | positiveButton:
126 | altNegativeButton:
127 | altPositiveButton:
128 | gravity: 0
129 | dead: 0
130 | sensitivity: .100000001
131 | snap: 0
132 | invert: 0
133 | type: 1
134 | axis: 1
135 | joyNum: 0
136 | - serializedVersion: 3
137 | m_Name: Mouse ScrollWheel
138 | descriptiveName:
139 | descriptiveNegativeName:
140 | negativeButton:
141 | positiveButton:
142 | altNegativeButton:
143 | altPositiveButton:
144 | gravity: 0
145 | dead: 0
146 | sensitivity: .100000001
147 | snap: 0
148 | invert: 0
149 | type: 1
150 | axis: 2
151 | joyNum: 0
152 | - serializedVersion: 3
153 | m_Name: Horizontal
154 | descriptiveName:
155 | descriptiveNegativeName:
156 | negativeButton:
157 | positiveButton:
158 | altNegativeButton:
159 | altPositiveButton:
160 | gravity: 0
161 | dead: .189999998
162 | sensitivity: 1
163 | snap: 0
164 | invert: 0
165 | type: 2
166 | axis: 0
167 | joyNum: 0
168 | - serializedVersion: 3
169 | m_Name: Vertical
170 | descriptiveName:
171 | descriptiveNegativeName:
172 | negativeButton:
173 | positiveButton:
174 | altNegativeButton:
175 | altPositiveButton:
176 | gravity: 0
177 | dead: .189999998
178 | sensitivity: 1
179 | snap: 0
180 | invert: 1
181 | type: 2
182 | axis: 1
183 | joyNum: 0
184 | - serializedVersion: 3
185 | m_Name: Fire1
186 | descriptiveName:
187 | descriptiveNegativeName:
188 | negativeButton:
189 | positiveButton: joystick button 0
190 | altNegativeButton:
191 | altPositiveButton:
192 | gravity: 1000
193 | dead: .00100000005
194 | sensitivity: 1000
195 | snap: 0
196 | invert: 0
197 | type: 0
198 | axis: 0
199 | joyNum: 0
200 | - serializedVersion: 3
201 | m_Name: Fire2
202 | descriptiveName:
203 | descriptiveNegativeName:
204 | negativeButton:
205 | positiveButton: joystick button 1
206 | altNegativeButton:
207 | altPositiveButton:
208 | gravity: 1000
209 | dead: .00100000005
210 | sensitivity: 1000
211 | snap: 0
212 | invert: 0
213 | type: 0
214 | axis: 0
215 | joyNum: 0
216 | - serializedVersion: 3
217 | m_Name: Fire3
218 | descriptiveName:
219 | descriptiveNegativeName:
220 | negativeButton:
221 | positiveButton: joystick button 2
222 | altNegativeButton:
223 | altPositiveButton:
224 | gravity: 1000
225 | dead: .00100000005
226 | sensitivity: 1000
227 | snap: 0
228 | invert: 0
229 | type: 0
230 | axis: 0
231 | joyNum: 0
232 | - serializedVersion: 3
233 | m_Name: Jump
234 | descriptiveName:
235 | descriptiveNegativeName:
236 | negativeButton:
237 | positiveButton: joystick button 3
238 | altNegativeButton:
239 | altPositiveButton:
240 | gravity: 1000
241 | dead: .00100000005
242 | sensitivity: 1000
243 | snap: 0
244 | invert: 0
245 | type: 0
246 | axis: 0
247 | joyNum: 0
248 | - serializedVersion: 3
249 | m_Name: Submit
250 | descriptiveName:
251 | descriptiveNegativeName:
252 | negativeButton:
253 | positiveButton: return
254 | altNegativeButton:
255 | altPositiveButton: joystick button 0
256 | gravity: 1000
257 | dead: .00100000005
258 | sensitivity: 1000
259 | snap: 0
260 | invert: 0
261 | type: 0
262 | axis: 0
263 | joyNum: 0
264 | - serializedVersion: 3
265 | m_Name: Submit
266 | descriptiveName:
267 | descriptiveNegativeName:
268 | negativeButton:
269 | positiveButton: enter
270 | altNegativeButton:
271 | altPositiveButton: space
272 | gravity: 1000
273 | dead: .00100000005
274 | sensitivity: 1000
275 | snap: 0
276 | invert: 0
277 | type: 0
278 | axis: 0
279 | joyNum: 0
280 | - serializedVersion: 3
281 | m_Name: Cancel
282 | descriptiveName:
283 | descriptiveNegativeName:
284 | negativeButton:
285 | positiveButton: escape
286 | altNegativeButton:
287 | altPositiveButton: joystick button 1
288 | gravity: 1000
289 | dead: .00100000005
290 | sensitivity: 1000
291 | snap: 0
292 | invert: 0
293 | type: 0
294 | axis: 0
295 | joyNum: 0
296 |
--------------------------------------------------------------------------------
/Documentation/zh-tw/zh-tw.md:
--------------------------------------------------------------------------------
1 | # Client DataBase 本地資料庫系統 V0.0.1b
2 | 方便讀取企劃 Excel 表格,將會自動產生相應程式碼與 [Scriptable Object](https://unity3d.com/cn/learn/tutorials/modules/beginner/live-training-archive/scriptable-objects) Asset
3 |
4 | 
5 |
6 |
7 |
8 | ## 資料夾結構
9 | ```
10 | Assets/ClientDataBase/
11 | ├── GameTable/ --- Excel 匯出 tab 分隔資料表(txt)
12 | ├── Generate/ --- 自動產出之相關資源
13 | ├── Resources/ --- Scriptable Object Asset
14 | ├── Scriptable/ --- Scriptable Object Script
15 | └── TableClass/ --- 資料列類別
16 | ├── Resources/ --- 設定檔
17 | ├── Scripts/ --- 相關程式碼
18 | ├── Base/ --- 基底類別
19 | ├── Config/ --- 配置設定
20 | ├── Editor/ --- 編輯器工具
21 | └── Utility/ --- 常用工具
22 | └── Templates/ --- 程式碼版型
23 | ```
24 |
25 | :warning: Generate 資料夾是由工具自動產生
26 |
27 |
28 | ## 配置檔案
29 | 方便修改資源路徑、Script 名稱
30 | ```
31 | Assets/ClientDataBase/Resources/Client DataBase Config.asset
32 | ```
33 |
34 |
35 | | 分類 | 名稱 | 描述 |
36 | | ------ | ----------- | ----------- |
37 | | Check ||
38 | || Game Table Check | 檢查資料表格式,判斷開頭字串是否相符 |
39 | | Path | | |
40 | || ROOT | 根目錄 |
41 | || Script Templates Path | 程式碼版型路徑 |
42 | || Game Table Path | 資料表路徑 |
43 | || Table Class Path | "自動產出" 資料列類別路徑 |
44 | || Scriptable Asset Path | "自動產出" Scriptable Object Asset 路徑 |
45 | || Scriptable Scripts Path | "自動產出" Scriptable Object Script 路徑 |
46 | || Scriptable Editor Path | "自動產出" Scriptable Object Editor Script 路徑 |
47 | | Name | | |
48 | || Class Name Prefix | "自動產出" 資料列類別名稱 |
49 | || Scriptable Asset Suffix | "自動產出" Scriptable Object Asset 名稱 |
50 | || Scriptable Script Suffix | "自動產出" Scriptable Object Script 名稱 |
51 | || Scriptable Editor Suffix | "自動產出" Scriptable Object Editor Script 名稱 |
52 |
53 |
54 | ## 支援資料型態
55 | + string
56 | + int
57 | + long
58 | + float
59 | + double
60 | + bool
61 | + Vector2
62 | + Vector3
63 | + string[]
64 | + int[]
65 | + long[]
66 | + float[]
67 | + double[]
68 | + bool[]
69 | + Vector2[]
70 | + Vector3[]
71 |
72 |
73 | ## Excel 資料表格式
74 | + [一般 資料表格式範例](https://docs.google.com/spreadsheets/d/1jEI_wGavArBLVHQY89_w7iMdoyuVVtkLDYYXrI_lZsw/edit#gid=1809851094)
75 |
76 | + [陣列 資料表格式範例](https://docs.google.com/spreadsheets/d/1jEI_wGavArBLVHQY89_w7iMdoyuVVtkLDYYXrI_lZsw/edit#gid=0)
77 |
78 |
79 | :warning: 幾個要注意的地方
80 | + 表格 "第一列" 為變數描述 (Summary)
81 | + 表格 "第二列" 為變數名稱 (Variable name)
82 | + 表格 "第三列" 為資料型態 (Data type)
83 | + 表格 "第一行" id 為讀取資料每列的 Key
84 | + bool 類型:T為true,F為false
85 | + Vector2、Vector3 類型:用逗號分隔
86 | + 陣列表示方法:第二列變數名稱最後面加入 "[]",相同名稱為同個陣列數值
87 |
88 |
89 | ## 使用方式
90 | 1. 從 Excel 或是 Google Excel 匯出 Tab分隔資料 (.tsv)
91 | 2. 附檔名改為 .txt
92 | 3. 將 .txt 檔案放入 Assets/ClientDataBase/GameTable 中
93 | 4. 選擇資源產生方式
94 | + 將 GameTable 下所有 .txt 表格資料產出資源
95 | Unity Menu -> Assets -> Client DataBase -> Update All
96 |
97 | + 使用 視窗工具 選擇檔案後,建立或是更新資源
98 | Unity Menu -> Assets -> Client DataBase -> Window
99 |
100 |
101 |
102 | 頁籤 Create:選擇一個或多個 .txt 表格資料後,按下 Create 按鈕建立資源
103 |
104 | 頁籤 Update:選擇一個或多個 資料表 Scriptable Object Asset 後,按下 Update 按鈕重新從 .txt 表格 再次更新資料
105 |
106 | 5. 將會自動產生相應程式碼與 Scriptable Object Asset
107 | 6. 讀取 Scriptable Object Asset 後,呼叫以下方法取得每列資料
108 |
109 | ```cs
110 | public Table[FileName] GetData(string id)
111 | ```
112 |
113 |
114 | ## 範例實作 (使用Google Excel)
115 | 1. Excel 資料表準備
116 | + [範例資料表](https://docs.google.com/spreadsheets/d/1jEI_wGavArBLVHQY89_w7iMdoyuVVtkLDYYXrI_lZsw/edit#gid=457664276)
117 |
118 | 2. 匯出 Tab分隔資料 (.tsv)
119 | 檔案 -> 下載 -> 定位鍵分隔值檔案(.tsv,目前工作表)
120 |
121 |
122 |
123 | 3. 附檔名改為 .txt,並將 .txt 檔案放入 Assets/ClientDataBase/GameTable 中
124 |
125 |
126 |
127 | 4. 工具自動產出程式碼 & 資源,期間會跳出視窗處理
128 |
129 | Unity Menu -> Assets -> Client DataBase -> Update All
130 |
131 | 處理完成後會產生 Generate 資料夾,檔案結構如下
132 | ```
133 | Assets/ClientDataBase/
134 | ├── Generate/
135 | ├── Resources/
136 | └── ClientDataBase/
137 | └── TableSampleAsset.asset --- Scriptable Object Asset
138 |
139 | ├── Scriptable/
140 | ├── Editor/
141 | └── TableSampleScriptableEditor.cs --- Scriptable Object Editor Script
142 | └── Script/
143 | └── TableSampleScriptable.cs --- Scriptable Object Script
144 |
145 | └── TableClass/
146 | └── TableSample.cs --- 資料列類別
147 | ```
148 |
149 | 5. 讀取 Scriptable Object Asset 方式
150 | + A. 直接讀取 Scriptable Object Asset,使用 Key 取得資料
151 | ```cs
152 | using UnityEngine;
153 |
154 | public class LoadTableNormal : MonoBehaviour
155 | {
156 | const string c_path = "ClientDataBase/TableSampleAsset";
157 | const string c_key = "Sample001";
158 |
159 | void Start()
160 | {
161 | TableSampleScriptable tableSampleScriptable = Resources.Load(c_path);
162 |
163 | TableSample tableSample = tableSampleScriptable.GetData(c_key);
164 |
165 | print(string.Format("{0} : {1}", c_key, tableSample.knowledge));
166 | print(string.Format("{0} : {1}", c_key, tableSample.pos[0]));
167 | }
168 | }
169 | ```
170 |
171 |
172 | + B. 使用 ClientDataBaseManager.cs (管理類別),方便讀取與管理 Scriptable Object Asset、設定檔
173 |
174 | ```
175 | Assets/ClientDataBase/Scripts/ClientDataBaseManager.cs
176 | ```
177 |
178 | 1.在 ClientDataBaseManager.cs 建構子中註冊
179 | ```cs
180 | public class ClientDataBaseManager : Singleton
181 | {
182 | ...
183 | public ClientDataBaseManager()
184 | {
185 | Register(typeof(TableSampleScriptable), LoadTable(TableSampleScriptable.m_gameTableName));
186 | }
187 | ...
188 | }
189 | ```
190 | 2.任意一處取得資料表與資料列
191 | ```cs
192 | using UnityEngine;
193 |
194 | public class LoadTableManager : MonoBehaviour
195 | {
196 | const string c_key = "Sample003";
197 |
198 | void Start()
199 | {
200 | TableSampleScriptable tableSampleScriptable = ClientDataBaseManager.Instance.GetTable();
201 | TableSample tableSample = tableSampleScriptable.GetData(c_key);
202 |
203 | print(string.Format("{0} : {1}", c_key, tableSample.knowledge));
204 | print(string.Format("{0} : {1}", c_key, tableSample.pos[0]));
205 | }
206 | }
207 | ```
208 |
209 |
210 |
211 |
212 | ##支援 & 問題回報
213 | Blog:[http://k79k06k02k.com/blog](http://k79k06k02k.com/blog)
214 | Facebook:[https://www.facebook.com/k79k06k02k](https://www.facebook.com/k79k06k02k)
215 | Email:k79k06k02k@gmail.com
216 |
217 | [](http://creativecommons.org/licenses/by-sa/4.0/)
218 | 本著作係採用創用 CC 姓名標示-相同方式分享 4.0 國際 授權條款授權。
219 | This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.
220 |
--------------------------------------------------------------------------------
/Assets/ClientDataBase/Scripts/Editor/ClientDataBaseEditorWindow.cs:
--------------------------------------------------------------------------------
1 | /**********************************************************
2 | // Author : K.(k79k06k02k)
3 | // FileName : ClientDataBaseEditorWindow.cs
4 | **********************************************************/
5 | using UnityEngine;
6 | using UnityEditor;
7 | using System.IO;
8 | using System.Linq;
9 | using System.Collections.Generic;
10 | using System.Text;
11 |
12 | namespace ClientDataBase
13 | {
14 | public class ClientDataBaseEditorWindow : EditorWindow
15 | {
16 | //按下執行按鈕
17 | bool _boolExecuteButtonClick = false;
18 | float _floatWaitForExecute = 0.1f;
19 |
20 | //一次執行的開始
21 | bool _boolStartCreate = false;
22 |
23 | //是否是更新全部
24 | bool _boolUpdateAll = false;
25 |
26 | //等待 Application Compiling Script
27 | bool _boolNeedToAttach = false;
28 | float _floatWaitForCompile = 1;
29 |
30 | string[] _types = new string[] { "Create", "Update" };
31 | int _intTabIndex = 0;
32 |
33 | List