private void OnSelectedOccupationChanged(SelectorVM <SelectorItemVM> obj)
 {
     if (obj.SelectedItem != null)
     {
         UpdateCharacterList();
     }
 }
Ejemplo n.º 2
0
        private void OnGameTypeSelection(SelectorVM <SelectorItemVM> selector)
        {
            int  num  = ((Collection <SelectorItemVM>)selector.ItemList)[selector.SelectedIndex].StringItem.IndexOf("siege", StringComparison.OrdinalIgnoreCase) >= 0 ? 1 : 0;
            bool flag = ((Collection <SelectorItemVM>)selector.ItemList)[selector.SelectedIndex].StringItem.IndexOf("vill", StringComparison.OrdinalIgnoreCase) >= 0;

            this._mapSelectionGroup.SetSearchMode(num == 0 ? (!flag ? MapSelectionGroup.SearchMode.Battle : MapSelectionGroup.SearchMode.Village) : MapSelectionGroup.SearchMode.Siege);
        }
Ejemplo n.º 3
0
 public void UpdateValue(SelectorVM <SelectorItemVM> selector)
 {
     if (selector.SelectedIndex >= 0)
     {
         Property.SetValue(Setting, _selectorIndex[selector.SelectedIndex]);
     }
 }
Ejemplo n.º 4
0
        public void RefreshCompanionSelector()
        {
            CompanionSelector = new SelectorVM <CompanionSelectorItemVM>(0, OnCompanionSelectorChange);
            CompanionSelector.SetOnChangeAction(null);

            CompanionSelector.AddItem(new CompanionSelectorItemVM(null, true, null));
            CompanionSelector.SelectedIndex = 0;
            foreach (Hero hero in Clan.PlayerClan.Companions)
            {
                var item = new CompanionSelectorItemVM(hero, true, "");
                CompanionSelector.AddItem(item);
            }

            var current = Campaign.Current.GetCampaignBehavior <CanvassBehavior>().GetCurrent(this.CurrentSelectedClan?.Clan);

            for (int i = 0; i < CompanionSelector.ItemList.Count; i++)
            {
                if (current != null && current == CompanionSelector.ItemList[i].Hero)
                {
                    CompanionSelector.SelectedIndex = i;
                    break;
                }
            }
            CompanionSelector.SetOnChangeAction(OnCompanionSelectorChange);

            UpdateCanvassRelationGainText(current, CurrentSelectedClan.Clan);
            RefreshCurrentCanvassClanText();
        }
 public override void RefreshValues()
 {
     base.RefreshValues();
     BattleTypeSelection = new SelectorVM <SelectorItemVM>(new List <TextObject>()
     {
         GameTexts.FindText("str_ebt_battle_type", "Field"),
         GameTexts.FindText("str_ebt_battle_type", "Siege"),
         GameTexts.FindText("str_ebt_battle_type", "Village"),
     }, (int)_config.BattleType, OnBattleTypeSelection);
     PlayerTypeSelection = new SelectorVM <SelectorItemVM>(new List <TextObject>()
     {
         GameTexts.FindText("str_ebt_player_type", "Commander"),
         GameTexts.FindText("str_ebt_player_type", "Sergeant"),
     }, (int)_config.PlayerType, OnPlayerTypeSelectionChange);
     PlayerSideSelection = new SelectorVM <SelectorItemVM>(new List <TextObject>()
     {
         GameTexts.FindText("str_ebt_side", "Attacker"),
         GameTexts.FindText("str_ebt_side", "Defender"),
     }, _config.PlayerSide == BattleSideEnum.Defender ? 1 : 0, OnPlayerSideChanged);
     EquipmentModifierTypeSelection = new SelectorVM <SelectorItemVM>(new List <TextObject>()
     {
         GameTexts.FindText("str_ebt_modifier_type", EquipmentModifierType.Random.ToString()),
         GameTexts.FindText("str_ebt_modifier_type", EquipmentModifierType.Average.ToString()),
         GameTexts.FindText("str_ebt_modifier_type", EquipmentModifierType.None.ToString()),
     }, (int)_config.EquipmentModifierType, OnEquipmentModifierType);
     BattleTypeText.RefreshValues();
     PlayerTypeText.RefreshValues();
     PlayerSideText.RefreshValues();
     EquipmentModifierTypeText.RefreshValues();
 }
Ejemplo n.º 6
0
 private void OnLearningSkillSelectionChange(SelectorVM <SkillLearningSelectorItemVM> obj)
 {
     if (Initialized && obj.SelectedItem != null)
     {
         Campaign.Current.GetCampaignBehavior <HeroLearningSkillBehaviour>().SetHeroLearningSkill(_hero, obj.SelectedItem.Skill);
     }
 }
        private void OnSelectedCultureChanged(SelectorVM <SelectorItemVM> cultures)
        {
            var selectedCulture = SelectedCultureId(cultures);

            if (selectedCulture == null)
            {
                _groupsInSelection = _characterCollection.GroupsInCultures.Values.SelectMany(list => list)
                                     .DistinctBy(group => group.Info.FormationClass).ToList();
                var groups = _groupsInSelection.Select(g => g.Info.Name).Prepend(GameTexts.FindText("str_ebt_all"))
                             .ToList();
                var index = Groups.SelectedIndex;
                if (index >= groups.Count)
                {
                    index = 0;
                }
                RefreshSelector(Groups, groups, index, OnSelectedGroupChanged);
            }
            else
            {
                _groupsInSelection = _characterCollection.GroupsInCultures[selectedCulture];
                var groups = _groupsInSelection.Select(group => group.Info.Name)
                             .Prepend(GameTexts.FindText("str_ebt_all")).ToList();
                var index = Groups.SelectedIndex;
                if (index >= groups.Count)
                {
                    index = 0;
                }
                RefreshSelector(Groups, groups, index, OnSelectedGroupChanged);
            }
        }
Ejemplo n.º 8
0
 public void OnselectItem(SelectorVM <SelectorItemVM> selectorVM)
 {
     // selectorVM.ItemList = this.DropdownValue.ItemList;
     // selectorVM.SelectedIndex = this.DropdownValue.SelectedIndex;
     this._spouseSettingsProperty.PropertyValue = this._spouseSettingsProperty.SelectItems[selectorVM.SelectedIndex];
     base.OnPropertyChanged("DropdownValue");
 }
    public RbmMenuViewModel()
    {
        _doneText        = new TextObject("{=ATDone}Done").ToString();
        _cancelText      = new TextObject("{=ATCancel}Cancel").ToString();
        _tab1Text        = new TextObject("{=ATTab1Text}Main Interface").ToString();
        _tab2Text        = new TextObject("{=ATTab2Text}Sub Interface").ToString();
        _sliderText      = new TextObject("{=ATSlideText}Slider Example").ToString();
        _sliderValue     = 10f;
        _sliderValueText = _sliderValue.ToString();
        _booleanValue    = true;
        RefreshValues();
        //RbmConfigData data;
        List <string> siegeTowersOptions = new List <string> {
            "Disabled", "Enabled"
        };

        SiegeTowersEnabledText = new TextViewModel(new TextObject("Siege Towers"));
        SiegeTowersEnabled     = new SelectorVM <SelectorItemVM>(siegeTowersOptions, 0, null);

        if (XmlConfig.dict["Global.SiegeTowersEnabled"] == 0)
        {
            SiegeTowersEnabled.SelectedIndex = 0;
        }
        else if (XmlConfig.dict["Global.SiegeTowersEnabled"] == 1)
        {
            SiegeTowersEnabled.SelectedIndex = 1;
        }
    }
Ejemplo n.º 10
0
        /// <summary>
        /// This method is used to change the color.
        /// </summary>
        /// <param name="d">
        /// The d.
        /// </param>
        /// <param name="e">
        /// The e.
        /// </param>
        private static void OnColorChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            BrushPicker brush = d as BrushPicker;

            if ((brush.Brush as SolidColorBrush).Color != brush.Color)
            {
                brush.Brush = new SolidColorBrush(brush.Color);

                SelectorVM selector = (brush.Tag as DiagramBuilderVM).SelectedDiagram.SelectedItems as SelectorVM;

                BrushConverter converter = new BrushConverter();

                Brush brushS = (Brush)converter.ConvertFromString(e.NewValue.ToString());
                if ((brush.DataContext as DiagramButtonViewModel).Label == "Label")
                {
                    selector.LabelForeground = brushS as SolidColorBrush;
                }
                else if ((brush.DataContext as DiagramButtonViewModel).Label == "Fill")
                {
                    selector.Fill = brushS as SolidColorBrush;
                }
                else if ((brush.DataContext as DiagramButtonViewModel).Label == "Stroke")
                {
                    selector.Stroke = brushS as SolidColorBrush;
                }

                brush.PickerTemp.IsDropDownOpen = false;
            }
        }
Ejemplo n.º 11
0
        private void OnEnemyFactionSelection(SelectorVM <SelectorItemVM> selector)
        {
            BasicCultureObject faction = this._factionList[this.EnemySide.FactionSelectionGroup.get_SelectedIndex()];

            this.EnemySide.CompositionGroup.SetCurrentSelectedCulture(this._factionList[this.EnemySide.FactionSelectionGroup.get_SelectedIndex()]);
            this.EnemySide.CurrentSelectedCultureID = faction.StringId;
        }
Ejemplo n.º 12
0
        private void OnPlayerFactionSelection(SelectorVM <SelectorItemVM> selector)
        {
            BasicCultureObject faction = this._factionList[this.PlayerSide.FactionSelectionGroup.SelectedIndex];

            this.PlayerSide.CompositionGroup.SetCurrentSelectedCulture(faction);
            this.PlayerSide.CurrentSelectedCultureID = ((MBObjectBase)faction).StringId;
        }
        private void OnFactionSelection(SelectorVM <FactionItemVM> selector)
        {
            BasicCultureObject faction = selector.SelectedItem.Faction;

            this.SelectedFaction = faction;
            this.CompositionGroup.SetCurrentSelectedCulture(faction);
            this.CurrentSelectedCultureID = faction.StringId;
        }
 public SetDropdownIndexAction(IRef context, SelectorVM <SelectorItemVM> value)
 {
     DropdownContext       = context;
     SelectedIndexProperty = AccessTools.Property(DropdownContext.Value.GetType(), nameof(IDropdownProvider.SelectedIndex));
     Context  = new ProxyRef <object>(() => SelectedIndexProperty.GetValue(DropdownContext.Value), o => SelectedIndexProperty.SetValue(DropdownContext.Value, o));
     Value    = value.SelectedIndex;
     Original = Context.Value;
 }
Ejemplo n.º 15
0
        protected CharactersInGroupVM(CharacterCollection collection)
        {
            Collection = collection;

            CharacterText = new TextVM(GameTexts.FindText("str_ebt_character"));
            Characters    = new SelectorVM <SelectorItemVM>(0, null);

            Character = CharacterConfigVM.Create(Collection.IsMultiplayer);
        }
Ejemplo n.º 16
0
 private void OnEnemyCharacterSelection(SelectorVM <SelectorItemVM> selector)
 {
     this.EnemySide.CurrentSelectedCharacter = new CharacterViewModel((CharacterViewModel.StanceTypes) 1);
     this.EnemySide.CurrentSelectedCharacter.FillFrom(this._charactersList[selector.SelectedIndex], -1);
     ((IEnumerable <SelectorItemVM>) this.PlayerSide.CharacterSelectionGroup.ItemList).ToList <SelectorItemVM>().ForEach((Action <SelectorItemVM>)(i => i.CanBeSelected = true));
     if (((Collection <SelectorItemVM>) this.PlayerSide.CharacterSelectionGroup.ItemList).Count <= selector.SelectedIndex)
     {
         return;
     }
     ((Collection <SelectorItemVM>) this.PlayerSide.CharacterSelectionGroup.ItemList)[selector.SelectedIndex].CanBeSelected = false;
 }
Ejemplo n.º 17
0
        private void OnCompanionSelectorChange(SelectorVM <CompanionSelectorItemVM> obj)
        {
            if (this.CurrentSelectedClan != null && obj.SelectedItem != null)
            {
                var canvass = Campaign.Current.GetCampaignBehavior <CanvassBehavior>();

                canvass.UpdateCanvass(obj.SelectedItem.Hero, CurrentSelectedClan.Clan);
            }
            UpdateCanvassRelationGainText(obj?.SelectedItem?.Hero, CurrentSelectedClan.Clan);
            RefreshCurrentCanvassClanText();
        }
Ejemplo n.º 18
0
        public override void RefreshValues()
        {
            base.RefreshValues();
            SelectorVM <SelectorItemVM> selector = this._selector;

            if (selector == null)
            {
                return;
            }
            selector.RefreshValues();
        }
Ejemplo n.º 19
0
 private void OnEnemyCharacterSelection(SelectorVM <SelectorItemVM> selector)
 {
     this.EnemySide.CurrentSelectedCharacter = new CharacterViewModel((CharacterViewModel.StanceTypes) 1);
     this.EnemySide.CurrentSelectedCharacter.FillFrom(this._charactersList[selector.get_SelectedIndex()], -1);
     ((IEnumerable <SelectorItemVM>) this.PlayerSide.CharacterSelectionGroup.get_ItemList()).ToList <SelectorItemVM>().ForEach((Action <SelectorItemVM>)(i => i.set_CanBeSelected(true)));
     if (this.PlayerSide.CharacterSelectionGroup.get_ItemList().Count <= selector.get_SelectedIndex())
     {
         return;
     }
     this.PlayerSide.CharacterSelectionGroup.get_ItemList()[selector.get_SelectedIndex()].set_CanBeSelected(false);
 }
 public MapSelectionGroupVM(List <SceneData> scenes)
 {
     _scenes               = scenes;
     MapSearchResults      = new MBBindingList <MapItemVM>();
     _battleMaps           = new List <MapItemVM>();
     _villageMaps          = new List <MapItemVM>();
     _siegeMaps            = new List <MapItemVM>();
     WallHitpointSelection = new SelectorVM <WallHitpointItemVM>(0, OnWallHitpointSelection);
     SceneLevelSelection   = new SelectorVM <SceneLevelItemVM>(0, OnSceneLevelSelection);
     SeasonSelection       = new SelectorVM <SeasonItemVM>(0, OnSeasonSelection);
     RefreshValues();
 }
Ejemplo n.º 21
0
        private void InitOrderTypeData()
        {
            List <TextObject> texts = new List <TextObject>();

            texts.Add(new TextObject("{=sms_battle_record_stats_order_asc}ASC"));
            texts.Add(new TextObject("{=sms_battle_record_stats_order_desc}DESC"));
            this._orderTypeVM = new SelectorVM <SelectorItemVM>(texts, currentOrderType, (item) =>
            {
                currentOrderType = item.SelectedIndex;
                GenerateStatsData();
            });
        }
Ejemplo n.º 22
0
        public WangStringOptionDataVM(SettingVM settingVM, ISetting setting, PropertyInfo property, PropertyInfo selector) : base(settingVM, setting, property)
        {
            try
            {
                var value = (string)property.GetValue(setting);
                List <TextObject> list = new List <TextObject>()
                {
                    new TextObject("{=wang_selector_none}please select a item")
                };
                _selectorIndex.Add(0, null);
                var selectedIndex = 0;

                var strs = selector.GetValue(setting);

                if (strs is IReadOnlyList <string> )
                {
                    var datas = (IReadOnlyList <string>)strs;

                    for (int i = 0; i < datas.Count; i++)
                    {
                        var text = new TextObject(datas[i]);
                        list.Add(text);
                        _selectorIndex.Add(i + 1, text.GetID());
                        if (value == text.GetID())
                        {
                            selectedIndex = i + 1;
                        }
                    }
                }
                else if (strs is Dictionary <string, TextObject> )
                {
                    var datas = (Dictionary <string, TextObject>)strs;

                    for (int i = 0; i < datas.Count; i++)
                    {
                        list.Add(datas.ElementAt(i).Value);
                        _selectorIndex.Add(i + 1, datas.ElementAt(i).Key);
                        if (value == datas.ElementAt(i).Key)
                        {
                            selectedIndex = i + 1;
                        }
                    }
                }

                this._selector = new SelectorVM <SelectorItemVM>(list, selectedIndex, new Action <SelectorVM <SelectorItemVM> >(this.UpdateValue));
            }
            catch (Exception e)
            {
                MessageBox.Show(e.FlattenException());
            }
        }
Ejemplo n.º 23
0
        private void InitSortTypeData()
        {
            List <TextObject> texts = new List <TextObject>();

            texts.Add(new TextObject(TotalKillCountText));
            texts.Add(new TextObject(MVPCountText));
            texts.Add(new TextObject(ZeroCountText));
            texts.Add(new TextObject(FightCountText));
            this._sortTypeVM = new SelectorVM <SelectorItemVM>(texts, currentSortType, (item) =>
            {
                currentSortType = item.SelectedIndex;
                GenerateStatsData();
            });
        }
Ejemplo n.º 24
0
        public DiagramVM(StorageFile file, bool isValidXml)
        {
            _isValidXml   = isValidXml;
            _file         = file;
            Nodes         = new ObservableCollection <NodeVM>();
            Connectors    = new ObservableCollection <ConnectorVM>();
            Groups        = new ObservableCollection <GroupVM>();
            SelectedItems = new SelectorVM(this);
            Select        = new Command(param => IsSelected = true);
            FirstLoad     = new Command(OnViewLoaded);

            SnapSettings = new SnapSettings()
            {
                SnapConstraints = SnapConstraints.All,
                SnapToObject    = SnapToObject.All
            };

            PageSettings = new PageVM();
            (PageSettings as PageVM).InitDiagram(this);
            this.HorizontalRuler = new Ruler()
            {
                Orientation = Orientation.Horizontal
            };
            this.VerticalRuler = new Ruler()
            {
                Orientation = Orientation.Vertical
            };
            //OffPageBackground = new SolidColorBrush(new Color() { A = 0xFF, R = 0xEC, G = 0xEC, B = 0xEC });
            //OffPageBackground = new SolidColorBrush(new Color() { A = 0xFF, R = 0x2D, G = 0x2D, B = 0x2D });
            InitLocation();
#if SyncfusionFramework4_5_1
            ExportSettings = new ExportSettings()
            {
                ImageStretch = Stretch.Uniform,
                ExportMode   = ExportMode.PageSettings
            };
            PrintingService = new PrintingService();
#endif
            Export       = new Command(OnExportCommand);
            Captures     = new Command(OnCapturesCommand);
            ClearDiagram = new Command(OnClearCommand);
            Upload       = new Command(Onuploadcommand);
            Draw         = new Command(OnDrawCommand);
            SingleSelect = new Command(OnSingleSelectCommand);
            SelectAll    = new Command(OnSelectAllCommand);
            Manipulate   = new Command(OnManipulateCommand);
            Port         = new Command(OnPortCommand);
            Diagrams     = new ObservableCollection <DiagramVM>();
        }
Ejemplo n.º 25
0
        private void InitRoleTypeData()
        {
            List <TextObject> texts = new List <TextObject>();

            texts.Add(new TextObject("{=sms_battle_record_stats_role_all}All"));
            texts.Add(new TextObject("{=sms_battle_record_stats_role_spouse}Spouse"));
            texts.Add(new TextObject("{=sms_battle_record_stats_role_companion}Companion"));
            texts.Add(new TextObject("{=sms_battle_record_stats_role_children}Children"));
            texts.Add(new TextObject("{=sms_battle_record_stats_role_other}Other"));
            this._roleTypeVM = new SelectorVM <SelectorItemVM>(texts, currentRoleType, (item) =>
            {
                currentRoleType = item.SelectedIndex;
                GenerateStatsData();
            });
        }
        public SPCharactersInGroupVM(CharacterCollection collection) : base(collection)
        {
            OccupationText = new TextVM(new TextObject("{=GZxFIeiJ}Occupation"));
            for (Occupation occupation = Occupation.NotAssigned;
                 occupation < Occupation.NumberOfOccupations;
                 ++occupation)
            {
                _occupations.Add(occupation);
            }

            Occupations = new SelectorVM <SelectorItemVM>(0, OnSelectedOccupationChanged);
            var list = new MBBindingList <SelectorItemVM>();

            foreach (var item in
                     _occupations.Select(occupation =>
            {
                switch (occupation)
                {
                case Occupation.GoodsTrader:
                case Occupation.BannerBearer:
                    return(new TextObject(occupation.ToString()));

                case Occupation.Outlaw:
                    return(GameTexts.FindText("str_outlaw"));

                case Occupation.RuralNotable:
                    return(GameTexts.FindText("str_rural_notable"));

                case Occupation.Artisan:
                case Occupation.Preacher:
                case Occupation.Headman:
                case Occupation.GangLeader:
                    return(GameTexts.FindText("str_charactertype_" + occupation.ToString().ToLower()));

                case Occupation.Judge:
                    return(new TextObject("{=ZRkceJx3}Judge"));

                case Occupation.CaravanGuard:
                    return(new TextObject("{=jxNe8lH2}Caravan Guard"));
                }
                return(GameTexts.FindText("str_occupation", occupation.ToString()));
            }))
            {
                list.Add(new SelectorItemVM(item));
            }

            Occupations.ItemList = list;
        }
Ejemplo n.º 27
0
        /// <summary>
        /// The button_ click_1 method will change the style of the selector.
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        /// <param name="e">
        /// The e.
        /// </param>
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            Button     element  = sender as Button;
            SelectorVM selector = (this.Tag as DiagramBuilderVM).SelectedDiagram.SelectedItems as SelectorVM;

            if (element.Name == "label")
            {
                selector.LabelForeground = this.Brush as SolidColorBrush;
            }
            else if (element.Name == "fill")
            {
                selector.Fill = this.Brush as SolidColorBrush;
            }
            else if (element.Name == "line")
            {
                selector.Stroke = this.Brush as SolidColorBrush;
            }
        }
Ejemplo n.º 28
0
        private void UpdatePrimaryUsageIndex(SelectorVM <CategoryItemVM> selector)
        {
            if (selector.SelectedIndex == -1)
            {
                return;
            }

            //Reset selectedCategory
            SelectedCategory = new MBBindingList <CategoryItemVM>();

            //Add Category Items
            foreach (var category in _xmlParse.Entities[selector.SelectedItem.StringItem])
            {
                var temp = new CategoryItemVM(category.Key);
                temp.Category = selector.SelectedItem.StringItem;
                SelectedCategory.Add(temp);
            }
        }
Ejemplo n.º 29
0
 public void UpdateValue(SelectorVM <SelectorItemVM> selector)
 {
     try
     {
         if (selector.SelectedIndex < 0)
         {
             return;
         }
         var selectedOption = _dropdownOptions[selector.SelectedIndex];
         var newValue       = ConvertToT(selectedOption, _initialValue);
         Value = newValue;
         _updateCall(Value);
     }
     catch (Exception ex)
     {
         GenericHelpers.LogException($"StringOptionDataVM.{_name}.UpdateValue", ex);
     }
 }
        private void RefreshSelector(SelectorVM <SelectorItemVM> selector, List <TextObject> texts, int index, Action <SelectorVM <SelectorItemVM> > action)
        {
            if (selector == null)
            {
                return;
            }
            var bindings = new MBBindingList <SelectorItemVM>();

            foreach (var textObject in texts)
            {
                bindings.Add(new SelectorItemVM(textObject));
            }

            selector.SetOnChangeAction(null);
            selector.ItemList      = bindings;
            selector.SelectedIndex = -1;
            selector.SetOnChangeAction(action);
            selector.SelectedIndex = index;
        }