Пример #1
0
 /// <summary>
 /// Basic root of user interface tree widget.
 /// </summary>
 /// <param name="name">Unique interface identifier</param>
 /// <param name="provider">Tile provider object, default value - null (interface would
 /// be drawn on the Main.tile, tiles would be irrevocably modified).
 /// <para></para>
 /// FakeTileRectangle from [FakeManager](https://github.com/AnzhelikaO/FakeManager)
 /// can be passed as a value so that interface would be drawn above the Main.tile.</param>
 public RootVisualObject(string name, int x, int y, int width, int height,
                         UIConfiguration configuration = null, ContainerStyle style = null, object provider = null)
     : base(x, y, width, height, configuration ?? new UIConfiguration() { UseBegin = true, UseMoving = true, UseEnd = true }, style)
 {
     Configuration.UseOutsideTouches = false;
     Name = name;
     if (provider == null)
     {
         Provider = new MainTileProvider();
     }
     else
     {
         Provider = provider;
     }
 }
Пример #2
0
 /// <summary>
 /// Draws popup object on top of all other child objects.
 /// </summary>
 /// <param name="style">Style of popup background</param>
 /// <param name="cancelCallback">Action to call when player touches popup background but not popup itself</param>
 /// <returns>PopUpBackground</returns>
 public virtual VisualContainer ShowPopUp(VisualObject popup, ContainerStyle style = null, Action <VisualObject> cancelCallback = null)
 {
     style             = style ?? new ContainerStyle();
     style.Transparent = true;
     lock (Locker)
     {
         if (PopUpBackground == null)
         {
             PopUpBackground = new VisualContainer(0, 0, 0, 0, new UIConfiguration()
             {
                 SessionAcquire = true
             }, style, (self, touch) =>
             {
                 VisualObject selected = self.Selected();
                 if (selected != null && PopUpCancelCallbacks.TryGetValue(selected, out Action <VisualObject> cancel))
                 {
                     cancel.Invoke(this);
                 }
                 else
                 {
                     HidePopUp();
                 }
             });
             Add(PopUpBackground, Int32.MaxValue);
         }
     }
     if (style != null)
     {
         PopUpBackground.Style = style;
     }
     PopUpBackground.SetFullSize(FullSize.Both);
     PopUpBackground.Add(popup);
     if (cancelCallback != null)
     {
         PopUpCancelCallbacks[popup] = cancelCallback;
     }
     PopUpBackground.ForceSection = ForceSection;
     PopUpBackground.Select(popup).Enable();
     Update();
     PopUpBackground.Apply().Draw();
     return(PopUpBackground);
 }
Пример #3
0
 public VisualContainer(ContainerStyle style)
     : this(0, 0, 0, 0, new UIConfiguration() { UseBegin = false }, style)
 {
 }
Пример #4
0
 public VisualContainer(int x, int y, int width, int height, UIConfiguration configuration = null, ContainerStyle style = null, Action <VisualObject, Touch> callback = null)
     : base(x, y, width, height, configuration, style ?? new ContainerStyle(), callback)
 {
 }
Пример #5
0
 public ContainerStyle(ContainerStyle style)
     : base(style)
 {
     Transparent = style.Transparent;
 }
Пример #6
0
 /// <summary>
 /// Show confirm window with information text and "yes", "no" buttons.
 /// </summary>
 /// <returns>this</returns>
 public virtual RootVisualObject Confirm(string text, Action <bool> callback, ContainerStyle windowStyle = null,
                                         ButtonStyle yesButtonStyle = null, ButtonStyle noButtonStyle = null)
 {
     ShowPopUp(new ConfirmWindow(text, callback, windowStyle, yesButtonStyle, noButtonStyle));
     return(this);
 }
Пример #7
0
 /// <summary>
 /// Show alert window with information text and "ok" button.
 /// </summary>
 /// <returns>this</returns>
 public virtual RootVisualObject Alert(string text, ContainerStyle windowStyle = null, ButtonStyle okButtonStyle = null)
 {
     ShowPopUp(new AlertWindow(text, windowStyle, okButtonStyle));
     return(this);
 }