コード例 #1
0
        public static void SetupSingleCostElement(UXFactory uxFactory, string costElementName, int credits, int materials, int contraband, int crystals, int eventPoints, bool locked, string lockedText)
        {
            string costElementStr  = costElementName + "Label";
            string creditName      = costElementName + "CreditIcon";
            string materialName    = costElementName + "MaterialIcon";
            string contrabandName  = costElementName + "ContrabandIcon";
            string crystalName     = costElementName + "CrystalIcon";
            string eventPointsName = costElementName + "EventIcon";
            string reputationName  = costElementName + "ReputationIcon";

            UXUtils.CommonSetupTasks(uxFactory, credits, materials, contraband, crystals, eventPoints, locked, lockedText, costElementName, creditName, materialName, contrabandName, crystalName, eventPointsName, reputationName, costElementStr, -1);
        }
コード例 #2
0
        public static UXElement SetCardQuality(UXFactory uxFactory, UXGrid grid, string itemUid, int qualityInt, string cardName, string defaultCardName)
        {
            UXElement subElement = grid.GetSubElement <UXElement>(itemUid, defaultCardName);

            if (qualityInt == 0)
            {
                subElement.Visible = true;
                UXUtils.HideGridQualityCards(grid, itemUid, cardName);
                return(null);
            }
            subElement.Visible = false;
            return(UXUtils.SetCardQuality(uxFactory, grid, itemUid, qualityInt, cardName));
        }
コード例 #3
0
        public static void SetupCostElements(UXFactory uxFactory, string costElementName, string clonedParentName, int credits, int materials, int contraband, int crystals, int eventPoints, bool locked, string lockedText, int clampWidth)
        {
            string costGroupStr    = UXUtils.FormatAppendedName(costElementName, clonedParentName);
            string costElementStr  = UXUtils.FormatAppendedName(costElementName + "Label", clonedParentName);
            string creditName      = UXUtils.FormatAppendedName(costElementName + "CreditIcon", clonedParentName);
            string materialName    = UXUtils.FormatAppendedName(costElementName + "MaterialIcon", clonedParentName);
            string contrabandName  = UXUtils.FormatAppendedName(costElementName + "ContrabandIcon", clonedParentName);
            string crystalName     = UXUtils.FormatAppendedName(costElementName + "CrystalIcon", clonedParentName);
            string eventPointsName = UXUtils.FormatAppendedName(costElementName + "EventIcon", clonedParentName);
            string reputationName  = UXUtils.FormatAppendedName(costElementName + "ReputationIcon", clonedParentName);

            UXUtils.CommonSetupTasks(uxFactory, credits, materials, contraband, crystals, eventPoints, locked, lockedText, costGroupStr, creditName, materialName, contrabandName, crystalName, eventPointsName, reputationName, costElementStr, clampWidth);
        }
コード例 #4
0
 public LabelFader(UXLabel label, UXFactory uxFactory, float showTime, float fadeTime, LabelFaderCompleteDelegate onComplete, int lineCount, UXElement objectToDestroy)
 {
     this.remainingTime   = showTime + fadeTime;
     this.label           = label;
     this.uxFactory       = uxFactory;
     this.fadeTime        = fadeTime;
     this.onComplete      = onComplete;
     this.objectToDestroy = objectToDestroy;
     this.LineCount       = lineCount;
     if (fadeTime > 0f || showTime > 0f)
     {
         Service.ViewTimeEngine.RegisterFrameTimeObserver(this);
     }
 }
コード例 #5
0
        public static UXElement SetCardQuality(UXFactory uxFactory, UXGrid grid, string itemUid, int qualityInt, string cardName)
        {
            string    name = string.Format(cardName, qualityInt);
            UXElement optionalSubElement = grid.GetOptionalSubElement <UXElement>(itemUid, name);

            if (optionalSubElement == null)
            {
                return(null);
            }
            UXUtils.HideGridQualityCards(grid, itemUid, cardName);
            uxFactory.RevertToOriginalNameRecursively(optionalSubElement.Root, itemUid);
            optionalSubElement.Visible = true;
            return(optionalSubElement);
        }
コード例 #6
0
 public void Destroy()
 {
     Service.ViewTimeEngine.UnregisterFrameTimeObserver(this);
     if (this.uxFactory != null)
     {
         this.uxFactory.DestroyElement(this.objectToDestroy);
     }
     if (this.onComplete != null)
     {
         this.onComplete(this);
     }
     this.onComplete      = null;
     this.objectToDestroy = null;
     this.uxFactory       = null;
     this.label           = null;
 }
コード例 #7
0
        public static void SetupMultiCostElements(UXFactory uxFactory, string[] costElementNames, string clonedParentName, string[] cost, int costMapCount)
        {
            int credits;
            int num;
            int num2;
            int num3;

            GameUtils.GetHQScaledCurrency(cost, out credits, out num, out num2, out num3);
            bool   locked     = false;
            string lockedText = null;

            UXUtils.SetupCostElements(uxFactory, costElementNames[0], clonedParentName, credits, num, num2, 0, 0, locked, lockedText);
            if (costMapCount == 2 && costElementNames.Length == 2)
            {
                if (num != 0 && num2 != 0)
                {
                    num = 0;
                }
                UXUtils.SetupCostElements(uxFactory, costElementNames[1], clonedParentName, 0, num, num2, 0, 0, locked, lockedText);
            }
        }
コード例 #8
0
        private static void CommonSetupTasks(UXFactory uxFactory, int credits, int materials, int contraband, int crystals, int eventPoints, bool locked, string lockedText, string costGroupStr, string creditName, string materialName, string contrabandName, string crystalName, string eventPointsName, string reputationName, string costElementStr, int clampWidth)
        {
            if (uxFactory == null)
            {
                return;
            }
            UXElement element = uxFactory.GetElement <UXElement>(costGroupStr);
            bool      flag    = credits != 0 || materials != 0 || contraband != 0 || crystals != 0 || eventPoints != 0 || !string.IsNullOrEmpty(lockedText);

            element.Visible = flag;
            if (flag)
            {
                UXSprite optionalElement  = uxFactory.GetOptionalElement <UXSprite>(creditName);
                UXSprite optionalElement2 = uxFactory.GetOptionalElement <UXSprite>(materialName);
                UXSprite optionalElement3 = uxFactory.GetOptionalElement <UXSprite>(contrabandName);
                UXSprite optionalElement4 = uxFactory.GetOptionalElement <UXSprite>(crystalName);
                UXSprite optionalElement5 = uxFactory.GetOptionalElement <UXSprite>(eventPointsName);
                UXSprite optionalElement6 = uxFactory.GetOptionalElement <UXSprite>(reputationName);
                UXUtils.HideIcon(optionalElement6);
                UXSprite icon = null;
                int      associatedIconWidth = 0;
                if (!uxFactory.HasElement <UXLabel>(costElementStr))
                {
                    Service.Logger.Error("UXFactory missing needed label: " + costElementStr);
                    return;
                }
                UXLabel element2 = uxFactory.GetElement <UXLabel>(costElementStr);
                element2.Root.GetComponent <UILabel>().overflowMethod = UILabel.Overflow.ResizeFreely;
                Lang lang = Service.Lang;
                if (credits != 0)
                {
                    if (optionalElement != null)
                    {
                        associatedIconWidth = optionalElement.GetUIWidget.width;
                        UXUtils.ShowIcon(optionalElement);
                        icon = optionalElement;
                    }
                    UXUtils.HideIcon(optionalElement2);
                    UXUtils.HideIcon(optionalElement3);
                    UXUtils.HideIcon(optionalElement4);
                    UXUtils.HideIcon(optionalElement5);
                    element2.Text = lang.ThousandsSeparated(credits);
                }
                else if (materials != 0)
                {
                    if (optionalElement2 != null)
                    {
                        associatedIconWidth = optionalElement2.GetUIWidget.width;
                        UXUtils.ShowIcon(optionalElement2);
                        icon = optionalElement2;
                    }
                    UXUtils.HideIcon(optionalElement);
                    UXUtils.HideIcon(optionalElement3);
                    UXUtils.HideIcon(optionalElement4);
                    UXUtils.HideIcon(optionalElement5);
                    element2.Text = lang.ThousandsSeparated(materials);
                }
                else if (contraband != 0)
                {
                    if (optionalElement3 != null)
                    {
                        associatedIconWidth = optionalElement3.GetUIWidget.width;
                        UXUtils.ShowIcon(optionalElement3);
                        icon = optionalElement3;
                    }
                    UXUtils.HideIcon(optionalElement);
                    UXUtils.HideIcon(optionalElement2);
                    UXUtils.HideIcon(optionalElement4);
                    UXUtils.HideIcon(optionalElement5);
                    element2.Text = lang.ThousandsSeparated(contraband);
                }
                else if (crystals != 0)
                {
                    if (optionalElement4 != null)
                    {
                        associatedIconWidth = optionalElement4.GetUIWidget.width;
                        UXUtils.ShowIcon(optionalElement4);
                        icon = optionalElement4;
                    }
                    UXUtils.HideIcon(optionalElement);
                    UXUtils.HideIcon(optionalElement2);
                    UXUtils.HideIcon(optionalElement3);
                    UXUtils.HideIcon(optionalElement5);
                    element2.Text = lang.ThousandsSeparated(crystals);
                }
                else if (eventPoints != 0)
                {
                    if (optionalElement5 != null)
                    {
                        associatedIconWidth = optionalElement5.GetUIWidget.width;
                        UXUtils.ShowIcon(optionalElement5);
                        icon = optionalElement5;
                    }
                    UXUtils.HideIcon(optionalElement);
                    UXUtils.HideIcon(optionalElement2);
                    UXUtils.HideIcon(optionalElement3);
                    UXUtils.HideIcon(optionalElement4);
                    element2.Text = lang.ThousandsSeparated(eventPoints);
                }
                else
                {
                    Vector3 localPosition = element2.LocalPosition;
                    UXUtils.HideIconMinX(optionalElement, ref localPosition);
                    UXUtils.HideIconMinX(optionalElement2, ref localPosition);
                    UXUtils.HideIconMinX(optionalElement3, ref localPosition);
                    UXUtils.HideIconMinX(optionalElement4, ref localPosition);
                    UXUtils.HideIconMinX(optionalElement5, ref localPosition);
                    element2.Text          = lockedText;
                    element2.TextColor     = UXUtils.GetCostColor(element2, false, true);
                    element2.LocalPosition = localPosition;
                }
                UXUtils.UpdateCostColor(element2, icon, credits, materials, contraband, crystals, eventPoints, locked);
                UXUtils.ClampUILabelWidth(element2, clampWidth, associatedIconWidth);
                UXUtils.CostGroupSetup(element);
            }
        }
コード例 #9
0
 public static void SetupCostElements(UXFactory uxFactory, string costElementName, string clonedParentName, int credits, int materials, int contraband, int crystals, int eventPoints, bool locked, string lockedText)
 {
     UXUtils.SetupCostElements(uxFactory, costElementName, clonedParentName, credits, materials, contraband, crystals, eventPoints, locked, lockedText, -1);
 }