示例#1
0
        /// <summary>
        /// Renders list of config views on custom editor.
        /// </summary>
        public static void Render(MVCEditor editor, MvcConfig config)
        {
            ConfigViewEditorFlags.Setup(config);

            DrawControls(editor, config);
            DrawViews(editor, config);
        }
示例#2
0
 protected void Application_Start()
 {
     AreaRegistration.RegisterAllAreas();
     RouteConfig.RegisterRoutes(RouteTable.Routes);
     MvcConfig.Setup();
     DependencyConfig.Setup();
 }
示例#3
0
 private static void DrawControls(MVCEditor editor, MvcConfig config)
 {
     if (GUILayout.Button(IsShowingView ? "Hide views" : "Show views"))
     {
         IsShowingView = !IsShowingView;
     }
 }
示例#4
0
 private static void RenderNoInitialView(MvcConfig config)
 {
     if (config.InitialView == null)
     {
         DisplayWarning("The initial view is not assigned. " +
                        "If this was intended, call MVC.ShowView() manually when you need to start displaying the views.");
     }
 }
示例#5
0
        /// <summary>
        /// Synchronizes project with MVC configuration.
        /// </summary>
        public static void Sync(MvcConfig config)
        {
            config.Save();

            MvcWorkspace.AutogenMVC(config);
            for (int i = 0; i < config.Views.Count; i++)
            {
                MvcWorkspace.AutogenView(config.Views[i]);
            }

            AssetDatabase.Refresh();
        }
示例#6
0
        public static void Render(MVCEditor editor, MvcConfig config)
        {
            if (GUILayout.Button(IsShowingWarning ? "Hide warnings" : "Show warnings"))
            {
                IsShowingWarning = !IsShowingWarning;
            }

            if (IsShowingWarning)
            {
                RenderNoInitialView(config);
                RenderMissingPrefab(editor, config);
            }
        }
示例#7
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public IServiceProvider ConfigureServices(IServiceCollection services)
        {
            BackgroundServiceConfig.ConfigureServices(services, Configuration);
            MvcConfig.ConfigureServices(services, Configuration);

            AuthConfig.ConfigureServices(services, Configuration);
            DataConfig.ConfigureServices(services, Configuration);
            CacheConfig.ConfigureServices(services, Configuration);

            ReportServiceConfig.ConfigureServices(services, Configuration);
            UploadConfig.ConfigureServices(services, Configuration);

            return(IocConfig.ConfigureServices(services, Configuration));
        }
示例#8
0
 private static void RenderMissingPrefab(MVCEditor editor, MvcConfig config)
 {
     for (int i = 0; i < config.Views.Count; i++)
     {
         var view = config.Views[i];
         if (!File.Exists(MvcResources.GetViewPrefabPath(view, view.GetViewName(), true)))
         {
             DisplayWarning(string.Format(
                                "Missing prefab for view ({0}) at path: Resources/{1}",
                                view.Name,
                                MvcResources.GetViewPrefabPath(view, view.GetViewName())
                                ));
         }
     }
 }
示例#9
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
        {
            //TODO:
            //if (env.IsDevelopment())
            //    app.UseDeveloperExceptionPage();

            BackgroundServiceConfig.Configure(app, env, loggerFactory, Configuration);
            DataConfig.Configure(app, env, loggerFactory, Configuration);
            LogConfig.Configure(app, env, loggerFactory, Configuration);
            AuthConfig.Configure(app, env, loggerFactory, Configuration);
            MvcConfig.Configure(app, env, loggerFactory, Configuration);

            ReportServiceConfig.Configure(app, env, loggerFactory, Configuration);
            MessageHubConfig.Configure(app, env, loggerFactory, Configuration);
        }
示例#10
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();

            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);

            RouteConfig.RegisterRoutes(RouteTable.Routes);

            BundleConfig.RegisterBundles(BundleTable.Bundles);

            NMoneysConfig.Configure();

            MvcConfig.Optimize();

            ApiConfig.RegisterApi();
        }
示例#11
0
        public static void Setup(MvcConfig config)
        {
            if (IsOpen == null)
            {
                IsOpen = new List <bool>();
            }

            for (int i = IsOpen.Count; i < config.Views.Count; i++)
            {
                IsOpen.Add(false);
            }
            for (int i = config.Views.Count; i < IsOpen.Count; i++)
            {
                IsOpen.RemoveAt(0);
            }
        }
示例#12
0
        private static bool ApplyEdit(MvcConfig config, MvcConfig.View view)
        {
            // Silently replace view name that ends with suffix "View".
            editingName = ViewNameTrim(editingName);

            if (view.SetViewName(editingName) && view.SetBaseClassName(editingBaseClassName) &&
                config.IsConfigValid())
            {
                view.LifeType        = editingLifeType;
                view.ViewRescaleMode = editingRescaleMode;
                if (editingInitial != view.IsInitial)
                {
                    config.ToggleInitial(editingInitial ? view : null);
                }
                return(true);
            }
            return(false);
        }
示例#13
0
        private static void DrawViews(MVCEditor editor, MvcConfig config)
        {
            if (!IsShowingView)
            {
                return;
            }

            GUILayout.BeginVertical("GroupBox");

            for (int i = 0; i < config.Views.Count; i++)
            {
                if (ConfigViewEditorFlags.IsOpen[i])
                {
                    DrawOpenedView(editor, config, config.Views[i], i);
                }
                else
                {
                    DrawClosedView(editor, config, config.Views[i], i);
                }
            }

            EditorColors.SetBackgroundColor(Color.green);
            {
                if (GUILayout.Button("Create View"))
                {
                    config.Views.Add(new MvcConfig.View(config)
                    {
                        Name = "View" + config.Views.Count
                    });

                    ConfigViewEditorFlags.Setup(config);
                    ConfigViewEditorFlags.SetOpen(config.Views.Count - 1);
                    SetEdit(config.Views.GetLast());
                }
            }
            EditorColors.ResetBackgroundColor();

            GUILayout.EndVertical();
        }
示例#14
0
        private static void DrawClosedView(MVCEditor editor, MvcConfig config, MvcConfig.View view, int index)
        {
            GUILayout.BeginHorizontal("GroupBox");

            GUILayout.BeginVertical();
            GUILayout.BeginHorizontal();
            GUILayout.Label(view.Name + " : " + view.GetBaseClass());
            GUILayout.Label(view.LifeType.ToString() + " on dispose.");
            if (view.IsInitial)
            {
                GUILayout.Label("Initial view");
            }
            GUILayout.EndHorizontal();
            GUILayout.EndVertical();

            if (GUILayout.Button("Edit"))
            {
                ConfigViewEditorFlags.SetOpen(index);
                SetEdit(view);
            }

            GUILayout.EndHorizontal();
        }
示例#15
0
        protected void Application_Start(object sender, EventArgs e)
        {
            WebApiConfig.Register(GlobalConfiguration.Configuration);
            MvcConfig.RegisterRoutes(RouteTable.Routes);
            MvcConfig.RegisterGlobalFilters(GlobalFilters.Filters);

            _bus.RegisterHandler <CheckInItemsToInventory>(commands.Handle);
            _bus.RegisterHandler <CreateInventoryItem>(commands.Handle);
            _bus.RegisterHandler <DeactivateInventoryItem>(commands.Handle);
            _bus.RegisterHandler <RemoveItemsFromInventory>(commands.Handle);
            _bus.RegisterHandler <RenameInventoryItem>(commands.Handle);
            var detail = new InvenotryItemDetailView();

            _bus.RegisterHandler <InventoryItemCreated>(detail.Handle);
            _bus.RegisterHandler <InventoryItemDeactivated>(detail.Handle);
            _bus.RegisterHandler <InventoryItemRenamed>(detail.Handle);
            _bus.RegisterHandler <ItemsCheckedInToInventory>(detail.Handle);
            _bus.RegisterHandler <ItemsRemovedFromInventory>(detail.Handle);
            var list = new InventoryListView();

            _bus.RegisterHandler <InventoryItemCreated>(list.Handle);
            _bus.RegisterHandler <InventoryItemRenamed>(list.Handle);
            _bus.RegisterHandler <InventoryItemDeactivated>(list.Handle);
        }
示例#16
0
 // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
 public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
 {
     MvcConfig.Configure(app, env);
     AuthenticationConfig.Configure(app, env);
     BlazorConfig.Configure(app, env);
 }
示例#17
0
文件: sys.cs 项目: zuhuizou/wojilu
 public void ClearMvcConfig()
 {
     MvcConfig.Reset();
 }
示例#18
0
 public HomeController(MvcConfig mvcConfig)
 {
     _mvcConfig = mvcConfig;
 }
示例#19
0
        private static void DrawOpenedView(MVCEditor editor, MvcConfig config, MvcConfig.View view, int index)
        {
            GUILayout.BeginVertical("LightmapEditorSelectedHighlight");

            editingName = ViewNameTrim(
                EditorGUILayout.TextField("View name", editingName)
                );
            editingBaseClassName = EditorGUILayout.TextField("Custom base class", editingBaseClassName);
            editingLifeType      = (MvcLifeType)EditorGUILayout.EnumPopup("Custom lifecycle", editingLifeType);
            editingRescaleMode   = (MvcRescaleType)EditorGUILayout.EnumPopup("View rescale mode", editingRescaleMode);
            editingInitial       = EditorGUILayout.Toggle("Is initial view?", editingInitial);

            if (GUILayout.Button("Save & Close"))
            {
                if (ApplyEdit(config, view))
                {
                    ConfigViewEditorFlags.ResetFlags();
                }
            }

            EditorColors.SetBackgroundColor(Color.red);
            {
                if (GUILayout.Button("Danger Zone!"))
                {
                    ConfigViewEditorFlags.IsDeleteOpen ^= true;
                }
            }
            EditorColors.ResetBackgroundColor();

            if (ConfigViewEditorFlags.IsDeleteOpen)
            {
                GUILayout.BeginVertical("GroupBox");

                EditorGUILayout.HelpBox(
                    "It is highly recommended to apply configurations first before performing any actions here.",
                    MessageType.Warning
                    );

                // Red background for danger zone buttons
                EditorColors.SetBackgroundColor(Color.red);
                {
                    if (GUILayout.Button("Delete config"))
                    {
                        if (EditorDialog.OpenAlert(
                                "Delete view configuration.",
                                "Are you sure you want to delete this view's configuration? " + DeleteWarning,
                                "Yes", "No"))
                        {
                            // Remove view from views list.
                            MvcViewRemover.RemoveFromConfig(config.Views, index);
                            ConfigViewEditorFlags.Setup(config);
                            ConfigViewEditorFlags.ResetFlags();
                        }
                    }

                    // If loaded from resources, the user must've already created a prefab or at least scripts.
                    if (view.IsFromResources)
                    {
                        EditorGUILayout.Space();

                        if (GUILayout.Button("Delete prefab"))
                        {
                            // Confirm prefab deletion
                            if (EditorDialog.OpenAlert(
                                    "Delete view prefab",
                                    "Are you sure you want to delete this view's prefab? " + DeleteWarning,
                                    "Yes", "No"))
                            {
                                MvcViewRemover.RemovePrefab(view);
                            }
                        }

                        EditorGUILayout.Space();

                        if (GUILayout.Button("Delete all"))
                        {
                            // Confirm deletion of all view-related things
                            if (EditorDialog.OpenAlert(
                                    "Delete view config, scripts, prefab",
                                    "Are you sure you want to delete this view's config, scripts, and prefab?" + DeleteWarning,
                                    "Yes", "No"))
                            {
                                MvcViewRemover.RemoveFromConfig(config.Views, index);
                                MvcViewRemover.RemoveScripts(view);
                                MvcViewRemover.RemovePrefab(view);
                                MvcViewRemover.Finalize(config);

                                ConfigViewEditorFlags.Setup(config);
                                ConfigViewEditorFlags.ResetFlags();
                            }
                        }
                    }
                }
                EditorColors.ResetBackgroundColor();

                GUILayout.EndVertical();
            }

            GUILayout.EndVertical();
        }
示例#20
0
 protected void Application_Start(object sender, EventArgs e)
 {
     WebApiConfig.Register(GlobalConfiguration.Configuration);
     MvcConfig.RegisterRoutes(RouteTable.Routes);
     MvcConfig.RegisterGlobalFilters(GlobalFilters.Filters);
 }