GameScript.AttachListeners C# (CSharp) Method

AttachListeners() public method

public AttachListeners ( ) : void
return void
    void AttachListeners()
    {
        // Make sure that any existing handlers are removed and add new ones

        // When we've requested an ad, if it is available it will call OnAdAvailable
        Spil.Instance.OnAdAvailable -= AdAvailableHandler;
        Spil.Instance.OnAdAvailable += AdAvailableHandler;

        // When we've requested an ad, if it is not available it will call OnAdNotAvailable
        Spil.Instance.OnAdNotAvailable -= AdNotAvailableHandler;
        Spil.Instance.OnAdNotAvailable += AdNotAvailableHandler;

        // When an ad starts it will first call OnAdStarted so music can be muted etc
        Spil.Instance.OnAdStarted -= AdStartedHandler;
        Spil.Instance.OnAdStarted += AdStartedHandler;

        // When an ad finishes or is dismissed it will call OnAdFinished so music can be re-enabled etc
        Spil.Instance.OnAdFinished -= AdFinishedHandler;
        Spil.Instance.OnAdFinished += AdFinishedHandler;

        // When the SpilSDK has retrieved playerdata from the back-end PlayerDataAvailable is called
        Spil.Instance.OnPlayerDataAvailable -= PlayerDataAvailableHandler;
        Spil.Instance.OnPlayerDataAvailable += PlayerDataAvailableHandler;

        // When the player data (inventory or wallet) has been updated PlayerDataUpdated is called
        Spil.Instance.OnPlayerDataUpdated -= PlayerDataUpdatedHandler;
        Spil.Instance.OnPlayerDataUpdated += PlayerDataUpdatedHandler;

        // When something has gone wrong while retrieving or updating the player data OnPlayerDataError is called and contains information about the error
        Spil.Instance.OnPlayerDataError -= PlayerDataErrorHandler;
        Spil.Instance.OnPlayerDataError += PlayerDataErrorHandler;

        // When tbe SpilSDK has retrieved game data (currencies, promotions, shop data) from the back-end SpilGameDataAvailable is called
        Spil.Instance.OnSpilGameDataAvailable -= SpilGameDataAvailableHandler;
        Spil.Instance.OnSpilGameDataAvailable += SpilGameDataAvailableHandler;

        // When something has gone wrong while retrieving or updating the game data SpilGameDataErrorHandler is called and contains information about the error
        Spil.Instance.OnSpilGameDataError -= SpilGameDataErrorHandler;
        Spil.Instance.OnSpilGameDataError += SpilGameDataErrorHandler;

        // When a splash screen is opened it will first call OnSplashScreenOpen so music can be muted etc
        Spil.Instance.OnSplashScreenOpen -= SplashScreenOpenHandler;
        Spil.Instance.OnSplashScreenOpen += SplashScreenOpenHandler;

        // When a splash screen closes it will call OnSplashScreenClosed so music can be re-enabled etc
        Spil.Instance.OnSplashScreenClosed -= SplashScreenClosedHandler;
        Spil.Instance.OnSplashScreenClosed += SplashScreenClosedHandler;

        // When a splash screen encountered an error while trying to open OnSplashScreenError is called and contains information about the error
        Spil.Instance.OnSplashScreenError -= SplashScreenErrorHandler;
        Spil.Instance.OnSplashScreenError += SplashScreenErrorHandler;

        // When no Splash screen has been configured in the back-end or no internet connection is available OnSplashScreenNotAvailable is called
        Spil.Instance.OnSplashScreenNotAvailable -= SplashScreenNotAvailabelHandler;
        Spil.Instance.OnSplashScreenNotAvailable += SplashScreenNotAvailabelHandler;

        // When a player taps on a button on the splash screen that should open the shop (for instance for a special promotion) OnSplashScreenOpenShop is called
        Spil.Instance.OnSplashScreenOpenShop -= SplashScreenOpenShopHandler;
        Spil.Instance.OnSplashScreenOpenShop += SplashScreenOpenShopHandler;

        // When a daily bonus screen is opened it will first call OnDailyBonusOpen so music can be muted etc
        Spil.Instance.OnDailyBonusOpen -= DailyBonusOpenHandler;
        Spil.Instance.OnDailyBonusOpen += DailyBonusOpenHandler;

        // When a daily bonus screen closes it will call OnDailyBonusClosed so music can be re-enabled etc
        Spil.Instance.OnDailyBonusClosed -= DailyBonusClosedHandler;
        Spil.Instance.OnDailyBonusClosed += DailyBonusClosedHandler;

        // When a daily bonus screen encountered an error while trying to open OnDailyBonusError is called and contains information about the error
        Spil.Instance.OnDailyBonusError -= DailyBonusErrorHandler;
        Spil.Instance.OnDailyBonusError += DailyBonusErrorHandler;

        // When no daily bonus screen has been configured in the back-end or no internet connection is available OnDailyBonusNotAvailable is called
        Spil.Instance.OnDailyBonusNotAvailable -= DailyBonusNotAvailabelHandler;
        Spil.Instance.OnDailyBonusNotAvailable += DailyBonusNotAvailabelHandler;

        // When the user has earned a daily bonus reward OnDailyBonusReward is called and contains information about the reward
        Spil.Instance.OnDailyBonusReward -= DailyBonusRewardHandler;
        Spil.Instance.OnDailyBonusReward += DailyBonusRewardHandler;
    }