Exemple #1
0
    public void HandleJoin(object[] data)
    {
        UILayerController.Instance.HideLoading();

        SRSXocXoc xocxoc = new SRSXocXoc();

        xocxoc.session    = JsonConvert.DeserializeObject <SRSXocXocSession>(BestHTTP.JSON.Json.Encode(data[0]));
        xocxoc.myData     = JsonConvert.DeserializeObject <SRSXocXocPlayer>(BestHTTP.JSON.Json.Encode(data[1]));
        xocxoc.myPosition = int.Parse(data[2].ToString());
        xocxoc.gateDatas  = JsonConvert.DeserializeObject <Dictionary <int, SRSXocXocGateData> >(BestHTTP.JSON.Json.Encode(data[3]));
        xocxoc.moneyType  = moneyType;

        _server.OnSRSEvent    = null;
        _server.OnSRSHubEvent = null;

        //ClearUI();
        //((LGameXocXoc)UILayerController.Instance.ShowLayer(UILayerKey.LGameXocXoc)).Init(_config, _assetBundleConfig, _server, xocxoc);
        StopAllCoroutines();

        LGameXocXoc layerX = UILayerController.Instance.GetLayer <LGameXocXoc>();

        if (layerX != null)
        {
            layerX.Init(_config, _assetBundleConfig, _server, xocxoc);
        }
        else
        {
            UILayerController.Instance.ShowLayer(UILayerKey.LGameXocXoc, _assetBundleConfig.name, (layer) =>
            {
                ClearUI();
                ((LGameXocXoc)layer).Init(_config, _assetBundleConfig, _server, xocxoc);
            });
        }
    }
Exemple #2
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();
    }