Exemplo n.º 1
0
    public static void Guardar()
    {
        DataGuardadoJSON datosGuardado = new DataGuardadoJSON();

        datosGuardado.listaNivel  = GameManager.Instance.ListaNiveles;
        datosGuardado.habilidades = GameManager.Instance.Habilidades;

        string datos = JsonUtility.ToJson(datosGuardado);

        File.WriteAllText(Carpeta_Guardado + slots[indiceSlot] + ".txt", datos);

        ListaHabilidades habilidades = GameManager.Instance.Habilidades;

        Debug.Log("guardando");
        GameManager.Instance.MostrarSaveIcon = true;

        if (File.Exists(Carpeta_Guardado + "slotsData.txt"))
        {
            string json = File.ReadAllText(Carpeta_Guardado + "slotsData.txt");

            dataSlots = JsonUtility.FromJson <DataSlots>(json);
        }

        SaveSlotsData();
        timeToIgnore = Time.time;
    }
Exemplo n.º 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BattleLog"/> class.
 /// </summary>
 public BattleLog()
 {
     this.Loot        = new ResourceSlots();
     this.Units       = new DataSlots();
     this.Spells      = new DataSlots();
     this.CastleUnits = new DataSlots();
     this.Levels      = new DataSlots();
 }
Exemplo n.º 3
0
 internal void DeployCastleUnits(DataSlots Units)
 {
     Units.ForEach(Slot =>
     {
         if (Slot.Count > 0)
         {
             this.CastleUnits.Add(Slot.Data, Slot.Count);
             this.DeployedHousingSpace += ((CharacterData)Slot.Data).HousingSpace * Slot.Count;
         }
     });
 }
Exemplo n.º 4
0
        public static TValue Get <TKey, TValue>(TKey key)
        {
            DataSlots <TKey, TValue> dataSlots = SingletonHelper.GetSessionSingleton <DataSlots <TKey, TValue> >();

            if (dataSlots.ContainsKey(key))
            {
                return(dataSlots[key]);
            }

            return(default(TValue));
        }
Exemplo n.º 5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Player"/> class.
        /// </summary>
        internal Player()
        {
            this.AchievementsClaimed = new List <Data>(50);

            this.Resources             = new ResourceSlots();
            this.AchievementProgresses = new DataSlots();

            this.Facebook   = new Facebook(this);
            this.Google     = new Google(this);
            this.Gamecenter = new Gamecenter(this);

            this.Home = new Home(this);

            this.Initialize();
        }
Exemplo n.º 6
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Player"/> class.
        /// </summary>
        internal Player()
        {
            this.Time = new Time();

            this.EnergyTimer = new Timer(this.Time);

            this.Achievements = new List <int>(50);

            this.AchievementProgress = new DataSlots(this);
            this.ItemInventories     = new DataSlots(this);
            this.Resources           = new ResourceSlots(this);
            this.Spells           = new DataSlots(this);
            this.HeroLevels       = new HeroLevelSlots(this);
            this.NpcProgress      = new DataSlots(this);
            this.Variables        = new DataSlots(this);
            this.EnergyPackages   = new DataSlots(this, 2);
            this.HeroUnlockSeens  = new DataSlots(this);
            this.QuestUnlockSeens = new DataSlots(this);
            this.Extras           = new DataSlots(this);

            this.Facebook   = new Facebook(this);
            this.Google     = new Google(this);
            this.Gamecenter = new Gamecenter(this);

            this.HeroUpgrade = new HeroUpgrade(this);

            // Initialize.

            this.Diamonds         = GameSettings.StartingDiamonds;
            this.OngoingQuestData = GameSettings.StartingQuest.GlobalID;

            this.HeroLevels.Initialize();
            this.Resources.Initialize();

            // DEBUG

            this.Resources.Set(2000003, 1000);
            this.Resources.Set(2000004, 1000);
            this.Resources.Set(2000005, 1000);

            foreach (QuestData Data in CSV.Tables.Get(Gamefile.Quests).Datas)
            {
                if (Data.QuestType == "Unlock")
                {
                    this.NpcProgress.AddItem(Data.GlobalID, 1);
                }
            }
        }
Exemplo n.º 7
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PlayerBase"/> class.
        /// </summary>
        public PlayerBase()
        {
            this.AchievementProgress = new DataSlots();
            this.ResourceCaps        = new DataSlots();
            this.Resources           = new ResourceSlots();
            this.Units         = new UnitSlots();
            this.Units2        = new UnitSlots();
            this.Spells        = new DataSlots();
            this.UnitUpgrades  = new DataSlots();
            this.SpellUpgrades = new DataSlots();
            this.HeroUpgrades  = new DataSlots();
            this.AllianceUnits = new AllianceUnitSlots();

            this.NpcMapProgress  = new NpcMapSlots();
            this.NpcLootedGold   = new DataSlots();
            this.NpcLootedElixir = new DataSlots();

            this.Variables = new DataSlots();
        }
Exemplo n.º 8
0
    public static void Incializar()
    {
        if (!Directory.Exists(Carpeta_Guardado))
        {
            Directory.CreateDirectory(Carpeta_Guardado);
        }

        if (File.Exists(Carpeta_Guardado + "slotsData.txt"))
        {
            string json = File.ReadAllText(Carpeta_Guardado + "slotsData.txt");
            dataSlots = JsonUtility.FromJson <DataSlots>(json);
        }
        else
        {
            string datos = JsonUtility.ToJson(dataSlots);
            File.WriteAllText(Carpeta_Guardado + "slotsData.txt", datos);
        }

        CargarPlayerPrefs();
    }
Exemplo n.º 9
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Player"/> class.
        /// </summary>
        internal Player()
        {
            this.Home = new Home(this, this.HighID, this.LowID);

            this.Units                        = new UnitList(this);
            this.NpcSeens                     = new DataSlots <Item>(this);
            this.Resources                    = new ResourceSlots(this);
            this.HeroSeens                    = new DataSlots <Item>(this);
            this.HeroStatus                   = new DataSlots <Item>(this);
            this.SectorBonuses                = new DataSlots <Item>(this);
            this.SpellUpgrades                = new DataSlots <Item>(this);
            this.UnitUpgrades                 = new DataSlots <Item>(this);
            this.TrapUpgrades                 = new DataSlots <Item>(this);
            this.SectorLevels                 = new DataSlots <Item>(this);
            this.ResourceCaps                 = new DataSlots <Item>(this);
            this.HeroUpgrades                 = new DataSlots <Item>(this);
            this.BuildingLevels               = new DataSlots <Item>(this);
            this.ArtifactBonuses              = new DataSlots <Item>(this);
            this.HeroAbilitySeens             = new DataSlots <Item>(this);
            this.SectorBoostLevels            = new DataSlots <Item>(this);
            this.LandingBoatLevels            = new DataSlots <Item>(this);
            this.SectorBonusFilter            = new DataSlots <Item>(this);
            this.HeroSelectedAbilities        = new DataSlots <Item>(this);
            this.AchievementProgresses        = new DataSlots <Item>(this);
            this.BottleChainProgresses        = new DataSlots <Item>(this);
            this.SubscriptionExpirationTimes  = new DataSlots <Item>(this);
            this.ResourcesConvertedToSupplies = new DataSlots <Item>(this);

            this.MissionCompleted   = new List <int>(64);
            this.AchievementClaimed = new List <int>(64);

            this.PlayerMap = new PlayerMap(this);

            this.Facebook   = new Facebook(this);
            this.Google     = new Google(this);
            this.Gamecenter = new Gamecenter(this);
        }
Exemplo n.º 10
0
        public static void Set <TKey, TValue>(TKey key, TValue value)
        {
            DataSlots <TKey, TValue> dataSlots = SingletonHelper.GetSessionSingleton <DataSlots <TKey, TValue> >();

            dataSlots.Add(key, value);
        }