123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654 |
- using FairyGUI;
- using UI.CommonGame;
- using UI.Main;
- using System.Collections.Generic;
- using UnityEngine;
- using System.Collections;
- using ET;
- namespace GFGGame
- {
- public class StoryChapterView : BaseWindow
- {
- private UI_StoryChapterUI _ui;
- private int _chapterID;
- private GComponent _compChapter;
- private ValueBarController _valueBarController;
- private GObject _unPasslevelItem;
- private GObject _endLevelItem;
- private EffectUI _effectUI1;
- private EffectUI _effectUI2;
- private EffectUI _effectUI3;
- private EffectUI _effectUI4;
- private EffectUI _effectUI5;
- private EffectUI _effectUI6;
- private EffectUI _effectUI7;
- private GComponent _comEff;
- private GComponent _effFirst;
- //当前章节索引
- private int newIndex;
- //y轴移动索引
- private float indexY;
- private GameObject gamey;
- //特效类型数组,这里后面可以二维数组,放向左和向右的
- private string[] effArray = new string[2] { "ZJ_JuQing", "ZJ_ZD" };
- private int currentDifficulty;
- public override void Dispose()
- {
- EffectUIPool.Recycle(_effectUI1);
- _effectUI1 = null;
- EffectUIPool.Recycle(_effectUI2);
- _effectUI2 = null;
- EffectUIPool.Recycle(_effectUI3);
- _effectUI3 = null;
- EffectUIPool.Recycle(_effectUI4);
- _effectUI4 = null;
- EffectUIPool.Recycle(_effectUI5);
- _effectUI5 = null;
- EffectUIPool.Recycle(_effectUI6);
- _effectUI6 = null;
- EffectUIPool.Recycle(_effectUI7);
- _effectUI7 = null;
- if (_comEff != null)
- {
- _comEff.RemoveFromParent();
- _comEff.Dispose();
- }
- if (_effFirst != null)
- {
- _effFirst.RemoveFromParent();
- _effFirst.Dispose();
- }
- if (_valueBarController != null)
- {
- _valueBarController.Dispose();
- _valueBarController = null;
- }
- if (_ui != null)
- {
- _ui.Dispose();
- _ui = null;
- }
- base.Dispose();
- }
- protected override void Init()
- {
- base.Init();
- _ui = UI_StoryChapterUI.Create();
- viewCom = _ui.target;
- isfullScreen = true;
- isReturnView = true;
- }
- protected override void OnInit()
- {
- base.OnInit();
- _valueBarController = new ValueBarController(_ui.m_valueBar);
- _ui.m_btnBack.onClick.Add(OnClickBtnBack);
- _ui.m_btnHome.onClick.Add(OnClickBtnHome);
- _ui.m_switchChapter.onClick.Add(OnClickSwitchBack);
- _ui.m_chapter.m_compChapterScroll.m_imgBegin.onClick.Add(OnClickNext);
- _ui.m_suitIcon.onClick.Add(OnClickGotoView);
- _ui.m_bonusBox1.target.onClick.Add(() =>
- {
- OnClickBonusBox(_ui.m_bonusBox1, 0);
- });
- _ui.m_bonusBox2.target.onClick.Add(() =>
- {
- OnClickBonusBox(_ui.m_bonusBox2, 1);
- });
- _ui.m_bonusBox3.target.onClick.Add(() =>
- {
- OnClickBonusBox(_ui.m_bonusBox3, 2);
- });
- _ui.m_loaBg.url = ResPathUtil.GetBgImgPath("zxian_bg3");
- //_comEff = new GComponent();
- //_comEff = UIPackage.CreateObject(UI_MainUI.PACKAGE_NAME, "ComEff").asCom;
- //_effectUI1 = EffectUIPool.CreateEffectUI(_comEff.GetChild("holder").asGraph, "ui_gk", "ui_gk_sg");
- _effFirst = new GComponent();
- _effFirst = UIPackage.CreateObject(UI_MainUI.PACKAGE_NAME, "ComEff").asCom;
- _effectUI3 = EffectUIPool.CreateEffectUI(_ui.m_bgEffect, "ui_zj", "ZX_BG_TX");
- _effectUI4 = EffectUIPool.CreateEffectUI(_ui.m_chapter.m_compChapterScroll.m_nextEffect, "ui_zj", "ZX_Next_Boat");
- _effectUI5 = EffectUIPool.CreateEffectUI(_ui.m_bonusBox1.m_effect, "ui_zj", "Claimed");
- _effectUI6 = EffectUIPool.CreateEffectUI(_ui.m_bonusBox2.m_effect, "ui_zj", "Claimed");
- _effectUI7 = EffectUIPool.CreateEffectUI(_ui.m_bonusBox3.m_effect, "ui_zj", "Claimed");
- }
- protected override void AddEventListener()
- {
- EventAgent.AddEventListener(ConstMessage.NOTICE_MAINSTORY_BOXBONUS_STATE, UpdateBonusBox);
- }
- protected override void OnShown()
- {
- base.OnShown();
- GRoot.inst.touchable = false;
- SuitFosterProxy.SendGetSuitInfos().Coroutine();
- MusicManager.Instance.PlayCroutine(ResPathUtil.GetMusicPath(ConstMusicName.DEFAULT));
- if ((this.viewData as object[]) != null)
- {
- _chapterID = (int)(this.viewData as object[])[0];
- currentDifficulty = (int)(this.viewData as object[])[1];
- if (!backRefresh && MainStoryDataManager.currentChapterCfgId != _chapterID)
- {
- _chapterID = MainStoryDataManager.currentChapterCfgId;
- }
- else
- {
- MainStoryDataManager.currentChapterCfgId = _chapterID;
- }
- }
- else
- {
- _chapterID = (int)this.viewData;
- }
- _valueBarController.OnShown();
- _ui.m_t0.SetHook("canHit", () => { GRoot.inst.touchable = true; });
- _ui.m_t0.Play();
- Timers.inst.AddUpdate(CheckGuide);
- UpdateView();
- //
- }
- protected override void OnHide()
- {
- base.OnHide();
- _unPasslevelItem = null;
- _endLevelItem = null;
- // _ui.m_chapter.RemoveChildren(0, 0, true);
- GRoot.inst.touchable = true;
- _valueBarController.OnHide();
- Timers.inst.Remove(SetContainerY);
- Timers.inst.Remove(CheckGuide);
- }
- protected override void RemoveEventListener()
- {
- base.RemoveEventListener();
- EventAgent.RemoveEventListener(ConstMessage.NOTICE_MAINSTORY_BOXBONUS_STATE, UpdateBonusBox);
- }
- private void OnClickBtnBack()
- {
- ViewManager.GoBackFrom(typeof(StoryChapterView).FullName);
- //GameController.GoBackToMainView();
- }
- private void UpdateView()
- {
- //由于这里会切换特效,所以切换界面时进行清空
- EffectUIPool.Recycle(_effectUI2);
- _effectUI2 = null;
- if (_effFirst != null)
- {
- _effFirst.RemoveFromParent();
- }
- StoryChapterCfg chapterCfg = StoryChapterCfgArray.Instance.GetCfg(_chapterID);
- newIndex = StoryUtil.GetChapterOrder(chapterCfg.id);
- indexY = 111.0f * Mathf.Max(0, (float)StoryLevelCfgArray.Instance.GetCfgsBytypeAndsubTypeAndchapterId(chapterCfg.type, chapterCfg.subType, chapterCfg.id).Count - 5);
- gamey = GameObject.Find("Stage/GRoot/Window - StoryChapterUI/ContentPane/CompChapter/Container/Container");
- _ui.m_chapter.m_compChapterScroll.m_imgBegin.visible = false;
- _ui.m_chapter.m_compChapterScroll.m_nextEffect.visible = false;
- _ui.m_targetSuit.visible = false;
- Timers.inst.StartCoroutine(InitChapter());
- //Timers.inst.Add(0.2f, 1, SetContainerY);
- _ui.m_chapter.m_compChapterScroll.target.y = 1;
- //招财进宝活动
- if (chapterCfg.subType == 2)
- {
- UI_ComponentValueBar valueBar = UI_ComponentValueBar.Proxy(_ui.m_valueBar);
- valueBar.m_c1.selectedIndex = 12;
- UI_ComponentValueBar.ProxyEnd();
- _valueBarController.UpdateList(new List<int>() { ConstItemID.DIAMOND_PURPLE, ConstItemID.DIAMOND_RED });
- _ui.m_selectChapter.visible = false;
- _ui.m_switchChapter.visible = false;
- _ui.m_bonusBox.visible = false;
- _ui.m_ActivityZCJB.visible = true;
- long timeActivity = ActivityGlobalDataManager.Instance.GetActivityInfoOneByType(17).EndTime - TimeHelper.ServerNow();
- _ui.m_ZCJBTimeText.text = timeActivity > TimeUtil.SECOND_PER_DAY * 1000 ? TimeUtil.FormattingTimeTo_DDHHmm(timeActivity) : TimeUtil.FormattingTimeTo_HHmmss(timeActivity);
- }
- else
- {
- UI_ComponentValueBar valueBar = UI_ComponentValueBar.Proxy(_ui.m_valueBar);
- valueBar.m_c1.selectedIndex = 1;
- UI_ComponentValueBar.ProxyEnd();
- _ui.m_selectChapter.visible = true;
- _ui.m_switchChapter.visible = true;
- _ui.m_bonusBox.visible = true;
- _ui.m_ActivityZCJB.visible = false;
- }
- }
- private void OnClickSwitchBack()
- {
- Timers.inst.Remove(SetContainerY);
- ViewManager.Show<StoryChapterListView>(new object[] { Mathf.Max(0, currentDifficulty), newIndex });
- }
- private void OnClickGotoView()
- {
- StoryChapterCfg chapterSuitCfg = StoryChapterCfgArray.Instance.GetCfg(_chapterID);
- ViewManager.Show<ClothingSyntheticView>(new object[] { chapterSuitCfg.suitId, 0, _chapterID }, false, false);
- }
- private void OnClickBtnHome()
- {
- GameController.GoBackToMainView();
- }
- private void OnClickNext()
- {
- StoryChapterCfg chapterSuitCfg = StoryChapterCfgArray.Instance.GetCfg(_chapterID);
- if (MainStoryDataManager.CheckChapterUnlock(_chapterID + 1) && StoryController.CheckSuitGot(chapterSuitCfg.suitId))
- {
- Timers.inst.Remove(SetContainerY);
- _chapterID += 1;
- MainStoryDataManager.currentChapterCfgId = _chapterID;
- //ViewManager.Show<StoryChapterView>(new object[] { (_chapterID+1), currentDifficulty });
- UpdateView();
- }
- else
- {
- StoryChapterCfg chapterCfg = StoryChapterCfgArray.Instance.GetCfg(_chapterID + 1);
- if (!StoryController.CheckSuitGot(chapterSuitCfg.suitId))
- {
- PromptController.Instance.ShowFloatTextPrompt("需集齐所需套装");
- }
- else if (GameGlobal.myNumericComponent.GetAsInt(NumericType.Lvl) < chapterCfg.lvl)
- {
- PromptController.Instance.ShowFloatTextPrompt(string.Format("角色等级达到{0}级开启", chapterCfg.lvl));
- }
- }
- }
- private IEnumerator InitChapter()
- {
- StoryChapterCfg chapterCfg = StoryChapterCfgArray.Instance.GetCfg(_chapterID);
- _ui.m_txtChapterName0.text = chapterCfg.name.Length > 0 ? chapterCfg.name[0].ToString() : "";
- _ui.m_txtChapterName1.text = chapterCfg.name.Length > 1 ? chapterCfg.name[1].ToString() : "";
- _ui.m_txtChapterName2.text = chapterCfg.name.Length > 2 ? chapterCfg.name[2].ToString() : "";
- _ui.m_txtChapterName3.text = chapterCfg.name.Length > 3 ? chapterCfg.name[3].ToString() : "";
- _ui.m_txtChapterName4.text = chapterCfg.name.Length > 4 ? chapterCfg.name[4].ToString() : "";
- int order = StoryUtil.GetChapterOrder(chapterCfg.id);
- _ui.m_txtChapter.text = order < 10 ? "0" + order : order.ToString();
- int starCountChapter = InstanceZonesDataManager.GetChapterStarCount(_chapterID, chapterCfg.type, chapterCfg.subType);
- _ui.m_txtStarCount.text = "" + starCountChapter + "/" + chapterCfg.bonusStar3;
- UpdateBonusBoxName(_ui.m_bonusBox1, "" + chapterCfg.bonusStar1);
- UpdateBonusBoxName(_ui.m_bonusBox2, "" + chapterCfg.bonusStar2);
- UpdateBonusBoxName(_ui.m_bonusBox3, "" + chapterCfg.bonusStar3);
- UpdateBonusBox();
- var list = StoryLevelCfgArray.Instance.GetCfgsBytypeAndsubTypeAndchapterId(chapterCfg.type, chapterCfg.subType, chapterCfg.id);
- int endLevel = 0;
- int UnlockCount = 0;
- _compChapter = _ui.m_chapter.m_compChapterScroll.target;
- float starPosY = _ui.m_chapter.m_compChapterScroll.m_imgBegin.y;
- int lineGap = 4500 / list.Count;
- StoryLevelCfg lastLevelCfg = list[list.Count - 1];
- StoryChapterCfg LastChapterCfg = StoryChapterCfgArray.Instance.GetCfg(_chapterID + 1);
- if (lastLevelCfg != null && InstanceZonesDataManager.CheckLevelPass(lastLevelCfg.id) && LastChapterCfg != null)
- {
- _ui.m_chapter.m_compChapterScroll.m_imgBegin.visible = true;
- _ui.m_chapter.m_compChapterScroll.m_nextEffect.visible = true;
- if (chapterCfg.suitId > 0 && chapterCfg.subType == 0)
- {
- _ui.m_targetSuit.visible = true;
- SuitCfg suitCfg = SuitCfgArray.Instance.GetCfg(chapterCfg.suitId);
- _ui.m_suitIcon.url = ResPathUtil.GetIconPath(suitCfg.res, "png");
- _ui.m_suitText.text = suitCfg.name;
- int count;
- int totalCount;
- DressUpMenuSuitDataManager.GetSuitProgressBySuitId(chapterCfg.suitId, out count, out totalCount);
- _ui.m_suitNum.text = count + "/" + totalCount;
- }
- else
- {
- _ui.m_targetSuit.visible = false;
- }
- }
- //根据困难程度选择显示图片
- currentDifficulty = chapterCfg.subType;
- if (currentDifficulty == 1)
- {
- _ui.m_loaBg.url = ResPathUtil.GetBgImgPath("zhangjie_bg");
- }
- else
- {
- currentDifficulty = 0;
- _ui.m_loaBg.url = ResPathUtil.GetBgImgPath("bg_zhuxian");
- }
- //_comEff.visible = false;
- //_effFirst.visible = false;
- for (int i = 0; i < 20; i++)
- {
- GObject obj = _ui.m_chapter.m_compChapterScroll.target.GetChild("g" + (19 - i + 1));
- obj.SetPosition(obj.x, starPosY - lineGap * i - 300, 0); ;
- StoryLevelCfg levelCfg = i < list.Count ? list[i] : null;
- UI_CompStoryLevelItem levelItem = UI_CompStoryLevelItem.Proxy(obj);
- levelItem.m_fightBg.visible = true;
- levelItem.m_loaDialogBg.visible = true;
- if (levelCfg != null && MainStoryDataManager.CheckLevelUnlock(levelCfg.id))
- {
- UnlockCount++;
- levelItem.target.data = levelCfg.id;
- levelItem.target.visible = true;
- levelItem.target.onClick.Clear();
- levelItem.target.onClick.Add(OnClickLevelItem);
- string showId = StoryUtil.GetChapterOrder(_chapterID) + "-" + levelCfg.order;
- levelItem.m_txtDialogOrder.text = showId;
- levelItem.m_txtFightOrder.text = showId;
- if (levelCfg.fightID.Length > 0)
- {
- levelItem.m_c1.selectedIndex = 1;
- int score = InstanceZonesDataManager.GetScoreHighest(levelCfg.id);
- if (score <= 0)
- {
- levelItem.m_flower.target.visible = false;
- }
- else
- {
- levelItem.m_flower.target.visible = true;
- int starCount = InstanceZonesDataManager.GetStarCountHistory(levelCfg.id);
- StoryUtil.UpdateStar(starCount, levelItem.m_flower.target, Mathf.Max(0, currentDifficulty));
- }
- }
- else
- {
- levelItem.m_c1.selectedIndex = 0;
- levelItem.m_flower.target.visible = false;
- levelItem.m_txtName.text = levelCfg.name;
- levelItem.m_comDialogBg.m_loabg.url = ResPathUtil.GetBgImgPath(chapterCfg.bgRes);
- levelItem.m_comDialogBg.m_loaIcon.url = ResPathUtil.GetChapterGuideIconPath(chapterCfg.bgRes);
- levelItem.m_comDialogBg.m_c1.selectedIndex = Random.Range(0, 10);
- }
- //根据困难程度选择显示图片
- if (currentDifficulty == 1)
- {
- levelItem.m_loaDialogBg.url = "ui://Main/zxian_btn_jq_jy";
- levelItem.m_fightBg.url = "ui://Main/zxian_btn_zd_jy";
- levelItem.m_txtFightOrder.text = string.Format("{0}", StringUtil.GetColorText(showId.ToString(), "#E3F8FF"));
- levelItem.m_fightIconA.alpha = 0;
- levelItem.m_fightIconB.alpha = 0;
- _ui.m_txtBg.url = "ui://Main/zxian_chapter_dec_jy";
- _ui.m_txtChapterName0.strokeColor = new Color(0.592f, 0.773f, 0.961f, 1.000f);
- _ui.m_txtChapterName1.strokeColor = new Color(0.592f, 0.773f, 0.961f, 1.000f);
- _ui.m_txtChapterName2.strokeColor = new Color(0.592f, 0.773f, 0.961f, 1.000f);
- _ui.m_txtChapterName3.strokeColor = new Color(0.592f, 0.773f, 0.961f, 1.000f);
- _ui.m_txtChapterName4.strokeColor = new Color(0.592f, 0.773f, 0.961f, 1.000f);
- _ui.m_txtChapter.strokeColor = new Color(0.592f, 0.773f, 0.961f, 1.000f);
- }
- else
- {
- levelItem.m_loaDialogBg.url = "ui://Main/zxian_btn_jq";
- levelItem.m_fightBg.url = "ui://Main/zxian_btn_zd";
- levelItem.m_txtFightOrder.text = string.Format("{0}", StringUtil.GetColorText(showId.ToString(), "#FFEABF"));
- levelItem.m_fightIconA.alpha = 0;
- levelItem.m_fightIconB.alpha = 0;
- _ui.m_txtBg.url = "ui://Main/zxian_chapter_dec";
- _ui.m_txtChapterName0.strokeColor = new Color(1.000f, 0.686f, 0.318f, 1.000f);
- _ui.m_txtChapterName1.strokeColor = new Color(1.000f, 0.686f, 0.318f, 1.000f);
- _ui.m_txtChapterName2.strokeColor = new Color(1.000f, 0.686f, 0.318f, 1.000f);
- _ui.m_txtChapterName3.strokeColor = new Color(1.000f, 0.686f, 0.318f, 1.000f);
- _ui.m_txtChapterName4.strokeColor = new Color(1.000f, 0.686f, 0.318f, 1.000f);
- _ui.m_txtChapter.strokeColor = new Color(1.000f, 0.686f, 0.318f, 1.000f);
- }
- levelItem.m_holder.visible = !InstanceZonesDataManager.CheckLevelPass(levelCfg.id);
- if (!InstanceZonesDataManager.CheckLevelPass(levelCfg.id))
- {
- //设置为解锁关卡
- MainStoryDataManager.currentLevelCfgId = levelCfg.id;
- _unPasslevelItem = levelItem.target;
- //levelItem.target.AddChild(_comEff);
- //_comEff.visible = true;
- //设置解锁特效
- string effName;
- if (currentDifficulty == 1)
- {
- effName = effArray[levelItem.m_c1.selectedIndex] + "_Bule";
- }
- else
- {
- effName = effArray[levelItem.m_c1.selectedIndex];
- }
- if (levelItem.m_c1.selectedIndex == 0)
- {
- if (levelItem.m_c2.selectedIndex == 0)
- {
- _effectUI2 = EffectUIPool.CreateEffectUI(_effFirst.GetChild("effect_jq_left").asGraph, "ui_zj", effName);
- _effFirst.GetChild("effect_jq_left").rotationY = 180;
- }
- else
- {
- _effectUI2 = EffectUIPool.CreateEffectUI(_effFirst.GetChild("effect_jq").asGraph, "ui_zj", effName);
- _effFirst.GetChild("effect_jq").rotationY = 0;
- }
- }
- else
- {
- _effectUI2 = EffectUIPool.CreateEffectUI(_effFirst.GetChild("effect_zd").asGraph, "ui_zj", effName);
- if (levelItem.m_c2.selectedIndex == 0)
- {
- _effFirst.GetChild("effect_zd").rotationY = 0;
- }
- else
- {
- _effFirst.GetChild("effect_zd").rotationY = 180;
- }
- }
- levelItem.target.AddChild(_effFirst);
- levelItem.m_fightBg.visible = false;
- levelItem.m_loaDialogBg.visible = false;
- levelItem.m_t0.Play();
- _effFirst.visible = true;
- //Timers.inst.Add(1.7f, 1, HideEffect, obj);
- }
- if (levelCfg.order > endLevel)
- {
- endLevel = levelCfg.order;
- _endLevelItem = levelItem.target;
- }
- }
- else
- {
- levelItem.target.visible = false;
- }
- UI_CompStoryLevelItem.ProxyEnd();
- }
- yield return new WaitForEndOfFrame();
- _ui.m_chapter.m_compChapterScroll.target.y = 0; //Mathf.Max(0, _ui.m_chapter.target.height - _ui.m_chapter.m_compChapterScroll.target.height);
- if (gamey != null)
- gamey.transform.position = new Vector3(0, indexY, 0);
- }
- private void SetContainerY(object param = null)
- {
- _ui.m_chapter.m_compChapterScroll.target.y = 1; //Mathf.Max(0, _ui.m_chapter.target.height - _ui.m_chapter.m_compChapterScroll.target.height - 1);
- }
- private void HideEffect(object param = null)
- {
- //_effFirst.visible = false;
- }
- private void OnClickLevelItem(EventContext context)
- {
- UI_CompStoryLevelItem levelItem = UI_CompStoryLevelItem.Proxy(context.sender as GObject);
- int levelCfgId = (int)levelItem.target.data;
- UI_CompStoryLevelItem.ProxyEnd();
- StoryController.ShowLevelView(levelCfgId);
- TryCompleteGuide();
- }
- private void UpdateBonusBoxName(UI_CompBonusBox bonusBox, string name)
- {
- bonusBox.m_txtName.text = name;
- }
- private void UpdateBonusBox()
- {
- UpdateBonusBoxStatus(_ui.m_bonusBox1, 0);
- UpdateBonusBoxStatus(_ui.m_bonusBox2, 1);
- UpdateBonusBoxStatus(_ui.m_bonusBox3, 2);
- }
- private void UpdateBonusBoxStatus(UI_CompBonusBox bonusBox, int index)
- {
- int status = MainStoryDataManager.GetChapterBonusStatus(_chapterID, index);
- bonusBox.m_iconActive.visible = status == ConstBonusStatus.CAN_GET;
- bonusBox.m_effect.visible = status == ConstBonusStatus.CAN_GET;
- // bonusBox.m_ComRewardEffect.visible = status == ConstBonusStatus.CAN_GET;
- if (status == ConstBonusStatus.GOT)
- {
- bonusBox.m_icon.url = "ui://Main/tgjljinnang_off";
- }
- else
- {
- bonusBox.m_icon.url = "ui://Main/tgjljinnang_no";
- }
- bonusBox.target.data = status;
- }
- private async void OnClickBonusBox(UI_CompBonusBox bonusBox, int index)
- {
- int status = (int)bonusBox.target.data;
- if (status == ConstBonusStatus.CAN_GET)
- {
- bool got = await MainStorySProxy.GetMainStoryBoxBonus(_chapterID, index);
- if (got)
- {
- List<ItemData> bonusList = MainStoryDataManager.GetChapterBonus(_chapterID, index);
- if (bonusList != null && bonusList.Count > 0)
- {
- BonusController.TryShowBonusList(bonusList);
- }
- UpdateBonusBoxStatus(bonusBox, index);
- }
- }
- // else if (status == ConstBonusStatus.GOT)
- // {
- // PromptController.Instance.ShowFloatTextPrompt("这个宝箱已经被领取过了");
- // }
- else
- {
- List<ItemData> rewards = StoryBonusDataCache.GetChapterBonusList(_chapterID, index);
- int star = StoryBonusDataCache.GetChapterBonusStar(_chapterID, index);
- ViewManager.Show<RewardPreView>(new object[] { rewards, "宝箱奖励", string.Format("本章达成{0}星可领取", star) });
- // PromptController.Instance.ShowFloatTextPrompt("关卡总分不足,继续加油吧。");
- }
- }
- private void CheckGuide(object param)
- {
- if (GuideDataManager.IsGuideFinish(ConstGuideId.START_FIGHT) <= 0
- || GuideDataManager.IsGuideFinish(ConstGuideId.FREEDOM_DRESS) <= 0
- || GuideDataManager.IsGuideFinish(ConstGuideId.ENTER_CHAPTER) <= 0
- || GuideDataManager.IsGuideFinish(ConstGuideId.BUY_CLOTHING) <= 0
- || GuideDataManager.IsGuideFinish(ConstGuideId.UP_CARD_LV) <= 0
- || GuideDataManager.IsGuideFinish(ConstGuideId.ENTER_CHAPTER_1) <= 0
- || GuideDataManager.IsGuideFinish(ConstGuideId.ENTER_CHAPTER_2) <= 0
- //|| GuideDataManager.IsGuideFinish(ConstGuideId.ENTER_CHAPTER_3) <= 0
- || GuideDataManager.IsGuideFinish(ConstGuideId.ENTER_CHAPTER_4) <= 0
- || GuideDataManager.IsGuideFinish(ConstGuideId.ENTER_CHAPTER_5) <= 0
- || GuideDataManager.IsGuideFinish(ConstGuideId.UP_CARD_STAR) <= 0
- || GuideDataManager.IsGuideFinish(ConstGuideId.ARENA_OPEN) <= 0
- || GuideDataManager.IsGuideFinish("ClothingSelectView") <= 0
- || GuideDataManager.IsGuideFinish(ConstGuideId.STUDIO_FILING) <=0
- || GuideDataManager.IsGuideFinish("TimeTracingShowView") <=0)
- //|| GuideDataManager.IsGuideFinish(ConstGuideId.CLOTHING_DECOMPOSE) <= 0)
- {
- UpdateToCheckGuide(null);
- }
- else
- {
- Timers.inst.Remove(CheckGuide);
- }
- }
- protected override void UpdateToCheckGuide(object param)
- {
- if (!ViewManager.CheckIsTopView(this.viewCom)) return;
- GComponent unPasslevelCom = _unPasslevelItem == null ? null : _unPasslevelItem.asCom;
- bool isGuide0 = GuideController.TryGuide(unPasslevelCom, ConstGuideId.START_FIGHT, 1, "尝试换上一套衣服吧。");
- bool isGuide1 = GuideController.TryGuide(_ui.m_btnHome, ConstGuideId.FREEDOM_DRESS, 1, "获得的服饰随时可以查看和试穿。");
- bool isGuide2 = GuideController.TryGuide(unPasslevelCom, ConstGuideId.ENTER_CHAPTER, 4, "来继续我们的旅程吧。");
- GuideController.TryCompleteGuide(ConstGuideId.ENTER_CHAPTER, 4);
- bool isGuide3 = GuideController.TryGuide(unPasslevelCom, ConstGuideId.ENTER_CHAPTER_1, 3, "来继续我们的旅程吧。");
- GuideController.TryCompleteGuide(ConstGuideId.ENTER_CHAPTER_1, 3);
- bool isGuide4 = GuideController.TryGuide(unPasslevelCom, ConstGuideId.BUY_CLOTHING, 1, "停电了室内温度升高,点击换身轻薄的服饰吧。");
- bool isGuide5 = GuideController.TryGuide(_ui.m_btnHome, ConstGuideId.UP_CARD_LV, 1, "点击返回主界面。");
- //bool isGuide6 = GuideController.TryGuide(_ui.m_btnHome, ConstGuideId.CLOTHING_DECOMPOSE, 1, "点击返回主界面。");
- bool isGuide7 = GuideController.TryGuide(unPasslevelCom, ConstGuideId.ENTER_CHAPTER_2, 3, "来继续我们的旅程吧。");
- GuideController.TryCompleteGuide(ConstGuideId.ENTER_CHAPTER_2, 3);
- //bool isGuide8 = GuideController.TryGuide(unPasslevelCom, ConstGuideId.ENTER_CHAPTER_3, 3, "来继续我们的旅程吧。");
- //GuideController.TryCompleteGuide(ConstGuideId.ENTER_CHAPTER_3, 3);
- bool isGuide10 = GuideController.TryGuide(unPasslevelCom, ConstGuideId.ENTER_CHAPTER_4, 2, "来继续我们的旅程吧。");
- GuideController.TryCompleteGuide(ConstGuideId.ENTER_CHAPTER_4, 2);
- bool isGuide11 = GuideController.TryGuide(unPasslevelCom, ConstGuideId.ENTER_CHAPTER_5, 3, "来继续我们的旅程吧。");
- GuideController.TryCompleteGuide(ConstGuideId.ENTER_CHAPTER_5, 3);
- bool isGuide9 = GuideController.TryGuide(_ui.m_btnHome, ConstGuideId.UP_CARD_STAR, 1, "点击返回主界面。");
- bool isGuide12 = GuideController.TryGuide(_ui.m_btnHome, ConstGuideId.ARENA_OPEN, 1, "点击返回主界面。");
- bool isGuide13 = GuideController.TryGuide(_ui.m_btnHome, "ClothingSelectView", 1, "点击返回主界面。");
- bool isGuide14 = GuideController.TryGuide(_ui.m_btnHome, ConstGuideId.STUDIO_FILING, 1, "点击返回主界面。");
- bool isGuide15 = GuideController.TryGuide(_ui.m_btnHome, "TimeTracingShowView", 1, "点击返回主界面。");
- //&& !isGuide6 && !isGuide8
- _ui.m_chapter.target.scrollPane.touchEffect = !isGuide0 && !isGuide1 && !isGuide2 && !isGuide3 && !isGuide4 && !isGuide5 && !isGuide7 && !isGuide9 && !isGuide10;
- }
- protected override void TryCompleteGuide()
- {
- base.TryCompleteGuide();
- // GuideCfg cfg = GuideCfgArray.Instance.GetCfg(ConstGuideId.ENTER_CHAPTER);
- GuideController.TryCompleteGuideIndex(ConstGuideId.ENTER_CHAPTER, 4);
- GuideController.TryCompleteGuide(ConstGuideId.ENTER_CHAPTER, 4);
- // GuideCfg cfg1 = GuideCfgArray.Instance.GetCfg(ConstGuideId.ENTER_CHAPTER_1);
- GuideController.TryCompleteGuideIndex(ConstGuideId.ENTER_CHAPTER_1, 3);
- GuideController.TryCompleteGuide(ConstGuideId.ENTER_CHAPTER_1, 3);
- // GuideCfg cfg2 = GuideCfgArray.Instance.GetCfg(ConstGuideId.ENTER_CHAPTER_2);
- GuideController.TryCompleteGuideIndex(ConstGuideId.ENTER_CHAPTER_2, 3);
- GuideController.TryCompleteGuide(ConstGuideId.ENTER_CHAPTER_2, 3);
- // GuideCfg cfg3 = GuideCfgArray.Instance.GetCfg(ConstGuideId.ENTER_CHAPTER_3);
- //GuideController.TryCompleteGuideIndex(ConstGuideId.ENTER_CHAPTER_3, 3);
- //GuideController.TryCompleteGuide(ConstGuideId.ENTER_CHAPTER_3, 3);
- // GuideCfg cfg4 = GuideCfgArray.Instance.GetCfg(ConstGuideId.ENTER_CHAPTER_4);
- GuideController.TryCompleteGuideIndex(ConstGuideId.ENTER_CHAPTER_4, 2);
- GuideController.TryCompleteGuide(ConstGuideId.ENTER_CHAPTER_4, 2);
- // GuideCfg cfg5 = GuideCfgArray.Instance.GetCfg(ConstGuideId.ENTER_CHAPTER_5);
- //GuideController.TryCompleteGuideIndex(ConstGuideId.ENTER_CHAPTER_5, 4);
- GuideController.TryCompleteGuide(ConstGuideId.ENTER_CHAPTER_5, 3);
- }
- }
- }
|