| | |
| | | public static void Init()
|
| | | {
|
| | | // 登记相应的数据体及对应的数据转逻辑类
|
| | | Register(typeof(HA3B1_tagMCEquipPartStarInfo), typeof(DTCA3B1_tagMCEquipPartStarInfo));
|
| | | Register(typeof(HA816_tagMCMysticalShopInfo), typeof(DTCA816_tagMCMysticalShopInfo));
|
| | | Register(typeof(HAC11_tagGCFeastRedPacketInfo), typeof(DTCAC11_tagGCFeastRedPacketInfo));
|
| | | Register(typeof(HAB25_tagMCFeastRedPackInfo), typeof(DTCAB25_tagMCFeastRedPackInfo));
|
| New file |
| | |
| | | using System.Collections; |
| | | using System.Collections.Generic; |
| | | using UnityEngine; |
| | | |
| | | public partial class EquipPlaceMapConfig : IConfigPostProcess |
| | | { |
| | | static Dictionary<int, int> clientPlaceToServerPlace = new Dictionary<int, int>(); |
| | | |
| | | public void OnConfigParseCompleted() |
| | | { |
| | | clientPlaceToServerPlace[LV * 100 + EquipPlace] = PackIndex; |
| | | } |
| | | |
| | | public static int GetServerPlace(int level, int equipPlace) |
| | | { |
| | | var key = level * 100 + equipPlace; |
| | | if (clientPlaceToServerPlace.ContainsKey(key)) |
| | | { |
| | | return clientPlaceToServerPlace[key]; |
| | | } |
| | | else |
| | | { |
| | | return 0; |
| | | } |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 5575604ea3a7ff34d97988215afd52dd |
| | | timeCreated: 1551686215 |
| | | licenseType: Pro |
| | | MonoImporter: |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | using UnityEngine; |
| | | using System.Collections; |
| | | |
| | | // A5 C5 装备部位升星 #tagCMEquipPartStarUp |
| | | |
| | | public class CA5C5_tagCMEquipPartStarUp : GameNetPackBasic |
| | | { |
| | | public ushort EquipPackIndex; // 部位格子索引 |
| | | public byte CostEquipCnt; // 装备个数 |
| | | public ushort[] CostEquipIndex; // 装备索引 |
| | | public uint[] CostEquipID; // 装备物品ID |
| | | |
| | | public CA5C5_tagCMEquipPartStarUp() |
| | | { |
| | | combineCmd = (ushort)0x03FE; |
| | | _cmd = (ushort)0xA5C5; |
| | | } |
| | | |
| | | public override void WriteToBytes() |
| | | { |
| | | WriteBytes(EquipPackIndex, NetDataType.WORD); |
| | | WriteBytes(CostEquipCnt, NetDataType.BYTE); |
| | | WriteBytes(CostEquipIndex, NetDataType.WORD, CostEquipCnt); |
| | | WriteBytes(CostEquipID, NetDataType.DWORD, CostEquipCnt); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 0e0e73c681efe2a439a71954e7dab705 |
| | | timeCreated: 1551685504 |
| | | licenseType: Pro |
| | | MonoImporter: |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | using UnityEngine;
|
| | | using System.Collections;
|
| | | using Snxxz.UI;
|
| | | // A3 B1 装备部位星数信息 #tagMCEquipPartStarInfo
|
| | |
|
| | | public class DTCA3B1_tagMCEquipPartStarInfo : DtcBasic
|
| | | {
EquipStarModel model { get { return ModelCenter.Instance.GetModel<EquipStarModel>(); } }
|
| | |
|
| | | public override void Done(GameNetPackBasic vNetPack)
|
| | | {
base.Done(vNetPack);
|
| | | var vNetData = vNetPack as HA3B1_tagMCEquipPartStarInfo;
model.UpdateStarLevels(vNetData);
|
| | | }
|
| | | }
|
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 718480869f00d38488b3c37ffc53c5bc |
| | | timeCreated: 1551687370 |
| | | licenseType: Pro |
| | | MonoImporter: |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | using UnityEngine;
|
| | | using System.Collections;
|
| | |
|
| | | // A3 B1 装备部位星数信息 #tagMCEquipPartStarInfo
|
| | |
|
| | | public class HA3B1_tagMCEquipPartStarInfo : GameNetPackBasic {
|
| | | public byte Count; // 信息个数
|
| | | public tagMCEquipPartStar[] InfoList = null; // 信息列表
|
| | |
|
| | | public HA3B1_tagMCEquipPartStarInfo () {
|
| | | _cmd = (ushort)0xA3B1;
|
| | | }
|
| | |
|
| | | public override void ReadFromBytes (byte[] vBytes) {
|
| | | TransBytes (out Count, vBytes, NetDataType.BYTE);
|
| | | InfoList = new tagMCEquipPartStar[Count];
|
| | | for (int i = 0; i < Count; i ++) {
|
| | | InfoList[i] = new tagMCEquipPartStar();
|
| | | TransBytes (out InfoList[i].EquipPackIndex, vBytes, NetDataType.WORD);
|
| | | TransBytes (out InfoList[i].Star, vBytes, NetDataType.BYTE);
|
| | | }
|
| | | }
|
| | |
|
| | | public struct tagMCEquipPartStar {
|
| | | public ushort EquipPackIndex;
|
| | | public byte Star;
|
| | | }
|
| | |
|
| | | }
|
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 0169900e0e4c9a0428ac35731c220f82 |
| | | timeCreated: 1551687369 |
| | | licenseType: Pro |
| | | MonoImporter: |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| | |
| | | namespace Snxxz.UI |
| | | { |
| | | |
| | | public class EquipLevelSelectBehaviour : ScrollItem |
| | | public class EquipLevelSelectBehaviour : MonoBehaviour |
| | | { |
| | | [SerializeField] RectTransform m_AppearanceSign; |
| | | [SerializeField] RedpointBehaviour m_Redpoint; |
| | | [SerializeField] RectTransform m_SelectedSign; |
| | | [SerializeField] Button m_Select; |
| | | [SerializeField] Image m_Icon; |
| | | [SerializeField] Text m_LevelName; |
| | | [SerializeField] RectTransform m_LockContainer; |
| | | [SerializeField] Text m_UnLockCondition; |
| | | [SerializeField] Material m_MaterialNormal; |
| | | [SerializeField] Material m_MaterialLocked; |
| | | [SerializeField] FontColorSizeConfig m_FontColor; |
| | | [SerializeField] FontColorSizeConfig m_FontConfig; |
| | | |
| | | EquipModel model { get { return ModelCenter.Instance.GetModel<EquipModel>(); } } |
| | | int level = 0; |
| | | EquipSet equipSet; |
| | | |
| | | public override void Display(object data) |
| | | public void Display(int level) |
| | | { |
| | | base.Display(data); |
| | | |
| | | this.level = (int)data; |
| | | this.level = level; |
| | | this.equipSet = model.GetEquipSet(level); |
| | | |
| | | this.m_Select.SetListener(() => { model.SelectSet(this.level, 0); }); |
| | |
| | | UpdateDynamicInfo(true); |
| | | } |
| | | |
| | | public override void Dispose() |
| | | public void Dispose() |
| | | { |
| | | base.Dispose(); |
| | | } |
| | | |
| | | private void LateUpdate() |
| | |
| | | m_LevelName.text = string.Empty; |
| | | |
| | | var unLocked = equipSet.unLocked; |
| | | m_UnLockCondition.gameObject.SetActive(unLocked); |
| | | m_Icon.material = unLocked ? m_MaterialNormal : m_MaterialLocked; |
| | | m_LevelName.color = m_FontColor.GetColorSize(unLocked ? "" : "").color; |
| | | if (!unLocked) |
| | | { |
| | | m_UnLockCondition.text = string.Empty; |
| | | } |
| | | |
| | | m_LockContainer.gameObject.SetActive(!unLocked); |
| | | m_Redpoint.redpointId = this.equipSet.redpoint.id; |
| | | } |
| | | |
| | |
| | | |
| | | if (force || equipSet.selected.dirty) |
| | | { |
| | | m_SelectedSign.gameObject.SetActive(equipSet.selected.Fetch()); |
| | | var selected = equipSet.selected.Fetch(); |
| | | m_Icon.SetSprite(equipSet.selected.Fetch() ? "Title_Clicked" : "Title_Normal"); |
| | | m_LevelName.color = m_FontConfig.GetColorSize(selected ? "Selected" : "Normal").color; |
| | | } |
| | | } |
| | | |
| | |
| | | return new List<int>(equipSets.Keys); |
| | | } |
| | | |
| | | public List<int> GetViewableEquipSets() |
| | | { |
| | | var sets = new List<int>(); |
| | | var enumerator = equipSets.GetEnumerator(); |
| | | while (enumerator.MoveNext()) |
| | | { |
| | | if (enumerator.Current.Value.unLocked) |
| | | { |
| | | sets.Add(enumerator.Current.Value.level); |
| | | } |
| | | else |
| | | { |
| | | break; |
| | | } |
| | | } |
| | | |
| | | if (enumerator.Current.Value != null) |
| | | { |
| | | sets.Add(enumerator.Current.Value.level); |
| | | } |
| | | |
| | | return sets; |
| | | } |
| | | |
| | | public EquipSet GetEquipSet(int level) |
| | | { |
| | | if (!equipSets.ContainsKey(level)) |
| | |
| | | } |
| | | } |
| | | |
| | | public static int ClientPlaceToServerPlace(int level, int place) |
| | | { |
| | | return EquipPlaceMapConfig.GetServerPlace(level, place); |
| | | } |
| | | |
| | | } |
| | | |
| | | public struct EquipAppearance |
| | |
| | | public class EquipSuitPropertyWidget : MonoBehaviour |
| | | { |
| | | [SerializeField] Text m_SuitName; |
| | | [SerializeField] StarToggle[] m_StarToggles; |
| | | [SerializeField] Text[] m_SuitEquipNames; |
| | | |
| | | [SerializeField] EquipSuitPropertyBar m_TwoSuit; |
| | |
| | | return string.Join("\n", lines.ToArray()); |
| | | } |
| | | |
| | | public class StarToggle |
| | | { |
| | | public int star; |
| | | public Text title; |
| | | public Toggle toggle; |
| | | |
| | | public void Display() |
| | | { |
| | | |
| | | title.gameObject.SetActive(true); |
| | | } |
| | | |
| | | public void Hide() |
| | | { |
| | | |
| | | } |
| | | |
| | | private void OnValueChange(bool value) |
| | | { |
| | | if (value) |
| | | { |
| | | switch (star) |
| | | { |
| | | case 0: |
| | | break; |
| | | case 3: |
| | | break; |
| | | case 6: |
| | | break; |
| | | case 9: |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | public class RealmEquipWin : Window |
| | | { |
| | | [SerializeField] RectTransform m_LevelsContainer; |
| | | [SerializeField] EquipSlots m_EquipSlots; |
| | | [SerializeField] Text m_FightPoint; |
| | | [SerializeField] RawImage m_Role; |
| | |
| | | |
| | | [SerializeField] EquipSuitPropertyWidget m_SuitPropertyWidget; |
| | | [SerializeField] CandidateEquipWidget m_CandidateEquipWidget; |
| | | |
| | | List<EquipLevelSelectBehaviour> levelSelectBehaviours = new List<EquipLevelSelectBehaviour>(); |
| | | List<GameObject> emptyFillers = new List<GameObject>(); |
| | | |
| | | EquipModel model { get { return ModelCenter.Instance.GetModel<EquipModel>(); } } |
| | | |
| | |
| | | protected override void OnActived() |
| | | { |
| | | base.OnActived(); |
| | | DisplayLevels(); |
| | | DisplayDynamicInfo(true); |
| | | |
| | | ShowCandidateEquips(); |
| | | } |
| | | |
| | | protected override void LateUpdate() |
| | |
| | | if (force || model.selectedLevel.dirty) |
| | | { |
| | | var level = model.selectedLevel.Fetch(); |
| | | |
| | | DisplayEquips(level); |
| | | DisplayAppearance(level); |
| | | DisplayFightPoint(level); |
| | |
| | | } |
| | | } |
| | | |
| | | private void DisplayLevels() |
| | | { |
| | | var sets = model.GetViewableEquipSets(); |
| | | var behaviourCount = sets.Count; |
| | | var emptyCount = behaviourCount >= 5 ? 0 : 5 - behaviourCount; |
| | | var behaviourGap = behaviourCount - levelSelectBehaviours.Count; |
| | | for (var i = 0; i < behaviourGap; i++) |
| | | { |
| | | var instance = UIUtility.CreateWidget("EquipLevelSelectBehaviour", "EquipLevelSelectBehaviour"); |
| | | instance.transform.SetParentEx(m_LevelsContainer, Vector3.zero, Quaternion.identity, Vector3.one); |
| | | instance.transform.SetAsFirstSibling(); |
| | | levelSelectBehaviours.Insert(0, instance.GetComponent<EquipLevelSelectBehaviour>()); |
| | | } |
| | | |
| | | var emptyGap = emptyCount - emptyFillers.Count; |
| | | for (var i = 0; i < emptyCount; i++) |
| | | { |
| | | var instance = UIUtility.CreateWidget("EquipLevelSelectEmptyBehaviour", "EquipLevelSelectEmptyBehaviour"); |
| | | instance.transform.SetParentEx(m_LevelsContainer, Vector3.zero, Quaternion.identity, Vector3.one); |
| | | instance.transform.SetAsLastSibling(); |
| | | emptyFillers.Add(instance); |
| | | } |
| | | |
| | | for (var i = 0; i < levelSelectBehaviours.Count; i++) |
| | | { |
| | | var behaviour = levelSelectBehaviours[i]; |
| | | if (i < behaviourCount) |
| | | { |
| | | behaviour.gameObject.SetActive(true); |
| | | behaviour.Display(sets[i]); |
| | | } |
| | | else |
| | | { |
| | | behaviour.gameObject.SetActive(false); |
| | | } |
| | | } |
| | | |
| | | for (var i = 0; i < emptyFillers.Count; i++) |
| | | { |
| | | emptyFillers[i].SetActive(i < emptyCount); |
| | | } |
| | | } |
| | | |
| | | private void DisplayEquips(int level) |
| | | { |
| | | for (var i = 1; i <= 12; i++) |
| | |
| | | { |
| | | public readonly int level = 0; |
| | | Dictionary<int, int> equipStars = new Dictionary<int, int>(); |
| | | Dictionary<EquipSuitType, int> suitLevels = new Dictionary<EquipSuitType, int>(); |
| | | |
| | | public EquipSetStar(int level) |
| | | { |
| | |
| | | } |
| | | |
| | | return totalLevel; |
| | | } |
| | | |
| | | public void UpdateEquipStarLevel(int place, int level) |
| | | { |
| | | equipStars[place] = level; |
| | | } |
| | | |
| | | public int GetEquipStarLevel(int place) |
| | |
| | | return count; |
| | | } |
| | | |
| | | public void UpdateSuitLevel(EquipSuitType type, int level) |
| | | { |
| | | suitLevels[type] = level; |
| | | } |
| | | |
| | | public int GetSuitLevel(EquipSuitType type) |
| | | { |
| | | return suitLevels[type]; |
| | | var targetCount = 2; |
| | | switch (type) |
| | | { |
| | | case EquipSuitType.TwoSuit: |
| | | targetCount = 2; |
| | | break; |
| | | case EquipSuitType.FiveSuit: |
| | | targetCount = 5; |
| | | break; |
| | | case EquipSuitType.EightSuit: |
| | | targetCount = 8; |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | |
| | | var maxLevel = GetTotalStarLevel() / targetCount; |
| | | for (var i = maxLevel; i >= 0; i--) |
| | | { |
| | | if (GetEquipCountWhichStarLevelLq(i) >= targetCount) |
| | | { |
| | | return i; |
| | | } |
| | | } |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | } |
| | |
| | | TwoSuit = 2, |
| | | FiveSuit = 5, |
| | | EightSuit = 8, |
| | | } |
| | | |
| | | public struct EquipStar |
| | | { |
| | | public int level; |
| | | public int place; |
| | | public int starLevel; |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | } |
| | | |
| | | public void DoStarUpgrade(int level, int place) |
| | | public void DoStarUpgrade(int level, int place, int starLevel) |
| | | { |
| | | if (!equipStars.ContainsKey(level)) |
| | | { |
| | | return; |
| | | } |
| | | |
| | | var maxLevel = GetMaxStarLevel(level); |
| | | if (starLevel > maxLevel) |
| | | { |
| | | //已经是最大星级,无法升星 |
| | | return; |
| | | } |
| | | |
| | | var config = EquipStarConfig.Get(level, place, starLevel); |
| | | var specialMaterial = packModel.GetItemByGuid(materials[6].value); |
| | | if (config.CostItemDict.x > 0 && (specialMaterial == null || specialMaterial.config.ID != config.CostItemDict.x)) |
| | | { |
| | | //请放入正确的特殊材料 |
| | | return; |
| | | } |
| | | |
| | | var materialIndexs = new List<ushort>(); |
| | | var materialItemIds = new List<uint>(); |
| | | foreach (var material in materials.Values) |
| | | { |
| | | if (!string.IsNullOrEmpty(material.value)) |
| | | { |
| | | var item = packModel.GetItemByGuid(material.value); |
| | | materialIndexs.Add((ushort)item.itemPlace); |
| | | materialItemIds.Add((uint)item.itemId); |
| | | } |
| | | } |
| | | |
| | | if (materialIndexs.Count < (config.CostEquipCnt + config.CostItemDict.x > 0 ? 1 : 0)) |
| | | { |
| | | //材料不足 |
| | | return; |
| | | } |
| | | |
| | | var info = new CA5C5_tagCMEquipPartStarUp(); |
| | | info.EquipPackIndex = (ushort)EquipSet.ClientPlaceToServerPlace(level, place); |
| | | info.CostEquipIndex = materialIndexs.ToArray(); |
| | | info.CostEquipID = materialItemIds.ToArray(); |
| | | info.CostEquipCnt = (byte)materialIndexs.Count; |
| | | |
| | | GameNetSystem.Instance.SendInfo(info); |
| | | } |
| | | |
| | | public void FiltrateCandidateEquips(int level) |
| | |
| | | } |
| | | } |
| | | |
| | | public void UpdateSuitLevel(int level, EquipSuitType type, int starLevel) |
| | | public void UpdateStarLevels(HA3B1_tagMCEquipPartStarInfo info) |
| | | { |
| | | if (!equipStars.ContainsKey(level)) |
| | | for (var i = 0; i < info.InfoList.Length; i++) |
| | | { |
| | | return; |
| | | var clientInfo = EquipSet.ServerPlaceToClientPlace(info.InfoList[i].EquipPackIndex); |
| | | var level = clientInfo.x; |
| | | if (equipStars.ContainsKey(level)) |
| | | { |
| | | equipStars[level].UpdateEquipStarLevel(clientInfo.y, info.InfoList[i].Star); |
| | | } |
| | | } |
| | | |
| | | equipStars[level].UpdateSuitLevel(type, starLevel); |
| | | } |
| | | |
| | | public int GetSuitLevel(int level, EquipSuitType type) |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | private void StarUpgrade() |
| | | { |
| | | var equip = packModel.GetItemByGuid(model.selectedEquip.value); |
| | | model.DoStarUpgrade(equip.config.LV, equip.config.EquipPlace); |
| | | var level = equip.config.LV; |
| | | var place = equip.config.EquipPlace; |
| | | var currentStarLevel = model.GetEquipStarLevel(level, place); |
| | | model.DoStarUpgrade(level, place, currentStarLevel); |
| | | } |
| | | |
| | | [System.Serializable] |