public ActionResult DeleteConfirmed(int id)
        {
            TextVM textVM = db.TextVMs.Find(id);

            db.TextVMs.Remove(textVM);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
示例#2
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);
        }
示例#3
0
 public TroopVM(TeamConfig teamConfig, TroopConfig config, TextObject troopRole, bool isPlayerSide, BattleTypeConfig battleTypeConfig)
 {
     _config                = config;
     CharacterButton        = new CharacterButtonVM(teamConfig, _config.Character, troopRole, isPlayerSide, battleTypeConfig);
     NumberText             = new TextVM(GameTexts.FindText("str_ebt_number"));
     Number                 = new NumberVM <int>(config.Number, 0, 5000, true);
     Number.OnValueChanged += number => config.Number = number;
     InvalidText            = new TextVM(GameTexts.FindText("str_ebt_invalid"));
 }
 public ActionResult Edit([Bind(Include = "TextId,TextContent")] TextVM textVM)
 {
     if (ModelState.IsValid)
     {
         db.Entry(textVM).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(textVM));
 }
        public ActionResult Create([Bind(Include = "TextId,TextContent")] TextVM textVM)
        {
            if (ModelState.IsValid)
            {
                db.TextVMs.Add(textVM);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(textVM));
        }
示例#6
0
 public SPCharacterConfigVM()
 {
     MaleRatioText               = new TextVM(GameTexts.FindText("str_ebt_male_ratio"));
     FemaleRatioText             = new TextVM(GameTexts.FindText("str_ebt_female_ratio"));
     OpenEncyclopediaText        = new TextVM(GameTexts.FindText("str_ebt_open_encyclopedia"));
     FemaleRatio                 = new NumberVM <float>(_config.FemaleRatio, 0, 1, false);
     FemaleRatio.OnValueChanged += femaleRatio =>
     {
         _config.FemaleRatio = femaleRatio;
         SetCharacterToViewModel();
     };
 }
        // GET: TextVMs/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            TextVM textVM = db.TextVMs.Find(id);

            if (textVM == null)
            {
                return(HttpNotFound());
            }
            return(View(textVM));
        }
        public UserControl CreateElement(ReportElementVM element)
        {
            UserControl returningUserControl = null;
            string      type = element.Type;

            if (type.Equals("table"))
            {
                TableUserControl table   = new TableUserControl();
                TableVM          tableVm = new TableVM(element);
                table.DataContext    = tableVm;
                returningUserControl = table;
            }
            else if (type.Equals("linechart"))
            {
                LineChartUserControl lineChart   = new LineChartUserControl();
                LineChartVM          lineChartVm = new LineChartVM(element);
                lineChart.DataContext = lineChartVm;
                returningUserControl  = lineChart;
            }
            else if (type.Equals("piechart"))
            {
                PieChartUserControl pieChart   = new PieChartUserControl();
                PieChartVM          pieChartVm = new PieChartVM(element);
                pieChart.DataContext = pieChartVm;
                returningUserControl = pieChart;
            }
            else if (type.Equals("barchart"))
            {
                BarChartUserControl barChart   = new BarChartUserControl();
                BarChartVM          barChartVm = new BarChartVM(element);
                barChart.DataContext = barChartVm;
                returningUserControl = barChart;
            }
            else if (type.Equals("image"))
            {
                ImageUserControl image   = new ImageUserControl();
                ImageVM          imageVm = new ImageVM(element);
                image.DataContext    = imageVm;
                returningUserControl = image;
            }
            else if (type.Equals("text"))
            {
                TextUserControl text   = new TextUserControl();
                TextVM          textVM = new TextVM(element);
                text.DataContext     = textVM;
                returningUserControl = text;
            }
            return(returningUserControl);
        }
        public BattleTypeSelectionGroup(
            BattleTypeConfig config,
            MapSelectionGroupVM mapSelectionGroup,
            Action <bool> onPlayerTypeChange)
        {
            _config             = config;
            _mapSelectionGroup  = mapSelectionGroup;
            _onPlayerTypeChange = onPlayerTypeChange;

            BattleTypeText            = new TextVM(GameTexts.FindText("str_ebt_battle_type"));
            PlayerTypeText            = new TextVM(GameTexts.FindText("str_ebt_player_type"));
            PlayerSideText            = new TextVM(GameTexts.FindText("str_ebt_player_side"));
            EquipmentModifierTypeText = new TextVM(GameTexts.FindText("str_ebt_equipment_modifier_type"));
            RefreshValues();
        }
示例#10
0
文件: UITest.cs 项目: K-Yoshiki/menko
    void Awake()
    {
        data = SaveDataFiler.Load <SaveData>(0);
        if (data == null)
        {
            Debug.Log("Non Save Data");
            data = new SaveData();
        }

        viewRoot.Bind(textVM     = new TextVM());
        viewRoot.Bind(toggleVM   = new ToggleVM());
        viewRoot.Bind(buttonVM   = new ButtonVM());
        viewRoot.Bind(dropdownVM = new DropdownVM());
        SetDefault();
    }
示例#11
0
文件: UITest.cs 项目: K-Yoshiki/menko
	void Awake()
	{
		data = SaveDataFiler.Load<SaveData>(0);
		if (data == null)
		{
			Debug.Log("Non Save Data");
			data = new SaveData();
		}

		viewRoot.Bind(textVM = new TextVM());
		viewRoot.Bind(toggleVM = new ToggleVM());
		viewRoot.Bind(buttonVM = new ButtonVM());
		viewRoot.Bind(dropdownVM = new DropdownVM());
		SetDefault();
	}
        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;
        }
        public MPCharacterConfigVM()
        {
            FirstPerks  = new SelectorVM <SelectorItemVM>(0, null);
            SecondPerks = new SelectorVM <SelectorItemVM>(0, null);

            IsHeroText             = new TextVM(GameTexts.FindText("str_ebt_is_hero"));
            MaleRatioText          = new TextVM(GameTexts.FindText("str_ebt_male_ratio"));
            FemaleRatioText        = new TextVM(GameTexts.FindText("str_ebt_female_ratio"));
            IsHero                 = new BoolVM(_config.IsHero);
            FemaleRatio            = new NumberVM <float>(_config.FemaleRatio, 0, 1, false);
            IsHero.OnValueChanged += b =>
            {
                _config.IsHero = b;
                SetCharacterToViewModel();
            };
            FemaleRatio.OnValueChanged += femaleRatio =>
            {
                _config.FemaleRatio = femaleRatio;
                SetCharacterToViewModel();
            };
        }
示例#14
0
        public static void FixProjectDesc(State state)
        {
            var textVm = new TextVM("Примечание", $"Примечание к проекту быстрой ссылки '{state.Project.Name}'",
                                    state.Project.Description, s => null);
            var textView = new TextView(textVm);

            if (textView.ShowDialog() != true)
            {
                throw new OperationCanceledException();
            }
            state.Project.Description = textVm.Value;
            state.Title = textVm.Value;
            var his     = Path.Combine(state.Project.Dir, @"_Shortcuts\ShortcutsHistory.xml");
            var hisText = File.ReadAllText(his);
            var match   = Regex.Match(hisText, @"desc="".*""");

            if (match.Success)
            {
                var g = match.Groups[0];
                hisText = hisText.Substring(0, g.Index) + $@"desc=""{textVm.Value}""" + hisText.Substring(g.Index + g.Length);
                File.WriteAllText(his, hisText);
            }

            foreach (var shortcut in state.Project.Shortcuts)
            {
                var text = File.ReadAllText(shortcut.XmlFile);
                match = Regex.Match(text, @"<ProjectDesc>.*<\/ProjectDesc>");
                if (!match.Success)
                {
                    continue;
                }
                var g = match.Groups[0];
                text = text.Substring(0, g.Index) + $"<ProjectDesc>{textVm.Value}</ProjectDesc>" +
                       text.Substring(g.Index + g.Length);
                File.WriteAllText(shortcut.XmlFile, text);
            }
        }
        public CharacterSelectionVM(CharacterCollection characterCollection, Action <CharacterSelectionData> beginSelection, Action endSelection, bool isMultiplayer)
        {
            _beginSelection = beginSelection;
            _endSelection   = endSelection;
            EnhancedBattleTestSubModule.Instance.OnSelectCharacter += this.Open;
            _characterCollection = characterCollection;

            TitleText   = new TextVM(GameTexts.FindText("str_ebt_select_character"));
            CultureText = new TextVM(GameTexts.FindText("str_ebt_culture"));
            GroupText   = new TextVM(GameTexts.FindText("str_ebt_group"));
            DoneText    = new TextVM(GameTexts.FindText("str_done"));
            CancelText  = new TextVM(GameTexts.FindText("str_cancel"));

            Characters         = CharactersInGroupVM.Create(_characterCollection);
            Groups             = new SelectorVM <SelectorItemVM>(0, null);
            _groupsInSelection = new List <Group>();
            Cultures           = new SelectorVM <SelectorItemVM>(
                _characterCollection.Cultures
                .Select(cultureId =>
                        cultureId == "null"
                            ? GameTexts.FindText("str_ebt_null_culture")
                            : MBObjectManager.Instance.GetObject <BasicCultureObject>(cultureId).Name)
                .Prepend(GameTexts.FindText("str_ebt_all")), 0, OnSelectedCultureChanged);
        }
示例#16
0
 public TextView(TextVM textVM)
     : base(textVM)
 {
     InitializeComponent();
 }
示例#17
0
        private void EditArea_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            if (!_mouseLeftDown)
            {
                return;
            }

            _mouseLeftDown = false;

            //if (sender != this.documentView)
            //    return;

            if (_addRect == null)
            {
                return;
            }

            var con       = _myVM.Document.SelectedAnyChild as ContainerVM;
            var parentCon = _myVM.Document.SelectedAnyChild.Parent as ContainerVM;

            switch (_myVM.SelectedDrawTool)
            {
            case ToolBoxMenuVM.ToolEnum.Text:
                var myText = new TextVM()
                {
                    Name   = "Text",
                    Height = _addRect.Height,
                    Width  = _addRect.Width,
                    HorizontalAlignment = HorizontalAlignment.Left,
                    VerticalAlignment   = VerticalAlignment.Top,
                    Margin = MarginVM.FromThickness(_addRect.Margin)
                };


                if (con != null)
                {
                    myText.Margin -= (con.MarginToDocument);
                    con.AddChild(myText);
                }
                else
                {
                    myText.Margin -= (parentCon.MarginToDocument);
                    parentCon.AddChild(myText);
                }

                break;

            case ToolBoxMenuVM.ToolEnum.Image:
                var myImage = new ImageVM()
                {
                    Name   = "Image",
                    Height = _addRect.Height,
                    Width  = _addRect.Width,
                    HorizontalAlignment = HorizontalAlignment.Left,
                    VerticalAlignment   = VerticalAlignment.Top,
                    Margin = MarginVM.FromThickness(_addRect.Margin)
                };


                if (con != null)
                {
                    myImage.Margin -= (con.MarginToDocument);
                    con.AddChild(myImage);
                }
                else
                {
                    myImage.Margin -= (parentCon.MarginToDocument);
                    parentCon.AddChild(myImage);
                }

                break;

            case ToolBoxMenuVM.ToolEnum.Video:
                var myVideo = new VideoVM()
                {
                    Name   = "Video",
                    Height = _addRect.Height,
                    Width  = _addRect.Width,
                    HorizontalAlignment = HorizontalAlignment.Left,
                    VerticalAlignment   = VerticalAlignment.Top,
                    Margin = MarginVM.FromThickness(_addRect.Margin)
                };


                if (con != null)
                {
                    myVideo.Margin -= (con.MarginToDocument);
                    con.AddChild(myVideo);
                }
                else
                {
                    myVideo.Margin -= (parentCon.MarginToDocument);
                    parentCon.AddChild(myVideo);
                }

                break;

            case ToolBoxMenuVM.ToolEnum.Container:
                var myContainer = new ContainerVM()
                {
                    Name   = "Container",
                    Height = _addRect.Height,
                    Width  = _addRect.Width,
                    HorizontalAlignment = HorizontalAlignment.Left,
                    VerticalAlignment   = VerticalAlignment.Top,
                    Margin          = MarginVM.FromThickness(_addRect.Margin),
                    BackgroundColor = Color.FromArgb(44, 255, 255, 255),
                    BorderColor     = Colors.DarkGray,
                    BorderThickness = 1
                };

                if (con != null)
                {
                    myContainer.Margin -= (con.MarginToDocument);
                    con.AddChild(myContainer);
                }
                else
                {
                    myContainer.Margin -= (parentCon.MarginToDocument);
                    parentCon.AddChild(myContainer);
                }

                break;

            default:
                break;
            }
            documentView.Children.Remove(_addRect);
            _addRect = null;
        }