Exemple #1
0
        public static void UpdateUnlockStateByPower(ICreativePower power, UIElement button, Color colorWhenSelected)
        {
            IGroupOptionButton asButton = button as IGroupOptionButton;

            if (asButton != null)
            {
                button.OnUpdate += delegate
                {
                    UpdateUnlockStateByPowerInternal(power, colorWhenSelected, asButton);
                };
            }
        }
Exemple #2
0
        public static void UpdateUnlockStateByPower(
            ICreativePower power,
            UIElement button,
            Color colorWhenSelected)
        {
            IGroupOptionButton asButton = button as IGroupOptionButton;

            if (asButton == null)
            {
                return;
            }
            button.OnUpdate += (UIElement.ElementEvent)(element => CreativePowersHelper.UpdateUnlockStateByPowerInternal(power, colorWhenSelected, asButton));
        }
Exemple #3
0
        private static void UpdateUnlockStateByPowerInternal(
            ICreativePower power,
            Color colorWhenSelected,
            IGroupOptionButton asButton)
        {
            bool isUnlocked = power.GetIsUnlocked();
            bool flag       = !CreativePowersHelper.IsAvailableForPlayer(power, Main.myPlayer);

            asButton.SetBorderColor(flag ? Color.DimGray : Color.White);
            if (flag)
            {
                asButton.SetColorsBasedOnSelectionState(new Color(60, 60, 60), new Color(60, 60, 60), 0.7f, 0.7f);
            }
            else if (isUnlocked)
            {
                asButton.SetColorsBasedOnSelectionState(colorWhenSelected, Colors.InventoryDefaultColor, 1f, 0.7f);
            }
            else
            {
                asButton.SetColorsBasedOnSelectionState(Color.Crimson, Color.Red, 0.7f, 0.7f);
            }
        }