/// <summary>
 /// Checks the presence of a key in the current saving system.
 /// </summary>
 /// <param name="_key">The key to look for</param>
 /// <param name="_saveFile">The specific filename in which to check. Uses a default file if empty.</param>
 /// <returns>true if the current saving system has the key already saved in</returns>
 public bool HasKey(string _key, string _saveFile = "")
 {
     return(ES2.Exists(globalSavePath + "/" + GetFileSave_Name(_saveFile) + "?tag=" + _key, es2Settings));
 }
Beispiel #2
0
 internal static void SaveToDefault <T>(string tag, T value)
 {
     ES2.Save <T>(value, SavePath + "?tag=" + tag, new ES2Settings());
 }
Beispiel #3
0
 public void Save()
 {
     ES2.Save(saveParams, Tag("saveParams"));
 }
Beispiel #4
0
 //Codage du bouton quitter
 public void Quitter()
 {
     this.jeuLance = false;
     ES2.Save(this.jeuLance, "jeuLance");
     Application.Quit();
 }
Beispiel #5
0
        internal static Transform GetRadiatorHose3Transform()
        {
            ES2Settings settings = new ES2Settings();

            return(ES2.Load <Transform>(SavePath + "?tag=radiator hose3(xxxxx)"));
        }
Beispiel #6
0
 public void AppendToFile(string identifier)
 {
     ES2.AppendRaw(data, identifier);
 }
    void loadSlotData()
    {
        #if !EMM_ES2
        //if there's already data present on this slot
        if (PlayerPrefs.GetInt("slot_" + slotId) == slotId)
        {
            //then load it and set it at UI
            saveName_text.text       = PlayerPrefs.GetString("slot_saveName_" + slotId);
            savePercentage_text.text = PlayerPrefs.GetFloat("slot_savePercentage_" + slotId) + "%";
        }

        //get key
        quickSaveSlot = PlayerPrefs.GetInt("quickSaveSlot") == slotId ? true : false;
        #else
        if (ES2.Exists("slot_" + slotId))
        {
            if (ES2.Load <int>("slot_" + slotId) == slotId)
            {
                //then load it and set it at UI
                if (ES2.Exists("slot_saveName_" + slotId))
                {
                    saveName_text.text = ES2.Load <string>("slot_saveName_" + slotId);
                }

                if (ES2.Exists("slot_savePercentage_" + slotId))
                {
                    savePercentage_text.text = ES2.Load <float>("slot_savePercentage_" + slotId) + "%";
                }
            }
        }

        //get key
        if (ES2.Exists("quickSaveSlot"))
        {
            quickSaveSlot = ES2.Load <int>("quickSaveSlot") == slotId ? true : false;
        }
        #endif

        //if true
        if (quickSaveSlot)
        {
            //change color
            Color c = Color.red;
            c.a = 0.25f;
            GetComponent <Image>().color = c;
            //disable btn
            GetComponentInChildren <Button>().enabled = false;
            //remove percentage from here
            savePercentage_text.text = "";

            //now finally sending the data
            saveGameUI.quickSaveSlotData(saveName_text, savePercentage_text, slotId);
        }

        if (slotId == 1)
        {
            //setting key input save
            MainMenu_KeyboardController keyInput = FindObjectOfType <MainMenu_KeyboardController>();
            if (keyInput)
            {
                keyInput.SetNextSelectedGameobject(saveName_text.gameObject);
            }
        }
    }
Beispiel #8
0
    //Init 2
    void OnRetrieveProductsFinised(BillingResult result)
    {
        AndroidInAppPurchaseManager.ActionRetrieveProducsFinished -= OnRetrieveProductsFinised;
        if (result.IsSuccess && !result.IsFailure)
        {
            if (PS_Plugin.Instance.isDebugMode && isDebugLog)
            {
                Debug.Log("OnRetrieveProductsFinised  Success");
            }
        }
        else
        {
            if (PS_Plugin.Instance.isDebugMode && isDebugLog)
            {
                Debug.LogError("OnRetrieveProductsFinised " + result.IsSuccess);
            }
            PS_Plugin.Instance.OnStoreInitComplete(false);
            return;
        }

        foreach (GoogleProductTemplate p in AndroidInAppPurchaseManager.Client.Inventory.Products)
        {
            if (PS_Plugin.Instance.isDebugMode && isDebugLog)
            {
                Debug.Log("プロダクトのリストをロードしました: " + p.Title);
            }
            if (PS_Plugin.Instance.isDebugMode && isDebugLog)
            {
                Debug.Log(p.SKU + "\n");
            }

            OnItemsQuery(p.SKU, p.LocalizedPrice.ToString(), p.Description, p.Title, p.ProductType);

            if (isConsumableProduct(p.SKU))
            {
                if (AndroidInAppPurchaseManager.Client.Inventory.IsProductPurchased(p.SKU))
                {
                    if (PS_Plugin.Instance.isDebugMode && isDebugLog)
                    {
                        Debug.Log("consume 忘れ " + p.SKU);
                    }
                    if (ES2.Exists(DataManger.DataFilename + "?tag=SPOfferLeft"))
                    {
                        consume(p.SKU);
                    }
                }
            }
            else
            {
                if (AndroidInAppPurchaseManager.Client.Inventory.IsProductPurchased(p.SKU))
                {
                    if (PS_Plugin.Instance.isDebugMode && isDebugLog)
                    {
                        Debug.Log("リストア  " + p.SKU);
                    }
                    if (ES2.Exists(DataManger.DataFilename + "?tag=SPOfferLeft"))
                    {
                        OnPurchaceRecovered(p.SKU);
                    }
                }
            }
        }
        PS_Plugin.Instance.OnStoreInitComplete(true);
    }
Beispiel #9
0
 void SaveMapTexture()
 {
     //var tex = new UnityEngine.Texture2D(fogTexture.width, fogTexture.height);
     //tex = fogTexture;
     ES2.SaveImage(fogTexture, "savedFogTexture.png");
 }
Beispiel #10
0
    // Load the T and X lines with their names
    void LoadTXLines()
    {
        if (ES2.Exists("tLineGameObjects.txt?tag=tLineNames" + SaveManager.currentProjID) && ES2.Exists("xLineGameObjects.txt?tag=xLineNames" + SaveManager.currentProjID) && ES2.Exists("xLineGameObjects.txt?tag=xLineNames" + SaveManager.currentProjID) &&
            ES2.Exists("tLineGameObjects.txt?tag=tLineNameTransforms" + SaveManager.currentProjID) && ES2.Exists("xLineGameObjects.txt?tag=xLineNameTransforms" + SaveManager.currentProjID))
        {
            List <string> tLineTexts = new List <string>();
            tLineTexts = ES2.LoadList <string>("tLineGameObjects.txt?tag=tLineNames" + SaveManager.currentProjID);
            List <Transform> tNameTransforms = new List <Transform>();
            tNameTransforms = ES2.LoadList <Transform>("tLineGameObjects.txt?tag=tLineNameTransforms" + SaveManager.currentProjID);

            List <Transform> xLineTransforms = new List <Transform>();
            xLineTransforms = ES2.LoadList <Transform>("xLineGameObjects.txt?tag=xLineTransforms" + SaveManager.currentProjID);
            List <string> xLineTexts = new List <string>();
            xLineTexts = ES2.LoadList <string>("xLineGameObjects.txt?tag=xLineNames" + SaveManager.currentProjID);
            List <Transform> xNameTransforms = new List <Transform>();
            xNameTransforms = ES2.LoadList <Transform>("xLineGameObjects.txt?tag=xLineNameTransforms" + SaveManager.currentProjID);

            for (int i = 0; i < xLineTransforms.Count; i++)
            {
                GameObject txParent = new GameObject(); // Make a GameObject that will contain its T and X axis
                txParent.name = "txParent";

                // Apply T line Info
                float      xLineZRot = xLineTransforms[i].eulerAngles.z;
                GameObject tempTLine = Instantiate(tLineObject, xLineTransforms[i].position, Quaternion.Euler(0, 0, 90 - xLineZRot)) as GameObject;
                tempTLine.transform.parent     = txParent.transform;
                tempTLine.transform.localScale = xLineTransforms[i].transform.localScale;
                AddXandTAxis.linesT.Add(tempTLine);

                GameObject tempTLineNames = Instantiate(nameObject, tNameTransforms[i].position, Quaternion.identity) as GameObject;
                tempTLineNames.transform.SetParent(tempTLine.transform);
                tempTLineNames.GetComponent <TextMesh>().text = tLineTexts[i];
                tempTLineNames.transform.localScale           = tNameTransforms[i].localScale;
                tempTLineNames.transform.rotation             = tempTLine.transform.rotation;

                // Apply X Line Info

                GameObject tempXLine = Instantiate(xLineObject, xLineTransforms[i].position, xLineTransforms[i].rotation) as GameObject;
                tempXLine.transform.parent     = txParent.transform;
                tempXLine.transform.localScale = xLineTransforms[i].transform.localScale;
                AddXandTAxis.linesX.Add(tempXLine);

                GameObject tempXLineNames = Instantiate(nameObject, xNameTransforms[i].position, Quaternion.identity) as GameObject;
                tempXLineNames.transform.SetParent(tempXLine.transform);
                tempXLineNames.GetComponent <TextMesh>().text = xLineTexts[i];
                tempXLineNames.transform.localScale           = xNameTransforms[i].localScale;
                tempXLineNames.transform.rotation             = tempXLine.transform.rotation;

                txParent.transform.SetParent(txParentsParent.transform);
            }
        }
    }
Beispiel #11
0
    // If the events loader file exists, load the events with their names
    void LoadEvents()
    {
        if (ES2.Exists("eventGameObjects.txt?tag=eventTransforms" + SaveManager.currentProjID) && ES2.Exists("eventGameObjects.txt?tag=eventNames" + SaveManager.currentProjID))
        {
            List <Transform> eventTransforms = new List <Transform>();
            eventTransforms = ES2.LoadList <Transform>("eventGameObjects.txt?tag=eventTransforms" + SaveManager.currentProjID);

            List <string> eventTexts = new List <string>();
            eventTexts = ES2.LoadList <string>("eventGameObjects.txt?tag=eventNames" + SaveManager.currentProjID);

            for (int i = 0; i < eventTransforms.Count; i++)
            {
                // Apply the loaded positions of the events
                GameObject tempEvents = Instantiate(eventsPicture, eventTransforms[i].transform.position, Quaternion.identity) as GameObject;
                tempEvents.transform.SetParent(eventsParent.transform);
                AddAnEvent.events.Add(tempEvents);

                // Apply the loaded names of the events
                GameObject tempNames = Instantiate(nameObject, new Vector3(eventTransforms[i].transform.position.x, eventTransforms[i].transform.position.y + 0.1f, eventTransforms[i].transform.position.z), Quaternion.identity) as GameObject;
                tempNames.transform.SetParent(tempEvents.transform);
                tempNames.GetComponent <TextMesh>().text = eventTexts[i];
                tempNames.transform.localScale           = new Vector3(5f, 5f, 1f);
            }
        }
    }
Beispiel #12
0
 public void LoadPointerPositionAndRotation()
 {
     transform.position = ES2.Load <Vector3>("PointerPosition" + SelectedPlayerPointerID + "PlayerID");
     transform.rotation = ES2.Load <Quaternion>("PointerRotation" + SelectedPlayerPointerID + "PlayerID");
 }
Beispiel #13
0
 public void Load()
 {
     levelToLoad = ES2.Load <string>("savedScene");
     SceneManager.LoadScene(levelToLoad);
 }
 /// <summary>
 /// Deletes an entry from the saving system.
 /// </summary>
 /// <param name="_entry">Name of the registry entry</param>
 public void DeleteEntry(string _key, string _saveFile = "")
 {
     ES2.Delete(globalSavePath + "/" + GetFileSave_Name(_saveFile) + "?tag=" + _key, es2Settings);
 }
Beispiel #15
0
 public void SaveToFile(string identifier)
 {
     ES2.Delete(identifier);
     ES2.SaveRaw(data, identifier);
 }
Beispiel #16
0
 // Encrypt and save player email
 public static void SaveEmail(string email)
 {
     ES2.Save(email, "gepr?tag=email");
 }
Beispiel #17
0
 public void SaveToFile(string identifier, ES2Settings settings)
 {
     ES2.Delete(identifier);
     ES2.SaveRaw(data, identifier, settings.Clone(identifier));
 }
Beispiel #18
0
    private void SaveUser(User user)
    {
        var userSerialized = JsonConvert.SerializeObject(user);

        ES2.Save(userSerialized, UserCacheKey);
    }
Beispiel #19
0
 public void AppendToFile(string identifier, ES2Settings settings)
 {
     ES2.AppendRaw(data, identifier, settings.Clone(identifier));
 }
Beispiel #20
0
 public void clearDatas()
 {
     ES2.Delete(dataFile);
 }
Beispiel #21
0
 public void SetVolume()
 {
     ES2.Save(_backgroundVolume.value, path + "?tag=backgroundVolume");
     _audio.volume = _backgroundVolume.value;
 }
 public void Load()
 {
     //On lance le coeur
     levelToLoad = ES2.Load <string>("savedScene");
     SceneManager.LoadScene(levelToLoad);
 }
 public void loadFromFile()
 {
     memories   = ES2.LoadList <MemoryObject>("merky.txt?tag=memories");
     gameStates = ES2.LoadList <GameState>("merky.txt?tag=states");
 }
Beispiel #24
0
 /*
  * This is where we save the Variables/Components of our prefab.
  */
 void SavePrefab(GameObject prefabToSave, int tag)
 {
     // Save the Transform of the prefab.
     ES2.Save(prefabToSave.transform, filename + "?tag=" + tag);
 }
Beispiel #25
0
 internal static void SaveToItem <T>(string tag, T value)
 {
     ES2.Save <T>(value, ItemsPath + "?tag=" + tag, new ES2Settings());
 }
Beispiel #26
0
    public static bool Load()
    {
        bool isFirstGame = true;

        if (ES2.Exists("GameInfo.txt?encrypt=true&password=fcde34ux6sj"))
        {
            isFirstGame = false;

            Debug.Log("~~~~Exists~~~~");

            ES2Data info = ES2.LoadAll("GameInfo.txt?encrypt=true&password=fcde34ux6sj");

            Debug.Log("~~~~topScore" + (info.TagExists("topScore")?" Exists~~~~":" None~~~~"));

            Debug.Log("~~~~theme" + (info.TagExists("theme")?" Exists~~~~":" None~~~~"));
            Debug.Log("~~~~tile" + (info.TagExists("tile")?" Exists~~~~":" None~~~~"));
            Debug.Log("~~~~background" + (info.TagExists("background")?" Exists~~~~":" None~~~~"));

            Debug.Log("~~~~unlocked" + (info.TagExists("unlocked")?" Exists~~~~":" None~~~~"));

            if (info.TagExists("currentLevel"))
            {
                currentLevel = info.Load <int> ("currentLevel");
            }
            // else
            // currentLevel = Resources.LoadAll<LevelData>("LevelData")[0].backupID;

            if (info.TagExists("topScoreLevels"))
            {
                topScoreLevels = info.LoadDictionary <int, int> ("topScoreLevels");
            }
            else
            {
                topScoreLevels = new Dictionary <int, int> ();
            }

            if (info.TagExists("topScore"))
            {
                topScore = info.Load <int> ("topScore");
            }
            else
            {
                topScore = 0;
            }

            if (info.TagExists("theme"))
            {
                currentTheme = info.Load <string> ("theme");
            }
            else
            {
                currentTheme = "original";
            }

            if (info.TagExists("tile"))
            {
                currentTile = info.Load <int> ("tile");
            }
            else
            {
                currentTile = 0;
            }

            if (info.TagExists("background"))
            {
                currentBackground = info.Load <int> ("background");
            }
            else
            {
                currentBackground = 0;
            }

            if (info.TagExists("unlocked"))
            {
                unlocks = info.LoadList <string> ("unlocked");
            }
            else
            {
                unlocks = new List <string> ()
                {
                    "original",
                    "colorblind",
                    "tile 1",
                    "wallpaper 1",
                }
            };
        }
        else
        {
            topScore          = 0;
            currentTheme      = "original";
            currentTile       = 0;
            currentBackground = 0;
            unlocks           = new List <string> ()
            {
                "original",
                "colorblind",
                "tile 1",
                "wallpaper 1",
            };
        }

        return(isFirstGame);
    }
Beispiel #27
0
        public static void VerifySave()
        {
            if (!File.Exists(SavePath))
            {
                return;
            }

            // Passenger bucket seat.
            // Check if driver bucket seat is bought and check the same for passenger one.
            // If they do not match, fix it.
            try
            {
                saveBugs = new List <SaveBugs>();

                bool bucketPassengerSeat = ES2.Load <bool>(SavePath + "?tag=bucket seat passenger(Clone)Purchased", setting);
                bool bucketDriverSeat    = ES2.Load <bool>(SavePath + "?tag=bucket seat driver(Clone)Purchased", setting);
                if (bucketDriverSeat != bucketPassengerSeat)
                {
                    saveBugs.Add(SaveBugs.New("Bucket Seats", "One bucket seat is present in the game world, while the other isn't - both should be in game world.", () =>
                    {
                        ES2.Save(true, SavePath + "?tag=bucket seat passenger(Clone)Purchased");
                        ES2.Save(true, SavePath + "?tag=bucket seat driver(Clone)Purchased");
                    }));
                }
            }
            catch (Exception e)
            {
                ExceptionManager.New(e, false, "VERIFY_SAVE_BUCKET_SEAT");
            }

            try
            {
                bool      tractorTrailerAttached = ES2.Load <bool>(SavePath + "?tag=TractorTrailerAttached", setting);
                Transform flatbedTransform       = ES2.Load <Transform>(SavePath + "?tag=FlatbedTransform", setting);
                Transform kekmetTransform        = ES2.Load <Transform>(SavePath + "?tag=TractorTransform", setting);
                if (tractorTrailerAttached && Vector3.Distance(flatbedTransform.position, kekmetTransform.position) > 5.5f)
                {
                    saveBugs.Add(SaveBugs.New("Flatbed Trailer Attached", "Trailer and tractor are too far apart from each other - impossible for them to be attached.", () =>
                    {
                        ES2.Save(false, SavePath + "?tag=TractorTrailerAttached", new ES2Settings());
                    }));
                }
            }
            catch (Exception ex)
            {
                ExceptionManager.New(ex, false, "VERIFY_SAVE_FLATBED");
            }

            try
            {
                // This one applies fix quietly, as it happens so often,
                // it would be annoying to nag player about that error.
                if (SaveFileExists)
                {
                    MopSaveData save = ModSave.Load <MopSaveData>(mopSavePath);
                    bool        bumperRearInstalled = ES2.Load <bool>(SavePath + "?tag=bumper rear(Clone)Installed", setting);
                    float       bumperTightness     = ES2.Load <float>(SavePath + "?tag=Bumper_RearTightness", setting);
                    if (bumperRearInstalled && bumperTightness != save.rearBumperTightness)
                    {
                        ES2.Save(save.rearBumperTightness, SavePath + "?tag=Bumper_RearTightness");
                        ES2.Save(save.rearBumperBolts, SavePath + "?tag=Bumper_RearBolts");
                    }
                }
            }
            catch (Exception ex)
            {
                ExceptionManager.New(ex, false, "VERIFY_BUMPER_REAR");
            }

            if (saveBugs.Count > 0)
            {
                ModPrompt.CreateYesNoPrompt($"MOP found <color=yellow>{saveBugs.Count}</color> problem{(saveBugs.Count > 1 ? "s" : "")} with your save:\n\n" +
                                            $"<color=yellow>{string.Join(", ", saveBugs.Select(f => f.BugName).ToArray())}</color>\n\n" +
                                            $"Would you like MOP to try and fix {((saveBugs.Count > 1) ? "them" : "it")}?", "MOP - Save Integrity Verification", FixAllProblems);
            }
            else
            {
                ModConsole.Log("[MOP] MOP didn't find any problems with your save :)");
            }
        }
Beispiel #28
0
 public static void SaveCurrentLevel(int levelID)
 {
     currentLevel = levelID;
     ES2.Save <int> (currentLevel, "GameInfo.txt?tag=currentLevel&encrypt=true&password=fcde34ux6sj");
 }
Beispiel #29
0
 public void Delete()
 {
     ES2.Delete(file);
 }
 /// <summary>
 /// Save a generic Param of T type with a tag
 /// </summary>
 /// <typeparam name="T">Type to be saved</typeparam>
 /// <param name="_key">The tag associated with the value to be saved</param>
 /// <param name="_param">The value of the param to save</param>
 /// <param name="_saveFile">The specific filename in which EasySave will write. Uses a default file if empty.</param>
 public void Save <T>(string _key, T _param, string _saveFile = "")
 {
     Debug.Log("Want to save " + _param + " as " + _key + " in " + _saveFile + " //// " + es2Settings.saveLocation);
     ES2.Save(_param, globalSavePath + "/" + GetFileSave_Name(_saveFile) + "?tag=" + _key, es2Settings);
 }