Esempio n. 1
0
        protected override bool OnCreate()
        {
            if (!base.OnCreate())
            {
                return(false);
            }

            LongOperationNotifier.Setup();

            Log.Info(">> 初始化 EntitySystemWorld...");
            if (!EntitySystemWorld.Init(new EntitySystemWorld()))
            {
                Log.Info(">> EntitySystemWorld 初始化失败!");
                return(false);
            }

            WorldType worldType = EntitySystemWorld.Instance.DefaultWorldType;

            if (!EntitySystemWorld.Instance.WorldCreate(WorldSimulationTypes.Editor, worldType))
            {
                Log.Info(">> 创建世界失败, WorldType: {0}", worldType);
                return(false);
            }

            instance = this;

            DesignerInterface.Init(new DesignerInterfaceImpl());
            EntityWorld.Setup();

            if (MainForm.Instance != null)
            {
                /*
                 * if (MainForm.Instance.ResourcesForm != null)
                 * {
                 *  MainForm.Instance.ResourcesForm.ResourceChange += new ResourcesForm.ResourceChangeDelegate(this.OnResourceChange);
                 *  MainForm.Instance.ResourcesForm.IsResourceEditModeActive += new ResourcesForm.IsResourceEditModeActiveDelegate(this.OnIsResourceEditMode);
                 *  MainForm.Instance.ResourcesForm.ResourceBeginEditMode += new ResourcesForm.ResourceBeginEditModeDelegate(this.OnResourceBeginEditMode);
                 *  MainForm.Instance.ResourcesForm.ResourceRename += new ResourcesForm.ResourceRenameDelegate(this.OnResourceRename);
                 * }
                 * //*/
                if (MainForm.Instance.PropertiesForm != null)
                {
                    MainForm.Instance.PropertiesForm.ReadOnly = true;
                }
            }
            ResourceUtils.OnUITypeEditorEditValue += ResourceUtils_OnUITypeEditorEditValue;

            AddonManager.PreInit();
            InitResourceTypeManager();

            UndoSystem.Init(64);

            //EntitySystemWorld.Instance.Simulation = true;
            return(true);
        }