Пример #1
0
            public static COutPacket UserQuestResult(QuestResultType op, QuestEntry pQuest, int nNpcTemplateId = 0, short usNextQuestID = 0)
            {
                var p = new COutPacket(SendOps.LP_UserQuestResult);

                p.Encode1(op);

                switch (op)
                {
                case QuestResultType.Failed_Equipped:
                case QuestResultType.Failed_Meso:
                case QuestResultType.Failed_OnlyItem:
                case QuestResultType.Failed_Unknown:
                    return(p);

                case QuestResultType.Failed_Inventory:
                case QuestResultType.Reset_QuestTimer:
                case QuestResultType.Failed_TimeOver:
                    p.Encode2(pQuest.nQuestID);
                    return(p);

                case QuestResultType.Success:
                    p.Encode2(pQuest.nQuestID);
                    p.Encode4(nNpcTemplateId);
                    p.Encode2(usNextQuestID);                             // 0 if no next
                    break;
                }

                return(p);
            }
        public void Initialize(QuestResultType type, QuestGroupModel questGroup, QuestModel quest, int starCount, int score, bool isNoticeMax)
        {
            this.type          = type;
            this.questGroup    = questGroup;
            this.quest         = quest;
            this.starCount     = starCount;
            this.score         = score;
            this.isNoticeMax   = isNoticeMax;
            this.opneInfo.text = "";

            if (CanUpdateScore(score, quest, type))
            {
                // 開放状況の設定
                SetOpenInfo();

                // 値のセット
                var playerQuestRepository = new PlayerQuestRepository();
                var playerQuestModel      = playerQuestRepository.Get(quest.ID);

                playerQuestModel.CurrentStarNum = starCount;
                playerQuestModel.CurrentScore   = score;
                playerQuestRepository.Set(playerQuestModel);
            }

            // 結果によって変えてもいいかも
            SoundManager.Instance.PlayBgm("kodoku");
        }
        private static bool CanUpdateScore(int nextScore, QuestModel model, QuestResultType type)
        {
            if (type == QuestResultType.Fail)
            {
                return(false);
            }

            var playerQuestRepository = new PlayerQuestRepository();
            var playerQuestModel      = playerQuestRepository.Get(model.ID);

            return(playerQuestModel.CurrentScore < nextScore);
        }
 public QuestResultSceneParameter(
     CharacterModel character,
     QuestGroupModel questGroup,
     QuestModel quest,
     int score,
     int starCount,
     QuestResultType resultType)
 {
     this.Chracter   = character;
     this.QuestGroup = questGroup;
     this.Quest      = quest;
     this.Score      = score;
     this.StarCount  = starCount;
     this.resultType = resultType;
 }