Core/GameEngine/DataToCtl/PackageRegedit.cs
@@ -31,6 +31,7 @@ public static void Init() { // 登记相应的数据体及对应的数据转逻辑类 Register(typeof(HB102_tagMCClothesCoatSkinState), typeof(DTCB102_tagMCClothesCoatSkinState)); Register(typeof(HC103_tagMCCrossRealmPKPlayerHisSeasonInfo), typeof(DTCC103_tagMCCrossRealmPKPlayerHisSeasonInfo)); Register(typeof(HA31E_tagMCGatherSoulHoleInfo), typeof(DTCA31E_tagMCGatherSoulHoleInfo)); Register(typeof(HAA1D_tagMCActTotalRechargeInfo), typeof(DTCAA1D_tagMCActTotalRechargeInfo)); Core/GameEngine/Model/Config/FashionDressCabinetConfig.cs
New file @@ -0,0 +1,44 @@ //-------------------------------------------------------- // [Author]: 第二世界 // [ Date ]: Tuesday, January 08, 2019 //-------------------------------------------------------- using UnityEngine; using System; namespace TableConfig { public partial class FashionDressCabinetConfig : ConfigBase { public int LV { get ; private set ; } public int NeedExp { get ; private set ; } public string Attr { get ; private set; } public override string getKey() { return LV.ToString(); } public override void Parse() { try { LV=IsNumeric(rawContents[0]) ? int.Parse(rawContents[0]):0; NeedExp=IsNumeric(rawContents[1]) ? int.Parse(rawContents[1]):0; Attr = rawContents[2].Trim(); } catch (Exception ex) { DebugEx.Log(ex); } } } } Core/GameEngine/Model/Config/FashionDressCabinetConfig.cs.meta
New file @@ -0,0 +1,12 @@ fileFormatVersion: 2 guid: 28e71cfd492229640aecaf39e2a40093 timeCreated: 1546913213 licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: Core/GameEngine/Model/Config/FashionDressConfig.cs
New file @@ -0,0 +1,75 @@ //-------------------------------------------------------- // [Author]: 第二世界 // [ Date ]: Tuesday, January 08, 2019 //-------------------------------------------------------- using UnityEngine; using System; namespace TableConfig { public partial class FashionDressConfig : ConfigBase { public int CoatID { get ; private set ; } public string name { get ; private set; } public int type { get ; private set ; } public int quality { get ; private set ; } public string getWay { get ; private set; } public int[] EquipItemID; public int UnlockItemID { get ; private set ; } public int MaxLV { get ; private set ; } public int[] CostItemCnt; public string StarAttr { get ; private set; } public override string getKey() { return CoatID.ToString(); } public override void Parse() { try { CoatID=IsNumeric(rawContents[0]) ? int.Parse(rawContents[0]):0; name = rawContents[1].Trim(); type=IsNumeric(rawContents[2]) ? int.Parse(rawContents[2]):0; quality=IsNumeric(rawContents[3]) ? int.Parse(rawContents[3]):0; getWay = rawContents[4].Trim(); string[] EquipItemIDStringArray = rawContents[5].Trim().Split(StringUtility.splitSeparator,StringSplitOptions.RemoveEmptyEntries); EquipItemID = new int[EquipItemIDStringArray.Length]; for (int i=0;i<EquipItemIDStringArray.Length;i++) { int.TryParse(EquipItemIDStringArray[i],out EquipItemID[i]); } UnlockItemID=IsNumeric(rawContents[6]) ? int.Parse(rawContents[6]):0; MaxLV=IsNumeric(rawContents[7]) ? int.Parse(rawContents[7]):0; string[] CostItemCntStringArray = rawContents[8].Trim().Split(StringUtility.splitSeparator,StringSplitOptions.RemoveEmptyEntries); CostItemCnt = new int[CostItemCntStringArray.Length]; for (int i=0;i<CostItemCntStringArray.Length;i++) { int.TryParse(CostItemCntStringArray[i],out CostItemCnt[i]); } StarAttr = rawContents[9].Trim(); } catch (Exception ex) { DebugEx.Log(ex); } } } } Core/GameEngine/Model/Config/FashionDressConfig.cs.meta
New file @@ -0,0 +1,12 @@ fileFormatVersion: 2 guid: 5ac2a701b6eaba844b1082c87758125e timeCreated: 1546945768 licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: Core/GameEngine/Model/ConfigManager.cs
@@ -219,6 +219,8 @@ AddAsyncTask<GatherSoulComposeConfig>(); AddAsyncTask<KingTreasureConfig>(); AddAsyncTask<KingTreasureItemConfig>(); AddAsyncTask<FashionDressConfig>(); AddAsyncTask<FashionDressCabinetConfig>(); while (!AllCompleted()) { Core/NetworkPackage/ClientPack/ClientToMapServer/CA5_Function/CA50B_tagCMCoatUp.cs
New file @@ -0,0 +1,18 @@ using UnityEngine; using System.Collections; // A5 0B 玩家时装升级 #tagCMCoatUp public class CA50B_tagCMCoatUp : GameNetPackBasic { public uint CoatIndex; // 时装索引 public CA50B_tagCMCoatUp () { combineCmd = (ushort)0x03FE; _cmd = (ushort)0xA50B; } public override void WriteToBytes () { WriteBytes (CoatIndex, NetDataType.DWORD); } } Core/NetworkPackage/ClientPack/ClientToMapServer/CA5_Function/CA50B_tagCMCoatUp.cs.meta
New file @@ -0,0 +1,12 @@ fileFormatVersion: 2 guid: 17ad6502064d0014b9ca6f5ba5e95a2c timeCreated: 1546938032 licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: Core/NetworkPackage/ClientPack/ClientToMapServer/CA5_Function/CA520_tagCMCoatDecompose.cs
New file @@ -0,0 +1,22 @@ using UnityEngine; using System.Collections; // A5 20 时装分解 #tagCMCoatDecompose public class CA520_tagCMCoatDecompose : GameNetPackBasic { public byte Count; //材料所在背包索引的数量 public ushort[] IndexList; //材料所在背包索引列表 public uint[] ItemIDList; //材料所在背包物品ID列表 public CA520_tagCMCoatDecompose () { combineCmd = (ushort)0x03FE; _cmd = (ushort)0xA520; } public override void WriteToBytes () { WriteBytes (Count, NetDataType.BYTE); WriteBytes (IndexList, NetDataType.WORD, Count); WriteBytes (ItemIDList, NetDataType.DWORD, Count); } } Core/NetworkPackage/ClientPack/ClientToMapServer/CA5_Function/CA520_tagCMCoatDecompose.cs.meta
New file @@ -0,0 +1,12 @@ fileFormatVersion: 2 guid: e9f99f58f066c144b8d82dd0e54660c5 timeCreated: 1546936247 licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: Core/NetworkPackage/DTCFile/ServerPack/HB1_Role/DTCB102_tagMCClothesCoatSkinState.cs
New file @@ -0,0 +1,24 @@ //-------------------------------------------------------- // [Author]: 第二世界 // [ Date ]: Tuesday, January 08, 2019 //-------------------------------------------------------- using Snxxz.UI; using System; using System.Collections; using System.Collections.Generic; public class DTCB102_tagMCClothesCoatSkinState : DtcBasic { public override void Done(GameNetPackBasic vNetPack) { base.Done(vNetPack); var package = vNetPack as HB102_tagMCClothesCoatSkinState; ModelCenter.Instance.GetModel<FashionDressModel>().ReceivePackage(package); } } Core/NetworkPackage/DTCFile/ServerPack/HB1_Role/DTCB102_tagMCClothesCoatSkinState.cs.meta
New file @@ -0,0 +1,12 @@ fileFormatVersion: 2 guid: 492fb693405473b41acea24913462db6 timeCreated: 1546938241 licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: Core/NetworkPackage/ServerPack/HB1_Role/HB102_tagMCClothesCoatSkinState.cs
New file @@ -0,0 +1,33 @@ using UnityEngine; using System.Collections; // B1 02 玩家时装皮肤激活状态 #tagMCClothesCoatSkinState public class HB102_tagMCClothesCoatSkinState : GameNetPackBasic { public uint CoatChestLV; //时装柜等级 public uint CoatChestExp; //时装柜经验 public ushort CoatNum; //时装个数 public tagMCClothesCoatLVInfo[] CoatInfoList; // 时装数据列表 public HB102_tagMCClothesCoatSkinState () { _cmd = (ushort)0xB102; } public override void ReadFromBytes (byte[] vBytes) { TransBytes (out CoatChestLV, vBytes, NetDataType.DWORD); TransBytes (out CoatChestExp, vBytes, NetDataType.DWORD); TransBytes (out CoatNum, vBytes, NetDataType.WORD); CoatInfoList = new tagMCClothesCoatLVInfo[CoatNum]; for (int i = 0; i < CoatNum; i ++) { CoatInfoList[i] = new tagMCClothesCoatLVInfo(); TransBytes (out CoatInfoList[i].CoatIndex, vBytes, NetDataType.DWORD); TransBytes (out CoatInfoList[i].CoatLV, vBytes, NetDataType.BYTE); } } public struct tagMCClothesCoatLVInfo { public uint CoatIndex; //时装索引 public byte CoatLV; //时装等级 } } Core/NetworkPackage/ServerPack/HB1_Role/HB102_tagMCClothesCoatSkinState.cs.meta
New file @@ -0,0 +1,12 @@ fileFormatVersion: 2 guid: 311be06de3a564b48951786c28d5bb27 timeCreated: 1546938210 licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: System/FashionDress.meta
File was renamed from Lua/Gen/Resources.meta @@ -1,7 +1,7 @@ fileFormatVersion: 2 guid: a545fb3dcf719304fa74180c10219375 guid: 87ce498b66c90b94ca39c71f74f9b161 folderAsset: yes timeCreated: 1542357825 timeCreated: 1546830607 licenseType: Pro DefaultImporter: userData: System/FashionDress/FashionAttrBeh.cs
New file @@ -0,0 +1,85 @@ using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using TableConfig; using System.Linq; namespace Snxxz.UI { [XLua.Hotfix] public class FashionAttrBeh : MonoBehaviour { [SerializeField] Text titleText; [SerializeField] Text starDesText; [SerializeField] List<Text> attrlist = new List<Text>(); ItemTipsModel tipsModel { get { return ModelCenter.Instance.GetModel<ItemTipsModel>(); } } FashionDressModel fashionModel { get { return ModelCenter.Instance.GetModel<FashionDressModel>(); } } public void SetDisplay(int star,int curStar) { int curFashionId = fashionModel.viewFashionDressId; FashionDress fashionDress = null; fashionModel.TryGetFashionDress(curFashionId,out fashionDress); int minStar = 1; int maxStar = fashionDress.maxLevel; if(star == curStar && curStar < maxStar) { titleText.text = StringUtility.Contact("当前效果(该件时装最多可升至",maxStar,"星)"); } else if(star == curStar && curStar >= maxStar) { titleText.text = StringUtility.Contact("已升至最高级"); } else { titleText.text = StringUtility.Contact(star,"星效果"); } if (star == curStar) { starDesText.text = StringUtility.Contact("升至",star, "星时获得属性(已获得)"); } else { starDesText.text = StringUtility.Contact("升至", star, "星时获得属性"); } Dictionary<int, int> attrDict = null; fashionModel.TryGetFashionDressProperty(curFashionId,star,out attrDict); if(attrDict != null) { List<int> attrIds = attrDict.Keys.ToList(); for (int i = 0; i < attrlist.Count; i++) { var attrText = attrlist[i]; if (i < attrIds.Count) { attrText.gameObject.SetActive(true); int attrId = attrIds[i]; int attrValue = attrDict[attrId]; var attrConfig = Config.Instance.Get<PlayerPropertyConfig>(attrId); string attrSB = string.Empty; if (attrConfig.Name.Contains("%s")) { attrSB = attrConfig.Name.Replace("%s", tipsModel.GetProValueTypeStr(attrConfig, attrValue)); } else { attrSB = StringUtility.Contact(attrConfig.Name, "+", tipsModel.GetProValueTypeStr(attrConfig, attrValue)); } attrText.text = attrSB; } else { attrText.gameObject.SetActive(false); } } } } } } System/FashionDress/FashionAttrBeh.cs.meta
New file @@ -0,0 +1,12 @@ fileFormatVersion: 2 guid: b55bd88d7eff9ea4a813eb57ec06698d timeCreated: 1546831641 licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: System/FashionDress/FashionDecomposeLineBeh.cs
New file @@ -0,0 +1,68 @@ using System; using UnityEngine; using UnityEngine.UI; using EnhancedUI.EnhancedScroller; using System.Collections.Generic; namespace Snxxz.UI { [XLua.Hotfix] public class FashionDecomposeLineBeh : ScrollerUI { [SerializeField] List<DecomposeItemBeh> itemBehs = new List<DecomposeItemBeh>(); public override void Refresh(CellView cell) { var decomposeModel = FashionDecomposeModel.Instance; var decomposeGuids = decomposeModel.decomposeItemGuids; int length = itemBehs.Count; for(int i = 0; i < length; i++) { var itemBeh = itemBehs[i]; int index = cell.index*length + i; if(decomposeGuids != null && index < decomposeGuids.Count) { var guid = decomposeGuids[index]; FashionDecomposeModel.DecomposeItem decomposeItem = null; decomposeModel.TryGetDecomposeItem(guid,out decomposeItem); itemBeh.SetDisplay(decomposeItem.itemModel,decomposeItem.isSelect); } else { itemBeh.SetDisplay(null); } } } [Serializable] public class DecomposeItemBeh { [SerializeField] CommonItemBaisc itemBaisc; [SerializeField] GameObject selectObj; public void SetDisplay(ItemModel itemModel,bool _isSelect = false) { if (itemModel == null) { itemBaisc.gameObject.SetActive(false); selectObj.SetActive(false); } else { itemBaisc.gameObject.SetActive(true); selectObj.SetActive(_isSelect); var decomposeModel = FashionDecomposeModel.Instance; itemBaisc.Init(itemModel); itemBaisc.cellBtn.RemoveAllListeners(); itemBaisc.cellBtn.AddListener(()=> { decomposeModel.UpdateDecomposeItem(itemModel.itemInfo.ItemGUID, !selectObj.activeInHierarchy); selectObj.SetActive(!selectObj.activeInHierarchy); }); } } } } } System/FashionDress/FashionDecomposeLineBeh.cs.meta
New file @@ -0,0 +1,12 @@ fileFormatVersion: 2 guid: 2bb54ddc8495e9540847635bd28036b3 timeCreated: 1546930677 licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: System/FashionDress/FashionDecomposeModel.cs
New file @@ -0,0 +1,135 @@ using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Snxxz.UI { [XLua.LuaCallCSharp] [XLua.Hotfix] public class FashionDecomposeModel : Singleton<FashionDecomposeModel> { FashionDressModel model { get { return ModelCenter.Instance.GetModel<FashionDressModel>(); } } PlayerPackModel playerPack { get { return ModelCenter.Instance.GetModel<PlayerPackModel>(); } } public Dictionary<string, DecomposeItem> decomposeItemDict = new Dictionary<string, DecomposeItem>(); public List<string> decomposeItemGuids { get; private set; } public event Action UpdateDecomposeExpEvent; List<int> fashionMatIds = new List<int>(); public void GetDecomposeItem() { decomposeItemGuids = null; decomposeItemDict.Clear(); SinglePackModel singlePack = playerPack.GetSinglePackModel(PackType.rptItem); if (singlePack == null) return; fashionMatIds.Clear(); model.TryGetSatisfyResolves(ref fashionMatIds); foreach(var matId in fashionMatIds) { List<ItemModel> itemModels = null; singlePack.GetItemCountByID(matId, out itemModels); if (itemModels != null) { foreach (var model in itemModels) { var decomposeItem = new DecomposeItem(); decomposeItem.SetModel(model); decomposeItemDict.Add(decomposeItem.guid, decomposeItem); } } } decomposeItemGuids = decomposeItemDict.Keys.ToList(); } public void UpdateDecomposeItem(string guid, bool _isSelect) { DecomposeItem decomposeItem = null; bool isItem = TryGetDecomposeItem(guid, out decomposeItem); if (isItem) { decomposeItem.SetIsSelect(_isSelect); if(UpdateDecomposeExpEvent != null) { UpdateDecomposeExpEvent(); } } } public bool TryGetDecomposeItem(string guid,out DecomposeItem decomposeItem) { return decomposeItemDict.TryGetValue(guid,out decomposeItem); } public int GetSumDecomposeExp() { int sumExp = 0; foreach(var guid in decomposeItemDict.Keys) { var decomposeItem = decomposeItemDict[guid]; if(decomposeItem.isSelect) { sumExp += decomposeItem.decomposeExp; } } return sumExp; } public void GetSelectItemlist(out List<ushort> indexs,out List<uint> ids) { indexs = new List<ushort>(); ids = new List<uint>(); foreach(var item in decomposeItemDict.Values) { if(item.isSelect) { indexs.Add((ushort)item.itemModel.itemInfo.ItemPlace); ids.Add((uint)item.itemModel.itemId); } } } public void SendDecomposeFashion() { List<ushort> indexs = null; List<uint> ids = null; GetSelectItemlist(out indexs,out ids); CA520_tagCMCoatDecompose coatDecompose = new CA520_tagCMCoatDecompose(); coatDecompose.Count = (byte)indexs.Count; coatDecompose.IndexList = indexs.ToArray(); coatDecompose.ItemIDList = ids.ToArray(); GameNetSystem.Instance.SendInfo(coatDecompose); } public class DecomposeItem { public string guid { get; private set; } public bool isSelect { get; private set; } public ItemModel itemModel { get; private set; } public int decomposeExp { get; private set; } public void SetModel(ItemModel _model) { guid = _model.itemInfo.ItemGUID; isSelect = true; itemModel = _model; if(itemModel.chinItemModel.Effect1 == 243) { decomposeExp = itemModel.chinItemModel.EffectValueB1 * itemModel.itemInfo.ItemCount; } else { decomposeExp = 0; } } public void SetIsSelect(bool _isSelect) { isSelect = _isSelect; } } } } System/FashionDress/FashionDecomposeModel.cs.meta
New file @@ -0,0 +1,12 @@ fileFormatVersion: 2 guid: d6722779fa42a274687159f4e8cf8270 timeCreated: 1546932457 licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: System/FashionDress/FashionDetailsWin.cs
New file @@ -0,0 +1,159 @@ using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using TableConfig; using System.Collections; namespace Snxxz.UI { [XLua.Hotfix] public class FashionDetailsWin : Window { [SerializeField] GameObject container; [SerializeField] CanvasGroup alpha; [Header("顶部UI")] [SerializeField] Text nameText; [SerializeField] Text fashionPartText; [SerializeField] Text jobText; [SerializeField] CommonItemBaisc itemBaisc; [Header("中间UI")] [SerializeField] GameObject midPartObj; [SerializeField] FashionAttrBeh currentFashionAttr; [SerializeField] FashionAttrBeh nextFashionAttr; [Header("底部UI")] [SerializeField] GameObject bottomPartObj; [SerializeField] Text resourceText; FashionDress fashionDress = null; ItemConfig itemConfig = null; FashionDressModel fashionModel { get { return ModelCenter.Instance.GetModel<FashionDressModel>(); } } #region Built-in protected override void BindController() { } protected override void AddListeners() { } protected override void OnPreOpen() { SetDisplay(); } protected override void OnActived() { base.OnActived(); StartCoroutine(DelayShow()); } protected override void OnAfterOpen() { } protected override void OnPreClose() { } protected override void OnAfterClose() { } #endregion private void SetDisplay() { fashionModel.TryGetFashionDress(fashionModel.viewFashionDressId,out fashionDress); if (fashionDress == null) return; container.SetActive(false); int itemId = fashionDress.GetEquipItemId(); DebugEx.Log("物品ID:" + itemId); alpha.alpha = 0; itemConfig = Config.Instance.Get<ItemConfig>(itemId); SetTopUI(); SetMidUI(); SetBotttomUI(); } private void SetTopUI() { if (itemConfig == null) return; if (itemConfig.JobLimit != 0) { JobNameConfig jobNameConfig = Config.Instance.Get<JobNameConfig>(itemConfig.JobLimit); jobText.text = jobNameConfig.name; } nameText.text = itemConfig.ItemName; nameText.color = UIHelper.GetUIColor(itemConfig.ItemColor); fashionPartText.text = itemConfig.ItemTypeName; ItemCellModel cellModel = new ItemCellModel(itemConfig.ID); itemBaisc.Init(cellModel); } private void SetMidUI() { //midPartObj.SetActive(true); if (fashionDress == null) return; int minStar = 1; int curSatr = fashionModel.GetFashionDressLevel(fashionDress.id); if(curSatr < minStar) { currentFashionAttr.gameObject.SetActive(false); nextFashionAttr.gameObject.SetActive(true); nextFashionAttr.SetDisplay(minStar,curSatr); } else if(curSatr >= fashionDress.maxLevel) { currentFashionAttr.gameObject.SetActive(true); nextFashionAttr.gameObject.SetActive(false); currentFashionAttr.SetDisplay(fashionDress.maxLevel,curSatr); } else { currentFashionAttr.gameObject.SetActive(true); nextFashionAttr.gameObject.SetActive(true); currentFashionAttr.SetDisplay(curSatr,curSatr); nextFashionAttr.SetDisplay(curSatr+1,curSatr); } } private void SetBotttomUI() { if (itemConfig == null) return; //bottomPartObj.SetActive(true); resourceText.text = itemConfig.Description; } IEnumerator DelayShow() { yield return null; container.SetActive(true); StartCoroutine(DelayAlpha()); } IEnumerator DelayShowMid() { yield return null; midPartObj.SetActive(true); StartCoroutine(DelayShowBottom()); } IEnumerator DelayShowBottom() { yield return null; bottomPartObj.SetActive(true); StartCoroutine(DelayAlpha()); } IEnumerator DelayAlpha() { yield return null; alpha.alpha = 1; } } } System/FashionDress/FashionDetailsWin.cs.meta
New file @@ -0,0 +1,12 @@ fileFormatVersion: 2 guid: 91c26b09f6d89e44d8d82d3dcce87396 timeCreated: 1546830741 licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: System/FashionDress/FashionDressCell.cs
New file @@ -0,0 +1,158 @@ using System; using System.Collections; using System.Collections.Generic; using TableConfig; using UnityEngine; using UnityEngine.UI; namespace Snxxz.UI { public class FashionDressCell : CellView { [SerializeField] ItemBehaviour m_Item; [SerializeField] Text m_ItemName; [SerializeField] Text m_ItemCount; [SerializeField] Text m_GetPath; [SerializeField] RectTransform m_ContainerStars; [SerializeField] Transform[] m_Stars; [SerializeField] Transform[] m_StarEquips; [SerializeField] Button m_LevelUp; [SerializeField] Transform m_ContainerDarkMask; [SerializeField] Transform m_Lock; [SerializeField] Button m_Unlock; [SerializeField] Transform m_ContainerSelect; [SerializeField] Transform m_Equiped; [SerializeField] Transform m_Preview; [SerializeField] Transform m_UnlockRedpoint; [SerializeField] Transform m_LevelUpRedpoint; [SerializeField] Button m_Select; int fashionDressId = 0; FashionDressModel model { get { return ModelCenter.Instance.GetModel<FashionDressModel>(); } } PlayerPackModel packModel { get { return ModelCenter.Instance.GetModel<PlayerPackModel>(); } } public void Display(int id) { fashionDressId = id; FashionDress fashionDress; m_LevelUp.RemoveAllListeners(); m_Unlock.RemoveAllListeners(); m_Select.RemoveAllListeners(); var fashionDressLevel = model.GetFashionDressLevel(fashionDressId); var active = fashionDressLevel > 0; m_ContainerDarkMask.gameObject.SetActive(!active); m_ContainerStars.gameObject.SetActive(active); m_GetPath.gameObject.SetActive(!active); m_UnlockRedpoint.gameObject.SetActive(model.levelUpRedpoint.state == RedPointState.Simple && model.fashionDressRedpointId == fashionDressId); m_LevelUpRedpoint.gameObject.SetActive(model.levelUpRedpoint.state == RedPointState.Simple && model.fashionDressRedpointId == fashionDressId); if (model.TryGetFashionDress(fashionDressId, out fashionDress)) { var equipItemId = fashionDress.GetEquipItemId(); var virtualEquipFashionId = model.GetVirtualEquipFashionDress(fashionDress.fashionDressType); var selectFashionDress = model.GetSelectFashionDress(fashionDress.fashionDressType); bool isEquiped = virtualEquipFashionId == fashionDressId; m_Equiped.gameObject.SetActive(isEquiped); bool isSelect = selectFashionDress == fashionDressId; m_Preview.gameObject.SetActive(!isEquiped && isSelect); m_ContainerSelect.gameObject.SetActive(isSelect); m_LevelUp.gameObject.SetActive(active && fashionDressLevel < fashionDress.maxLevel); bool isMax = fashionDressLevel >= fashionDress.maxLevel; var count = packModel.GetItemCountByID(PackType.rptItem, fashionDress.requireLevelUpItem); m_Item.SetItem(equipItemId, 0); var levelUpRequireCount = fashionDress.GetLevelUpRequireCount(fashionDressLevel); var requireCountDisplay = UIHelper.AppendStringColor(count >= levelUpRequireCount ? TextColType.DarkGreen : TextColType.Red, count.ToString()); m_ItemCount.text = isMax ? string.Empty : StringUtility.Contact(requireCountDisplay, "/", levelUpRequireCount); var config = Config.Instance.Get<FashionDressConfig>(fashionDressId); m_ItemName.text = config.name; m_GetPath.text = config.getWay; if (fashionDressLevel > 0) { for (int i = 0; i < m_Stars.Length; i++) { m_Stars[i].gameObject.SetActive(i < fashionDress.maxLevel); } for (int i = 0; i < m_StarEquips.Length; i++) { m_StarEquips[i].gameObject.SetActive(i < fashionDressLevel); } } m_Lock.gameObject.SetActive(count < levelUpRequireCount); m_Unlock.gameObject.SetActive(count >= levelUpRequireCount); m_LevelUp.AddListener(LevelUp); m_Unlock.AddListener(LevelUp); m_Select.AddListener(Select); } } private void Select() { FashionDress fashionDress; if (model.TryGetFashionDress(fashionDressId, out fashionDress)) { var selectFashionDress = model.GetSelectFashionDress(fashionDress.fashionDressType); var virtualEquipFashionDress = model.GetVirtualEquipFashionDress(fashionDress.fashionDressType); if (selectFashionDress != fashionDressId) { if (model.IsFashionDressUnlock(fashionDressId)) { model.SetVirtualEquipFashionDress(fashionDress.fashionDressType, fashionDressId); model.SetSelectFashionDress(fashionDress.fashionDressType, fashionDressId); } else { model.SetSelectFashionDress(fashionDress.fashionDressType, fashionDressId); } } else { if (virtualEquipFashionDress == fashionDressId) { model.SetVirtualEquipFashionDress(fashionDress.fashionDressType, 0); model.SetSelectFashionDress(fashionDress.fashionDressType, 0); } else { model.SetSelectFashionDress(fashionDress.fashionDressType, virtualEquipFashionDress); } } } } private void LevelUp() { var error = 0; if (!model.TryLevelUp(fashionDressId, out error)) { model.DisplayLevelUpError(error); return; } model.SendLevelUp(fashionDressId); } } } System/FashionDress/FashionDressCell.cs.meta
New file @@ -0,0 +1,12 @@ fileFormatVersion: 2 guid: 6f69d8fa7c986cd4babb27d708adba91 timeCreated: 1546918315 licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: System/FashionDress/FashionDressModel.cs
New file @@ -0,0 +1,543 @@ using System; using System.Collections; using System.Collections.Generic; using System.Linq; using TableConfig; using UnityEngine; namespace Snxxz.UI { public class FashionDressModel : Model, IBeforePlayerDataInitialize, IPlayerLoginOk { Dictionary<int, FashionDress> fashionDressDict = new Dictionary<int, FashionDress>(); Dictionary<int, int> fashionDressLevelDict = new Dictionary<int, int>(); Dictionary<int, Dictionary<int, int>> cabinetPropertyDict = new Dictionary<int, Dictionary<int, int>>(); Dictionary<int, int> fashionTypeMapPlaceDict = new Dictionary<int, int>(); Dictionary<int, List<int>> fashionDressTypeDict = new Dictionary<int, List<int>>(); Dictionary<int, Dictionary<int, List<int>>> fashionDressQualityDict = new Dictionary<int, Dictionary<int, List<int>>>(); const int FASHIONDRESS_REDPOINT_BASE = 10105; const int FASHIONDRESS_FUNC_ID = 160; public readonly Redpoint redpoint = new Redpoint(101, FASHIONDRESS_REDPOINT_BASE); public readonly Redpoint levelUpRedpoint = new Redpoint(FASHIONDRESS_REDPOINT_BASE, 1010501); public int cabinetLevel { get; private set; } public int cabinetExp { get; private set; } public int cabinetMaxLevel { get; private set; } public int fashoinDressCount { get { return fashionDressDict.Count; } } public Dictionary<int, int> fashionDressSelectDict { get; private set; } public Dictionary<int, int> fashionDressEquipDict { get; private set; } public List<int> fashionDressLevelUpItems { get; private set; } public List<int> fashionDressTypes { get; private set; } int m_SelectType = 1; public int selectType { get { return m_SelectType; } set { if (m_SelectType != value) { m_SelectType = value; if (selectTypeRefresh != null) { selectTypeRefresh(); } } } } int m_SelectQuality = 0; public int selectQuality { get { return m_SelectQuality; } set { if (m_SelectQuality != value) { m_SelectQuality = value; if (selectQualityRefresh != null) { selectQualityRefresh(); } } } } public event Action selectTypeRefresh; public event Action selectQualityRefresh; public event Action cabinetRefresh; public event Action<int> fashionDressRefresh; public event Action<int> previewRefresh; public event Action<int> virtualEquipRefresh; PlayerPackModel packModel { get { return ModelCenter.Instance.GetModel<PlayerPackModel>(); } } public override void Init() { ParseConfig(); fashionDressSelectDict = new Dictionary<int, int>(); fashionDressEquipDict = new Dictionary<int, int>(); FuncOpen.Instance.OnFuncStateChangeEvent += OnFuncStateChangeEvent; packModel.RefreshItemCountAct += RefreshItemCountAct; } public void OnBeforePlayerDataInitialize() { fashionDressLevelDict.Clear(); cabinetLevel = 0; cabinetExp = 0; } public void OnPlayerLoginOk() { UpdateRedpoint(); } public override void UnInit() { } private void OnFuncStateChangeEvent(int id) { if (id == FASHIONDRESS_FUNC_ID) { UpdateRedpoint(); } } private void RefreshItemCountAct(PackType packType, int arg2, int itemId) { if (packType == PackType.rptItem) { if (fashionDressLevelUpItems.Contains(itemId)) { UpdateRedpoint(); } } } void ParseConfig() { { var configs = Config.Instance.GetAllValues<FashionDressConfig>(); fashionDressLevelUpItems = new List<int>(); foreach (var config in configs) { fashionDressDict[config.CoatID] = new FashionDress(config); { List<int> list; if (!fashionDressTypeDict.TryGetValue(config.type, out list)) { list = new List<int>(); fashionDressTypeDict.Add(config.type, list); } list.Add(config.CoatID); } if (!fashionDressLevelUpItems.Contains(config.UnlockItemID)) { fashionDressLevelUpItems.Add(config.UnlockItemID); } { Dictionary<int, List<int>> dict; if (!fashionDressQualityDict.TryGetValue(config.type, out dict)) { dict = new Dictionary<int, List<int>>(); fashionDressQualityDict.Add(config.type, dict); } List<int> list; if (!dict.TryGetValue(config.quality, out list)) { list = new List<int>(); dict.Add(config.quality, list); } list.Add(config.CoatID); } } } { var configs = Config.Instance.GetAllValues<FashionDressCabinetConfig>(); foreach (var config in configs) { cabinetPropertyDict.Add(config.LV, ConfigParse.GetDic<int, int>(config.Attr)); if (config.LV > cabinetMaxLevel) { cabinetMaxLevel = config.LV; } } } { var config = Config.Instance.Get<FuncConfigConfig>("FashionDressType"); if (config != null) { fashionTypeMapPlaceDict = ConfigParse.GetDic<int, int>(config.Numerical1); } fashionDressTypes = fashionTypeMapPlaceDict.Keys.ToList(); } } public int GetFashionDressLevel(int id) { if (fashionDressLevelDict.ContainsKey(id)) { return fashionDressLevelDict[id]; } return 0; } public int GetFashionDressEquipId(int type) { if (fashionTypeMapPlaceDict.ContainsKey(type) && fashionDressTypeDict.ContainsKey(type)) { var equipPlace = fashionTypeMapPlaceDict[type]; var itemModel = packModel.GetItemModelByIndex(PackType.rptEquip, (int)equipPlace); var list = fashionDressTypeDict[type]; if (itemModel != null) { var index = list.FindIndex((id) => { FashionDress fashionDress; if (TryGetFashionDress(id, out fashionDress)) { return fashionDress.GetEquipItemId() == itemModel.itemId; } return false; }); if (index != -1) { return list[index]; } } } return 0; } public int GetSelectFashionDress(int type) { if (fashionDressSelectDict.ContainsKey(type)) { return fashionDressSelectDict[type]; } return 0; } public int GetVirtualEquipFashionDress(int type) { if (fashionDressEquipDict.ContainsKey(type)) { return fashionDressEquipDict[type]; } return 0; } public bool IsFashionDressUnlock(int id) { var level = GetFashionDressLevel(id); return level > 0; } public bool TryGetFashionDress(int id, out FashionDress fashionDress) { return fashionDressDict.TryGetValue(id, out fashionDress); } public bool TryGetFashionDresses(int type, int quality, out List<int> list) { list = null; if (fashionDressQualityDict.ContainsKey(type)) { return fashionDressQualityDict[type].TryGetValue(quality, out list); } return false; } public bool TryGetFashionDresses(int type, out List<int> list) { return fashionDressTypeDict.TryGetValue(type, out list); } public bool TryGetFashionDressProperty(int id, int level, out Dictionary<int, int> dict) { dict = null; if (fashionDressDict.ContainsKey(id)) { return fashionDressDict[id].TryGetProperty(level, out dict); } return false; } public bool TryGetCabinetProperty(int level, out Dictionary<int, int> dict) { return cabinetPropertyDict.TryGetValue(level, out dict); } public bool TryGetSatisfyResolves(ref List<int> list) { if (list == null) { list = new List<int>(); } list.Clear(); foreach (var fashionDress in fashionDressDict.Values) { var level = GetFashionDressLevel(fashionDress.id); if (level < fashionDress.maxLevel) { continue; } var count = packModel.GetItemCountByID(PackType.rptItem, fashionDress.requireLevelUpItem); if (count > 0 && !list.Contains(fashionDress.requireLevelUpItem)) { list.Add(fashionDress.requireLevelUpItem); } } return list != null && list.Count > 0; } public bool TryGetActiveFashionDress(out List<int> list) { list = new List<int>(); foreach (var fashionDress in fashionDressDict.Values) { var level = GetFashionDressLevel(fashionDress.id); if (level > 0) { list.Add(fashionDress.id); } } return list.Count > 0; } public bool TryLevelUp(int id, out int error) { error = 0; FashionDress fashionDress; if (TryGetFashionDress(id, out fashionDress)) { var level = GetFashionDressLevel(id); if (level >= fashionDress.maxLevel) { return false; } var count = packModel.GetItemCountByID(PackType.rptItem, fashionDress.requireLevelUpItem); var levelUpRequireCount = fashionDress.GetLevelUpRequireCount(level); if (count < levelUpRequireCount) { error = 1; return false; } } return true; } public void DisplayLevelUpError(int error) { switch (error) { case 1: SysNotifyMgr.Instance.ShowTip("FashionDressLevelUpError_1"); break; } } public void SetSelectFashionDress(int type, int id) { fashionDressSelectDict[type] = id; if (previewRefresh != null) { previewRefresh(type); } } public void SetVirtualEquipFashionDress(int type, int id) { fashionDressEquipDict[type] = id; if (virtualEquipRefresh != null) { virtualEquipRefresh(type); } } public void ReceivePackage(HB102_tagMCClothesCoatSkinState package) { cabinetLevel = (int)package.CoatChestLV; cabinetExp = (int)package.CoatChestExp; if (cabinetRefresh != null) { cabinetRefresh(); } for (int i = 0; i < package.CoatNum; i++) { var id = (int)package.CoatInfoList[i].CoatIndex; var level = (int)package.CoatInfoList[i].CoatLV; fashionDressLevelDict[id] = level; if (fashionDressRefresh != null) { fashionDressRefresh(id); } } UpdateRedpoint(); } public void SendLevelUp(int id) { CA50B_tagCMCoatUp pak = new CA50B_tagCMCoatUp(); pak.CoatIndex = (uint)id; GameNetSystem.Instance.SendInfo(pak); } public void TryEquip() { foreach (var type in fashionDressEquipDict.Keys) { var equipId = GetFashionDressEquipId(type); var virtualEquipId = fashionDressEquipDict[type]; var index = fashionTypeMapPlaceDict[type]; if (virtualEquipId != 0) { if (IsFashionDressUnlock(virtualEquipId) && virtualEquipId != equipId) { SendEquipPackage((int)PackType.rptInterimPack, virtualEquipId, (int)PackType.rptEquip, index); } } else { if (equipId != 0) { SendEquipPackage((int)PackType.rptEquip, index, (int)PackType.rptInterimPack, 0); } } } } void SendEquipPackage(int srcpackType, int scrIndex, int destpackType, int destIndex) { C073D_tagCPackItemExchange pak = new C073D_tagCPackItemExchange(); pak.SrcBackpack = (byte)srcpackType; pak.SrcIndex = (ushort)scrIndex; pak.DesBackPack = (byte)destpackType; pak.DestIndex = (ushort)destIndex; GameNetSystem.Instance.SendInfo(pak); } #region 时装详情 public int viewFashionDressId { get; private set; } public void ViewFashionDressDetails(int id) { viewFashionDressId = id; WindowCenter.Instance.Open<FashionDetailsWin>(); } #endregion #region 红点 public int fashionDressRedpointId { get; private set; } void UpdateRedpoint() { levelUpRedpoint.state = RedPointState.None; if (!FuncOpen.Instance.IsFuncOpen(FASHIONDRESS_FUNC_ID)) { return; } foreach (var fashionDress in fashionDressDict.Values) { var level = GetFashionDressLevel(fashionDress.id); if (level >= fashionDress.maxLevel) { continue; } var levelUpRequireCount = fashionDress.GetLevelUpRequireCount(level); var count = packModel.GetItemCountByID(PackType.rptItem, fashionDress.requireLevelUpItem); if (count >= levelUpRequireCount) { fashionDressRedpointId = fashionDress.id; levelUpRedpoint.state = RedPointState.Simple; return; } } } #endregion } public class FashionDress { public int id { get; private set; } public int requireLevelUpItem { get; private set; } public int maxLevel { get; private set; } public int equipPlace { get; private set; } public int fashionDressType { get; private set; } List<int> equipItems = new List<int>(); List<int> requireLevelUpCounts = new List<int>(); Dictionary<int, Dictionary<int, int>> propertys = new Dictionary<int, Dictionary<int, int>>(); public FashionDress(FashionDressConfig config) { id = config.CoatID; requireLevelUpItem = config.UnlockItemID; maxLevel = config.MaxLV; fashionDressType = config.type; requireLevelUpCounts.AddRange(config.CostItemCnt); var json = LitJson.JsonMapper.ToObject(config.StarAttr); foreach (var starKey in json.Keys) { var star = int.Parse(starKey); Dictionary<int, int> dict = new Dictionary<int, int>(); propertys.Add(star, dict); foreach (var propertyKey in json[starKey].Keys) { var property = int.Parse(propertyKey); dict.Add(property, int.Parse(json[starKey][propertyKey].ToString())); } } equipItems.AddRange(config.EquipItemID); var equipItemConfig = Config.Instance.Get<ItemConfig>(equipItems[0]); equipPlace = equipItemConfig.EquipPlace; } public int GetEquipItemId(int job = 0) { if (job == 0) { job = PlayerDatas.Instance.baseData.Job; } var index = job - 1; if (index < equipItems.Count) { return equipItems[index]; } return 0; } public bool TryGetProperty(int level, out Dictionary<int, int> dict) { return propertys.TryGetValue(level, out dict); } public int GetLevelUpRequireCount(int level) { var index = level; if (index < requireLevelUpCounts.Count) { return requireLevelUpCounts[index]; } return 0; } } } System/FashionDress/FashionDressModel.cs.meta
New file @@ -0,0 +1,12 @@ fileFormatVersion: 2 guid: 0a0e33f1957b1724ba147992931bd7f9 timeCreated: 1546852997 licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: System/FashionDress/FashionDressQualityBehaviour.cs
New file @@ -0,0 +1,83 @@ using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; namespace Snxxz.UI { [XLua.Hotfix] public class FashionDressQualityBehaviour : MonoBehaviour { [SerializeField] int m_Quality = 0; [SerializeField] Transform m_ContainerSelect; [SerializeField] Transform m_ContainerNormal; [SerializeField] Transform m_Redpoint; [SerializeField] Shadow m_QualityShadow; [SerializeField] Button m_Select; FashionDressModel model { get { return ModelCenter.Instance.GetModel<FashionDressModel>(); } } private void Awake() { m_Select.AddListener(OnSelect); } public void Display() { model.selectQualityRefresh += SelectQualityRefresh; RedpointCenter.Instance.redpointValueChangeEvent += RedpointValueChangeEvent; DisplaySelect(); DisplayRedpoint(); } void DisplaySelect() { bool selected = model.selectQuality == m_Quality; m_ContainerSelect.gameObject.SetActive(selected); m_ContainerNormal.gameObject.SetActive(!selected); m_QualityShadow.enabled = selected; } void DisplayRedpoint() { var requireRedpoint = false; List<int> list; if (model.levelUpRedpoint.state == RedPointState.Simple && model.TryGetFashionDresses(model.selectType, m_Quality, out list) && list.Contains(model.fashionDressRedpointId)) { requireRedpoint = true; } m_Redpoint.gameObject.SetActive(requireRedpoint); } public void Dispose() { model.selectQualityRefresh -= SelectQualityRefresh; RedpointCenter.Instance.redpointValueChangeEvent -= RedpointValueChangeEvent; } private void RedpointValueChangeEvent(int id) { if (model.levelUpRedpoint.id == id) { DisplayRedpoint(); } } private void SelectQualityRefresh() { DisplaySelect(); } private void OnSelect() { model.selectQuality = m_Quality; } } } System/FashionDress/FashionDressQualityBehaviour.cs.meta
New file @@ -0,0 +1,12 @@ fileFormatVersion: 2 guid: a006ff57d928a7248b12f7688c91811e timeCreated: 1546914298 licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: System/FashionDress/FashionDressTypeBehaviour.cs
New file @@ -0,0 +1,82 @@ using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; namespace Snxxz.UI { [XLua.Hotfix] public class FashionDressTypeBehaviour : MonoBehaviour { [SerializeField] int m_FashionDressType; [SerializeField] Button m_Select; [SerializeField] RectTransform m_ContainerSelect; [SerializeField] RectTransform m_ContainerNormal; [SerializeField] Transform m_SelectRedpoint; [SerializeField] Transform m_NormalRedpoint; FashionDressModel model { get { return ModelCenter.Instance.GetModel<FashionDressModel>(); } } private void Awake() { m_Select.onClick.AddListener(OnSelect); } public void Display() { model.selectTypeRefresh += SelectEquipPlaceRefresh; RedpointCenter.Instance.redpointValueChangeEvent += RedpointValueChangeEvent; DisplaySelect(); DisplayRedpoint(); } void DisplaySelect() { m_ContainerSelect.gameObject.SetActive(m_FashionDressType == model.selectType); m_ContainerNormal.gameObject.SetActive(m_FashionDressType != model.selectType); } void DisplayRedpoint() { var requireRedpoint = false; List<int> list; if (model.levelUpRedpoint.state == RedPointState.Simple && model.TryGetFashionDresses(m_FashionDressType, out list) && list.Contains(model.fashionDressRedpointId)) { requireRedpoint = true; } m_SelectRedpoint.gameObject.SetActive(requireRedpoint); m_NormalRedpoint.gameObject.SetActive(requireRedpoint); } public void Dispose() { model.selectTypeRefresh -= SelectEquipPlaceRefresh; RedpointCenter.Instance.redpointValueChangeEvent -= RedpointValueChangeEvent; } private void RedpointValueChangeEvent(int id) { if (model.levelUpRedpoint.id == id) { DisplayRedpoint(); } } private void SelectEquipPlaceRefresh() { DisplaySelect(); } private void OnSelect() { model.selectType = m_FashionDressType; } } } System/FashionDress/FashionDressTypeBehaviour.cs.meta
New file @@ -0,0 +1,12 @@ fileFormatVersion: 2 guid: ac86cee78491407418892b9b745e2b1c timeCreated: 1546862460 licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: System/FashionDress/FashionDressWin.cs
New file @@ -0,0 +1,347 @@ //-------------------------------------------------------- // [Author]: 第二世界 // [ Date ]: Monday, January 07, 2019 //-------------------------------------------------------- using System; using System.Collections; using System.Collections.Generic; using TableConfig; using UnityEngine; using UnityEngine.UI; namespace Snxxz.UI { [XLua.Hotfix] public class FashionDressWin : Window { [SerializeField] FashionDressTypeBehaviour[] m_FashionDressTypes; [SerializeField] Button m_ViewProperty; [SerializeField] Button m_Resolve; [SerializeField] IntensifySmoothSlider m_SmoothSlider; [SerializeField] Text m_CabinetExp; [SerializeField] Text m_CabinetLevel; [SerializeField] RawImage m_RawModel; [SerializeField] FashionDressQualityBehaviour[] m_FashionDressQualitys; [SerializeField] ScrollerController m_ScrollerControl; [SerializeField] RectTransform m_ContainerViewDetail; [SerializeField] Button m_ViewDetail; FashionDressModel model { get { return ModelCenter.Instance.GetModel<FashionDressModel>(); } } PlayerPackModel packModel { get { return ModelCenter.Instance.GetModel<PlayerPackModel>(); } } MagicianModel godWeaponModel { get { return ModelCenter.Instance.GetModel<MagicianModel>(); } } List<int> resolveList = new List<int>(); #region Built-in protected override void BindController() { } protected override void AddListeners() { m_ViewProperty.AddListener(ViewProperty); m_Resolve.AddListener(Resolve); m_ViewDetail.AddListener(ViewDetail); m_ScrollerControl.OnRefreshCell += OnRefreshCell; } protected override void OnPreOpen() { SetDefaultSelect(); model.cabinetRefresh += FashionDressCabinetRefresh; model.selectTypeRefresh += SelectTypeRefresh; model.selectQualityRefresh += SelectQualityRefresh; model.previewRefresh += PreviewRefresh; //model.virtualEquipRefresh += VirtualEquipRefresh; model.fashionDressRefresh += FashionDressRefresh; packModel.RefreshItemCountAct += RefreshItemCountAct; for (int i = 0; i < m_FashionDressTypes.Length; i++) { m_FashionDressTypes[i].Display(); } for (int i = 0; i < m_FashionDressQualitys.Length; i++) { m_FashionDressQualitys[i].Display(); } Display(); } protected override void OnAfterOpen() { } protected override void OnPreClose() { model.cabinetRefresh -= FashionDressCabinetRefresh; model.selectTypeRefresh -= SelectTypeRefresh; model.selectQualityRefresh -= SelectQualityRefresh; model.previewRefresh -= PreviewRefresh; packModel.RefreshItemCountAct -= RefreshItemCountAct; model.fashionDressRefresh -= FashionDressRefresh; //model.virtualEquipRefresh -= VirtualEquipRefresh; for (int i = 0; i < m_FashionDressTypes.Length; i++) { m_FashionDressTypes[i].Dispose(); } for (int i = 0; i < m_FashionDressQualitys.Length; i++) { m_FashionDressQualitys[i].Dispose(); } model.TryEquip(); } protected override void OnAfterClose() { } #endregion void SetDefaultSelect() { model.selectType = model.fashionDressTypes[0]; model.selectQuality = 0; foreach (var fashionDressType in model.fashionDressTypes) { var equipId = model.GetFashionDressEquipId(fashionDressType); model.SetVirtualEquipFashionDress(fashionDressType, equipId); model.SetSelectFashionDress(fashionDressType, equipId); } } void Display() { DisplayCabinet(); DisplayFashionDress(); DisplayModel(); DisplayViewDetail(); } void DisplayCabinet(bool requireAnimation = false) { m_SmoothSlider.stage = model.cabinetLevel; if (!requireAnimation) { m_SmoothSlider.delay = 0; m_SmoothSlider.ResetStage(); } else { m_SmoothSlider.delay = 0.2f; } bool isMax = model.cabinetLevel >= model.cabinetMaxLevel; var progress = 0f; if (isMax) { progress = 1; m_CabinetExp.text = model.cabinetExp.ToString(); } else { var config = Config.Instance.Get<FashionDressCabinetConfig>(model.cabinetLevel + 1); progress = Mathf.Clamp01((float)model.cabinetExp / config.NeedExp); m_CabinetExp.text = StringUtility.Contact(model.cabinetExp, "/", config.NeedExp); } m_SmoothSlider.value = progress; m_CabinetLevel.text = Language.Get("CabinetLevel", model.cabinetLevel); } void DisplayFashionDress() { List<int> list; m_ScrollerControl.Refresh(); if (model.TryGetFashionDresses(model.selectType, model.selectQuality, out list)) { for (int i = 0; i < list.Count; i++) { m_ScrollerControl.AddCell(ScrollerDataType.Header, list[i]); } } m_ScrollerControl.Restart(); } void DisplayViewDetail() { var selectFashionDress = model.GetSelectFashionDress(model.selectType); m_ContainerViewDetail.gameObject.SetActive(selectFashionDress != 0); } private void FashionDressCabinetRefresh() { DisplayCabinet(true); } private void SelectTypeRefresh() { DisplayFashionDress(); } private void SelectQualityRefresh() { DisplayFashionDress(); } private void PreviewRefresh(int type) { if (model.selectType == type) { m_ScrollerControl.m_Scorller.RefreshActiveCellViews(); } DisplayModel(); DisplayViewDetail(); } //private void VirtualEquipRefresh(int type) //{ // if (model.selectType == type) // { // m_ScrollerControl.m_Scorller.RefreshActiveCellViews(); // } // DisplayModel(); // DisplayViewDetail(); //} private void FashionDressRefresh(int id) { m_ScrollerControl.RefreshSingleCellView(id); } private void OnRefreshCell(ScrollerDataType type, CellView cell) { var fashionDressCell = cell as FashionDressCell; fashionDressCell.Display(cell.index); } private void RefreshItemCountAct(PackType packType, int index, int itemId) { if (packType == PackType.rptItem && model.fashionDressLevelUpItems.Contains(itemId)) { m_ScrollerControl.m_Scorller.RefreshActiveCellViews(); } if (packType == PackType.rptEquip) { if (index == (int)RoleEquipType.retFashionClothes || index == (int)RoleEquipType.retFashionWeapon || index == (int)RoleEquipType.retFashionWeapon2) { m_ScrollerControl.m_Scorller.RefreshActiveCellViews(); foreach (var fashionDressType in model.fashionDressTypes) { var equipId = model.GetFashionDressEquipId(fashionDressType); model.SetVirtualEquipFashionDress(fashionDressType, equipId); model.SetSelectFashionDress(fashionDressType, equipId); } } } } public void DisplayModel() { m_RawModel.gameObject.SetActive(true); var job = PlayerDatas.Instance.baseData.Job; var playerPack = ModelCenter.Instance.GetModel<PlayerPackModel>(); var clothes = playerPack.GetItemModelByIndex(PackType.rptEquip, (int)RoleEquipType.retClothes); var clothesId = clothes == null ? 0 : (int)clothes.itemInfo.ItemID; var weapon = playerPack.GetItemModelByIndex(PackType.rptEquip, (int)RoleEquipType.retWeapon); var weaponId = weapon == null ? 0 : (int)weapon.itemInfo.ItemID; var wings = playerPack.GetItemModelByIndex(PackType.rptEquip, (int)RoleEquipType.retWing); var wingsId = wings == null ? 0 : (int)wings.itemInfo.ItemID; var secondary = playerPack.GetItemModelByIndex(PackType.rptEquip, (int)RoleEquipType.retWeapon2); var secondaryId = secondary == null ? 0 : (int)secondary.itemInfo.ItemID; int _suitLevel = 0; if (clothes != null) { if (clothes.itemInfo.IsSuite == 1) { if (clothes.GetUseDataModel(30) != null && clothes.GetUseDataModel(30)[0] != 0) { _suitLevel = clothes.GetUseDataModel(30)[0]; } } } Dictionary<int, int> dict = new Dictionary<int, int>(); for (int i = 0; i < godWeaponModel.godWeaponTypes.Count; i++) { var type = godWeaponModel.godWeaponTypes[i]; var godWeaponInfo = godWeaponModel.GetGodWeaponInfo(type); var equipedLevel = godWeaponInfo != null ? godWeaponInfo.level : 0; dict[type] = equipedLevel; } UI3DPlayerExhibitionData data = new UI3DPlayerExhibitionData() { job = job, clothesId = clothesId, suitLevel = _suitLevel, weaponId = weaponId, wingsId = wingsId, secondaryId = secondaryId, isDialogue = false, godWeapons = dict }; UI3DModelExhibition.Instance.ShowOtherPlayer(m_RawModel, data); } private void Resolve() { if (!model.TryGetSatisfyResolves(ref resolveList)) { SysNotifyMgr.Instance.ShowTip("FashionDressResolveOpenError"); return; } WindowCenter.Instance.Open<FashiongDecomposeWin>(); } private void ViewProperty() { WindowCenter.Instance.Open<FashionSumAttrWin>(); } private void ViewDetail() { var virtualEquipId = model.GetVirtualEquipFashionDress(model.selectType); var previewId = model.GetSelectFashionDress(model.selectType); if (previewId != 0) { model.ViewFashionDressDetails(previewId); } else if (virtualEquipId != 0) { model.ViewFashionDressDetails(virtualEquipId); } } } } System/FashionDress/FashionDressWin.cs.meta
New file @@ -0,0 +1,12 @@ fileFormatVersion: 2 guid: aa3feb2eec13a714da4c9c6522acc0a3 timeCreated: 1546859809 licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: System/FashionDress/FashionSumAttrWin.cs
New file @@ -0,0 +1,224 @@ using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using TableConfig; using System.Linq; using System.Collections; namespace Snxxz.UI { [XLua.Hotfix] public class FashionSumAttrWin : Window { [SerializeField] GameObject container; [SerializeField] CanvasGroup alpha; [Header("时装总加成")] [SerializeField] Text activateNumText; [SerializeField] GameObject noneActivate; [SerializeField] List<Text> activateAttrs = new List<Text>(); [SerializeField] List<GameObject> activateAttrObjs = new List<GameObject>(); [Header("衣柜等级加成")] [SerializeField] Text wardrobeLvText; [SerializeField] GameObject noneLvAdd; [SerializeField] List<Text> lvAddAttrs = new List<Text>(); [SerializeField] List<GameObject> lvAddAttrObjs = new List<GameObject>(); FashionDressModel fashionModel { get { return ModelCenter.Instance.GetModel<FashionDressModel>(); } } ItemTipsModel tipsModel { get { return ModelCenter.Instance.GetModel<ItemTipsModel>(); } } #region Built-in protected override void BindController() { } protected override void AddListeners() { } protected override void OnPreOpen() { SetDisplay(); } protected override void OnActived() { base.OnActived(); StartCoroutine(DelayShow()); } protected override void OnAfterOpen() { } protected override void OnPreClose() { } protected override void OnAfterClose() { } #endregion private void SetDisplay() { alpha.alpha = 0; container.SetActive(false); SetActivateFashionAdd(); SetWardrobeLvAdd(); } private void SetActivateFashionAdd() { List<int> activateIds = null; bool isActivate = fashionModel.TryGetActiveFashionDress(out activateIds); int sumNum = fashionModel.fashoinDressCount; int activateNum = activateIds.Count; string actvivateNumSB = string.Empty; if(activateNum > 0) { actvivateNumSB = UIHelper.AppendStringColor(TextColType.Green,activateNum.ToString()); } else { actvivateNumSB = UIHelper.AppendStringColor(TextColType.Red, activateNum.ToString()); } activateNumText.text = StringUtility.Contact(actvivateNumSB, "/",sumNum); Dictionary<int, int> attrDict = GetActivateAttr(); if(attrDict != null && attrDict.Count > 0) { noneActivate.SetActive(false); List<int> attrIds = attrDict.Keys.ToList(); for(int i = 0; i < activateAttrObjs.Count; i++) { var attrObj = activateAttrObjs[i]; attrObj.SetActive(i < attrIds.Count); if(i < attrIds.Count) { var attrText = activateAttrs[i]; int attrId = attrIds[i]; int attrValue = attrDict[attrId]; var attrConfig = Config.Instance.Get<PlayerPropertyConfig>(attrId); string attrSB = string.Empty; string attrValueSB = UIHelper.AppendStringColor(TextColType.Green, tipsModel.GetProValueTypeStr(attrConfig, attrValue)); if (attrConfig.Name.Contains("%s")) { attrSB = attrConfig.Name.Replace("%s",attrValueSB); } else { attrSB = StringUtility.Contact(attrConfig.Name, "+",attrValueSB); } attrText.text = attrSB; } } } else { noneActivate.SetActive(true); for (int i = 0; i < activateAttrObjs.Count; i++) { var attrObj = activateAttrObjs[i]; attrObj.SetActive(false); } } } private Dictionary<int,int> GetActivateAttr() { var sumAttrDict = new Dictionary<int, int>(); List<int> fashionIds = null; bool isActivate = fashionModel.TryGetActiveFashionDress(out fashionIds); if(isActivate) { foreach(var id in fashionIds) { int fashionLevel = fashionModel.GetFashionDressLevel(id); Dictionary<int, int> attrDict = null; bool isAttr = fashionModel.TryGetFashionDressProperty(id,fashionLevel,out attrDict); if(isAttr) { foreach(var attrId in attrDict.Keys) { var attrValue = attrDict[attrId]; if(!sumAttrDict.ContainsKey(attrId)) { sumAttrDict.Add(attrId,attrValue); } else { sumAttrDict[attrId] = attrValue; } } } } } return sumAttrDict; } private void SetWardrobeLvAdd() { int wardrobeLevel = fashionModel.cabinetLevel; string wardrobeLevelSB = string.Empty; if (wardrobeLevel > 0) { wardrobeLevelSB = UIHelper.AppendStringColor(TextColType.Green, wardrobeLevel.ToString()); } else { wardrobeLevelSB = UIHelper.AppendStringColor(TextColType.Red, wardrobeLevel.ToString()); } wardrobeLvText.text = StringUtility.Contact(wardrobeLevelSB, "级"); Dictionary<int, int> attrDict = null; fashionModel.TryGetCabinetProperty(fashionModel.cabinetLevel, out attrDict); if (attrDict != null && attrDict.Count > 0) { noneLvAdd.SetActive(false); List<int> attrIds = attrDict.Keys.ToList(); for (int i = 0; i < lvAddAttrObjs.Count; i++) { var attrObj = lvAddAttrObjs[i]; attrObj.SetActive(i < attrIds.Count); if (i < attrIds.Count) { var attrText = lvAddAttrs[i]; int attrId = attrIds[i]; int attrValue = attrDict[attrId]; var attrConfig = Config.Instance.Get<PlayerPropertyConfig>(attrId); string attrSB = string.Empty; string attrValueSB = UIHelper.AppendStringColor(TextColType.Green, tipsModel.GetProValueTypeStr(attrConfig, attrValue)); if (attrConfig.Name.Contains("%s")) { attrSB = attrConfig.Name.Replace("%s", attrValueSB); } else { attrSB = StringUtility.Contact(attrConfig.Name, "+", attrValueSB); } attrText.text = attrSB; } } } else { noneLvAdd.SetActive(true); for (int i = 0; i < lvAddAttrObjs.Count; i++) { var attrObj = lvAddAttrObjs[i]; attrObj.SetActive(false); } } } IEnumerator DelayShow() { yield return null; container.SetActive(true); StartCoroutine(DelayAlpha()); } IEnumerator DelayAlpha() { yield return null; alpha.alpha = 1; } } } System/FashionDress/FashionSumAttrWin.cs.meta
New file @@ -0,0 +1,12 @@ fileFormatVersion: 2 guid: c8afd26123775ac4b912680f965deea6 timeCreated: 1546915247 licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: System/FashionDress/FashiongDecomposeWin.cs
New file @@ -0,0 +1,119 @@ using System; using UnityEngine; using UnityEngine.UI; using TableConfig; namespace Snxxz.UI { [XLua.Hotfix] public class FashiongDecomposeWin : Window { [SerializeField] Button closeBtn; [SerializeField] Button decomposeBtn; [SerializeField] Text wardrobeLvText; [SerializeField] Text upgradeExpText; [SerializeField] Text getExpText; [SerializeField] ScrollerController lineCtrl; [SerializeField, Header("创建格子数")] int initGrid = 100; FashionDressModel model{ get { return ModelCenter.Instance.GetModel<FashionDressModel>(); }} #region Built-in protected override void BindController() { } protected override void AddListeners() { closeBtn.AddListener(CloseClick); decomposeBtn.AddListener(ClickDecompose); } protected override void OnPreOpen() { model.cabinetRefresh += UpdateCabinetInfo; FashionDecomposeModel.Instance.UpdateDecomposeExpEvent += UpdateGetExp; SetDisplay(); } protected override void OnAfterOpen() { } protected override void OnPreClose() { model.cabinetRefresh -= UpdateCabinetInfo; FashionDecomposeModel.Instance.UpdateDecomposeExpEvent -= UpdateGetExp; } protected override void OnAfterClose() { } #endregion private void SetDisplay() { FashionDecomposeModel.Instance.GetDecomposeItem(); CreateLineCell(); UpdateGetExp(); UpdateCabinetLv(); } private void UpdateCabinetInfo() { FashionDecomposeModel.Instance.GetDecomposeItem(); UpdateCabinetLv(); lineCtrl.m_Scorller.RefreshActiveCellViews(); } private void CreateLineCell() { int line = initGrid / 5; lineCtrl.Refresh(); for (int i = 0; i < line; i++) { lineCtrl.AddCell(ScrollerDataType.Header, i); } lineCtrl.Restart(); } private void UpdateCabinetLv() { int wardrobeLv = model.cabinetLevel; wardrobeLvText.text = StringUtility.Contact(wardrobeLv, "级"); int curWardrobeExp = model.cabinetExp; bool isCabinetMax = wardrobeLv >= model.cabinetMaxLevel ? true : false; int upgradeLv = isCabinetMax ? model.cabinetMaxLevel : wardrobeLv + 1; var cabinetConfig = Config.Instance.Get<FashionDressCabinetConfig>(upgradeLv); upgradeExpText.gameObject.SetActive(cabinetConfig != null); if (cabinetConfig != null) { int upgradeWardrobeExp = cabinetConfig.NeedExp; if (isCabinetMax) { upgradeExpText.text = StringUtility.Contact("(已升至最高等级)"); } else { upgradeExpText.text = StringUtility.Contact("(", curWardrobeExp, "/", upgradeWardrobeExp, ")"); } } } private void UpdateGetExp() { int getDecomposeExp = FashionDecomposeModel.Instance.GetSumDecomposeExp(); getExpText.text = getDecomposeExp.ToString(); } private void ClickDecompose() { int getDecomposeExp = FashionDecomposeModel.Instance.GetSumDecomposeExp(); if(getDecomposeExp <= 0) { return; } FashionDecomposeModel.Instance.SendDecomposeFashion(); CloseImmediately(); } } } System/FashionDress/FashiongDecomposeWin.cs.meta
New file @@ -0,0 +1,12 @@ fileFormatVersion: 2 guid: dcedad5cc63fa9a449a785ffa93d903c timeCreated: 1546928860 licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: System/GatheringSoul/GatheringSoulModel.cs
@@ -85,15 +85,15 @@ public const int RARA_GATHERSOUL_QUALITY = 3; const int GATHERSOUL_REDPOINT_BASE = 10102; const int GATHERSOUL_REDPOINT_DEEP = 1010200; const int GATHERSOUL_REDPOINT_BASE = 10104; const int GATHERSOUL_REDPOINT_DEEP = 1010400; static int redpointIndex = 5; public readonly Redpoint redpoint = new Redpoint(101, GATHERSOUL_REDPOINT_BASE); public readonly Redpoint equipRedpoint = new Redpoint(GATHERSOUL_REDPOINT_BASE, 1010201); public readonly Redpoint replaceRedpoint = new Redpoint(GATHERSOUL_REDPOINT_BASE, 1010202); public readonly Redpoint resolveRedpoint = new Redpoint(GATHERSOUL_REDPOINT_BASE, 1010203); public readonly Redpoint levelUpRedpoint = new Redpoint(GATHERSOUL_REDPOINT_BASE, 1010204); public readonly Redpoint equipRedpoint = new Redpoint(GATHERSOUL_REDPOINT_BASE, 1010401); public readonly Redpoint replaceRedpoint = new Redpoint(GATHERSOUL_REDPOINT_BASE, 1010402); public readonly Redpoint resolveRedpoint = new Redpoint(GATHERSOUL_REDPOINT_BASE, 1010403); public readonly Redpoint levelUpRedpoint = new Redpoint(GATHERSOUL_REDPOINT_BASE, 1010404); static readonly IComparer<int> soulPackSort = new GatherSoulPackSort(); static readonly IEqualityComparer<int> holeItemTypeDistinct = new HoleItemTypeDistinct(); System/Role/RolePanel.cs
@@ -16,6 +16,7 @@ [SerializeField] FunctionButton functionButtonRole; [SerializeField] FunctionButton functionButtonMagician; [SerializeField] FunctionButton m_GatherSoul; [SerializeField] FunctionButton m_FashionDress; [SerializeField] RectTransform m_RoleInfoRt; [SerializeField] Text m_PropertyAtk; @@ -267,6 +268,7 @@ functionButtonMagician.onClick.AddListener(OnFuncMagician); m_AddPoint.onClick.AddListener(OnPromoteClick); m_GatherSoul.onClick.AddListener(GatherSoul); m_FashionDress.onClick.AddListener(OpenFashionDress); m_PlayerPropertyBtn.onClick.AddListener(OnAttrExplainClick); m_TitleBtn.onClick.AddListener(OnDesignationClick); m_RenameBtn.onClick.AddListener(OnRenameClick); @@ -283,6 +285,13 @@ functionOrder = m_GatherSoul.order; } private void OpenFashionDress() { CloseChild(); WindowCenter.Instance.Open<FashionDressWin>(); functionOrder = m_FashionDress.order; } private void OnFuncMagician() { CloseChild(); System/WindowBase/ModelCenter.cs
@@ -218,6 +218,7 @@ RegisterModel<GatherSoulComposeModel>(); RegisterModel<GatherSoulDungeonModel>(); RegisterModel<KingTreasureModel>(); RegisterModel<FashionDressModel>(); inited = true; } Utility/EnumHelper.cs
@@ -374,6 +374,9 @@ retBaldric5, //17 佩饰 retBaldric6, //18 佩饰 mount = 19,//当前的坐骑 retFashionWeapon = 20,//时装武器 retFashionClothes = 21,//时装衣服 retFashionWeapon2 = 22,//时装副手 retMax, };