Exemple #1
0
        void IModule.LoadModule()
        {
            SceneView.duringSceneGui   += OnSceneGUI;
            Selection.selectionChanged += UpdateConditionData;
            // We need to re-cache values for selection after since they can be lost after assembly reload.
            AssemblyReloadEvents.afterAssemblyReload += UpdateConditionData;

            foreach (var kvp in MarsUIResources.instance.ConditionIcons)
            {
                var data = new ConditionTypeData();
                data.iconData = kvp.Value;
                m_ConditionData.Add(kvp.Key, data);
            }
        }
Exemple #2
0
    public void _23_1_CollectedConditionsDescriptorFromJson()
    {
        var basePath          = Path.Combine(Application.dataPath, "AutomatineTest/TestGenerated/Editor");
        var autoGenOutputPath = Path.Combine(basePath, "_23_1_CollectedConditionsDescriptorFromJson.json");

        {
            var conditionCategoriesDict = new ConditionTypeData(new List <string> {
                "Act", "Anim", "Hit"
            });

            // jsonファイルに吐き出す
            var serialized = JsonUtility.ToJson(conditionCategoriesDict);

            // write json file
            using (var sw = new StreamWriter(autoGenOutputPath))
            {
                sw.Write(serialized);
            }
        }

        {
            // read json file
            var body = string.Empty;
            using (var sr = new StreamReader(autoGenOutputPath))
            {
                body = sr.ReadToEnd();
            }
            var deserialized = JsonUtility.FromJson <ConditionTypeData>(body);

            var conditionCategories = deserialized.conditionTypes;


            var desc = AutoDescriptor.CollectedConditions("DummyCollectedConditions", conditionCategories);

            var outputPath = Path.Combine(basePath, "_23_1_CollectedConditionsDescriptorFromJson.cs");

            // write class file
            using (var sw = new StreamWriter(outputPath))
            {
                sw.Write(desc);
            }
        }
    }