public void ShowSaveSelectUI()
    {
#if UNITY_ANDROID
        if (!Social.localUser.authenticated)
        {
            UIManager.Instance.Set_Google_Txt();
            UIManager.Instance.PushPopup(UIManager.Instance.GooglePopup);
        }
        else
        {
            UIManager.Instance.Set_Google_Txt();

            uint maxNumToDisplay = 5;
            bool allowCreateNew  = true;
            bool allowDelete     = true;

            ISavedGameClient savedGameClient = PlayGamesPlatform.Instance.SavedGame;
            savedGameClient.ShowSelectSavedGameUI("Select saved game",
                                                  maxNumToDisplay,
                                                  allowCreateNew,
                                                  allowDelete,
                                                  OnSavedGameSelected);
        }
#else
#endif
    }
示例#2
0
    //displays savefiles in the cloud. This will only include one savefile if the m_saveName hasn't been changed
    private void ShowSaveSystemUI(ILocalUser user, Action <SelectUIStatus, ISavedGameMetadata> callback)
    {
        uint maxNumToDisplay = 3;
        bool allowCreateNew  = true;
        bool allowDelete     = true;

        ISavedGameClient savedGameClient = PlayGamesPlatform.Instance.SavedGame;

        if (savedGameClient != null)
        {
            savedGameClient.ShowSelectSavedGameUI(user.userName + "\u0027s saves",
                                                  maxNumToDisplay,
                                                  allowCreateNew,
                                                  allowDelete,
                                                  (SelectUIStatus status, ISavedGameMetadata saveGame) => {
                // some error occured, just show window again
                if (status != SelectUIStatus.SavedGameSelected)
                {
                    ShowSaveSystemUI(user, callback);
                    return;
                }

                if (callback != null)
                {
                    callback.Invoke(status, saveGame);
                }
            });
        }
        else
        {
            // this is usually due to incorrect APP ID
            Debug.LogError("Save Game client is null...");
        }
    }
示例#3
0
    /*
     * Shows the saved game interface.
     * */
    public void showSavedGame()
    {
        uint maxNumToDisplay = 5;
        bool allowCreateNew  = false;
        bool allowDelete     = true;

        ISavedGameClient savedGameClient = PlayGamesPlatform.Instance.SavedGame;

        savedGameClient.ShowSelectSavedGameUI("Select Saved Game", maxNumToDisplay, allowCreateNew, allowDelete, OnSavedGameSelected);
    }
示例#4
0
        public static void ShowSelectUI(bool loadGame, bool allowCreate = true)
        {
#if UNITY_ANDROID && GPGS
            LoadProgress = loadGame;

            const uint maxNumToDisplay = 5;
            bool       allowCreateNew  = allowCreate;

            ISavedGameClient savedGameClient = PlayGamesPlatform.Instance.SavedGame;
            savedGameClient.ShowSelectSavedGameUI("Select saved game", maxNumToDisplay, allowCreateNew, true, OnSavedGameSelected);
#endif
        }
示例#5
0
    //--------------------------------------------------------------------
    public static void ShowSelectUI()
    {
#if UNITY_ANDROID && !UNITY_EDITOR
        uint maxNumToDisplay = 5;
        bool allowCreateNew  = false;
        bool allowDelete     = true;

        ISavedGameClient savedGameClient = PlayGamesPlatform.Instance.SavedGame;
        savedGameClient.ShowSelectSavedGameUI("Select saved game",
                                              maxNumToDisplay,
                                              allowCreateNew,
                                              allowDelete,
                                              OnSavedGameSelected);
#endif
    }
示例#6
0
    public void LoadSaveFileFromCloudWithSelectionUI(uint maxNumToDisplay = 5, bool allowCreateNew = false, bool allowDelete = false)
    {
        if (CheckIfThePlayerIsValid() == false)
        {
            return;
        }

        isSaving = false;

        ISavedGameClient savedGameClient = PlayGamesPlatform.Instance.SavedGame;

        savedGameClient.ShowSelectSavedGameUI("Select saved game to load",
                                              maxNumToDisplay,
                                              allowCreateNew,
                                              allowDelete,
                                              OnSavedGameSelected);
    }
示例#7
0
    /*
     *
     *
     *
     *
     *  GAME SAVING AND LOADING STUFF DOWN HERE
     *
     *
     *
     *
     */



    void ShowSelectUI()
    {
        DataLogger.LogError("show is called");
        int  maxNumToDisplay = 5;
        bool allowCreateNew  = false;
        bool allowDelete     = true;

        try {
            ISavedGameClient savedGameClient = PlayGamesPlatform.Instance.SavedGame;
            savedGameClient.ShowSelectSavedGameUI("Select saved game",
                                                  (uint)maxNumToDisplay,
                                                  allowCreateNew,
                                                  allowDelete,
                                                  OnSavedGameSelected);
        } catch (System.Exception e) {
            DataLogger.LogError(this.name, e);
        }
    }
示例#8
0
    static public void ShowSavedGamesUI(Action <SelectUIStatus, ISavedGameMetadata> onSavedGameSelected, Action <bool> onSavesOpened)
    {
        if (PlayerLoggedIn)
        {
            uint maxNumToDisplay = 5;
            bool allowCreateNew  = false;
            bool allowDelete     = true;

            ISavedGameClient savedGameClient = PlayGamesPlatform.Instance.SavedGame;
            savedGameClient.ShowSelectSavedGameUI("Select saved game",
                                                  maxNumToDisplay,
                                                  allowCreateNew,
                                                  allowDelete,
                                                  onSavedGameSelected);
        }
        if (onSavesOpened != null)
        {
            onSavesOpened.Invoke(PlayerLoggedIn);
        }
    }
示例#9
0
    public void SelectSaveGame()
    {
        uint maxNumToDisplay = 3;
        bool allowCreateNew  = true;
        bool allowDelete     = true;

        ISavedGameClient savedGameClient = PlayGamesPlatform.Instance.SavedGame;

        savedGameClient.ShowSelectSavedGameUI("Select save game",
                                              maxNumToDisplay,
                                              allowCreateNew,
                                              allowDelete,
                                              (SelectUIStatus status, ISavedGameMetadata saveGame) => {
            // some error occured, just show window again
            if (status == SelectUIStatus.SavedGameSelected)
            {
                OpenSavedGame(saveGame);
            }
        });
    }
    public void ShowLoadSelectUI()
    {
#if UNITY_ANDROID
        if (!Social.localUser.authenticated)
        {
        }
        else
        {
            uint maxNumToDisplay = 5;
            bool allowCreateNew  = false;
            bool allowDelete     = false;

            ISavedGameClient savedGameClient = PlayGamesPlatform.Instance.SavedGame;
            savedGameClient.ShowSelectSavedGameUI("Select saved game",
                                                  maxNumToDisplay,
                                                  allowCreateNew,
                                                  allowDelete,
                                                  OnLoadGameSelected);
        }
#else
#endif
    }
示例#11
0
    public bool LoadGame()  //이닛 후에 불려져야함.
    {
#if UNITY_ANDROID
        if (st == null || !savedGame)
        {
            Debug.Log("로드게임 - 세이브 데이타가 존재하지 않음 또는 " + savedGame);
            return(false);
        }


        if (false == PlayGamesPlatform.Instance.localUser.authenticated)
        {
            PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder().EnableSavedGames().Build();
            PlayGamesPlatform.InitializeInstance(config);
            PlayGamesPlatform.DebugLogEnabled = true;
            PlayGamesPlatform.Activate();
            Social.localUser.Authenticate((bool success, string msg) =>
            {
                if (false == success)
                {
                    Debug.Log("로드 실패 - 로그인 불가");
                    return;
                }
            });
        }
        ISavedGameClient saveClient = PlayGamesPlatform.Instance.SavedGame;
        saveClient.OpenWithAutomaticConflictResolution(Constant.saveFileNameInGPGSCloud, DataSource.ReadCacheOrNetwork, ConflictResolutionStrategy.UseMostRecentlySaved, (status, metaData) =>
        {
            if (status != SavedGameRequestStatus.Success)
            {
                Debug.Log("로드 실패 - 메타데이타 오픈 불가");
                return;
            }
            saveClient.ReadBinaryData(metaData, (readStatus, savedData) =>
            {
                if (readStatus == SavedGameRequestStatus.Success)
                {
                    Debug.Log("바이너리 데이타 리드 읽기 성공!");
                    byte[] savedDataByteArr = savedData;

                    BinaryFormatter bt = new BinaryFormatter();
                    MemoryStream ms    = new MemoryStream(savedDataByteArr);
                    st = bt.Deserialize(ms) as SaveStructure;
                    ms.Dispose();
                    ms.Close();

                    if (st == null)
                    {
                        Debug.Log("리드는 했으나 스트럭쳐가 널임.");
                    }
                }
                else
                {
                    Debug.Log("바이너리 데이타 리드 읽기 실패!");
                    saveClient.ShowSelectSavedGameUI("리드가 안됨.", 5, false, false, (stq, md) => { });
                }
            });
        });
        if (st == null)
        {
            Debug.Log("리드 실패");
            return(false);
        }
#else
        BinaryFormatter bt   = new BinaryFormatter();
        FileStream      file = File.Open(Constant.saveDataAllPath, FileMode.Open);

        if (file != null && file.Length > 0)
        {
            st = bt.Deserialize(file) as SaveStructure;
            file.Close();
            if (st == null)
            {
                Debug.Log("파일이 없음.");
                return(false);
            }
        }
        else
        {
            file.Close();
            return(false);
        }
#endif
        Debug.Log("로드 게임");
        //  LanguageManager.GetInstance().SetLanguage(st.lang);   언어설정은 새로 할 수 있게.
        GoldManager.GetInstance().SetGold(st.golds);
        GameEndJudgeManager.GetInstance().Load(st);
        InGameTimeManager.GetInstance().Load(st);
        CharactorManager.GetInstance().Load(st);
        QuestManager.GetInstance().Load(st);
        Inventory.GetInstance().Load(st);
        WholeMonsterRiskManager.GetInstance().Load(st);
        PhaseManager.GetInstance().Load(st);
        TextManager.GetInstance().Load(st);

        return(true);
    }