|
@@ -61,6 +61,7 @@ namespace GFGGame
|
|
{
|
|
{
|
|
OnClickBonusBox(_ui.m_bonusBox3, 2);
|
|
OnClickBonusBox(_ui.m_bonusBox3, 2);
|
|
});
|
|
});
|
|
|
|
+ _ui.m_loaBg.url = ResPathUtil.GetBgImgPath("zxian_bg3");
|
|
|
|
|
|
}
|
|
}
|
|
protected override void AddEventListener()
|
|
protected override void AddEventListener()
|
|
@@ -74,11 +75,8 @@ namespace GFGGame
|
|
MusicManager.Instance.Play(ResPathUtil.GetMusicPath(ConstMusicName.DEFAULT));
|
|
MusicManager.Instance.Play(ResPathUtil.GetMusicPath(ConstMusicName.DEFAULT));
|
|
_chapterID = (int)viewData;
|
|
_chapterID = (int)viewData;
|
|
MainStoryDataManager.currentChapterCfgId = _chapterID;
|
|
MainStoryDataManager.currentChapterCfgId = _chapterID;
|
|
- _compChapter = (GComponent)UIPackage.CreateObject("Main", "CompChapter" + _chapterID);
|
|
|
|
- StoryChapterCfg cfg = StoryChapterCfgArray.Instance.GetCfg(_chapterID);
|
|
|
|
- _compChapter.GetChild("loaBg").asLoader.url = ResPathUtil.GetBgImgPath(cfg.bgRes);
|
|
|
|
- _ui.m_chapter.scrollPane.touchEffect = true;
|
|
|
|
- _ui.m_chapter.AddChild(_compChapter);
|
|
|
|
|
|
+ // StoryChapterCfg cfg = StoryChapterCfgArray.Instance.GetCfg(_chapterID);
|
|
|
|
+
|
|
InitChapter();
|
|
InitChapter();
|
|
_valueBarController.OnShown();
|
|
_valueBarController.OnShown();
|
|
// _valueBarController.Controller(1);
|
|
// _valueBarController.Controller(1);
|
|
@@ -116,7 +114,13 @@ namespace GFGGame
|
|
private void InitChapter()
|
|
private void InitChapter()
|
|
{
|
|
{
|
|
StoryChapterCfg chapterCfg = StoryChapterCfgArray.Instance.GetCfg(_chapterID);
|
|
StoryChapterCfg chapterCfg = StoryChapterCfgArray.Instance.GetCfg(_chapterID);
|
|
- _ui.m_txtChapterName.text = StoryUtil.GetChapterOrderText(_chapterID) + "·" + chapterCfg.name;
|
|
|
|
|
|
+ _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);
|
|
int starCountChapter = InstanceZonesDataManager.GetChapterStarCount(_chapterID, chapterCfg.type, chapterCfg.subType);
|
|
_ui.m_txtStarCount.text = "" + starCountChapter + "/" + chapterCfg.bonusStar3;
|
|
_ui.m_txtStarCount.text = "" + starCountChapter + "/" + chapterCfg.bonusStar3;
|
|
UpdateBonusBoxName(_ui.m_bonusBox1, "" + chapterCfg.bonusStar1);
|
|
UpdateBonusBoxName(_ui.m_bonusBox1, "" + chapterCfg.bonusStar1);
|
|
@@ -126,69 +130,81 @@ namespace GFGGame
|
|
|
|
|
|
var list = StoryLevelCfgArray.Instance.GetCfgsBytypeAndsubTypeAndchapterId(chapterCfg.type, chapterCfg.subType, chapterCfg.id);
|
|
var list = StoryLevelCfgArray.Instance.GetCfgsBytypeAndsubTypeAndchapterId(chapterCfg.type, chapterCfg.subType, chapterCfg.id);
|
|
int endLevel = 0;
|
|
int endLevel = 0;
|
|
|
|
+
|
|
|
|
+ _compChapter = (GComponent)UIPackage.CreateObject("Main", "CompChapter");
|
|
|
|
+ float starPosY = _compChapter.GetChild("imgBegin").asImage.y;
|
|
|
|
+ _ui.m_chapter.scrollPane.touchEffect = true;
|
|
|
|
+ _ui.m_chapter.AddChild(_compChapter);
|
|
|
|
+
|
|
|
|
+ int lineGap = 4800 / list.Count;
|
|
for (int i = 0; i < list.Count; i++)
|
|
for (int i = 0; i < list.Count; i++)
|
|
{
|
|
{
|
|
|
|
+ GObject obj = UIPackage.CreateObject("Main", "CompStoryLevelItem");
|
|
|
|
+ _compChapter.AddChild(obj);
|
|
|
|
+ GObject posGrh0 = _compChapter.GetChild(string.Format("grh{0}_0", i));
|
|
|
|
+ GObject posGrh1 = _compChapter.GetChild(string.Format("grh{0}_1", i));
|
|
|
|
+
|
|
|
|
+ obj.SetPosition(posGrh0 == null ? posGrh1.x : posGrh0.x, starPosY - lineGap * i - 100, 0); ;
|
|
|
|
+
|
|
StoryLevelCfg levelCfg = list[i];
|
|
StoryLevelCfg levelCfg = list[i];
|
|
- GObject obj = _compChapter.GetChild("g" + levelCfg.order);
|
|
|
|
- if (obj != null)
|
|
|
|
|
|
+ UI_CompStoryLevelItem levelItem = UI_CompStoryLevelItem.Proxy(obj);
|
|
|
|
+ levelItem.target.data = levelCfg.id;
|
|
|
|
+ if (MainStoryDataManager.CheckLevelUnlock(levelCfg.id))
|
|
{
|
|
{
|
|
- UI_CompStoryLevelItem levelItem = UI_CompStoryLevelItem.Proxy(obj);
|
|
|
|
- levelItem.target.data = levelCfg.id;
|
|
|
|
- if (MainStoryDataManager.CheckLevelUnlock(levelCfg.id))
|
|
|
|
|
|
+ levelItem.m_c2.selectedIndex = posGrh0 == null ? 1 : 0;
|
|
|
|
+ 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.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);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- else
|
|
|
|
|
|
+ levelItem.m_c1.selectedIndex = 1;
|
|
|
|
+ int score = InstanceZonesDataManager.GetScoreHighest(levelCfg.id);
|
|
|
|
+ if (score <= 0)
|
|
{
|
|
{
|
|
- levelItem.m_c1.selectedIndex = 0;
|
|
|
|
levelItem.m_flower.target.visible = false;
|
|
levelItem.m_flower.target.visible = false;
|
|
-
|
|
|
|
}
|
|
}
|
|
- levelItem.m_holder.visible = !InstanceZonesDataManager.CheckLevelPass(levelCfg.id);
|
|
|
|
-
|
|
|
|
- if (levelItem.m_holder.visible)
|
|
|
|
- {
|
|
|
|
- //设置为解锁关卡
|
|
|
|
- MainStoryDataManager.currentLevelCfgId = levelCfg.id;
|
|
|
|
-
|
|
|
|
- _unPasslevelItem = levelItem.target;
|
|
|
|
- _gameObject = null;
|
|
|
|
- _wrapper = null;
|
|
|
|
- string resPath = ResPathUtil.GetViewEffectPath("ui_gk", "ui_gk_sg");
|
|
|
|
- SceneController.AddObjectToView(_gameObject, _wrapper, levelItem.m_holder, resPath, out _gameObject, out _wrapper);
|
|
|
|
- }
|
|
|
|
- if (levelCfg.order > endLevel)
|
|
|
|
|
|
+ else
|
|
{
|
|
{
|
|
- endLevel = levelCfg.order;
|
|
|
|
- _endLevelItem = levelItem.target;
|
|
|
|
|
|
+ levelItem.m_flower.target.visible = true;
|
|
|
|
+ int starCount = InstanceZonesDataManager.GetStarCountHistory(levelCfg.id);
|
|
|
|
+ StoryUtil.UpdateStar(starCount, levelItem.m_flower.target);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
- levelItem.target.visible = false;
|
|
|
|
|
|
+ levelItem.m_c1.selectedIndex = 0;
|
|
|
|
+ levelItem.m_flower.target.visible = false;
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ levelItem.m_holder.visible = !InstanceZonesDataManager.CheckLevelPass(levelCfg.id);
|
|
|
|
+
|
|
|
|
+ if (levelItem.m_holder.visible)
|
|
|
|
+ {
|
|
|
|
+ //设置为解锁关卡
|
|
|
|
+ MainStoryDataManager.currentLevelCfgId = levelCfg.id;
|
|
|
|
+
|
|
|
|
+ _unPasslevelItem = levelItem.target;
|
|
|
|
+ _gameObject = null;
|
|
|
|
+ _wrapper = null;
|
|
|
|
+ string resPath = ResPathUtil.GetViewEffectPath("ui_gk", "ui_gk_sg");
|
|
|
|
+ SceneController.AddObjectToView(_gameObject, _wrapper, levelItem.m_holder, resPath, out _gameObject, out _wrapper);
|
|
|
|
+ }
|
|
|
|
+ if (levelCfg.order > endLevel)
|
|
|
|
+ {
|
|
|
|
+ endLevel = levelCfg.order;
|
|
|
|
+ _endLevelItem = levelItem.target;
|
|
}
|
|
}
|
|
- UI_CompStoryLevelItem.ProxyEnd();
|
|
|
|
}
|
|
}
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ levelItem.target.visible = false;
|
|
|
|
+ }
|
|
|
|
+ UI_CompStoryLevelItem.ProxyEnd();
|
|
}
|
|
}
|
|
|
|
+
|
|
if (_endLevelItem != null)
|
|
if (_endLevelItem != null)
|
|
{
|
|
{
|
|
float tx = _endLevelItem.x + _endLevelItem.width / 2;
|
|
float tx = _endLevelItem.x + _endLevelItem.width / 2;
|
|
@@ -227,11 +243,11 @@ namespace GFGGame
|
|
// bonusBox.m_ComRewardEffect.visible = status == ConstBonusStatus.CAN_GET;
|
|
// bonusBox.m_ComRewardEffect.visible = status == ConstBonusStatus.CAN_GET;
|
|
if (status == ConstBonusStatus.GOT)
|
|
if (status == ConstBonusStatus.GOT)
|
|
{
|
|
{
|
|
- bonusBox.m_icon.url = "ui://Main/zx_gka_baoxiang_2";
|
|
|
|
|
|
+ bonusBox.m_icon.url = "ui://Main/zxian_gift_get";
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
- bonusBox.m_icon.url = "ui://Main/zx_gka_baoxiang_1";
|
|
|
|
|
|
+ bonusBox.m_icon.url = "ui://Main/zxian_gift_unget";
|
|
}
|
|
}
|
|
bonusBox.target.data = status;
|
|
bonusBox.target.data = status;
|
|
}
|
|
}
|