示例#1
0
        /// <summary>
        /// Constructs a SpeechBubble that follows the given Personnage
        /// </summary>
        /// <param name="speaker">Personnage followed by the SpeechBubble</param>
        public SpeechBubble(Personnage speaker)
            : base()
        {
            Speaker = speaker;
            Listeners = new List<Personnage>();

            Margins = DEFAULT_MARGINS;

            Box = new VAutoSizeBox();
            Box.Position = GetGlobalFromLocal(new Vector2f());
            AddWidget(Box);

            Messages = new List<List<String>>();
            MessageLabels = new List<List<Label>>();
            CurrentBuiltMessage = 0;

            LetterTimer = new Timer();
            MessageIsCompleted = false;

            ActionKeyPlayingMode = true;
            IsLooping = false;
            IsPlaying = false;

            StopSpeech(true);
        }
示例#2
0
        public TileSelector(Int32 width = DEFAULT_SIZE, Int32 height = DEFAULT_SIZE)
            : base()
        {
            Width = width;
            Height = height;

            VMainBox = new VAutoSizeBox(false);
            HMidleBox = new HAutoSizeBox();

            MultiBox = new MultiBox(Alignment.Vertical, Height, Width);
            MultiBox.SetSize(Width);
            MultiBox.OnVPointerChange += new PointerChangeEventHandler(MultiBox_OnVPointerChange);
            MultiBox.OnHPointerChange += new PointerChangeEventHandler(MultiBox_OnHPointerChange);

            VScrollBar = new VScrollBar();
            VScrollBar.Scrolled += new ScrollEventHandler(VScrollBar_Scrolled);
            HScrollBar = new HScrollBar();
            HScrollBar.Scrolled += new ScrollEventHandler(HScrollBar_Scrolled);

            AddWidget(VMainBox);

            VMainBox.AddItem(HMidleBox, 0, HAlignment.Right);
            HMidleBox.AddItem(MultiBox);
            HMidleBox.AddItem(VScrollBar);

            VMainBox.AddItem(HScrollBar);
        }
示例#3
0
        public UpDownBox(
            Int32 minValue = DEFAULT_MIN_VALUE,
            Int32 maxValue = DEFAULT_MAX_VALUE,
            Int32 scaleValue = DEFAULT_SCALE_VALUE,
            Int32 defaultValue = DEFAULT_DEFAULT_VALUE,
            String label = null,
            LabeledWidget.EMode mode = DEFAULT_MODE,
            Boolean shortCutMode = DEFAULT_SHORTCUT_MODE)
            : base(label, mode, shortCutMode)
        {
            MinValue = minValue;
            MaxValue = maxValue;
            ScaleValue = scaleValue;
            DefaultValue = defaultValue;

            MainBox = new HAutoSizeBox(true, null, 0);

            ButtonBox = new VAutoSizeBox(true, null, 0);

            DownBtn = new Button(Create.Texture("Gui_DownButtonN"), Create.Texture("Gui_DownButtonO"));
            DownBtn.Dimension *= BUTTON_RESIZE_FACTOR;
            DownBtn.Clicked += new ClickEventHandler(DownBtn_Clicked);
            AddWidget(DownBtn);

            UpBtn = new Button(Create.Texture("Gui_UpButtonN"), Create.Texture("Gui_UpButtonO"));
            UpBtn.Dimension *= BUTTON_RESIZE_FACTOR;
            UpBtn.Clicked += new ClickEventHandler(UpBtn_Clicked);

            ButtonBox.AddItem(UpBtn);
            ButtonBox.AddItem(DownBtn);

            TextBox = new TextBox(BlazeraLib.TextBox.EInputType.Numeric);

            SetCurrentValue(GetDefaultValue());
            TextBox.Dimension = new SFML.Window.Vector2f(40F, UpBtn.Dimension.Y + DownBtn.Dimension.Y);

            TextBox.TextAdded += new TextAddedEventHandler(TextBox_TextAdded);
            AddWidget(TextBox);

            ValueIsModified = false;

            MainBox.AddItem(TextBox);
            MainBox.AddItem(ButtonBox);

            AddLabeledWidget(MainBox);

            GetLabelWidget().Clicked += new ClickEventHandler(UpDownBox_Clicked);
        }
示例#4
0
        public RadioButton(Alignment alignment = DEFAULT_ALIGNMENT)
            : base()
        {
            RadioButtons = new Dictionary<Item, CheckEventHandler>();

            Alignment = alignment;

            if (Alignment == Alignment.Horizontal)
            {
                HBox = new HAutoSizeBox();
                AddWidget(HBox);
            }
            else
            {
                VBox = new VAutoSizeBox();
                AddWidget(VBox);
            }
        }
示例#5
0
        public LabeledWidget(Texture picture = null, EMode mode = DEFAULT_MODE)
            : base()
        {
            if (picture != null)
            {
                Mode = mode;
                Type = EType.Picture;

                Picture = new Button(picture, null);
                Picture.Dimension = new SFML.Window.Vector2f(DEFAULT_PICTURE_SIZE, DEFAULT_PICTURE_SIZE);

                switch (Mode)
                {
                    case EMode.Left:
                    case EMode.Right: HBox = new HAutoSizeBox(true, null, DEFAULT_BOXPICTURE_OFFSET); AddWidget(HBox); break;
                    case EMode.Top:
                    case EMode.Bottom: VBox = new VAutoSizeBox(true, null, DEFAULT_BOXPICTURE_OFFSET); AddWidget(VBox); break;
                }
            }
        }
示例#6
0
        protected ExtendedBox(EType type = DEFAULT_TYPE, Boolean noBorderMode = true, Int32 size = DEFAULT_SIZE)
            : base()
        {
            Size = size;
            CurrentPointer = 0;

            ExtendedItems = new List<Widget>();

            Type = type;

            if (Type == EType.Vertical)
            {
                VMainBox = new VAutoSizeBox(noBorderMode);
                AddWidget(VMainBox);
            }
            else
            {
                HMainBox = new HAutoSizeBox(noBorderMode);
                AddWidget(HMainBox);
            }
        }
示例#7
0
        public LabeledWidget(String label = null, EMode mode = DEFAULT_MODE, Boolean shortCutMode = DEFAULT_SHORTCUT_MODE)
            : base()
        {
            if (label != null)
            {
                Mode = mode;
                Type = EType.Label;

                Label = new Button(label, Button.EMode.Label);

                switch (Mode)
                {
                    case EMode.Left:
                    case EMode.Right: HBox = new HAutoSizeBox(true, null); AddWidget(HBox); break;
                    case EMode.Top:
                    case EMode.Bottom: VBox = new VAutoSizeBox(true, null); AddWidget(VBox); break;
                }

                ShortCutMode = shortCutMode;

                if (Label.Text.Length > 0)
                    ShortCutKey = WindowEvents.KeyCodeFromString(Label.Text[0].ToString());
            }
        }
示例#8
0
文件: Menu.cs 项目: eickegao/Blazera
 protected virtual void InitBox()
 {
     if (Alignment == BlazeraLib.Alignment.Vertical)
     {
         VMainBox = new VAutoSizeBox(true, null, ItemOffset);
         VMainBox.Position = GetGlobalFromLocal(new Vector2f());
         AddWidget(VMainBox);
     }
     else
     {
         HMainBox = new HAutoSizeBox(true, null, ItemOffset);
         HMainBox.Position = GetGlobalFromLocal(new Vector2f());
         AddWidget(HMainBox);
     }
 }
示例#9
0
        protected DialogBox(String title)
            : base(title)
        {
            MessageBox = new VAutoSizeBox();
            AddItem(MessageBox, 0, HAlignment.Center);

            Validated += new ValidateEventHandler(DialogBox_Validated);
        }
示例#10
0
        private void RefreshBox()
        {
            if (Alignment == BlazeraLib.Alignment.Vertical)
                GetVMainBox().Clear();
            else
                GetHMainBox().Clear();

            for (Int32 vCount = CurrentVPointer; vCount < CurrentVPointer + GetCurrentVSize(); vCount++)
            {
                List<Widget> newList = GetItems(vCount, CurrentHPointer, GetCurrentHSize(vCount));

                if (Alignment == BlazeraLib.Alignment.Vertical)
                {
                    HAutoSizeBox HB = new HAutoSizeBox(true, null, 0F);
                    HB.AddItem(newList, 0, VAlignment.Top);
                    GetVMainBox().AddItem(HB, 0, HAlignment.Left);
                }
                else
                {
                    VAutoSizeBox VB = new VAutoSizeBox(true, null, 0F);
                    VB.AddItem(newList, 0, HAlignment.Center);
                    GetHMainBox().AddItem(VB, 0, VAlignment.Center);
                }
            }
        }