Files
back_cantanBuilding/Assets/Scripts/SupplyDrop/SupplyDropGameplayCtrl.cs
2026-05-26 16:15:54 +08:00

52 lines
1.6 KiB
C#

using asap.core;
using cfg;
using game;
using GameCore;
using UnityEngine;
using UnityEngine.AddressableAssets;
public class SupplyDropGameplayCtrl : ISupplyDropGameCtrl
{
protected ResetFishingStatusEvent resetFishing;
protected Tables tables;
public SupplyDropCtrl supplyDropCtrl { get; set; }
public GameObject containerModel { get; set; }
public GameObject gameModel { get; set; }
public void AddPlayerItem(ItemData selectData)
{
GContext.container.Resolve<PlayerItemData>().AddItem(selectData);
Debug.Log($"SupplyDropGameplayCtrl AddPlayerItem: {selectData.id}, count: {selectData.count}, curCount: {selectData.curCount}");
supplyDropCtrl.targetAddData = new TargetAddData(selectData.id, (int)selectData.curCount, (int)selectData.count);
}
public void Dispose()
{
UIManager.Instance.UI3DCamera.gameObject.SetActive(false);
GContext.Publish(resetFishing);
Debug.Log("SupplyDropGameplayCtrl disposed.");
if (gameModel != null)
{
Addressables.ReleaseInstance(gameModel);
}
if (containerModel != null)
{
Addressables.ReleaseInstance(containerModel);
}
}
public void InitData(SupplyDropCtrl supplyDropCtrl, int supplyDropId, ResetFishingStatusEvent resetFishing)
{
this.supplyDropCtrl = supplyDropCtrl;
tables = GContext.container.Resolve<Tables>();
this.resetFishing = resetFishing;
UIManager.Instance.UI3DCamera.gameObject.SetActive(true);
Init(supplyDropId);
}
protected virtual void Init(int id)
{
}
}