コード例 #1
0
 public static StatsModel Aggregate(Save savegame)
 {
     var stats = new SaveStats(savegame);
     var regiments = stats.WorldRegiments();
     var ships = stats.WorldShips();
     return new StatsModel()
     {
         Player = savegame.Player,
         Players = string.Join(", ", 
             (savegame.Countries ?? Enumerable.Empty<Country>()).Where(x =>
             x.WasPlayer.GetValueOrDefault()).Select(x => x.Abbreviation)),
         PlayerCountries = stats.PlayerStats(),
         Date = savegame.Date,
         Manpower = stats.WorldManpower(),
         PotentialManpower = stats.MaxWorldManpower(),
         LeaderReport = stats.LeaderReport(),
         BiggestNavalWars = stats.NavalWarReport().Take(10),
         BiggestLandWars = stats.LandWarReport().Take(10),
         BiggestLandBattles = stats.LandBattleReport().Take(10),
         BiggestNavalBattles = stats.NavalBattleReport().Take(10),
         BiggestRivalries = stats.CommanderRivalries().Take(10),
         CountryMilitaryStats = stats.CountryKillsAndLosses().Take(10),
         LedgerCorrelations = stats.LedgerCorrelations(),
         ScoreStats = stats.ScoreRankings().Where(x => x.rank <= 10 || stats.IsPlayer(x.name)),
         Debt = stats.CountryDebts().Take(10),
         TradePower = stats.CountryTradeReport().Take(10),
         RegimentCount = regiments.Item1,
         RegimentSum = regiments.Item2,
         ShipCount = ships.Item1,
         ShipSum = ships.Item2
     };
 }
コード例 #2
0
    static public void ChangeLevel(bool increment, int level)
    {
        //If you just want to increment the level, then ChangeLevel(true, 1);
        //If you want to go to a specific level, then ChangeLevel(false, #oflevelyouwant );
        player = GameObject.FindGameObjectWithTag("Player");
        if (increment)
        {
            levelNum++;
        }
        else
        {
            levelNum = level;
        }

        SaveStats.saveStats(player.GetComponentInChildren <PlayerInfo> ().Health,
                            player.GetComponentInChildren <PlayerInfo> ().Energy,
                            0);

        //Checking if you hit the final level
        if (levelNum >= FinalLevelNum)
        {
            Application.LoadLevel(FinalLevelName);              //Or replace with the name
        }
        else
        {
            Application.LoadLevel(levelNum);                    //If we only have 1 level that we keep reusing, Replace with levelNum in the future or specific level names
            //Application.LoadLevel(levelNum);	//What it should actually be (only if we have multiple levels that don't get reused)
        }
    }
コード例 #3
0
ファイル: Manager.cs プロジェクト: Marcinsirant/angryBall
 void Start()
 {
     ballBought = new List <int>();
     ballHitPlatformAudioSource = GetComponent <AudioSource>();
     stats               = new int[4];
     statsDate           = new string[4];
     menuPanelController = GameObject.Find("MenuPanel");
     // load data
     if (SaveSystem.LoadDataPlayer() != null)
     {
         SaveStats stats = SaveSystem.LoadDataPlayer();
         statsDate  = stats.statsDate;
         this.stats = stats.stats;
         coin       = stats.coin;
         ballBought = stats.ballsBought;
         CurrentBall.numberOfList = stats.nomberOfCurrentBall;
         coinText.SetText(coin.ToString());
     }
     else
     {
         coin = 0;
         ballBought.Add(0);
         CurrentBall.numberOfList = 0;
     }
     Time.timeScale    = 0;
     level             = 0;
     joystickActivated = true;
     joysticktLeft     = GameObject.Find("JoystickLeft");
     joystickRight     = GameObject.Find("JoystickRight");
     menuPanelController.GetComponent <MenuPanelController>().setStats(this.stats, statsDate);
 }
コード例 #4
0
 public void ResumeGame()
 {
     paused = false;
     PlayerStatus.GetComponent <Player2DController>().paused = false;
     SaveStats.ResetHealth();
     UI_GameOver.SetActive(false);
     Time.timeScale = 1.0f;
 }
コード例 #5
0
 void Awake()
 {
     Health = SaveStats.GetPlayerHealth();
     Energy = SaveStats.GetPlayerEnergy();
     UpdateEnergyBar();
     healthBar.value = Health;
     healthNum.text  = Health.ToString();
     InvokeRepeating("RegenerateEnergy", 1, 10.0f);
 }
コード例 #6
0
 void RunGameOver()
 {
     SaveStats.ResetHealth();
     DeathPrefSet     = true;
     MainComment.text = "Game Over";
     comment.text     = GameOverComment(d);
     Time.timeScale   = 0.0f;        //Pauses the game
     UI_GameOver.SetActive(true);    //Makes Gameover UI visible
 }
コード例 #7
0
 void Start()
 {
     if (instance)
     {
         Destroy(gameObject);                        //Destroy if there is a SaveStats loaded
     }
     else
     {
         instance = this;
         DontDestroyOnLoad(gameObject);      //Keep from deleting this gameObject when loading a new scene
     }
 }
コード例 #8
0
    public static void SaveDataPlayer(int[] saveStats, string[] saveStatsDate, int coin, List <int> ballsBought, int nomberOfCurrentBall)
    {
        BinaryFormatter formatter = new BinaryFormatter();
        string          path      = Application.persistentDataPath + "/player.properties";
        FileStream      stream    = new FileStream(path, FileMode.Create);

        SaveStats data = new SaveStats(saveStats, saveStatsDate, coin, ballsBought, nomberOfCurrentBall);

        formatter.Serialize(stream, data);

        stream.Close();
    }
コード例 #9
0
ファイル: HeroStats.cs プロジェクト: FriscoeHotsauce/HeroesTD
 //b o i l e r p l a t e
 public void loadStats(SaveStats saveStats)
 {
     this.Health      = saveStats.health;
     this.Attack      = saveStats.attack;
     this.Magic       = saveStats.magic;
     this.Defense     = saveStats.defense;
     this.Resistance  = saveStats.resistance;
     this.Agility     = saveStats.agility;
     this.Experience  = saveStats.experience;
     this.Block       = saveStats.block;
     this.Range       = saveStats.range;
     this.Cost        = saveStats.cost;
     this.Level       = saveStats.level;
     this.currentXp   = saveStats.currentXp;
     this.nextLevelXp = saveStats.nextLevelXp;
 }
コード例 #10
0
        public void ReadJsonDeserialize(string fileName, IPlayer _context, DateTime date)
        {
            if (!File.Exists(fileName))
            {
                return;
            }
            int       i           = 0;
            int       j           = 0;
            SaveStats playerStats = new SaveStats();

            try
            {
                Rootobject rootObject = JsonConvert.DeserializeObject <Rootobject>(File.ReadAllText(fileName));
                foreach (var p in rootObject.cumulativeplayerstats.playerstatsentry)
                {
                    System.Diagnostics.Debug.Write("#: " + i++ + " Id: " + p.player.ID + " " + p.player.LastName);
                    //First check to see if the player is in the Player table
                    SalaryCapData.Data.Models.Player player = _context.Get(Convert.ToInt32(p.player.ID));
                    if (player == null)
                    {
                        continue;
                    }



                    System.Diagnostics.Debug.Write(" " + j++ + " Saved ");
                    if (p.player.Position == "P")
                    {
                        BuildPitcherStatModel(Convert.ToInt32(p.player.ID), p.stats, _context, date);
                    }
                    else
                    {
                        BuildHitterMStatModel(Convert.ToInt32(p.player.ID), p.stats, _context, date);
                    }

                    System.Diagnostics.Debug.WriteLine("\n");
                }
            }
            catch (Exception ex)
            {
                string errorMessage = string.Format("Error saving player stats: " + ex);
                System.Diagnostics.Debug.WriteLine(errorMessage);
                log.Info(errorMessage);
            }
            System.Diagnostics.Debug.WriteLine(i + " Cumulative Records Read.  " + j + " Saved.  Delta: " + (i - j));
        }
コード例 #11
0
ファイル: Chekpoint.cs プロジェクト: Elm0D/JuperFly
    void OnTriggerEnter2D(Collider2D other)
    {
        if (other.gameObject.CompareTag("Player"))
        {
//			Debug.Log("Save Position");
            RT = other.gameObject.GetComponentInChildren <RectTransform>();
            SaveStats savePosition = new SaveStats();
            savePosition.SaveStatistik(RT.position);
            if (gameObject.GetComponent <SpawnManeger>())
            {
                gameObject.GetComponent <SpawnManeger>().enabled = true;
            }
            if (gameObject.GetComponent <SpawnManeger1>())
            {
                gameObject.GetComponent <SpawnManeger1>().enabled = true;
            }
        }
    }
コード例 #12
0
ファイル: TaskManeger.cs プロジェクト: Elm0D/JuperFly
    public void TakeExit()
    {
        if (numTask > 1)
        {
            SaveStats ss = new SaveStats();
            ss.SaveStatistik(numTask.ToString(), "NumberTask");
        }
        Shop shop = poolr.shop;

        shop.simplePC.enabled = !shop.simplePC.enabled;

        poolr.GameCanvas.gameObject.SetActive(!poolr.GameCanvas.gameObject.activeSelf);
        //poolr.TaskCanvas.gameObject.SetActive(!poolr.TaskCanvas.gameObject.activeSelf);
        PoolReference.TableScene[EnumInPool.TaskCanvas.ToString()].SetActive(
            !PoolReference.TableScene[EnumInPool.TaskCanvas.ToString()].activeSelf
            );
        //Debug.Log ("TakeExit()");
    }
コード例 #13
0
    public static SaveStats LoadDataPlayer()
    {
        string path = Application.persistentDataPath + "/player.properties";

        if (File.Exists(path))
        {
            BinaryFormatter formatter = new BinaryFormatter();
            FileStream      stream    = new FileStream(path, FileMode.Open);

            SaveStats data = formatter.Deserialize(stream) as SaveStats;
            stream.Close();
            return(data);
        }
        else
        {
            Debug.Log("null data");
            return(null);
        }
    }
コード例 #14
0
    public void SaveStatus()
    {
        try
        {
            coinText = PoolReference.TableScene[EnumInPool.CoinText.ToString()].GetComponent <Text>();
            flyText  = PoolReference.TableScene[EnumInPool.BonusFlyText.ToString()].GetComponent <Text>();
            tm       = PoolReference.TableScene[EnumInPool.TaskCanvas.ToString()].GetComponent <TaskManeger>();

            SaveStats ss = new SaveStats();
            ss.SaveStatistik(coinText.text, "Coin");

            ss.SaveStatistik(flyText.text, "Fly");
            if (tm.numTask > 1)
            {
                ss.SaveStatistik(tm.numTask.ToString(), "NumberTask");
            }

            Debug.Log("Save Complite");
        } catch { }
        PoolReference.TableScene.Clear(); //Очистка ключей
    }
コード例 #15
0
 void OnApplicationQuit()                                    //Ensure that the instance is destroyed when the game is stopped in the editor.
 {
     instance = null;
 }
コード例 #16
0
    static public SaveStats instance;                           //SaveStats is a singleton.	 SaveStats.instance.DoSomeThing();

    void Awake()
    {
        instance = this;
    }
コード例 #17
0
        private void OnSaveSlotButtonPresentSaveSlot(On.UnityEngine.UI.SaveSlotButton.orig_PresentSaveSlot orig, UnityEngine.UI.SaveSlotButton self, SaveStats saveStats)
        {
            SaveSlotBackgrounds ssbg = self.saveSlots;

            if (cabgSprite != null)
            {
                bool present = false;
                foreach (var ab in ssbg.areaBackgrounds)
                {
                    present = present || ((ab.areaName != (GlobalEnums.MapZone)CUSTOM_MAPZONE) || !(ab.backgroundImage.Equals(cabgSprite)));
                }
                if (present)
                {
                    AreaBackground[] customAreaBackgrounds = new AreaBackground[ssbg.areaBackgrounds.Length + 1];
                    ssbg.areaBackgrounds.CopyTo(customAreaBackgrounds, 1);
                    customAreaBackgrounds[0] = new AreaBackground
                    {
                        areaName        = (GlobalEnums.MapZone)CUSTOM_MAPZONE,
                        backgroundImage = cabgSprite
                    };
                    ssbg.areaBackgrounds = customAreaBackgrounds;
                }
            }

            orig(self, saveStats);
        }
コード例 #18
0
    public void LoadStats()
    {
        var Equipo = EquipoPokemon.instance.equipoPokemon;

        SaveStats FirstSlot  = JsonUtility.FromJson <SaveStats>(readFileOne);
        SaveStats SecondSlot = JsonUtility.FromJson <SaveStats>(readFileTwo);
        SaveStats ThirdSlot  = JsonUtility.FromJson <SaveStats>(readFileThird);
        SaveStats FourthSlot = JsonUtility.FromJson <SaveStats>(readFileFourth);
        SaveStats FiveSlot   = JsonUtility.FromJson <SaveStats>(readFileFive);
        SaveStats SixSlot    = JsonUtility.FromJson <SaveStats>(readFileSix);

        //HP Load Stats
        if (Equipo.Count >= 1)
        {
            hpTotal[0]              = FirstSlot.hpTotal;
            ataqueTotal[0]          = FirstSlot.ataqueTotal;
            ataqueEspecialTotal[0]  = FirstSlot.ataqueEspecialTotal;
            defensaTotal[0]         = FirstSlot.defensaTotal;
            defensaEspecialTotal[0] = FirstSlot.defensaEspecialTotal;
            velocidadTotal[0]       = FirstSlot.velocidadTotal;
            nivel[0] = FirstSlot.nivel;
        }

        if (Equipo.Count >= 2)
        {
            hpTotal[1]              = SecondSlot.hpTotal;
            ataqueTotal[1]          = SecondSlot.ataqueTotal;
            ataqueEspecialTotal[1]  = SecondSlot.ataqueEspecialTotal;
            defensaTotal[1]         = SecondSlot.defensaTotal;
            defensaEspecialTotal[1] = SecondSlot.defensaEspecialTotal;
            velocidadTotal[1]       = SecondSlot.velocidadTotal;
            nivel[1] = SecondSlot.nivel;
        }

        if (Equipo.Count >= 3)
        {
            hpTotal[2]              = ThirdSlot.hpTotal;
            ataqueTotal[2]          = ThirdSlot.ataqueTotal;
            ataqueEspecialTotal[2]  = ThirdSlot.ataqueEspecialTotal;
            defensaTotal[2]         = ThirdSlot.defensaTotal;
            defensaEspecialTotal[2] = ThirdSlot.defensaEspecialTotal;
            velocidadTotal[2]       = ThirdSlot.velocidadTotal;
            nivel[2] = ThirdSlot.nivel;
        }

        if (Equipo.Count >= 4)
        {
            hpTotal[3]              = FourthSlot.hpTotal;
            ataqueTotal[3]          = FourthSlot.ataqueTotal;
            ataqueEspecialTotal[3]  = FourthSlot.ataqueEspecialTotal;
            defensaTotal[3]         = FourthSlot.defensaTotal;
            defensaEspecialTotal[3] = FourthSlot.defensaEspecialTotal;
            velocidadTotal[3]       = FourthSlot.velocidadTotal;
            nivel[3] = FourthSlot.nivel;
        }

        if (Equipo.Count >= 5)
        {
            hpTotal[4]              = FiveSlot.hpTotal;
            ataqueTotal[4]          = FiveSlot.ataqueTotal;
            ataqueEspecialTotal[4]  = FiveSlot.ataqueEspecialTotal;
            defensaTotal[4]         = FiveSlot.defensaTotal;
            defensaEspecialTotal[4] = FiveSlot.defensaEspecialTotal;
            velocidadTotal[4]       = FiveSlot.velocidadTotal;
            nivel[4] = FiveSlot.nivel;
        }

        if (Equipo.Count >= 6)
        {
            hpTotal[5]              = SixSlot.hpTotal;
            ataqueTotal[5]          = SixSlot.ataqueTotal;
            ataqueEspecialTotal[5]  = SixSlot.ataqueEspecialTotal;
            defensaTotal[5]         = SixSlot.defensaTotal;
            defensaEspecialTotal[5] = SixSlot.defensaEspecialTotal;
            velocidadTotal[5]       = SixSlot.velocidadTotal;
            nivel[5] = SixSlot.nivel;
        }
    }
コード例 #19
0
    public void SaveStats()
    {
        var       Equipo     = EquipoPokemon.instance.equipoPokemon;
        SaveStats FirstSlot  = JsonUtility.FromJson <SaveStats>(readFileOne);
        SaveStats SecondSlot = JsonUtility.FromJson <SaveStats>(readFileTwo);
        SaveStats ThirdSlot  = JsonUtility.FromJson <SaveStats>(readFileThird);
        SaveStats FourthSlot = JsonUtility.FromJson <SaveStats>(readFileFourth);
        SaveStats FiveSlot   = JsonUtility.FromJson <SaveStats>(readFileFive);
        SaveStats SixSlot    = JsonUtility.FromJson <SaveStats>(readFileSix);

        //Stats
        calcularHP();
        calcularAtaque();
        calcularAtaqueEspecial();
        calcularDefensa();
        calcularDefensaEspecial();
        calcularVelocidad();
        calcularSiguienteNivel();

        //FirstSlot
        if (Equipo.Count >= 1)
        {
            FirstSlot.hpTotal              = hpTotal[0];
            FirstSlot.ataqueTotal          = ataqueTotal[0];
            FirstSlot.ataqueEspecialTotal  = ataqueEspecialTotal[0];
            FirstSlot.defensaTotal         = defensaTotal[0];
            FirstSlot.defensaEspecialTotal = defensaEspecialTotal[0];
            FirstSlot.velocidadTotal       = velocidadTotal[0];
            FirstSlot.experienciaSiguiente = experienciaSiguiente[0];
            FirstSlot.nivel          = nivel[0];
            FirstSlot.siguienteNivel = siguienteNivel[0];

            var WriteOne = JsonUtility.ToJson(FirstSlot);
            File.WriteAllText(filePathOne, WriteOne);
        }

        //SecondSlot
        if (Equipo.Count >= 2)
        {
            SecondSlot.hpTotal              = hpTotal[1];
            SecondSlot.ataqueTotal          = ataqueTotal[1];
            SecondSlot.ataqueEspecialTotal  = ataqueEspecialTotal[1];
            SecondSlot.defensaTotal         = defensaTotal[1];
            SecondSlot.defensaEspecialTotal = defensaEspecialTotal[1];
            SecondSlot.velocidadTotal       = velocidadTotal[1];
            SecondSlot.experienciaSiguiente = experienciaSiguiente[1];
            SecondSlot.nivel          = nivel[1];
            SecondSlot.siguienteNivel = siguienteNivel[1];

            var WriteTwo = JsonUtility.ToJson(SecondSlot);
            File.WriteAllText(filePathTwo, WriteTwo);
        }

        //ThirdSlot
        if (Equipo.Count >= 3)
        {
            ThirdSlot.hpTotal              = hpTotal[2];
            ThirdSlot.ataqueTotal          = ataqueTotal[2];
            ThirdSlot.ataqueEspecialTotal  = ataqueEspecialTotal[2];
            ThirdSlot.defensaTotal         = defensaTotal[2];
            ThirdSlot.defensaEspecialTotal = defensaEspecialTotal[2];
            ThirdSlot.velocidadTotal       = velocidadTotal[2];
            ThirdSlot.experienciaSiguiente = experienciaSiguiente[2];
            ThirdSlot.nivel          = nivel[2];
            ThirdSlot.siguienteNivel = siguienteNivel[2];

            var WriteThird = JsonUtility.ToJson(ThirdSlot);
            File.WriteAllText(filePathThird, WriteThird);
        }

        //FourthSlot
        if (Equipo.Count >= 4)
        {
            FourthSlot.hpTotal              = hpTotal[3];
            FourthSlot.ataqueTotal          = ataqueTotal[3];
            FourthSlot.ataqueEspecialTotal  = ataqueEspecialTotal[3];
            FourthSlot.defensaTotal         = defensaTotal[3];
            FourthSlot.defensaEspecialTotal = defensaEspecialTotal[3];
            FourthSlot.velocidadTotal       = velocidadTotal[3];
            FourthSlot.experienciaSiguiente = experienciaSiguiente[3];
            FourthSlot.nivel          = nivel[3];
            FourthSlot.siguienteNivel = siguienteNivel[3];

            var WriteFourth = JsonUtility.ToJson(FourthSlot);
            File.WriteAllText(filePathFourth, WriteFourth);
        }

        //FiveSlot
        if (Equipo.Count >= 5)
        {
            FiveSlot.hpTotal              = hpTotal[4];
            FiveSlot.ataqueTotal          = ataqueTotal[4];
            FiveSlot.ataqueEspecialTotal  = ataqueEspecialTotal[4];
            FiveSlot.defensaTotal         = defensaTotal[4];
            FiveSlot.defensaEspecialTotal = defensaEspecialTotal[4];
            FiveSlot.velocidadTotal       = velocidadTotal[4];
            FiveSlot.experienciaSiguiente = experienciaSiguiente[4];
            FiveSlot.nivel          = nivel[4];
            FiveSlot.siguienteNivel = siguienteNivel[4];

            var WriteFive = JsonUtility.ToJson(FiveSlot);
            File.WriteAllText(filePathFive, WriteFive);
        }

        //SixSlot
        if (Equipo.Count >= 6)
        {
            SixSlot.hpTotal              = hpTotal[5];
            SixSlot.ataqueTotal          = ataqueTotal[5];
            SixSlot.ataqueEspecialTotal  = ataqueEspecialTotal[5];
            SixSlot.defensaTotal         = defensaTotal[5];
            SixSlot.defensaEspecialTotal = defensaEspecialTotal[5];
            SixSlot.velocidadTotal       = velocidadTotal[5];
            SixSlot.experienciaSiguiente = experienciaSiguiente[5];
            SixSlot.nivel          = nivel[5];
            SixSlot.siguienteNivel = siguienteNivel[5];

            var WriteSix = JsonUtility.ToJson(SixSlot);
            File.WriteAllText(filePathSix, WriteSix);
        }
    }
コード例 #20
-1
ファイル: TaskManeger.cs プロジェクト: Antis28/JuperFly
    public void TakeExit()
    {
        if (numTask > 1)
        {
            SaveStats ss = new SaveStats();
            ss.SaveStatistik(numTask.ToString(), "NumberTask");
        }
        Shop shop = poolr.shop;
        shop.simplePC.enabled = !shop.simplePC.enabled;

        poolr.GameCanvas.gameObject.SetActive(!poolr.GameCanvas.gameObject.activeSelf);
        //poolr.TaskCanvas.gameObject.SetActive(!poolr.TaskCanvas.gameObject.activeSelf);
        PoolReference.TableScene[EnumInPool.TaskCanvas.ToString()].SetActive(
                                 !PoolReference.TableScene[EnumInPool.TaskCanvas.ToString()].activeSelf
                                                                            );
        //Debug.Log ("TakeExit()");
    }
コード例 #21
-1
ファイル: InputManeger.cs プロジェクト: Antis28/JuperFly
    public void SaveStatus()
    {
        try
        {
            coinText = PoolReference.TableScene[EnumInPool.CoinText.ToString()].GetComponent<Text>();
            flyText = PoolReference.TableScene[EnumInPool.BonusFlyText.ToString()].GetComponent<Text>();
            tm = PoolReference.TableScene[EnumInPool.TaskCanvas.ToString()].GetComponent<TaskManeger>();

        SaveStats ss = new SaveStats();
        ss.SaveStatistik( coinText.text, "Coin" );

        ss.SaveStatistik( flyText.text, "Fly" );
        if( tm.numTask > 1 )
            ss.SaveStatistik( tm.numTask.ToString(), "NumberTask" );

        Debug.Log( "Save Complite" );
        } catch { }
        PoolReference.TableScene.Clear(); //Очистка ключей
    }