示例#1
0
    public void UpdateListItem()
    {
        ClearAllListItem();

        // 게임 가능한 리스트 선별
        for (int i = 0; i < USER.I._PKGamesInfo.data.Length; i++)
        {
            if (DEF.IsUseGameID((eGameList)USER.I._PKGamesInfo.data[i].game_id))
            {
                //Debug.Log("GameList Info = " + USER.I._PKGamesInfo.data[i].game_id.ToString() + " , status : " + USER.I._PKGamesInfo.data[i].status);
                _GameList.Add(USER.I._PKGamesInfo.data[i]);
            }
        }

        int count = _GameList.Count;

        for (int i = 0; i < count; i += 3)
        {
            if (i < count)
            {
                STGameItem item = new STGameItem();
                if (i < count)
                {
                    item.list.Add(_GameList[i]);
                }
                if (i + 1 < count)
                {
                    item.list.Add(_GameList[i + 1]);
                }
                if (i + 2 < count)
                {
                    item.list.Add(_GameList[i + 2]);
                }
                m_ItemList.Add(item);
            }
        }

/*
 #if UNITY_EDITOR
 *      for(int i=0; i<m_ItemList.Count; i++)
 *          for (int k = 0; k < m_ItemList[i].list.Count; k++)
 *              Debug.Log(i + " > m_ItemList Info = " + m_ItemList[i].list[k].game_id);
 *
 #endif
 */
        CurrentItemMaxCount = m_ItemList.Count;
        Reset();
        _GamePage.Init(m_ItemList.Count);
    }
示例#2
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();
         }
     }
 }
示例#3
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);
             }));
         }
     }
 }
示例#4
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);
    }