コード例 #1
0
        protected override void OnFinalize()
        {
            Game game = _game;

            game.AfterTick       = (Action <float>)Delegate.Remove(game.AfterTick, new Action <float>(OnTick));
            _game                = null;
            _homeDatasource      = null;
            _navigatorDatasource = null;
            _encyclopediaData    = null;
            base.OnFinalize();
        }
コード例 #2
0
 private EncyclopediaPageVM ExecuteLink(string pageId, object obj, bool needsRefresh)
 {
     _navigatorDatasource.NavBarString = string.Empty;
     if (_encyclopediaData == null)
     {
         _encyclopediaData = new EncyclopediaData(this, ScreenManager.TopScreen, _homeDatasource, _navigatorDatasource, _setMapCameraPosition);
     }
     if (pageId == "LastPage")
     {
         Tuple <string, object> lastPage = _navigatorDatasource.GetLastPage();
         pageId = lastPage.Item1;
         obj    = lastPage.Item2;
     }
     base.IsEncyclopediaOpen = true;
     return(_encyclopediaData.ExecuteLink(pageId, obj, needsRefresh));
 }
コード例 #3
0
        public void ClosePage()
        {
            GauntletEncyclopediaScreenManager gauntletEncyclopediaScreenManager = MapScreen.Instance.EncyclopediaScreenManager as GauntletEncyclopediaScreenManager;

            if (gauntletEncyclopediaScreenManager == null)
            {
                return;
            }

            EncyclopediaData   encyclopediaData   = AccessTools.Field(typeof(GauntletEncyclopediaScreenManager), "_encyclopediaData").GetValue(gauntletEncyclopediaScreenManager) as EncyclopediaData;
            EncyclopediaPageVM encyclopediaPageVM = AccessTools.Field(typeof(EncyclopediaData), "_activeDatasource").GetValue(encyclopediaData) as EncyclopediaPageVM;

            this.selectedHeroPage = (encyclopediaPageVM as EncyclopediaHeroPageVM);

            if (this.selectedHeroPage == null)
            {
                return;
            }

            gauntletEncyclopediaScreenManager.CloseEncyclopedia();
        }
コード例 #4
0
        public void ClosePage()
        {
            GauntletEncyclopediaScreenManager gauntletEncyclopediaScreenManager = MapScreen.Instance.EncyclopediaScreenManager as GauntletEncyclopediaScreenManager;

            if (gauntletEncyclopediaScreenManager == null)
            {
                return;
            }

            FieldInfo          field              = typeof(GauntletEncyclopediaScreenManager).GetField("_encyclopediaData", BindingFlags.Instance | BindingFlags.NonPublic);
            FieldInfo          field2             = typeof(EncyclopediaData).GetField("_activeDatasource", BindingFlags.Instance | BindingFlags.NonPublic);
            EncyclopediaData   encyclopediaData   = (EncyclopediaData)field.GetValue(gauntletEncyclopediaScreenManager);
            EncyclopediaPageVM encyclopediaPageVM = (EncyclopediaPageVM)field2.GetValue(encyclopediaData);

            this.selectedHeroPage = (encyclopediaPageVM as EncyclopediaHeroPageVM);

            if (this.selectedHeroPage == null)
            {
                return;
            }

            gauntletEncyclopediaScreenManager.CloseEncyclopedia();
        }
コード例 #5
0
 public override void CloseEncyclopedia()
 {
     _encyclopediaData.CloseEncyclopedia();
     _encyclopediaData       = null;
     base.IsEncyclopediaOpen = false;
 }
        public void OnEncyclopediaPageChanged(EncyclopediaPageChangedEvent e)
        {
            EncyclopediaData.EncyclopediaPages newPage = e.NewPage;
            if ((int)newPage != 12)
            {
                selectedHeroPage = null;
                selectedHero     = null;
                if (gauntletLayerTopScreen != null && gauntletLayer != null)
                {
                    gauntletLayerTopScreen.RemoveLayer(gauntletLayer);
                    if (gauntletMovie != null)
                    {
                        gauntletLayer.ReleaseMovie(gauntletMovie);
                    }
                    gauntletLayerTopScreen = null;
                    gauntletMovie          = null;
                }
                return;
            }
            GauntletEncyclopediaScreenManager gauntletEncyclopediaScreenManager = MapScreen.Instance.EncyclopediaScreenManager as GauntletEncyclopediaScreenManager;

            if (gauntletEncyclopediaScreenManager == null)
            {
                return;
            }

            EncyclopediaData   encyclopediaData   = ReflectUtils.ReflectField <EncyclopediaData>("_encyclopediaData", gauntletEncyclopediaScreenManager);
            EncyclopediaPageVM encyclopediaPageVM = ReflectUtils.ReflectField <EncyclopediaPageVM>("_activeDatasource", encyclopediaData);

            selectedHeroPage = (encyclopediaPageVM as EncyclopediaHeroPageVM);

            if (selectedHeroPage == null)
            {
                return;
            }
            selectedHero = (selectedHeroPage.Obj as Hero);
            if (selectedHero == null)
            {
                return;
            }
            if (gauntletLayer == null)
            {
                gauntletLayer = new GauntletLayer(211, "GauntletLayer");
            }

            try
            {
                if (viewModel == null)
                {
                    viewModel = new HeroBuilderVM(delegate(Hero editHero)
                    {
                        InformationManager.DisplayMessage(new InformationMessage(new TextObject("{=CharacterCreation_EditAppearanceForHeroMessage}Entering edit appearance for: ").ToString() + editHero));
                    });
                }
                viewModel.SetHero(selectedHero);
                gauntletMovie          = gauntletLayer.LoadMovie("HeroEditor", viewModel);
                gauntletLayerTopScreen = ScreenManager.TopScreen;
                gauntletLayerTopScreen.AddLayer(gauntletLayer);
                gauntletLayer.InputRestrictions.SetInputRestrictions(true, InputUsageMask.MouseButtons);

                // Refresh
                selectedHeroPage.Refresh();
            }
            catch (Exception ex)
            {
                // MessageBox.Show($"Error :\n{ex.Message} \n\n{ex.InnerException?.Message}");
            }
        }
コード例 #7
0
        protected override void OnGameStart(Game game, IGameStarter gameStarterObject)
        {
            base.OnGameStart(game, gameStarterObject);

            if (!(game.GameType is Campaign))
            {
                return;
            }
            AddModels(gameStarterObject as CampaignGameStarter);

            game.EventManager.RegisterEvent(delegate(EncyclopediaPageChangedEvent e)
            {
                EncyclopediaData.EncyclopediaPages newPage = e.NewPage;
                if ((int)newPage != 12)
                {
                    this.selectedHeroPage = null;
                    this.selectedHero     = null;
                    if (this.gauntletLayerTopScreen != null && this.gauntletLayer != null)
                    {
                        this.gauntletLayerTopScreen.RemoveLayer(this.gauntletLayer);
                        if (this.gauntletMovie != null)
                        {
                            this.gauntletLayer.ReleaseMovie(this.gauntletMovie);
                        }
                        this.gauntletLayerTopScreen = null;
                        this.gauntletMovie          = null;
                    }
                    return;
                }
                GauntletEncyclopediaScreenManager gauntletEncyclopediaScreenManager = MapScreen.Instance.EncyclopediaScreenManager as GauntletEncyclopediaScreenManager;
                if (gauntletEncyclopediaScreenManager == null)
                {
                    return;
                }

                FieldInfo field  = typeof(GauntletEncyclopediaScreenManager).GetField("_encyclopediaData", BindingFlags.Instance | BindingFlags.NonPublic);
                FieldInfo field2 = typeof(EncyclopediaData).GetField("_activeDatasource", BindingFlags.Instance | BindingFlags.NonPublic);
                EncyclopediaData encyclopediaData     = (EncyclopediaData)field.GetValue(gauntletEncyclopediaScreenManager);
                EncyclopediaPageVM encyclopediaPageVM = (EncyclopediaPageVM)field2.GetValue(encyclopediaData);
                this.selectedHeroPage = (encyclopediaPageVM as EncyclopediaHeroPageVM);

                if (this.selectedHeroPage == null)
                {
                    return;
                }
                this.selectedHero = (this.selectedHeroPage.Obj as Hero);
                if (this.selectedHero == null)
                {
                    return;
                }
                if (this.gauntletLayer == null)
                {
                    this.gauntletLayer = new GauntletLayer(211, "GauntletLayer");
                }

                try
                {
                    if (this.viewModel == null)
                    {
                        this.viewModel = new HeroBuilderVM(this.heroModel, delegate(Hero editHero)
                        {
                            InformationManager.DisplayMessage(new InformationMessage("Entering edit appearance for: " + editHero));
                        });
                    }
                    this.viewModel.SetHero(this.selectedHero);
                    this.gauntletMovie          = this.gauntletLayer.LoadMovie("HeroEditor", this.viewModel);
                    this.gauntletLayerTopScreen = ScreenManager.TopScreen;
                    this.gauntletLayerTopScreen.AddLayer(this.gauntletLayer);
                    this.gauntletLayer.InputRestrictions.SetInputRestrictions(true, InputUsageMask.MouseButtons);

                    // Refresh
                    this.selectedHeroPage.Refresh();
                }
                catch (Exception ex)
                {
                    MessageBox.Show($"Error :\n{ex.Message} \n\n{ex.InnerException?.Message}");
                }
            });
        }