From 83cc5733f4d1491c145e2de4bc916712d8f2ba12 Mon Sep 17 00:00:00 2001
From: client_linchunjie <461730578@qq.com>
Date: 星期一, 20 八月 2018 15:30:33 +0800
Subject: [PATCH] 2703【前端】宗门试练副本界面显示评级对应奖励及数量
---
Core/GameEngine/Model/ConfigManager.cs | 1
Core/GameEngine/Model/Config/TrialRewardsConfig.cs | 52 +++++++++++++++++
System/Dungeon/TrialRewardsBehaviour.cs | 31 ++++++++++
System/Dungeon/TrialRewardsBehaviour.cs.meta | 12 ++++
Core/GameEngine/Model/Config/TrialRewardsConfig.cs.meta | 12 ++++
System/Dungeon/TrialDungeonModel.cs | 27 +++++++++
System/Dungeon/TrialDungeonEntranceWin.cs | 13 ++-
7 files changed, 143 insertions(+), 5 deletions(-)
diff --git a/Core/GameEngine/Model/Config/TrialRewardsConfig.cs b/Core/GameEngine/Model/Config/TrialRewardsConfig.cs
new file mode 100644
index 0000000..be90145
--- /dev/null
+++ b/Core/GameEngine/Model/Config/TrialRewardsConfig.cs
@@ -0,0 +1,52 @@
+锘�//--------------------------------------------------------
+// [Author]: 绗簩涓栫晫
+// [ Date ]: Monday, August 20, 2018
+//--------------------------------------------------------
+
+using UnityEngine;
+using System;
+
+namespace TableConfig {
+
+
+ public partial class TrialRewardsConfig : ConfigBase {
+
+ public int id { get ; private set ; }
+ public int lineId { get ; private set ; }
+ public int grade { get ; private set ; }
+ public int[] rewards;
+
+ public override string getKey()
+ {
+ return id.ToString();
+ }
+
+ public override void Parse() {
+ try
+ {
+ id=IsNumeric(rawContents[0]) ? int.Parse(rawContents[0]):0;
+
+ lineId=IsNumeric(rawContents[1]) ? int.Parse(rawContents[1]):0;
+
+ grade=IsNumeric(rawContents[2]) ? int.Parse(rawContents[2]):0;
+
+ string[] rewardsStringArray = rawContents[3].Trim().Split(StringUtility.splitSeparator,StringSplitOptions.RemoveEmptyEntries);
+ rewards = new int[rewardsStringArray.Length];
+ for (int i=0;i<rewardsStringArray.Length;i++)
+ {
+ int.TryParse(rewardsStringArray[i],out rewards[i]);
+ }
+ }
+ catch (Exception ex)
+ {
+ DebugEx.Log(ex);
+ }
+ }
+
+ }
+
+}
+
+
+
+
diff --git a/Core/GameEngine/Model/Config/TrialRewardsConfig.cs.meta b/Core/GameEngine/Model/Config/TrialRewardsConfig.cs.meta
new file mode 100644
index 0000000..e820715
--- /dev/null
+++ b/Core/GameEngine/Model/Config/TrialRewardsConfig.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: ee2212e198950744b9c7524b9d74d042
+timeCreated: 1534748051
+licenseType: Pro
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Core/GameEngine/Model/ConfigManager.cs b/Core/GameEngine/Model/ConfigManager.cs
index d24ce41..afcd8ab 100644
--- a/Core/GameEngine/Model/ConfigManager.cs
+++ b/Core/GameEngine/Model/ConfigManager.cs
@@ -187,6 +187,7 @@
AddAsyncTask<AllPeoplePartyAwardConfig>();
AddAsyncTask<OrderInfoConfig>();
AddAsyncTask<TrialExchangeConfig>();
+ AddAsyncTask<TrialRewardsConfig>();
while (!AllCompleted())
{
diff --git a/System/Dungeon/TrialDungeonEntranceWin.cs b/System/Dungeon/TrialDungeonEntranceWin.cs
index ddf216e..a3bb984 100644
--- a/System/Dungeon/TrialDungeonEntranceWin.cs
+++ b/System/Dungeon/TrialDungeonEntranceWin.cs
@@ -40,8 +40,8 @@
[SerializeField] Image m_BossRealm;
[SerializeField] Text m_BossName;
- [SerializeField]
- ItemBehaviour[] m_RewardBehaviours;
+ [SerializeField] TrialRewardsBehaviour[] m_RewardBehaviours;
+ [SerializeField] ScrollRect m_RewardScroller;
DungeonModel m_Model;
DungeonModel model {
@@ -58,6 +58,8 @@
}
DailyQuestModel dailyQuestModel { get { return ModelCenter.Instance.GetModel<DailyQuestModel>(); } }
+
+ TrialDungeonModel trialDungeonModel { get { return ModelCenter.Instance.GetModel<TrialDungeonModel>(); } }
#region Built-in
protected override void BindController()
@@ -176,16 +178,17 @@
private void DrawRewards()
{
+ m_RewardScroller.verticalNormalizedPosition = 1;
var dongeonId = model.DungeonMap(model.selectedTrialDungeon);
var config = ConfigManager.Instance.GetTemplate<DungeonConfig>(dongeonId);
- var rewards = config.Rewards;
for (int i = 0; i < m_RewardBehaviours.Length; i++)
{
var behaviour = m_RewardBehaviours[i];
- if (i < rewards.Length)
+ int[] rewards = null;
+ if (trialDungeonModel.TryGetTrialRewards(config.LineID, m_RewardBehaviours[i].grade, out rewards))
{
behaviour.gameObject.SetActive(true);
- behaviour.SetItem(rewards[i], 0);
+ behaviour.Display(rewards);
}
else
{
diff --git a/System/Dungeon/TrialDungeonModel.cs b/System/Dungeon/TrialDungeonModel.cs
index 9448739..6933d8e 100644
--- a/System/Dungeon/TrialDungeonModel.cs
+++ b/System/Dungeon/TrialDungeonModel.cs
@@ -10,6 +10,7 @@
{
Dictionary<int, List<TrialExchangeConfig>> trialTokenExchangeDict = new Dictionary<int, List<TrialExchangeConfig>>();
Dictionary<int, int> lineToTokenClassDict;
+ Dictionary<int, Dictionary<int, int[]>> trialRewardDict = new Dictionary<int, Dictionary<int, int[]>>();
public Dictionary<int, List<int>> trialClassTokens = new Dictionary<int, List<int>>();
public List<int> trialTokens = new List<int>();
PlayerPackModel packModel { get { return ModelCenter.Instance.GetModel<PlayerPackModel>(); } }
@@ -78,6 +79,18 @@
}
var funcConfig = ConfigManager.Instance.GetTemplate<FuncConfigConfig>("LineToItemStage");
lineToTokenClassDict = ConfigParse.GetDic<int, int>(funcConfig.Numerical1);
+
+ var trialRewards = ConfigManager.Instance.GetAllValues<TrialRewardsConfig>();
+ for (int i = 0; i < trialRewards.Count; i++)
+ {
+ Dictionary<int, int[]> dict = null;
+ if (!trialRewardDict.TryGetValue(trialRewards[i].lineId, out dict))
+ {
+ dict = new Dictionary<int, int[]>();
+ trialRewardDict.Add(trialRewards[i].lineId, dict);
+ }
+ dict.Add(trialRewards[i].grade, trialRewards[i].rewards);
+ }
}
public override void UnInit()
@@ -140,6 +153,20 @@
return trialTokenExchangeDict.TryGetValue(lv, out list);
}
+ public bool TryGetTrialRewards(int lineId, int grade, out int[] rewards)
+ {
+ rewards = null;
+ if (trialRewardDict.ContainsKey(lineId))
+ {
+ if (trialRewardDict[lineId].ContainsKey(grade))
+ {
+ rewards = trialRewardDict[lineId][grade];
+ return rewards != null && rewards.Length > 0;
+ }
+ }
+ return false;
+ }
+
public List<int> GetTotalClass()
{
return trialTokenExchangeDict.Keys.ToList();
diff --git a/System/Dungeon/TrialRewardsBehaviour.cs b/System/Dungeon/TrialRewardsBehaviour.cs
new file mode 100644
index 0000000..73611a6
--- /dev/null
+++ b/System/Dungeon/TrialRewardsBehaviour.cs
@@ -0,0 +1,31 @@
+锘縰sing System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+namespace Snxxz.UI
+{
+ public class TrialRewardsBehaviour : MonoBehaviour
+ {
+ [SerializeField] int m_Grade;
+ [SerializeField] ItemBehaviour[] m_ItemBehaviours;
+
+ public int grade { get { return m_Grade; } }
+
+ public void Display(int[] rewards)
+ {
+ for (int i = 0; i < m_ItemBehaviours.Length; i++)
+ {
+ var behaviour = m_ItemBehaviours[i];
+ if (i < rewards.Length)
+ {
+ behaviour.gameObject.SetActive(true);
+ behaviour.SetItem(rewards[i], 0);
+ }
+ else
+ {
+ behaviour.gameObject.SetActive(false);
+ }
+ }
+ }
+ }
+}
+
diff --git a/System/Dungeon/TrialRewardsBehaviour.cs.meta b/System/Dungeon/TrialRewardsBehaviour.cs.meta
new file mode 100644
index 0000000..31a479f
--- /dev/null
+++ b/System/Dungeon/TrialRewardsBehaviour.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: f436f3dabd50bc5429d2de289d60fdd5
+timeCreated: 1534749125
+licenseType: Pro
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
--
Gitblit v1.8.0