コード例 #1
0
ファイル: Controller.cs プロジェクト: xAdamQ/Basra
    private void OnConnected(HubConnection obj)
    {
        Debug.Log("connected to server");


        SignInPanel.DestroyModule();

        LangSelector.DestroyModule();

        Destroy(FindObjectOfType <TestClientStart>()?.gameObject);
    }
コード例 #2
0
ファイル: Controller.cs プロジェクト: xAdamQ/Basra
    public async UniTaskVoid Start()
    {
        await InitModules();

        SignInPanel.Create().Forget();
        LangSelector.Create();

#if GMS
        FB.Init(OnInitComplete);
#endif

#if HMS
        AdPlaceholder.SetActive(!HMSAdsKitManager.Instance.IsBannerAdLoaded);
        HMSAdsKitManager.Instance.OnBannerLoadEvent += () => AdPlaceholder.SetActive(false);
#endif

#if UNITY_WEBGL
        if (JsManager.IsFigSdkInit() == 0)
        {
            Debug.Log("seems like you're in the demo not fig");
            //TestClientStart.Create();
            return;
        }

        Debug.Log("user data: " + JsManager.GetUserData());
        var fbigUserData = JsonUtility.FromJson <FbigUserData>(JsManager.GetUserData());
        Debug.Log("user data loaeds: " + JsonUtility.ToJson(fbigUserData));

        if (fbigUserData.EnteredBefore == 0)
        {
            ConnectToServer(fbigToken: fbigUserData.Token, fbigUserData.Name, fbigUserData.PictureUrl);
        }
        else
        {
            ConnectToServer(fbigToken: fbigUserData.Token);
        }

        Repository.I.TopFriends = JsonUtility.FromJson <List <FbigFriend> >(JsManager.GetFriends())
                                  .Select(f => new MinUserInfo {
            Id = f.Id, Name = f.Name, PictureUrl = f.PictureUrl
        })
                                  .ToArray();

        Debug.Log("friends are: " + JsManager.GetFriends());
        Debug.Log("friends loaded: " + JsonUtility.ToJson(Repository.I.TopFriends));

        JsManager.StartFbigGame();
        //you can think it would make more sence to start when conntected, but there could be network issue and require reconnect for example
        //the decision is not final anyway
#endif
    }