Example #1
0
    public static bool LoadHiScore()
    {
        try {
            if (CheckSaveDataHeader("SDG_HiScore"))
            {
                Debug.Log("SaveData.LoadHiScore : Start");

                zFoxDataPackString hiScoreData = new zFoxDataPackString();
                hiScoreData.DecodeDataPackString(hiScoreData.PlayerPrefsGetStringUTF8("HiScoreData"));

                for (int i = 0; i < 10; i++)
                {
                    HiScore[i] = (int)hiScoreData.GetData("Rank" + (i + 1));
                }

                Debug.Log("SaveData.LoadHiScore : End");
            }

            return(true);
        } catch (System.Exception e) {
            Debug.LogWarning("SaveData.LoadHiScore : Failed(" + e.Message + ")");
        }

        return(false);
    }
Example #2
0
 public static bool LoadHiScore()
 {
     Debug.Log("LoadHiScore Come");
     try
     {
         if (CheckSaveDataHeader("SDG_HiScore"))
         {
             Debug.Log("SaveData.LoadHiScore : Start");
             zFoxDataPackString hiscoreData = new zFoxDataPackString();
             hiscoreData.DecodeDataPackString(hiscoreData.PlayerPrefsGetStringUTF8("HiScoreData"));
             Debug.Log(hiscoreData.PlayerPrefsGetStringUTF8("HiScoreData"));
             for (int i = 0; i < HiScore.GetLength(0); i++)
             {
                 HiScore[i, 0] = (string)hiscoreData.GetData("PunchOutCntforRank" + (i + 1));
                 HiScore[i, 1] = (string)hiscoreData.GetData("HiScoreforRank" + (i + 1));
             }
             Debug.Log("SaveData.LoadHiScore : End");
         }
         return(true);
     }
     catch (System.Exception e)
     {
         Debug.Log("LoadHiScore catch");
         Debug.LogWarning("SaveData.LoadHiScore : Failed (" + e.Message + ")");
     }
     return(false);
 }
Example #3
0
 public static bool LoadGamePlay(bool allData)
 {
     try {
         // SaveDataInfo
         if (CheckSaveDataHeader("SDG_GUEST"))
         {
             //Debug.Log("SaveData.LoadGamePlay : Start");
             SaveDate = PlayerPrefs.GetString("SaveDataDate");
             if (allData)                   // PlayerData
             {
                 zFoxDataPackString playerData = new zFoxDataPackString();
                 playerData.DecodeDataPackString(playerData.PlayerPrefsGetStringUTF8("PlayerData"));
                 GameData.Instance.players[1].coin     = (int)playerData.GetData("Player_Coin");
                 GameData.Instance.players[1].cardHas  = (int)playerData.GetData("Player_CARDHAS");
                 GameData.Instance.players[1].exp      = (int)playerData.GetData("Player_EXP");
                 GameData.Instance.players[1].expCount = (int)playerData.GetData("Player_EXPCOUNT");
                 GameData.Instance.players[1].expCount = (int)playerData.GetData("Player_TROPHY");
             }
             return(true);
         }
     } catch (System.Exception e) {
         Debug.LogWarning("SaveData.LoadGamePlay : Failed (" + e.Message + ")");
     }
     return(false);
 }
Example #4
0
    public static bool LoadGamePlay(bool allData)
    {
        try {
            if (CheckSaveDataHeader("SDG_GamePlay"))
            {
                SaveDate = PlayerPrefs.GetString("SaveDataDate");

                if (allData)
                {
                    zFoxDataPackString playerData = new zFoxDataPackString();
                    playerData.DecodeDataPackString(playerData.PlayerPrefsGetStringUTF8("PlayerData"));

                    PlayerController.nowHpMax            = (float)playerData.GetData("Player_HPMax");
                    PlayerController.nowHp               = (float)playerData.GetData("Player_HP");
                    PlayerController.score               = (int)playerData.GetData("Player_Score");
                    PlayerController.checkPointEnabled   = (bool)playerData.GetData("Player_checkPointEnabled");
                    PlayerController.checkPointSceneName = (string)playerData.GetData("Player_checkPointSceneName");
                    PlayerController.checkPointLabelName = (string)playerData.GetData("Player_checkPointLabelName");
                }


                if (PlayerPrefs.HasKey("StageData_" + Application.loadedLevelName))
                {
                    zFoxDataPackString stageData = new zFoxDataPackString();
                    stageData.DecodeDataPackString(stageData.PlayerPrefsGetStringUTF8("Stage_" + Application.loadedLevelName));

                    // 아직 이해 안 됨
                    zFoxUID[] uidList = GameObject.Find("Stage").GetComponentsInChildren <zFoxUID>();

                    foreach (zFoxUID uidItem in uidList)
                    {
                        if (uidItem.uid != null && uidItem.uid != "(non)")
                        {
                            if (stageData.GetData(uidItem.uid) == null)
                            {
                                uidItem.gameObject.SetActive(false);
                            }
                        }
                    }
                }

                if (allData)
                {
                    zFoxDataPackString eventData = new zFoxDataPackString();
                    eventData.DecodeDataPackString(eventData.PlayerPrefsGetStringUTF8("EventData"));
                    PlayerController.itemKeyA = (bool)eventData.GetData("Event_KeyItem_A");
                    PlayerController.itemKeyB = (bool)eventData.GetData("Event_KeyItem_B");
                    PlayerController.itemKeyC = (bool)eventData.GetData("Event_KeyItem_C");
                }

                return(true);
            }
        } catch (System.Exception e) {
            Debug.LogError("SaveData.LoadGamePlay : Failed (" + e.Message + ")");
        }

        return(false);
    }
Example #5
0
    public static string LoadContinueSceneName()
    {
        if (CheckSaveDataHeader("SDG_GamePlay")) {
            zFoxDataPackString playerData = new zFoxDataPackString();
            playerData.DecodeDataPackString(playerData.PlayerPrefsGetStringUTF8 ("PlayerData"));
            return (string)playerData.GetData ("Player_checkPointSceneName");
        }

        continuePlay = false;
        return "StageA";
    }
Example #6
0
    public static string LoadContinueSceneName()
    {
        if (CheckSaveDataHeader("SDG_GamePlay"))
        {
            zFoxDataPackString playerData = new zFoxDataPackString();
            playerData.DecodeDataPackString(playerData.PlayerPrefsGetStringUTF8("PlayerData"));
            return((string)playerData.GetData("Player_checkPointSceneName"));
        }

        continuePlay = false;
        return("StageA");
    }
Example #7
0
 public static bool Load()
 {
     try {
         zFoxDataPackString playerData = new zFoxDataPackString();
         playerData.DecodeDataPackString(playerData.PlayerPrefsGetStringUTF8("playerData"));
         PlayerController.CheckPointNumber =
             (int)playerData.GetData("CheckPointNumber");
         return(true);
     } catch (System.Exception e) {
     }
     return(false);
 }
Example #8
0
    public static bool LoadGamePlay(bool allData)
    {
        try{
            if(CheckSaveDataHeader("SDG_GamePlay")){
                SaveDate = PlayerPrefs.GetString("SaveDataDate");
                if(allData){
                    zFoxDataPackString playerData = new zFoxDataPackString();
                    playerData.DecodeDataPackString(
                        playerData.PlayerPrefsGetStringUTF8("PlayerData"));
                    PlayerController.nowHpMax = (float)playerData.GetData("Player_HPMax");
                    PlayerController.nowHp = (float)playerData.GetData("Player_HP");
                    PlayerController.score = (int)playerData.GetData("Player_Score");
                    PlayerController.checkPointEnabled = (bool)playerData.GetData("Player_checkPointEnabled");
                    PlayerController.checkPointSceneName = (string)playerData.GetData("Player_checkPointSceneName");
                    PlayerController.checkPointLabelName = (string)playerData.GetData("Player_checkPointLabelName");
                }

                if(PlayerPrefs.HasKey("StageData_"+Application.loadedLevelName)){
                    zFoxDataPackString stageData = new zFoxDataPackString();
                    stageData.DecodeDataPackString(stageData.PlayerPrefsGetStringUTF8(
                        "StageData_"+Application.loadedLevelName));

                    zFoxUID[] uidList = GameObject.Find("Stage").GetComponentsInChildren<zFoxUID>();
                    foreach(zFoxUID uidItem in uidList){
                        if(uidItem.uid != null && uidItem.uid != "(non)"){
                            if(stageData.GetData(uidItem.uid)==null){
                                uidItem.gameObject.SetActive(false);
                            }
                        }
                    }

                }
                if(allData){
                    zFoxDataPackString eventData = new zFoxDataPackString();
                    eventData.DecodeDataPackString(
                        eventData.PlayerPrefsGetStringUTF8("EventData"));
                    PlayerController.itemKeyA = (bool)eventData.GetData("Event_KeyItem_A");
                    PlayerController.itemKeyB = (bool)eventData.GetData("Event_KeyItem_B");
                    PlayerController.itemKeyC = (bool)eventData.GetData("Event_KeyItem_C");
                }
                return true;
            }
        }catch(System.Exception e){

        }
        return false;
    }
Example #9
0
 public static bool LoadHiScore()
 {
     try {
         if (CheckSaveDataHeader("SDG_HiScore")) {
             Debug.Log("SaveData.LoadHiScore : Start");
             zFoxDataPackString hiscoreData = new zFoxDataPackString();
             hiscoreData.DecodeDataPackString(hiscoreData.PlayerPrefsGetStringUTF8 ("HiScoreData"));
             //Debug.Log(hiscoreData.PlayerPrefsGetStringUTF8 ("HiScoreData"));
             for(int i = 0;i < 10;i ++) {
                 HiScore[i] = (int)hiscoreData.GetData ("Rank" + (i + 1));
             }
             Debug.Log("SaveData.LoadHiScore : End");
         }
         return true;
     } catch(System.Exception e) {
         Debug.LogWarning("SaveData.LoadHiScore : Failed (" + e.Message + ")");
     }
     return false;
 }
Example #10
0
    public static bool LoadHiScore()
    {
        try{
            if(CheckSaveDataHeader("SDG_HiScore")){
                zFoxDataPackString hiscoreData= new zFoxDataPackString();
                hiscoreData.DecodeDataPackString(
                    hiscoreData.PlayerPrefsGetStringUTF8("HiScoreData"));
                for(int i=0;i<10;i++){
                    HiScore[i] = (int)hiscoreData.GetData("Rank"+(i+1));
                }
            }
            return true;
        }catch(System.Exception e){

        }
        return false;
    }
Example #11
0
    public static bool LoadGamePlay(bool allData)
    {
        try
        {
            // SaveDataInfo
            if (CheckSaveDataHeader("SDG_GamePlay"))
            {
                Debug.Log("SaveData.LoadGamePlay : Start");
                SaveDate = PlayerPrefs.GetString("SaveDataDate");
                if (allData)
                { // PlayerData
                    zFoxDataPackString playerData = new zFoxDataPackString();
                    playerData.DecodeDataPackString(playerData.PlayerPrefsGetStringUTF8("PlayerData"));
                    Debug.Log(playerData.PlayerPrefsGetStringUTF8("PlayerData"));

                    punchOutCnt = (int)playerData.GetData("Player_PunchOutCnt");

                    /*
                     * PlayerController.nowHp = (float)playerData.GetData("Player_HP");
                     * PlayerController.score = (int)playerData.GetData("Player_Score");
                     * PlayerController.checkPointEnabled = (bool)playerData.GetData("Player_checkPointEnabled");
                     * PlayerController.checkPointSceneName = (string)playerData.GetData("Player_checkPointSceneName");
                     * PlayerController.checkPointLabelName = (string)playerData.GetData("Player_checkPointLabelName");
                     */
                }
                // StageData
                if (PlayerPrefs.HasKey("StageData_" + SceneManager.GetActiveScene().name))
                {
                    //zFoxDataPackString stageData = new zFoxDataPackString();
                    //stageData.DecodeDataPackString(stageData.PlayerPrefsGetStringUTF8("StageData_" + SceneManager.GetActiveScene().name));
                    //Debug.Log(stageData.PlayerPrefsGetStringUTF8 ("StageData_" + Application.loadedLevelName));

                    /*
                     * zFoxUID[] uidList = GameObject.Find("Stage").GetComponentsInChildren<zFoxUID>();
                     * foreach (zFoxUID uidItem in uidList)
                     * {
                     *  if (uidItem.uid != null && uidItem.uid != "(non)")
                     *  {
                     *      if (stageData.GetData(uidItem.uid) == null)
                     *      {
                     *          uidItem.gameObject.SetActive(false);
                     *      }
                     *  }
                     * }
                     */
                }
                if (allData)
                { // EventData
                  //zFoxDataPackString eventData = new zFoxDataPackString();
                  //eventData.DecodeDataPackString(eventData.PlayerPrefsGetStringUTF8("EventData"));
                  //Debug.Log(playerData.PlayerPrefsGetStringUTF8 ("PlayerData"));

                    /*
                     * PlayerController.itemKeyA = (bool)eventData.GetData("Event_KeyItem_A");
                     * PlayerController.itemKeyB = (bool)eventData.GetData("Event_KeyItem_B");
                     * PlayerController.itemKeyC = (bool)eventData.GetData("Event_KeyItem_C");
                     */
                }
                Debug.Log("SaveData.LoadGamePlay : End");
                return(true);
            }
        }
        catch (System.Exception e)
        {
            Debug.LogWarning("SaveData.LoadGamePlay : Failed (" + e.Message + ")");
        }
        return(false);
    }