예제 #1
0
 /// <summary>
 /// 延时启动引导
 /// </summary>
 /// <param name="runningTaskConfigData"></param>
 /// <returns></returns>
 private IEnumerator CoroutineExecuteTaskGuide(TaskNewConfigData runningTaskConfigData)
 {
     if (runningTaskConfigData.DelayTime != 0)
     {
         yield return(new WaitForSeconds(runningTaskConfigData.DelayTime / 1000f));
     }
     if (m_showingNpcTalkPanel != null)
     {
         GameObject.Destroy(m_showingNpcTalkPanel);
     }
     ExecuteTaskGuide();
     yield break;
 }
예제 #2
0
    public void FinishAct(TaskNewConfigData taskNewConfigData)
    {
        SoundManager.Instance.PlaySoundEffect(taskNewConfigData.TaskCompleteSound);
        TaskTitle.text = LanguageTextManager.GetString(taskNewConfigData.TaskTitle);
        NGUITools.AddChild(FinishEffPoint, FinishEff);

        //任务奖励
        var awards         = taskNewConfigData.GetTaskAwardInfo();
        int awardItemCount = Mathf.Min(awards.Length, 3);//最多三项奖励

        for (int i = 0; i < awardItemCount; i++)
        {
            var awardItem          = NGUITools.AddChild(AwardPoints[i].gameObject, TaskAwardItemPrefab);
            var awardItemBehaviour = awardItem.GetComponent <TaskAwardItem>();
            int goodId             = awards[i].GoodsId;
            var itemFileInfo       = ItemDataManager.Instance.GetItemData(goodId);
            if (itemFileInfo != null)
            {
                awardItemBehaviour.InitItemData(itemFileInfo, awards[i].AwardAmount);
            }
            else
            {
                TraceUtil.Log(SystemModel.Rocky, TraceLevel.Error, "Task no good:" + goodId);
            }
        }

        GotoFightBtn.SetCallBackFuntion((obj) =>
        {
            SoundManager.Instance.PlaySoundEffect("Sound_Button_Task_Award");
            //确定按钮
            Destroy(gameObject);
        });
        var  runningTask     = TaskModel.Instance.FindRuningTaskState();
        bool registerBtnFlag = true;

        if (runningTask != null &&
            runningTask.dwTaskID != taskNewConfigData.TaskID)
        {
            registerBtnFlag = false;
        }
        if (registerBtnFlag)
        {
            GotoFightBtn.gameObject.RegisterBtnMappingId(UIType.Task, BtnMapId_Sub.Task_FinishAwardConfirm);
        }
    }
예제 #3
0
 private void ResetStoryNPC(TaskNewConfigData runningTaskConfigData)
 {
     m_taskNPCs.ApplyAllItem(P => { if (P != null)
                                    {
                                        GameObjectPool.Instance.Release(P);
                                    }
                             });
     m_NPCTitles.ApplyAllItem(P => { if (P != null)
                                     {
                                         GameObjectPool.Instance.Release(P);
                                     }
                              });
     m_NPCTitles.Clear();
     for (int i = 0; i < 16; i++)
     {
         m_taskNPCs[i] = MakeNPC(i, runningTaskConfigData);
     }
 }
예제 #4
0
 public TaskState(STaskState sTaskState, TaskNewConfigData taskNewConfigData)
 {
     Finished = false;
     this.Update(sTaskState);
     TaskNewConfigData = taskNewConfigData;
 }
예제 #5
0
    private GameObject MakeNPC(int index, TaskNewConfigData runningTaskConfigData)
    {
        GameObject      npc             = null;
        StoryPersonInfo storyPersonInfo = runningTaskConfigData.GetStoryPersonInfo(index);

        if (storyPersonInfo != null && storyPersonInfo.SrotyPersonPrefab != null)
        {
            var        pos    = storyPersonInfo.PersonPos;
            Quaternion npcDir = Quaternion.Euler(0, storyPersonInfo.StartAngle, 0);
            npc = GameObjectPool.Instance.AcquireLocal(storyPersonInfo.SrotyPersonPrefab, pos, npcDir);
            if (npc.GetComponent <NPCBehaviour>() != null)
            {
                npc.RemoveComponent <NPCBehaviour>("NPCBehaviour");
            }
            var tasknpcBehaviour = npc.GetComponent <TaskNPCBehaviour>();
            if (tasknpcBehaviour == null)
            {
                tasknpcBehaviour = npc.AddComponent <TaskNPCBehaviour>();
            }
            tasknpcBehaviour.InitTaskNPCData(storyPersonInfo);
            tasknpcBehaviour.ShowTaskNpcPanel = (personInfo) =>
            {
                if (personInfo != null)
                {
                    var playerBehaviour = (PlayerBehaviour)PlayerManager.Instance.FindHeroEntityModel().Behaviour;
                    if (playerBehaviour.FSMSystem.CurrentStateID == StateID.PlayerFindPathing)
                    {
                        PlayerManager.Instance.HeroAgent.enabled = false;
                        //playerBehaviour.FSMSystem.PerformTransition(Transition.PlayerToIdle);
                    }
                    //显示面板
                    var taskNpcTalkPanelBehaviour = UI.CreatObjectToNGUI.InstantiateObj(TaskNpcTalkPanelGo, npcTalkParent).GetComponent <TaskNpcTalkPanelBehaviour>();                   // NGUITools.AddChild(gameObject, TaskNpcTalkPanelGo).GetComponent<TaskNpcTalkPanelBehaviour>();
                    int storyBoxStyle             = personInfo.StoryBoxStyle - 1;
                    var storyPanel = StoryDialogPrefabs[storyBoxStyle];
                    TalkIdConfigData talkIdConfigData = new TalkIdConfigData();
                    talkIdConfigData.DialogPrefab   = (DialogBoxType)personInfo.StoryBoxStyle;
                    talkIdConfigData.NPCName        = personInfo.PersonNameIDS;
                    talkIdConfigData.TalkHead       = personInfo.SrotyPersonHeadPrefab;
                    talkIdConfigData.TalkID         = 0;
                    talkIdConfigData.TalkText       = personInfo.DialogIDS;
                    talkIdConfigData.TalkType       = StoryTallType.NPC;
                    talkIdConfigData.isTaskTalkMark = false;
                    talkIdConfigData.TextPos        = "0";

                    taskNpcTalkPanelBehaviour.Show(storyPanel, talkIdConfigData);
                    if (personInfo.DialogVoiceIDS != "0")
                    {
                        SoundManager.Instance.PlaySoundEffect(personInfo.DialogVoiceIDS);
                    }
                    m_showingNpcTalkPanel = taskNpcTalkPanelBehaviour.gameObject;
                    //send event to joystick of TownUI
                    UIEventManager.Instance.TriggerUIEvent(UIEventType.OnNpcTalkOpenEvent, null);
                }
            };
            string npcName    = storyPersonInfo.PersonNameIDS;//
            string szNpcTitle = "";
            var    npcTitleGo = GameObjectPool.Instance.AcquireLocal(NpcTitle, Vector3.zero, Quaternion.identity);
            npcTitleGo.transform.parent     = BattleManager.Instance.UICamera.transform;
            npcTitleGo.transform.localScale = new Vector3(20, 20, 20);
            npcTitleGo.GetComponent <NPCTitle>().SetNpcTitle(npcName, szNpcTitle, npc.transform.FindChild("NPCTitle").position);
            m_NPCTitles.Add(npcTitleGo);
        }
        return(npc);
    }