| | |
| | | //-------------------------------------------------------- |
| | | // [Author]: 第二世界 |
| | | // [ Date ]: Wednesday, October 11, 2017 |
| | | //-------------------------------------------------------- |
| | | using UnityEngine; |
| | | using System.Collections; |
| | | using UnityEngine.UI; |
| | | using TableConfig; |
| | | using System.Collections.Generic; |
| | | using UnityEngine.EventSystems; |
| | | //剧情任务面板 |
| | | namespace Snxxz.UI |
| | | { |
| | | |
| | | public class StoryTask : MonoBehaviour |
| | | { |
| | | [SerializeField] ScrollerController _TaskRamusList; |
| | | //右侧面板 |
| | | [SerializeField] Text _Text_TaskName;//任务名 |
| | | [SerializeField] RichText _Text_TaskDescribe;//任务描述 |
| | | [SerializeField] RichText _Text_TaskTarget;//任务目标 |
| | | [SerializeField] Transform _Grid;//任务奖励生成的节点 |
| | | |
| | | [SerializeField] Button _Btn_Forward;//剧情面板按钮 |
| | | [SerializeField] Text _Text_Forward;//按钮文字 |
| | | private List<RewardAnalysis.RewardInfo> rewardList = new List<RewardAnalysis.RewardInfo>(); |
| | | Dictionary<int, Dictionary<string, string>> _DicTaskInforma = new Dictionary<int, Dictionary<string, string>>();//任务字典的信息 |
| | | private Dictionary<int, MissionDetailDates> _MainTaskDic = new Dictionary<int, MissionDetailDates>();//主线任务字典 |
| | | private Dictionary<int, string> chapterDic = new Dictionary<int, string>();//用来存储主线任务章节 |
| | | private List<int> listTask = new List<int>();//储存当前章节的任务个数 |
| | | private int mainTaskID = 0;//获取当前正在进行任务的ID |
| | | private int mainTaaskChapter = 1;//获取当前任务的章节 |
| | | |
| | | private int MainTaaskChapterNow = 1;//获取当前选中的选中章节数 |
| | | private int MainTaskIDNow = 0;//当前选中的任务ID |
| | | private bool _IsOpenbool = true; |
| | | PlayerTaskDatas m_TaskModel; |
| | | PlayerTaskDatas taskmodel { get { return m_TaskModel ?? (m_TaskModel = ModelCenter.Instance.GetModel<PlayerTaskDatas>()); } } |
| | | ItemTipsModel _itemTipsModel; |
| | | ItemTipsModel itemTipsModel { get { return _itemTipsModel ?? (_itemTipsModel = ModelCenter.Instance.GetModel<ItemTipsModel>()); } } |
| | | |
| | | private void Awake() |
| | | { |
| | | _TaskRamusList.OnRefreshCell += OnRefreshGridCell; |
| | | SaveChapter(); |
| | | } |
| | | private void OnEnable() |
| | | { |
| | | _IsOpenbool = true; |
| | | PlayerTaskDatas.Event_TaskInformation += TaskInformation;//任务字典信息 |
| | | _DicTaskInforma = taskmodel._DicTaskInformation; |
| | | _MainTaskDic = taskmodel.MainTaskDic; |
| | | GetMainIDAndMainTaskChapter(); |
| | | MainTaaskChapterNow = mainTaaskChapter; |
| | | ListTask(MainTaaskChapterNow); |
| | | MainTaskIDNow = mainTaskID; |
| | | OnCreateGridLineCell(_TaskRamusList);//创建赋值 |
| | | StartCoroutine("Delay"); |
| | | } |
| | | IEnumerator Delay() |
| | | { |
| | | |
| | | yield return null; |
| | | _TaskRamusList.JumpIndex(JunpIndex() - 1); |
| | | |
| | | } |
| | | private void Start() |
| | | { |
| | | _Btn_Forward.onClick.AddListener(ForwardButton); |
| | | } |
| | | private void OnDisable() |
| | | { |
| | | StopCoroutine("Delay"); |
| | | PlayerTaskDatas.Event_TaskInformation -= TaskInformation;//任务字典信息 |
| | | } |
| | | |
| | | void OnCreateGridLineCell(ScrollerController gridCtrl)//任务预制体创建 |
| | | { |
| | | gridCtrl.Refresh(); |
| | | |
| | | foreach (int key in chapterDic.Keys) |
| | | { |
| | | if (key <= mainTaaskChapter) |
| | | { |
| | | gridCtrl.AddCell(ScrollerDataType.Header, key); |
| | | if (key == MainTaaskChapterNow && _IsOpenbool) |
| | | { |
| | | for (int i = 0; i < listTask.Count; i++) |
| | | { |
| | | gridCtrl.AddCell(ScrollerDataType.Normal, listTask[i]); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | gridCtrl.Restart(); |
| | | |
| | | } |
| | | |
| | | void OnRefreshGridCell(ScrollerDataType type, CellView cell) |
| | | { |
| | | int taskID = cell.index; |
| | | if (type == ScrollerDataType.Header) |
| | | { |
| | | TaskTitleBtton taskTitleBtton = cell.GetComponent<TaskTitleBtton>(); |
| | | if (MainTaaskChapterNow == taskID) |
| | | { |
| | | taskTitleBtton.PitchOnImage.SetActive(true); |
| | | } |
| | | else |
| | | { |
| | | taskTitleBtton.PitchOnImage.SetActive(false); |
| | | } |
| | | taskTitleBtton.TitleName.text = chapterDic[taskID]; |
| | | taskTitleBtton.TitleBtton.RemoveAllListeners(); |
| | | taskTitleBtton.TitleBtton.AddListener(() => |
| | | { |
| | | if (taskID != MainTaaskChapterNow) |
| | | { |
| | | MainTaaskChapterNow = taskID; |
| | | ListTask(MainTaaskChapterNow); |
| | | _IsOpenbool = true; |
| | | OnCreateGridLineCell(_TaskRamusList); |
| | | } |
| | | else |
| | | { |
| | | MainTaaskChapterNow = 0; |
| | | _IsOpenbool = false; |
| | | OnCreateGridLineCell(_TaskRamusList); |
| | | } |
| | | }); |
| | | } |
| | | if (type == ScrollerDataType.Normal) |
| | | { |
| | | |
| | | MainTaskButton mainTaskButton = cell.GetComponent<MainTaskButton>(); |
| | | TaskListConfig tasklistmodel = ConfigManager.Instance.GetTemplate<TaskListConfig>(taskID); |
| | | |
| | | mainTaskButton.LightUpTheState.SetActive(false);//是否选中状态 |
| | | if (taskID < mainTaskID) |
| | | { |
| | | mainTaskButton.Text_RamusName.text = ConfigManager.Instance.GetTemplate<TASKINFOConfig>(tasklistmodel.TaskName).show_writing; |
| | | mainTaskButton.Text_RamusState.gameObject.SetActive(false); |
| | | mainTaskButton.m_Img_Finish.SetActive(true); |
| | | } |
| | | else if (taskID == mainTaskID) |
| | | { |
| | | mainTaskButton.Text_RamusName.text = ConfigManager.Instance.GetTemplate<TASKINFOConfig>(tasklistmodel.TaskName).show_writing; |
| | | mainTaskButton.Text_RamusState.gameObject.SetActive(true); |
| | | mainTaskButton.Text_RamusState.text = GegionalTaskStatus(_MainTaskDic[taskID].MissionState); |
| | | mainTaskButton.m_Img_Finish.SetActive(false); |
| | | } |
| | | else if (taskID > mainTaskID) |
| | | { |
| | | mainTaskButton.Text_RamusName.text = ConfigManager.Instance.GetTemplate<TASKINFOConfig>(tasklistmodel.TaskName).show_writing; |
| | | mainTaskButton.Text_RamusState.gameObject.SetActive(true); |
| | | mainTaskButton.Text_RamusState.text = Language.Get("NotPickedUp_Z"); |
| | | mainTaskButton.m_Img_Finish.SetActive(false); |
| | | } |
| | | if (taskID <= mainTaskID) |
| | | { |
| | | mainTaskButton.MainTaskBtn.interactable = true; |
| | | mainTaskButton.LightUpThe.color = new Color(1, 1, 1, 1); |
| | | if (taskID == MainTaskIDNow) |
| | | { |
| | | mainTaskButton.LightUpTheState.SetActive(true); |
| | | if (taskID == mainTaskID) |
| | | { |
| | | _Btn_Forward.gameObject.SetActive(true); |
| | | Information(taskID); |
| | | } |
| | | else |
| | | { |
| | | _Btn_Forward.gameObject.SetActive(false); |
| | | MissionsTask(taskID); |
| | | } |
| | | } |
| | | mainTaskButton.MainTaskBtn.RemoveAllListeners(); |
| | | mainTaskButton.MainTaskBtn.AddListener(() => |
| | | { |
| | | MainTaskIDNow = taskID; |
| | | _TaskRamusList.m_Scorller.RefreshActiveCellViews();//刷新当前可见 |
| | | }); |
| | | } |
| | | else |
| | | { |
| | | mainTaskButton.MainTaskBtn.interactable = false; |
| | | mainTaskButton.LightUpThe.color = new Color(1, 1, 1, 0.5f); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | void ForwardButton()//剧情任务按钮 |
| | | { |
| | | _Text_TaskTarget.ExcuteHref(); |
| | | WindowCenter.Instance.CloseImmediately<TaskWin>(); |
| | | WindowCenter.Instance.Open<MainInterfaceWin>(); |
| | | |
| | | } |
| | | |
| | | void Information(int taskID) |
| | | { |
| | | _Text_TaskName.text = ConfigManager.Instance.GetTemplate<TASKINFOConfig>(_MainTaskDic[taskID].Name).show_writing;//任务名 |
| | | _Text_TaskDescribe.text = ConfigManager.Instance.GetTemplate<TASKINFOConfig>(_MainTaskDic[taskID].Desclist).show_writing;//任务描述 |
| | | string strINfor = _MainTaskDic[taskID].InforList; |
| | | string str= ConfigManager.Instance.GetTemplate<TASKINFOConfig>(strINfor).show_writing; |
| | | //str= WordAnalysis.Color_Start_Regex.Replace(str, string.Empty); |
| | | //str = WordAnalysis.Color_End_Regex.Replace(str, string.Empty); |
| | | _Text_TaskTarget.text = str;//任务目标 |
| | | _Text_Forward.text = TaskStatus(_MainTaskDic[taskID].MissionState); |
| | | if (_DicTaskInforma.ContainsKey(taskID)) |
| | | { |
| | | _Text_TaskTarget.SetReplaceInfo(_DicTaskInforma[taskID]); |
| | | } |
| | | string _RewardStr = ConfigManager.Instance.GetTemplate<TASKINFOConfig>(_MainTaskDic[taskID].RewardList).show_writing; |
| | | RewardAnalysis.Inst.GetReward(_RewardStr, ref rewardList); |
| | | RewardInformationDisplay(rewardList); |
| | | } |
| | | |
| | | void MissionsTask(int taskID) |
| | | { |
| | | TaskListConfig taskListModel = ConfigManager.Instance.GetTemplate<TaskListConfig>(taskID); |
| | | _Text_TaskName.text = ConfigManager.Instance.GetTemplate<TASKINFOConfig>(taskListModel.TaskName).show_writing;//任务名 |
| | | _Text_TaskDescribe.text = ConfigManager.Instance.GetTemplate<TASKINFOConfig>(taskListModel.TaskDescribe).show_writing;//任务描述 |
| | | var taskconfig = ConfigManager.Instance.GetTemplate<TASKINFOConfig>(taskListModel.TaskTarget); |
| | | if (taskconfig == null) |
| | | { |
| | | DesignDebug.LogError("告诉TT任务目标没有这条数据(TASKINFO)" + taskListModel.TaskTarget); |
| | | return; |
| | | } |
| | | string str = ConfigManager.Instance.GetTemplate<TASKINFOConfig>(taskListModel.TaskTarget).show_writing; |
| | | //str = WordAnalysis.Color_Start_Regex.Replace(str, string.Empty); |
| | | //str = WordAnalysis.Color_End_Regex.Replace(str, string.Empty); |
| | | _Text_TaskTarget.text = str;//任务目标 |
| | | string _RewardStr = ConfigManager.Instance.GetTemplate<TASKINFOConfig>(taskListModel.TaskRewards).show_writing; |
| | | RewardAnalysis.Inst.GetReward(_RewardStr, ref rewardList); |
| | | RewardInformationDisplay(rewardList); |
| | | } |
| | | |
| | | |
| | | string TaskStatus(int _index)//获取主线任务状态 |
| | | { |
| | | switch (_index) |
| | | { |
| | | case 0: |
| | | return Language.Get("Z1075"); |
| | | case 1: |
| | | return Language.Get("Z1074"); |
| | | case 2: |
| | | return Language.Get("Z1076"); |
| | | } |
| | | return string.Empty; |
| | | } |
| | | |
| | | string GegionalTaskStatus(int _index)//任务状态 |
| | | { |
| | | switch (_index) |
| | | { |
| | | case 0: |
| | | return Language.Get("Z1072"); |
| | | case 1: |
| | | return Language.Get("Z1071"); |
| | | case 2: |
| | | return Language.Get("Z1073"); |
| | | } |
| | | return string.Empty; |
| | | } |
| | | void RewardInformationDisplay(List<RewardAnalysis.RewardInfo> rewardList)//奖励信息 |
| | | { |
| | | if (_Grid.childCount != 0) |
| | | { |
| | | for (int i = 0; i < _Grid.childCount; i++) |
| | | { |
| | | DestroyObject(_Grid.GetChild(i).gameObject); |
| | | } |
| | | } |
| | | if (rewardList.Count == 0) |
| | | return; |
| | | for (int i = 0; i < rewardList.Count; i++) |
| | | { |
| | | GameObject go = GameObject.Instantiate(UILoader.LoadPrefab("ItemCell")); |
| | | ItemCell itemcell = go.GetComponent<ItemCell>(); |
| | | go.transform.SetParent(_Grid); |
| | | go.transform.localScale = Vector3.one; |
| | | Vector3 pos = go.transform.localPosition; |
| | | go.transform.localPosition = pos.SetZ(0); |
| | | ItemCellModel cellModel = new ItemCellModel(rewardList[i].itemCfg.ID, true, (ulong)rewardList[i].num); |
| | | itemcell.Init(cellModel); |
| | | itemcell.cellBtn.RemoveAllListeners(); |
| | | int tab = i; |
| | | itemcell.cellBtn.AddListener(() => |
| | | { |
| | | ItemAttrData attrData = new ItemAttrData(rewardList[tab].itemCfg.ID, true, (ulong)rewardList[tab].num); |
| | | itemTipsModel.SetItemTipsModel(attrData); |
| | | }); |
| | | } |
| | | } |
| | | void TaskInformation(int _Taskid, Dictionary<int, Dictionary<string, string>> _Dic)//任务字典信息 |
| | | { |
| | | _DicTaskInforma = taskmodel._DicTaskInformation; |
| | | if (_DicTaskInforma.ContainsKey(_Taskid)) |
| | | { |
| | | _Text_TaskTarget.SetReplaceInfo(_DicTaskInforma[_Taskid]); |
| | | } |
| | | } |
| | | |
| | | void SaveChapter()//获取主线任务章节 |
| | | { |
| | | var configs = ConfigManager.Instance.GetAllValues<TaskListConfig>(); |
| | | foreach (var value in configs) |
| | | { |
| | | if (!chapterDic.ContainsKey(value.ChapterID)) |
| | | { |
| | | chapterDic.Add(value.ChapterID, value.ChapterName); |
| | | |
| | | } |
| | | } |
| | | } |
| | | |
| | | void GetMainIDAndMainTaskChapter()//获取正在进行的任务ID和章节数 |
| | | { |
| | | |
| | | foreach (int key in _MainTaskDic.Keys) |
| | | { |
| | | if (_MainTaskDic[key].MissionState != 0 && _MainTaskDic[key].MissionState != 3) |
| | | { |
| | | mainTaskID = key; |
| | | mainTaaskChapter = ConfigManager.Instance.GetTemplate<TaskListConfig>(key).ChapterID; |
| | | |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | private void ListTask(int ChapterID) |
| | | { |
| | | listTask.Clear(); |
| | | var configs = ConfigManager.Instance.GetAllValues<TaskListConfig>(); |
| | | foreach (var value in configs) |
| | | { |
| | | if (value.ChapterID == ChapterID && value.TaskID<= mainTaskID) |
| | | { |
| | | listTask.Add(value.TaskID); |
| | | } |
| | | } |
| | | } |
| | | |
| | | private int JunpIndex() |
| | | { |
| | | int Index = 0; |
| | | Index += mainTaaskChapter; |
| | | for (int i = 0; i < listTask.Count; i++) |
| | | { |
| | | Index += 1; |
| | | if (listTask[i] == mainTaskID) |
| | | { |
| | | return Index; |
| | | |
| | | } |
| | | } |
| | | return 0; |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | //--------------------------------------------------------
|
| | | // [Author]: 第二世界
|
| | | // [ Date ]: Wednesday, October 11, 2017
|
| | | //--------------------------------------------------------
|
| | | using UnityEngine;
|
| | | using System.Collections;
|
| | | using UnityEngine.UI;
|
| | | using TableConfig;
|
| | | using System.Collections.Generic;
|
| | | using UnityEngine.EventSystems;
|
| | | //剧情任务面板
|
| | | namespace Snxxz.UI
|
| | | {
|
| | |
|
| | | public class StoryTask : MonoBehaviour
|
| | | {
|
| | | [SerializeField] ScrollerController _TaskRamusList;
|
| | | //右侧面板
|
| | | [SerializeField] Text _Text_TaskName;//任务名
|
| | | [SerializeField] RichText _Text_TaskDescribe;//任务描述
|
| | | [SerializeField] RichText _Text_TaskTarget;//任务目标
|
| | | [SerializeField] Transform _Grid;//任务奖励生成的节点
|
| | |
|
| | | [SerializeField] Button _Btn_Forward;//剧情面板按钮
|
| | | [SerializeField] Text _Text_Forward;//按钮文字
|
| | | private List<RewardAnalysis.RewardInfo> rewardList = new List<RewardAnalysis.RewardInfo>();
|
| | | Dictionary<int, Dictionary<string, string>> _DicTaskInforma = new Dictionary<int, Dictionary<string, string>>();//任务字典的信息
|
| | | private Dictionary<int, MissionDetailDates> _MainTaskDic = new Dictionary<int, MissionDetailDates>();//主线任务字典
|
| | | private Dictionary<int, string> chapterDic = new Dictionary<int, string>();//用来存储主线任务章节
|
| | | private List<int> listTask = new List<int>();//储存当前章节的任务个数
|
| | | private int mainTaskID = 0;//获取当前正在进行任务的ID
|
| | | private int mainTaaskChapter = 1;//获取当前任务的章节
|
| | |
|
| | | private int MainTaaskChapterNow = 1;//获取当前选中的选中章节数
|
| | | private int MainTaskIDNow = 0;//当前选中的任务ID
|
| | | private bool _IsOpenbool = true;
|
| | | PlayerTaskDatas m_TaskModel;
|
| | | PlayerTaskDatas taskmodel { get { return m_TaskModel ?? (m_TaskModel = ModelCenter.Instance.GetModel<PlayerTaskDatas>()); } }
|
| | | ItemTipsModel _itemTipsModel;
|
| | | ItemTipsModel itemTipsModel { get { return _itemTipsModel ?? (_itemTipsModel = ModelCenter.Instance.GetModel<ItemTipsModel>()); } }
|
| | |
|
| | | private void Awake()
|
| | | {
|
| | | _TaskRamusList.OnRefreshCell += OnRefreshGridCell;
|
| | | SaveChapter();
|
| | | }
|
| | | private void OnEnable()
|
| | | {
|
| | | _IsOpenbool = true;
|
| | | PlayerTaskDatas.Event_TaskInformation += TaskInformation;//任务字典信息
|
| | | _DicTaskInforma = taskmodel._DicTaskInformation;
|
| | | _MainTaskDic = taskmodel.MainTaskDic;
|
| | | GetMainIDAndMainTaskChapter();
|
| | | MainTaaskChapterNow = mainTaaskChapter;
|
| | | ListTask(MainTaaskChapterNow);
|
| | | MainTaskIDNow = mainTaskID;
|
| | | OnCreateGridLineCell(_TaskRamusList);//创建赋值
|
| | | StartCoroutine("Delay");
|
| | | }
|
| | | IEnumerator Delay()
|
| | | {
|
| | |
|
| | | yield return null;
|
| | | _TaskRamusList.JumpIndex(JunpIndex() - 1);
|
| | |
|
| | | }
|
| | | private void Start()
|
| | | {
|
| | | _Btn_Forward.onClick.AddListener(ForwardButton);
|
| | | }
|
| | | private void OnDisable()
|
| | | {
|
| | | StopCoroutine("Delay");
|
| | | PlayerTaskDatas.Event_TaskInformation -= TaskInformation;//任务字典信息 |
| | | }
|
| | |
|
| | | void OnCreateGridLineCell(ScrollerController gridCtrl)//任务预制体创建
|
| | | {
|
| | | gridCtrl.Refresh();
|
| | |
|
| | | foreach (int key in chapterDic.Keys)
|
| | | {
|
| | | if (key <= mainTaaskChapter)
|
| | | {
|
| | | gridCtrl.AddCell(ScrollerDataType.Header, key);
|
| | | if (key == MainTaaskChapterNow && _IsOpenbool)
|
| | | {
|
| | | for (int i = 0; i < listTask.Count; i++)
|
| | | {
|
| | | gridCtrl.AddCell(ScrollerDataType.Normal, listTask[i]);
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | gridCtrl.Restart();
|
| | |
|
| | | }
|
| | |
|
| | | void OnRefreshGridCell(ScrollerDataType type, CellView cell)
|
| | | {
|
| | | int taskID = cell.index;
|
| | | if (type == ScrollerDataType.Header)
|
| | | {
|
| | | TaskTitleBtton taskTitleBtton = cell.GetComponent<TaskTitleBtton>();
|
| | | if (MainTaaskChapterNow == taskID)
|
| | | {
|
| | | taskTitleBtton.PitchOnImage.SetActive(true);
|
| | | }
|
| | | else
|
| | | {
|
| | | taskTitleBtton.PitchOnImage.SetActive(false);
|
| | | }
|
| | | taskTitleBtton.TitleName.text = chapterDic[taskID];
|
| | | taskTitleBtton.TitleBtton.RemoveAllListeners();
|
| | | taskTitleBtton.TitleBtton.AddListener(() =>
|
| | | {
|
| | | if (taskID != MainTaaskChapterNow)
|
| | | {
|
| | | MainTaaskChapterNow = taskID;
|
| | | ListTask(MainTaaskChapterNow);
|
| | | _IsOpenbool = true;
|
| | | OnCreateGridLineCell(_TaskRamusList);
|
| | | }
|
| | | else
|
| | | {
|
| | | MainTaaskChapterNow = 0;
|
| | | _IsOpenbool = false;
|
| | | OnCreateGridLineCell(_TaskRamusList);
|
| | | }
|
| | | });
|
| | | }
|
| | | if (type == ScrollerDataType.Normal)
|
| | | {
|
| | |
|
| | | MainTaskButton mainTaskButton = cell.GetComponent<MainTaskButton>();
|
| | | TaskListConfig tasklistmodel = Config.Instance.Get<TaskListConfig>(taskID);
|
| | |
|
| | | mainTaskButton.LightUpTheState.SetActive(false);//是否选中状态
|
| | | if (taskID < mainTaskID)
|
| | | {
|
| | | mainTaskButton.Text_RamusName.text = Config.Instance.Get<TASKINFOConfig>(tasklistmodel.TaskName).show_writing;
|
| | | mainTaskButton.Text_RamusState.gameObject.SetActive(false);
|
| | | mainTaskButton.m_Img_Finish.SetActive(true);
|
| | | }
|
| | | else if (taskID == mainTaskID)
|
| | | {
|
| | | mainTaskButton.Text_RamusName.text = Config.Instance.Get<TASKINFOConfig>(tasklistmodel.TaskName).show_writing;
|
| | | mainTaskButton.Text_RamusState.gameObject.SetActive(true);
|
| | | mainTaskButton.Text_RamusState.text = GegionalTaskStatus(_MainTaskDic[taskID].MissionState);
|
| | | mainTaskButton.m_Img_Finish.SetActive(false);
|
| | | }
|
| | | else if (taskID > mainTaskID)
|
| | | {
|
| | | mainTaskButton.Text_RamusName.text = Config.Instance.Get<TASKINFOConfig>(tasklistmodel.TaskName).show_writing;
|
| | | mainTaskButton.Text_RamusState.gameObject.SetActive(true);
|
| | | mainTaskButton.Text_RamusState.text = Language.Get("NotPickedUp_Z");
|
| | | mainTaskButton.m_Img_Finish.SetActive(false);
|
| | | }
|
| | | if (taskID <= mainTaskID)
|
| | | {
|
| | | mainTaskButton.MainTaskBtn.interactable = true;
|
| | | mainTaskButton.LightUpThe.color = new Color(1, 1, 1, 1);
|
| | | if (taskID == MainTaskIDNow)
|
| | | {
|
| | | mainTaskButton.LightUpTheState.SetActive(true);
|
| | | if (taskID == mainTaskID)
|
| | | {
|
| | | _Btn_Forward.gameObject.SetActive(true);
|
| | | Information(taskID);
|
| | | }
|
| | | else
|
| | | {
|
| | | _Btn_Forward.gameObject.SetActive(false);
|
| | | MissionsTask(taskID);
|
| | | }
|
| | | }
|
| | | mainTaskButton.MainTaskBtn.RemoveAllListeners();
|
| | | mainTaskButton.MainTaskBtn.AddListener(() =>
|
| | | {
|
| | | MainTaskIDNow = taskID;
|
| | | _TaskRamusList.m_Scorller.RefreshActiveCellViews();//刷新当前可见
|
| | | });
|
| | | }
|
| | | else
|
| | | {
|
| | | mainTaskButton.MainTaskBtn.interactable = false;
|
| | | mainTaskButton.LightUpThe.color = new Color(1, 1, 1, 0.5f);
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | |
|
| | | void ForwardButton()//剧情任务按钮
|
| | | {
|
| | | _Text_TaskTarget.ExcuteHref();
|
| | | WindowCenter.Instance.CloseImmediately<TaskWin>();
|
| | | WindowCenter.Instance.Open<MainInterfaceWin>();
|
| | |
|
| | | }
|
| | |
|
| | | void Information(int taskID)
|
| | | {
|
| | | _Text_TaskName.text = Config.Instance.Get<TASKINFOConfig>(_MainTaskDic[taskID].Name).show_writing;//任务名
|
| | | _Text_TaskDescribe.text = Config.Instance.Get<TASKINFOConfig>(_MainTaskDic[taskID].Desclist).show_writing;//任务描述
|
| | | string strINfor = _MainTaskDic[taskID].InforList;
|
| | | string str= Config.Instance.Get<TASKINFOConfig>(strINfor).show_writing;
|
| | | //str= WordAnalysis.Color_Start_Regex.Replace(str, string.Empty);
|
| | | //str = WordAnalysis.Color_End_Regex.Replace(str, string.Empty);
|
| | | _Text_TaskTarget.text = str;//任务目标
|
| | | _Text_Forward.text = TaskStatus(_MainTaskDic[taskID].MissionState);
|
| | | if (_DicTaskInforma.ContainsKey(taskID))
|
| | | {
|
| | | _Text_TaskTarget.SetReplaceInfo(_DicTaskInforma[taskID]);
|
| | | }
|
| | | string _RewardStr = Config.Instance.Get<TASKINFOConfig>(_MainTaskDic[taskID].RewardList).show_writing;
|
| | | RewardAnalysis.Inst.GetReward(_RewardStr, ref rewardList);
|
| | | RewardInformationDisplay(rewardList);
|
| | | }
|
| | |
|
| | | void MissionsTask(int taskID)
|
| | | {
|
| | | TaskListConfig taskListModel = Config.Instance.Get<TaskListConfig>(taskID);
|
| | | _Text_TaskName.text = Config.Instance.Get<TASKINFOConfig>(taskListModel.TaskName).show_writing;//任务名
|
| | | _Text_TaskDescribe.text = Config.Instance.Get<TASKINFOConfig>(taskListModel.TaskDescribe).show_writing;//任务描述
|
| | | var taskconfig = Config.Instance.Get<TASKINFOConfig>(taskListModel.TaskTarget);
|
| | | if (taskconfig == null)
|
| | | {
|
| | | DebugEx.LogError("告诉TT任务目标没有这条数据(TASKINFO)" + taskListModel.TaskTarget);
|
| | | return;
|
| | | }
|
| | | string str = Config.Instance.Get<TASKINFOConfig>(taskListModel.TaskTarget).show_writing;
|
| | | //str = WordAnalysis.Color_Start_Regex.Replace(str, string.Empty);
|
| | | //str = WordAnalysis.Color_End_Regex.Replace(str, string.Empty);
|
| | | _Text_TaskTarget.text = str;//任务目标
|
| | | string _RewardStr = Config.Instance.Get<TASKINFOConfig>(taskListModel.TaskRewards).show_writing;
|
| | | RewardAnalysis.Inst.GetReward(_RewardStr, ref rewardList);
|
| | | RewardInformationDisplay(rewardList);
|
| | | }
|
| | |
|
| | |
|
| | | string TaskStatus(int _index)//获取主线任务状态
|
| | | {
|
| | | switch (_index)
|
| | | {
|
| | | case 0:
|
| | | return Language.Get("Z1075");
|
| | | case 1:
|
| | | return Language.Get("Z1074");
|
| | | case 2:
|
| | | return Language.Get("Z1076");
|
| | | }
|
| | | return string.Empty;
|
| | | }
|
| | |
|
| | | string GegionalTaskStatus(int _index)//任务状态
|
| | | {
|
| | | switch (_index)
|
| | | {
|
| | | case 0:
|
| | | return Language.Get("Z1072");
|
| | | case 1:
|
| | | return Language.Get("Z1071");
|
| | | case 2:
|
| | | return Language.Get("Z1073");
|
| | | }
|
| | | return string.Empty;
|
| | | }
|
| | | void RewardInformationDisplay(List<RewardAnalysis.RewardInfo> rewardList)//奖励信息
|
| | | {
|
| | | if (_Grid.childCount != 0)
|
| | | {
|
| | | for (int i = 0; i < _Grid.childCount; i++)
|
| | | {
|
| | | DestroyObject(_Grid.GetChild(i).gameObject);
|
| | | }
|
| | | }
|
| | | if (rewardList.Count == 0)
|
| | | return;
|
| | | for (int i = 0; i < rewardList.Count; i++)
|
| | | {
|
| | | GameObject go = GameObject.Instantiate(UILoader.LoadPrefab("ItemCell"));
|
| | | ItemCell itemcell = go.GetComponent<ItemCell>();
|
| | | go.transform.SetParent(_Grid);
|
| | | go.transform.localScale = Vector3.one;
|
| | | Vector3 pos = go.transform.localPosition;
|
| | | go.transform.localPosition = pos.SetZ(0);
|
| | | ItemCellModel cellModel = new ItemCellModel(rewardList[i].itemCfg.ID, true, (ulong)rewardList[i].num);
|
| | | itemcell.Init(cellModel);
|
| | | itemcell.cellBtn.RemoveAllListeners();
|
| | | int tab = i;
|
| | | itemcell.cellBtn.AddListener(() =>
|
| | | {
|
| | | ItemAttrData attrData = new ItemAttrData(rewardList[tab].itemCfg.ID, true, (ulong)rewardList[tab].num);
|
| | | itemTipsModel.SetItemTipsModel(attrData);
|
| | | });
|
| | | }
|
| | | }
|
| | | void TaskInformation(int _Taskid, Dictionary<int, Dictionary<string, string>> _Dic)//任务字典信息
|
| | | {
|
| | | _DicTaskInforma = taskmodel._DicTaskInformation;
|
| | | if (_DicTaskInforma.ContainsKey(_Taskid))
|
| | | {
|
| | | _Text_TaskTarget.SetReplaceInfo(_DicTaskInforma[_Taskid]);
|
| | | }
|
| | | }
|
| | |
|
| | | void SaveChapter()//获取主线任务章节
|
| | | {
|
| | | var configs = Config.Instance.GetAllValues<TaskListConfig>();
|
| | | foreach (var value in configs)
|
| | | {
|
| | | if (!chapterDic.ContainsKey(value.ChapterID))
|
| | | {
|
| | | chapterDic.Add(value.ChapterID, value.ChapterName);
|
| | |
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | void GetMainIDAndMainTaskChapter()//获取正在进行的任务ID和章节数
|
| | | {
|
| | |
|
| | | foreach (int key in _MainTaskDic.Keys)
|
| | | {
|
| | | if (_MainTaskDic[key].MissionState != 0 && _MainTaskDic[key].MissionState != 3)
|
| | | {
|
| | | mainTaskID = key;
|
| | | mainTaaskChapter = Config.Instance.Get<TaskListConfig>(key).ChapterID;
|
| | |
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | |
|
| | | private void ListTask(int ChapterID)
|
| | | {
|
| | | listTask.Clear();
|
| | | var configs = Config.Instance.GetAllValues<TaskListConfig>();
|
| | | foreach (var value in configs)
|
| | | {
|
| | | if (value.ChapterID == ChapterID && value.TaskID<= mainTaskID)
|
| | | {
|
| | | listTask.Add(value.TaskID);
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | private int JunpIndex()
|
| | | {
|
| | | int Index = 0;
|
| | | Index += mainTaaskChapter;
|
| | | for (int i = 0; i < listTask.Count; i++)
|
| | | {
|
| | | Index += 1;
|
| | | if (listTask[i] == mainTaskID)
|
| | | {
|
| | | return Index;
|
| | |
|
| | | }
|
| | | }
|
| | | return 0;
|
| | | }
|
| | | }
|
| | |
|
| | |
|
| | |
|
| | | }
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|