示例#1
0
        private bool updateWidgetInput(Player player)
        {
            bool             flag = false;
            IAttributeWidget selectedAttribute = SelectedAttribute;

            if (uiDelay == 0)
            {
                if (parentUI.IsDownButtonDown() && selectedAttribute.SelectDown())
                {
                    flag = true;
                }
                if (parentUI.IsUpButtonDown() && selectedAttribute.SelectUp())
                {
                    flag = true;
                }
                if (parentUI.IsLeftButtonDown() && selectedAttribute.SelectLeft())
                {
                    flag = true;
                }
                if (parentUI.IsRightButtonDown() && selectedAttribute.SelectRight())
                {
                    flag = true;
                }
            }
            if (flag)
            {
                selectedAttribute.Apply(player);
            }
            return(flag);
        }
示例#2
0
        private bool updateCategoryInput(Player player)
        {
            bool             result            = false;
            IAttributeWidget selectedAttribute = SelectedAttribute;

            if ((IsButtonDown(Buttons.RightShoulder) || parentUI.IsButtonTriggered(Buttons.A)) && categoryWidget.SelectNext())
            {
                result            = true;
                previousAttribute = selectedAttribute;
                SelectedAttribute.Show();
                UpdateHeaderAndFooter();
                if (parentUI.IsButtonTriggered(Buttons.A))
                {
                    previousAttribute.FlashSelection(10);
                }
            }
            if (IsButtonDown(Buttons.LeftShoulder) && categoryWidget.SelectPrevious())
            {
                result            = true;
                previousAttribute = selectedAttribute;
                SelectedAttribute.Show();
                UpdateHeaderAndFooter();
            }
            if (parentUI.IsButtonTriggered(Buttons.Y))
            {
                Randomize(player);
                result = true;
            }
            return(result);
        }
示例#3
0
        public void ApplyDefaultAttributes(Player player)
        {
            Randomize(player);
            IAttributeWidget attributeWidget = attributes[9];

            attributeWidget.Reset();
            attributeWidget.Apply(player);
            categoryWidget.SelectedIndex = 0;
            UpdateHeaderAndFooter();
        }
示例#4
0
 public void Randomize(Player player)
 {
     Vector2i[] array = RandomCharacter.create(rnd);
     for (int i = 0; i < attributes.Length; i++)
     {
         if (i != 9)
         {
             IAttributeWidget attributeWidget = attributes[i];
             attributeWidget.SetCursor(array[i]);
             attributeWidget.Apply(player);
         }
     }
 }
示例#5
0
        public static UI Create(Terraria.UI parentUI)
        {
            CategorySelector categorySelector = new CategorySelector(Assets.CATEGORY_ICONS, Assets.CATEGORY_BACKGROUND, Assets.CATEGORY_BACKGROUND_SELECTED, new Vector2(54f, 0f));

            IAttributeWidget[] array = new IAttributeWidget[10];
            array[1] = HairAttributeWidget.Create(PlayerModifier.Hair, new Vector2i(4, 1), Lang.controls(Lang.CONTROLS.HAIR_TYPE), Lang.controls(Lang.CONTROLS.SELECT_TYPE));
            array[2] = ColorAttributeWidget.Create(PlayerModifier.HairColor, new Vector2i(4, 6), Lang.controls(Lang.CONTROLS.HAIR_COLOR), Lang.controls(Lang.CONTROLS.SELECT_COLOR));
            array[5] = ColorAttributeWidget.Create(PlayerModifier.Shirt, new Vector2i(4, 2), Lang.controls(Lang.CONTROLS.SHIRT_COLOR), Lang.controls(Lang.CONTROLS.SELECT_COLOR));
            array[6] = ColorAttributeWidget.Create(PlayerModifier.Undershirt, new Vector2i(2, 6), Lang.controls(Lang.CONTROLS.UNDERSHIRT_COLOR), Lang.controls(Lang.CONTROLS.SELECT_COLOR));
            array[7] = ColorAttributeWidget.Create(PlayerModifier.Pants, new Vector2i(9, 7), Lang.controls(Lang.CONTROLS.PANTS_COLOR), Lang.controls(Lang.CONTROLS.SELECT_COLOR));
            array[8] = ColorAttributeWidget.Create(PlayerModifier.Shoes, new Vector2i(0, 0), Lang.controls(Lang.CONTROLS.SHOE_COLOR), Lang.controls(Lang.CONTROLS.SELECT_COLOR));
            array[3] = ColorAttributeWidget.Create(PlayerModifier.Eyes, new Vector2i(9, 2), Lang.controls(Lang.CONTROLS.EYE_COLOR), Lang.controls(Lang.CONTROLS.SELECT_COLOR));
            array[4] = ColorAttributeWidget.Create(PlayerModifier.Skin, new Vector2i(3, 3), Lang.controls(Lang.CONTROLS.SKIN_COLOR), Lang.controls(Lang.CONTROLS.SELECT_COLOR));
            array[0] = GenderAttributeWidget.Create(PlayerModifier.Gender, GenderAttributeWidget.Gender.MALE, Lang.controls(Lang.CONTROLS.GENDER), Lang.controls(Lang.CONTROLS.SELECT_GENDER));
            array[9] = DifficultyAttributeWidget.Create(PlayerModifier.Difficulty, Difficulty.SOFTCORE, Lang.controls(Lang.CONTROLS.DIFFICULTY), Lang.controls(Lang.CONTROLS.SELECT_DIFFICULTY));
            return(new UI(parentUI, categorySelector, array));
        }