예제 #1
0
    /// <summary>
    /// 로그인후 로비씬 이전에 번틀 버젼채크를 하며, 완료후 로비씬 로딩이 이루어진다.
    /// </summary>
    private void AssetBundleVersionCheck()
    {
        _ProgressBar.gameObject.SetActive(true);
        _ProgressLock = false;
        _BeginTime    = Time.time;

        if ((SCENEIDs)m_args[0] == SCENEIDs.FBSignOut ||
            (SCENEIDs)m_args[0] == SCENEIDs.ReConnectServer)
        {
            NET.I.AddMessage(PKID.LobbyDisconnect);
            NET.I.AddMessage(PKID.LobbyConnect);
            if (USER.I.IsGuestLogin)
            {
                NET.I.AddMessage(PKID.GuestUserJoin);
            }
            CommonLoginNeworkConnect();
        }
        else
        {
            _ProgressBar.SetFillAmount(0.03f);
            _ProgressBar.AutoAddGague(60f, null);

            StartCoroutine(BUNDLE.I.BeginVersionCheck(() => {
                _BeginTime    = Time.time;
                _ProgressLock = false;
                StartCoroutine(BUNDLE.I.DownloadUpdateFromServer(DEF.GetLobbyBundleName(), OnBundleUpdateProgress_Lobby, () => {
                    StartCoroutine(BUNDLE.I.DownloadUpdateFromServer(DEF.GetGameCommonBundleName(), OnBundleUpdateProgress_Game, () => {
                        string prefabGameName = DEF.GetGameBundleName(DEF.FIRST_INSTALL_GAME);
                        StartCoroutine(BUNDLE.I.DownloadUpdateFromServer(prefabGameName, OnBundleUpdateProgress_Game, FirstLoginNetworkConnect));
                    }, OnLoadError));
                }, OnLoadError));
            }, OnLoadError));
        }
    }
예제 #2
0
파일: UI.cs 프로젝트: kimhwi9202/crown_temp
    /// <summary>
    /// 로비에서 게임화면으로 전환
    /// </summary>
    /// <param name="eGameName">Name of the e game.</param>
    public void LobbyToGame(eGameList eGameName)
    {
        SOUND.I.PlayStop(DEF.SND.lobby_bgm);

        loadGame           = eGameName;
        Main.I.CurrentView = eView.Game;

        string     prefabGameName = DEF.GetGamePrefabName(loadGame);
        GameObject obj            = BUNDLE.I.LoadAsset <GameObject>(prefabGameName);

        if (obj)
        {
            GameObject go = GameObject.Instantiate(obj);
            go.name = prefabGameName;
            go.transform.SetParent(this.gameObject.transform);
            SOUND.I.LoadAssetBundleAudioClipsPackage(DEF.GetGameBundleName(loadGame));

            GameMain        = go.gameObject.GetComponent <InGame>();
            GameMain.gameId = eGameName;
            GameMain.Init();

            Main.I.AppsFlyerEvent(AFInAppEvents.GAME, AFInAppEvents.GAME_SELECT, eGameName.ToString());
        }

        if (Lobby.I != null)
        {
            Lobby.I.LobbyToGame();
        }
        Coins.LobbyToGame();
        Game.LobbyToGame();
        BroadCast.LobbyToGame();
    }
예제 #3
0
    private void LoadGameBundle()
    {
        SetState(eState.BeginDownloads);
        imgLoadBar.fillAmount = 0;

        _playTime = 30f;
        _time     = Time.time;
        _tempfill = imgLoadBar.fillAmount;

        StartCoroutine(coUpdateLoadBar());

        string bundleName = DEF.GetGameBundleName((eGameList)_id);

        StartCoroutine(xLIB.BUNDLE.I.DownloadUpdateFromServer(bundleName, null, OnLoadComplete, OnLoadError));
    }
예제 #4
0
    protected override void OnEnable()
    {
        base.OnEnable();
        if (m_args == null)
        {
            return;
        }

        _imgFadeInOut.color = Color.black;
        _imgFadeInOut.gameObject.SetActive(true);
        _ProgressBar.gameObject.SetActive(true);
        _ProgressBar.Reset();

        if ((SCENEIDs)m_args[0] == SCENEIDs.LobbyToGame)
        {
            _ProgressBar.SetFillAmount(0.03f);
            _ProgressBar.AutoAddGague(10f, null);
            PK.GamesInfo.REData info = USER.I.GetGameListInfo((int)m_args[1]);

            _GameKind   = (eGameList)m_args[1];
            _bundleName = DEF.GetGameBundleName(_GameKind);

            // gamecommon 번들에 넣어둔 이미지 로딩
            Sprite spr = DEF.GetGameLoadingImage(_GameKind);
            if (spr != null)
            {
                _imgTitle.texture = spr.texture;
                _imgFadeInOut.DOFade(0, 0.3f).OnComplete(OnFadeComplete);
            }
            else  // 혹시나 로딩 실패하면 기존 웹다운방식
            {
                DB.I.WebDownloadImage(info.loading_image, (x) =>
                {
                    _imgTitle.texture = x;
                    _imgFadeInOut.DOFade(0, 0.3f).OnComplete(OnFadeComplete);
                });
            }
        }
        else
        {
            Close("cancel");
        }
    }
예제 #5
0
 void OnEnable()
 {
     if (_Info != null)
     {
         if (DEF.IsUseGameID((eGameList)_id))
         {
             if (_Info.status == "active")
             {
                 // 게임 번들 존재 여부 확인
                 _bundleName = DEF.GetGameBundleName((eGameList)_id);
                 AssetBundle bundle = xLIB.BUNDLE.I.GetBundle(_bundleName);
                 if (bundle != null)
                 {
                     SetState(eState.Play);
                 }
                 else if (xLIB.BUNDLE.I.IsLocalFileCached(_bundleName))
                 {
                     SetState(eState.Play);
                 }
                 else
                 {
                     SetState(eState.Download);
                 }
                 // 잭팟 액션 시작
                 UpdateJackpotPool();
             }
             else if (_Info.status == "coming_soon")
             {
                 SetState(eState.ComingSoon);
             }
             else if (_Info.status == "maintenance")
             {
             }
         }
         else
         {
             _url        = "";
             _bundleName = "";
             InitState();
         }
     }
 }
예제 #6
0
파일: UI.cs 프로젝트: kimhwi9202/crown_temp
    /// <summary>
    /// 게임화면에서 로비화면으로 전환
    /// </summary>
    public void GameToLobby()
    {
        if (!SOUND.I.IsPlay(DEF.SND.lobby_bgm))
        {
            SOUND.I.Play(DEF.SND.lobby_bgm, true);
        }

        Main.I.CurrentView = eView.Lobby;
        if (GameMain != null)
        {
            SOUND.I.RemoveClipPackage(DEF.GetGameBundleName(loadGame));
            BUNDLE.I.UnLoadBundle(DEF.GetGameBundleName(loadGame), true);
            Destroy(GameMain.gameObject);
            GameMain = null;
            loadGame = eGameList.none;
        }

        if (Lobby.I != null)
        {
            Lobby.I.GameToLobby();
        }

        Coins.GameToLobby();
        Game.GameToLobby();
        Tournaments.GameToLobby();
        BroadCast.GameToLobby();

        Resources.UnloadUnusedAssets();
        System.GC.Collect();

        NET.I.SendReqLobbyUserInfo((id, msg) =>
        {
            USER.I.SetPKUserInfo(msg);
            USER.I.UpdateAllUserInfo();

            Main.I.AppsFlyerEvent(AFInAppEvents.GAME, AFInAppEvents.GAME_EXIT, "true");
        }, null);
    }
예제 #7
0
 // 게임을 직접 실행한다.
 public void RunNewsGame(eGameList gameId)
 {
     UI.SetWaitLoading(true);
     if (DEF.IsUseGameID(gameId))
     {
         runGameId = (int)gameId;
         string      bundleName = DEF.GetGameBundleName(gameId);
         AssetBundle bundle     = xLIB.BUNDLE.I.GetBundle(bundleName);
         if (bundle != null)
         {
             SCENE.I.AddMessage(SCENEIDs.LobbyToGame, "game", runGameId);
         }
         else if (xLIB.BUNDLE.I.IsLocalFileCached(bundleName))
         {
             SCENE.I.AddMessage(SCENEIDs.LobbyToGame, "game", runGameId);
         }
         else
         {
             StartCoroutine(xLIB.BUNDLE.I.DownloadUpdateFromServer(bundleName, null, () => {
                 SCENE.I.AddMessage(SCENEIDs.LobbyToGame, "game", runGameId);
             }));
         }
     }
 }
예제 #8
0
    void ParserCommand(Hashtable has)
    {
        SCENEIDs _IDs = (SCENEIDs)has["id"].GetHashCode();

#if UNITY_EDITOR
        Debug.Log(Time.frameCount + " <Color=#fff000> SCENE::ParserCommand - " + _IDs.ToString() + " </Color>");
#endif
        switch (_IDs)
        {
        case SCENEIDs.Company:
            Main.I.ShowCompany(true);
            Main.I._logo.color = Color.white;
            Main.I._logo.DOFade(0, 1f).SetDelay(2f).OnComplete(() => {
                remove(SCENEIDs.Company);
            });
            return;

        case SCENEIDs.MsgBoxNetReConnect:
            MsgBoxNetworkReConnect();
            break;

        case SCENEIDs.NetReConnect:
            NetworkReConnect();
            break;

        case SCENEIDs.FirstLoginToLobby:
            Main.I.ShowCompany(false);
            UI.ShowLoginLoadingPage((id, args) =>
            {
                remove(SCENEIDs.FirstLoginToLobby);
            }, SCENEIDs.FirstLoginToLobby, has["name"].ToString());
            return;

        case SCENEIDs.FirstActiveLobby:
            //UI.I.FirstActiveLobby();
            break;

        case SCENEIDs.FBSignOut:
        {
            SOUND.I.PlayStop(DEF.SND.lobby_bgm);
            USER.I.ResetReConnect();
            UI.SetWaitLoading(false);
            UI.ShowLoginLoadingPage((id, args) =>
                {
                    remove(SCENEIDs.FBSignOut);
                }, SCENEIDs.FBSignOut);
        }
            return;

        case SCENEIDs.FacebookShare:
            break;

        case SCENEIDs.InitLobby:
            UI.I.FirstActiveLobby();
            break;

        case SCENEIDs.InviteFriends:
            Main.I.GetFBController().InviteFriends();
            break;

        case SCENEIDs.ReConnectServer:
            UI.SetWaitLoading(false);
            USER.I.ResetReConnect();
            UI.ShowLoginLoadingPage((id, args) =>
            {
                remove(SCENEIDs.ReConnectServer);
            }, SCENEIDs.ReConnectServer);
            return;

        case SCENEIDs.GuestToFacebook:
        {
            if (USER.I.IsGuestLogin)
            {
                UI.I.ShowGuestGuide((_id, args) =>
                    {
                        if (args[0].ToString() == "ok")
                        {
                            AddMessage(SCENEIDs.LoginGuestToFacebook);
                            remove(SCENEIDs.GuestToFacebook);
                        }
                        else     // cancel
                        {
                            remove(SCENEIDs.GuestToFacebook);
                        }
                    });
            }
            else
            {
                remove(SCENEIDs.GuestToFacebook);
            }
        }
            return;

        case SCENEIDs.LoginGuestToFacebook:
        {
            UI.SetWaitLoading(true);
            Main.FB.FBLogin((x) =>
                {
                    if (x == true)
                    {
                        SOUND.I.PlayStop(DEF.SND.lobby_bgm);
                        long guestId = System.Convert.ToInt64(PlayerPrefHelper.GetUserID());
                        long fbid    = System.Convert.ToInt64(Main.FB.GetFbLoginInfo().id);
                        NET.I.SendReqGuestToFacebook((id, msg) =>
                        {
                            // reset data
                            USER.I.ResetReConnect();
                            I.AddMessage(SCENEIDs.ReLoginFacebook);
                        }, NET.I.OnSendReqTimerout, guestId, fbid);
                    }
                    else
                    {
                        UI.SetWaitLoading(false);
                    }
                });
        }
        break;

        case SCENEIDs.ReLoginFacebook:
            UI.SetWaitLoading(false);
            UI.ShowLoginLoadingPage((id, args) =>
            {
                remove(SCENEIDs.ReLoginFacebook);
            }, SCENEIDs.ReLoginFacebook);
            return;

        case SCENEIDs.GuestToFBActiveLobby:
            UI.I.GuestToFBActiveLobby();
            break;

        case SCENEIDs.LobbyToGame:
            int gameID = System.Convert.ToInt32(has["game"].ToString());
            if (DEF.IsUseGameID((eGameList)gameID))
            {
                if (Lobby.I != null)
                {
                    Lobby.I.gameObject.SetActive(false);
                }
                UI.ShowGameLoadingPage((id, args) =>
                {
                    if (args[0].ToString() == "ok")
                    {
                        //UI.I.LobbyToGame((eGameList)args[1]);
                        remove(SCENEIDs.LobbyToGame);
                    }
                }, SCENEIDs.LobbyToGame, gameID);
                return;
            }
            break;

        case SCENEIDs.GameToLobby:
            UI.I.GameToLobby();
            break;

        case SCENEIDs.Quit:
            UI.I.ShowMsgBox("Are you sure you want to quit the game?", (id, args) => {
                if (args[0].ToString() == "ok")
                {
                    Main.I.OnQuit();
                }
            });
            break;

        case SCENEIDs.DEBUG_LOADING_COMPLETED:
        {
            UI.GameMain = GameObject.FindObjectOfType <InGame>();
            if (UI.GameMain.gameId == DEF.FIRST_INSTALL_GAME)
            {
                BUNDLE.I.UnLoadBundle(DEF.GetGameBundleName(DEF.FIRST_INSTALL_GAME));          // 로비에서 다운받기 때문에 삭제
            }
            UI.I.LobbyToGame(UI.GameMain.gameId);
            UI.GameMain.Init();
        }
        break;


        // first news popups
        case SCENEIDs.NewsDailySpin:
            UI.Popup.ShowPopup <UIPopDailySpin>("DailySpin", (int)_IDs, (id, args) => {
                if (args[0].ToString() == "x")
                {
                    base.removeAt(SCENEIDs.NewsGoldenSpin);                                 // 취소면 NewsGoldenSpin 메세지 강제 제거
                }
                remove(SCENEIDs.NewsDailySpin);
            }, true);
            return;

        case SCENEIDs.NewsGoldenSpin:
            UI.Popup.ShowPopup <UIPopDailySpinShop>("DailySpinShop", (int)_IDs, (id, args) => {
                remove(SCENEIDs.NewsGoldenSpin);
            }, null);
            return;

        case SCENEIDs.NewsFirstPurchase:
            UI.Popup.ShowPopup <UIPopFirstPurchaseOffer>("FirstPurchaseOffer", (int)_IDs, (id, args) => {
                remove(SCENEIDs.NewsFirstPurchase);
            }, true);
            return;

        case SCENEIDs.NewsSweetOffer:
            UI.Popup.ShowPopup <UIPopSweetOffer>("SweetOffer", (int)_IDs, (id, args) => {
                if (args[0].ToString() == "buy")
                {
                    UI.Popup.ShowPopup <UIPopPurchaseSuccessful>("PurchaseSuccessful", 0, (id2, args2) => {
                        remove(SCENEIDs.NewsSweetOffer);
                    }, args[1]);
                }
                else
                {
                    remove(SCENEIDs.NewsSweetOffer);
                }
            }, true);
            return;

        case SCENEIDs.NewsNormal:
            UI.Popup.ShowPopup <UIPopNewsNormal>("NewsNormal", (int)_IDs, (id, args) => {
                remove(SCENEIDs.NewsNormal);
            }, has["url"], has["value"]);
            return;

        case SCENEIDs.NewsGame:
            UI.Popup.ShowPopup <UIPopNewsGame>("NewsGame", (int)_IDs, (id, args) => {
                remove(SCENEIDs.NewsGame);
                if (args[0].ToString() == "ok")
                {
                    AddMessage(SCENEIDs.NewsGameRun, "gameid", args[1]);
                }
                else
                {
                    AddMessage(SCENEIDs.NewsInbox);
                }
            }, has["url"], has["value"]);
            return;

        case SCENEIDs.NewsGameRun:
            Lobby.I.RunNewsGame((eGameList)HasToInt("gameid"));
            break;

        case SCENEIDs.NewsInbox:
            //UI.Popup.ShowPopup<UIPopGift>("Gift", (int)_IDs, null, "InBox");
            UI.I.AddMessage(UI.IDs.PopGift, "tab", "InBox");
            break;
        }
        I.remove(_IDs);
    }