Merge branch 'master' of http://192.168.0.87:10010/r/snxxz_scripts
| | |
| | | //--------------------------------------------------------
|
| | | // [Author]: 第二世界
|
| | | // [ Date ]: Monday, August 20, 2018
|
| | | //--------------------------------------------------------
|
| | |
|
| | | using UnityEngine;
|
| | | using System;
|
| | |
|
| | | namespace TableConfig {
|
| | |
|
| | | |
| | | public partial class TrialRewardsConfig : ConfigBase {
|
| | |
|
| | | //-------------------------------------------------------- |
| | | // [Author]: 第二世界 |
| | | // [ Date ]: Tuesday, August 21, 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
|
| | | {
|
| | | public string rewards { get ; private set; } |
| | | |
| | | 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);
|
| | | }
|
| | | }
|
| | | |
| | | }
|
| | |
|
| | | }
|
| | |
|
| | |
|
| | |
|
| | |
|
| | | rewards = rawContents[3].Trim(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | DebugEx.Log(ex); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | |
| | | fileFormatVersion: 2 |
| | | guid: ee2212e198950744b9c7524b9d74d042 |
| | | timeCreated: 1534748051 |
| | | timeCreated: 1534819587 |
| | | licenseType: Pro |
| | | MonoImporter: |
| | | serializedVersion: 2 |
| | |
| | | }
|
| | | else
|
| | | {
|
| | | path = StringUtility.Contact(ResourcesPath.Instance.ExternalStorePath, "config/", fileName, ".bytes");
|
| | | path = StringUtility.Contact(ResourcesPath.Instance.ExternalStorePath, "config/", fileName, ".txt");
|
| | | }
|
| | |
|
| | | var task = new ConfigTask(typeof(T), AssetSource.refdataFromEditor ? AssetPath.ResourceOut : AssetPath.External, path);
|
| | |
| | | (object _obj) =>
|
| | | {
|
| | | string[] lines = null;
|
| | | StreamReader sr = null;
|
| | |
|
| | | try
|
| | | {
|
| | | if (_task.assetPath == AssetPath.ResourceOut)
|
| | | {
|
| | | lines = File.ReadAllLines(_task.filePath, Encoding.UTF8);
|
| | | }
|
| | | else if (_task.assetPath == AssetPath.External)
|
| | | {
|
| | | var tripleDESCryptoServiceProvider = new TripleDESCryptoServiceProvider();
|
| | | tripleDESCryptoServiceProvider.Key = Convert.FromBase64String(CustomKey);
|
| | | tripleDESCryptoServiceProvider.IV = Convert.FromBase64String(CustomIV);
|
| | | tripleDESCryptoServiceProvider.Mode = CipherMode.CBC;
|
| | | tripleDESCryptoServiceProvider.Padding = PaddingMode.PKCS7;
|
| | | var decryptor = tripleDESCryptoServiceProvider.CreateDecryptor();
|
| | |
|
| | | var expectedSteam = new FileStream(_task.filePath, FileMode.Open, FileAccess.Read, FileShare.Read);
|
| | | var bytes = new byte[expectedSteam.Length];
|
| | | expectedSteam.Read(bytes, 0, bytes.Length);
|
| | | var tableMs = new MemoryStream(bytes);
|
| | |
|
| | | var crypS = new CryptoStream(tableMs, decryptor, CryptoStreamMode.Read);
|
| | | sr = new StreamReader(crypS, Encoding.UTF8);
|
| | | var content = sr.ReadToEnd();
|
| | |
|
| | | lines = content.Split(new string[] { "\r\n" }, StringSplitOptions.None);
|
| | | }
|
| | |
|
| | | lines = File.ReadAllLines(_task.filePath, Encoding.UTF8);
|
| | | _task.state = TaskState.ReadFileSuccess;
|
| | | }
|
| | | catch (Exception ex)
|
| | |
| | | for (int i = 0; i < m_RewardBehaviours.Length; i++)
|
| | | {
|
| | | var behaviour = m_RewardBehaviours[i];
|
| | | int[] rewards = null;
|
| | | Item[] rewards = null;
|
| | | if (trialDungeonModel.TryGetTrialRewards(config.LineID, m_RewardBehaviours[i].grade, out rewards))
|
| | | {
|
| | | behaviour.gameObject.SetActive(true);
|
| | |
| | | {
|
| | | 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[]>>();
|
| | | Dictionary<int, Dictionary<int, Item[]>> trialRewardDict = new Dictionary<int, Dictionary<int, Item[]>>();
|
| | | 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>(); } }
|
| | |
| | | var trialRewards = ConfigManager.Instance.GetAllValues<TrialRewardsConfig>();
|
| | | for (int i = 0; i < trialRewards.Count; i++)
|
| | | {
|
| | | Dictionary<int, int[]> dict = null;
|
| | | Dictionary<int, Item[]> dict = null;
|
| | | if (!trialRewardDict.TryGetValue(trialRewards[i].lineId, out dict))
|
| | | {
|
| | | dict = new Dictionary<int, int[]>();
|
| | | dict = new Dictionary<int, Item[]>();
|
| | | trialRewardDict.Add(trialRewards[i].lineId, dict);
|
| | | }
|
| | | dict.Add(trialRewards[i].grade, trialRewards[i].rewards);
|
| | | var itemsArray = LitJson.JsonMapper.ToObject<int[][]>(trialRewards[i].rewards);
|
| | | if (itemsArray != null && itemsArray.Length > 0)
|
| | | {
|
| | | Item[] items = new Item[itemsArray.Length];
|
| | | for (int k = 0; k < itemsArray.Length; k++)
|
| | | {
|
| | | items[k] = new Item()
|
| | | {
|
| | | id = itemsArray[k][0],
|
| | | count = itemsArray[k][1],
|
| | | bind = itemsArray[k][2] == 1
|
| | | };
|
| | | }
|
| | | dict.Add(trialRewards[i].grade, items);
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | return trialTokenExchangeDict.TryGetValue(lv, out list);
|
| | | }
|
| | |
|
| | | public bool TryGetTrialRewards(int lineId, int grade, out int[] rewards)
|
| | | public bool TryGetTrialRewards(int lineId, int grade, out Item[] rewards)
|
| | | {
|
| | | rewards = null;
|
| | | if (trialRewardDict.ContainsKey(lineId))
|
| | |
| | |
|
| | | public int grade { get { return m_Grade; } }
|
| | |
|
| | | public void Display(int[] rewards)
|
| | | public void Display(Item[] rewards)
|
| | | {
|
| | | for (int i = 0; i < m_ItemBehaviours.Length; i++)
|
| | | {
|
| | |
| | | if (i < rewards.Length)
|
| | | {
|
| | | behaviour.gameObject.SetActive(true);
|
| | | behaviour.SetItem(rewards[i], 0);
|
| | | behaviour.SetItem(rewards[i]);
|
| | | }
|
| | | else
|
| | | {
|
| | |
| | | }
|
| | | break;
|
| | | case ShowStep.ShowUnlock:
|
| | | m_FuncUnLockSlider.value = timer / (6 * stageTime);
|
| | | if (timer > 3 * stageTime)
|
| | | var length = m_TreasureNewGots.Length;
|
| | | m_FuncUnLockSlider.value = timer / (length * stageTime);
|
| | | if (timer > length * stageTime)
|
| | | {
|
| | | timer = 0f;
|
| | | showStep = ShowStep.ShowComplete;
|