Esempio n. 1
0
        public EntityLabel(
            IPlayerControl playerControl,
            string interactAction,
            Label titleLabel,
            Option <Label> shortcutLabel,
            Option <Label> actionLabel,
            Option <Godot.Control> actionPanel,
            ITimeSource timeSource,
            Godot.Control node,
            ILoggerFactory loggerFactory) : base(node, loggerFactory)
        {
            Ensure.That(playerControl, nameof(playerControl)).IsNotNull();
            Ensure.That(interactAction, nameof(interactAction)).IsNotNull();
            Ensure.That(titleLabel, nameof(titleLabel)).IsNotNull();
            Ensure.That(timeSource, nameof(timeSource)).IsNotNull();

            PlayerControl  = playerControl;
            InteractAction = interactAction;
            TitleLabel     = titleLabel;
            ShortcutLabel  = shortcutLabel;
            ActionLabel    = actionLabel;
            ActionPanel    = actionPanel;
            TimeSource     = timeSource;
            InteractAction = interactAction;
        }
Esempio n. 2
0
 public GridStruct(int nx,int ny,Godot.Control Path){
     x = nx;
     y = ny;
     res = Path;
     res.RectPosition = new Vector2(x*offeset,y*offeset);
     res.Call("setCell",0);
 }
Esempio n. 3
0
 protected override Validation <string, ColorMorphPanel> CreateService(
     IMorph <Color, ColorMorphDefinition> morph,
     Label label,
     Godot.Control node,
     ILoggerFactory loggerFactory)
 {
     return
         (from button in Button
          .ToValidation("Failed to find the button.")
          select new ColorMorphPanel(morph, button, label, node, loggerFactory));
 }
Esempio n. 4
0
            protected MorphPanel(
                IMorph <TVal, TDef> morph,
                Label label,
                Godot.Control node,
                ILoggerFactory loggerFactory) : base(morph, label, node, loggerFactory)
            {
                Ensure.That(morph, nameof(morph)).IsNotNull();
                Ensure.That(label, nameof(label)).IsNotNull();

                Morph = morph;
            }
Esempio n. 5
0
        public ColorMorphPanel(
            IMorph <Color, ColorMorphDefinition> morph,
            ColorPickerButton button,
            Label label,
            Godot.Control node,
            ILoggerFactory loggerFactory) : base(morph, label, node, loggerFactory)
        {
            Ensure.That(button, nameof(button)).IsNotNull();

            Button = button;
        }
Esempio n. 6
0
        public MorphListPanel(
            TabContainer tabContainer,
            PackedScene groupPanelScene,
            Godot.Control node,
            ILoggerFactory loggerFactory) : base(node, loggerFactory)
        {
            Ensure.That(tabContainer, nameof(tabContainer)).IsNotNull();
            Ensure.That(groupPanelScene, nameof(groupPanelScene)).IsNotNull();

            TabContainer    = tabContainer;
            GroupPanelScene = groupPanelScene;
        }
Esempio n. 7
0
        protected FullScreenModalPanel(
            bool pauseWhenVisible,
            Option <string> closeAction,
            IPlayerControl playerControl,
            Godot.Control node,
            ILoggerFactory loggerFactory) : base(node, loggerFactory)
        {
            Ensure.That(playerControl, nameof(playerControl)).IsNotNull();

            PauseWhenVisible = pauseWhenVisible;
            CloseAction      = closeAction;
            PlayerControl    = playerControl;
        }
Esempio n. 8
0
 protected override Validation <string, RangedMorphPanel> CreateService(
     IMorph <float, RangedMorphDefinition> morph,
     Label label,
     Godot.Control node,
     ILoggerFactory loggerFactory)
 {
     return
         (from slider in Slider
          .ToValidation("Failed to find the slider.")
          from spinner in Spinner
          .ToValidation("Failed to find the spinner.")
          select new RangedMorphPanel(morph, slider, spinner, label, node, loggerFactory));
 }
Esempio n. 9
0
        public InventoryView(
            IPlayerControl playerControl,
            InspectingView viewControl,
            MeshInstance itemStand,
            bool pauseWhenVisible,
            Option <string> closeAction,
            Godot.Control node,
            Tree tree,
            Container buttonContainer,
            Panel infoPanel,
            Label titleLabel,
            Option <Label> typeLabel,
            Option <RichTextLabel> descriptionLabel,
            PackedScene actionButton,
            ILoggerFactory loggerFactory) : base(pauseWhenVisible, closeAction, playerControl, node, loggerFactory)
        {
            Ensure.That(viewControl, nameof(viewControl)).IsNotNull();
            Ensure.That(tree, nameof(tree)).IsNotNull();
            Ensure.That(itemStand, nameof(itemStand)).IsNotNull();
            Ensure.That(buttonContainer, nameof(buttonContainer)).IsNotNull();
            Ensure.That(infoPanel, nameof(infoPanel)).IsNotNull();
            Ensure.That(titleLabel, nameof(titleLabel)).IsNotNull();
            Ensure.That(actionButton, nameof(actionButton)).IsNotNull();

            ViewControl      = viewControl;
            Tree             = tree;
            ButtonContainer  = buttonContainer;
            ItemStand        = itemStand;
            InfoPanel        = infoPanel;
            TitleLabel       = titleLabel;
            TypeLabel        = typeLabel;
            DescriptionLabel = descriptionLabel;
            ActionButton     = actionButton;

            _buttonListeners = new CompositeDisposable();

            OnEquipmentContainerChange = PlayerControl.OnCharacterChange
                                         .Select(c => c.Select(v => v.Equipments).ToObservable())
                                         .Switch();

            OnItemsChange = OnEquipmentContainerChange
                            .Select(c => c.OnItemsChange)
                            .Switch();

            OnSelectionChange = Tree.OnItemSelect()
                                .Select(v => v.Bind(i => Optional(i.GetMeta(SlotKey) as string)))
                                .Merge(OnItemsChange.Select(_ => Option <string> .None))
                                .CombineLatest(OnEquipmentContainerChange, (slot, slots) => (slot, slots))
                                .Select(t => t.slot.Bind(s => t.slots.FindItemInSlot(s)).HeadOrNone())
                                .Do(current => Selected = current);
        }
Esempio n. 10
0
        public AttributeBar(
            Option <IAttribute> attribute,
            Option <Label> label,
            Option <Label> valueLabel,
            Option <string> valueFormat,
            Option <TextureRect> icon,
            ProgressBar progressBar,
            Godot.Control node,
            ILoggerFactory loggerFactory) : base(attribute, label, valueLabel, valueFormat, icon, node, loggerFactory)
        {
            Ensure.That(progressBar, nameof(progressBar)).IsNotNull();

            ProgressBar = progressBar;
        }
Esempio n. 11
0
        public RangedMorphPanel(
            IMorph <float, RangedMorphDefinition> morph,
            Slider slider,
            SpinBox spinner,
            Label label,
            Godot.Control node,
            ILoggerFactory loggerFactory) : base(morph, label, node, loggerFactory)
        {
            Ensure.That(slider, nameof(slider)).IsNotNull();
            Ensure.That(spinner, nameof(spinner)).IsNotNull();

            Slider  = slider;
            Spinner = spinner;
        }
Esempio n. 12
0
 protected override Validation <string, AttributeBar> CreateService(
     Godot.Control node, ILoggerFactory loggerFactory)
 {
     return(ProgressBar
            .ToValidation("Failed to find the progress bar.")
            .Map(progress => new AttributeBar(
                     None,
                     Label,
                     ValueLabel,
                     ValueFormat.TrimToOption(),
                     Icon,
                     progress,
                     node,
                     loggerFactory)));
 }
Esempio n. 13
0
        public BlendMapGenerator(LineEdit inputEdit,
                                 LineEdit outputEdit,
                                 Tree sourceList,
                                 Tree morphList,
                                 Label progressLabel,
                                 ProgressBar progressBar,
                                 Button inputButton,
                                 Button outputButton,
                                 Button startButton,
                                 Button closeButton,
                                 FileDialog fileDialog,
                                 Label infoLabel,
                                 Godot.Control node,
                                 ILoggerFactory loggerFactory) : base(node, loggerFactory)
        {
            Ensure.That(inputEdit, nameof(inputEdit)).IsNotNull();
            Ensure.That(outputEdit, nameof(outputEdit)).IsNotNull();
            Ensure.That(sourceList, nameof(sourceList)).IsNotNull();
            Ensure.That(morphList, nameof(morphList)).IsNotNull();
            Ensure.That(progressLabel, nameof(progressLabel)).IsNotNull();
            Ensure.That(progressBar, nameof(progressBar)).IsNotNull();
            Ensure.That(inputButton, nameof(inputButton)).IsNotNull();
            Ensure.That(outputButton, nameof(inputButton)).IsNotNull();
            Ensure.That(startButton, nameof(startButton)).IsNotNull();
            Ensure.That(closeButton, nameof(closeButton)).IsNotNull();
            Ensure.That(fileDialog, nameof(fileDialog)).IsNotNull();
            Ensure.That(infoLabel, nameof(infoLabel)).IsNotNull();

            InputEdit     = inputEdit;
            OutputEdit    = outputEdit;
            SourceList    = sourceList;
            MorphList     = morphList;
            ProgressLabel = progressLabel;
            ProgressBar   = progressBar;
            InputButton   = inputButton;
            OutputButton  = outputButton;
            StartButton   = startButton;
            CloseButton   = closeButton;
            FileDialog    = fileDialog;
            InfoLabel     = infoLabel;
        }
Esempio n. 14
0
        public MorphGroupPanel(
            IMorphGroup group,
            IEnumerable <IMorph> morphs,
            Container morphsPanel,
            PackedScene colorMorphPanelScene,
            PackedScene rangedMorphPanelScene,
            Godot.Control node,
            ILoggerFactory loggerFactory) : base(node, loggerFactory)
        {
            Ensure.That(group, nameof(group)).IsNotNull();
            Ensure.That(morphs, nameof(morphs)).IsNotNull();
            Ensure.That(morphsPanel, nameof(morphsPanel)).IsNotNull();
            Ensure.That(colorMorphPanelScene, nameof(colorMorphPanelScene)).IsNotNull();
            Ensure.That(rangedMorphPanelScene, nameof(rangedMorphPanelScene)).IsNotNull();

            Group                 = group;
            Morphs                = morphs;
            MorphsPanel           = morphsPanel;
            ColorMorphPanelScene  = colorMorphPanelScene;
            RangedMorphPanelScene = rangedMorphPanelScene;
        }
Esempio n. 15
0
        public Menu(
            IEnumerable <IMenuModel> rootItems,
            IEnumerable <IMenuHandler> menuHandlers,
            IEnumerable <IMenuStructureProvider> structureProviders,
            IEnumerable <IMenuRenderer> renderers,
            Option <string> backAction,
            Godot.Control node,
            Node itemsContainer,
            Option <ActionLabel> closeLabel,
            Option <ActionLabel> upLabel,
            Option <Label> emptyLabel,
            Option <Label> breadcrumb,
            PackedScene itemScene,
            ILoggerFactory loggerFactory) : base(node, loggerFactory)
        {
            Ensure.That(renderers, nameof(renderers)).IsNotNull();

            RootItems          = rootItems;
            MenuHandlers       = menuHandlers;
            StructureProviders = structureProviders;
            Renderers          = renderers.Append(new FallbackRenderer());

            Ensure.Enumerable.HasItems(RootItems, nameof(rootItems));
            Ensure.Enumerable.HasItems(MenuHandlers, nameof(menuHandlers));
            Ensure.Enumerable.HasItems(StructureProviders, nameof(structureProviders));

            Ensure.That(itemsContainer, nameof(itemsContainer)).IsNotNull();
            Ensure.That(itemScene, nameof(itemScene)).IsNotNull();

            BackAction     = backAction;
            ItemsContainer = itemsContainer;
            CloseLabel     = closeLabel;
            UpLabel        = upLabel;
            EmptyLabel     = emptyLabel;
            Breadcrumb     = breadcrumb;
            ItemScene      = itemScene;

            _current = CreateSubject <Option <IMenuModel> >(None);
        }
Esempio n. 16
0
 protected override void SetSceneControl(Godot.Control control)
 {
     base.SetSceneControl(control);
     SceneControl = (Godot.Range)control;
 }
Esempio n. 17
0
 public SpellCheckResult(Control block, int index, string word)
 {
     Block = block;
     Index = index;
     Word  = word;
 }
Esempio n. 18
0
 public static IObservable <Unit> OnFocusExit(this Godot.Control control)
 {
     return(control.FromSignal("focus_exited").AsUnitObservable());
 }
Esempio n. 19
0
 public static IObservable <Unit> OnMouseExit(this Godot.Control control)
 {
     return(control.FromSignal("mouse_exited").AsUnitObservable());
 }
Esempio n. 20
0
 public static IObservable <bool> OnVisibilityChange(this Godot.Control control)
 {
     return(control.FromSignal("visibility_changed").Select(_ => control.Visible));
 }
Esempio n. 21
0
        public static Option <Font> FindFont(this Godot.Control control, string name, string type)
        {
            Ensure.That(control, nameof(control)).IsNotNull();

            return(control.HasFont(name, type) ? Some(control.GetFont(name, type)) : None);
        }