using UnityEngine;
using UnityEngine.UI;
using UnityEngine.U2D;
public class VersionDesigner : MonoBehaviour
{
[SerializeField] GameObject _MessageSoon;
[SerializeField] GameObject _InfoPanel;
[SerializeField] GameObject _View360;
//[SerializeField] GameObject Collection;
//public GameObject _MODELContainer;
//[SerializeField] UIButtonCache[] _buttons;
//static UIButtonCache[] _buttonPool = new UIButtonCache[24];
// static bool _poolCreated = false;
public void Verification()
{
if (Get.PreferenceBool("VERSION_DESIGNER"))
{
DOIT.CloseALLPNL();
Get.o2("HIDER", "CameraCapture").SetActive(true);
Set.alpha(Get.o2("Canvas", "Panel_SCENE"), false);
}
else MessageSoon();
}
public void MessageSoon()
{
_MessageSoon.SetActive(!Get.PreferenceBool("VERSION_DESIGNER"));
Set.GlobalColorAndTranslate();
}
public void MessageClose()
{
_MessageSoon.SetActive(false);
_InfoPanel.SetActive(false);
_View360.SetActive(false);
}
public void CameraCapture()
{
Camera cam = Camera.main;
_G.SaveCameraView.Add(new CameraView
{
Name = $"View_{_G.SaveCameraView.Count + 1}",
Position = cam.transform.position,
Rotation = cam.transform.rotation,
FieldOfView = cam.fieldOfView
});
Debug.Log($"✅ CameraView sauvegardée: {_G.SaveCameraView.Count} vue(s)");
foreach (var v in _G.SaveCameraView)
Debug.Log($" → {v.Name} | Pos: {v.Position} | FOV: {v.FieldOfView}");
Set.alpha(Get.o2("Canvas", "Panel_SCENE"), true);
Get.o2("HIDER", "CameraCapture").SetActive(false);
DASH.RESETSCENE();
}
/// ---------------------------------------------------------------
/// Deco Panal Selecetion---------------------------------------------------
/// --------------------------------------------------------------
// public void CollectionSelect()
// {
// string collectionName = Get.TogOn(Collection).name;
// print(collectionName);
// SetSelection(collectionName);
// }
// public static void SetSelection(string category)
// {
// int number = 101;
// switch (category)
// {
// case "1": number = 125; break;
// case "2": number = 149; break;
// case "3": number = 173; break;
// case "4": number = 197; break;
// case "5": number = 221; break;
// case "6": number = 245; break;
// }
// string atlasPath = "ATLAS/STOOL_" + category;
// SpriteAtlas atlas = AtlasCache.GetAtlas(atlasPath);
// Debug.Log("Category = " + category);
// Debug.Log("Atlas found = " + (atlas != null));
// DecoObject3D(atlas, "STOOL", number);
// }
// public static void DecoObject3D(SpriteAtlas atlas, string nameObject, int numberStart)
// {
// if (atlas == null)
// {
// Debug.LogError("Atlas is null");
// return;
// }
// //CreateButtonPool();
// for (int i = 0; i < 24; i++)
// {
// int itemId = numberStart + i;
// var btn = _buttonPool[i];
// if (btn == null || btn.Root == null)
// {
// Debug.LogError("Button pool item is null at index " + i);
// continue;
// }
// btn.Root.SetActive(true);
// btn.Root.name = nameObject[..4] + itemId;
// btn.Label.text = itemId.ToString();
// Sprite sp = atlas.GetSprite("STOO" + itemId);
// if (sp == null)
// Debug.LogWarning("Sprite not found: STOO" + itemId);
// btn.Background.sprite = sp;
// }
// Set.ToggleGroupToAllChild(_G.PON + "/MODEL/Viewport/Content");
// }
// public static void CreateButtonPool()
// {
// GameObject pnl = Get.o2(_G.PON + "/MODEL/Viewport", "Content");
// print("_poolCreated==="+_poolCreated +" button Count====" +pnl.transform.childCount);
// if (_poolCreated && pnl.transform.childCount==24) return;
// DOIT.DELETEAllChild(_G.PON + "/MODEL/Viewport/Content");
// GameObject btnPrefab = Get.o2(_G.PON, "BTNSELECTION");
// if (pnl == null)
// {
// Debug.LogError("PNL Content not found");
// return;
// }
// if (btnPrefab == null)
// {
// Debug.LogError("BTNSELECTION prefab not found");
// return;
// }
// for (int i = 0; i < 24; i++)
// {
// GameObject o = Instantiate(btnPrefab, pnl.transform, false);
// o.SetActive(true);
// _buttonPool[i] = new UIButtonCache
// {
// Root = o,
// Label = o.transform.Find("Image/Text").GetComponent(),
// Background = o.transform.Find("Background").GetComponent()
// };
// }
// _poolCreated = true;
// }
}