Beispiel #1
0
    public void Init()
    {
        UILayerController.Instance.ShowLoading();
        uiSelect.gameObject.SetActive(false);
        _assetBundleConfig = AssetbundlesManager.Instance.assetSetting.GetItemByGameId(_GAMEID);
        _soundSetting      = AudioAssistant.Instance.GetSettingSound(_GAMEID, true);

        moneyType             = (int)MoneyType.GOLD;
        _server               = SignalRController.Instance.CreateServer <VuaBaoSignalRServer>((int)_GAMEID);
        _server.OnSRSEvent    = OnSRSEvent;
        _server.OnSRSHubEvent = OnSRSHubEvent;
        _server.SRSInit(_URL, _HUBNAME);

        this.roomIdSelected = 1;

        lastResult = null;

        this.isAuto = false;
        btAuto.SetupAll(false);
        vkBtBets[roomIdSelected - 1].VKInteractable = false;

        this.accountInfo = Database.Instance.Account();
        ChangeSound();
        ChangeTypeMoney();

        slotMachine.ClearUI();

        List <int> id = new List <int>()
        {
            1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20
        };

        slotMachine.InitLineSelected(id);
    }
Beispiel #2
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);
    }
Beispiel #3
0
    public void Init(SRSXocXocConfig config, AssetBundleSettingItem assetBundleConfig, XocXocSignalRServer server, SRSXocXoc xocXocData)
    {
        ClearUI();

        _config            = config;
        _xocxoc            = xocXocData;
        _assetBundleConfig = assetBundleConfig;
        _settingSound      = AudioAssistant.Instance.GetSettingSound(_config.gameId);

        _account = Database.Instance.Account();

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

        transSystemChip.gameObject.SetActive(_xocxoc.session.RoomType == XocXocRoom.Fifty);
        uiPlayerMaster.gameObject.SetActive(_xocxoc.session.RoomType != XocXocRoom.Fifty);

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

        SetNotify("");
        LoadMoneyType();
        LoadMyData();
        LoadRoomData();
        LoadRoomUser();
        LoadGate();
        FirstLoadPlayer();
        LoadHistory();
        LoadButtonMaster();

        ChangeChip(uiChips[0]);

        UpdateGame();
    }
    public void Init()
    {
        UILayerController.Instance.ShowLoading();

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

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

        _server            = SignalRController.Instance.CreateServer <SignalRServer>(_bacayConfig.gameId);
        _server.OnSRSEvent = OnSRSEvent;
        //_server.OnSRSHubEvent = OnSRSHubEvent;

        _server.SRSInit(_bacayConfig.urlServer, _bacayConfig.hubName);
        _server.Connection.OnConnected += HandleConnected;

        _server.AddListener("lobbyInfo", HandleLobby);
        _server.AddListener("joinGame", HandleJoin);
        _server.AddListener("error", HandleErrorCode);

        moneyType = MoneyType.GOLD;
        LoadMoney();
        ChangeTypeMoney();
    }
    public void DownloadBundle(AssetBundleSettingItem asItemConfig, GameObject gDownload, Text txtProgress, Image imgProgress, Action callback)
    {
        if (asItemConfig == null)
        {
            NotifyController.Instance.Open("Không có dữ liệu", NotifyController.TypeNotify.Error);
            return;
        }

        if (downloading.ContainsKey(asItemConfig.name))
        {
            NotifyController.Instance.Open("Đang tải trò chơi này", NotifyController.TypeNotify.Error);
            return;
        }

        if (gDownload == null)
        {
            gDownload   = gDefaultProgress;
            txtProgress = txtDefaultProgress;
            imgProgress = imgDefaultProgress;
        }

#if UNITY_EDITOR
        if (SimulateAssetBundleInEditor)
        {
            callback.Invoke();
        }
        else
#endif
        {
            //AssetBundleSettingItem asItemLocal = Database.Instance.localData.GetLocalBundle(asItemConfig.gid);
            //if (asItemLocal == null)
            //{
            //    RemoveAssetBundleByKey(asItemConfig.name);

            //    // Download
            //    IEnumerator enumerator = DownloadAsset(asItemConfig, gDownload, txtProgress, imgProgress, true, callback);
            //    downloading.Add(asItemConfig.name, enumerator);
            //    StartCoroutine(enumerator);
            //}
            //else
            {
                if (asset.ContainsKey(asItemConfig.name))
                {
                    callback.Invoke();
                }
                else
                {
                    // Download
                    IEnumerator enumerator = DownloadAsset(asItemConfig, gDownload, txtProgress, imgProgress, true, callback);
                    downloading.Add(asItemConfig.name, enumerator);
                    StartCoroutine(enumerator);
                }
            }
        }
    }
Beispiel #6
0
    public void Init()
    {
        _assetBundleConfig = AssetbundlesManager.Instance.assetSetting.GetItemByGameId(_GAMEID);
        _soundSetting      = AudioAssistant.Instance.GetSettingSound(_GAMEID);

        btSpin.interactable = true;

        gCapcha.SetActive(false);
        UILayerController.Instance.ShowLoading();
        SendRequest.SendGetAvailable(urlApi);

        ChangeSound();
    }
    public void Init(SRSSlot20LineConfig config, Slot20lineSignalRServer server, SRSSlot20LineAccount account, AssetBundleSettingItem assetBundleConfig, int roomId, int mType)
    {
        _config = config;

        ClearUI();

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

        _assetBundleConfig = assetBundleConfig;
        _settingSound      = AudioAssistant.Instance.GetSettingSound(_config.gameId);

        this.accountSpin = account;
        this.accountInfo = Database.Instance.Account();

        this.roomBetId    = roomId;
        this.moneyType    = mType;
        this.roomBetValue = accountSpin.RoomBetValue(roomBetId);

        txtRomBet.SetNumber(roomBetValue);

        SetNotifyFree();
        SetLineSelected(account.GetLineData());

        // event
        OnEventUpdate();

        // update jackpot
        if (_server.jackpots.ContainsKey(roomBetId.ToString()))
        {
            jackpot = _server.jackpots[roomBetId.ToString()];
            UpdateJackpot();
        }

        // Set data
        imgIconMoney.sprite = sprIconMoney[moneyType == MoneyType.GOLD ? 0 : 1];
        vkTxtMyMoney.SetNumber(accountInfo.GetCurrentBalance(moneyType));

        // finish bonus
        if (account.BonusId > 0)
        {
            _server.HubCallFinishBonusGame(moneyType, account.BonusId);
        }
    }
    public void Init()
    {
        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 <Slot20lineSignalRServer>((int)_config.gameId);
        _server.OnSRSEvent    = OnSRSEvent;
        _server.OnSRSHubEvent = OnSRSHubEvent;

        moneyType = MoneyType.GOLD;
        _server.SRSInit(_config.urlServer, _config.hubName);

        LoadMoney();
        StartCoroutine(WaitToLoadEvent());
    }
Beispiel #9
0
    public void Init()
    {
        isClickChoiNhanh = false;
        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 <XocXocSignalRServer>(_config.gameId);
        _server.OnSRSEvent    = OnSRSEvent;
        _server.OnSRSHubEvent = OnSRSHubEvent;

        moneyType = MoneyType.GOLD;
        _server.SRSInit(_config.urlServer, _config.hubName);

        LoadMoney();
        ChangeTypeMoney();
    }
Beispiel #10
0
    public void Init()
    {
        ClearUI();
        UILayerController.Instance.ShowLoading();
        _taixiu            = new SRSTaiXiu();
        _assetBundleConfig = AssetbundlesManager.Instance.assetSetting.GetItemByGameId(_GAMEID);
        _soundSetting      = AudioAssistant.Instance.GetSettingSound(_GAMEID);

        _taixiu.MoneyType     = MoneyType.GOLD;
        _server               = SignalRController.Instance.CreateServer <TaiXiuSignalRServer>((int)_GAMEID);
        _server.OnSRSEvent    = OnSRSEvent;
        _server.OnSRSHubEvent = OnSRSHubEvent;
        _server.SRSInit(_URL, _HUBNAME);

        this._account = Database.Instance.Account();

        ChangeSound();
        ShowMoneyType();
        UpdateMoneyType();
        UpdateGameInfo();
    }
Beispiel #11
0
    public void Init()
    {
        _baucua           = new SRSBauCua();
        _baucua.moneyType = MoneyType.GOLD;

        ClearUI();

        UILayerController.Instance.ShowLoading();

        _account           = Database.Instance.Account();
        _assetBundleConfig = AssetbundlesManager.Instance.assetSetting.GetItemByGameId(_GAMEID);
        _soundSetting      = AudioAssistant.Instance.GetSettingSound(_GAMEID);

        _server               = SignalRController.Instance.CreateServer <BauCuaSignalRServer>((int)_GAMEID);
        _server.OnSRSEvent    = OnSRSEvent;
        _server.OnSRSHubEvent = OnSRSHubEvent;

        _server.SRSInit(_URL, _HUBNAME);

        ChangeSound();
        ChangeTypeMoney();
        ChangeChip(uiChips[0]);
    }
    public void Init()
    {
        this.roomIdSelected = 1;
        this.moneyType      = MoneyType.GOLD;

        ClearUI();

        UILayerController.Instance.ShowLoading();

        _account           = Database.Instance.Account();
        _assetBundleConfig = AssetbundlesManager.Instance.assetSetting.GetItemByGameId(_GAMEID);
        _soundSetting      = AudioAssistant.Instance.GetSettingSound(_GAMEID);

        _server               = SignalRController.Instance.CreateServer <HighLowSignalRServer>((int)_GAMEID);
        _server.OnSRSEvent    = OnSRSEvent;
        _server.OnSRSHubEvent = OnSRSHubEvent;

        _server.SRSInit(_URL, _HUBNAME);

        ChangeSound();
        ChangeTypeMoney();
        vkTxtJackpot.UpdateNumber(0);
    }
Beispiel #13
0
    public void Init()
    {
        UILayerController.Instance.ShowLoading();
        _assetBundleConfig = AssetbundlesManager.Instance.assetSetting.GetItemByGameId(_GAMEID);
        _soundSetting      = AudioAssistant.Instance.GetSettingSound(_GAMEID);

        moneyType             = (int)MoneyType.GOLD;
        _server               = SignalRController.Instance.CreateServer <MiniPokerSignalRServer>((int)_GAMEID);
        _server.OnSRSEvent    = OnSRSEvent;
        _server.OnSRSHubEvent = OnSRSHubEvent;
        _server.SRSInit(_URL, _HUBNAME);

        this.accountInfo    = Database.Instance.Account();
        this.roomIdSelected = 1;
        vkBtBets[roomIdSelected - 1].VKInteractable = false;

        ChangeSound();
        ChangeTypeMoney();
        toggleAuto.isOn = false;
        toggleFast.isOn = false;
        ButtonFastSpinClickListener();

        var rnd           = new System.Random();
        var randomNumbers = Enumerable.Range(1, 49).OrderBy(x => rnd.Next()).Take(5).ToList();

        VKDebug.LogColorRed(randomNumbers.Count);
        for (int i = 0; i < randomNumbers.Count; i++)
        {
            VKDebug.LogColorRed(randomNumbers[i]);
        }

        for (int i = 0; i < lines.Count; i++)
        {
            lines[i].LoadCard(randomNumbers[i]);
        }
    }
    public void DownloadBundle(int gameId, GameObject gDownload, Text txtProgress, Image imgProgress, Action callback)
    {
        AssetBundleSettingItem asItemConfig = assetSetting.GetItemByGameId(gameId);

        DownloadBundle(asItemConfig, gDownload, txtProgress, imgProgress, callback);
    }
    IEnumerator DownloadAsset(AssetBundleSettingItem assetConfig, GameObject gDownload, Text txtProgress, Image imgProgress, bool showDownload, Action callback)
    {
        // Show UI download
        if (showDownload)
        {
            gDownload.SetActive(true);
            if (txtProgress != null)
            {
                txtProgress.text = "0%";
            }

            if (imgProgress != null)
            {
                imgProgress.fillAmount = 0;
            }
        }

        while (!Caching.ready)
        {
            yield return(null);
        }


        string url = assetSetting.GetLink() + assetConfig.name;

        WWW www = WWW.LoadFromCacheOrDownload(url, Hash128.Parse(assetConfig.hash));

        while (!www.isDone)
        {
            if (showDownload)
            {
                if (imgProgress != null)
                {
                    imgProgress.fillAmount = www.progress;
                }
                if (txtProgress != null)
                {
                    txtProgress.text = (www.progress * 100).ToString("F1") + "%";
                }
            }

            yield return(new WaitForEndOfFrame());
        }

        // Show download done
        if (imgProgress)
        {
            if (imgProgress != null)
            {
                imgProgress.fillAmount = 1;
            }
            if (txtProgress != null)
            {
                txtProgress.text = "100%";
            }
        }

        if (!string.IsNullOrEmpty(www.error))
        {
            VKDebug.Log("Error while Downloading Data: " + url + " msg: " + www.error);
            LPopup.OpenPopupTop("Lỗi", "Không tải được game xin vui lòng thử lại!");
            yield return(null);
        }
        else
        {
            VKDebug.Log("Download Asset Success");
            AssetBundle assetBundle = www.assetBundle;

            if (assetBundle == null)
            {
                VKDebug.Log("Game được tải không đúng" + www.error);
                LPopup.OpenPopupTop("Lỗi", "Không tải được game xin vui lòng thử lại!");
            }
            else
            {
                // load game object
                if (asset.ContainsKey(assetConfig.name))
                {
                    asset[assetConfig.name] = assetBundle;
                }
                else
                {
                    asset.Add(assetConfig.name, assetBundle);
                }

                //Database.Instance.localData.UpdateBundle(assetConfig);
                Database.Instance.SaveLocalData();

                callback.Invoke();
            }
        }

        gDownload.SetActive(false);
        downloading.Remove(assetConfig.name);
    }
Beispiel #16
0
    public void DownloadGameDone()
    {
        VKDebug.LogWarning("Download done");
        if (UILayerController.Instance.IsCurrentLayer(UILayerKey.LViewLobby))
        {
            AssetBundleSettingItem assetConfig = AssetbundlesManager.Instance.assetSetting.GetItemByGameId(gameId);
            switch (gameId)
            {
            case GameId.SLOT_NONGTRAI:
            case GameId.SLOT_MAFIA:
                if (Database.Instance.currentGame != GameId.NONE)
                {
                    return;
                }
                else
                {
                    Database.Instance.currentGame = gameId;
                    UILayerController.Instance.ShowLayer(UILayerKey.LGameSlot20LineLobby, assetConfig.name);
                }
                break;

            case GameId.SLOT_HAIVUONG:
                if (Database.Instance.currentGame != GameId.NONE)
                {
                    return;
                }
                else
                {
                    Database.Instance.currentGame = gameId;
                    UILayerController.Instance.ShowLayer(UILayerKey.LGameSlot25LineLobby, assetConfig.name);
                }
                break;

            case GameId.MINIPOKER:
                if (UILayerController.Instance.GetLayer(UILayerKey.LGameMiniPoker) == null)
                {
                    UILayerController.Instance.ShowLayer(UILayerKey.LGameMiniPoker, assetConfig.name);
                }
                else
                {
                    UILayerController.Instance.FocusMiniGame(UILayerKey.LGameMiniPoker);
                }
                break;

            case GameId.HIGHLOW:
                if (UILayerController.Instance.GetLayer(UILayerKey.LGameHighLow) == null)
                {
                    UILayerController.Instance.ShowLayer(UILayerKey.LGameHighLow, assetConfig.name);
                }
                else
                {
                    UILayerController.Instance.FocusMiniGame(UILayerKey.LGameHighLow);
                }
                break;

            case GameId.VUABAO:
                if (UILayerController.Instance.GetLayer(UILayerKey.LGameVuaBao) == null)
                {
                    UILayerController.Instance.ShowLayer(UILayerKey.LGameVuaBao, assetConfig.name);
                }
                else
                {
                    UILayerController.Instance.FocusMiniGame(UILayerKey.LGameVuaBao);
                }
                break;

            case GameId.TAIXIU:
                if (UILayerController.Instance.GetLayer(UILayerKey.LGameTaiXiu) == null)
                {
                    MenuMiniGame.Instance.DisconnectTaiXiu();
                    UILayerController.Instance.ShowLayer(UILayerKey.LGameTaiXiu, assetConfig.name);
                }
                else
                {
                    UILayerController.Instance.FocusMiniGame(UILayerKey.LGameTaiXiu);
                }
                break;

            case GameId.LUCKYSPIN:
                if (UILayerController.Instance.GetLayer(UILayerKey.LGameLuckySpin) == null)
                {
                    UILayerController.Instance.ShowLayer(UILayerKey.LGameLuckySpin, assetConfig.name);
                }
                else
                {
                    UILayerController.Instance.FocusMiniGame(UILayerKey.LGameLuckySpin);
                }
                break;

            case GameId.BAUCUA:
                if (UILayerController.Instance.GetLayer(UILayerKey.LGameBauCua) == null)
                {
                    UILayerController.Instance.ShowLayer(UILayerKey.LGameBauCua, assetConfig.name);
                }
                else
                {
                    UILayerController.Instance.FocusMiniGame(UILayerKey.LGameBauCua);
                }
                break;

            case GameId.XOCXOC:
                if (UILayerController.Instance.GetLayer(UILayerKey.LGameXocXocLobby) == null)
                {
                    UILayerController.Instance.ShowLayer(UILayerKey.LGameXocXocLobby, assetConfig.name);
                    //UILayerController.Instance.ShowLayer(UILayerKey.LGameXocXocLobby);
                }
                else
                {
                    UILayerController.Instance.FocusMiniGame(UILayerKey.LGameXocXocLobby);
                }
                break;

            case GameId.SAM:
                if (UILayerController.Instance.GetLayer(UILayerKey.LGameSamLobby) == null)
                {
                    UILayerController.Instance.ShowLayer(UILayerKey.LGameSamLobby, assetConfig.name, (layer) =>
                    {
                        ((LGameSamLobby)layer).Init(isSoloServer);
                    });
                    //UILayerController.Instance.ShowLayer(UILayerKey.LGameXocXocLobby);
                }
                else
                {
                    UILayerController.Instance.FocusMiniGame(UILayerKey.LGameSamLobby);
                }
                break;

#if USE_XLUA
            default:
                if (UILayerController.Instance.GetLayer(layerName) == null)
                {
                    UILayerController.Instance.ShowLayer(layerName, assetConfig.name);
                }
                else
                {
                    UILayerController.Instance.FocusMiniGame(layerName);
                }
                break;
#endif
            }
        }
    }