Esempio n. 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()
    {
        transform.Find("Prefabs").gameObject.SetActive(false);
        bombMessageResponder          = GetComponentInChildren <BombMessageResponder>(true);
        postGameMessageResponder      = GetComponentInChildren <PostGameMessageResponder>(true);
        missionMessageResponder       = GetComponentInChildren <MissionMessageResponder>(true);
        miscellaneousMessageResponder = GetComponentInChildren <MiscellaneousMessageResponder>(true);

        bombMessageResponder.twitchBombHandlePrefab      = GetComponentInChildren <TwitchBombHandle>(true);
        bombMessageResponder.twitchComponentHandlePrefab = GetComponentInChildren <TwitchComponentHandle>(true);
        bombMessageResponder.moduleCamerasPrefab         = GetComponentInChildren <ModuleCameras>(true);

        BombMessageResponder.Instance = bombMessageResponder;

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

        _coroutineQueue = GetComponent <CoroutineQueue>();

        Leaderboard.Instance.LoadDataFromFile();

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

        TwitchPlaySettings.LoadDataFromFile();

        SetupResponder(bombMessageResponder);
        SetupResponder(postGameMessageResponder);
        SetupResponder(missionMessageResponder);
        SetupResponder(miscellaneousMessageResponder);

        bombMessageResponder.parentService = this;

        GameObject infoObject = new GameObject("TwitchPlays_Info");

        infoObject.transform.parent          = gameObject.transform;
        _publicProperties                    = infoObject.AddComponent <TwitchPlaysProperties>();
        _publicProperties.TwitchPlaysService = this;
        if (TwitchPlaySettings.data.SkipModManagerInstructionScreen || IRCConnection.Instance.State == IRCConnectionState.Connected)
        {
            ModManagerManualInstructionScreen.HasShownOnce = true;
        }
    }
    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");
        }
    }