Exemple #1
0
        /// <summary>
        /// 构造器
        /// </summary>
        public MainWindow()
        {
            InitializeComponent();
            ViewManager.SetWindowReference(this);
            this.Title             = GlobalConfigContext.GAME_TITLE_NAME;
            this.Width             = GlobalConfigContext.GAME_VIEWPORT_WIDTH;
            this.Height            = GlobalConfigContext.GAME_VIEWPORT_ACTUALHEIGHT;
            this.mainCanvas.Width  = GlobalConfigContext.GAME_WINDOW_WIDTH;
            this.mainCanvas.Height = GlobalConfigContext.GAME_WINDOW_HEIGHT;
            this.ResizeMode        = GlobalConfigContext.GAME_WINDOW_RESIZEABLE ? ResizeMode.CanResize : ResizeMode.NoResize;
            // 加载主页面
            this.mainFrame.Width  = GlobalConfigContext.GAME_WINDOW_WIDTH;
            this.mainFrame.Height = GlobalConfigContext.GAME_WINDOW_HEIGHT;
            ViewPageManager.RegisterPage("SplashPage", new SplashPage());
            ViewPageManager.RegisterPage("LHPage", new LHPage());
            ViewPageManager.RegisterPage("LHStartPage", new LHStartPage());
            this.maskFrame.Width  = GlobalConfigContext.GAME_WINDOW_WIDTH;
            this.maskFrame.Height = GlobalConfigContext.GAME_WINDOW_HEIGHT;
            this.uiFrame.Width    = GlobalConfigContext.GAME_WINDOW_WIDTH;
            this.uiFrame.Height   = GlobalConfigContext.GAME_WINDOW_HEIGHT;

            ViewManager.MaskFrameRef = this.maskFrame;
            InputMethod.SetIsInputMethodEnabled(this, false);
            this.mainFrame.Content = ViewPageManager.RetrievePage("SplashPage");

            if (GlobalConfigContext.GAME_WINDOW_FULLSCREEN)
            {
                Director.IsFullScreen = true;
                this.FullScreenTransform();
            }
            logger.Info("main window loaded");
        }
 /// <summary>
 /// 强制跳转到主舞台
 /// </summary>
 public void GoToMainStage()
 {
     if (MainWindow.initFlag == false)
     {
         if (GlobalConfigContext.GAME_IS3D)
         {
             this.world.SetStagePageReference(new Stage3D());
         }
         else
         {
             this.world.SetStagePageReference(new Stage2D());
         }
         // 预注册保存和读取页面
         ViewPageManager.RegisterPage("SavePage", new SLPage(isSave: true));
         ViewPageManager.RegisterPage("LoadPage", new SLPage(isSave: false));
         MainWindow.initFlag = true;
     }
     this.mainFrame.Content = ViewPageManager.RetrievePage(GlobalConfigContext.FirstViewPage);
     Director.ResumeUpdateContext();
 }
Exemple #3
0
 /// <summary>
 /// 设置主舞台页面的引用
 /// </summary>
 /// <param name="sp">主舞台对象</param>
 public void SetStagePageReference(Page sp)
 {
     ViewPageManager.RegisterPage(GlobalConfigContext.FirstViewPage, sp);
     ViewPageManager.InitFirstPage(sp);
 }