| | |
| | | [SerializeField] Text m_TextShowD;//显示内容4 |
| | | [SerializeField] ScrollerController m_ScrollerController; |
| | | [SerializeField] Button m_CloseButton; |
| | | [SerializeField] Text m_TextTurnedOn;//已开启 |
| | | [SerializeField] Text m_TextUnopened;//未开启 |
| | | [SerializeField] Text m_Textschedule;//进度 |
| | | [SerializeField] Button m_ButtonGoto; |
| | | List<FunctionForecastConfig> FunctionList = new List<FunctionForecastConfig>(); |
| | | |
| | | TreasureModel treasureModel { get { return ModelCenter.Instance.GetModel<TreasureModel>(); } } |
| | | #region Built-in |
| | | private int ClickFuncID = 0; |
| | | protected override void BindController() |
| | | { |
| | | } |
| | |
| | | |
| | | protected override void OnPreOpen() |
| | | {
|
| | | AddList();
|
| | | m_ScrollerController.OnRefreshCell += OnRefreshGridCell; |
| | | AddList();//添加数组列表
|
| | | DefaultSelection();//获取默认选择
|
| | | m_ScrollerController.OnRefreshCell += OnRefreshGridCell; |
| | | OnCreateGridLineCell(m_ScrollerController); |
| | | ContentDisplay();
|
| | | m_ScrollerController.JumpIndex(JumpIndex()); |
| | | } |
| | | |
| | | protected override void OnAfterOpen() |
| | | { |
| | | } |
| | | |
| | | FuncOpen.Instance.OnFuncStateChangeEvent += OnFuncStateChangeEvent;
|
| | | PlayerDatas.Instance.PlayerDataRefreshInfoEvent += OnPlayersUpLV;
|
| | | treasureModel.treasureStateChangeEvent += treasureStateChangeEvent;
|
| | | treasureModel.treasureStageUpEvent += treasureStageUpEvent; |
| | | }
|
| | | protected override void OnPreClose() |
| | | {
|
| | | m_ScrollerController.OnRefreshCell -= OnRefreshGridCell; |
| | | PlayerDatas.Instance.PlayerDataRefreshInfoEvent -= OnPlayersUpLV;
|
| | | FuncOpen.Instance.OnFuncStateChangeEvent -= OnFuncStateChangeEvent;
|
| | | m_ScrollerController.OnRefreshCell -= OnRefreshGridCell;
|
| | | treasureModel.treasureStateChangeEvent -= treasureStateChangeEvent;
|
| | | treasureModel.treasureStageUpEvent -= treasureStageUpEvent; |
| | | }
|
| | |
|
| | | private void treasureStageUpEvent(int obj)
|
| | | {
|
| | | ContentDisplay();
|
| | | m_ScrollerController.m_Scorller.RefreshActiveCellViews();//刷新可见
|
| | | }
|
| | |
|
| | | private void treasureStateChangeEvent(int obj)
|
| | | {
|
| | | ContentDisplay();
|
| | | m_ScrollerController.m_Scorller.RefreshActiveCellViews();//刷新可见
|
| | | }
|
| | |
|
| | | private void OnFuncStateChangeEvent(int obj)
|
| | | {
|
| | | ContentDisplay();
|
| | | m_ScrollerController.m_Scorller.RefreshActiveCellViews();//刷新可见
|
| | | }
|
| | | private void OnPlayersUpLV(PlayerDataRefresh obj)
|
| | | {
|
| | | if (obj == PlayerDataRefresh.LV)
|
| | | {
|
| | | ContentDisplay();
|
| | | m_ScrollerController.m_Scorller.RefreshActiveCellViews();//刷新可见
|
| | | }
|
| | | }
|
| | | void OnCreateGridLineCell(ScrollerController gridCtrl)
|
| | | {
|
| | | gridCtrl.Refresh();
|
| | |
| | | {
|
| | | FeaturesType1 featuresType1 = cell.GetComponent<FeaturesType1>();
|
| | | featuresType1.GetTheFeatureID(funcId);
|
| | | if (funcId == ClickFuncID)
|
| | | {
|
| | | featuresType1.ImageSelected.SetActive(true);
|
| | | }
|
| | | else
|
| | | {
|
| | | featuresType1.ImageSelected.SetActive(false);
|
| | | }
|
| | | featuresType1.Button.SetListener(()=> |
| | | {
|
| | | if (funcId != ClickFuncID)
|
| | | {
|
| | | ClickFuncID = funcId;
|
| | | ContentDisplay();
|
| | | m_ScrollerController.m_Scorller.RefreshActiveCellViews();//刷新可见
|
| | | }
|
| | | });
|
| | | }
|
| | | else if (type == ScrollerDataType.Normal)
|
| | | {
|
| | | FeaturesType2 featuresType2 = cell.GetComponent<FeaturesType2>();
|
| | | featuresType2.GetTheFeatureID(funcId);
|
| | | if (funcId == ClickFuncID)
|
| | | {
|
| | | featuresType2.ImageSelected.SetActive(true);
|
| | | }
|
| | | else
|
| | | {
|
| | | featuresType2.ImageSelected.SetActive(false);
|
| | | }
|
| | | featuresType2.Button.SetListener(() =>
|
| | | {
|
| | | if (funcId != ClickFuncID)
|
| | | {
|
| | | ClickFuncID = funcId;
|
| | | ContentDisplay();
|
| | | m_ScrollerController.m_Scorller.RefreshActiveCellViews();//刷新可见
|
| | | }
|
| | | });
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | { |
| | | }
|
| | | #endregion |
| | | private void AddList()
|
| | | private void AddList()//添加列表信息
|
| | | {
|
| | | if (FunctionList.Count <= 0)
|
| | | {
|
| | |
| | | {
|
| | | FunctionList.Add(functionForecastConfig);
|
| | | }
|
| | | }
|
| | | }
|
| | | } |
| | | |
| | | private void DefaultSelection()//获取默认选择
|
| | | {
|
| | | var configs = Config.Instance.GetAllValues<FunctionForecastConfig>();
|
| | | foreach (var config in configs)
|
| | | {
|
| | | int openTag = config.FuncId;
|
| | | if (!FuncOpen.Instance.IsFuncOpen(openTag))
|
| | | {
|
| | | ClickFuncID = openTag;
|
| | | return;
|
| | | }
|
| | | }
|
| | | if (ClickFuncID == 0)
|
| | | {
|
| | | ClickFuncID = FunctionList[0].FuncId;
|
| | | }
|
| | | } |
| | | |
| | | private int JumpIndex()//Jump选中
|
| | | {
|
| | | int Index = 0;
|
| | | Index = FunctionList.FindIndex((x)=> |
| | | {
|
| | | return x.FuncId == ClickFuncID;
|
| | | });
|
| | | return Index;
|
| | | } |
| | | |
| | | private void ContentDisplay()//内容显示
|
| | | {
|
| | | var functionForecastConfig = Config.Instance.Get<FunctionForecastConfig>(ClickFuncID);
|
| | | if (functionForecastConfig == null)
|
| | | {
|
| | | return;
|
| | | }
|
| | | m_TextAdvanceName.text = functionForecastConfig.FuncName;
|
| | | m_FeaturesImage.SetSprite(functionForecastConfig.Icon);
|
| | | string[] StrList = ConfigParse.GetMultipleStr(functionForecastConfig.Content);
|
| | | if (StrList.Length > 0)
|
| | | {
|
| | | m_Text_ShowA.text = StrList[0];
|
| | | m_TextShowB.text = StrList[1];
|
| | | m_TextShowC.text = StrList[2];
|
| | | m_TextShowD.text = StrList[3];
|
| | | }
|
| | | if (FuncOpen.Instance.IsFuncOpen(ClickFuncID))
|
| | | {
|
| | | m_TextTurnedOn.gameObject.SetActive(true);
|
| | | m_TextUnopened.gameObject.SetActive(false);
|
| | | m_Textschedule.gameObject.SetActive(false);
|
| | | m_ButtonGoto.gameObject.SetActive(false);
|
| | | }
|
| | | else
|
| | | {
|
| | | TrailerClassification(ClickFuncID);
|
| | | }
|
| | |
|
| | | } |
| | | |
| | | void TrailerClassification(int funcID)//预告分类
|
| | | {
|
| | | m_TextTurnedOn.gameObject.SetActive(false);
|
| | | m_TextUnopened.gameObject.SetActive(false);
|
| | | m_Textschedule.gameObject.SetActive(false);
|
| | | m_ButtonGoto.gameObject.SetActive(false);
|
| | | FuncOpenLVConfig funcoPenConfig = Config.Instance.Get<FuncOpenLVConfig>(funcID);
|
| | | if (funcoPenConfig.LimitMagicWeapon != 0 || funcoPenConfig.LimitMissionID != 0)
|
| | | {
|
| | | if (funcoPenConfig.LimitMagicWeapon != 0)//法宝
|
| | | {
|
| | | int faBaoID = funcoPenConfig.LimitMagicWeapon / 100;
|
| | | MagicWeapon(faBaoID);
|
| | |
|
| | | }
|
| | | else if (funcoPenConfig.LimitMissionID != 0)//任务
|
| | | {
|
| | | m_TextUnopened.gameObject.SetActive(true);
|
| | | m_TextUnopened.text= string.Format(Language.Get("TaskFuncOpen"), funcoPenConfig.LimitLV);
|
| | | return;
|
| | | }
|
| | | }
|
| | | else//等级
|
| | | {
|
| | | m_TextUnopened.gameObject.SetActive(true);
|
| | | m_TextUnopened.text= string.Format(Language.Get("FuncLevelOpen"), funcoPenConfig.LimitLV);
|
| | | return;
|
| | | }
|
| | | } |
| | | |
| | | private void MagicWeapon(int fabaoID)
|
| | | {
|
| | | m_ButtonGoto.gameObject.SetActive(true);
|
| | | Treasure treasure;
|
| | | TreasureConfig _treasure = Config.Instance.Get<TreasureConfig>(fabaoID);
|
| | | m_ButtonGoto.SetListener(()=> |
| | | {
|
| | | var config = Config.Instance.Get<TreasureConfig>(fabaoID);
|
| | | treasureModel.selectedTreasure = fabaoID;
|
| | | treasureModel.currentCategory = (TreasureCategory)config.Category;
|
| | | WindowJumpMgr.Instance.WindowJumpTo(JumpUIType.TreasureCollectSoul);
|
| | | });
|
| | | if (treasureModel.TryGetTreasure(fabaoID, out treasure)
|
| | | && treasure.state == TreasureState.Collected)
|
| | | {
|
| | | m_Textschedule.gameObject.SetActive(true);
|
| | | var list = treasure.treasureStages;
|
| | | var funcStage = 0;
|
| | | for (int i = 0; i < list.Count; i++)
|
| | | {
|
| | | if (list[i].unlockType == TreasureStageUnlock.Func &&
|
| | | list[i].func == ClickFuncID)
|
| | | {
|
| | | funcStage = i;
|
| | | break;
|
| | | }
|
| | | }
|
| | | if (treasure.stage < funcStage)
|
| | | {
|
| | | if (treasure.stage == funcStage - 1 || funcStage == 0)
|
| | | {
|
| | | m_Textschedule.text = (float)treasure.exp / treasure.treasureStages[funcStage].exp+"%";
|
| | | }
|
| | | else
|
| | | {
|
| | | m_Textschedule.text = 0+" %";
|
| | | }
|
| | | }
|
| | | }
|
| | | else
|
| | | {
|
| | | m_TextUnopened.gameObject.SetActive(true);
|
| | | m_TextUnopened.text = string.Format(Language.Get("FuncFBOpen"), _treasure.Name);
|
| | | }
|
| | | } |
| | | } |