示例#1
1
 protected ContentControl(GuiSystem guiSystem, XmlElement element) : base(guiSystem, element)
 {
     if (element.HasChildNodes)
     {
         Child = CreateFromXmlType(guiSystem, (XmlElement)element.FirstChild);
     }
 }
 public static void deleteSave(GuiElement inp)
 {
     if (MyRootMenuRev2.focusedSave != null)
     {
         popupConfirmDelete.isVisible = true;
         popupActive = true;
     }
 }
示例#3
0
        /// <summary>
        /// Control state info ctor
        /// </summary>
        /// <param name="stateName">Name of the property defines the control state.</param>
        /// <param name="stateValue">value of the control state</param>
        public ControlStateInfo(string stateName, string stateValue, string typeName, GuiElement guiElement)
        {
            this._controlStateName = stateName != null?stateName.Replace("ControlState", "") : stateName;

            this._controlStateValue = stateValue;
            this._controlStateType  = typeName;
            this._guiElement        = guiElement;
        }
 public static void loadGame(GuiElement inp)
 {
     // this method has to be called instead of RootMenuRev2.loadGame since we can not patch with Harmony the private original which uses instance variable.
     if (MyRootMenuRev2.focusedSave != null)
     {
         string name = MyRootMenuRev2.focusedSave.name;
         DeleteWorldSaves.MyRootMenuRev2.databaseLoadSpecified(name); // we also have to make our own method for loading the save as the original can not be accessed without harmony patch/reflections
     }
 }
示例#5
0
        private void SetButtonTransitionTo(GuiElement root, string buttonId, Type targetState)
        {
            var button = root.FindGuiElementById <Button>(buttonId);

            button.Click += () =>
            {
                _stateChangeInformation = StateChangeInformation.StateChange(targetState, typeof(SlideTransition));
            };
        }
        void MouseHover(GuiElement Sender, PointF MousePos, MouseButtons ButtonStatus)
        {
            Vector2 Pos = new Vector2(MousePos.X, MousePos.Y) - MainCirclePosition;

            if (ButtonStatus != MouseButtons.None && !IsDraggingCircle && Pos.LengthSquared < MainCircleOuterRadius * MainCircleOuterRadius)
            {
                RotationSpeed = 0;
            }
        }
        private void onDrawColorRect(Context ctx, ImageSurface surface, ElementBounds currentBounds)
        {
            ctx.Rectangle(0, 0, GuiElement.scaled(25), GuiElement.scaled(25));
            ctx.SetSourceRGBA(ColorUtil.ToRGBADoubles(color));

            ctx.FillPreserve();

            ctx.SetSourceRGBA(GuiStyle.DialogBorderColor);
            ctx.Stroke();
        }
 void FractalWindowClick(GuiElement Sender, PointF MousePos, MouseButtons ButtonStatus)
 {
     if (Sender is FractalWindow window)
     {
         zoomController.PrepareFromExisting(window);
         zoomController.Start();
         M.MainCoefficientArray         = window.Controller.CoefficientArray;
         M.polynomialParser.InputString = parser.InputString;
     }
 }
示例#9
0
            public static List <GuiElement> GetNewGuiPanel(
                Plugin plugin,
                string name,
                Rectangle rectangle,
                GuiElement parent,
                Layer layer,
                GuiColor panelColor = null,
                float FadeIn        = 0,
                float FadeOut       = 0,
                GuiText text        = null,
                string imgName      = null,
                Blur blur           = Blur.none)
            {
                List <GuiElement> elements = new List <GuiElement>();

                Layer higherLayer = layer;

                if (parent != null)
                {
                    higherLayer = (Layer)Math.Min((int)layer, (int)parent.Layer);
                }

                if (string.IsNullOrEmpty(imgName))
                {
                    GuiPlainPanel plainPanel = GuiPlainPanel.GetNewGuiPlainPanel(name, rectangle, parent, layer, panelColor, FadeIn, FadeOut, blur);
                    elements.Add(plainPanel);
                }
                else
                {
                    GuiImage image = GuiImage.GetNewGuiImage(plugin, name, rectangle, imgName, false, parent, layer, panelColor, FadeIn, FadeOut);
                    elements.Add(image);
                }
                if (text != null)
                {
                    text.FadeIn = FadeIn;
                    GuiLabel label = new GuiLabel
                    {
                        Name       = name + "_txt",
                        Rectangle  = new Rectangle(),
                        Layer      = higherLayer,
                        Parent     = name,
                        Text       = text,
                        FadeOut    = FadeOut,
                        Components =
                        {
                            text,
                            new Rectangle()
                        }
                    };
                    elements.Add(label);
                }

                return(elements);
            }
示例#10
0
 public DifficultySlot()
 {
     Children = new GuiElement[]
     {
         new Sprite(null)
         {
             RelativeSizeAxes = Axes.Both,
             Size             = Vector2.One,
         },
     };
 }
    private void SetupDiplomaticAbility(AgeTransform tableItem, GuiElement diplomaticAbilityGuiElement, int index)
    {
        DiplomaticAbilityItem component = tableItem.GetComponent <DiplomaticAbilityItem>();

        if (component == null)
        {
            Diagnostics.LogError("In the NegotiationScreen, trying to refresh a table item that is not a DiplomaticAbilityItem");
            return;
        }
        component.RefreshContent(diplomaticAbilityGuiElement);
    }
示例#12
0
 private bool IsMouseOverOccludingElement(GuiElement element, Vector2 mousePositionInScreenSpace)
 {
     if (!element.Showing)
     {
         return(false);
     }
     else
     {
         Rect elementRect = new Rect(0.0f, 0.0f, element.Size.x, element.Size.y);
         return(elementRect.Contains(element.GetWidgetPosition(mousePositionInScreenSpace)));
     }
 }
示例#13
0
 public string GetSelected(int mouseX, int mouseY)
 {
     for (int i = 0; i < Textures.Length; i++)
     {
         Texture tex = Textures[i];
         if (tex.IsValid && GuiElement.Contains(tex.X, tex.Y, tex.Width, tex.Height, mouseX, mouseY))
         {
             return(GetUrl(i, mouseX) ?? lines[i]);
         }
     }
     return(null);
 }
        public override void OnRenderGUI(float deltaTime)
        {
            base.OnRenderGUI(deltaTime);

            capi.Render.GlPushMatrix();

            if (focused)
            {
                capi.Render.GlTranslate(0, 0, 150);
            }

            capi.Render.GlRotate(-14, 1, 0, 0);

            mat.Identity();
            mat.RotateXDeg(-14);
            Vec4f  lightRot = mat.TransformVector(lighPos);
            double pad      = GuiElement.scaled(GuiElementItemSlotGridBase.unscaledSlotPadding);

            capi.Render.CurrentActiveShader.Uniform("lightPosition", new Vec3f(lightRot.X, lightRot.Y, lightRot.Z));

            capi.Render.PushScissor(insetSlotBounds);

            if (curTab == 0)
            {
                capi.Render.RenderEntityToGui(
                    deltaTime,
                    capi.World.Player.Entity,
                    insetSlotBounds.renderX + pad - GuiElement.scaled(195) * charZoom + GuiElement.scaled(115 * (1 - charZoom)),
                    insetSlotBounds.renderY + pad - GuiElement.scaled(10 + 30 * (1 - charZoom)),
                    (float)GuiElement.scaled(230),
                    yaw,
                    (float)GuiElement.scaled(330 * charZoom),
                    ColorUtil.WhiteArgb);
            }
            else
            {
                capi.Render.RenderEntityToGui(
                    deltaTime,
                    capi.World.Player.Entity,
                    insetSlotBounds.renderX + pad - GuiElement.scaled(95),
                    insetSlotBounds.renderY + pad - GuiElement.scaled(35),
                    (float)GuiElement.scaled(230),
                    yaw,
                    (float)GuiElement.scaled(180),
                    ColorUtil.WhiteArgb);
            }

            capi.Render.PopScissor();

            capi.Render.CurrentActiveShader.Uniform("lightPosition", new Vec3f(1, -1, 0).Normalize());

            capi.Render.GlPopMatrix();
        }
示例#15
0
 void DistanceColorButtonClicked(GuiElement Sender, PointF MousePos, MouseButtons ButtonStatus)
 {
     DistanceEstimateColoring = !DistanceEstimateColoring;
     foreach (var item in fractalWindows)
     {
         item.Controller.DistanceEstimateEnabled = DistanceEstimateColoring;
         if (DistanceEstimateColoring)
         {
             item.Controller.Compute();
         }
     }
 }
示例#16
0
        public static GuiElement Get(dynamic control)
        {
            if (control is NullExceptionPreventer)
            {
                return(null);
            }

            GuiElement guiElement = null;

            if (control.Type is NullExceptionPreventer)
            {
                throw new ArgumentException("Type of control is not defined in control Layout");
            }

            Type T = Assembly.Load("CGui").GetTypes().First(t => t.Name == control.Type);

            if (typeof(GuiElement).IsAssignableFrom(T))
            {
                if (T.ContainsGenericParameters)
                {
                    Type X = Assembly.GetCallingAssembly().GetTypes().First(t => t.Name == control.ItemType);
                    Type Y = T.MakeGenericType(X);
                    guiElement = Activator.CreateInstance(Y, new object[] { }) as GuiElement;
                }
                else
                {
                    guiElement = Activator.CreateInstance(T, new object[] { }) as GuiElement;
                }

                foreach (var propertyName in control.Keys)
                {
                    if (propertyName == "Type")
                    {
                        continue;
                    }
                    PropertyInfo prop = guiElement.GetType().GetProperty(propertyName, BindingFlags.Public | BindingFlags.Instance);
                    if (null != prop && prop.CanWrite)
                    {
                        if (prop.PropertyType == typeof(ConsoleColor))
                        {
                            prop.SetValue(guiElement, Configuration.GetColor(control[propertyName]), null);
                        }
                        else
                        {
                            prop.SetValue(guiElement, Convert.ChangeType(control[propertyName], prop.PropertyType), null);
                        }
                    }
                }
            }

            return(guiElement);
        }
示例#17
0
        internal GuiMinMax(GuiElement e)
        {
            maxHeight = e.MaxHeight;
            minHeight = e.MinHeight;
            maxWidth  = e.MaxWidth;
            minWidth  = e.MinWidth;

            maxHeight = GetMax(e.Height, e.MinHeight, e.MaxHeight);
            minHeight = GetMin(e.Height, e.MinHeight, e.MaxHeight);

            maxWidth = GetMax(e.Width, e.MinWidth, e.MaxWidth);
            minWidth = GetMin(e.Width, e.MinWidth, e.MaxWidth);
        }
示例#18
0
            public KnobSprite(ClientResourceManager skin)
            {
                var tex = skin.AquireTexture("textures/debug_vol");

                Children = new GuiElement[]
                {
                    m_sprite = new Sprite(tex)
                    {
                        RelativeSizeAxes = Axes.Both,
                        Size             = Vector2.One,
                        Color            = Vector4.One,
                    }
                };
            }
        protected string ComputeReadableString(string guiName, bool allowDefault = true)
        {
            GuiElement guiElement = null;

            if (this.GuiService.GuiPanelHelper.TryGetGuiElement(guiName, out guiElement))
            {
                return(AgeLocalizer.Instance.LocalizeString(guiElement.Title));
            }
            if (allowDefault)
            {
                return(AgeLocalizer.Instance.LocalizeString("%" + guiName + "Title"));
            }
            return(AgeLocalizer.Instance.LocalizeStringDefaults("%" + guiName + "Title", string.Empty));
        }
示例#20
0
        public void addElement(GuiElement label, int index = -1)
        {
            // Add the label, possibly at a specified index
            if (index < 0 || index >= allElements.Count)
            {
                allElements.Add(label);
            }
            else
            {
                allElements.Insert(index, label);
            }

            // Make sure all labels are in the correct positions
            calculateElementPositions();
        }
示例#21
0
 void Hover(GuiElement Sender, PointF MousePos, MouseButtons ButtonStatus)
 {
     if (HandleRect.Contains((int)MousePos.X, (int)MousePos.Y))
     {
         // GuiHandler.cursorType = GuiHandler.CursorTypes.Hand;
         if (Orientation == SliderOrientation.Horizontal)
         {
             GuiHandler.cursorType = GuiHandler.CursorTypes.ArrowHorizontal;
         }
         else
         {
             GuiHandler.cursorType = GuiHandler.CursorTypes.ArrowVertical;
         }
     }
 }
示例#22
0
        private void OnBgDraw(Context ctx, ImageSurface surface, ElementBounds currentBounds)
        {
            double top = cookingSlotsSlotBounds.fixedHeight + cookingSlotsSlotBounds.fixedY;

            // 1. Fire
            ctx.Save();
            Matrix m = ctx.Matrix;

            m.Translate(GuiElement.scaled(5), GuiElement.scaled(53 + top));
            m.Scale(GuiElement.scaled(0.25), GuiElement.scaled(0.25));
            ctx.Matrix = m;
            capi.Gui.Icons.DrawFlame(ctx);

            double dy = 210 - 210 * (Attributes.GetFloat("fuelBurnTime", 0) / Attributes.GetFloat("maxFuelBurnTime", 1));

            ctx.Rectangle(0, dy, 200, 210 - dy);
            ctx.Clip();
            LinearGradient gradient = new LinearGradient(0, GuiElement.scaled(250), 0, 0);

            gradient.AddColorStop(0, new Color(1, 1, 0, 1));
            gradient.AddColorStop(1, new Color(1, 0, 0, 1));
            ctx.SetSource(gradient);
            capi.Gui.Icons.DrawFlame(ctx, 0, false, false);
            gradient.Dispose();
            ctx.Restore();


            // 2. Arrow Right
            ctx.Save();
            m = ctx.Matrix;
            m.Translate(GuiElement.scaled(63), GuiElement.scaled(top + 2));
            m.Scale(GuiElement.scaled(0.6), GuiElement.scaled(0.6));
            ctx.Matrix = m;
            capi.Gui.Icons.DrawArrowRight(ctx, 2);

            double cookingRel = Attributes.GetFloat("oreCookingTime") / Attributes.GetFloat("maxOreCookingTime", 1);


            ctx.Rectangle(5, 0, 125 * cookingRel, 100);
            ctx.Clip();
            gradient = new LinearGradient(0, 0, 200, 0);
            gradient.AddColorStop(0, new Color(0, 0.4, 0, 1));
            gradient.AddColorStop(1, new Color(0.2, 0.6, 0.2, 1));
            ctx.SetSource(gradient);
            capi.Gui.Icons.DrawArrowRight(ctx, 0, false, false);
            gradient.Dispose();
            ctx.Restore();
        }
示例#23
0
    public void Bind(Fortress fortress)
    {
        GuiElement guiElement = null;

        this.Fortress = fortress;
        for (int i = 0; i < this.typesFIDS.Count; i++)
        {
            base.GuiService.GuiPanelHelper.TryGetGuiElement(this.typesFIDS[i], out guiElement, this.Fortress.Occupant.Faction.Name);
            if (guiElement != null)
            {
                ExtendedGuiElement extendedGuiElement = (ExtendedGuiElement)guiElement;
                if (i < this.TotalValuesTable.GetChildren().Count)
                {
                    AgeTransform ageTransform = this.TotalValuesTable.GetChildren()[i];
                    for (int j = 0; j < ageTransform.GetChildren().Count; j++)
                    {
                        AgeTooltip component = ageTransform.GetComponent <AgeTooltip>();
                        if (component != null)
                        {
                            component.Class   = "Simple";
                            component.Content = extendedGuiElement.Description;
                        }
                        AgeTransform ageTransform2 = ageTransform.GetChildren()[j];
                        if (ageTransform2.name == "1Symbol")
                        {
                            Texture2D image;
                            if (base.GuiService.GuiPanelHelper.TryGetTextureFromIcon(guiElement, global::GuiPanel.IconSize.Small, out image))
                            {
                                ageTransform2.GetComponent <AgePrimitiveImage>().Image     = image;
                                ageTransform2.GetComponent <AgePrimitiveImage>().TintColor = extendedGuiElement.Color;
                            }
                            break;
                        }
                    }
                }
            }
            SimulationPropertyTooltipData simulationPropertyTooltipData = this.valuesFIDS[i].AgeTransform.AgeTooltip.ClientData as SimulationPropertyTooltipData;
            if (simulationPropertyTooltipData != null)
            {
                simulationPropertyTooltipData.Context = this.Fortress;
            }
        }
        IGameService service = Services.GetService <IGameService>();

        this.PlayerController       = service.Game.Services.GetService <IPlayerControllerRepositoryService>().ActivePlayerController;
        this.updateFacilityDelegate = new AgeTransform.RefreshTableItem <PointOfInterest>(this.UpdateFacility);
    }
示例#24
0
 void Drag(GuiElement Sender, PointF MousePos, PointF StartPos, PointF DeltaPos, MouseButtons ButtonStatus)
 {
     if (ButtonStatus == MouseButtons.Left)
     {
         if (HoldingHandle)
         {
             if (Orientation == SliderOrientation.Horizontal)
             {
                 Value = 1 - (1 - StartValue + (StartPos.X - MousePos.X) / (Rect.Width - HandleRectangleSize.Width - Padding * 2));
             }
             else
             {
                 Value = StartValue + (StartPos.Y - MousePos.Y) / (Rect.Height - HandleRectangleSize.Height - Padding * 2);
             }
             if (Value > 1)
             {
                 Value = 1;
             }
             if (Value < 0)
             {
                 Value = 0;
             }
             if (SliderEvent != null)
             {
                 SliderEvent.Invoke(Value);
             }
         }
     }
     else if (AllowSmoothMotion && ButtonStatus == MouseButtons.Right)
     {
         DoingSmoothMotion = true;
         if (Orientation == SliderOrientation.Horizontal)
         {
             SmoothStart = StartPos.X;
             SmoothEnd   = MousePos.X;
         }
         else
         {
             SmoothStart = StartPos.Y;
             SmoothEnd   = MousePos.Y;
         }
         if (Math.Abs(SmoothEnd - SmoothStart) > SmoothMaxDistance)
         {
             SmoothEnd = SmoothStart + Math.Sign(SmoothEnd - SmoothStart) * SmoothMaxDistance;
         }
     }
 }
示例#25
0
        int HighlightedName(int mouseX, int mouseY)
        {
            for (int i = 0; i < namesCount; i++)
            {
                if (!textures[i].IsValid || IDs[i] == groupNameID)
                {
                    continue;
                }

                Texture t = textures[i];
                if (GuiElement.Contains(t.X, t.Y, t.Width, t.Height, mouseX, mouseY))
                {
                    return(i);
                }
            }
            return(-1);
        }
示例#26
0
        // override class in order to allow the rendering of two textures
        public override void RenderTo(ICoreClientAPI capi, double x, double y)
        {
            double posX = GuiElement.scaled(10.0);
            double posY = GuiElement.scaled(25.0);

            if (this.Texture != null)
            {
                capi.Render.Render2DTexturePremultipliedAlpha(this.Texture.TextureId, x + posX, y + posY / 4.0 - 3.0, this.Texture.Width, this.Texture.Height);
            }

            if (this.textTexture == null)
            {
                Recompose(capi);
            }

            capi.Render.Render2DTexturePremultipliedAlpha(this.textTexture.TextureId, x + posX + 50, y + posY / 4.0 - 3.0, this.textTexture.Width, this.textTexture.Height);
        }
示例#27
0
    public void SetupContent(DownloadableContent downloadableContent, GameObject client, bool activated)
    {
        this.ActivationToggle.OnSwitchObject = client;
        this.ActivationToggle.OnSwitchData   = downloadableContent.Name.ToString();
        this.StoreButton.OnActivateObject    = client;
        this.StoreButton.OnActivateData      = downloadableContent.Name.ToString();
        this.Background.Image = AgeManager.Instance.FindDynamicTexture("Gui/DynamicBitmaps/Notifications/NotificationBackground", false);
        IGuiPanelHelper guiPanelHelper = Services.GetService <global::IGuiService>().GuiPanelHelper;
        GuiElement      guiElement     = null;

        if (guiPanelHelper != null)
        {
            if (guiPanelHelper.TryGetGuiElement(downloadableContent.Name, out guiElement))
            {
                this.Title.Text       = guiElement.Title;
                this.Description.Text = guiElement.Description;
                this.Type.Text        = "%DownloadableContentType" + downloadableContent.Type.ToString() + "Title";
                this.Type.AgeTransform.AgeTooltip.Content = "%DownloadableContentType" + downloadableContent.Type.ToString() + "Description";
                Texture2D image;
                if (guiPanelHelper.TryGetTextureFromIcon(guiElement, global::GuiPanel.IconSize.Large, out image))
                {
                    this.LargeImage.Image = image;
                }
                if (guiPanelHelper.TryGetTextureFromIcon(guiElement, global::GuiPanel.IconSize.Small, out image))
                {
                    this.SmallImageBackground.Visible = true;
                    this.SmallImage.Image             = image;
                }
                else
                {
                    this.SmallImageBackground.Visible = false;
                    this.SmallImage.Image             = null;
                }
            }
            else
            {
                this.Title.Text       = downloadableContent.Name;
                this.Description.Text = downloadableContent.Description;
                this.Type.Text        = downloadableContent.Type.ToString();
                this.LargeImage.Image = null;
                this.SmallImage.Image = null;
            }
        }
        this.RefreshDownloadableContentActivation(downloadableContent, activated);
    }
示例#28
0
        private bool onClickItem(int page)
        {
            currentLoreItemIndex = page;
            this.page            = 0;

            CairoFont     font     = CairoFont.WhiteDetailText().WithFontSize(17).WithLineHeightMultiplier(1.15f);
            TextDrawUtil  prober   = new TextDrawUtil();
            StringBuilder fulltext = new StringBuilder();

            JournalEntry entry = journalitems[currentLoreItemIndex];

            for (int p = 0; p < entry.Chapters.Count; p++)
            {
                if (p > 0)
                {
                    fulltext.AppendLine();
                }
                fulltext.Append(Lang.Get(entry.Chapters[p].Text));
            }

            pages = Paginate(fulltext.ToString(), font, GuiElement.scaled(629), GuiElement.scaled(450));


            double elemToDlgPad = GuiStyle.ElementToDialogPadding;

            ElementBounds textBounds   = ElementBounds.Fixed(0, 0, 630, 450);
            ElementBounds dialogBounds = textBounds.ForkBoundingParent(elemToDlgPad, elemToDlgPad + 20, elemToDlgPad, elemToDlgPad + 30).WithAlignment(EnumDialogArea.LeftMiddle);

            dialogBounds.fixedX = 350;


            Composers["loreItem"] =
                capi.Gui
                .CreateCompo("loreItem", dialogBounds)
                .AddShadedDialogBG(ElementBounds.Fill, true)
                .AddDialogTitleBar(Lang.Get(journalitems[page].Title), CloseIconPressedLoreItem)
                .AddRichtext(pages[0], font, textBounds, "page")
                .AddDynamicText("1 / " + pages.Length, CairoFont.WhiteSmallishText().WithOrientation(EnumTextOrientation.Center), ElementBounds.Fixed(250, 500, 100, 30), "currentpage")
                .AddButton(Lang.Get("Previous Page"), OnPrevPage, ElementBounds.Fixed(17, 500, 100, 23).WithFixedPadding(10, 4), CairoFont.WhiteSmallishText())
                .AddButton(Lang.Get("Next Page"), OnNextPage, ElementBounds.Fixed(520, 500, 100, 23).WithFixedPadding(10, 4), CairoFont.WhiteSmallishText())
                .Compose()
            ;

            return(true);
        }
示例#29
0
        private void fullnessMeterDraw(Context ctx, ImageSurface surface, ElementBounds currentBounds)
        {
            ItemSlot liquidSlot = Inventory[1]; // Water ID Slot

            if (liquidSlot.Empty)
            {
                return;
            }

            BlockEntitySingleSink besink = capi.World.BlockAccessor.GetBlockEntity(BlockEntityPosition) as BlockEntitySingleSink;
            float itemsPerLitre          = 1f;
            int   capacity = besink.CapacityLitres;

            WaterTightContainableProps props = BlockLiquidContainerBase.GetInContainerProps(liquidSlot.Itemstack);

            if (props != null)
            {
                itemsPerLitre = props.ItemsPerLitre;
                capacity      = Math.Max(capacity, props.MaxStackSize);
            }

            float fullnessRelative = liquidSlot.StackSize / itemsPerLitre / capacity;


            double offY = (1 - fullnessRelative) * currentBounds.InnerHeight;

            ctx.Rectangle(0, offY, currentBounds.InnerWidth, currentBounds.InnerHeight - offY);
            //ctx.SetSourceRGBA(ravg/255.0, gavg / 255.0, bavg / 255.0, aavg / 255.0);
            //ctx.Fill();

            CompositeTexture tex = liquidSlot.Itemstack.Collectible.Attributes?["waterTightContainerProps"]?["texture"]?.AsObject <CompositeTexture>(null, liquidSlot.Itemstack.Collectible.Code.Domain);

            if (tex != null)
            {
                ctx.Save();
                Matrix m = ctx.Matrix;
                m.Scale(GuiElement.scaled(3), GuiElement.scaled(3));
                ctx.Matrix = m;

                AssetLocation loc = tex.Base.Clone().WithPathAppendixOnce(".png");
                GuiElement.fillWithPattern(capi, ctx, loc.Path, true, false);

                ctx.Restore();
            }
        }
示例#30
0
        void MainDrag(GuiElement Sender, PointF MousePos, PointF StartPos, PointF DeltaPos, MouseButtons ButtonStatus)
        {
            Vector2 Change         = new Vector2(DeltaPos.X, DeltaPos.Y);
            Vector2 Pos            = new Vector2(MousePos.X, MousePos.Y) - MainCirclePosition;
            double  StartAngle     = Math.Atan2(Pos.Y, Pos.X);
            double  EndAngle       = Math.Atan2(Pos.Y + Change.Y, Pos.X + Change.X);
            float   RotationChange = (float)((StartAngle - EndAngle) / (2 * Math.PI));

            if (IsHoldingNode)
            {
                PalettePositions[SelectedIndex] += RotationChange;
            }
            else if (IsHoldingCircle)
            {
                RotationSpeed    = RotationChange;
                IsDraggingCircle = true;
            }
        }
示例#31
0
        public void Update(GameTime gameTime)
        {
            _previousKeyboard = _currentKeyboard;
            _currentKeyboard  = Keyboard.GetState();

            _previousMouse = _currentMouse;
            _currentMouse  = Mouse.GetState();

            if (_previousKeyboard.IsKeyDown(ToggleDebugHotKey) && _currentKeyboard.IsKeyUp(ToggleDebugHotKey))
            {
                Enabled = !Enabled;
            }

            if (!Enabled)
            {
                return;
            }
            if (!BoundingBoxesEnabled)
            {
                return;
            }

            if ((_previousMouse.LeftButton == ButtonState.Pressed && _currentMouse.LeftButton != ButtonState.Pressed) ||
                (_previousMouse.RightButton == ButtonState.Pressed && _currentMouse.RightButton != ButtonState.Pressed))
            {
                TopMostFocused = TopMostFocused == null ? _topMostHighlighted : null;
            }

            if (_previousKeyboard.IsKeyDown(Keys.Escape) && _currentKeyboard.IsKeyUp(Keys.Escape))
            {
                TopMostFocused = null;
            }

            // add extra updates below here
            if (TopMostFocused == null)
            {
                CursorPosition = Renderer.Unproject(_currentMouse.Position.ToVector2());
            }

            if (GuiManager.FocusManager.TryGetElementAt(CursorPosition, e => e is GuiElement c,
                                                        out var controlMatchingPosition))
            {
                _topMostHighlighted = controlMatchingPosition as GuiElement;
            }
示例#32
0
 private void ConfigureNameElement(GuiElement element, FleetReport report) {
     var nameLabel = element.gameObject.GetSafeFirstMonoBehaviourInChildren<UILabel>();
     nameLabel.text = report.ParentName != null ? report.ParentName : _unknown;
     UIEventListener.Get(element.gameObject).onDoubleClick += CloseScreenAndFocusOnItem; // OPTIMIZE Cleanup?
 }
示例#33
0
 private void ConfigureOwnerElement(GuiElement element, FleetReport report) {
     var ownerElement = element as OwnerGuiElement;
     ownerElement.Owner = report.Owner;
 }
示例#34
0
 private void ConfigureLocationElement(GuiElement element, FleetReport report) {
     var locationElement = element as GuiLocationElement;
     locationElement.SetValues(report.SectorIndex, report.__Position);
 }
示例#35
0
 private void AddChild(int column, int row, GuiElement element)
 {
     _childElementsByLinearTableIndex.Add(new Tuple<int, int>(column, row), element);
     Children.Add(element);
 }
示例#36
0
 private void ConfigureHeroElement(GuiElement element, FleetReport report) {
     var heroElement = element as HeroGuiElement;
     heroElement.__HeroName = "None";    // = report.Hero;
 }
示例#37
0
 private void ConfigureSizeElement(GuiElement element, FleetReport report, IIconInfo iconInfo) {
     var sizeElement = element as GuiSizeElement;
     sizeElement.SetValues(iconInfo, report.Category);
 }
示例#38
0
 private void ConfigureMaxSpeedElement(GuiElement element, FleetReport report) {
     var speedLabel = element.gameObject.GetSafeFirstMonoBehaviourInChildren<UILabel>();
     speedLabel.text = report.UnitFullSpeed.HasValue ? _speedFormat.Inject(report.UnitFullSpeed.Value) : _unknown;
 }
示例#39
0
 public void AddChild(GuiElement child)
 {
     Children.Add(child);
 }
示例#40
0
 private void ConfigureHealthElement(GuiElement element, FleetReport report) {
     var healthElement = element as HealthGuiElement;
     healthElement.SetValues(report.UnitHealth, report.UnitCurrentHitPoints, report.UnitMaxHitPoints);
 }
示例#41
0
 private void ConfigureDefensiveStrengthElement(GuiElement element, FleetReport report) {
     var strengthElement = element as GuiStrengthElement;
     strengthElement.DefensiveStrength = report.UnitDefensiveStrength;
 }