Ejemplo n.º 1
0
        public bool PlayerOffline(Player player)
        {
            if (!database.UpdataDataByUniqueID(player.UniqueID,
                                               new string[]
            {
                "Level", "EXP", "LastTakeCakeTime", "CakeCount"
            },
                                               new object[]
            {
                player.Level, player.EXP, player.LastTakeCakeTime, (player.FoodInfos.Count > 0) ? player.FoodInfos.First(x => x.food is Cake).count : 0
            }, "player"))
            {
                Log.ErrorFormat("error when player offline save player data to database");
            }
            AntGrowthProperties properties = player.Nests[0].GrowthProperties;
            string distributionMap1, distributionMap2, distributionMap3;

            player.Nests[0].Serialize3DistributionMap(out distributionMap1, out distributionMap2, out distributionMap3);
            if (!database.UpdataDataByID(player.UniqueID,
                                         new string[]
            {
                "Duration", "Speed", "Resistant", "Population", "Sensitivity", "DistributionMap1", "DistributionMap2", "DistributionMap3"
            },
                                         new object[]
            {
                properties.duration, properties.speed, properties.resistant, properties.population, properties.sensitivity, distributionMap1, distributionMap2, distributionMap3
            }, "nest", "PlayerID"))
            {
                Log.ErrorFormat("error when player offline save nest data to database");
            }
            return(playerManager.ErasePlayer(player));
        }
Ejemplo n.º 2
0
    private void OnNestPropertiesChangeAction(AntGrowthProperties properties)
    {
        levelText.text = string.Format("LV.{0}", properties.Level);

        durationText.text    = properties.duration.ToString();
        speedText.text       = properties.speed.ToString();
        resistantText.text   = properties.resistant.ToString();
        populationText.text  = properties.population.ToString();
        sensitivityText.text = properties.sensitivity.ToString();

        bool upgradable = NestLevelFoodTable.FoodForUpgrade(properties.Level) <= IANTGame.Player.CakeCount;

        durationButton.interactable    = upgradable && properties.duration <= 5;
        speedButton.interactable       = upgradable && properties.speed <= 5;
        resistantButton.interactable   = upgradable && properties.resistant <= 5;
        populationButton.interactable  = upgradable && properties.population <= 5;
        sensitivityButton.interactable = upgradable && properties.sensitivity <= 5;

        costText.text = NestLevelFoodTable.FoodForUpgrade(properties.Level).ToString();
    }