Esempio n. 1
0
        private bool IsOnlyHaveDeliveryDart(Hotfix_LT.Data.MainLandEncounterTemplate met)
        {
            int[] func_ids = new int[3] {
                met.func_id_1, met.func_id_2, met.func_id_3
            };
            if (met.func_id_1 == 0 && met.func_id_2 == 0 && met.func_id_3 == 0)
            {
                return(false);
            }

            bool isOnlyDeliveryDart = true;

            for (var i = 0; i < func_ids.Length; i++)
            {
                int id = func_ids[i];

                if (id > 0)
                {
                    FuncTemplate func = Hotfix_LT.Data.FuncTemplateManager.Instance.GetFunc(id);
                    if (func.ui_model != "DeliveryDart")
                    {
                        isOnlyDeliveryDart = false;
                    }
                }
            }

            return(isOnlyDeliveryDart);
        }
Esempio n. 2
0
 /// <summary>
 /// 是否是功能NPC
 /// </summary>
 /// <param name="interactable"></param>
 /// <returns></returns>
 private bool IsFunctionNPC(string npc_id, string scene_name)
 {
     Hotfix_LT.Data.MainLandEncounterTemplate met = Hotfix_LT.Data.SceneTemplateManager.GetMainLandsNPCData(scene_name, npc_id);
     if (met != null)
     {
         if (met.func_id_1 > 0 || met.func_id_2 > 0 || met.func_id_3 > 0 || met.dialogue_id > 0)
         {
             return(true);
         }
     }
     return(false);
 }
Esempio n. 3
0
        void PrepareData()
        {
            m_Functions.Clear();

            if (!string.IsNullOrEmpty(npc) && !string.IsNullOrEmpty(scene))
            {
                Hotfix_LT.Data.MainLandEncounterTemplate met = Hotfix_LT.Data.SceneTemplateManager.GetMainLandsNPCData(scene, npc);

                if (met != null)
                {
                    if (met.func_id_1 > 0)
                    {
                        Hotfix_LT.Data.FuncTemplate func = Hotfix_LT.Data.FuncTemplateManager.Instance.GetFunc(met.func_id_1);
                        if (func != null)//红点设置
                        {
                            m_Functions.Add(func);
                            SetRP();
                        }
                    }
                    if (met.func_id_2 > 0)
                    {
                        Hotfix_LT.Data.FuncTemplate func = Hotfix_LT.Data.FuncTemplateManager.Instance.GetFunc(met.func_id_2);
                        if (func != null)
                        {
                            m_Functions.Add(func);
                            SetRP2();
                        }
                    }
                    if (met.func_id_3 > 0)
                    {
                        Hotfix_LT.Data.FuncTemplate func = Hotfix_LT.Data.FuncTemplateManager.Instance.GetFunc(met.func_id_3);
                        if (func != null)
                        {
                            m_Functions.Add(func);
                        }
                    }

                    if (taskData != null)
                    {
                        Hotfix_LT.Data.FuncTemplate func = new Hotfix_LT.Data.FuncTemplate();
                        func.ui_model = "task";
                        string displayName = EB.Dot.String("taskName", taskData, string.Empty);
                        func.display_name = string.Format("[{0}]", EB.Localizer.GetString("ID_MAIN_LINE")) + displayName;
                        m_Functions.Add(func);
                    }
                }
                else
                {
                    EB.Debug.LogError("Tabel did not have npc={0} in scene={1}", npc, scene);
                }
            }
        }
Esempio n. 4
0
        //交互处理函数
        private void NpcIntactProcess(GameObject player, GameObject interactable)
        {
            //play Audio
            PostAudioMessage(player, interactable);

            //有任务优先显示任务  -修改为有主线任务优先显示
            NpcTaskDataLookup task_datalookup = interactable.transform.GetDataLookupILRComponentInChildren <NpcTaskDataLookup>("Hotfix_LT.UI.NpcTaskDataLookup", true, false);

            //老江需求,正在进行的任务不弹框

            if (task_datalookup != null && task_datalookup.mDL.DefaultDataID != null && task_datalookup.IsMainTask() && !task_datalookup.IsRunning())
            {
                string task_state = TaskSystem.ACCEPTABLE;
                DataLookupsCache.Instance.SearchDataByID <string>(task_datalookup.mDL.DefaultDataID + ".state", out task_state);
                if (task_state.Equals(TaskSystem.UNACCEPTABLE))
                {
                    PopFuncitonIntactMenu(player, interactable);
                    return;
                }

                if (IsNpcFuncMenu(player, interactable))
                {
                    string npc_id     = interactable.name;
                    string scene_name = MainLandLogic.GetInstance().CurrentSceneName;
                    Hotfix_LT.Data.MainLandEncounterTemplate met = Hotfix_LT.Data.SceneTemplateManager.GetMainLandsNPCData(scene_name, npc_id);
                    if (IsFunctionNPC(npc_id, scene_name) && met != null && met.func_id_1 > 0)
                    {
                        if (IsOnlyHaveDeliveryDart(met) && AlliancesManager.Instance.DartData.State != eAllianceDartCurrentState.Transfering)
                        {
                            PopTaskIntactMenu(player, interactable);
                            return;
                        }

                        int m_taskId;
                        if (int.TryParse(task_datalookup.mDL.DefaultDataID.Replace(TaskStaticData.TaskPrefix, ""), out m_taskId))
                        {
                            TaskTemplate  taskTpl  = TaskTemplateManager.Instance.GetTask(m_taskId);
                            string        taskName = taskTpl.task_name;
                            System.Action callBack = delegate()
                            {
                                PopTaskIntactMenu(player, interactable);
                            };
                            Hashtable taskData = new Hashtable()
                            {
                                { "taskName", taskName }, { "callback", callBack }
                            };
                            Hashtable data = new Hashtable()
                            {
                                { "npc", npc_id }, { "scene", scene_name }, { "task", taskData }
                            };
                            GlobalMenuManager.Instance.Open("NpcFuncMenu", data);
                            return;
                        }
                        else
                        {
                            EB.Debug.LogError("parse taskId fail taskId=" + task_datalookup.mDL.DefaultDataID);
                        }
                    }
                }

                PopTaskIntactMenu(player, interactable);
                return;
            }

            //普通功能
            PopFuncitonIntactMenu(player, interactable);
        }