// 初始化 protected override void Awake() { base.Awake(); SubTitle.text = ULocalizationService.Instance.Get("UIView", "Task", "TaskList"); NoDataDesc.text = ULocalizationService.Instance.Get("UIView", "Task", "NoTaskData"); // 初始化任务列表模块 m_listTaskItem = new TaskHoldItem[SINGLE_PAGE_TASK_COUNT]; for (int i = 0; i < SINGLE_PAGE_TASK_COUNT; i++) { GameObject taskItemObj = ResNode.InstantiateRes(TaskItemTemplate); if (!taskItemObj) { return; } m_listTaskItem[i] = taskItemObj.GetComponent <TaskHoldItem>(); if (!m_listTaskItem[i]) { return; } taskItemObj.name = String.Format("TaskHold{0}", i + 1); m_listTaskItem[i].SetWndView(this); RectTransform taskItemRect = taskItemObj.transform as RectTransform; taskItemRect.SetParent(TaskItemFrame, false); } TaskItemTemplate.gameObject.SetActive(false); //m_nCurTaskPage = 1; m_nBtnState = HoldViewBtnState.HVBS_TASK; HoldBtnDesc.text = ULocalizationService.Instance.Get("UIView", "Task", "MyContact"); m_bInitShow = true; }
// 清空数据 public void ClearData() { for (int i = 0; i < SINGLE_PAGE_TASK_COUNT; i++) { m_listTaskItem[i].Clear(); } NoDataDesc.gameObject.SetActive(true); HoldBtnDesc.text = ULocalizationService.Instance.Get("UIView", "Task", "MyContact"); m_nBtnState = HoldViewBtnState.HVBS_TASK; m_bInitShow = true; }
// 查看自身拥有瓶子 public void OnClickMyContactBtn() { if (m_nBtnState == HoldViewBtnState.HVBS_TASK) { m_nBtnState = HoldViewBtnState.HVBS_CONTACT; HoldBtnDesc.text = ULocalizationService.Instance.Get("UIView", "Task", "MyTask"); SetPublishContactData(); } else if (m_nBtnState == HoldViewBtnState.HVBS_CONTACT) { m_nBtnState = HoldViewBtnState.HVBS_TASK; HoldBtnDesc.text = ULocalizationService.Instance.Get("UIView", "Task", "MyContact"); SetTaskData(); } }