Esempio n. 1
0
        public static void LevelUp(this ILevelUpEvent self)
        {
            var gameSystem        = GameSystem.Instance;
            var levelUpCostRecord = gameSystem.MasterData.LevelUpCost.Records.Get(self.Id, self.Level);

            levelUpCostRecord.Cost.Consume(gameSystem.User, gameSystem.MasterData.Item);
            self.Level++;
            var record = gameSystem.MasterData.CellEvent.Records.Get(self.Id);

            gameSystem.User.History.GenerateCellEvent.Add(self.Id, self.Level - 1);

            // FIXME: 不要になったら削除する
            Broker.Global.Publish(RequestNotification.Get($"レベルアップ! {self.Level - 1} -> {self.Level}", NotificationUIElement.MessageType.Information));
        }
Esempio n. 2
0
        /// <summary>
        /// レベルアップ可能か返す
        /// </summary>
        public static bool CanLevelUp(this ILevelUpEvent self)
        {
            var gameSystem        = GameSystem.Instance;
            var levelUpCostRecord = gameSystem.MasterData.LevelUpCost.Records.Get(self.Id, self.Level);

            if (levelUpCostRecord == null)
            {
                // FIXME: 不要になったら削除する
                Broker.Global.Publish(RequestNotification.Get($"最大レベルです!", NotificationUIElement.MessageType.Error));
                return(false);
            }

            if (!levelUpCostRecord.Cost.IsEnough(gameSystem.User, gameSystem.MasterData.Item))
            {
                // FIXME: 不要になったら削除する
                Broker.Global.Publish(RequestNotification.Get($"素材が足りません!", NotificationUIElement.MessageType.Error));
                return(false);
            }

            return(true);
        }