1个文件已删除
	
		
		17个文件已修改
	
		
		2 文件已复制
	
		
		4个文件已添加
	
		
		1 文件已重命名
	
	
 
	
	
	
	
	
	
	
	
|  |  |  | 
|---|
|  |  |  | using UnityEngine; | 
|---|
|  |  |  | using LitJson; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public class FuncOpen | 
|---|
|  |  |  | { | 
|---|
|  |  |  | private static FuncOpen _inst = null; | 
|---|
|  |  |  | public static FuncOpen Instance { | 
|---|
|  |  |  | get { | 
|---|
|  |  |  | if (_inst == null) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | _inst = new FuncOpen(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return _inst; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | protected FuncOpen() | 
|---|
|  |  |  | { | 
|---|
|  |  |  | if (Application.isEditor) | 
|---|
|  |  |  | public class FuncOpen | 
|---|
|  |  |  | { | 
|---|
|  |  |  | private static FuncOpen _inst = null; | 
|---|
|  |  |  | public static FuncOpen Instance { | 
|---|
|  |  |  | get { | 
|---|
|  |  |  | if (_inst == null) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | if (!Application.isPlaying) return; | 
|---|
|  |  |  | _inst = new FuncOpen(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | var allKeys = new List<int>(FuncOpenLVConfig.dic.Keys);//GetKeys(); | 
|---|
|  |  |  | funcArray = new int[allKeys.Count]; | 
|---|
|  |  |  | int _index = 0; | 
|---|
|  |  |  | foreach (var key in allKeys) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | int func = key; | 
|---|
|  |  |  | funcOpenState[func] = false; | 
|---|
|  |  |  | funcArray[_index] = func; | 
|---|
|  |  |  | _index++; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | DTC0102_tagCDBPlayer.beforePlayerDataInitializeEvent += BeforePlayerDataInitializeEvent; | 
|---|
|  |  |  | DTC0102_tagCDBPlayer.switchAccountEvent += SwitchAccountEvent; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | funcClientLVLimitDict.Clear(); | 
|---|
|  |  |  | var jsonConfig = JsonMapper.ToObject(FuncConfigConfig.Get("FuncLevelLimitClient").Numerical1); | 
|---|
|  |  |  | foreach (var key in jsonConfig.Keys) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | funcClientLVLimitDict[int.Parse(key)] = int.Parse(jsonConfig[key].ToString()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private void BeforePlayerDataInitializeEvent() | 
|---|
|  |  |  | { | 
|---|
|  |  |  | for (int i = 0; i < funcArray.Length; i++) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | funcOpenState[funcArray[i]] = false; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private void SwitchAccountEvent() | 
|---|
|  |  |  | { | 
|---|
|  |  |  | for (int i = 0; i < funcArray.Length; i++) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | funcOpenState[funcArray[i]] = false; | 
|---|
|  |  |  | if (OnFuncStateChangeEvent != null) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | OnFuncStateChangeEvent(funcArray[i]); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // TaskModel m_TaskModel; | 
|---|
|  |  |  | // TaskModel taskmodel { get { return m_TaskModel ?? (m_TaskModel = ModelCenter.Instance.GetModel<TaskModel>()); } } | 
|---|
|  |  |  | private static Dictionary<int, bool> funcOpenState = new Dictionary<int, bool>(); | 
|---|
|  |  |  | private int[] funcArray; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public event Action<int> OnFuncStateChangeEvent; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //纯客户端的功能等级限制, key 以功能配置表的FuncLevelLimitClient为准 | 
|---|
|  |  |  | //1. 精彩活动-全服红包显示等级 | 
|---|
|  |  |  | public Dictionary<int, int> funcClientLVLimitDict = new Dictionary<int, int>(); | 
|---|
|  |  |  | public bool IsClientLVLimit(int key) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | if (!funcClientLVLimitDict.ContainsKey(key)) | 
|---|
|  |  |  | return true; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (PlayerDatas.Instance.baseData.LV >= funcClientLVLimitDict[key]) | 
|---|
|  |  |  | return true; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return false; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public void UpdateFuncState(HA302_tagMCFuncOpenStateList vNetData) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | for (int i = 0; i < vNetData.FuncCount; i++) | 
|---|
|  |  |  | { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | var funcState = vNetData.FuncStateList[i]; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | bool bPerFuncIsOpen = false; | 
|---|
|  |  |  | bool bAfterFuncIsOpen = false; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (!funcOpenState.ContainsKey(funcState.FuncID)) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | funcOpenState.Add(funcState.FuncID, funcState.State == 1); | 
|---|
|  |  |  | bAfterFuncIsOpen = true; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  | bPerFuncIsOpen = funcOpenState[funcState.FuncID]; | 
|---|
|  |  |  | funcOpenState[funcState.FuncID] = funcState.State == 1; | 
|---|
|  |  |  | bAfterFuncIsOpen = funcOpenState[funcState.FuncID]; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (OnFuncStateChangeEvent != null) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | OnFuncStateChangeEvent(funcState.FuncID); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private bool IsFuncOpen(int key, out int errorCode) | 
|---|
|  |  |  | { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | errorCode = 0; | 
|---|
|  |  |  | var config = FuncOpenLVConfig.Get(key); | 
|---|
|  |  |  | if (config == null) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | return false; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | // if (config.LimitMagicWeapon > 0) | 
|---|
|  |  |  | // { | 
|---|
|  |  |  | //     Treasure treasure = null; | 
|---|
|  |  |  | //     var _stage = config.LimitMagicWeapon % 100; | 
|---|
|  |  |  | //     ModelCenter.Instance.GetModel<TreasureModel>().TryGetTreasure(config.LimitMagicWeapon / 100, out treasure); | 
|---|
|  |  |  | //     if (treasure == null || treasure.state != TreasureState.Collected || treasure.level < _stage) | 
|---|
|  |  |  | //     { | 
|---|
|  |  |  | //         errorCode = 2; | 
|---|
|  |  |  | //         return false; | 
|---|
|  |  |  | //     } | 
|---|
|  |  |  | // } | 
|---|
|  |  |  | // if (config.LimitMissionID > 0) | 
|---|
|  |  |  | // { | 
|---|
|  |  |  | // MissionDetailDates missionDetailDates = null; | 
|---|
|  |  |  | // taskmodel.allMissionDict.TryGetValue(config.LimitMissionID, out missionDetailDates); | 
|---|
|  |  |  | // if (missionDetailDates == null || missionDetailDates.MissionState != 3) | 
|---|
|  |  |  | // { | 
|---|
|  |  |  | // errorCode = 4; | 
|---|
|  |  |  | // return false; | 
|---|
|  |  |  | // } | 
|---|
|  |  |  | // } | 
|---|
|  |  |  | // if (config.LimiRealmLV > 0 && PlayerDatas.Instance.baseData.realmLevel < config.LimiRealmLV) | 
|---|
|  |  |  | // { | 
|---|
|  |  |  | //     errorCode = 3; | 
|---|
|  |  |  | //     return false; | 
|---|
|  |  |  | // } | 
|---|
|  |  |  | if (config.LimitLV > 0 && PlayerDatas.Instance.baseData.LV < config.LimitLV) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | errorCode = 1; | 
|---|
|  |  |  | return false; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return true; | 
|---|
|  |  |  | // return false; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public bool IsFuncOpen(int key, bool tip = false) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | bool isOpen = false; | 
|---|
|  |  |  | if (funcOpenState.ContainsKey(key)) | 
|---|
|  |  |  | isOpen = funcOpenState[key]; | 
|---|
|  |  |  | if (!isOpen && tip) | 
|---|
|  |  |  | ProcessorFuncErrorTip(key); | 
|---|
|  |  |  | return isOpen; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public void ProcessorFuncErrorTip(int key) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | var config = FuncOpenLVConfig.Get(key); | 
|---|
|  |  |  | if (config != null) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | SoundPlayer.Instance.PlayUIAudio(SoundPlayer.defaultClickNegativeAudio); | 
|---|
|  |  |  | if (config.Tip.Equals("FuncLimit_Level")) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | SysNotifyMgr.Instance.ShowTip(config.Tip); | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | var errorCode = 0; | 
|---|
|  |  |  | if (!IsFuncOpen(key, out errorCode)) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | switch (errorCode) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | case 1: | 
|---|
|  |  |  | SysNotifyMgr.Instance.ShowTip(config.Tip, Language.Get("OpenFunc4", config.LimitLV)); | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | //  TODO YYL | 
|---|
|  |  |  | // case 2: | 
|---|
|  |  |  | //     var treasureConfig = TreasureConfig.Get(config.LimitMagicWeapon / 100); | 
|---|
|  |  |  | //     SysNotifyMgr.Instance.ShowTip(config.Tip, Language.Get("OpenFunc1", treasureConfig != null ? treasureConfig.Name : string.Empty)); | 
|---|
|  |  |  | //     break; | 
|---|
|  |  |  | // case 3: | 
|---|
|  |  |  | //     SysNotifyMgr.Instance.ShowTip(config.Tip, UIHelper.GetRealmName(config.LimiRealmLV, true)); | 
|---|
|  |  |  | //     break; | 
|---|
|  |  |  | case 4: | 
|---|
|  |  |  | if (config.LimitLV > 0) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | SysNotifyMgr.Instance.ShowTip(config.Tip, Language.Get("OpenFunc2", config.LimitLV)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  | SysNotifyMgr.Instance.ShowTip(config.Tip, Language.Get("OpenFunc3")); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public int GetLimitLv(int key) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | // FuncOpenLVConfig tagFuncOpenLVModel = FuncOpenLVConfig.Get(key); | 
|---|
|  |  |  | // if (tagFuncOpenLVModel.LimitLV != 0) | 
|---|
|  |  |  | // { | 
|---|
|  |  |  | //     return tagFuncOpenLVModel.LimitLV; | 
|---|
|  |  |  | // } | 
|---|
|  |  |  | // if (tagFuncOpenLVModel.LimitMissionID != 0) | 
|---|
|  |  |  | // { | 
|---|
|  |  |  | //     var TaskConfig = PyTaskConfig.Get(tagFuncOpenLVModel.LimitMissionID); | 
|---|
|  |  |  | //     return TaskConfig.lv; | 
|---|
|  |  |  | // } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return 1; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Dictionary<int, ICheckFuncOpen> m_CheckFuncDict = new Dictionary<int, ICheckFuncOpen>(); | 
|---|
|  |  |  | public void Register(int _key, ICheckFuncOpen _check) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | if (!m_CheckFuncDict.ContainsKey(_key)) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | m_CheckFuncDict.Add(_key, _check); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public bool CheckFuncOpen(int _key) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | if (m_CheckFuncDict.ContainsKey(_key)) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | return m_CheckFuncDict[_key].CheckFunc(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return true; | 
|---|
|  |  |  | return _inst; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public interface ICheckFuncOpen | 
|---|
|  |  |  | protected FuncOpen() | 
|---|
|  |  |  | { | 
|---|
|  |  |  | bool CheckFunc(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (Application.isEditor) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | if (!Application.isPlaying) return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | var allKeys = new List<int>(FuncOpenLVConfig.dic.Keys);//GetKeys(); | 
|---|
|  |  |  | funcArray = new int[allKeys.Count]; | 
|---|
|  |  |  | int _index = 0; | 
|---|
|  |  |  | foreach (var key in allKeys) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | int func = key; | 
|---|
|  |  |  | funcOpenState[func] = false; | 
|---|
|  |  |  | funcArray[_index] = func; | 
|---|
|  |  |  | _index++; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | DTC0102_tagCDBPlayer.beforePlayerDataInitializeEvent += BeforePlayerDataInitializeEvent; | 
|---|
|  |  |  | DTC0102_tagCDBPlayer.switchAccountEvent += SwitchAccountEvent; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | funcClientLVLimitDict.Clear(); | 
|---|
|  |  |  | var jsonConfig = JsonMapper.ToObject(FuncConfigConfig.Get("FuncLevelLimitClient").Numerical1); | 
|---|
|  |  |  | foreach (var key in jsonConfig.Keys) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | funcClientLVLimitDict[int.Parse(key)] = int.Parse(jsonConfig[key].ToString()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private void BeforePlayerDataInitializeEvent() | 
|---|
|  |  |  | { | 
|---|
|  |  |  | for (int i = 0; i < funcArray.Length; i++) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | funcOpenState[funcArray[i]] = false; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private void SwitchAccountEvent() | 
|---|
|  |  |  | { | 
|---|
|  |  |  | for (int i = 0; i < funcArray.Length; i++) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | funcOpenState[funcArray[i]] = false; | 
|---|
|  |  |  | if (OnFuncStateChangeEvent != null) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | OnFuncStateChangeEvent(funcArray[i]); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // TaskModel m_TaskModel; | 
|---|
|  |  |  | // TaskModel taskmodel { get { return m_TaskModel ?? (m_TaskModel = ModelCenter.Instance.GetModel<TaskModel>()); } } | 
|---|
|  |  |  | private static Dictionary<int, bool> funcOpenState = new Dictionary<int, bool>(); | 
|---|
|  |  |  | private int[] funcArray; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public event Action<int> OnFuncStateChangeEvent; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //纯客户端的功能等级限制, key 以功能配置表的FuncLevelLimitClient为准 | 
|---|
|  |  |  | //1. 精彩活动-全服红包显示等级 | 
|---|
|  |  |  | public Dictionary<int, int> funcClientLVLimitDict = new Dictionary<int, int>(); | 
|---|
|  |  |  | public bool IsClientLVLimit(int key) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | if (!funcClientLVLimitDict.ContainsKey(key)) | 
|---|
|  |  |  | return true; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (PlayerDatas.Instance.baseData.LV >= funcClientLVLimitDict[key]) | 
|---|
|  |  |  | return true; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return false; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public void UpdateFuncState(HA302_tagMCFuncOpenStateList vNetData) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | for (int i = 0; i < vNetData.FuncCount; i++) | 
|---|
|  |  |  | { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | var funcState = vNetData.FuncStateList[i]; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | bool bPerFuncIsOpen = false; | 
|---|
|  |  |  | bool bAfterFuncIsOpen = false; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (!funcOpenState.ContainsKey(funcState.FuncID)) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | funcOpenState.Add(funcState.FuncID, funcState.State == 1); | 
|---|
|  |  |  | bAfterFuncIsOpen = true; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  | bPerFuncIsOpen = funcOpenState[funcState.FuncID]; | 
|---|
|  |  |  | funcOpenState[funcState.FuncID] = funcState.State == 1; | 
|---|
|  |  |  | bAfterFuncIsOpen = funcOpenState[funcState.FuncID]; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (OnFuncStateChangeEvent != null) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | OnFuncStateChangeEvent(funcState.FuncID); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private bool IsFuncOpen(int key, out int errorCode) | 
|---|
|  |  |  | { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | errorCode = 0; | 
|---|
|  |  |  | var config = FuncOpenLVConfig.Get(key); | 
|---|
|  |  |  | if (config == null) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | return false; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (config.OpenDay > 0) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | if (config.OpenDay > TimeUtility.OpenDay + 1) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | errorCode = 2; | 
|---|
|  |  |  | return false; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (config.LimitMissionID > 0) | 
|---|
|  |  |  | { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (TaskManager.Instance.GetNeedFinishTaskCount(config.LimitMissionID) > 0) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | errorCode = 4; | 
|---|
|  |  |  | return false; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (config.LimiRealmLV > 0 && PlayerDatas.Instance.baseData.realmLevel < config.LimiRealmLV) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | errorCode = 3; | 
|---|
|  |  |  | return false; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (config.LimitLV > 0 && PlayerDatas.Instance.baseData.LV < config.LimitLV) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | errorCode = 1; | 
|---|
|  |  |  | return false; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return true; | 
|---|
|  |  |  | // return false; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public bool IsFuncOpen(int key, bool tip = false) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | bool isOpen = false; | 
|---|
|  |  |  | if (funcOpenState.ContainsKey(key)) | 
|---|
|  |  |  | isOpen = funcOpenState[key]; | 
|---|
|  |  |  | if (!isOpen && tip) | 
|---|
|  |  |  | ProcessorFuncErrorTip(key); | 
|---|
|  |  |  | return isOpen; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public void ProcessorFuncErrorTip(int key) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | var config = FuncOpenLVConfig.Get(key); | 
|---|
|  |  |  | if (config != null) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | SoundPlayer.Instance.PlayUIAudio(SoundPlayer.defaultClickNegativeAudio); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | var errorCode = 0; | 
|---|
|  |  |  | if (!IsFuncOpen(key, out errorCode)) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | switch (errorCode) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | case 1: | 
|---|
|  |  |  | SysNotifyMgr.Instance.ShowStringTip(Language.Get("FuncLimit_Level", config.LimitLV) | 
|---|
|  |  |  | + Language.Get("FuncLimitOpen1")); | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | case 2: | 
|---|
|  |  |  | //开服多少天 一般是组合 | 
|---|
|  |  |  | if (config.LimitLV != 0) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | SysNotifyMgr.Instance.ShowStringTip(Language.Get("FuncLimit_OpenDay", config.OpenDay) | 
|---|
|  |  |  | + Language.Get("FuncLimitOpen2") | 
|---|
|  |  |  | + Language.Get("FuncLimit_Level", config.LimitLV) | 
|---|
|  |  |  | + Language.Get("FuncLimitOpen1")); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else if (config.LimitMissionID != 0) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | SysNotifyMgr.Instance.ShowStringTip(Language.Get("FuncLimit_OpenDay", config.OpenDay) | 
|---|
|  |  |  | + Language.Get("FuncLimitOpen2") | 
|---|
|  |  |  | + Language.Get("FuncLimit_Mission", TaskManager.Instance.GetNeedFinishTaskCount(config.LimitMissionID)) | 
|---|
|  |  |  | + Language.Get("FuncLimitOpen1")); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  | SysNotifyMgr.Instance.ShowStringTip(Language.Get("FuncLimit_OpenDay", config.OpenDay) | 
|---|
|  |  |  | + Language.Get("FuncLimitOpen1")); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | case 3: | 
|---|
|  |  |  | SysNotifyMgr.Instance.ShowStringTip(Language.Get("FuncLimit_Realm", RealmConfig.Get(config.LimiRealmLV).Name) | 
|---|
|  |  |  | + Language.Get("FuncLimitOpen1")); | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | case 4: | 
|---|
|  |  |  | SysNotifyMgr.Instance.ShowStringTip(Language.Get("FuncLimit_Mission", TaskManager.Instance.GetNeedFinishTaskCount(config.LimitMissionID)) | 
|---|
|  |  |  | + Language.Get("FuncLimitOpen1")); | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public int GetLimitLv(int key) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | // FuncOpenLVConfig tagFuncOpenLVModel = FuncOpenLVConfig.Get(key); | 
|---|
|  |  |  | // if (tagFuncOpenLVModel.LimitLV != 0) | 
|---|
|  |  |  | // { | 
|---|
|  |  |  | //     return tagFuncOpenLVModel.LimitLV; | 
|---|
|  |  |  | // } | 
|---|
|  |  |  | // if (tagFuncOpenLVModel.LimitMissionID != 0) | 
|---|
|  |  |  | // { | 
|---|
|  |  |  | //     var TaskConfig = PyTaskConfig.Get(tagFuncOpenLVModel.LimitMissionID); | 
|---|
|  |  |  | //     return TaskConfig.lv; | 
|---|
|  |  |  | // } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return 1; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Dictionary<int, ICheckFuncOpen> m_CheckFuncDict = new Dictionary<int, ICheckFuncOpen>(); | 
|---|
|  |  |  | public void Register(int _key, ICheckFuncOpen _check) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | if (!m_CheckFuncDict.ContainsKey(_key)) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | m_CheckFuncDict.Add(_key, _check); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public bool CheckFuncOpen(int _key) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | if (m_CheckFuncDict.ContainsKey(_key)) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | return m_CheckFuncDict[_key].CheckFunc(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return true; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public interface ICheckFuncOpen | 
|---|
|  |  |  | { | 
|---|
|  |  |  | bool CheckFunc(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | using System; | 
|---|
|  |  |  | using UnityEngine.EventSystems; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public class UIFuncOpen : MonoBehaviour, IPointerClickHandler | 
|---|
|  |  |  | public class UIFuncOpen : MonoBehaviour, IPointerClickHandler | 
|---|
|  |  |  | { | 
|---|
|  |  |  | [SerializeField] int funcOpenKey; | 
|---|
|  |  |  | [SerializeField] GameObject LockImg; | 
|---|
|  |  |  | [SerializeField] bool active = true; | 
|---|
|  |  |  | public int id { get { return funcOpenKey; } } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private Button funcBtn; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private void Awake() | 
|---|
|  |  |  | { | 
|---|
|  |  |  | [SerializeField] int funcOpenKey; | 
|---|
|  |  |  | [SerializeField] GameObject LockImg; | 
|---|
|  |  |  | [SerializeField] bool active = true; | 
|---|
|  |  |  | public int id { get { return funcOpenKey; } } | 
|---|
|  |  |  | funcBtn = GetComponent<Button>(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private Button funcBtn; | 
|---|
|  |  |  | FuncOpen.Instance.OnFuncStateChangeEvent += OnFuncStateChangeEvent; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private void Awake() | 
|---|
|  |  |  | public void OnPointerClick(PointerEventData eventData) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | if (!FuncOpen.Instance.IsFuncOpen(funcOpenKey)) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | funcBtn = GetComponent<Button>(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | FuncOpen.Instance.OnFuncStateChangeEvent += OnFuncStateChangeEvent; | 
|---|
|  |  |  | FuncOpen.Instance.ProcessorFuncErrorTip(funcOpenKey); | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public void OnPointerClick(PointerEventData eventData) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | if (!FuncOpen.Instance.IsFuncOpen(funcOpenKey)) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | FuncOpen.Instance.ProcessorFuncErrorTip(funcOpenKey); | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | private void OnEnable() | 
|---|
|  |  |  | { | 
|---|
|  |  |  | SetState(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private void OnEnable() | 
|---|
|  |  |  | private void OnFuncStateChangeEvent(int func) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | if (funcOpenKey == func) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | SetState(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private void OnFuncStateChangeEvent(int func) | 
|---|
|  |  |  | private void OnDestroy() | 
|---|
|  |  |  | { | 
|---|
|  |  |  | FuncOpen.Instance.OnFuncStateChangeEvent -= OnFuncStateChangeEvent; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | private void SetState() | 
|---|
|  |  |  | { | 
|---|
|  |  |  | var IsOpen = FuncOpen.Instance.IsFuncOpen(funcOpenKey); | 
|---|
|  |  |  | var _funcOpenCfg = FuncOpenLVConfig.Get(funcOpenKey); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (_funcOpenCfg == null) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | if (funcOpenKey == func) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | SetState(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | IsOpen = true; | 
|---|
|  |  |  | active = true; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private void OnDestroy() | 
|---|
|  |  |  | if (funcBtn != null) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | FuncOpen.Instance.OnFuncStateChangeEvent -= OnFuncStateChangeEvent; | 
|---|
|  |  |  | funcBtn.interactable = IsOpen; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | private void SetState() | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (LockImg != null) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | var IsOpen = FuncOpen.Instance.IsFuncOpen(funcOpenKey); | 
|---|
|  |  |  | var _funcOpenCfg = FuncOpenLVConfig.Get(funcOpenKey); | 
|---|
|  |  |  | LockImg.SetActive(!IsOpen); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (_funcOpenCfg == null) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | IsOpen = true; | 
|---|
|  |  |  | active = true; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | // 未开启是否显示的配置 | 
|---|
|  |  |  | // if (_funcOpenCfg != null && _funcOpenCfg.open == 0) | 
|---|
|  |  |  | // { | 
|---|
|  |  |  | //     gameObject.SetActive(false); | 
|---|
|  |  |  | //     return; | 
|---|
|  |  |  | // } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (funcBtn != null) | 
|---|
|  |  |  | if (!active) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | gameObject.SetActive(IsOpen); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  | if (!gameObject.activeSelf) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | funcBtn.interactable = IsOpen; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (LockImg != null) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | LockImg.SetActive(!IsOpen); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (_funcOpenCfg != null && _funcOpenCfg.open == 0) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | gameObject.SetActive(false); | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (!active) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | gameObject.SetActive(IsOpen); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  | if (!gameObject.activeSelf) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | gameObject.SetActive(true); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | gameObject.SetActive(true); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | //-------------------------------------------------------- | 
|---|
|  |  |  | //    [Author]:           YYL | 
|---|
|  |  |  | //    [  Date ]:           2025年8月20日 | 
|---|
|  |  |  | //    [  Date ]:           2025年8月28日 | 
|---|
|  |  |  | //-------------------------------------------------------- | 
|---|
|  |  |  |  | 
|---|
|  |  |  | using System.Collections.Generic; | 
|---|
|  |  |  | 
|---|
|  |  |  | public int LimitLV; | 
|---|
|  |  |  | public int LimiRealmLV; | 
|---|
|  |  |  | public int LimitMissionID; | 
|---|
|  |  |  | public int OpenDay; | 
|---|
|  |  |  | public string Name; | 
|---|
|  |  |  | public string Desc; | 
|---|
|  |  |  | public string Tip; | 
|---|
|  |  |  | public string Icon; | 
|---|
|  |  |  | public int open; | 
|---|
|  |  |  | public Dictionary<int, int[][]> Award; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public override int LoadKey(string _key) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | int.TryParse(tables[3],out LimitMissionID); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Name = tables[4]; | 
|---|
|  |  |  | int.TryParse(tables[4],out OpenDay); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Desc = tables[5]; | 
|---|
|  |  |  | Name = tables[5]; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Tip = tables[6]; | 
|---|
|  |  |  | Desc = tables[6]; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Icon = tables[7]; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | int.TryParse(tables[8],out open); | 
|---|
|  |  |  | Award = ConfigParse.ParseIntArray2Dict(tables[8]); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | catch (Exception exception) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | 
|---|
|  |  |  | //-------------------------------------------------------- | 
|---|
|  |  |  | //    [Author]:           YYL | 
|---|
|  |  |  | //    [  Date ]:           2025年8月7日 | 
|---|
|  |  |  | //    [  Date ]:           Thursday, August 28, 2025 | 
|---|
|  |  |  | //-------------------------------------------------------- | 
|---|
|  |  |  |  | 
|---|
|  |  |  | using System.Collections.Generic; | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public int Quality; | 
|---|
|  |  |  | public int[] UPCostItem; | 
|---|
|  |  |  | public int InitStarUpper; | 
|---|
|  |  |  | public int InitAddPer; | 
|---|
|  |  |  | public int LVAddPer; | 
|---|
|  |  |  | 
|---|
|  |  |  | string[] tables = input.Split('\t'); | 
|---|
|  |  |  | int.TryParse(tables[0],out Quality); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (tables[1].Contains("[")) | 
|---|
|  |  |  | int.TryParse(tables[1],out InitStarUpper); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | int.TryParse(tables[2],out InitAddPer); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | int.TryParse(tables[3],out LVAddPer); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | int.TryParse(tables[4],out BreakLVAddPer); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | int.TryParse(tables[5],out StarAddPer); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (tables[6].Contains("[")) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | UPCostItem = JsonMapper.ToObject<int[]>(tables[1]); | 
|---|
|  |  |  | BookActAwardMoney = JsonMapper.ToObject<int[]>(tables[6]); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  | string[] UPCostItemStringArray = tables[1].Trim().Split(StringUtility.splitSeparator,StringSplitOptions.RemoveEmptyEntries); | 
|---|
|  |  |  | UPCostItem = new int[UPCostItemStringArray.Length]; | 
|---|
|  |  |  | for (int i=0;i<UPCostItemStringArray.Length;i++) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | int.TryParse(UPCostItemStringArray[i],out UPCostItem[i]); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | int.TryParse(tables[2],out InitStarUpper); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | int.TryParse(tables[3],out InitAddPer); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | int.TryParse(tables[4],out LVAddPer); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | int.TryParse(tables[5],out BreakLVAddPer); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | int.TryParse(tables[6],out StarAddPer); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (tables[7].Contains("[")) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | BookActAwardMoney = JsonMapper.ToObject<int[]>(tables[7]); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  | string[] BookActAwardMoneyStringArray = tables[7].Trim().Split(StringUtility.splitSeparator,StringSplitOptions.RemoveEmptyEntries); | 
|---|
|  |  |  | string[] BookActAwardMoneyStringArray = tables[6].Trim().Split(StringUtility.splitSeparator,StringSplitOptions.RemoveEmptyEntries); | 
|---|
|  |  |  | BookActAwardMoney = new int[BookActAwardMoneyStringArray.Length]; | 
|---|
|  |  |  | for (int i=0;i<BookActAwardMoneyStringArray.Length;i++) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | int.TryParse(tables[8],out BookInitAddPer); | 
|---|
|  |  |  | int.TryParse(tables[7],out BookInitAddPer); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | int.TryParse(tables[9],out BookStarAddPer); | 
|---|
|  |  |  | int.TryParse(tables[8],out BookStarAddPer); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | int.TryParse(tables[10],out BookBreakLVAddPer); | 
|---|
|  |  |  | int.TryParse(tables[9],out BookBreakLVAddPer); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | DismissReturnItems = JsonMapper.ToObject<int[][]>(tables[11].Replace("(", "[").Replace(")", "]")); | 
|---|
|  |  |  | DismissReturnItems = JsonMapper.ToObject<int[][]>(tables[10].Replace("(", "[").Replace(")", "]")); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | catch (Exception exception) | 
|---|
|  |  |  | { | 
|---|
| New file | 
|  |  |  | 
|---|
|  |  |  | using UnityEngine; | 
|---|
|  |  |  | using System.Collections; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //03 03 设置快捷栏保存#tagCSetShutCutData | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public class C0303_tagCSetShutCutData : GameNetPackBasic { | 
|---|
|  |  |  | public string Setting; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public C0303_tagCSetShutCutData () { | 
|---|
|  |  |  | _cmd = (ushort)0x0303; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public override void WriteToBytes () { | 
|---|
|  |  |  | WriteBytes (Setting, NetDataType.Chars, 100); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
copy from Main/Component/UI/Common/FuncEnable.cs.meta
copy to Main/Core/NetworkPackage/ClientPack/C03_MainCharacter/C0303_tagCSetShutCutData.cs.meta
| File was copied from Main/Component/UI/Common/FuncEnable.cs.meta | 
|  |  |  | 
|---|
|  |  |  | fileFormatVersion: 2 | 
|---|
|  |  |  | guid: e034d1a3f772bb44bbbcd4273f5084e1 | 
|---|
|  |  |  | timeCreated: 1516430103 | 
|---|
|  |  |  | licenseType: Free | 
|---|
|  |  |  | guid: 35992e06ad8ed6049bbfca868849f3d1 | 
|---|
|  |  |  | MonoImporter: | 
|---|
|  |  |  | externalObjects: {} | 
|---|
|  |  |  | serializedVersion: 2 | 
|---|
|  |  |  | defaultReferences: [] | 
|---|
|  |  |  | executionOrder: 0 | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | PlayerDatas.Instance.InitPlayerData(package); | 
|---|
|  |  |  | PlayerDatas.Instance.RequestWorldTick(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | QuickSetting.Instance.SetQuickSetting(package.Setting); | 
|---|
|  |  |  | if (playerIdBuf != 0 && playerIdBuf != PlayerDatas.Instance.baseData.PlayerID) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | if (switchAccountEvent != null) | 
|---|
|  |  |  | 
|---|
|  |  |  | managers.Add(HeroUIManager.Instance); | 
|---|
|  |  |  | managers.Add(InvestModel.Instance); | 
|---|
|  |  |  | managers.Add(BlessLVManager.Instance); | 
|---|
|  |  |  | managers.Add(AutoFightModel.Instance); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | foreach (var manager in managers) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | 
|---|
|  |  |  | for (int i = 0; i < act.ctgIDs.Count; i++) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | int ctgID = act.ctgIDs[i]; | 
|---|
|  |  |  | RechargeManager.RechargeCount rechargeCount; | 
|---|
|  |  |  | RechargeCount rechargeCount; | 
|---|
|  |  |  | if (RechargeManager.Instance.TryGetRechargeCount(ctgID, out rechargeCount)) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | total += rechargeCount.totalCount; | 
|---|
|  |  |  | 
|---|
|  |  |  | OperationRechargeGiftAct act; | 
|---|
|  |  |  | OperationTimeHepler.Instance.TryGetOperation(operaType, out act); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | RechargeManager.RechargeCount rechargeCount; | 
|---|
|  |  |  | RechargeCount rechargeCount; | 
|---|
|  |  |  | RechargeManager.Instance.TryGetRechargeCount(ctgID, out rechargeCount); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | var ctgConfig = CTGConfig.Get(ctgID); | 
|---|
|  |  |  | 
|---|
|  |  |  | if (!RechargeManager.Instance.TryGetRechargeItem(ctgId, out awards)) | 
|---|
|  |  |  | return false; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | RechargeManager.RechargeCount rechargeCount; | 
|---|
|  |  |  | RechargeCount rechargeCount; | 
|---|
|  |  |  | if (!RechargeManager.Instance.TryGetRechargeCount(ctgId, out rechargeCount)) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | return false; | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public void InitChoose() | 
|---|
|  |  |  | { | 
|---|
|  |  |  | RechargeManager.RechargeCount rechargeCount; | 
|---|
|  |  |  | RechargeCount rechargeCount; | 
|---|
|  |  |  | RechargeManager.Instance.TryGetRechargeCount(chooseCTGID, out rechargeCount); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | var selectedItemIndexs = CustomizedRechargeModel.Instance.GetSelectedItems(rechargeCount.selectItemValue); | 
|---|
|  |  |  | 
|---|
|  |  |  | int goodsSumCount; //商品总数量 | 
|---|
|  |  |  | List<Item> awards = new List<Item>(); | 
|---|
|  |  |  | TryGetRechargeItemEx(ctgID, out awards, out goodsCount, out goodsSumCount); | 
|---|
|  |  |  | RechargeManager.RechargeCount rechargeCount; | 
|---|
|  |  |  | RechargeCount rechargeCount; | 
|---|
|  |  |  | RechargeManager.Instance.TryGetRechargeCount(ctgID, out rechargeCount); | 
|---|
|  |  |  | for (int i = 0; i < itemCells.Count; i++) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | 
|---|
|  |  |  | public class EquipModel : GameSystemManager<EquipModel> | 
|---|
|  |  |  | { | 
|---|
|  |  |  | public const int TotleEquip = 12;  //装备栏大小 | 
|---|
|  |  |  | public bool waitEquipOPPack = false; | 
|---|
|  |  |  | public bool waitEquipOPPack = false;    // 穿戴装备的操作 不含分解 | 
|---|
|  |  |  | public event Action<bool, int> OnEquipOPResultAction;    //是否换上了新装备且分解了 装备索引 | 
|---|
|  |  |  | public event Action<List<int>, RectTransform> OnItemDropEvent; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | public int[] equipUIGirdEffects;  //装备格子特效 | 
|---|
|  |  |  | public ItemModel selectFloorEquip; //选中的地板装备 | 
|---|
|  |  |  | public int lastShowEquipIndex = -1;  //上一次界面显示装备的索引,拾取后物品消失需记录下做表现 | 
|---|
|  |  |  | public Queue<int> waitEquipOP = new Queue<int>();    //等待操作的装备,需要和UI交互确认 | 
|---|
|  |  |  | public Queue<int> waitEquipOP = new Queue<int>();    //等待操作的装备,需要和UI交互确认 不含分解 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public override void Init() | 
|---|
|  |  |  | { | 
|---|
|  |  |  | 
|---|
|  |  |  | // if (!IsEquip(equip)) | 
|---|
|  |  |  | //     return false; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (AutoFightModel.Instance.TryAutoFightDoEquip(equip)) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | //自动战力对比, 条件不满足的分解 | 
|---|
|  |  |  | return false; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 好几件装备需要处理的情况存起来 | 
|---|
|  |  |  | waitEquipOP.Enqueue(equip.gridIndex); | 
|---|
|  |  |  | //未回复装备操作结果,否则会显示旧装备 | 
|---|
|  |  |  | if (waitEquipOPPack) | 
|---|
|  |  |  | 
|---|
|  |  |  | return false; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | selectFloorEquip = GetSelectFloorEquip(); | 
|---|
|  |  |  | if (selectFloorEquip == null) | 
|---|
|  |  |  | return false; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | UIManager.Instance.OpenWindow<EquipExchangeWin>(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return true; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | if (waitEquipOP.Count == 0) | 
|---|
|  |  |  | return null; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | ItemModel item = PackManager.Instance.GetItemByIndex(PackType.DropItem, waitEquipOP.Dequeue()); | 
|---|
|  |  |  | if (AutoFightModel.Instance.isAutoAttack) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | //自动战力对比, 条件不满足的分解 | 
|---|
|  |  |  | return null; | 
|---|
|  |  |  | return PackManager.Instance.GetItemByIndex(PackType.DropItem, waitEquipOP.Dequeue()); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return item; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //等级 | 
|---|
|  |  |  | public int GetEquipLV(ItemModel equip) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | 
|---|
|  |  |  | //     InGameDownLoad.Instance.downLoadGo = false; | 
|---|
|  |  |  | //     DownloadMgr.MaxDownLoadTask = InGameDownLoad.Instance.GetMaxTask(); | 
|---|
|  |  |  | // }); | 
|---|
|  |  |  | AutoFightModel.Instance.isAutoAttack = false; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | protected override void OnOpenAnimationComplete() | 
|---|
|  |  |  | 
|---|
|  |  |  | public override void Refresh() | 
|---|
|  |  |  | { | 
|---|
|  |  |  | base.Refresh(); | 
|---|
|  |  |  | Debug.Log("刷新登录窗口"); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //打包版本 + 功能版本 + 语言ID | 
|---|
|  |  |  | Debug.Log("刷新登录窗口"); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //打包版本 + 功能版本 + 语言ID | 
|---|
|  |  |  | verInfo.text = LoginManager.Instance.GetVersionStr(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | var sprite = BuiltInLoader.LoadSprite("TB_DL_Logo"); | 
|---|
|  |  |  | 
|---|
|  |  |  | using System.Collections; | 
|---|
|  |  |  | using System.Collections.Generic; | 
|---|
|  |  |  | using System.Text; | 
|---|
|  |  |  | using LitJson; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | using UnityEngine; | 
|---|
|  |  |  | public class AutoFightModel : GameSystemManager<AutoFightModel> | 
|---|
|  |  |  | { | 
|---|
|  |  |  | public int fightSpeed = 1; //战斗倍数:值越大越快,影响战斗表现,掉落速度等 | 
|---|
|  |  |  | //战斗倍数:值越大越快,影响战斗表现,掉落速度等 | 
|---|
|  |  |  | public int fightSpeed | 
|---|
|  |  |  | { | 
|---|
|  |  |  | get | 
|---|
|  |  |  | { | 
|---|
|  |  |  | int value = QuickSetting.Instance.GetQuickSettingValue<int>(QuickSettingType.AutoFight_Speed, 0); | 
|---|
|  |  |  | return Math.Min(Math.Max(value, 1), maxSpeed); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | set | 
|---|
|  |  |  | { | 
|---|
|  |  |  | QuickSetting.Instance.SetQuickSetting(QuickSettingType.AutoFight_Speed, value); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public bool isAutoAttack; //自动攻击 | 
|---|
|  |  |  | //消耗倍数 | 
|---|
|  |  |  | public int fightCost | 
|---|
|  |  |  | { | 
|---|
|  |  |  | get | 
|---|
|  |  |  | { | 
|---|
|  |  |  | int value = QuickSetting.Instance.GetQuickSettingValue<int>(QuickSettingType.AutoFight_Cost, 0); | 
|---|
|  |  |  | return Math.Min(Math.Max(value, 1), maxCost); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | set | 
|---|
|  |  |  | { | 
|---|
|  |  |  | QuickSetting.Instance.SetQuickSetting(QuickSettingType.AutoFight_Cost, value); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //自动模式, 真正点击战锤消耗开启,和休息(或无材料)停止 | 
|---|
|  |  |  | public bool isAutoAttack = false; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //是否开启自动战斗设置 | 
|---|
|  |  |  | public bool isAutoAttackSet | 
|---|
|  |  |  | { | 
|---|
|  |  |  | get | 
|---|
|  |  |  | { | 
|---|
|  |  |  | return QuickSetting.Instance.GetQuickSettingBool(QuickSettingType.AutoFight_Open, 0); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | set | 
|---|
|  |  |  | { | 
|---|
|  |  |  | QuickSetting.Instance.SetQuickSetting(QuickSettingType.AutoFight_Open, value); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //更好装备停止战斗 | 
|---|
|  |  |  | public bool isStopFightByBetterEquip | 
|---|
|  |  |  | { | 
|---|
|  |  |  | get | 
|---|
|  |  |  | { | 
|---|
|  |  |  | return QuickSetting.Instance.GetQuickSettingBool(QuickSettingType.AutoFight_FightPower, 0); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | set | 
|---|
|  |  |  | { | 
|---|
|  |  |  | QuickSetting.Instance.SetQuickSetting(QuickSettingType.AutoFight_FightPower, value); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public event Action ChangeAutoEvent; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public int maxSpeed = 3; //最高速度 | 
|---|
|  |  |  | public int maxCost; //最高消耗 | 
|---|
|  |  |  | public int[] autoCostWithBlessLV; //自动战斗消耗倍数关联祝福等级 | 
|---|
|  |  |  | public int speed2UnlockMissionID; | 
|---|
|  |  |  | public int speed3UnlockCTGID; | 
|---|
|  |  |  | public override void Init() | 
|---|
|  |  |  | { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | ParseConfig(); | 
|---|
|  |  |  | DTC0403_tagPlayerLoginLoadOK.playerLoginOkEvent += OnPlayerLoginOk; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public override void Release() | 
|---|
|  |  |  | { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | DTC0403_tagPlayerLoginLoadOK.playerLoginOkEvent -= OnPlayerLoginOk; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | void ParseConfig() | 
|---|
|  |  |  | { | 
|---|
|  |  |  | var config = FuncConfigConfig.Get("AutoGuaji"); | 
|---|
|  |  |  | autoCostWithBlessLV = JsonMapper.ToObject<int[]>(config.Numerical1); | 
|---|
|  |  |  | speed2UnlockMissionID = int.Parse(config.Numerical2); | 
|---|
|  |  |  | speed3UnlockCTGID = int.Parse(config.Numerical3); | 
|---|
|  |  |  | maxCost = autoCostWithBlessLV.Length; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | void OnPlayerLoginOk() | 
|---|
|  |  |  | { | 
|---|
|  |  |  | //登录时有装备的处理 | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public void SaveAutoFightSetting() | 
|---|
|  |  |  | { | 
|---|
|  |  |  | QuickSetting.Instance.SendPackage(); | 
|---|
|  |  |  | ChangeAutoEvent?.Invoke(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //自动处理装备,需要等待穿戴返回false,其他情况返回true | 
|---|
|  |  |  | public bool TryAutoFightDoEquip(ItemModel item) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | if (!isAutoAttack) | 
|---|
|  |  |  | return false; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (item == null) | 
|---|
|  |  |  | return true; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | long showFightPower = FightPowerManager.Instance.GetFightPowerChange(item); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (showFightPower < 0) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | EquipModel.Instance.SendEquipOP(new ushort[] { (ushort)item.gridIndex }, 1); | 
|---|
|  |  |  | return true; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  | if (isStopFightByBetterEquip) | 
|---|
|  |  |  | return false; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | EquipModel.Instance.SendEquipOP(new ushort[] { (ushort)item.gridIndex }, 1); | 
|---|
|  |  |  | return true; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
| New file | 
|  |  |  | 
|---|
|  |  |  | using System.Collections; | 
|---|
|  |  |  | using System.Collections.Generic; | 
|---|
|  |  |  | using UnityEngine; | 
|---|
|  |  |  | using UnityEngine.UI; | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public class AutoFightWin : UIBase | 
|---|
|  |  |  | { | 
|---|
|  |  |  | [SerializeField] Button autoStartBtn; | 
|---|
|  |  |  | [SerializeField] GameObject usingAutoObj; | 
|---|
|  |  |  | [SerializeField] Button autoStopBtn; | 
|---|
|  |  |  | [SerializeField] Button autoSaveBtn; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | [SerializeField] Button changeCostBtn; | 
|---|
|  |  |  | [SerializeField] Text costText; | 
|---|
|  |  |  | [SerializeField] Image costArrow; | 
|---|
|  |  |  | [SerializeField] Text costTip; | 
|---|
|  |  |  | [SerializeField] ScrollerController costScroll; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | [SerializeField] Button changeSpeedBtn; | 
|---|
|  |  |  | [SerializeField] Text speedText; | 
|---|
|  |  |  | [SerializeField] Image speedArrow; | 
|---|
|  |  |  | [SerializeField] ScrollerController speedScroll; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | [SerializeField] Toggle betterEquipToggle; | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | bool isOpenCostScroll = false; | 
|---|
|  |  |  | bool isOpenSpeedScroll = false; | 
|---|
|  |  |  | protected override void InitComponent() | 
|---|
|  |  |  | { | 
|---|
|  |  |  | autoStartBtn.AddListener(OnClickAutoStart); | 
|---|
|  |  |  | autoStopBtn.AddListener(OnClickAutoStop); | 
|---|
|  |  |  | autoSaveBtn.AddListener(OnClickAutoStart); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | changeCostBtn.AddListener(() => | 
|---|
|  |  |  | { | 
|---|
|  |  |  | isOpenCostScroll = !isOpenCostScroll; | 
|---|
|  |  |  | costScroll.SetActive(isOpenCostScroll); | 
|---|
|  |  |  | costArrow.transform.localRotation = Quaternion.Euler(0, 0, isOpenCostScroll ? 180 : 0); | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | changeSpeedBtn.AddListener(() => | 
|---|
|  |  |  | { | 
|---|
|  |  |  | isOpenSpeedScroll = !isOpenSpeedScroll; | 
|---|
|  |  |  | speedScroll.SetActive(isOpenSpeedScroll); | 
|---|
|  |  |  | speedArrow.transform.localRotation = Quaternion.Euler(0, 0, isOpenSpeedScroll ? 180 : 0); | 
|---|
|  |  |  | }); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | betterEquipToggle.AddListener((bool value) => | 
|---|
|  |  |  | { | 
|---|
|  |  |  | betterEquipToggle.isOn = value; | 
|---|
|  |  |  | }); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | costScroll.GetComponent<ClickScreenOtherSpace>().AddListener(() => | 
|---|
|  |  |  | { | 
|---|
|  |  |  | isOpenCostScroll = false; | 
|---|
|  |  |  | costArrow.transform.localRotation = Quaternion.Euler(0, 0, 0); | 
|---|
|  |  |  | }); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | speedScroll.GetComponent<ClickScreenOtherSpace>().AddListener(() => | 
|---|
|  |  |  | { | 
|---|
|  |  |  | isOpenSpeedScroll = false; | 
|---|
|  |  |  | speedArrow.transform.localRotation = Quaternion.Euler(0, 0, 0); | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | protected override void OnPreOpen() | 
|---|
|  |  |  | { | 
|---|
|  |  |  | costScroll.OnRefreshCell += OnRefreshCostCell; | 
|---|
|  |  |  | speedScroll.OnRefreshCell += OnRefreshSpeedCell; | 
|---|
|  |  |  | Display(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | protected override void OnPreClose() | 
|---|
|  |  |  | { | 
|---|
|  |  |  | costScroll.OnRefreshCell -= OnRefreshCostCell; | 
|---|
|  |  |  | speedScroll.OnRefreshCell -= OnRefreshSpeedCell; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | void Display() | 
|---|
|  |  |  | { | 
|---|
|  |  |  | costText.text = AutoFightModel.Instance.fightCost.ToString(); | 
|---|
|  |  |  | speedText.text = AutoFightModel.Instance.fightSpeed.ToString(); | 
|---|
|  |  |  | betterEquipToggle.isOn = AutoFightModel.Instance.isStopFightByBetterEquip; | 
|---|
|  |  |  | costTip.text = Language.Get("AutoFight2", ItemConfig.Get(GeneralDefine.MoneyDisplayModel[41]).ItemName, AutoFightModel.Instance.fightCost); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (AutoFightModel.Instance.isAutoAttackSet) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | usingAutoObj.SetActive(true); | 
|---|
|  |  |  | autoStartBtn.SetActive(false); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  | usingAutoObj.SetActive(false); | 
|---|
|  |  |  | autoStartBtn.SetActive(true); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | costScroll.SetActive(false); | 
|---|
|  |  |  | speedScroll.SetActive(false); | 
|---|
|  |  |  | costArrow.transform.localRotation = Quaternion.Euler(0, 0, 0); | 
|---|
|  |  |  | speedArrow.transform.localRotation = Quaternion.Euler(0, 0, 0); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | CreateCostScroll(); | 
|---|
|  |  |  | CreateSpeedScroll(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | void CreateCostScroll() | 
|---|
|  |  |  | { | 
|---|
|  |  |  | costScroll.Refresh(); | 
|---|
|  |  |  | for (int i = 0; i < AutoFightModel.Instance.maxCost; i++) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | costScroll.AddCell(ScrollerDataType.Header, i + 1); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | costScroll.Restart(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | void CreateSpeedScroll() | 
|---|
|  |  |  | { | 
|---|
|  |  |  | speedScroll.Refresh(); | 
|---|
|  |  |  | for (int i = 0; i < AutoFightModel.Instance.maxSpeed; i++) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | speedScroll.AddCell(ScrollerDataType.Header, i + 1); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | speedScroll.Restart(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | void OnRefreshCostCell(ScrollerDataType type, CellView cell) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | var btn = cell.GetComponent<Button>(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | btn.AddListener(() => | 
|---|
|  |  |  | { | 
|---|
|  |  |  | if (AutoFightModel.Instance.autoCostWithBlessLV[cell.index - 1] > BlessLVManager.Instance.m_TreeLV) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | SysNotifyMgr.Instance.ShowTip("autofight4", AutoFightModel.Instance.autoCostWithBlessLV[cell.index - 1]); | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | isOpenCostScroll = false; | 
|---|
|  |  |  | costScroll.SetActive(false); | 
|---|
|  |  |  | costArrow.transform.localRotation = Quaternion.Euler(0, 0, 0); | 
|---|
|  |  |  | costText.text = cell.index.ToString(); | 
|---|
|  |  |  | costTip.text = Language.Get("AutoFight2", ItemConfig.Get(GeneralDefine.MoneyDisplayModel[41]).ItemName, cell.index); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | }); | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | var cntText = cell.GetComponentInChildren<Text>(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (AutoFightModel.Instance.autoCostWithBlessLV[cell.index - 1] <= BlessLVManager.Instance.m_TreeLV) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | cntText.text = UIHelper.AppendColor(TextColType.LightWhite, cell.index.ToString()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  | cntText.text = UIHelper.AppendColor(TextColType.Gray, cell.index.ToString()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | void OnRefreshSpeedCell(ScrollerDataType type, CellView cell) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | var btn = cell.GetComponent<Button>(); | 
|---|
|  |  |  | var needtaskCount = TaskManager.Instance.GetNeedFinishTaskCount(AutoFightModel.Instance.speed2UnlockMissionID); | 
|---|
|  |  |  | RechargeCount _rechargeCount; | 
|---|
|  |  |  | bool isbuy = false; | 
|---|
|  |  |  | if (RechargeManager.Instance.TryGetRechargeCount(AutoFightModel.Instance.speed3UnlockCTGID, out _rechargeCount)) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | isbuy = _rechargeCount.totalCount > 0; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | btn.AddListener(() => | 
|---|
|  |  |  | { | 
|---|
|  |  |  | if (cell.index == 2) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | if (needtaskCount > 0) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | SysNotifyMgr.Instance.ShowTip("autofight2", needtaskCount); | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else if (cell.index == 3) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | if (!isbuy) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | SysNotifyMgr.Instance.ShowTip("autofight3"); | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | isOpenSpeedScroll = false; | 
|---|
|  |  |  | speedScroll.SetActive(false); | 
|---|
|  |  |  | speedArrow.transform.localRotation = Quaternion.Euler(0, 0, 0); | 
|---|
|  |  |  | speedText.text = cell.index.ToString(); | 
|---|
|  |  |  | }); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | var cntText = cell.GetComponentInChildren<Text>(); | 
|---|
|  |  |  | if (cell.index == 2) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | cntText.text = UIHelper.AppendColor(needtaskCount > 0 ? TextColType.Gray : TextColType.LightWhite, cell.index.ToString()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else if (cell.index == 3) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | cntText.text = UIHelper.AppendColor(isbuy ? TextColType.LightWhite : TextColType.Gray, cell.index.ToString()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  | cntText.text = cell.index.ToString(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | void OnClickAutoStart() | 
|---|
|  |  |  | { | 
|---|
|  |  |  | AutoFightModel.Instance.isAutoAttackSet = true; | 
|---|
|  |  |  | AutoFightModel.Instance.fightCost = int.Parse(costText.text); | 
|---|
|  |  |  | AutoFightModel.Instance.fightSpeed = int.Parse(speedText.text); | 
|---|
|  |  |  | AutoFightModel.Instance.isStopFightByBetterEquip = betterEquipToggle.isOn; | 
|---|
|  |  |  | AutoFightModel.Instance.SaveAutoFightSetting(); | 
|---|
|  |  |  | CloseWindow(); | 
|---|
|  |  |  | SysNotifyMgr.Instance.ShowTip("autofight1"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | void OnClickAutoStop() | 
|---|
|  |  |  | { | 
|---|
|  |  |  | ConfirmCancel.ShowPopConfirm(Language.Get("Mail101"), | 
|---|
|  |  |  | Language.Get("AutoFight11"), (bool isOK) => | 
|---|
|  |  |  | { | 
|---|
|  |  |  | if (isOK) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | AutoFightModel.Instance.isAutoAttackSet = false; | 
|---|
|  |  |  | AutoFightModel.Instance.fightCost = int.Parse(costText.text); | 
|---|
|  |  |  | AutoFightModel.Instance.fightSpeed = int.Parse(speedText.text); | 
|---|
|  |  |  | AutoFightModel.Instance.isStopFightByBetterEquip = betterEquipToggle.isOn; | 
|---|
|  |  |  | AutoFightModel.Instance.SaveAutoFightSetting(); | 
|---|
|  |  |  | CloseWindow(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
copy from Main/Component/UI/Common/FuncEnable.cs.meta
copy to Main/System/Main/AutoFightWin.cs.meta
| File was copied from Main/Component/UI/Common/FuncEnable.cs.meta | 
|  |  |  | 
|---|
|  |  |  | fileFormatVersion: 2 | 
|---|
|  |  |  | guid: e034d1a3f772bb44bbbcd4273f5084e1 | 
|---|
|  |  |  | timeCreated: 1516430103 | 
|---|
|  |  |  | licenseType: Free | 
|---|
|  |  |  | guid: eb3b2c8794aa61c4c95ea434c6baebbc | 
|---|
|  |  |  | MonoImporter: | 
|---|
|  |  |  | externalObjects: {} | 
|---|
|  |  |  | serializedVersion: 2 | 
|---|
|  |  |  | defaultReferences: [] | 
|---|
|  |  |  | executionOrder: 0 | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //底部功能 | 
|---|
|  |  |  | [SerializeField] Button autoBtn; | 
|---|
|  |  |  | [SerializeField] Image autoCloseImg; | 
|---|
|  |  |  | [SerializeField] UIEffectPlayer autoOpenEffect; | 
|---|
|  |  |  | [SerializeField] Button  blessLVBtn; | 
|---|
|  |  |  | [SerializeField] Text blessLVText; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | autoBtn.AddListener(() => | 
|---|
|  |  |  | { | 
|---|
|  |  |  | //测试拾取所有物品 | 
|---|
|  |  |  | var items = PackManager.Instance.GetItems(PackType.DropItem); | 
|---|
|  |  |  | List<int> dropindexs = new List<int>(); | 
|---|
|  |  |  | for (int i = 0; i < items.Count; i++) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | var item = items[i]; | 
|---|
|  |  |  | if (dropindexs.Count > 5) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | EquipModel.Instance.NotifyItemDrop(dropindexs, BattleManager.Instance.storyBattleField.battleRootNode.blueTeamNodeList[Random.Range(0, 5)].GetComponent<RectTransform>()); | 
|---|
|  |  |  | dropindexs.Clear(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | // //测试拾取所有物品 | 
|---|
|  |  |  | // var items = PackManager.Instance.GetItems(PackType.DropItem); | 
|---|
|  |  |  | // List<int> dropindexs = new List<int>(); | 
|---|
|  |  |  | // for (int i = 0; i < items.Count; i++) | 
|---|
|  |  |  | // { | 
|---|
|  |  |  | //     var item = items[i]; | 
|---|
|  |  |  | //     if (dropindexs.Count > 5) | 
|---|
|  |  |  | //     { | 
|---|
|  |  |  | //         EquipModel.Instance.NotifyItemDrop(dropindexs, BattleManager.Instance.storyBattleField.battleRootNode.blueTeamNodeList[Random.Range(0, 5)].GetComponent<RectTransform>()); | 
|---|
|  |  |  | //         dropindexs.Clear(); | 
|---|
|  |  |  | //     } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | dropindexs.Add(item.gridIndex); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (dropindexs.Count > 0) | 
|---|
|  |  |  | //     dropindexs.Add(item.gridIndex); | 
|---|
|  |  |  | // } | 
|---|
|  |  |  | // if (dropindexs.Count > 0) | 
|---|
|  |  |  | // { | 
|---|
|  |  |  | //     EquipModel.Instance.NotifyItemDrop(dropindexs, BattleManager.Instance.storyBattleField.battleRootNode.blueTeamNodeList[Random.Range(0, 5)].GetComponent<RectTransform>()); | 
|---|
|  |  |  | //     dropindexs.Clear(); | 
|---|
|  |  |  | // } | 
|---|
|  |  |  | if (!FuncOpen.Instance.IsFuncOpen(108, true)) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | EquipModel.Instance.NotifyItemDrop(dropindexs, BattleManager.Instance.storyBattleField.battleRootNode.blueTeamNodeList[Random.Range(0, 5)].GetComponent<RectTransform>()); | 
|---|
|  |  |  | dropindexs.Clear(); | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | UIManager.Instance.OpenWindow<AutoFightWin>(); | 
|---|
|  |  |  | }); | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | UpdateTask(); | 
|---|
|  |  |  | RefreshRecharge(); | 
|---|
|  |  |  | ShowBlessLV(); | 
|---|
|  |  |  | DisplayAutoFight(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | protected override void OnPreOpen() | 
|---|
|  |  |  | 
|---|
|  |  |  | PlayerDatas.Instance.playerDataRefreshEvent += PlayerDataRefresh; | 
|---|
|  |  |  | TaskManager.Instance.OnTaskUpdate += UpdateTask; | 
|---|
|  |  |  | BlessLVManager.Instance.OnBlessLVUpdateEvent += ShowBlessLV; | 
|---|
|  |  |  | AutoFightModel.Instance.ChangeAutoEvent += DisplayAutoFight; | 
|---|
|  |  |  | Display(); | 
|---|
|  |  |  | // var battleWin = UIManager.Instance.OpenWindow<BattleWin>(); | 
|---|
|  |  |  | // battleWin.SetBattleField(BattleManager.Instance.storyBattleField); | 
|---|
|  |  |  | 
|---|
|  |  |  | PlayerDatas.Instance.playerDataRefreshEvent -= PlayerDataRefresh; | 
|---|
|  |  |  | TaskManager.Instance.OnTaskUpdate -= UpdateTask; | 
|---|
|  |  |  | BlessLVManager.Instance.OnBlessLVUpdateEvent -= ShowBlessLV; | 
|---|
|  |  |  | AutoFightModel.Instance.ChangeAutoEvent -= DisplayAutoFight; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //  关闭的时候把战斗界面也给关了 虽然是在外面开的 | 
|---|
|  |  |  | UIManager.Instance.CloseWindow<BattleWin>(); | 
|---|
|  |  |  | 
|---|
|  |  |  | { | 
|---|
|  |  |  | blessLVText.text = BlessLVManager.Instance.m_TreeLV.ToString(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | void DisplayAutoFight() | 
|---|
|  |  |  | { | 
|---|
|  |  |  | if (AutoFightModel.Instance.isAutoAttackSet) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | autoCloseImg.SetActive(false); | 
|---|
|  |  |  | autoOpenEffect.Play(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  | autoCloseImg.SetActive(true); | 
|---|
|  |  |  | autoOpenEffect.Stop(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /// <summary> | 
|---|
|  |  |  | /// 更新玩家信息 | 
|---|
|  |  |  | 
|---|
|  |  |  | if (currentSubUI != null && currentSubUI.name == "HomeWin") | 
|---|
|  |  |  | { | 
|---|
|  |  |  | //打开主界面的情况下再点击按钮,执行攻击逻辑 | 
|---|
|  |  |  | if (AutoFightModel.Instance.isAutoAttackSet) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | AutoFightModel.Instance.isAutoAttack = true; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | StoryBattleField storyBattleField = BattleManager.Instance.storyBattleField; | 
|---|
|  |  |  | if (storyBattleField != null) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //信息提示表的提示 | 
|---|
|  |  |  | public void ShowTip(string key, params object[] msg) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | SysInfoConfig cfg = SysInfoConfig.Get(key); | 
|---|
|  |  |  | 
|---|
|  |  |  | AnalysisSysmsg(cfg); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  | { | 
|---|
|  |  |  | Debug.LogError("未找到系统提示信息: " + key); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //语言表的提示 | 
|---|
|  |  |  | public void ShowLangTip(string key, params object[] msg) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | string hint = Language.Get(key, msg); | 
|---|
|  |  |  | ScrollTip.ShowTip(hint); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //直接传文字的提示 | 
|---|
|  |  |  | public void ShowStringTip(string hint) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | ScrollTip.ShowTip(hint); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | void AnalysisSysmsg(SysInfoConfig cfg) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | SysNotifySound(cfg.sound); | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public struct RechargeCount | 
|---|
|  |  |  | { | 
|---|
|  |  |  | public int todayCount; | 
|---|
|  |  |  | public int totalCount; | 
|---|
|  |  |  | public int weekPayCount; | 
|---|
|  |  |  | public int monthPayCount; | 
|---|
|  |  |  | public int selectItemValue; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public int FirstGoldServerDay = 0; //0表示未充值,首充时为开服第几天(openday+1) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public struct RechargeCount | 
|---|
|  |  |  | { | 
|---|
|  |  |  | public int todayCount; | 
|---|
|  |  |  | public int totalCount; | 
|---|
|  |  |  | public int weekPayCount; | 
|---|
|  |  |  | public int monthPayCount; | 
|---|
|  |  |  | public int selectItemValue; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
| New file | 
|  |  |  | 
|---|
|  |  |  | fileFormatVersion: 2 | 
|---|
|  |  |  | guid: 629835bc583036c41a4e9cb04fc4fdb7 | 
|---|
|  |  |  | folderAsset: yes | 
|---|
|  |  |  | DefaultImporter: | 
|---|
|  |  |  | externalObjects: {} | 
|---|
|  |  |  | userData: | 
|---|
|  |  |  | assetBundleName: | 
|---|
|  |  |  | assetBundleVariant: | 
|---|
| New file | 
|  |  |  | 
|---|
|  |  |  | using System.Collections; | 
|---|
|  |  |  | using System.Collections.Generic; | 
|---|
|  |  |  | using UnityEngine; | 
|---|
|  |  |  | using System.Text; | 
|---|
|  |  |  | using System; | 
|---|
|  |  |  | using System.Text.RegularExpressions; | 
|---|
|  |  |  | /// <summary> | 
|---|
|  |  |  | /// 服务端Setting配置,存储一些快捷设置,目前长度为100 | 
|---|
|  |  |  | /// </summary> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public class QuickSetting : Singleton<QuickSetting> | 
|---|
|  |  |  | { | 
|---|
|  |  |  | public QuickSetting() | 
|---|
|  |  |  | { | 
|---|
|  |  |  | //自动战斗 几倍消耗 几倍速度 是否高战力停止 是否开启自动战斗 | 
|---|
|  |  |  | quickSettingDic.Add(QuickSettingType.AutoFight_Cost, new QuickSettingRange(QuickSettingType.AutoFight_Cost, 0, 1)); | 
|---|
|  |  |  | quickSettingDic.Add(QuickSettingType.AutoFight_Speed, new QuickSettingRange(QuickSettingType.AutoFight_Speed, 1, 1)); | 
|---|
|  |  |  | quickSettingDic.Add(QuickSettingType.AutoFight_FightPower, new QuickSettingRange(QuickSettingType.AutoFight_FightPower, 2, 1)); | 
|---|
|  |  |  | quickSettingDic.Add(QuickSettingType.AutoFight_Open, new QuickSettingRange(QuickSettingType.AutoFight_Open, 3, 1)); | 
|---|
|  |  |  | setting = new string(UCharacter, 100); | 
|---|
|  |  |  | DTC0102_tagCDBPlayer.beforePlayerDataInitializeEvent += BeforePlayerDataInitializeEvent; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public Dictionary<QuickSettingType, QuickSettingRange> quickSettingDic = new Dictionary<QuickSettingType, QuickSettingRange>(); | 
|---|
|  |  |  | public const char UCharacter = '*'; | 
|---|
|  |  |  | private string setting; | 
|---|
|  |  |  | private string cacheSetting; | 
|---|
|  |  |  | private StringBuilder textBuilder = new StringBuilder(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public event Action onQuickSettingUpdate; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public void SetQuickSetting<T>(QuickSettingType type, T value, int index = 0) where T : struct | 
|---|
|  |  |  | { | 
|---|
|  |  |  | SetQuickSetting(type, value.ToString(), index); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | public void SetQuickSetting(QuickSettingType type, bool value, int index = 0) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | SetQuickSetting<int>(type, value ? 1 : 0, index); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public void SetQuickSetting(int type, string value, int index) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | SetQuickSetting((QuickSettingType)type, value, index); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public void SetQuickSetting(QuickSettingType type, string value, int index) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | var quickRange = quickSettingDic[type]; | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if ((index - quickRange.index) * quickRange.single + value.Length > quickRange.length || value.Length > quickRange.single) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | Debug.LogErrorFormat("存储的数据超过最大长度!{0}", type); | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | textBuilder.Length = 0; | 
|---|
|  |  |  | var start = quickRange.index + index * quickRange.single; | 
|---|
|  |  |  | var end = start + value.Length; | 
|---|
|  |  |  | if (quickRange.length == quickRange.single) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | end = start + quickRange.length; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | textBuilder.Append(setting, 0, start); | 
|---|
|  |  |  | textBuilder.Append(value); | 
|---|
|  |  |  | if (quickRange.length == quickRange.single | 
|---|
|  |  |  | && quickRange.length > value.Length) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | textBuilder.Append('*', quickRange.length - value.Length); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | textBuilder.Append(setting, end, setting.Length - end); | 
|---|
|  |  |  | setting = textBuilder.ToString(); | 
|---|
|  |  |  | PlayerDatas.Instance.baseData.Setting = setting; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | public void SetQuickSetting(string value) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | value = UIHelper.ServerStringTrim(value); | 
|---|
|  |  |  | if (value != null && value.Length > 0) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | setting = StringUtility.Contact(value, setting.Substring(value.Length, setting.Length - value.Length)); | 
|---|
|  |  |  | cacheSetting = setting; | 
|---|
|  |  |  | PlayerDatas.Instance.baseData.Setting = setting; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (onQuickSettingUpdate != null) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | onQuickSettingUpdate(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public T GetQuickSettingValue<T>(QuickSettingType type, int index) where T : struct | 
|---|
|  |  |  | { | 
|---|
|  |  |  | string destinationStr = GetQuickSetting(type, index); | 
|---|
|  |  |  | if (string.IsNullOrEmpty(destinationStr)) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | return default(T); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return (T)Convert.ChangeType(destinationStr, typeof(T)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | public string GetQuickSetting(QuickSettingType type, int index) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | var quickRange = quickSettingDic[type]; | 
|---|
|  |  |  | var start = quickRange.index + index * quickRange.single; | 
|---|
|  |  |  | var destinationStr = setting.Substring(start, quickRange.single); | 
|---|
|  |  |  | destinationStr = Regex.Replace(destinationStr, @"\*", string.Empty); | 
|---|
|  |  |  | return destinationStr; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | public bool GetQuickSettingBool(QuickSettingType type, int index, bool _default = false) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | string destinationStr = GetQuickSetting(type, index); | 
|---|
|  |  |  | if (string.IsNullOrEmpty(destinationStr)) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | return _default; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | int _value = _default ? 1 : 0; | 
|---|
|  |  |  | int.TryParse(destinationStr, out _value); | 
|---|
|  |  |  | return _value == 1; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public string GetQuickSetting(int type, int index) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | return GetQuickSetting((QuickSettingType)type, index); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public void SendPackage() | 
|---|
|  |  |  | { | 
|---|
|  |  |  | if (cacheSetting != setting) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | cacheSetting = setting; | 
|---|
|  |  |  | C0303_tagCSetShutCutData vNetData = new C0303_tagCSetShutCutData(); | 
|---|
|  |  |  | vNetData.Setting = setting; | 
|---|
|  |  |  | GameNetSystem.Instance.SendInfo(vNetData); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private void BeforePlayerDataInitializeEvent() | 
|---|
|  |  |  | { | 
|---|
|  |  |  | setting = null; | 
|---|
|  |  |  | setting = new string(UCharacter, 100); | 
|---|
|  |  |  | PlayerDatas.Instance.baseData.Setting = setting; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public enum QuickSettingType | 
|---|
|  |  |  | { | 
|---|
|  |  |  | AutoFight_Cost, //自动战斗 几倍消耗 | 
|---|
|  |  |  | AutoFight_Speed,    //几倍速度 | 
|---|
|  |  |  | AutoFight_FightPower,   //是否高战力停止 | 
|---|
|  |  |  | AutoFight_Open,    //是否开启自动战斗 | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public class QuickSettingRange | 
|---|
|  |  |  | { | 
|---|
|  |  |  | public QuickSettingType type; | 
|---|
|  |  |  | public int index; | 
|---|
|  |  |  | public int length; | 
|---|
|  |  |  | public int single; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public QuickSettingRange(QuickSettingType type, int start, int length, int single = 0) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | this.type = type; | 
|---|
|  |  |  | this.index = start; | 
|---|
|  |  |  | this.length = length; | 
|---|
|  |  |  | this.single = single == 0 ? length : single; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
| File was renamed from Main/Component/UI/Common/FuncEnable.cs.meta | 
|  |  |  | 
|---|
|  |  |  | fileFormatVersion: 2 | 
|---|
|  |  |  | guid: e034d1a3f772bb44bbbcd4273f5084e1 | 
|---|
|  |  |  | timeCreated: 1516430103 | 
|---|
|  |  |  | licenseType: Free | 
|---|
|  |  |  | guid: 591bd551698e54c42bb51c4b2af7ae0e | 
|---|
|  |  |  | MonoImporter: | 
|---|
|  |  |  | externalObjects: {} | 
|---|
|  |  |  | serializedVersion: 2 | 
|---|
|  |  |  | defaultReferences: [] | 
|---|
|  |  |  | executionOrder: 0 | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 任务状态 1-进行中 2-可领取 | 
|---|
|  |  |  | public int GetMainTaskState() | 
|---|
|  |  |  | { | 
|---|
|  |  |  | { | 
|---|
|  |  |  | return mainTask.State; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //还需完成多少个任务 | 
|---|
|  |  |  | public int GetNeedFinishTaskCount(int taskID) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | var taskConfig = TaskConfig.Get(taskID); | 
|---|
|  |  |  | return taskConfig.Index - TaskConfig.Get(mainTask.TaskID).Index + 1; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | public static readonly Color s_NavyYellow = new Color32(242, 238, 2, 255); //f2ee02 | 
|---|
|  |  |  | public static readonly Color s_LightGreen = new Color32(42, 227, 55, 255);//2ae337 | 
|---|
|  |  |  | public static readonly Color s_LightWhite = new Color32(245, 246, 230, 255); //f5f6e6 | 
|---|
|  |  |  | public static readonly Color s_Gray = new Color32(132, 121, 123, 255);  //84797b | 
|---|
|  |  |  | public static readonly Color s_Gray = new Color32(104, 104, 104,255);  //bbbbbb | 
|---|
|  |  |  | public static readonly Color s_Gold = new Color32(255, 239, 71, 255);//ffef47 | 
|---|
|  |  |  | public static readonly Color s_EarthYellow = new Color32(248, 152, 59, 255);//f8983b | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | case TextColType.LightGreen: | 
|---|
|  |  |  | return StringUtility.Contact("<color=#8ddc11>", msg, "</color>"); | 
|---|
|  |  |  | case TextColType.Gray: | 
|---|
|  |  |  | return StringUtility.Contact("<color=#84797b>", msg, "</color>"); | 
|---|
|  |  |  | return StringUtility.Contact("<color=#bbbbbb>", msg, "</color>"); | 
|---|
|  |  |  | case TextColType.lightYellow: | 
|---|
|  |  |  | return StringUtility.Contact("<color=#fcedb9>", msg, "</color>"); | 
|---|
|  |  |  | case TextColType.NavyYellow: | 
|---|