310 lines
10 KiB
C#
310 lines
10 KiB
C#
using System;
|
|
using BlueWater.Items;
|
|
using BlueWater.Npcs.Crews.Bartender;
|
|
using BlueWater.Npcs.Crews.Cleaner;
|
|
using BlueWater.Npcs.Crews.Server;
|
|
using BlueWater.Npcs.Customers;
|
|
using UnityEngine;
|
|
|
|
namespace BlueWater
|
|
{
|
|
public static class EventManager
|
|
{
|
|
// Global events
|
|
#region Global events
|
|
|
|
public static Action OnInitializedPlayerInput;
|
|
public static void InvokeInitializedPlayerInput()
|
|
{
|
|
OnInitializedPlayerInput?.Invoke();
|
|
}
|
|
|
|
public static Action<float> OnCameraZoomOut;
|
|
public static void InvokeCameraZoomOut(float value)
|
|
{
|
|
OnCameraZoomOut?.Invoke(value);
|
|
}
|
|
|
|
public static Action<float> OnCameraZoomIn;
|
|
public static void InvokeCameraZoomIn(float value)
|
|
{
|
|
OnCameraZoomIn?.Invoke(value);
|
|
}
|
|
|
|
// Ui
|
|
public static Action<float, float, Color?, float> OnFadeInOut;
|
|
public static void InvokeFadeInOut(float fadeInTime, float fadeOutTime, Color? fadeColor = null, float delayAfterFadeIn = 0f)
|
|
{
|
|
OnFadeInOut?.Invoke(fadeInTime, fadeOutTime, fadeColor, delayAfterFadeIn);
|
|
}
|
|
|
|
// Player
|
|
// 플레이어 최대체력 변경 이벤트
|
|
public static Action<int, int> OnMaxHealthChanged;
|
|
public static void InvokeMaxHealthChanged(int previousMaxHealthPoint, int changedMaxHealthPoint)
|
|
{
|
|
OnMaxHealthChanged?.Invoke(previousMaxHealthPoint, changedMaxHealthPoint);
|
|
}
|
|
|
|
// 플레이어 현재체력 변경 이벤트
|
|
public static Action<int> OnHealthChanged;
|
|
public static void InvokeHealthChanged(int changedHealthPoint)
|
|
{
|
|
OnHealthChanged?.Invoke(changedHealthPoint);
|
|
}
|
|
|
|
// 플레이어 죽을 때 이벤트
|
|
public static Action OnDead;
|
|
public static void InvokeDead()
|
|
{
|
|
OnDead?.Invoke();
|
|
}
|
|
|
|
// 상호작용
|
|
// 상호작용 Ui 활성화
|
|
public static Action<string> OnShowInteractionUi;
|
|
public static void InvokeShowInteractionUi(string interactionMessage)
|
|
{
|
|
OnShowInteractionUi?.Invoke(interactionMessage);
|
|
}
|
|
|
|
// 상호작용 Ui 비활성화
|
|
public static Action OnHideInteractionUi;
|
|
public static void InvokeHideInteractionUi()
|
|
{
|
|
OnHideInteractionUi?.Invoke();
|
|
}
|
|
|
|
// 플레이어 홀딩 상호작용중 이벤트
|
|
public static Action<float> OnHoldInteracting;
|
|
public static void InvokeHoldInteracting(float value)
|
|
{
|
|
OnHoldInteracting?.Invoke(value);
|
|
}
|
|
|
|
#endregion
|
|
|
|
// Tycoon events
|
|
#region Tycoon events
|
|
|
|
// 타이쿤 시작 이벤트
|
|
public static Action OnTycoonGameStarted;
|
|
public static void InvokeTycoonGameStarted()
|
|
{
|
|
OnTycoonGameStarted?.Invoke();
|
|
}
|
|
|
|
// 타이쿤 종료 이벤트 (OnDead 이벤트로 대체중)
|
|
public static Action OnTycoonGameOvered;
|
|
public static void InvokeTycoonGameOvered()
|
|
{
|
|
OnTycoonGameOvered?.Invoke();
|
|
}
|
|
|
|
// 플레이어
|
|
// 레벨업 이벤트
|
|
public static Action<LevelData> OnLevelUp;
|
|
public static void InvokeLevelUp(LevelData levelData)
|
|
{
|
|
OnLevelUp?.Invoke(levelData);
|
|
}
|
|
|
|
// 경험치 변경 이벤트
|
|
public static Action<int> OnChangeExp;
|
|
public static void InvokeChangeExp(int addedExp)
|
|
{
|
|
OnChangeExp?.Invoke(addedExp);
|
|
}
|
|
|
|
// 골드 변경 이벤트
|
|
public static Action<int> OnChangeGold;
|
|
public static void InvokeChangeGold(int newGold)
|
|
{
|
|
OnChangeGold?.Invoke(newGold);
|
|
}
|
|
|
|
// 플레이어 칵테일 제조 시작 이벤트
|
|
public static Action OnMakeCocktailStarted;
|
|
public static void InvokeCocktailStarted()
|
|
{
|
|
OnMakeCocktailStarted?.Invoke();
|
|
}
|
|
|
|
// 칵테일 제조 완성 이벤트 (bool값은 player가 만들었으면 true, crew가 만들었으면 false)
|
|
public static Action<CocktailData, bool> OnMakeCocktailCompleted;
|
|
public static void InvokeCocktailCompleted(CocktailData completedCocktail, bool isMadePlayer)
|
|
{
|
|
OnMakeCocktailCompleted?.Invoke(completedCocktail, isMadePlayer);
|
|
}
|
|
|
|
// 플레이어가 들고있는 칵테일 버리기 이벤트
|
|
public static Action<CocktailData, bool> OnCocktailDiscarded;
|
|
public static void InvokeCocktailDiscarded(CocktailData cocktailData, bool isDiscardedPlayer)
|
|
{
|
|
OnCocktailDiscarded?.Invoke(cocktailData, isDiscardedPlayer);
|
|
}
|
|
|
|
// 플레이어가 들고있는 칵테일을 서빙테이블에 올려두는 이벤트
|
|
public static Action OnPlaceOnServingTable;
|
|
public static void InvokePlaceOnServingTable()
|
|
{
|
|
OnPlaceOnServingTable?.Invoke();
|
|
}
|
|
|
|
// Npc
|
|
// 손님 생성 이벤트
|
|
public static Action OnCreateCustomer;
|
|
public static void InvokeCreateCustomer()
|
|
{
|
|
OnCreateCustomer?.Invoke();
|
|
}
|
|
|
|
// 손님 파괴 이벤트
|
|
public static Action<Customer> OnDestroyCustomer;
|
|
public static void InvokeDestroyCustomer(Customer customer)
|
|
{
|
|
OnDestroyCustomer?.Invoke(customer);
|
|
}
|
|
|
|
// 손님 전체 정화 이벤트
|
|
public static Action OnPurifiedCustomerAll;
|
|
public static void InvokePurifiedCustomerAll()
|
|
{
|
|
OnPurifiedCustomerAll?.Invoke();
|
|
}
|
|
|
|
// 손님이 칵테일 주문 이벤트
|
|
public static Action<Customer> OnOrderedCocktail;
|
|
public static void InvokeOrderedCocktail(Customer orderedCustomer)
|
|
{
|
|
OnOrderedCocktail?.Invoke(orderedCustomer);
|
|
}
|
|
|
|
// 손님이 칵테일을 받을때 이벤트
|
|
public static Action<CocktailData, bool> OnCocktailServedToCustomer;
|
|
public static void InvokeCocktailServedToCustomer(CocktailData servedCocktailData, bool isServedPlayer)
|
|
{
|
|
OnCocktailServedToCustomer?.Invoke(servedCocktailData, isServedPlayer);
|
|
}
|
|
|
|
// 손님이 칵테일을 받을때 결과 이벤트
|
|
public static Action<Customer, bool> OnOrderResult;
|
|
public static void InvokeOrderResult(Customer orderedCustomer, bool orderedSucceed)
|
|
{
|
|
OnOrderResult?.Invoke(orderedCustomer, orderedSucceed);
|
|
}
|
|
|
|
// 손님이 나갈 때, 계산대에 돈을 두고 가는 이벤트
|
|
public static Action<int> OnAddedMoneyCounter;
|
|
public static void InvokeAddedMoneyCounter(int money)
|
|
{
|
|
OnAddedMoneyCounter?.Invoke(money);
|
|
}
|
|
|
|
// 손님의 기다림 게이지를 초기화 시키는 이벤트
|
|
public static Action OnGaugeResetCustomers;
|
|
public static void InvokeGaugeResetCustomers()
|
|
{
|
|
OnGaugeResetCustomers?.Invoke();
|
|
}
|
|
|
|
// Crews
|
|
public static Func<CleanerCrew> OnCreateCleanerCrew;
|
|
public static void InvokeCreateCleanerCrew()
|
|
{
|
|
OnCreateCleanerCrew?.Invoke();
|
|
}
|
|
|
|
public static Func<ServerCrew> OnCreateServerCrew;
|
|
public static void InvokeCreateServerCrew()
|
|
{
|
|
OnCreateServerCrew?.Invoke();
|
|
}
|
|
|
|
public static Func<BartenderCrew> OnCreateBartenderCrew;
|
|
public static void InvokeCreateBartenderCrew()
|
|
{
|
|
OnCreateBartenderCrew?.Invoke();
|
|
}
|
|
|
|
// 인게임 UI 최신화 이벤트
|
|
public static Action<int, int, int> OnUpdateCrewUi;
|
|
public static void InvokeUpdateCrewUi(int bartenderCount, int serverCount, int cleanerCount)
|
|
{
|
|
OnUpdateCrewUi?.Invoke(bartenderCount, serverCount, cleanerCount);
|
|
}
|
|
|
|
// 패시브 카드 (청소 보너스)로 바텐더 제작 속도 증가 이벤트
|
|
public static Action<int, float> OnCleaningBonus;
|
|
public static void InvokeCleaningBonus(int feverTime, float multiply)
|
|
{
|
|
OnCleaningBonus?.Invoke(feverTime, multiply);
|
|
}
|
|
|
|
// Props
|
|
// 레스토랑을 전부 청소 이벤트
|
|
public static Action OnCleaningAll;
|
|
public static void InvokeCleaningAll()
|
|
{
|
|
OnCleaningAll?.Invoke();
|
|
}
|
|
|
|
// 모든 배럴의 게이지 추가
|
|
public static Action<int> OnAddBarrels;
|
|
public static void InvokeAddBarrels(int addedValue)
|
|
{
|
|
OnAddBarrels?.Invoke(addedValue);
|
|
}
|
|
|
|
// 배럴의 자동화
|
|
public static Action OnAutoSupplyBarrels;
|
|
public static void InvokeAutoSupplyBarrels()
|
|
{
|
|
OnAutoSupplyBarrels?.Invoke();
|
|
}
|
|
|
|
// 버섯 생성 이벤트
|
|
public static Action OnCreateMushroom;
|
|
public static void InvokeCreateMushroom()
|
|
{
|
|
OnCreateMushroom?.Invoke();
|
|
}
|
|
|
|
// 곰팡이 생성 이벤트
|
|
public static Action OnCreateMold;
|
|
public static void InvokeCreateMold()
|
|
{
|
|
OnCreateMold?.Invoke();
|
|
}
|
|
|
|
// 계산대 골드 자동 회수 이벤트
|
|
public static Action<int> OnGainAutoMoneyCounter;
|
|
public static void InvokeGainAutoMoneyCounter(int gainWaitTime)
|
|
{
|
|
OnGainAutoMoneyCounter?.Invoke(gainWaitTime);
|
|
}
|
|
|
|
// 휴지통이 랜덤한 칵테일로 변하는 패시브 카드 이벤트
|
|
public static Action<CocktailData> OnChangedRandomCocktail;
|
|
public static void InvokeChangedRandomCocktail(CocktailData changedCocktailData)
|
|
{
|
|
OnChangedRandomCocktail?.Invoke(changedCocktailData);
|
|
}
|
|
|
|
// 일반 보물상자 오픈 이벤트
|
|
public static Action OnOpenedNormalRewardBox;
|
|
public static void InvokeOpenedNormalRewardBox()
|
|
{
|
|
OnOpenedNormalRewardBox?.Invoke();
|
|
}
|
|
|
|
// 레어 보물상자 오픈 이벤트
|
|
public static Action OnOpenedRareRewardBox;
|
|
public static void InvokeOpenedRareRewardBox()
|
|
{
|
|
OnOpenedRareRewardBox?.Invoke();
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
} |