Exemplo n.º 1
0
        private void OnSaveLevelAs(object argument)
        {
            CAssetBrowserViewModel assetBrowser = Instance.GetTool <CAssetBrowserViewModel>();
            string assetPath = assetBrowser.ActiveDirectory;

            CEngine.Instance.Dispatch(EEngineUpdatePriority.BeginFrame, () =>
            {
                CLevelAsset levelAsset = new CLevelAsset(CEngine.Instance.CurrentWorld.LoadedLevel, "Level", assetPath);
                Application.Current.Dispatcher.BeginInvoke(DispatcherPriority.Normal, (Action)(() =>
                {
                    assetBrowser.UpdateShownAssets();
                }));
            });
        }
        private void OnCreateAssetFromEntity(object e)
        {
            // We need the asset browser to get the active path where we want to save the entity asset
            CAssetBrowserViewModel assetBrowser = CWorkspace.Instance.GetTool <CAssetBrowserViewModel>();
            string assetPath = assetBrowser.ActiveDirectory;

            CEngine.Instance.Dispatch(EEngineUpdatePriority.BeginFrame, () =>
            {
                CEntity entity = EntityId.GetEntity();
                CEntityAsset <CEntity> .CreateFromEntity(entity, assetPath);
                Application.Current.Dispatcher.BeginInvoke(DispatcherPriority.Normal, (Action)(() =>
                {
                    assetBrowser.UpdateShownAssets();
                }));
            });
        }
Exemplo n.º 3
0
        private void OnSaveLevel(object arg)
        {
            string assetPath = null;

            CAssetBrowserViewModel assetBrowser = Instance.GetTool <CAssetBrowserViewModel>();

            if (OpenedLevelAsset != null)
            {
                assetPath = OpenedLevelAsset.GetAsset().Path;
                CLevelAsset asset = OpenedLevelAsset.GetAsset();

                CEngine.Instance.Dispatch(EEngineUpdatePriority.BeginFrame, () =>
                {
                    asset.SetLevel(CEngine.Instance.CurrentWorld.LoadedLevel);
                    CAssetRegistry.Instance.SaveAsset(asset);

                    Application.Current.Dispatcher.BeginInvoke(DispatcherPriority.Normal, (Action)(() =>
                    {
                        assetBrowser.UpdateShownAssets();
                    }));
                });
            }
        }