Exemplo n.º 1
0
    /// <summary>
    /// 分页选择
    /// </summary>
    /// <param name="index">0:每日任务  1:新手任务</param>
    public void SelectToggle(int index)
    {
        if (index != 1)
        {
            if (_isPlayAnimation)
            {
                _isPlayAnimation = false;
                UniversalTool.StartUIAnimTwo(GetComponent <CanvasGroup>(), _thisBgRect);
            }
        }

        //if (_currPagingIndex == index)
        //{
        //    return;
        //}
        _currPagingIndex = index;
        List <TaskDefine> taskDefines = new List <TaskDefine>();
        Transform         parent      = null;

        switch (index)
        {
        case 0:
            _dailyTaskBoxRect.gameObject.SetActive(true);
            _tyroTaskBoxRect.gameObject.SetActive(false);
            parent = _dilyTaskBoxMiddleScrollRect.content;
            if (_allTypeDataDic.ContainsKey(Company.Cfg.TaskType.DailyTask))
            {
                taskDefines = _allTypeDataDic[Company.Cfg.TaskType.DailyTask];
            }
            break;

        case 1:
            _dailyTaskBoxRect.gameObject.SetActive(false);
            _tyroTaskBoxRect.gameObject.SetActive(true);
            parent = _tyroTaskBoxMiddleScrollRect.content;
            if (_allTypeDataDic.ContainsKey(Company.Cfg.TaskType.GuidanceTask))
            {
                taskDefines = _allTypeDataDic[Company.Cfg.TaskType.GuidanceTask];
            }
            break;
        }
        DisposeAllCurrShowItem();
        taskDefines = DataSort(taskDefines);

        for (int i = 0; i < taskDefines.Count; i++)
        {
            RectTransform itemTra       = CreationItem(parent).GetComponent <RectTransform>();
            TaskDefine    data          = taskDefines[i];
            TaskPanelItem taskPanelItem = itemTra.GetComponent <TaskPanelItem>();
            taskPanelItem.Initial(data, this);
            _currShowItems.Add(taskPanelItem);
            if (!_currShowItemDic.ContainsKey(data.TaskID))
            {
                _currShowItemDic.Add(data.TaskID, taskPanelItem);
            }
        }
        if (index == 0)
        {
            bool isOpen = IsOpenAKeyToGet();
            _aKeyToGetBtn.enabled = isOpen;
            Image btnIamge = _aKeyToGetBtn.transform.GetComponent <Image>();
            if (isOpen)
            {
                btnIamge.sprite = GetBtnSprite(1);
            }
            else
            {
                btnIamge.sprite = GetBtnSprite(2);
            }
        }

        if (index == 1)
        {
            _tyroTaskBoxSlideToTheLeftBtn.gameObject.SetActive(false);
            _tyroTaskBoxSlideToTheRightBtn.gameObject.SetActive(true);
            PlayVideo();
        }
        else
        {
            if (_isPlayAnimation)
            {
                _isPlayAnimation = false;
                UniversalTool.StartUIAnimTwo(GetComponent <CanvasGroup>(), _thisBgRect);
            }
        }
    }
Exemplo n.º 2
0
 public TaskDefineMetaInfo(TaskDefine target) : base(target)
 {
 }
Exemplo n.º 3
0
        public void OnClickMap(uint mapId)
        {
            uint needLevel = InstanceHelper.GetInstanceNeedRoleLevel((uint)mapId);
            var  instance  = DBInstance.Instance.GetInstanceInfo(mapId);

            string peakLvDesc = GetPeakLvDesc(needLevel);
            var    preStrFmt  = DBConstText.GetText("GAME_MAP_OPEN_TIPS"); // 达到{0}
            string descontent = string.Format(preStrFmt, peakLvDesc);

            uint isCanEnterCount = 0;

            if (needLevel > LocalPlayerManager.Instance.Level)
            {
                isCanEnterCount++;
                descontent = string.Format("<color=#ff0000>{0}</color>", descontent);
            }

            var needTaskId = instance.mNeedTaskId;

            if (instance != null && needTaskId != 0)
            {
                int requestLevelMin = TaskDefine.GetTaskRequestLevelMin(needTaskId);

                string taskFmt           = DBConstText.GetText("GAME_MAP_FINISH_TASK_TIPS"); //完成{0}任务开启
                string requestPeakLvDesc = GetPeakLvDesc((uint)requestLevelMin);
                string taskDesc          = string.Format(taskFmt, requestPeakLvDesc);

                if (TaskHelper.MainTaskIsPassed(needTaskId) == false)
                {
                    taskDesc = string.Format("<color=#ff0000>{0}</color>", taskDesc);

                    isCanEnterCount++;
                }

                descontent += string.Format("\n{0}", taskDesc);
            }

            if (isCanEnterCount == 0)
            {
                if (mapId == SceneHelp.Instance.CurSceneID)
                {
                    if (instance != null)
                    {
                        UINotice.Instance.ShowMessage(string.Format(DBConstText.GetText("ENTER_SAME_SCENE_TIPS"), instance.mName));
                    }
                    else
                    {
                        UINotice.Instance.ShowMessage(DBConstText.GetText("INSTANCE_CAN_NOT_SWITCH_WILD_INSTANCE"));
                    }
                }
                else
                {
                    SceneHelp.JumpToScene(mapId);
                    UIManager.Instance.CloseSysWindow("UIWorldMapWindow");
                }
            }
            else
            {
                var refObjPos = GetMapPointRefObjPos(mMapGoDic[(int)mapId]);
                mNotEnterTips.transform.localPosition = new Vector3(refObjPos.x, refObjPos.y - 190, 0);
                mNotEnterTips.SetActive(true);

                mNotEnterTipsTrigger.gameObject.SetActive(true);
                mNotEnterTipsTrigger.transform.SetAsLastSibling();
                Text content = UIHelper.FindChild(mNotEnterTips, "Content").GetComponent <Text>();

                content.text = descontent;
            }
        }