Exemple #1
0
    public void Init(SRSSamConfig config, AssetBundleSettingItem assetBundleConfig, SamSignalRServer server, SRSSamGameSession session, int moneyType, bool isSolo)
    {
        _sam           = new SRSSam();
        _sam.session   = session;
        _sam.moneyType = moneyType;

        ClearUI();

        _config            = config;
        _assetBundleConfig = assetBundleConfig;
        _settingSound      = AudioAssistant.Instance.GetSettingSound(_config.gameId);
        _account           = Database.Instance.Account();

        _server                   = server;
        _server.OnSRSEvent        = OnSRSEvent;
        _server.OnSRSHubEvent     = OnSRSHubEvent;
        _server.OnSRSHubCallEvent = OnSRSHubCallEvent;

        gUiCoints.ForEach(a => a.SetActive(_sam.moneyType == MoneyType.COIN));
        gUiGolds.ForEach(a => a.SetActive(_sam.moneyType == MoneyType.GOLD));

        gUiSamNormals.ForEach(a => a.SetActive(!isSolo));
        gUiSamSolos.ForEach(a => a.SetActive(isSolo));

        LoadRoomInfo();
        LoadUserFirst(isSolo);
    }
    public void Init(bool isSolo)
    {
        isClickChoiNhanh = false;
        isRoomSolo       = isSolo;
        UILayerController.Instance.ShowLoading();

        // Music
        AudioAssistant.Instance.PlayMusicGame(_config.gameId, _config.audioBackground);

        _assetBundleConfig = AssetbundlesManager.Instance.assetSetting.GetItemByGameId(_config.gameId);
        _settingSound      = AudioAssistant.Instance.GetSettingSound(_config.gameId);

        _server                   = SignalRController.Instance.CreateServer <SamSignalRServer>(_config.gameId);
        _server.OnSRSEvent        = OnSRSEvent;
        _server.OnSRSHubEvent     = OnSRSHubEvent;
        _server.OnSRSHubCallEvent = OnSRSHubCallEvent;

        moneyType = MoneyType.GOLD;

        _server.SRSInit(isSolo ? _config.urlServerSolo : _config.urlServerMulti, _config.hubName);

        LoadMoney();
        ChangeTypeMoney();
    }