Skip to content

Instantly share code, notes, and snippets.

@braindroplabs
Created December 7, 2016 01:09
Show Gist options
  • Save braindroplabs/f21f7ba7d4cab67808e9ae92e916a5f6 to your computer and use it in GitHub Desktop.
Save braindroplabs/f21f7ba7d4cab67808e9ae92e916a5f6 to your computer and use it in GitHub Desktop.
using System;
using UnityEngine;
public class Signals : MonoBehaviour
{
/***********************************************************************************************
PRELOAD
***********************************************************************************************/
//preload game scene
public static event Action OnPreloadGameSceneComplete;
public static void PreloadGameSceneComplete(){ if(OnPreloadGameSceneComplete != null) OnPreloadGameSceneComplete(); }
//preload world data
public static event Action OnPreloadWorldDataComplete;
public static void PreloadWorldDataComplete(){ if(OnPreloadWorldDataComplete != null) OnPreloadWorldDataComplete(); }//preload world data
//preload worlds pack
public static event Action OnUpdateCurrentWorldPack;
public static void UpdateCurrentWorldPack(){ if(OnUpdateCurrentWorldPack != null) OnUpdateCurrentWorldPack(); }//preload worlds pack
//preload worlds pack complete
public static event Action OnUpdateCurrentWorldPackComplete;
public static void UpdateCurrentWorldPackComplete(){ if(OnUpdateCurrentWorldPackComplete != null) OnUpdateCurrentWorldPackComplete(); }
/***********************************************************************************************
ASYNC LOADING
***********************************************************************************************/
public static event Action<string> OnRequestWorldPack;
public static void RequestWorldPack(string packName){ if(OnRequestWorldPack != null) OnRequestWorldPack(packName); }
public static event Action<string> OnRequestWorldPackComplete;
public static void RequestWorldPackComplete(string packName){ if(OnRequestWorldPackComplete != null) OnRequestWorldPackComplete(packName); }
/***********************************************************************************************
GAME STATE
***********************************************************************************************/
//game state
public static event Action<States.GameState, float> OnGameStateChanged;
public static void GameStateChanged(States.GameState newState, float transitionTime){ if(OnGameStateChanged != null) OnGameStateChanged(newState, transitionTime); }
//unpause
public static event Action OnUnpause;
public static void Unpause(){ if(OnUnpause != null) OnUnpause(); }
/***********************************************************************************************
GAME
***********************************************************************************************/
//gameboard touch
public static event Action<TKAnyTouchRecognizer> OnGameBoardTouchDownChanged;
public static void GameBoardTouchDownChanged(TKAnyTouchRecognizer anyTouch){ if(OnGameBoardTouchDownChanged != null) OnGameBoardTouchDownChanged(anyTouch); }
public static event Action<TKAnyTouchRecognizer> OnGameBoardTouchUpChanged;
public static void GameBoardTouchUpChanged(TKAnyTouchRecognizer anyTouch){ if(OnGameBoardTouchUpChanged != null) OnGameBoardTouchUpChanged(anyTouch); }
public static event Action<TKPanRecognizer> OnGameBoardTouchPanMoveChanged;
public static void GameBoardTouchPanMoveChanged(TKPanRecognizer panTouch){ if(OnGameBoardTouchPanMoveChanged != null) OnGameBoardTouchPanMoveChanged(panTouch); }
public static event Action<TKPanRecognizer> OnGameBoardTouchPanEndChanged;
public static void GameBoardTouchPanEndChanged(TKPanRecognizer panTouch){ if(OnGameBoardTouchPanEndChanged != null) OnGameBoardTouchPanEndChanged(panTouch); }
//gameboard tile piece actions
public static event Action OnTilePieceRaised;
public static void TilePieceRaised(){ if(OnTilePieceRaised != null) OnTilePieceRaised(); }
public static event Action OnTilePieceLowered;
public static void TilePieceLowered(){ if(OnTilePieceLowered != null) OnTilePieceLowered(); }
public static event Action OnTilePieceInterlocked;
public static void TilePieceInterlocked(){ if(OnTilePieceInterlocked != null) OnTilePieceInterlocked(); }
public static event Action OnTilePieceLocked;
public static void TilePieceLocked(){ if(OnTilePieceLocked != null) OnTilePieceLocked(); }
//gameboard actions
public static event Action OnTileLocked;
public static void TileLocked(){ if(OnTileLocked != null) OnTileLocked(); }
public static event Action OnTilesTransitionIn;
public static void TilesTransitionIn(){ if(OnTilesTransitionIn != null) OnTilesTransitionIn(); }
public static event Action OnTilesTransitionOut;
public static void TilesTransitionOut(){ if(OnTilesTransitionOut != null) OnTilesTransitionOut(); }
public static event Action<int> OnTilePieceLockedParticleEmission;
public static void TilePieceLockedParticleEmission(int emitCount){ if(OnTilePieceLockedParticleEmission != null) OnTilePieceLockedParticleEmission(emitCount); }
public static event Action OnLevelComplete;
public static void LevelComplete(){ if(OnLevelComplete != null) OnLevelComplete(); }
public static event Action OnWorldComplete;
public static void WorldComplete(){ if(OnWorldComplete != null) OnWorldComplete(); }
/***********************************************************************************************
UI
***********************************************************************************************/
public static event Action OnSelectLevel;
public static void SelectLevel(){ if(OnSelectLevel != null) OnSelectLevel(); }
public static event Action OnSelectWorld;
public static void SelectWorld(){ if(OnSelectWorld != null) OnSelectWorld(); }
public static event Action OnShowMessage;
public static void ShowMessage(){ if(OnShowMessage != null) OnShowMessage(); }
public static event Action OnHideMessage;
public static void HideMessage(){ if(OnHideMessage != null) OnHideMessage(); }
public static event Action OnShowUnlockMenu;
public static void ShowUnlockMenu(){ if(OnShowUnlockMenu != null) OnShowUnlockMenu(); }
public static event Action OnHideUnlockMenu;
public static void HideUnlockMenu(){ if(OnHideUnlockMenu != null) OnHideUnlockMenu(); }
public static event Action OnToggleAudio;
public static void ToggleAudio(){ if(OnToggleAudio != null) OnToggleAudio(); }
/***********************************************************************************************
IAP
***********************************************************************************************/
public static event Action<string> OnRequestPurchase;
public static void RequestPurchase(string optionName){ if(OnRequestPurchase != null) OnRequestPurchase(optionName); }
public static event Action<bool, string> OnRequestPurchaseComplete;
public static void RequestPurchaseComplete(bool isSuccess, string optionName){ if(OnRequestPurchaseComplete != null) OnRequestPurchaseComplete(isSuccess, optionName); }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment