Example #1
0
    private void Start()
    {
        Instance = this;

        transform.Find("Prefabs").gameObject.SetActive(false);
        twitchGame = GetComponentInChildren <TwitchGame>(true);

        twitchGame.twitchBombPrefab    = GetComponentInChildren <TwitchBomb>(true);
        twitchGame.twitchModulePrefab  = GetComponentInChildren <TwitchModule>(true);
        twitchGame.moduleCamerasPrefab = GetComponentInChildren <ModuleCameras>(true);

        TwitchGame.Instance = twitchGame;

        GameRoom.InitializeSecondaryCamera();
        _gameInfo = GetComponent <KMGameInfo>();
        _gameInfo.OnStateChange += OnStateChange;

        CoroutineQueue = GetComponent <CoroutineQueue>();

        Leaderboard.Instance.LoadDataFromFile();
        LeaderboardController.Install();

        ModuleData.LoadDataFromFile();
        ModuleData.WriteDataToFile();

        AuditLog.SetupLog();
        MainThreadQueue.Initialize();

        TwitchPlaySettings.LoadDataFromFile();

        MusicPlayer.LoadMusic();

        IRCConnection.Instance.OnMessageReceived.AddListener(OnMessageReceived);

        twitchGame.ParentService = this;

        GameObject infoObject = new GameObject("TwitchPlays_Info");

        infoObject.transform.parent          = gameObject.transform;
        _publicProperties                    = infoObject.AddComponent <TwitchPlaysProperties>();
        _publicProperties.TwitchPlaysService = this;         // TODO: Useless variable?
        if (TwitchPlaySettings.data.SkipModManagerInstructionScreen || IRCConnection.Instance.State == IRCConnectionState.Connected)
        {
            ModManagerManualInstructionScreen.HasShownOnce = true;
        }

        UpdateUiHue();
        SetupChatSimulator();
    }
    private void Start()
    {
        Instance = this;

        transform.Find("Prefabs").gameObject.SetActive(false);
        twitchGame = GetComponentInChildren <TwitchGame>(true);

        twitchGame.twitchBombPrefab    = GetComponentInChildren <TwitchBomb>(true);
        twitchGame.twitchModulePrefab  = GetComponentInChildren <TwitchModule>(true);
        twitchGame.moduleCamerasPrefab = GetComponentInChildren <ModuleCameras>(true);

        TwitchGame.Instance = twitchGame;

        GameRoom.InitializeSecondaryCamera();
        _gameInfo = GetComponent <KMGameInfo>();
        _gameInfo.OnStateChange += OnStateChange;

        CoroutineQueue = GetComponent <CoroutineQueue>();

        Leaderboard.Instance.LoadDataFromFile();
        LeaderboardController.Install();

        ModuleData.LoadDataFromFile();
        ModuleData.WriteDataToFile();

        AuditLog.SetupLog();
        MainThreadQueue.Initialize();

        TwitchPlaySettings.LoadDataFromFile();

        MusicPlayer.LoadMusic();

        IRCConnection.Instance.OnMessageReceived.AddListener(OnMessageReceived);

        twitchGame.ParentService = this;

        TwitchPlaysAPI.Setup();

        GameObject infoObject = new GameObject("TwitchPlays_Info");

        infoObject.transform.parent          = gameObject.transform;
        _publicProperties                    = infoObject.AddComponent <TwitchPlaysProperties>();
        _publicProperties.TwitchPlaysService = this;         // TODO: Useless variable?
        if (TwitchPlaySettings.data.SkipModManagerInstructionScreen || IRCConnection.Instance.State == IRCConnectionState.Connected)
        {
            ModManagerManualInstructionScreen.HasShownOnce = true;
        }

        UpdateUiHue();

        if (TwitchPlaySettings.data.DarkMode)
        {
            HeaderBackground.color   = new Color32(0x0E, 0x0E, 0x10, 0xFF);
            HeaderText.color         = new Color32(0xEF, 0xEF, 0xEC, 0xFF);
            MessagesBackground.color = new Color32(0x3A, 0x3A, 0x3D, 0xFF);
        }
        else
        {
            HeaderBackground.color   = new Color32(0xEE, 0xEE, 0xEE, 0xFF);
            HeaderText.color         = new Color32(0x4F, 0x4F, 0x4F, 0xFF);
            MessagesBackground.color = new Color32(0xD8, 0xD8, 0xD8, 0xFF);
        }

        SetupChatSimulator();

        // Delete the steam_appid.txt since it was created for a one-time steam boot.
        // Steam will have initialized before this.
        if (File.Exists("steam_appid.txt"))
        {
            File.Delete("steam_appid.txt");
        }
    }