using UnityEditor; using UnityEngine; using UnityEngine.UI; namespace Fateforge.Editor { public static class CabinetArtwork { const string Art = "Assets/Fateforge/Art/PhysicalCasino/"; const string Shop = "Assets/Fateforge/Resources/Fateforge/Art/assets/graphics/sprites/kit_ui_shop_interface/"; const string Audio = "Assets/Fateforge/Resources/Fateforge/Audio/sfx/"; public static void Load(UiTheme theme) { theme.coinSprite = AssetDatabase.LoadAssetAtPath(Art + "CoinStack.png"); theme.helpBadge = AssetDatabase.LoadAssetAtPath(Art + "HelpBadge.png"); theme.leverHub = AssetDatabase.LoadAssetAtPath(Art + "LeverHub.png"); theme.leverRod = AssetDatabase.LoadAssetAtPath(Art + "LeverRod.png"); theme.leverKnob = AssetDatabase.LoadAssetAtPath(Art + "LeverKnob.png"); theme.unlockSprite = AssetDatabase.LoadAssetAtPath(Art + "UnlockPlus.png"); theme.rerollSprite = AssetDatabase.LoadAssetAtPath(Shop + "reroll_button_normal.png"); theme.ticketRip = AssetDatabase.LoadAssetAtPath(Audio + "RS_ticket_rip_1.ogg"); theme.defeatStinger = AssetDatabase.LoadAssetAtPath(Audio + "CHA_MUS_STINGER_DEFEAT_03.ogg"); theme.scoreTick = AssetDatabase.LoadAssetAtPath(Audio + "score/RS_score_ratchet_1.ogg"); theme.scoreImpact = AssetDatabase.LoadAssetAtPath(Audio + "score/RS_score_impact.ogg"); theme.defeatArt=AssetDatabase.LoadAssetAtPath(Art+"AfterHours.png"); theme.magnetActivation=AssetDatabase.LoadAssetAtPath(Audio+"combinations/RS_magnet_electric_activation_1.ogg"); EditorUtility.SetDirty(theme); } // Also upgrades an already authored scene without rebuilding unrelated assets. public static void Apply(ViewBindings view) { Load(view.theme); SetCoin(view.play.Find("CoinIcon"), view.theme); var help = (Image)view.help.targetGraphic; help.sprite = view.theme.helpBadge; help.color = Color.white; var helpLabel=view.help.GetComponentInChildren(true); helpLabel.text=""; helpLabel.enabled=false; string path = AssetDatabase.GetAssetPath(view.offerPrefab); var root = PrefabUtility.LoadPrefabContents(path); try { var offer = root.GetComponent(); offer.priceCoin = SetCoin(offer.buy.transform.Find("PriceCoin"), view.theme); PrefabUtility.SaveAsPrefabAsset(root, path); } finally { PrefabUtility.UnloadPrefabContents(root); } } static Image SetCoin(Transform node, UiTheme theme) { if (node.TryGetComponent(out var old)) Object.DestroyImmediate(old); if (!node.TryGetComponent(out var image)) image = node.gameObject.AddComponent(); image.sprite = theme.coinSprite; image.color = Color.white; image.preserveAspect = true; image.raycastTarget = false; return image; } } }