public override void HandleSubImageMouseover(ArcenUI_Image.SubImage SubImage)
            {
                int index = this.SubImages.IndexOf(SubImage);

                if (index < 0)
                {
                    return;
                }
                ImageId id = (ImageId)index;

                string tooltip = SubImage.Tooltip;

                switch (id)
                {
                case ImageId.Attack:
                case ImageId.Defense:
                    tooltip = tooltip.Replace("{0}", ExternalConstants.Instance.Balance_DamageMultiplierWhenCounteringDefense.ReadableString);
                    break;
                }

                string key = "EntityTooltipPanel_" + id;

                if (!Language.Current.Contains(key))
                {
                    return;
                }
                Window_AtMouseTooltipPanel.bPanel.Instance.SetText(Language.Current.GetValue(key) + tooltip);
            }
Ejemplo n.º 2
0
            public override void OnUpdate()
            {
                if (this.Element != null && this.NeedsToResize)
                {
                    this.NeedsToResize = false;

                    string  text        = this.NextTextToShow;
                    Vector2 messageSize = CalculateMessageSize(ref text);
                    this.WrappedNextTextToShow = text;

                    float textInset = 6;

                    this.LastRequestedWidth  = textInset + messageSize.x + textInset;
                    this.LastRequestedHeight = textInset + messageSize.y + textInset;

                    float referenceSideLength = 50;
                    float xScale = this.LastRequestedWidth / referenceSideLength;
                    float yScale = this.LastRequestedHeight / referenceSideLength;

                    ArcenUI_Image.SubImage subImage = this.Element.SubImages[0];
                    subImage.Img.rectTransform.sizeDelta = new Vector2(referenceSideLength * xScale, referenceSideLength * yScale);

                    float textSideLength = referenceSideLength - (textInset * 2);

                    SubText subText = this.Element.SubTexts[0];
                    subText.ReferenceText.rectTransform.sizeDelta = new Vector2(textSideLength * xScale, textSideLength * yScale);
                }
                base.OnUpdate();
            }
            public override void OnUpdate()
            {
                if (!this.HaveGottenScaleInfo && this.Element != null)
                {
                    this.HaveGottenScaleInfo = true;
                    //float referenceWidth = 300;
                    float referenceHeight = 345;
                    float requestedHeight = this.Element.Height * ArcenUI.Instance.PixelsPerPercent_Y;
                    float scaleRatio      = requestedHeight / referenceHeight;
                    this.XScale = scaleRatio;
                    this.YScale = scaleRatio;
                    //Rect rect = this.Element.ReferenceImage.rectTransform.rect;
                    //rect.width = referenceWidth * this.XScale;
                    //rect.height = referenceHeight * this.YScale;
                    //this.Element.ReferenceImage.rectTransform.SetWidth( rect.width );
                    //this.Element.ReferenceImage.rectTransform.SetHeight( rect.height );

                    //if ( ArcenUI.Instance.PixelsPerPercent_X != ArcenUI.Instance.PixelsPerPercent_Y )
                    //{
                    //    float adjustmentMultiplier = ArcenUI.Instance.PixelsPerPercent_Y / ArcenUI.Instance.PixelsPerPercent_X;
                    //    Vector3 mainImageScale = this.Element.ReferenceImage.transform.localScale;
                    //    mainImageScale.x *= adjustmentMultiplier;
                    //    this.Element.ReferenceImage.transform.localScale = mainImageScale;
                    //    referenceWidth *= adjustmentMultiplier;
                    //}

                    //Rect rect = this.Element.ReferenceImage.rectTransform.rect;
                    //this.XScale = rect.width / referenceWidth;
                    //this.YScale = rect.height / referenceHeight;

                    for (int i = 0; i < this.Element.SubImages.Length; i++)
                    {
                        ArcenUI_Image.SubImage image = this.Element.SubImages[i];

                        switch (i)
                        {
                        case (int)ImageId.Unused1:
                        case (int)ImageId.Unused2:
                        case (int)ImageId.Unused3:
                            continue;     // horrible hack, it's because these are actually duplicate references and all kinds of bad things will happen if they get multiplied more than once
                        }

                        Vector3 scale = image.Img.transform.localScale;
                        scale.x *= this.XScale;
                        scale.y *= this.YScale;
                        image.Img.transform.localScale = scale;

                        Vector3 position = image.Img.transform.localPosition;
                        position.x *= this.XScale;
                        position.y *= this.YScale;
                        image.Img.transform.localPosition = position;
                    }

                    for (int i = 0; i < this.Element.SubTexts.Length; i++)
                    {
                        SubText text = this.Element.SubTexts[i];

                        Vector3 scale = text.ReferenceText.transform.localScale;
                        scale.x *= this.XScale;
                        scale.y *= this.YScale;
                        text.ReferenceText.transform.localScale = scale;

                        Vector3 position = text.ReferenceText.transform.localPosition;
                        position.x *= this.XScale;
                        position.y *= this.YScale;
                        text.ReferenceText.transform.localPosition = position;
                    }
                }
                base.OnUpdate();
            }
 public virtual void HandleSubImageMouseover(ArcenUI_Image.SubImage SubImage)
 {
 }