Esempio n. 1
0
        /// <summary>
        /// 检查传入的对话组是否已经完成全部交谈的话
        /// </summary>
        /// <returns><c>true</c>, if dialog group finished was checked, <c>false</c> otherwise.</returns>
        /// <param name="dialogGroup">Dialog group.</param>
        public bool CheckDialogGroupFinished(HLHDialogGroup dialogGroup)
        {
            bool dialogGroupFinished = false;

            List <HLHNPCChatRecord> dialogRecords = GameManager.Instance.gameDataCenter.chatRecords;

            for (int i = 0; i < dialogRecords.Count; i++)
            {
                HLHNPCChatRecord dialogRecord = dialogRecords[i];

                if (dialogRecord.npcId == npcId && dialogRecord.npcDialogGroupID == dialogGroup.dialogGroupId)
                {
                    dialogGroupFinished = true;
                    break;
                }
            }

            return(dialogGroupFinished);
        }
Esempio n. 2
0
        public void NextDialog()
        {
            if (dialogHasFinished)
            {
                return;
            }

            int nextDialogId = ++currentDialogId;

            if (nextDialogId < dialogGroup.dialogs.Count)
            {
                HLHDialog dialog = dialogGroup.dialogs[nextDialogId];

                dialogText.text = dialog.dialogContent;

                return;
            }

            if (dialogGroup.isRewardTriggered)
            {
                HLHNPCReward reward = dialogGroup.reward;

                switch (reward.rewardType)
                {
                case HLHRewardType.Gold:
                    int goldReward = reward.rewardValue;
                    Player.mainPlayer.totalGold += goldReward;
                    tintHUD.SetUpGoldTintHUD(goldReward);
                    break;

                case HLHRewardType.Item:
                    Item rewardItem = Item.NewItemWith(reward.rewardValue, reward.attachValue);

                    if (rewardItem.itemType == ItemType.Equipment)
                    {
                        Equipment equipment = rewardItem as Equipment;

                        if (equipment.defaultQuality.Equals(EquipmentDefaultQuality.Random))
                        {
                            equipment.ResetPropertiesByQuality(EquipmentQuality.Gray);
                        }
                    }

                    ExploreManager.Instance.newMapGenerator.SetUpRewardInMap(rewardItem, ExploreManager.Instance.battlePlayerCtr.transform.position);

                    if (!Player.mainPlayer.CheckBagFull(rewardItem))
                    {
                        Player.mainPlayer.AddItem(rewardItem);
                        simpleItemDetail.SetupSimpleItemDetail(rewardItem);
                        ExploreManager.Instance.expUICtr.UpdateBottomBar();
                    }
                    break;
                }

                if (!dialogGroup.isMultiTimes)
                {
                    List <HLHNPCChatRecord> chatRecords = GameManager.Instance.gameDataCenter.chatRecords;

                    HLHNPCChatRecord chatRecord = new HLHNPCChatRecord(npc.npcId, dialogGroup.dialogGroupId);

                    chatRecords.Add(chatRecord);


                    //GameManager.Instance.persistDataManager.SaveCompletePlayerData();
                }

                dialogHasFinished = true;

                QuitDialogPlane();

                return;
            }

            //if(Player.mainPlayer.currentLevelIndex == CommonData.maxLevel && dialogGroup.triggerLevel == CommonData.maxLevel){

            //             this.gameObject.SetActive(false);

            //	GameManager.Instance.UIManager.SetUpCanvasWith(CommonData.shareCanvasBundleName, "ShareCanvas", delegate
            //             {
            //                 TransformManager.FindTransform("ShareCanvas").GetComponent<ShareViewController>().SetUpShareView(ShareType.WeChat, null, null, null);
            //             });

            //	return;
            //}

            QuitDialogPlane();
        }