Example #1
0
        protected override void OnAgentControllerChanged(Agent agent)
        {
            /*if (null == MissionScreen) {
             *  FocusOnAgent(agent);
             * }*/
            if (!enable)
            {
                return;
            }

            if (null == MissionScreen)
            {
                enable = false;
                return;
            }
            if (_showControlHintLayer != null && textHandler != null)
            {
                return;
            }
            _showControlHintLayer = new GauntletLayer(1);
            textHandler           = new KillInfoWriteHandler(true, GameLoadConfiguration.horizontalAlignment);
            _showControlHintLayer.LoadMovie("showControlHint", textHandler);
            MissionScreen.AddLayer(_showControlHintLayer);
            textHandler.SetShowText(true);
        }
        protected override void OnInitialize()
        {
            base.OnInitialize();
            SpriteData spriteData = UIResourceManager.SpriteData;
            TwoDimensionEngineResourceContext resourceContext = UIResourceManager.ResourceContext;
            ResourceDepot uIResourceDepot = UIResourceManager.UIResourceDepot;

            _clanCategory = spriteData.SpriteCategories["ui_clan"];
            _clanCategory.Load(resourceContext, uIResourceDepot);

            this._kingdomCategory = spriteData.SpriteCategories["ui_kingdom"];
            this._kingdomCategory.Load(resourceContext, uIResourceDepot);

            this._spriteCategory = spriteData.SpriteCategories["ui_options"];
            this._spriteCategory.Load(resourceContext, uIResourceDepot);


            _gauntletLayer = new GauntletLayer(1);
            _gauntletLayer.InputRestrictions.SetInputRestrictions();
            _gauntletLayer.Input.RegisterHotKeyCategory(HotKeyManager.GetCategory("GenericCampaignPanelsGameKeyCategory"));

            _gauntletLayer.IsFocusLayer = true;
            ScreenManager.TrySetFocus(_gauntletLayer);
            AddLayer(_gauntletLayer);
            _dataSource = new WangVM(CloseWangScreen, OpenPartyAsManage, OpenBannerEditorWithPlayerClan);
            _gauntletLayer.LoadMovie("WangScreen", _dataSource);
            //   Game.Current.EventManager.TriggerEvent(new TutorialContextChangedEvent(TutorialContexts.ClanScreen));
        }
Example #3
0
        public void CreateLayout()
        {
            SpriteData spriteData = UIResourceManager.SpriteData;
            TwoDimensionEngineResourceContext resourceContext = UIResourceManager.ResourceContext;
            ResourceDepot uiResourceDepot = UIResourceManager.UIResourceDepot;

            this._spriteCategory = spriteData.SpriteCategories["ui_crafting"];
            this._spriteCategory.Load((ITwoDimensionResourceContext)resourceContext, uiResourceDepot);

            this._gauntletLayer = new GauntletLayer(1, "GauntletLayer");
            this._gauntletLayer.InputRestrictions.SetInputRestrictions(true, InputUsageMask.All);
            this._gauntletLayer.Input.RegisterHotKeyCategory(HotKeyManager.GetCategory("GenericCampaignPanelsGameKeyCategory"));
            this._gauntletLayer.IsFocusLayer = true;
            //ScreenManager.TrySetFocus((ScreenLayer) this._gauntletLayer);
            MissionScreen.AddLayer((ScreenLayer)this._gauntletLayer);
            this._gauntletLayer.LoadMovie("ScrollGrid", new GameEntityVM());


            //this._testGlobalLayer = new testGlobalLayer();
            //this._testGlobalLayer.Initialize(); // screen where
            //MissionScreen.AddLayer(this._testGlobalLayer.Layer);
            //MissionScreen
            // ScreenManager.AddGlobalLayer(this._testGlobalLayer, true);
            //ScreenManager.TrySetFocus(this._testGlobalLayer.Layer);
        }
        protected override void OnInitialize()
        {
            try
            {
                base.OnInitialize();

                this._dataSource    = new TownRevoltViewModel(this._settlementInfo);
                this._gauntletLayer = new GauntletLayer(100)
                {
                    IsFocusLayer = true
                };

                this.AddLayer(this._gauntletLayer);
                this._gauntletLayer.InputRestrictions.SetInputRestrictions();
                ScreenManager.TrySetFocus(this._gauntletLayer);
                this._gauntletLayer.LoadMovie("TownRevoltScreen", this._dataSource);
            }
            catch (Exception exception)
            {
                InformationManager.DisplayMessage(new InformationMessage($"Revolutions: Error while initializing screen. Turn on debug mode for details.", ColorHelper.Red));

                if (RevolutionsSettings.Instance.DebugMode)
                {
                    InformationManager.DisplayMessage(new InformationMessage($"{exception.Message}{Environment.NewLine}{exception.StackTrace}", ColorHelper.Red));
                }
            }
        }
Example #5
0
        public static void AddPartyWidgets(GauntletPartyScreen partyScreen)
        {
            try
            {
                if (!PartyManagerSettings.Settings.HideUIWidgets)
                {
                    var newLayer = new GauntletLayer(100, "GauntletLayer");


                    newLayer.InputRestrictions.SetInputRestrictions(true, InputUsageMask.All);

                    var partyManagerModVm = new PartyManagerVM(partyScreen.GetPartyVM(), partyScreen.GetPartyVM()?.GetPartyScreenLogic(), partyScreen);

                    newLayer?.LoadMovie("PartyManagerModScreen", (TaleWorlds.Library.ViewModel)partyManagerModVm);
                    CurrentInstance.WidgetsAdded = true;
                    partyScreen.AddLayer(newLayer);
                    GenericHelpers.LogDebug("AddPartyWidgets", "Party Widget Added");
                }
                else
                {
                    GenericHelpers.LogDebug("AddPartyWidgets", "Skipped adding widgets");
                }
            }
            catch (Exception ex)
            {
                GenericHelpers.LogException("AddPartyWidgets", ex);
            }
        }
 private void OnEscapeMenuToggled(bool isOpened)
 {
     if (isOpened)
     {
         if (!GameNetwork.IsMultiplayer)
         {
             MBCommon.PauseGameEngine();
         }
     }
     else
     {
         MBCommon.UnPauseGameEngine();
     }
     if (isOpened)
     {
         _dataSource    = new OptionsModOptionsViewModel(new OptionsVM(GameNetwork.IsMultiplayer, OnCloseOptions, OnKeybindRequest), new ModOptionsVM());
         _gauntletLayer = new GauntletLayer(ViewOrderPriorty, "GauntletLayer");
         _gauntletLayer.InputRestrictions.SetInputRestrictions(true, InputUsageMask.All);
         _gauntletLayer.Input.RegisterHotKeyCategory(HotKeyManager.GetCategory("GenericPanelGameKeyCategory"));
         _movie = _gauntletLayer.LoadMovie("OptionsWithModOptionsView_v3", _dataSource);
         MissionScreen.AddLayer(_gauntletLayer);
         _gauntletLayer.IsFocusLayer = true;
         ScreenManager.TrySetFocus(_gauntletLayer);
         return;
     }
     _gauntletLayer.InputRestrictions.ResetInputRestrictions();
     _gauntletLayer.IsFocusLayer = false;
     ScreenManager.TryLoseFocus(_gauntletLayer);
     MissionScreen.RemoveLayer(_gauntletLayer);
     _keybindingPopup?.OnToggle(false);
     _gauntletLayer = null !;
     _dataSource?.OnFinalize();
     _dataSource    = null !;
     _gauntletLayer = null !;
 }
Example #7
0
 public AacUiApplier(AacMissionBehavior aacMissionBehavior, ViewModel viewModel)
 {
     ViewModel = viewModel;
     aacMissionBehavior.BattleStartEvent += OnBattleStart;
     GauntletLayer = new GauntletLayer(100);
     GauntletLayer.LoadMovie("ArmyArrowCounter", ViewModel);
 }
Example #8
0
 protected override void OnFinalize()
 {
     base.OnFinalize();
     _gauntletLayer = null;
     _dataSource    = null;
     _movie         = null;
 }
 protected override void OnFinalize()
 {
     base.OnFinalize();
     RemoveLayer(_gauntletLayer);
     //_dataSource = null;
     _gauntletLayer = null;
 }
        protected override void OnFinalize()
        {
            base.OnFinalize();

            this._gauntletLayer = null;
            this._dataSource    = null;
        }
Example #11
0
 protected override void OnFinalize()
 {
     base.OnFinalize();
     this.DataSource.OnFinalize();
     base.MapScreen.RemoveLayer(this.Layer);
     this.Layer = null;
 }
        protected override void OnActivate()
        {
            base.OnActivate();
            SpriteData spriteData = UIResourceManager.SpriteData;
            TwoDimensionEngineResourceContext resourceContext = UIResourceManager.ResourceContext;
            ResourceDepot uIResourceDepot = UIResourceManager.UIResourceDepot;

            this._characterdeveloper = spriteData.SpriteCategories["ui_characterdeveloper"];
            this._characterdeveloper.Load(resourceContext, uIResourceDepot);

            //this._clanCategory = spriteData.SpriteCategories["ui_encyclopedia"];
            //this._clanCategory.Load(resourceContext, uIResourceDepot);

            this._clanCategory = spriteData.SpriteCategories["ui_clan"];
            this._clanCategory.Load(resourceContext, uIResourceDepot);

            this._gauntletLayer = new GauntletLayer(1, "GauntletLayer");
            this._gauntletLayer.InputRestrictions.SetInputRestrictions(true, InputUsageMask.All);
            this._gauntletLayer.Input.RegisterHotKeyCategory(HotKeyManager.GetCategory("GenericCampaignPanelsGameKeyCategory"));
            this._gauntletLayer.IsFocusLayer = true;
            ScreenManager.TrySetFocus(this._gauntletLayer);
            base.AddLayer(this._gauntletLayer);

            this._dataSource = new HereAdminDashBoardVM(this._heroAdminState.EditHero, OnCloseHereAdminDashBoard);

            this._gauntletLayer.LoadMovie("HeroAdminDashBoard", this._dataSource);
        }
        private static void OnCharacterPortraitPopUpOpened(CharacterObject characterObject)
        {
            if (characterObject == null || LocationComplex.Current == null)
            {
                return;
            }

            Location locationOfCharacter = LocationComplex.Current.GetLocationOfCharacter(characterObject.HeroObject);

            if (!characterObject.HeroObject.IsPrisoner)
            {
                return;
            }

            heroToTalk = characterObject.HeroObject;

            MenuContext menuContext = Campaign.Current.CurrentMenuContext;

            if (menuContext == null)
            {
                return;
            }

            GameOverlays.MenuOverlayType menuOverlayType = Campaign.Current.GameMenuManager.GetMenuOverlayType(menuContext);

            if (menuOverlayType == GameOverlays.MenuOverlayType.SettlementWithCharacters)
            {
                // get menu overlay layer, see GauntletMenuOverlayBase;
                ScreenBase topScreen = ScreenManager.TopScreen;
                if (topScreen == null)
                {
                    return;
                }
                GauntletLayer gauntletLayer = topScreen.FindLayer <ScreenLayer>("BasicLayer") as GauntletLayer;
                if (gauntletLayer == null)
                {
                    return;
                }

                // get _moviesAndDatasources, its public
                // and there will be ViewModel for SettlementMenuOverlayVM;
                var movieAndDatasource = gauntletLayer._moviesAndDatasources.FirstOrDefault(p => p.Item2 is SettlementMenuOverlayVM);
                if (movieAndDatasource == null)
                {
                    return;
                }
                SettlementMenuOverlayVM dataSource = movieAndDatasource.Item2 as SettlementMenuOverlayVM;

                // it has prop ContextList;
                // you should add new items there, example ExecuteOnSetAsActiveContextMenuItem;
                GameMenuOverlayActionVM overlayItem = new GameMenuOverlayActionVM(
                    OnTalkToPrisonerAction,
                    GameTexts.FindText("str_menu_overlay_context_list", "Conversation").ToString(),
                    true,
                    1, // ID for Conversation
                    "");
                dataSource.ContextList.Add(overlayItem);
            }
        }
Example #14
0
 public override void OnMissionScreenFinalize()
 {
     base.OnMissionScreenFinalize();
     GauntletLayer = null;
     _dataSource?.OnFinalize();
     _dataSource = null;
     _movie      = null;
 }
 public void Deactivate()
 {
     _gauntletLayer.InputRestrictions.ResetInputRestrictions();
     MissionScreen.RemoveLayer(_gauntletLayer);
     _gauntletLayer = null;
     _dataSource.OnFinalize();
     _dataSource = null;
 }
 protected override void OnFinalize()
 {
     this.UnloadMovie();
     this.RemoveLayer((ScreenLayer)this._gauntletLayer);
     this._dataSource    = (CustomBattleMenuVM)null;
     this._gauntletLayer = (GauntletLayer)null;
     base.OnFinalize();
 }
Example #17
0
 protected override void OnFinalize()
 {
     base.OnFinalize();
     this._gauntletMovie = (GauntletMovie)null;
     this._dataSource.OnFinalize();
     this._dataSource    = (SPInventoryVM)null;
     this._gauntletLayer = (GauntletLayer)null;
 }
 private void RemoveLayer(FaceGenVMCustomEventOff customEvent)
 {
     if (_layer != null)
     {
         ScreenManager.TopScreen?.RemoveLayer(_layer);
         _layer = null;
     }
 }
Example #19
0
 private void CreateLayer()
 {
     _gauntletLayer = new GauntletLayer(50, "GauntletLayer");
     _movie         = _gauntletLayer.LoadMovie(nameof(CharacterSelectionView), _dataSource);
     _screen.AddLayer(_gauntletLayer);
     _gauntletLayer.IsFocusLayer = true;
     ScreenManager.TrySetFocus(_gauntletLayer);
     _gauntletLayer.InputRestrictions.SetInputRestrictions(true, InputUsageMask.All);
 }
Example #20
0
 protected override void OnInitialize()
 {
     base.OnInitialize();
     _viewModel     = new CESettingsVM();
     _gauntletLayer = new GauntletLayer(1, "GauntletLayer");
     _gauntletLayer.LoadMovie("CaptivityEventsConfigScreen", _viewModel);
     _gauntletLayer.InputRestrictions.SetInputRestrictions(true, InputUsageMask.All);
     base.AddLayer(_gauntletLayer);
 }
 protected override void OnInitialize()
 {
     base.OnInitialize();
     _viewModel     = new RbmMenuViewModel();
     _gauntletLayer = new GauntletLayer(1);
     _gauntletLayer.LoadMovie("RBMAIMConfig", _viewModel);
     _gauntletLayer.InputRestrictions.SetInputRestrictions();
     AddLayer(_gauntletLayer);
 }
Example #22
0
        public override void OnMissionScreenInitialize()
        {
            base.OnMissionScreenInitialize();

            _layer = new GauntletLayer(20);
            _layer.LoadMovie(nameof(BattleMiniMapView), _dataSource);
            MissionScreen.AddLayer(_layer);
            _timer = new MissionTimer(0.05f);
        }
Example #23
0
 public override void OnMissionScreenFinalize()
 {
     base.OnMissionScreenFinalize();
     if (null != _showControlHintLayer)
     {
         MissionScreen.RemoveLayer(_showControlHintLayer);
     }
     _showControlHintLayer = null;
     textHandler           = null;
 }
 protected override void OnFinalize()
 {
     base.OnFinalize();
     this._layer.InputRestrictions.ResetInputRestrictions();
     this.MapScreen.RemoveLayer((ScreenLayer)this._layer);
     this.MapScreen.RestartAmbientSounds();
     ScreenManager.TryLoseFocus((ScreenLayer)this._layer);
     this._layer      = (GauntletLayer)null;
     this._dataSource = (HardmodeOptionsVM)null;
 }
Example #25
0
 public void ClosePopupViewEnhancements()
 {
     if (_popupLayer != null)
     {
         _popupLayer.ReleaseMovie(_popupMovie);
         _parentScreen.RemoveLayer(_popupLayer);
         _popupLayer.InputRestrictions.ResetInputRestrictions();
         _popupLayer = null;
     }
 }
Example #26
0
 protected override void OnFinalize()
 {
     base.OnFinalize();
     RemoveLayer(_gauntletLayer);
     _gauntletLayer.ReleaseMovie(_gauntletMovie);
     _gauntletLayer = null !;
     _gauntletMovie = null !;
     _dataSource.SettingProperty = null !;
     _dataSource = null !;
 }
 protected override void OnInitialize()
 {
     base.OnInitialize();
     this._dataSource    = new CustomBattleMenuVM(this._customBattleState);
     this._gauntletLayer = new GauntletLayer(1, "GauntletLayer");
     this.LoadMovie();
     ((ScreenLayer)this._gauntletLayer).InputRestrictions.SetInputRestrictions(true, InputUsageMask.All);
     this._dataSource.SetActiveState(true);
     this.AddLayer((ScreenLayer)this._gauntletLayer);
 }
Example #28
0
 public static void Prefix(ref ScreenBase __instance, ref ScreenLayer layer)
 {
     if (__instance is GauntletPartyScreen && screenLayer != null && layer.Input.IsCategoryRegistered(HotKeyManager.GetCategory("PartyHotKeyCategory")))
     {
         __instance.RemoveLayer(screenLayer);
         enhancementVm.OnFinalize();
         enhancementVm = null;
         screenLayer   = null;
     }
 }
 protected override void OnFinalize()
 {
     base.OnFinalize();
     RemoveLayer(gauntletLayer);
     gauntletLayer.ReleaseMovie(movie);
     gauntletLayer      = null;
     movie              = null;
     vm.SettingProperty = null;
     vm = null;
 }
Example #30
0
        public override void OnMissionScreenFinalize()
        {
            base.OnMissionScreenFinalize();

            MissionScreen.RemoveLayer(_layer);
            _dataSource.OnFinalize();
            _layer = null;
            Mission.Current.Boundaries.CollectionChanged -= BoundariesOnCollectionChanged;
            Game.Current.EventManager.UnregisterEvent <MissionPlayerToggledOrderViewEvent>(OnOrderViewToggled);
        }