示例#1
0
        public void UpdateDisplayFarmers()
        {
            for (int i = 0; i < availableTextures.Count; i++)
            {
                var textureIndex = i + _startingRow * _texturesPerRow;
                if (textureIndex < filteredTextureOptions.Count)
                {
                    var targetPack = filteredTextureOptions[textureIndex];

                    string          modDataKey      = null;
                    AppearanceModel appearanceModel = null;
                    switch (_appearanceFilter)
                    {
                    case HandMirrorMenu.HAIR_FILTER_BUTTON:
                        modDataKey      = ModDataKeys.CUSTOM_HAIR_ID;
                        appearanceModel = (targetPack as HairContentPack).GetHairFromFacingDirection(fakeFarmers[i].facingDirection);
                        break;

                    case HandMirrorMenu.ACCESSORY_FILTER_BUTTON:
                        modDataKey      = _callbackMenu.GetCurrentAccessorySlotKey();
                        appearanceModel = (targetPack as AccessoryContentPack).GetAccessoryFromFacingDirection(fakeFarmers[i].facingDirection);
                        break;

                    case HandMirrorMenu.HAT_FILTER_BUTTON:
                        modDataKey      = ModDataKeys.CUSTOM_HAT_ID;
                        appearanceModel = (targetPack as HatContentPack).GetHatFromFacingDirection(fakeFarmers[i].facingDirection);
                        break;

                    case HandMirrorMenu.SHIRT_FILTER_BUTTON:
                        modDataKey      = ModDataKeys.CUSTOM_SHIRT_ID;
                        appearanceModel = (targetPack as ShirtContentPack).GetShirtFromFacingDirection(fakeFarmers[i].facingDirection);
                        break;

                    case HandMirrorMenu.PANTS_FILTER_BUTTON:
                        modDataKey      = ModDataKeys.CUSTOM_PANTS_ID;
                        appearanceModel = (targetPack as PantsContentPack).GetPantsFromFacingDirection(fakeFarmers[i].facingDirection);
                        break;

                    case HandMirrorMenu.SLEEVES_FILTER_BUTTON:
                        if (_callbackMenu.GetCurrentFeatureSlotKey() == ModDataKeys.CUSTOM_SHOES_ID)
                        {
                            modDataKey      = ModDataKeys.CUSTOM_SHOES_ID;
                            appearanceModel = (targetPack as ShoesContentPack).GetShoesFromFacingDirection(fakeFarmers[i].facingDirection);
                        }
                        else
                        {
                            modDataKey      = ModDataKeys.CUSTOM_SLEEVES_ID;
                            appearanceModel = (targetPack as SleevesContentPack).GetSleevesFromFacingDirection(fakeFarmers[i].facingDirection);
                        }
                        break;
                    }

                    fakeFarmers[i].modData[modDataKey] = targetPack.Id;
                    FashionSense.ResetAnimationModDataFields(fakeFarmers[i], 0, AnimationModel.Type.Idle, fakeFarmers[i].facingDirection);
                    FashionSense.SetSpriteDirty();
                }
            }
        }
示例#2
0
        public override void receiveLeftClick(int x, int y, bool playSound = false)
        {
            base.receiveLeftClick(x, y, playSound);
            if (Game1.activeClickableMenu == null)
            {
                return;
            }

            for (int i = 0; i < availableTextures.Count; i++)
            {
                ClickableTextureComponent c = availableTextures[i];
                var textureIndex            = i + _startingRow * _texturesPerRow;
                if (textureIndex < filteredTextureOptions.Count && c.containsPoint(x, y))
                {
                    foreach (var key in fakeFarmers[i].modData.Keys)
                    {
                        _displayFarmer.modData[key] = fakeFarmers[i].modData[key];
                    }
                    FashionSense.ResetAnimationModDataFields(_displayFarmer, 0, AnimationModel.Type.Idle, _displayFarmer.facingDirection);
                    FashionSense.SetSpriteDirty();
                    base.exitThisMenu();
                    Game1.activeClickableMenu = _callbackMenu;
                    return;
                }
            }

            if (_startingRow > 0 && backButton.containsPoint(x, y))
            {
                _startingRow--;
                UpdateDisplayFarmers();
                Game1.playSound("shiny4");
                return;
            }
            if ((_maxRows + _startingRow) * _texturesPerRow < filteredTextureOptions.Count && forwardButton.containsPoint(x, y))
            {
                _startingRow++;
                UpdateDisplayFarmers();
                Game1.playSound("shiny4");
                return;
            }
        }