using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public partial interface ICommandMessage
{
void OnCmdGamePatchComplete();
}
public partial class CommandMessage : MonoBehaviour, ICommandMessage
{
public virtual void OnCmdGamePatchComplete() { }
}
public class BaseUIPopupModule : CommandMessage
{
private void OnEnable()
{
CommandHelper.OnConnectCommand(this);
}
private void OnDisable()
{
CommandHelper.OnDisconnectCommand(this);
}
}
public class testMono : BaseUIPopupModule
{
public override void OnCmdGamePatchComplete()
{
Debug.Log("testMono::OnCmdGamePatchComplete()");
}
public void OnClick_PatchComplete()
{
CommandHelper.OnCmdGamePatchComplete();
//this.Invoke("OnCmdGamePatchComplete", 0.0f);
}
private void Dispatch(System.Action<ICommandMessage> msg)
{
msg.Invoke(this);
}
}
public partial class CommandHelper
{
protected static List<ICommandMessage> popupMessageCollection = new List<ICommandMessage>();
public static void OnConnectCommand(ICommandMessage message)
{
if (popupMessageCollection.Contains(message) == true)
return;
popupMessageCollection.Add(message);
}
public static void OnDisconnectCommand(ICommandMessage message)
{
if (popupMessageCollection.Contains(message) == true)
{
popupMessageCollection.Remove(message);
}
}
private static void SendMessage(System.Action<ICommandMessage> sendMessage)
{
for (int i = 0; i < popupMessageCollection.Count; i++)
{
//sendMessage.Invoke(popupMessageCollection[i]);
sendMessage(popupMessageCollection[i]);
// <OnCmdGamePatchComplete>(testMono)
// <OnCmdGamePatchComplete>(testMono2)
}
}
public static void OnCmdGamePatchComplete()
{
SendMessage(c => c.OnCmdGamePatchComplete());
}
}
'IT > Unity3D' 카테고리의 다른 글
Ubuntu 18.04-LTS 에 Unity 설치 (0) | 2023.04.18 |
---|---|
Unity Dedicated Server to AKS (0) | 2023.04.17 |
Unity 전처리기 (0) | 2023.04.08 |
모바일 기기 특이 해상도 (0) | 2018.04.16 |
하이시에라 10.13 부터 파일 시스템 포맷 변경이 있었습니다. (0) | 2018.04.16 |