Example #1
0
        static void Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            EditorCore.FillDefaultImageList();
            EditorCore.InitDefaultLists();

            Project project = ResourcesHandler.CreateProjectInstance("TestProject");

            //Declare some actors
            Actor actorA = new Actor();

            actorA.ID   = "Actor01";
            actorA.Name = "Jim";
            project.AddActor(actorA);

            Actor actorB = new Actor();

            actorB.ID   = "Actor02";
            actorB.Name = "Bob";
            project.AddActor(actorB);

            //Dialogue is created in Window constructor
            Application.Run(new Window());
        }
Example #2
0
        private static void BindType <T>()
        {
            Type   type     = typeof(T);
            string nodeType = type.Name.Replace("Node", string.Empty);

            EditorCore.BindAttribute(type, nodeType, NicifyName(nodeType));
        }
Example #3
0
        static void Main(string[] args)
        {
            string path = Directory.GetCurrentDirectory();

            if (args.Length > 0)
            {
                path = args[0];
            }
            // 如果路径是以/或者\\结尾,则去除最后一个字符,方便使用
            if (path.EndsWith("/") || path.EndsWith("\\"))
            {
                path = path.Substring(0, path.Length - 1);
            }
            // 如果当前在HelperExe目录中,就在path向上3层查找文件,否则就查找path中的文件
            if (path.EndsWith("HelperExe"))
            {
                path = StringUtility.getFilePath(path);
                path = StringUtility.getFilePath(path);
                path = StringUtility.getFilePath(path);
            }
            EditorCore editorCore = new EditorCore();

            editorCore.init(path);
            // 将列表中的所有文件都加入防火墙例外
            foreach (var item in editorCore.getProgramPathList())
            {
                bool ret = EditorUtility.addFirewallExceptions(item.Key, item.Value);
            }
        }
Example #4
0
        internal void OnGraphicsContextInitialized(GLControl context, WindowsFormsHost host)
        {
            m_control = context;

            m_editorCore             = new EditorCore();
            m_intervalTimer          = new System.Windows.Forms.Timer();
            m_intervalTimer.Interval = 16; // 60 FPS roughly
            m_intervalTimer.Enabled  = true;
            m_intervalTimer.Tick    += (args, o) =>
            {
                Vector2 mousePosGlobal     = new Vector2(System.Windows.Forms.Control.MousePosition.X, System.Windows.Forms.Control.MousePosition.Y);
                Vector2 glControlPosGlobal = new Vector2((float)host.PointToScreen(new Point(0, 0)).X, (float)host.PointToScreen(new Point(0, 0)).Y);

                var delta = mousePosGlobal - glControlPosGlobal;

                delta.X = MathE.Clamp(delta.X, 0, m_control.Width);
                delta.Y = MathE.Clamp(delta.Y, 0, m_control.Height);

                ((MainWindow)Application.Current.MainWindow).Tick();

                m_editorCore.GetWorldByName("main").Input.SetMousePosition(delta);
                m_editorCore.Tick();

                if (m_control != null)
                {
                    m_control.SwapBuffers();
                }
            };

            m_editorCore.PropertyChanged += OnEditorPropertyChanged;
            EntityOutliner.m_world        = m_editorCore.GetWorldByName("main");
        }
Example #5
0
        public MainEditor()
        {
            //Initialize the WinForm
            InitializeComponent();
            KeyPreview = true;

            _mruMenu = new MruStripMenu(mruList, OnMruClickedHandler, _mruRegKey + "\\MRU", 6);
            _loadedWorldspaceProject = null;

            // Register a handler for WorldspaceProjectLoaded that sets the Window's title.
            WorldspaceProjectLoaded += OnWorldSpaceProjectLoaded;

            glControl.KeyDown   += HandleEventKeyDown;
            glControl.KeyUp     += HandleEventKeyUp;
            glControl.MouseDown += HandleEventMouseDown;
            glControl.MouseMove += HandleEventMouseMove;
            glControl.MouseUp   += HandleEventMouseUp;
            glControl.Resize    += Display.Internal_EventResize;

            glControl.Load += (sender, args) =>
            {
                // Hook Application Idle to force rendering while no events are happening.
                Application.Idle += HandleApplicationIdle;

                Console.WriteLine("glContro loaded!");
                // Initialize our core once the glControl has been created as initalization
                // requires a glContext.
                _editorCore = new EditorCore();
            };

            // Hook the glControl's Paint function (which is called every frame thanks to above)
            glControl.Paint += (sender, args) => RenderFrame();
        }
Example #6
0
        static void Main()
        {
            // Handle float edition in PropertyGrid
            //http://visualhint.com/blog/70/how-to-format-a-number-with-a-specific-cultureinfonumberformatinfo-in-the-propert
            System.Threading.Thread.CurrentThread.CurrentCulture   = new System.Globalization.CultureInfo("en-US");
            System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("en");

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            // Core
            EditorCore.FillDefaultImageList();
            EditorCore.InitDefaultWindow();
            EditorCore.InitDefaultLists();

            EditorCore.VersionProject = "1.0.0";

            //......
            // Custom overrides should come here !
            //......

            // MainWindow
            EditorCore.MainWindow.Init();

            // Add the event handler for handling UI thread exceptions to the event.
            Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(WIN32.ShowCrashMessage);

            // Run
            Application.Run(EditorCore.MainWindow);
        }
Example #7
0
        public MainEditor()
        {
            //Initialize the WinForm
            InitializeComponent();
            KeyPreview = true;
            
            _mruMenu = new MruStripMenu(mruList, OnMruClickedHandler, _mruRegKey + "\\MRU", 6);
            _loadedWorldspaceProject = null;

            // Register a handler for WorldspaceProjectLoaded that sets the Window's title.
            WorldspaceProjectLoaded += OnWorldSpaceProjectLoaded;

            glControl.KeyDown += HandleEventKeyDown;
            glControl.KeyUp += HandleEventKeyUp;
            glControl.MouseDown += HandleEventMouseDown;
            glControl.MouseMove += HandleEventMouseMove;
            glControl.MouseUp += HandleEventMouseUp;
            glControl.Resize += Display.Internal_EventResize;

            glControl.Load += (sender, args) =>
            {
                // Hook Application Idle to force rendering while no events are happening.
                Application.Idle += HandleApplicationIdle;

                Console.WriteLine("glContro loaded!");
                // Initialize our core once the glControl has been created as initalization
                // requires a glContext.
                _editorCore = new EditorCore();
            };

            // Hook the glControl's Paint function (which is called every frame thanks to above)
            glControl.Paint += (sender, args) => RenderFrame();
        }
Example #8
0
 public void destroy()
 {
     mTimer.Stop();
     mTimer = null;
     unregisteEventHandler();
     mEditorCore.destroy();
     mEditorCore = null;
 }
Example #9
0
 public static void notifyFrameDestroy()
 {
     mEditorCore          = null;
     mCommandSystem       = null;
     mHttpDownloadManager = null;
     mDownloadManager     = null;
     mUploadManager       = null;
     mEventSystem         = null;
 }
Example #10
0
 public EditorCore()
 {
     if (mSingleton != null)
     {
         return;
     }
     mSingleton          = this;
     mFrameComponentMap  = new Dictionary <string, FrameComponent>();
     mFrameComponentList = new List <FrameComponent>();
 }
Example #11
0
 public static void notifyConstructDone()
 {
     if (mEditorCore == null)
     {
         mEditorCore          = EditorCore.getSingleton();
         mCommandSystem       = mEditorCore.getSystem <CommandSystem>();
         mHttpDownloadManager = mEditorCore.getSystem <HttpDownloadManager>();
         mDownloadManager     = mEditorCore.getSystem <DownloadManager>();
         mUploadManager       = mEditorCore.getSystem <UploadManager>();
         mEventSystem         = mEditorCore.getSystem <EventSystem>();
     }
 }
Example #12
0
        public OTKWinForm()
        {
            InitializeComponent();
            Editor = new EditorCore();
            timer  = new System.Threading.Timer(new TimerCallback(TickWorld));
            timer.Change(0, 10);
            PrevCursorPosition = new Point(this.Width / 2, this.Height / 2);
            enabledKeys        = new bool[4] {
                false, false, false, false
            };

            treeView1.NodeMouseClick += TreeView1_NodeMouseClick;
        }
        public CollisionEditorWindow()
        {
            Application.EnableVisualStyles();
            InitializeComponent();
            Editor = new EditorCore();
            timer  = new System.Threading.Timer(new TimerCallback(TickWorld));
            timer.Change(0, 10);
            PrevCursorPosition = new Point(this.Width / 2, this.Height / 2);
            enabledKeys        = new bool[4] {
                false, false, false, false
            };

            treeView1.NodeMouseClick += TreeView1_NodeMouseClick;
        }
Example #14
0
 public MainWindow()
 {
     Application.Current.ShutdownMode = ShutdownMode.OnExplicitShutdown;
     InitializeComponent();
     mFrameDone     = true;
     mRunning       = true;
     mUpdateDone    = false;
     mAutoStartGame = true;
     mAutoClose     = false;
     mOKDialog      = new OKDialog();
     mYesNoDialog   = new YesNoDialog();
     mBusyInfo      = new BusyInfo();
     mEditorCore    = new EditorCore();
     init();
 }
Example #15
0
        public MainEditorForm()
        {
            Instance = this;
            InitializeComponent();

            glControl.Resize += Display.Internal_EventResize;

            glControl.Load += (sender, args) =>
            {
                Application.Idle += HandleApplicationIdle;

                MainEditorCore = new EditorCore(this);
            };

            glControl.Paint += (sender, args) => RenderFrame();
        }
Example #16
0
        public Form1()
        {
            InitializeComponent();
            mEditorCore = new EditorCore();
            mEditorCore.init();
            mLastTime       = DateTime.Now;
            mTimer          = new Timer();
            mTimer.Interval = 20;
            mTimer.Tick    += onTimer;
            mTimer.Start();
            Dictionary <string, string> pathList = mEditorCore.getProgramPathList();

            foreach (var item in pathList)
            {
                mProgramListCombo.Items.AddRange(new object[] { item.Key });
            }
            if (mProgramListCombo.Items.Count > 0)
            {
                mProgramListCombo.SelectedIndex = 0;
            }
        }
Example #17
0
        private void LoadEntities(Map newMap, EditorCore core, Dictionary<Scene, VirtualFilesystemDirectory> archiveMap, WWorld world)
        {
            MapEntityLoader entityLoader = new MapEntityLoader(core, newMap);

            // For each room/scene, find the associated dzr/dzs file and load its
            // contents into the entityLoader.
            foreach (var kvp in archiveMap)
            {
                // Check to see if this Archive has stage/room entity data.
                var roomEntData = kvp.Value.FindByExtension(".dzr");
                var stageEntData = kvp.Value.FindByExtension(".dzs");

                VirtualFilesystemFile vfsFile = null;
                if (roomEntData.Count > 0)
                    vfsFile = roomEntData[0];
                else if (stageEntData.Count > 0)
                    vfsFile = stageEntData[0];
                else
                    continue;

                using (EndianBinaryReader reader = new EndianBinaryReader(new System.IO.MemoryStream(vfsFile.File.GetData()), Endian.Big))
                {
                    WLog.Info(LogCategory.EntityLoading, null, "Loading .dzr/.dzs (Room/Stage Entity Dat) for {0}{1}...", vfsFile.Name, vfsFile.Extension);
                    entityLoader.LoadFromStream(kvp.Key, reader);
                    WLog.Info(LogCategory.EntityLoading, null, "Finished loading .dzr/.dzs (Room/Stage Entity Dat) for {0}{1}.", vfsFile.Name, vfsFile.Extension);
                }
            }

            // Once we've loaded all of the entities from the stream, we're going to
            // post-process them to resolve object references.
            entityLoader.PostProcessEntities();

            // Finally, we can actually convert these into map objects
            foreach (var roomOrStageData in entityLoader.GetData())
            {
                Stage stage = roomOrStageData.Key as Stage;
                Room room = roomOrStageData.Key as Room;

                if (stage != null)
                {
                    PostProcessStage(stage, roomOrStageData.Value);
                    foreach (var entity in stage.Entities)
                        entity.World = world;
                }
                if (room != null)
                {
                    PostProcessRoom(room, roomOrStageData.Value);
                    foreach (var entity in room.Entities)
                        entity.World = world;
                }
            }
        }
Example #18
0
        public Map CreateFromDirectory(WWorld world, EditorCore editorCore, string folderPath)
        {
            if (world == null)
            {
                throw new ArgumentNullException("world", "No world to load map into specified.");
            }

            if (string.IsNullOrEmpty(folderPath))
            {
                throw new ArgumentException("folderPath is null or empty!");
            }

            if (!System.IO.Directory.Exists(folderPath))
            {
                throw new System.IO.DirectoryNotFoundException("folderPath not found, ensure the directory exists first!");
            }

            // Calculate the Map Name from the folderPath - it should be the last segment of the folder path.s
            System.IO.DirectoryInfo rootFolderInfo = new System.IO.DirectoryInfo(folderPath);
            string mapName = rootFolderInfo.Name;


            // Sort the directories in rootFolderInfo into natural order, instead of alphabetical order which solves issues
            // where room indexes were getting remapped to the wrong one.
            IEnumerable <System.IO.DirectoryInfo> subFolders = rootFolderInfo.GetDirectories().OrderByNatural(x => x.Name);
            IEnumerable <System.IO.FileInfo>      subFiles   = rootFolderInfo.GetFiles().OrderByNatural(x => x.Name);

            // Maps are stored in two distinct parts. A Stage which encompasses global data for all rooms, and then
            // one or more rooms. We're going to load both the room and stage into ZArchives and then load the data
            // stored in them into different data.
            var archiveFolderMap = new Dictionary <string, VirtualFilesystemDirectory>();

            foreach (var dirInfo in subFolders)
            {
                VirtualFilesystemDirectory archive = null;

                string folderName = dirInfo.Name;
                if (folderName.ToLower().StartsWith("stage"))
                {
                    archive = new VirtualFilesystemDirectory(folderName);

                    if (archiveFolderMap.ContainsKey("stage"))
                    {
                        WLog.Warning(LogCategory.EditorCore, null, "{0} contains more than one stage archive, ignoring second...", folderPath);
                        continue;
                    }
                }
                else if (folderName.ToLower().StartsWith("room"))
                {
                    archive = new VirtualFilesystemDirectory(folderName);
                }

                // sea has LOD folders which don't have the right sub-folder setup, boo. This skips them for now,
                // maybe later we can add an ArchiveType.LOD.
                if (archive == null)
                {
                    continue;
                }

                // Fill the archives with their contents.
                archive.ImportFromDisk(dirInfo.FullName);
                archiveFolderMap[folderName.ToLower()] = archive;
            }

            // We're also going to try and process the files inside the folder to see if they're archives.
            foreach (var fileInfo in subFiles)
            {
                VirtualFilesystemDirectory archive = WArchiveTools.ArcUtilities.LoadArchive(fileInfo.FullName);

                // File wasn't a valid RARC archive.
                if (archive == null)
                {
                    continue;
                }

                if (archive.Name.ToLower().StartsWith("stage"))
                {
                    if (archiveFolderMap.ContainsKey("stage"))
                    {
                        WLog.Warning(LogCategory.EditorCore, null, "{0} contains more than one stage archive, ignoring second...", folderPath);
                        continue;
                    }
                }

                string arcName = System.IO.Path.GetFileNameWithoutExtension(fileInfo.FullName).ToLower();
                archiveFolderMap[arcName] = archive;
            }

            Map newMap = new Map();

            newMap.Name            = mapName;
            newMap.ProjectFilePath = System.IO.Path.GetDirectoryName(folderPath);

            var sceneMap = CreateScenesFromArchives(newMap, archiveFolderMap);

            LoadEntities(newMap, editorCore, sceneMap, world);
            LoadModels(sceneMap);

            return(newMap);
        }
Example #19
0
        private void LoadEntities(Map newMap, EditorCore core, Dictionary <Scene, VirtualFilesystemDirectory> archiveMap, WWorld world)
        {
            MapEntityLoader entityLoader = new MapEntityLoader(core, newMap);

            // For each room/scene, find the associated dzr/dzs file and load its
            // contents into the entityLoader.
            foreach (var kvp in archiveMap)
            {
                // Check to see if this Archive has stage/room entity data.
                var roomEntData  = kvp.Value.FindByExtension(".dzr");
                var stageEntData = kvp.Value.FindByExtension(".dzs");

                VirtualFilesystemFile vfsFile = null;
                if (roomEntData.Count > 0)
                {
                    vfsFile = roomEntData[0];
                }
                else if (stageEntData.Count > 0)
                {
                    vfsFile = stageEntData[0];
                }
                else
                {
                    continue;
                }

                using (EndianBinaryReader reader = new EndianBinaryReader(new System.IO.MemoryStream(vfsFile.File.GetData()), Endian.Big))
                {
                    WLog.Info(LogCategory.EntityLoading, null, "Loading .dzr/.dzs (Room/Stage Entity Dat) for {0}{1}...", vfsFile.Name, vfsFile.Extension);
                    entityLoader.LoadFromStream(kvp.Key, reader);
                    WLog.Info(LogCategory.EntityLoading, null, "Finished loading .dzr/.dzs (Room/Stage Entity Dat) for {0}{1}.", vfsFile.Name, vfsFile.Extension);
                }
            }

            // Once we've loaded all of the entities from the stream, we're going to
            // post-process them to resolve object references.
            entityLoader.PostProcessEntities();

            // Finally, we can actually convert these into map objects
            foreach (var roomOrStageData in entityLoader.GetData())
            {
                Stage stage = roomOrStageData.Key as Stage;
                Room  room  = roomOrStageData.Key as Room;

                if (stage != null)
                {
                    PostProcessStage(stage, roomOrStageData.Value);
                    foreach (var entity in stage.Entities)
                    {
                        entity.World = world;
                    }
                }
                if (room != null)
                {
                    PostProcessRoom(room, roomOrStageData.Value);
                    foreach (var entity in room.Entities)
                    {
                        entity.World = world;
                    }
                }
            }
        }
Example #20
0
        static void Main()
        {
            // Handle float edition in PropertyGrid
            //http://visualhint.com/blog/70/how-to-format-a-number-with-a-specific-cultureinfonumberformatinfo-in-the-propert
            System.Threading.Thread.CurrentThread.CurrentCulture   = new System.Globalization.CultureInfo("en-US");
            System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("en");

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            // Core
            EditorCore.FillDefaultImageList();
            EditorCore.InitDefaultWindow();
            EditorCore.InitDefaultLists();

            EditorCore.VersionProject = "1.0.0";

            //..............................................................
            // Here you can declare custom types, bindings and menus

            // Animations
            //EditorCore.Animations.Add("Common", new List<string>() { "WaveHands", "CrossArms" });
            //EditorCore.Animations.Add("Angry", new List<string>() { "Speak_01", "Speak_02" });

            // Additional lists items
            EditorCore.CustomLists.Add("TargetActions", new Dictionary <string, string>());
            EditorCore.CustomLists["TargetActions"].Add("AttackEnemy", "Attack Player");
            EditorCore.CustomLists["TargetActions"].Add("ForceFlee", "Flee");
            EditorCore.CustomLists["TargetActions"].Add("ClearTarget", "End Combat");
            EditorCore.CustomLists["TargetActions"].Add("WasRevealed", "Revealed");
            EditorCore.CustomLists["TargetActions"].Add("DisableAI", "Disable");
            EditorCore.CustomLists["TargetActions"].Add("EnableAI", "Enable");
            EditorCore.CustomLists["TargetActions"].Add("OnResurrect", "Resurrected");

            // Bind Nodes Attributes
            EditorCore.BindAttribute(typeof(NodeActionNPCAction), "NPCAction", "NPC Action");
            EditorCore.BindAttribute(typeof(NodeActionChangeState), "ChangeState", "Change State");
            EditorCore.BindAttribute(typeof(NodeActionSay), "Say", "Say");
            EditorCore.BindAttribute(typeof(NodeActionSendMessageToTarget), "SendMessageTarget", "Send Message to Target");
            EditorCore.BindAttribute(typeof(NodeActionSetObjVarNumber), "SetObjVarNumber", "Set Object Var (Number)");
            EditorCore.BindAttribute(typeof(NodeActionSetObjVarString), "SetObjVarString", "Set Object Var (Text)");
            EditorCore.BindAttribute(typeof(NodeActionStartTimer), "StartTimer", "Start Timer");

            EditorCore.BindAttribute(typeof(NodeConditionHasUseCase), "HasUseCase", "Has Use Case");
            EditorCore.BindAttribute(typeof(NodeConditionObjVarNumber), "ObjVarNumber", "Compare Object Var (Number)");
            EditorCore.BindAttribute(typeof(NodeConditionStringCompare), "CompareString", "Compare Two Strings");
            EditorCore.BindAttribute(typeof(NodeConditionTimerTicking), "TimerTicking", "Is Timer Ticking");

            // Delegate post-load project
            EditorCore.OnProjectLoad = delegate
            {
                //...
                // Here you can start additional processes like filling the loaded project/dialogues with some imported data
                //...
            };

            // Delegate to check custom errors
            EditorCore.OnCheckDialogueErrors = delegate(Dialogue dialogue)
            {
                //...
                // Here you can plug custom checks, using this kind of messages :
                //EditorCore.LogError(String.Format("{0} {1} - Sentence has no Speaker", dialogue.GetName(), node.ID), dialogue, node);
                //...
            };

            //..............................................................

            // MainWindow
            EditorCore.MainWindow.Init();

            // Add the event handler for handling UI thread exceptions to the event.
            Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(WIN32.ShowCrashMessage);

            // Run
            Application.Run(EditorCore.MainWindow);
        }
Example #21
0
        static void Main()
        {
            // Handle float edition in PropertyGrid
            //http://visualhint.com/blog/70/how-to-format-a-number-with-a-specific-cultureinfonumberformatinfo-in-the-propert
            System.Threading.Thread.CurrentThread.CurrentCulture   = new System.Globalization.CultureInfo("en-US");
            System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("en");

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            // Core
            EditorCore.FillDefaultImageList();
            EditorCore.InitDefaultWindow();
            EditorCore.InitDefaultLists();

            EditorCore.VersionProject = "1.0.0";

            //..............................................................
            // Here you can declare custom types, bindings and menus

            // Animations
            EditorCore.Animations.Add("Common", new List <string>()
            {
                "WaveHands", "CrossArms"
            });
            EditorCore.Animations.Add("Angry", new List <string>()
            {
                "Speak_01", "Speak_02"
            });

            // Additional lists items
            EditorCore.CustomLists["Builds"].Add("Dwarf", "Dwarf");

            // Cameras
            var cameras = new Dictionary <string, string>();

            cameras.Add("", "");
            cameras.Add("CloseUp", "Close Up");
            cameras.Add("MediumShot", "Medium Shot");
            cameras.Add("FullShot", "Full Shot");
            EditorCore.CustomLists["Cameras"] = cameras;

            // Bind Nodes Attributes
            EditorCore.BindAttribute(typeof(NodeConditionHasHonor), "ConditionHasHonor", "Has Honor");
            EditorCore.BindAttribute(typeof(NodeActionAddHonor), "ActionAddHonor", "Add Honor");

            // Bind Nodes Properties Panels
            EditorCore.BindCustomProperties(typeof(DialogueNodeSentence), "DirectingProperties", typeof(DirectingProperties), typeof(FormPropertiesDirecting));

            // Delegate post-load project
            EditorCore.OnProjectLoad = delegate
            {
                //...
                // Here you can start additional processes like filling the loaded project/dialogues with some imported data
                //...
            };

            // Delegate post-load dialogue, should be used when data needs to migrate between versions
            EditorCore.OnDialoguePostLoad = delegate(Dialogue dialogue)
            {
                //...
                // Here you can handle data migration and properties update, using serialized data from ExtensionData dictionnaries
                //...

                //...
                // Here you can flush all ExtensionData to remove them from serialization once migration is complete
                //foreach (DialogueNode node in dialogue.ListNodes)
                //{
                //    node.ExtensionData?.Clear();
                //}

                //dialogue.ExtensionData?.Clear();
                //...
            };

            // Delegate to check custom errors
            EditorCore.OnCheckDialogueErrors = delegate(Dialogue dialogue)
            {
                //...
                // Here you can plug custom checks, using this kind of messages :
                //EditorCore.LogError(String.Format("{0} {1} - Sentence has no Speaker", dialogue.GetName(), node.ID), dialogue, node);
                //...
            };

            //..............................................................

            // MainWindow
            EditorCore.MainWindow.Init();

            // Add the event handler for handling UI thread exceptions to the event.
            Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(WIN32.ShowCrashMessage);

            // Run
            Application.Run(EditorCore.MainWindow);
        }
Example #22
0
        static void Main()
        {
            // Handle float edition in PropertyGrid
            //http://visualhint.com/blog/70/how-to-format-a-number-with-a-specific-cultureinfonumberformatinfo-in-the-propert
            System.Threading.Thread.CurrentThread.CurrentCulture   = new System.Globalization.CultureInfo("en-US");
            System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("en");

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            // Core
            EditorCore.FillDefaultImageList();
            EditorCore.InitDefaultWindow();
            EditorCore.InitDefaultLists();

            Dictionary <string, string> dialogueChoicesToValues;

            if (!EditorCore.CustomLists.TryGetValue("DialogueChoices", out dialogueChoicesToValues))
            {
                EditorCore.CustomLists["DialogueChoices"] = dialogueChoicesToValues = new Dictionary <string, string>();
            }

            dialogueChoicesToValues["GuestItemsSelection"] = "Guest's Items Selection";
            dialogueChoicesToValues["CirceItemsSelection"] = "Circe's Items Selection";
            dialogueChoicesToValues["DialoguesSelection"]  = "Dialogues Selection";

            EditorCore.VersionProject = "1.0.0";

            //..............................................................
            // Here you can declare custom types, bindings and menus

            // Additional lists items
            EditorCore.CustomLists["Builds"].Add("Dwarf", "Dwarf");

            // Bind Nodes Attributes
            BindType <NodeConditionHasItemStack>();
            BindType <NodeConditionPOIHasState>();
            BindType <NodeConditionHasTag>();

            BindType <NodeActionItemStack>();
            BindType <NodeActionTag>();
            BindType <NodeActionLoadScene>();
            BindType <NodeActionSetPOIState>();
            BindType <NodeActionSetPOICurrentDialog>();

            // Delegate post-load project
            EditorCore.OnProjectLoad = delegate
            {
                //...
                // Here you can start additional processes like filling the loaded project/dialogues with some imported data
                //...
            };

            // Delegate to check custom errors
            EditorCore.OnCheckDialogueErrors = delegate(Dialogue dialogue)
            {
                //...
                // Here you can plug custom checks, using this kind of messages :
                //EditorCore.LogError(String.Format("{0} {1} - Sentence has no Speaker", dialogue.GetName(), node.ID), dialogue, node);
                //...
            };

            //..............................................................

            // MainWindow
            EditorCore.MainWindow.Init();

            // Add the event handler for handling UI thread exceptions to the event.
            Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(WIN32.ShowCrashMessage);

            // Run
            Application.Run(EditorCore.MainWindow);
        }
Example #23
0
 public MapEntityLoader(EditorCore core, Map parentMap)
 {
     m_entityData = new Dictionary <Scene, List <RawMapEntity> >();
     m_editorCore = core;
     m_map        = parentMap;
 }
Example #24
0
 public MapEntityLoader(EditorCore core, Map parentMap)
 {
     m_entityData = new Dictionary<Scene, List<RawMapEntity>>();
     m_editorCore = core;
     m_map = parentMap;
 }
Example #25
0
        static void Main()
        {
            // Handle float edition in PropertyGrid
            //http://visualhint.com/blog/70/how-to-format-a-number-with-a-specific-cultureinfonumberformatinfo-in-the-propert
            System.Threading.Thread.CurrentThread.CurrentCulture   = new System.Globalization.CultureInfo("en-US");
            System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("en");

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            // Core
            EditorCore.FillDefaultImageList();
            EditorCore.InitDefaultWindow();
            EditorCore.InitDefaultLists();

            EditorCore.VersionProject = "1.0.0";

            //..............................................................
            // Here you can declare custom types, bindings and menus

            // Animations
            EditorCore.Animations.Add("Common", new List <string>()
            {
                "WaveHands", "CrossArms"
            });
            EditorCore.Animations.Add("Angry", new List <string>()
            {
                "Speak_01", "Speak_02"
            });

            // Additional lists items
            EditorCore.CustomLists["Builds"].Add("Dwarf", "Dwarf");

            // Bind Nodes Attributes
            EditorCore.BindAttribute(typeof(NodeConditionHasHonor), "ConditionHasHonor", "Has Honor");
            EditorCore.BindAttribute(typeof(NodeActionAddHonor), "ActionAddHonor", "Add Honor");

            // Delegate post-load project
            EditorCore.OnProjectLoad = delegate
            {
                //...
                // Here you can start additional processes like filling the loaded project/dialogues with some imported data
                //...
            };

            // Delegate to check custom errors
            EditorCore.OnCheckDialogueErrors = delegate(Dialogue dialogue)
            {
                //...
                // Here you can plug custom checks, using this kind of messages :
                //EditorCore.LogError(String.Format("{0} {1} - Sentence has no Speaker", dialogue.GetName(), node.ID), dialogue, node);
                //...
            };

            //..............................................................

            // MainWindow
            EditorCore.MainWindow.Init();

            // Add the event handler for handling UI thread exceptions to the event.
            Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(WIN32.ShowCrashMessage);

            // Run
            Application.Run(EditorCore.MainWindow);
        }
Example #26
0
        public Map CreateFromDirectory(WWorld world, EditorCore editorCore, string folderPath)
        {
            if (world == null)
                throw new ArgumentNullException("world", "No world to load map into specified.");

            if (string.IsNullOrEmpty(folderPath))
                throw new ArgumentException("folderPath is null or empty!");

            if (!System.IO.Directory.Exists(folderPath))
                throw new System.IO.DirectoryNotFoundException("folderPath not found, ensure the directory exists first!");

            // Calculate the Map Name from the folderPath - it should be the last segment of the folder path.s
            System.IO.DirectoryInfo rootFolderInfo = new System.IO.DirectoryInfo(folderPath);
            string mapName = rootFolderInfo.Name;

            // Sort the directories in rootFolderInfo into natural order, instead of alphabetical order which solves issues
            // where room indexes were getting remapped to the wrong one.
            IEnumerable<System.IO.DirectoryInfo> subFolders = rootFolderInfo.GetDirectories().OrderByNatural(x => x.Name);
            IEnumerable<System.IO.FileInfo> subFiles = rootFolderInfo.GetFiles().OrderByNatural(x => x.Name);

            // Maps are stored in two distinct parts. A Stage which encompasses global data for all rooms, and then
            // one or more rooms. We're going to load both the room and stage into ZArchives and then load the data
            // stored in them into different data.
            var archiveFolderMap = new Dictionary<string, VirtualFilesystemDirectory>();
            foreach (var dirInfo in subFolders)
            {
                VirtualFilesystemDirectory archive = null;

                string folderName = dirInfo.Name;
                if (folderName.ToLower().StartsWith("stage"))
                {
                    archive = new VirtualFilesystemDirectory(folderName);

                    if (archiveFolderMap.ContainsKey("stage"))
                    {
                        WLog.Warning(LogCategory.EditorCore, null, "{0} contains more than one stage archive, ignoring second...", folderPath);
                        continue;
                    }
                }
                else if (folderName.ToLower().StartsWith("room"))
                {
                    archive = new VirtualFilesystemDirectory(folderName);
                }

                // sea has LOD folders which don't have the right sub-folder setup, boo. This skips them for now,
                // maybe later we can add an ArchiveType.LOD.
                if (archive == null)
                    continue;

                // Fill the archives with their contents.
                archive.ImportFromDisk(dirInfo.FullName);
                archiveFolderMap[folderName.ToLower()] = archive;
            }

            // We're also going to try and process the files inside the folder to see if they're archives.
            foreach (var fileInfo in subFiles)
            {
                VirtualFilesystemDirectory archive = WArchiveTools.ArcUtilities.LoadArchive(fileInfo.FullName);

                // File wasn't a valid RARC archive.
                if (archive == null)
                    continue;

                if (archive.Name.ToLower().StartsWith("stage"))
                {
                    if (archiveFolderMap.ContainsKey("stage"))
                    {
                        WLog.Warning(LogCategory.EditorCore, null, "{0} contains more than one stage archive, ignoring second...", folderPath);
                        continue;
                    }
                }

                string arcName = System.IO.Path.GetFileNameWithoutExtension(fileInfo.FullName).ToLower();
                archiveFolderMap[arcName] = archive;
            }

            Map newMap = new Map();
            newMap.Name = mapName;
            newMap.ProjectFilePath = System.IO.Path.GetDirectoryName(folderPath);

            var sceneMap = CreateScenesFromArchives(newMap, archiveFolderMap);
            LoadEntities(newMap, editorCore, sceneMap, world);
            LoadModels(sceneMap);

            return newMap;
        }