Esempio n. 1
0
        public static Button Option(Game.Option option)
        {
            bool optionColor = !String.IsNullOrEmpty(option.OnlyIf) && !option.OnlyIf.Contains(">") && !option.OnlyIf.Contains("<");

            if (Game.Data.ShowDisabledOption || !String.IsNullOrEmpty(option.Aftertext))
            {
                optionColor = !String.IsNullOrEmpty(option.OnlyIf) && !Game.Data.CheckOnlyIf(option.OnlyIf);
            }

            string color = Game.Data.Constants.GetButtonsColor(optionColor ?
                                                               Output.Buttons.ButtonTypes.Option : Output.Buttons.ButtonTypes.Main);

            bool isEnabled = (!(!String.IsNullOrEmpty(option.OnlyIf) && !Game.Data.CheckOnlyIf(option.OnlyIf)));

            if (String.IsNullOrEmpty(option.Text))
            {
                option.Text = (option.Destination == 0 ? "Начать сначала" : "Далее");
            }

            Button optionButton = new Button()
            {
                Text            = option.Text,
                BackgroundColor = Color.FromHex(color),
                IsEnabled       = isEnabled,
                FontFamily      = Output.Interface.TextFontFamily(standart: true),
                FontSize        = Device.GetNamedSize(NamedSize.Large, typeof(Label)),
                IsVisible       = String.IsNullOrEmpty(option.Input),
            };

            return(Output.Interface.SetBorderAndTextColor(optionButton));
        }
Esempio n. 2
0
        public Game.Option OptionsTemplate(XmlNode xmlOption)
        {
            Game.Option option = OptionsTemplateWithoutDestination(xmlOption);

            option.Destination = Game.Xml.IntParse(xmlOption.Attributes["Destination"]);

            return(option);
        }