521 lines
14 KiB
C#
521 lines
14 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using DDD;
|
|
using DDD.Items;
|
|
using DDD.Npcs.Crews.Bartender;
|
|
using DDD.Npcs.Crews.Cleaner;
|
|
using DDD.Npcs.Crews.Server;
|
|
using DDD.Npcs.Customers;
|
|
using DDD.ScriptableObjects;
|
|
using DDD.Uis.Tycoon;
|
|
using UnityEngine;
|
|
|
|
public static class EventManager
|
|
{
|
|
// Global events
|
|
|
|
#region Global events
|
|
|
|
public static Action OnDevelopKey01;
|
|
public static void InvokeDevelopKey01()
|
|
{
|
|
OnDevelopKey01?.Invoke();
|
|
}
|
|
|
|
public static Action OnMoveRestaurant;
|
|
public static void InvokeMoveRestaurant()
|
|
{
|
|
OnMoveRestaurant?.Invoke();
|
|
}
|
|
|
|
public static Action OnMoveFavorability01;
|
|
public static void InvokeMoveFavorability01()
|
|
{
|
|
OnMoveFavorability01?.Invoke();
|
|
}
|
|
|
|
public static Action OnMoveFavorability02;
|
|
public static void InvokeMoveFavorability02()
|
|
{
|
|
OnMoveFavorability02?.Invoke();
|
|
}
|
|
|
|
public static Action OnChangedDisplay;
|
|
|
|
public static void InvokeChangedDisplay()
|
|
{
|
|
OnChangedDisplay?.Invoke();
|
|
}
|
|
|
|
// 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();
|
|
}
|
|
|
|
// 결과창 출력 이벤트
|
|
public static Action OnShowResult;
|
|
|
|
public static void InvokeShowResult()
|
|
{
|
|
OnShowResult?.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<float> OnDashCooldown;
|
|
|
|
public static void InvokeDashCooldown(float cooldown)
|
|
{
|
|
OnDashCooldown?.Invoke(cooldown);
|
|
}
|
|
|
|
// 레벨업 이벤트
|
|
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, bool> OnAddedGold;
|
|
|
|
public static void InvokeAddedGold(int addedGold, bool isTip)
|
|
{
|
|
OnAddedGold?.Invoke(addedGold, isTip);
|
|
}
|
|
|
|
// 플레이어 칵테일 제조 시작 이벤트
|
|
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<CocktailData> OnPickupCocktail;
|
|
|
|
public static void InvokePickupCocktail(CocktailData cocktailData)
|
|
{
|
|
OnPickupCocktail?.Invoke(cocktailData);
|
|
}
|
|
|
|
// 플레이어가 들고있는 칵테일을 서빙테이블에 올려두는 이벤트
|
|
public static Action OnPlaceOnServingTable;
|
|
|
|
public static void InvokePlaceOnServingTable()
|
|
{
|
|
OnPlaceOnServingTable?.Invoke();
|
|
}
|
|
|
|
// 플레이어가 들고 있는 아이템 정보가 바뀌는 경우
|
|
public static Action<string> OnChangedPickupItem;
|
|
|
|
public static void InvokeChangedPickupItem(string idx)
|
|
{
|
|
OnChangedPickupItem?.Invoke(idx);
|
|
}
|
|
|
|
// 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 orderedCorrected)
|
|
{
|
|
OnOrderResult?.Invoke(orderedCustomer, orderedCorrected);
|
|
}
|
|
|
|
// 손님에게 서빙을 하지 못했을 때 이벤트
|
|
public static Action<bool> OnSucceedServing;
|
|
|
|
public static void InvokeSucceedServing(bool isSucceed)
|
|
{
|
|
OnSucceedServing?.Invoke(isSucceed);
|
|
}
|
|
|
|
// 손님에게 서빙을 하지 못했을 때 이벤트
|
|
public static Action OnMissedServing;
|
|
|
|
public static void InvokeMissedServing()
|
|
{
|
|
OnMissedServing?.Invoke();
|
|
}
|
|
|
|
// 손님의 기다림 게이지를 초기화 시키는 이벤트
|
|
public static Action OnGaugeResetCustomers;
|
|
|
|
public static void InvokeGaugeResetCustomers()
|
|
{
|
|
OnGaugeResetCustomers?.Invoke();
|
|
}
|
|
|
|
// 손님이 퇴장하기 전에 스킨을 확인하는 이벤트
|
|
public static Action<CustomerSkin> OnCheckedSkin;
|
|
|
|
public static void InvokeCheckedSkin(CustomerSkin skinIndex)
|
|
{
|
|
OnCheckedSkin?.Invoke(skinIndex);
|
|
}
|
|
|
|
// 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<bool> OnCleaningResult;
|
|
|
|
public static void InvokeCleaningResult(bool isSucceed)
|
|
{
|
|
OnCleaningResult?.Invoke(isSucceed);
|
|
}
|
|
|
|
// 구토 생성 이벤트
|
|
public static Action<Vector3> OnCreateVomiting;
|
|
|
|
public static void InvokeCreateVomiting(Vector3 spawnPosition)
|
|
{
|
|
OnCreateVomiting?.Invoke(spawnPosition);
|
|
}
|
|
|
|
// 버섯 생성 이벤트
|
|
public static Action OnCreateMushroom;
|
|
|
|
public static void InvokeCreateMushroom()
|
|
{
|
|
OnCreateMushroom?.Invoke();
|
|
}
|
|
|
|
// 곰팡이 생성 이벤트
|
|
public static Action OnCreateMold;
|
|
|
|
public static void InvokeCreateMold()
|
|
{
|
|
OnCreateMold?.Invoke();
|
|
}
|
|
|
|
// 펌프 활성화 이벤트
|
|
public static Action OnActivatePump;
|
|
|
|
public static void InvokeActivatePump()
|
|
{
|
|
OnActivatePump?.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 OnChangedRandomBox;
|
|
|
|
public static void InvokeChangedRandomBox()
|
|
{
|
|
OnChangedRandomBox?.Invoke();
|
|
}
|
|
|
|
// 일반 보물상자 오픈 이벤트
|
|
public static Action OnOpenedNormalRewardBox;
|
|
|
|
public static void InvokeOpenedNormalRewardBox()
|
|
{
|
|
OnOpenedNormalRewardBox?.Invoke();
|
|
}
|
|
|
|
// 레어 보물상자 오픈 이벤트
|
|
public static Action OnOpenedRareRewardBox;
|
|
|
|
public static void InvokeOpenedRareRewardBox()
|
|
{
|
|
OnOpenedRareRewardBox?.Invoke();
|
|
}
|
|
|
|
// 튜토리얼
|
|
public static Action<string> OnTutorial;
|
|
|
|
public static void InvokeTutorial(string tutorialName)
|
|
{
|
|
OnTutorial?.Invoke(tutorialName);
|
|
}
|
|
|
|
#endregion
|
|
|
|
// DDD
|
|
#region DDD
|
|
|
|
// Tycoon
|
|
|
|
// 게임 시작할 때, 밀키트를 추가하는 이벤트
|
|
public static Action<List<TodayMenu>> OnAddedMealKit;
|
|
public static void InvokeAddedMealKit(List<TodayMenu> todayMenus)
|
|
{
|
|
OnAddedMealKit?.Invoke(todayMenus);
|
|
}
|
|
|
|
// 플레이어가 밀키트를 냉장고에서 꺼내는 이벤트
|
|
public static Action<CraftRecipeData> OnPickupMealKit;
|
|
public static void InvokePickupMealKit(CraftRecipeData craftRecipeData)
|
|
{
|
|
OnPickupMealKit?.Invoke(craftRecipeData);
|
|
}
|
|
|
|
// 플레이어가 들고 있는 요리 도구 정보가 바뀌는 경우
|
|
public static Action<CraftingTool?> OnChangedCraftingTool;
|
|
public static void InvokeChangedCraftingTool(CraftingTool? craftingTool)
|
|
{
|
|
OnChangedCraftingTool?.Invoke(craftingTool);
|
|
}
|
|
|
|
// 플레이어가 들고 있는 아이템 정보가 바뀌는 경우
|
|
public static Action<CraftRecipeData> OnChangedPickupCook;
|
|
public static void InvokeChangedPickupCook(CraftRecipeData craftRecipeData)
|
|
{
|
|
OnChangedPickupCook?.Invoke(craftRecipeData);
|
|
}
|
|
|
|
// 손님이 음식을 주문하는 이벤트
|
|
public static Action<Customer> OnOrderedCook;
|
|
public static void InvokeOrderedCook(Customer orderedCustomer)
|
|
{
|
|
OnOrderedCook?.Invoke(orderedCustomer);
|
|
}
|
|
|
|
// 손님이 음식을 받을때 이벤트
|
|
public static Action<bool> OnServedCookToCustomer;
|
|
public static void InvokeServedCookToCustomer(bool isServedPlayer)
|
|
{
|
|
OnServedCookToCustomer?.Invoke(isServedPlayer);
|
|
}
|
|
|
|
// 손님이 음식을 받을때 결과 이벤트
|
|
public static Action<Customer, bool> OnServedResult;
|
|
public static void InvokeServedResult(Customer orderedCustomer, bool orderedCorrected)
|
|
{
|
|
OnServedResult?.Invoke(orderedCustomer, orderedCorrected);
|
|
}
|
|
|
|
// 벨을 상호작용 할 때 이벤트
|
|
public static Action<Vector3> OnRingedBell;
|
|
public static void InvokeRingedBell(Vector3 bellPosition)
|
|
{
|
|
OnRingedBell?.Invoke(bellPosition);
|
|
}
|
|
|
|
// 벨 이벤트가 끝날 때 이벤트
|
|
public static Action OnEndedBell;
|
|
public static void InvokeEndedBell()
|
|
{
|
|
OnEndedBell?.Invoke();
|
|
}
|
|
|
|
#endregion
|
|
} |