protected override void Init() { Kernel.ComponentRegistered += new ComponentDataDelegate(OnComponentRegistered); if (FacilityConfig.IsNotNull()) { if (FacilityConfig.Attributes["provideByDefault"].ToBool().IsNotNull()) { _wirePropertiesInContainerByDefault = (bool)FacilityConfig.Attributes["provideByDefault"].ToBool(); } } }
public static void ScanAllScenes() { var configName = "scenes.json"; var filename = FI.ConfigPath + configName; var trancfgName = "transtriggers.json"; var tranFileName = FI.ConfigPath + trancfgName; var npccfgName = "npctriggers.json"; var npcFileName = FI.ConfigPath + npccfgName; var facilitycfgName = "facilitytriggers.json"; var facilityFileName = FI.ConfigPath + facilitycfgName; var questcfgName = "questtriggers.json"; var questFileName = FI.ConfigPath + questcfgName; var investigatecfgName = "investigatetriggers.json"; var investigateFileName = FI.ConfigPath + investigatecfgName; var jsonWriter = new ScannerJsonWriter(); var config = new SceneConfig(); var cfgTran = new TranConfig(); var cfgFacility = new FacilityConfig(); var cfgNpc = new NpcConfig(); var cfgQuest = new QuestAreaConfig(); var cfgInvestigate = new InvestigateConfig(); var allScenes = Directory.GetFiles("Assets/Scenes/game/streets", "*.unity", SearchOption.AllDirectories).ToList(); for (int i = 0; i < allScenes.Count; ++i) { var scene = allScenes[i]; EditorUtility.DisplayProgressBar("Scan all scenes", "scanning " + scene, (float)i / allScenes.Count); Lightmapping.giWorkflowMode = Lightmapping.GIWorkflowMode.OnDemand; var sceneName = Path.GetFileNameWithoutExtension(scene); var triggerSceneFile = "Assets/Scenes/city_triggers/" + sceneName + "_trigger.unity"; UnityEditor.SceneManagement.EditorSceneManager.OpenScene(scene, UnityEditor.SceneManagement.OpenSceneMode.Single); if (File.Exists(triggerSceneFile)) { UnityEditor.SceneManagement.EditorSceneManager.OpenScene(triggerSceneFile, UnityEditor.SceneManagement.OpenSceneMode.Additive); } Lightmapping.giWorkflowMode = Lightmapping.GIWorkflowMode.OnDemand; var curScene = EditorApplication.currentScene; if (curScene != null && curScene != "") { sceneName = System.IO.Path.GetFileNameWithoutExtension(curScene); var street = new SceneConfig.Street(sceneName); var ttan = new TranConfig.Trigger(sceneName); var tnpc = new NpcConfig.Trigger(sceneName); var tfacility = new FacilityConfig.Trigger(sceneName); var tquest = new QuestAreaConfig.Trigger(sceneName); var tinvestigate = new InvestigateConfig.Trigger(sceneName); var scanner = new SceneScanner(street, ttan, tfacility, tnpc, tquest, tinvestigate); scanner.ScanCurrentScene(sceneName); config.AddStreet(street); cfgTran.AddTrigger(ttan); cfgNpc.AddTrigger(tnpc); cfgFacility.AddTrigger(tfacility); cfgQuest.AddTrigger(tquest); cfgInvestigate.AddTrigger(tinvestigate); LogUtil.Debug("Scene " + curScene + " scan success"); } else { LogUtil.Debug("You need to select a scene before scan"); } } jsonWriter.OutputToFile(filename, config.ToJson()); jsonWriter.OutputToFile(tranFileName, cfgTran.ToJson()); jsonWriter.OutputToFile(facilityFileName, cfgFacility.ToJson()); jsonWriter.OutputToFile(npcFileName, cfgNpc.ToJson()); jsonWriter.OutputToFile(questFileName, cfgQuest.ToJson()); jsonWriter.OutputToFile(investigateFileName, cfgInvestigate.ToJson()); LogUtil.Debug("Scene " + filename + " successfully generated in game-config folder"); EditorUtility.ClearProgressBar(); AssetDatabase.SaveAssets(); }
protected override void OnModelCreating(DbModelBuilder modelBuilder) { FacilityConfig.Configure(modelBuilder); }