コード例 #1
0
        public static void Setup()
        {
            IAbilityDataProvider database;

            if (LSDatabaseManager.TryGetDatabase <IAbilityDataProvider>(out database))
            {
                AbilityDataItem[] interfacers = database.AbilityData;
                for (int i = 0; i < interfacers.Length; i++)
                {
                    AbilityDataItem interfacer = interfacers [i];
                    if (interfacer.Script.Type == null)
                    {
                        //exception or ignore?
                        continue;
                    }
                    CodeInterfacerMap.Add(interfacer.Name, interfacer);
                    TypeInterfacerMap.Add(interfacer.Script.Type, interfacer);
                }
            }
        }
コード例 #2
0
        public static void Setup()
        {
            IAbilityDataProvider database;

            if (LSDatabaseManager.TryGetDatabase <IAbilityDataProvider>(out database))
            {
                AbilityDataItem[] interfacers = database.AbilityData;
                for (int i = 0; i < interfacers.Length; i++)
                {
                    AbilityDataItem interfacer = interfacers [i];
                    if (interfacer.Script.Type == null)
                    {
                        //exception or ignore?
                        continue;
                    }
                    interfacer.LocalInitialize();
                    CodeInterfacerMap.Add(interfacer.Name, interfacer);
                    TypeInterfacerMap.Add(interfacer.Script.Type, interfacer);

                    //Debug.Log (interfacer.ListenInputCode + ", " + InputCodeManager.GetCodeID (interfacer.ListenInputCode) + ", " + InputCodeManager.GetCodeID ("Stop"));
                    //Debug.Log (interfacer.Name + ", " + interfacer.ListenInputCode + ", " + interfacer.ListenInputID);
                }
            }
        }
コード例 #3
0
        void DrawSettings()
        {
            settingsFoldout = EditorGUILayout.Foldout(settingsFoldout, "Data Settings");
            if (settingsFoldout)
            {
                GUILayout.BeginHorizontal();

                /*
                 * const int maxDirLength = 28;
                 * if (GUILayout.Button (DatabasePath.Length > maxDirLength ? "..." + DatabasePath.Substring (DatabasePath.Length - maxDirLength) : DatabasePath, GUILayout.ExpandWidth (true))) {
                 * }*/

                SerializedObject obj = new SerializedObject(this);

                SerializedProperty databaseTypeProp = obj.FindProperty("_databaseType");
                EditorGUILayout.PropertyField(databaseTypeProp, new GUIContent("Database Type"));

                float settingsButtonWidth = 70f;
                if (GUILayout.Button("Load", GUILayout.MaxWidth(settingsButtonWidth)))
                {
                    DatabasePath = EditorUtility.OpenFilePanel("Database File", Application.dataPath, "asset");
                    if (!string.IsNullOrEmpty(DatabasePath))
                    {
                        LSFSettingsModifier.Save();
                        if (LoadDatabaseFromPath(DatabasePath) == false)
                        {
                            Debug.LogFormat("Database was not found at path of '{0}'.", DatabasePath);
                        }
                    }
                }
                if (GUILayout.Button("Create", GUILayout.MaxWidth(settingsButtonWidth)))
                {
                    DatabasePath = EditorUtility.SaveFilePanel("Database File", Application.dataPath, "NewDatabase", "asset");
                    if (!string.IsNullOrEmpty(DatabasePath))
                    {
                        if (CreateDatabase(DatabasePath))
                        {
                            Debug.Log("Database creation succesful!");
                        }
                        else
                        {
                            Debug.Log("Database creation unsuccesful");
                        }
                    }
                }
                GUILayout.EndHorizontal();

                //json stuff
                GUILayout.BeginHorizontal();
                jsonFile = (TextAsset)EditorGUILayout.ObjectField("Json", jsonFile, typeof(TextAsset), false);
                if (GUILayout.Button("Load", GUILayout.MaxWidth(settingsButtonWidth)))
                {
                    LSDatabaseManager.ApplyJson(jsonFile.text, Database);
                }
                if (GUILayout.Button("Save", GUILayout.MaxWidth(settingsButtonWidth)))
                {
                    System.IO.File.WriteAllText(
                        AssetDatabase.GetAssetPath(jsonFile),
                        LSDatabaseManager.ToJson(Database)
                        );
                }
                GUILayout.EndHorizontal();
                if (CanSave)
                {
                    obj.ApplyModifiedProperties();
                }
            }
        }