50 【主界面】核心主体 - 装备部分掉落分解穿戴
24个文件已修改
12个文件已删除
12 文件已复制
14个文件已添加
2 文件已重命名
| | |
| | | public class OutlineEx : BaseMeshEffect |
| | | { |
| | | [Header("新shader描边")] |
| | | public Color OutlineColor = new Color(0, 0, 0, 0.5f);// Color.black; |
| | | public Color m_OutlineColor= new Color(0, 0, 0, 0.5f);// Color.black; |
| | | public Color OutlineColor |
| | | { |
| | | get { return m_OutlineColor; } |
| | | set |
| | | { |
| | | m_OutlineColor = value; |
| | | this._Refresh(); |
| | | } |
| | | } |
| | | |
| | | QualityTextColType m_ColorType = QualityTextColType.None; |
| | | public QualityTextColType colorType |
| | |
| | | { |
| | | m_ColorType = value; |
| | | OutlineColor = UIHelper.GetUIOutlineColor(value); |
| | | this._Refresh(); |
| | | } |
| | | } |
| | | } |
| | |
| | | protected EffectPenetrationBlocker blocker = null; |
| | | |
| | | protected bool isInit = false; |
| | | protected bool isPlaying = false; |
| | | |
| | | protected List<ParticleSystem> particleList = new List<ParticleSystem>(); |
| | | |
| | |
| | | { |
| | | if (spineComp != null) |
| | | { |
| | | //隐藏,会有静态显示问题 |
| | | spineComp.enabled = false; |
| | | if (!isPlaying) |
| | | { |
| | | //隐藏,会有静态显示问题 |
| | | spineComp.enabled = false; |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | effectTarget = null; |
| | | } |
| | | |
| | | if (spineComp != null) |
| | | { |
| | | spineComp.enabled = false; |
| | | } |
| | | isInit = false; |
| | | |
| | | isPlaying = false; |
| | | Clear(); |
| | | onComplete?.Invoke(); |
| | | } |
| | |
| | | if (isReleaseImmediately) |
| | | { |
| | | spineComp.enabled = false; |
| | | isPlaying = false; |
| | | Stop(); |
| | | } |
| | | } |
| | |
| | | |
| | | int playSpineAnimIndex = -1; //播放spine特效动画索引, |
| | | |
| | | |
| | | |
| | | protected override void OnEnable() |
| | | { |
| | | playSpineAnimIndex = -1; |
| | |
| | | } |
| | | else if (spineComp != null) |
| | | { |
| | | //隐藏,会有静态显示问题 |
| | | spineComp.enabled = false; |
| | | if (!isPlaying) |
| | | { |
| | | //隐藏,会有静态显示问题 |
| | | spineComp.enabled = false; |
| | | } |
| | | } |
| | | } |
| | | |
| | | public override void Play(bool showLog = true) |
| | | { |
| | | isPlaying = true; |
| | | if (!isInit) |
| | | { |
| | | InitComponent(showLog); |
| | |
| | | this.gameObject.SetActive(true); |
| | | } |
| | | if (effectConfig.isSpine != 0) |
| | | { |
| | | { |
| | | PlayerTheSpineAnim(); |
| | | } |
| | | return; |
| | |
| | | PlaySpineEffect(); |
| | | } |
| | | else |
| | | { |
| | | { |
| | | PlayerEffect(false); |
| | | } |
| | | SoundPlayer.Instance.PlayUIAudio(effectConfig.audio); |
| | |
| | | } |
| | | |
| | | async UniTask PlayAsync(bool showLog = true) |
| | | { |
| | | { |
| | | await UniTask.Delay(playDelayTime); |
| | | Play(showLog); |
| | | } |
| | |
| | | if (!isPlaySpineLoop) |
| | | { |
| | | spineComp.enabled = false; |
| | | isPlaying = false; |
| | | if (isReleaseImmediately) |
| | | { |
| | | Stop(); |
| | |
| | | return effectPlayer; |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | typeof(CTGConfig),
|
| | | typeof(DamageNumConfig),
|
| | | typeof(DirtyWordConfig),
|
| | | typeof(EquipGSParamConfig),
|
| | | typeof(FaceConfig),
|
| | | typeof(HeroLineupHaloConfig),
|
| | | typeof(HeroQualityLVConfig),
|
| | |
| | | ClearConfigDictionary<DamageNumConfig>();
|
| | | // 清空 DirtyWordConfig 字典
|
| | | ClearConfigDictionary<DirtyWordConfig>();
|
| | | // 清空 EquipGSParamConfig 字典
|
| | | ClearConfigDictionary<EquipGSParamConfig>();
|
| | | // 清空 FaceConfig 字典
|
| | | ClearConfigDictionary<FaceConfig>();
|
| | | // 清空 HeroLineupHaloConfig 字典
|
| | |
| | | }
|
| | |
|
| | | //{'17':['63','6','27'],'65':['800'],'55':['139'],'19':['1000','2600','130']}
|
| | | public static Regex userDataRegex = new Regex(@"'([0-9]+)':\[(.*?)\]", RegexOptions.Singleline);
|
| | | public static Dictionary<int, List<int>> Analysis(string val)//正则表达式的字符串分割
|
| | | {
|
| | | string s = ServerStringTrim(val);
|
| | |
| | | //}
|
| | | }
|
| | |
|
| | | public static Dictionary<int, List<int>> ParseJsonDict(string jsonStr)
|
| | | {
|
| | | if (jsonStr == "{}" || string.IsNullOrEmpty(jsonStr))
|
| | | {
|
| | | return new Dictionary<int, List<int>>();
|
| | | }
|
| | | var dict = JsonMapper.ToObject<Dictionary<string, List<int>>>(jsonStr);
|
| | | Dictionary<int, List<int>> result = new Dictionary<int, List<int>>();
|
| | |
|
| | | foreach (var item in dict)
|
| | | {
|
| | | result[int.Parse(item.Key)] = item.Value;
|
| | | }
|
| | |
|
| | | return result;
|
| | | }
|
| | |
|
| | | //json格式: {"1":1}
|
| | | public static Dictionary<int, int> ParseIntDict(string jsonStr)
|
| | | {
|
| | | if (jsonStr == "{}" || string.IsNullOrEmpty(jsonStr))
|
| | |
| | | return result;
|
| | | }
|
| | |
|
| | | //json格式: {"1":[1,2],"2":[3,4]}
|
| | | public static Dictionary<int, int[]> ParseIntArrayDict(string jsonStr)
|
| | | {
|
| | | if (jsonStr == "{}" || string.IsNullOrEmpty(jsonStr))
|
| | |
| | | return result;
|
| | | }
|
| | |
|
| | | //json格式: {"1":[[1,2],[3,4]]}
|
| | | public static Dictionary<int, int[][]> ParseIntArray2Dict(string jsonStr)
|
| | | {
|
| | | if (jsonStr == "{}" || string.IsNullOrEmpty(jsonStr))
|
| | |
| | | //--------------------------------------------------------
|
| | | // [Author]: YYL
|
| | | // [ Date ]: 2025年8月5日
|
| | | // [ Date ]: Thursday, August 14, 2025
|
| | | //--------------------------------------------------------
|
| | |
|
| | | using System.Collections.Generic;
|
| | |
| | | public string Level;
|
| | | public string MapBG;
|
| | | public int[][] DailyBootyUpperList;
|
| | | public string BootyWeightList;
|
| | |
|
| | | public override int LoadKey(string _key)
|
| | | {
|
| | |
| | | MapBG = tables[3];
|
| | |
|
| | | DailyBootyUpperList = JsonMapper.ToObject<int[][]>(tables[4].Replace("(", "[").Replace(")", "]"));
|
| | |
|
| | | BootyWeightList = tables[5];
|
| | | }
|
| | | catch (Exception exception)
|
| | | {
|
| | |
| | | using UnityEngine; |
| | | using System.Collections; |
| | | |
| | | // B4 15 主线掉落物品操作 #tagCSMainDropItemOP |
| | | |
| | | public class CB415_tagCSMainDropItemOP : GameNetPackBasic { |
| | | public byte Count; |
| | | public ushort[] IndexList; // 掉落背包中的物品格子索引列表 |
| | | public byte OPType; // 0 - 拾取非装备物品;1 - 分解;2 - 穿戴/替换; |
| | | public byte OPValue; // 操作额外指令值,由操作类型决定,如穿戴时可发送穿戴后是否自动分解 |
| | | |
| | | public CB415_tagCSMainDropItemOP () { |
| | | combineCmd = (ushort)0x03FE; |
| | | _cmd = (ushort)0xB415; |
| | | } |
| | | |
| | | public override void WriteToBytes () { |
| | | WriteBytes (Count, NetDataType.BYTE); |
| | | WriteBytes (IndexList, NetDataType.WORD, Count); |
| | | WriteBytes (OPType, NetDataType.BYTE); |
| | | WriteBytes (OPValue, NetDataType.BYTE); |
| | | } |
| | | |
| | | } |
| | | // B4 15 主线掉落物品操作 #tagCSMainDropItemOP
|
| | |
|
| | | public class CB415_tagCSMainDropItemOP : GameNetPackBasic {
|
| | | public byte Count;
|
| | | public ushort[] IndexList; // 掉落背包中的物品格子索引列表
|
| | | public byte OPType; // 0 - 拾取非装备物品;1 - 分解;2 - 穿戴/替换;
|
| | | public byte OPValue; // 操作额外指令值,由操作类型决定,如穿戴时可发送穿戴后是否自动分解
|
| | |
|
| | | public CB415_tagCSMainDropItemOP () {
|
| | | combineCmd = (ushort)0x03FE;
|
| | | _cmd = (ushort)0xB415;
|
| | | }
|
| | |
|
| | | public override void WriteToBytes () {
|
| | | WriteBytes (Count, NetDataType.BYTE);
|
| | | WriteBytes (IndexList, NetDataType.WORD, Count);
|
| | | WriteBytes (OPType, NetDataType.BYTE);
|
| | | WriteBytes (OPValue, NetDataType.BYTE);
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | public static event Action beforePlayerDataInitializeEvent;
|
| | | public static event Action afterPlayerDataInitializeEvent;
|
| | | public static event Action switchAccountEvent;
|
| | | public static bool isAfterPlayerDataInitialize = false;
|
| | | public static bool isAfterPlayerDataInitialize = false; //可以用来判断是否切号,如短暂的断线重连
|
| | | public static uint playerIdBuf = 0;
|
| | |
|
| | | public override void Done(GameNetPackBasic vNetPack)
|
New file |
| | |
| | | using UnityEngine;
|
| | | using System.Collections;
|
| | | using System;
|
| | |
|
| | | // A8 14 操作结果通知 #tagMCMakeItemAnswer
|
| | |
|
| | | public class DTCA814_tagMCMakeItemAnswer : DtcBasic {
|
| | | public static event Action<HA814_tagMCMakeItemAnswer> MakeItemAnswerEvent;
|
| | | public override void Done(GameNetPackBasic vNetPack)
|
| | | {
|
| | | base.Done(vNetPack);
|
| | | HA814_tagMCMakeItemAnswer vNetData = vNetPack as HA814_tagMCMakeItemAnswer;
|
| | | MakeItemAnswerEvent?.Invoke(vNetData);
|
| | | }
|
| | | }
|
copy from Main/Config/Configs/EquipGSParamConfig.cs.meta
copy to Main/Core/NetworkPackage/DTCFile/ServerPack/HA8_Item/DTCA814_tagMCMakeItemAnswer.cs.meta
File was copied from Main/Config/Configs/EquipGSParamConfig.cs.meta |
| | |
| | | fileFormatVersion: 2 |
| | | guid: f510c442e570ac446af81fa008cc0367 |
| | | guid: 293efa631c4a5d649acf8845f93f885c |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
New file |
| | |
| | | using UnityEngine; |
| | | using System.Collections; |
| | | |
| | | // B1 23 每日掉落战利品信息 #tagSCDropBootyInfo
|
| | |
|
| | | public class DTCB123_tagSCDropBootyInfo : DtcBasic {
|
| | | public override void Done(GameNetPackBasic vNetPack) {
|
| | | base.Done(vNetPack);
|
| | | HB123_tagSCDropBootyInfo vNetData = vNetPack as HB123_tagSCDropBootyInfo;
|
| | | }
|
| | | }
|
copy from Main/Config/Configs/EquipGSParamConfig.cs.meta
copy to Main/Core/NetworkPackage/DTCFile/ServerPack/HB1_Role/DTCB123_tagSCDropBootyInfo.cs.meta
File was copied from Main/Config/Configs/EquipGSParamConfig.cs.meta |
| | |
| | | fileFormatVersion: 2 |
| | | guid: f510c442e570ac446af81fa008cc0367 |
| | | guid: ad40b9e7061d05547a2940e6a348a2a0 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | |
| | | Register(typeof(HA207_tagSCPackBuyInfo), typeof(DTCA207_tagSCPackBuyInfo)); |
| | | Register(typeof(H0722_tagItemDeadLockRefresh), typeof(DTC0722_tagItemDeadLockRefresh)); |
| | | Register(typeof(HB125_tagSCPlayerHeroInfo), typeof(DTCB125_tagSCPlayerHeroInfo)); |
| | | Register(typeof(HA814_tagMCMakeItemAnswer), typeof(DTCA814_tagMCMakeItemAnswer)); |
| | | } |
| | | |
| | | //主工程注册封包 |
New file |
| | |
| | | using UnityEngine; |
| | | using System.Collections; |
| | | |
| | | // A8 14 操作结果通知 #tagMCMakeItemAnswer
|
| | |
|
| | | public class HA814_tagMCMakeItemAnswer : GameNetPackBasic {
|
| | | public byte MakeType; //类型 TMakeItemType
|
| | | public byte Result; //是否成功
|
| | | public uint MakeValue; //操作值,如合成时为合成的物品ID
|
| | |
|
| | | public HA814_tagMCMakeItemAnswer () {
|
| | | _cmd = (ushort)0xA814;
|
| | | }
|
| | |
|
| | | public override void ReadFromBytes (byte[] vBytes) {
|
| | | TransBytes (out MakeType, vBytes, NetDataType.BYTE);
|
| | | TransBytes (out Result, vBytes, NetDataType.BYTE);
|
| | | TransBytes (out MakeValue, vBytes, NetDataType.DWORD);
|
| | | }
|
| | |
|
| | | }
|
File was renamed from Main/Config/Configs/EquipGSParamConfig.cs.meta |
| | |
| | | fileFormatVersion: 2 |
| | | guid: f510c442e570ac446af81fa008cc0367 |
| | | guid: be88efc853cab3d46b1a28dc6461d9e3 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
New file |
| | |
| | | using UnityEngine; |
| | | using System.Collections; |
| | | |
| | | // B1 23 每日掉落战利品信息 #tagSCDropBootyInfo
|
| | |
|
| | | public class HB123_tagSCDropBootyInfo : GameNetPackBasic {
|
| | | public ushort Count;
|
| | | public tagSCDropBooty[] DropBootyList; //每日已掉落战利品信息列表
|
| | |
|
| | | public HB123_tagSCDropBootyInfo () {
|
| | | _cmd = (ushort)0xB123;
|
| | | }
|
| | |
|
| | | public override void ReadFromBytes (byte[] vBytes) {
|
| | | TransBytes (out Count, vBytes, NetDataType.WORD);
|
| | | DropBootyList = new tagSCDropBooty[Count];
|
| | | for (int i = 0; i < Count; i ++) {
|
| | | DropBootyList[i] = new tagSCDropBooty();
|
| | | TransBytes (out DropBootyList[i].ItemID, vBytes, NetDataType.DWORD);
|
| | | TransBytes (out DropBootyList[i].TodayDropCnt, vBytes, NetDataType.DWORD);
|
| | | }
|
| | | }
|
| | |
|
| | | public class tagSCDropBooty {
|
| | | public uint ItemID; // 战利品ID
|
| | | public uint TodayDropCnt; // 今日已掉落数量
|
| | | }
|
| | |
|
| | | }
|
copy from Main/Config/Configs/EquipGSParamConfig.cs.meta
copy to Main/Core/NetworkPackage/ServerPack/HB1_Role/HB123_tagSCDropBootyInfo.cs.meta
File was copied from Main/Config/Configs/EquipGSParamConfig.cs.meta |
| | |
| | | fileFormatVersion: 2 |
| | | guid: f510c442e570ac446af81fa008cc0367 |
| | | guid: 60e5d156d8d7dc14da9061d205127a85 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | |
| | |
|
| | | }
|
| | |
|
| | | public struct DungeonResult
|
| | | public class DungeonResult
|
| | | {
|
| | | public int conWinCnt; //胜利的场数
|
| | | public int extraExp; //额外的经验加成
|
| | |
| | | }
|
| | |
|
| | |
|
| | | public struct DungeonMissionData
|
| | | public class DungeonMissionData
|
| | | {
|
| | | public int lineID;
|
| | | public int missionID;
|
New file |
| | |
| | | using System;
|
| | | using UnityEngine;
|
| | | using UnityEngine.UI;
|
| | |
|
| | | //装备图标(装备位)
|
| | | public class EquipCell : MonoBehaviour
|
| | | {
|
| | | Button button;
|
| | | Image bgImage;//装备的底图,不同品质颜色
|
| | | Image bgIconImage; //空装备的部位图标
|
| | | Image iconImage; //装备图标
|
| | | UIEffectPlayer uieff;
|
| | | Text lvText;
|
| | |
|
| | | void InitComponent()
|
| | | {
|
| | | button = this.GetComponent<Button>();
|
| | | bgImage = this.GetComponent<Image>();
|
| | | bgIconImage = this.GetComponent<Image>("equipempty");
|
| | | iconImage = this.GetComponent<Image>("equipicon");
|
| | | uieff = this.GetComponent<UIEffectPlayer>("uieffect");
|
| | | lvText = this.GetComponent<Text>("lv");
|
| | | }
|
| | |
|
| | | public void Init(ItemModel equip)
|
| | | {
|
| | | if (iconImage == null)
|
| | | {
|
| | | InitComponent();
|
| | | }
|
| | |
|
| | | if (equip == null)
|
| | | {
|
| | | button?.RemoveAllListeners();
|
| | | bgImage.SetSprite("equipQuality0");
|
| | | bgIconImage?.SetActive(true);
|
| | | iconImage.SetActive(false);
|
| | | uieff?.Stop();
|
| | | if (lvText != null)
|
| | | lvText.text = string.Empty;
|
| | |
|
| | | return;
|
| | | }
|
| | |
|
| | | if (button != null)
|
| | | {
|
| | | button.AddListener(() =>
|
| | | {
|
| | | ItemTipUtility.Show(equip.guid);
|
| | | });
|
| | | }
|
| | | bgImage.SetSprite("equipQuality" + equip.config.ItemColor);
|
| | | bgIconImage?.SetActive(false);
|
| | | iconImage.SetActive(true);
|
| | | iconImage.SetOrgSprite(equip.config.IconKey);
|
| | | if (lvText != null)
|
| | | lvText.text = Language.Get("L1113", EquipModel.Instance.GetEquipLV(equip));
|
| | |
|
| | | if (uieff == null)
|
| | | { |
| | | //等美术提供装备的效果特效(需要特效图)
|
| | | // int effectID = EquipModel.Instance.equipUIEffects[Math.Min(equip.config.ItemColor, EquipModel.Instance.equipUIEffects.Length) - 1];
|
| | | // if (effectID == 0)
|
| | | // {
|
| | | // uieff.Stop();
|
| | | // }
|
| | | // else
|
| | | // {
|
| | | // uieff.effectId = effectID;
|
| | | // uieff.Play();
|
| | | // }
|
| | | }
|
| | | }
|
| | |
|
| | |
|
| | | }
|
| | |
|
| | |
|
| | |
|
copy from Main/Config/Configs/EquipGSParamConfig.cs.meta
copy to Main/System/Equip/EquipCell.cs.meta
File was copied from Main/Config/Configs/EquipGSParamConfig.cs.meta |
| | |
| | | fileFormatVersion: 2 |
| | | guid: f510c442e570ac446af81fa008cc0367 |
| | | guid: 62e3eb45ea8ccc645ba954c15c710fd8 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
New file |
| | |
| | | using System; |
| | | using System.Collections; |
| | | using System.Collections.Generic; |
| | | using Cysharp.Threading.Tasks; |
| | | |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | |
| | | //获得装备模板 |
| | | public class EquipExchangeCell : MonoBehaviour |
| | | { |
| | | [SerializeField] Image equipImage; |
| | | [SerializeField] Text itemName; |
| | | [SerializeField] Text qualityName; |
| | | [SerializeField] OutlineEx itemNameOutline; |
| | | [SerializeField] OutlineEx qualityNameOutline; |
| | | [SerializeField] Text placeName; |
| | | [SerializeField] Text lvText; |
| | | [SerializeField] Image bgFlower; //背景花纹变色 |
| | | [SerializeField] Text fightPowerNum; |
| | | [SerializeField] GameObject fightPowerGO; |
| | | [SerializeField] GameObject equipedText; |
| | | [SerializeField] List<Text> baseAttrNames; |
| | | [SerializeField] List<Text> baseAttrValues; |
| | | [SerializeField] List<Image> baseAttrStates; |
| | | [SerializeField] GameObject fightAttrGameObj; |
| | | [SerializeField] List<GameObject> fightAttrLine; |
| | | [SerializeField] List<Text> fightAttrNames; |
| | | [SerializeField] List<Text> fightAttrValues; |
| | | [SerializeField] List<Image> fightAttrStates; |
| | | [SerializeField] GameObject decomposeObject; |
| | | [SerializeField] Toggle decomposeCheck; |
| | | [SerializeField] GameObject btnsGO; |
| | | [SerializeField] Button decomposeButton; |
| | | [SerializeField] Button exchangeButton; |
| | | [SerializeField] Button putonButton; |
| | | |
| | | [SerializeField] UIEffectPlayer uieffect; |
| | | [SerializeField] RectTransform bgRect; |
| | | |
| | | int cmpResult = 0; // 装备对比结果 0相同 1更强 2更弱 |
| | | bool isToggle = true; |
| | | |
| | | void Start() |
| | | { |
| | | putonButton.AddListener(() => |
| | | { |
| | | EquipModel.Instance.SendEquipOP(new ushort[] { (ushort)EquipModel.Instance.selectFloorEquip.gridIndex }, 2); |
| | | }); |
| | | |
| | | exchangeButton.AddListener(ExchangeEquip); |
| | | decomposeButton.AddListener(DecomposeEquip); |
| | | |
| | | decomposeCheck.onValueChanged.RemoveAllListeners(); |
| | | decomposeCheck.onValueChanged.AddListener((bool isOn) => |
| | | { |
| | | isToggle = !isToggle; |
| | | }); |
| | | |
| | | } |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | /// <param name="equip">本件装备物品数据</param> |
| | | /// <param name="isNewEquip">是否新装备(即掉落背包里的装备)</param> |
| | | public void Display(ItemModel equip, bool isNewEquip) |
| | | { |
| | | var oldEquip = PackManager.Instance.GetItemByIndex(PackType.Equip, EquipModel.Instance.selectFloorEquip.config.EquipPlace - 1); |
| | | if (oldEquip == null) |
| | | cmpResult = 1; |
| | | |
| | | equipImage.SetOrgSprite(equip.config.IconKey); |
| | | itemName.text = UIHelper.AppendColor(equip.config.ItemColor, equip.config.ItemName, true, 1); |
| | | qualityName.text = UIHelper.GetQualityNameWithColor(equip.config.ItemColor, Language.Get("equipQualityFormat")); |
| | | itemNameOutline.OutlineColor = UIHelper.GetUIOutlineColor(equip.config.ItemColor); |
| | | qualityNameOutline.OutlineColor = UIHelper.GetUIOutlineColor(equip.config.ItemColor); |
| | | placeName.text = EquipModel.Instance.GetEquipPlaceName(equip.config.EquipPlace); |
| | | lvText.text = Language.Get("EquipExchangeWin7", EquipModel.Instance.GetEquipLV(equip)); |
| | | bgFlower.color = UIHelper.GetUIColor(equip.config.ItemColor); |
| | | |
| | | if (!isNewEquip) |
| | | { |
| | | equipedText.SetActive(true); |
| | | fightPowerGO.SetActive(false); |
| | | decomposeObject.SetActive(false); |
| | | btnsGO.SetActive(false); |
| | | } |
| | | else |
| | | { |
| | | equipedText.SetActive(false); |
| | | fightPowerGO.SetActive(true); |
| | | decomposeObject.SetActive(true); |
| | | btnsGO.SetActive(true); |
| | | decomposeCheck.isOn = isToggle; |
| | | |
| | | long showFightPower = FightPowerManager.Instance.GetFightPowerChange(EquipModel.Instance.selectFloorEquip); |
| | | |
| | | if (showFightPower < 0) |
| | | { |
| | | fightPowerNum.text = UIHelper.AppendColor(TextColType.Red, $"-{UIHelper.ReplaceLargeNum(showFightPower)}", false); |
| | | } |
| | | else |
| | | { |
| | | fightPowerNum.text = UIHelper.AppendColor(TextColType.Green, $"+{UIHelper.ReplaceLargeNum(showFightPower)}", false); |
| | | } |
| | | } |
| | | |
| | | var baseAttrs = EquipModel.Instance.GetEquipBaseAttrs(equip); |
| | | var baseValues = EquipModel.Instance.GetEquipBaseValues(equip); |
| | | var fightAttrs = EquipModel.Instance.GetEquipFightAttrs(equip); |
| | | var fightValues = EquipModel.Instance.GetEquipFightValues(equip); |
| | | |
| | | for (var i = 0; i < baseAttrNames.Count; i++) |
| | | { |
| | | if (i >= baseAttrs.Count) |
| | | { |
| | | baseAttrNames[i].text = ""; |
| | | baseAttrValues[i].text = ""; |
| | | } |
| | | else |
| | | { |
| | | baseAttrNames[i].text = PlayerPropertyConfig.Get(baseAttrs[i]).Name; |
| | | baseAttrValues[i].text = PlayerPropertyConfig.GetValueDescription(baseAttrs[i], baseValues[i]); |
| | | } |
| | | } |
| | | |
| | | if (fightAttrs.IsNullOrEmpty()) |
| | | { |
| | | fightAttrGameObj.SetActive(false); |
| | | } |
| | | else |
| | | { |
| | | fightAttrGameObj.SetActive(true); |
| | | for (var i = 0; i < fightAttrNames.Count; i++) |
| | | { |
| | | if (i >= fightAttrs.Count) |
| | | { |
| | | fightAttrNames[i].SetActive(false); |
| | | } |
| | | else |
| | | { |
| | | fightAttrNames[i].SetActive(true); |
| | | fightAttrNames[i].text = PlayerPropertyConfig.Get(fightAttrs[i]).Name; |
| | | fightAttrValues[i].text = PlayerPropertyConfig.GetValueDescription(fightAttrs[i], fightValues[i]); |
| | | } |
| | | } |
| | | } |
| | | |
| | | ShowAttrState(isNewEquip); |
| | | RefreshEffect(equip).Forget(); |
| | | } |
| | | |
| | | //延迟处理特效大小 |
| | | async UniTask RefreshEffect(ItemModel equip) |
| | | { |
| | | await UniTask.DelayFrame(5); |
| | | int effectID = EquipModel.Instance.equipUIEffects[Math.Min(equip.config.ItemColor, EquipModel.Instance.equipUIEffects.Length) - 1]; |
| | | if (effectID == 0) |
| | | { |
| | | uieffect.Stop(); |
| | | } |
| | | else |
| | | { |
| | | uieffect.effectId = effectID; |
| | | //计算高度缩放比例 特效显示依赖rect的排版 |
| | | uieffect.transform.localScale = new Vector3(0.98f, bgRect.rect.height / uieffect.GetComponent<RectTransform>().rect.height, 1); |
| | | uieffect.Play(); |
| | | } |
| | | } |
| | | |
| | | |
| | | //替换装备 |
| | | void ExchangeEquip() |
| | | { |
| | | //穿更弱装备 要提示 |
| | | if (cmpResult == 2 && decomposeCheck.isOn) |
| | | { |
| | | ConfirmCancel.ShowPopConfirm(Language.Get("Mail101"), |
| | | Language.Get("EquipExchangeWin4"), (bool ok) => |
| | | { |
| | | if (ok) |
| | | { |
| | | EquipModel.Instance.SendEquipOP(new ushort[] { (ushort)EquipModel.Instance.selectFloorEquip.gridIndex }, 2, decomposeCheck.isOn); |
| | | } |
| | | |
| | | }); |
| | | } |
| | | else |
| | | { |
| | | EquipModel.Instance.SendEquipOP(new ushort[] { (ushort)EquipModel.Instance.selectFloorEquip.gridIndex }, 2, decomposeCheck.isOn); |
| | | } |
| | | |
| | | } |
| | | |
| | | //分解装备 |
| | | void DecomposeEquip() |
| | | { |
| | | //分解更强装备要提示 |
| | | if (cmpResult == 1) |
| | | { |
| | | ConfirmCancel.ShowPopConfirm(Language.Get("Mail101"), |
| | | Language.Get("EquipExchangeWin5"), (bool ok) => |
| | | { |
| | | if (ok) |
| | | { |
| | | EquipModel.Instance.SendEquipOP(new ushort[] { (ushort)EquipModel.Instance.selectFloorEquip.gridIndex }, 1); |
| | | } |
| | | |
| | | }); |
| | | } |
| | | else |
| | | { |
| | | EquipModel.Instance.SendEquipOP(new ushort[] { (ushort)EquipModel.Instance.selectFloorEquip.gridIndex }, 1); |
| | | } |
| | | } |
| | | |
| | | void ShowAttrState(bool isNewEquip) |
| | | { |
| | | ItemModel oldEquip = null; |
| | | |
| | | if (isNewEquip) |
| | | { |
| | | //找对比装备 |
| | | oldEquip = PackManager.Instance.GetItemByIndex(PackType.Equip, EquipModel.Instance.selectFloorEquip.config.EquipPlace - 1); |
| | | } |
| | | |
| | | if (oldEquip == null) |
| | | { |
| | | for (int i = 0; i < baseAttrStates.Count; i++) |
| | | { |
| | | baseAttrStates[i].SetActive(false); |
| | | } |
| | | |
| | | for (int i = 0; i < fightAttrStates.Count; i++) |
| | | { |
| | | if (!isNewEquip) |
| | | { |
| | | //原装备不对比显示 |
| | | fightAttrStates[i].SetActive(false); |
| | | continue; |
| | | } |
| | | var list = EquipModel.Instance.GetEquipFightValues(EquipModel.Instance.selectFloorEquip); |
| | | if (list == null || i >= list.Count) |
| | | { |
| | | fightAttrStates[i].SetActive(false); |
| | | } |
| | | else |
| | | { |
| | | fightAttrStates[i].SetActive(true); |
| | | fightAttrStates[i].SetSprite("GiftState1"); |
| | | fightAttrStates[i].SetNativeSize(); |
| | | } |
| | | } |
| | | |
| | | return; |
| | | } |
| | | |
| | | |
| | | //基础属性 排序和个数是一致的 |
| | | for (int i = 0; i < baseAttrStates.Count; i++) |
| | | { |
| | | var list = EquipModel.Instance.GetEquipBaseValues(EquipModel.Instance.selectFloorEquip); |
| | | var list2 = EquipModel.Instance.GetEquipBaseValues(oldEquip); |
| | | if (list == null || i >= list.Count) |
| | | { |
| | | baseAttrStates[i].SetActive(false); |
| | | } |
| | | else |
| | | { |
| | | baseAttrStates[i].SetActive(true); |
| | | var value = i < list2.Count ? list2[i] : 0; |
| | | if (list[i] == value) |
| | | { |
| | | baseAttrStates[i].SetActive(false); |
| | | } |
| | | else |
| | | { |
| | | baseAttrStates[i].SetActive(true); |
| | | baseAttrStates[i].SetSprite(value == 0 ? "GiftState1" : list[i] > value ? "EquipUpIcon" : "EquipDownIcon"); |
| | | baseAttrStates[i].SetNativeSize(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | for (int i = 0; i < fightAttrStates.Count; i++) |
| | | { |
| | | //战斗属性 排序和个数不一致 根据ID进行对比 |
| | | var list = EquipModel.Instance.GetEquipFightValues(EquipModel.Instance.selectFloorEquip); |
| | | var list2 = EquipModel.Instance.GetEquipFightValues(oldEquip); |
| | | |
| | | var idList = EquipModel.Instance.GetEquipFightAttrs(EquipModel.Instance.selectFloorEquip); |
| | | var idList2 = EquipModel.Instance.GetEquipFightAttrs(oldEquip); |
| | | |
| | | if (list == null || i >= list.Count) |
| | | { |
| | | fightAttrStates[i].SetActive(false); |
| | | } |
| | | else |
| | | { |
| | | fightAttrStates[i].SetActive(true); |
| | | var value = !list2.IsNullOrEmpty() && i < list2.Count ? list2[i] : 0; |
| | | var id = !idList2.IsNullOrEmpty() && i < idList2.Count ? idList2[i] : 0; |
| | | if (idList[i] == id && list[i] == value) |
| | | { |
| | | fightAttrStates[i].SetActive(false); |
| | | } |
| | | else |
| | | { |
| | | fightAttrStates[i].SetActive(true); |
| | | if (idList[i] != id) |
| | | { |
| | | fightAttrStates[i].SetSprite("GiftState1"); |
| | | } |
| | | else |
| | | { |
| | | fightAttrStates[i].SetSprite(list[i] > value ? "EquipUpIcon" : "EquipDownIcon"); |
| | | } |
| | | fightAttrStates[i].SetNativeSize(); |
| | | |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
copy from Main/Config/Configs/EquipGSParamConfig.cs.meta
copy to Main/System/Equip/EquipExchangeCell.cs.meta
File was copied from Main/Config/Configs/EquipGSParamConfig.cs.meta |
| | |
| | | fileFormatVersion: 2 |
| | | guid: f510c442e570ac446af81fa008cc0367 |
| | | guid: d9cfe093a2a035a4ab2e4d90eac6a86a |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
New file |
| | |
| | | using Spine;
|
| | | using System;
|
| | | using System.Collections;
|
| | | using System.Collections.Generic;
|
| | |
|
| | | using UnityEngine;
|
| | | using UnityEngine.UI;
|
| | |
|
| | | //获得装备界面
|
| | | public class EquipExchangeWin : UIBase
|
| | | {
|
| | | [SerializeField] EquipExchangeCell oldEquipObj;
|
| | | [SerializeField] EquipExchangeCell newEquipObj;
|
| | |
|
| | |
|
| | |
|
| | |
|
| | | protected override void OnPreOpen()
|
| | | {
|
| | |
|
| | | // 通知主战场暂停
|
| | | BattleManager.Instance.storyBattleField.IsPause = true;
|
| | | EquipModel.Instance.OnEquipOPResultAction += OnRefreshItem;
|
| | | Display();
|
| | | // if (EquipModel.Instance.newEquipIDToGuideID.ContainsKey(EquipModel.Instance.selectFloorEquip.itemId))
|
| | | // {
|
| | | // // if (!NewBieCenter.Instance.IsGuideCompleted(EquipModel.Instance.newEquipIDToGuideID[EquipModel.Instance.selectFloorEquip.itemId]))
|
| | | // // NewBieCenter.Instance.StartNewBieGuideEx(EquipModel.Instance.newEquipIDToGuideID[EquipModel.Instance.selectFloorEquip.itemId]);
|
| | | // }
|
| | | }
|
| | |
|
| | |
|
| | |
|
| | | protected override void OnPreClose()
|
| | | {
|
| | | EquipModel.Instance.OnEquipOPResultAction -= OnRefreshItem;
|
| | | // 通知主战场
|
| | | BattleManager.Instance.storyBattleField.IsPause = false;
|
| | | }
|
| | |
|
| | |
|
| | |
|
| | |
|
| | | void Display()
|
| | | {
|
| | | EquipModel.Instance.lastShowEquipIndex = EquipModel.Instance.selectFloorEquip.config.EquipPlace - 1;
|
| | | var oldEquip = PackManager.Instance.GetItemByIndex(PackType.Equip, EquipModel.Instance.lastShowEquipIndex);
|
| | | if (oldEquip == null)
|
| | | {
|
| | | oldEquipObj.SetActive(false);
|
| | | newEquipObj.SetActive(true);
|
| | | newEquipObj.Display(EquipModel.Instance.selectFloorEquip, true);
|
| | | }
|
| | | else
|
| | | {
|
| | | oldEquipObj.SetActive(true);
|
| | | newEquipObj.SetActive(true);
|
| | | oldEquipObj.Display(oldEquip, false);
|
| | | newEquipObj.Display(EquipModel.Instance.selectFloorEquip, true);
|
| | |
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | |
|
| | | |
| | | void OnRefreshItem(bool isDone, int index)
|
| | | {
|
| | | Display();
|
| | | }
|
| | |
|
| | |
|
| | | }
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
copy from Main/Config/Configs/EquipGSParamConfig.cs.meta
copy to Main/System/Equip/EquipExchangeWin.cs.meta
File was copied from Main/Config/Configs/EquipGSParamConfig.cs.meta |
| | |
| | | fileFormatVersion: 2 |
| | | guid: f510c442e570ac446af81fa008cc0367 |
| | | guid: 6854b489b6d72ab4d894390ea8e9e08e |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | |
| | | using UnityEngine; |
| | | using System; |
| | | using LitJson; |
| | | using UnityEngine.UI; |
| | | |
| | | |
| | | public class EquipModel : GameSystemManager<EquipModel> |
| | | { |
| | | EquipSet equipSet = new EquipSet(0); |
| | | public bool waitEquipOPPack = false; |
| | | public event Action<bool, int > OnEquipOPResultAction; //是否换上了新装备且分解了 装备索引 |
| | | public event Action<List<int>, RectTransform> OnItemDropEvent; |
| | | |
| | | //用于飘动逻辑 |
| | | // public Dictionary<int, EquipOnFloorInfo> equipFloorInfo = new Dictionary<int, EquipOnFloorInfo>(); //真实背包的索引,对应地板装备的信息 |
| | | |
| | | public void OnPlayerLoginOk() |
| | | { |
| | | |
| | | } |
| | | public int[] equipUIEffectLights; //装备掉落特效 |
| | | public float[] dropEffectScales; //掉装备的动画缩放 |
| | | public Dictionary<int, int> newEquipIDToGuideID = new Dictionary<int, int>(); //装备掉落id,引导的id |
| | | public int[] equipUIEffects; //装备TIP面板特效 |
| | | public int[] equipUIGirdEffects; //装备格子特效 |
| | | public ItemModel selectFloorEquip; //选中的地板装备 |
| | | public int lastShowEquipIndex = -1; //上一次界面显示装备的索引,拾取后物品消失需记录下做表现 |
| | | public Queue<int> waitEquipOP = new Queue<int>(); //等待操作的装备,需要和UI交互确认 |
| | | |
| | | public override void Init() |
| | | { |
| | | |
| | | DTCA814_tagMCMakeItemAnswer.MakeItemAnswerEvent += OnEquipResult; |
| | | DTC0102_tagCDBPlayer.beforePlayerDataInitializeEvent += BeforePlayerDataInitialize; |
| | | EventBroadcast.Instance.AddListener<string, BattleDrops, Action>(EventName.BATTLE_DROP_ITEMS, OnDropEvent); |
| | | ParseConfig(); |
| | | } |
| | | |
| | | public override void Release() |
| | | { |
| | | DTCA814_tagMCMakeItemAnswer.MakeItemAnswerEvent -= OnEquipResult; |
| | | DTC0102_tagCDBPlayer.beforePlayerDataInitializeEvent -= BeforePlayerDataInitialize; |
| | | EventBroadcast.Instance.RemoveListener<string, BattleDrops, Action>(EventName.BATTLE_DROP_ITEMS, OnDropEvent); |
| | | } |
| | | |
| | | public Dictionary<int, int> EquipLevelFuncID = new Dictionary<int, int>(); |
| | | |
| | | |
| | | public void OnAfterPlayerDataInitialize() |
| | | void ParseConfig() |
| | | { |
| | | var config = FuncConfigConfig.Get("DropItem"); |
| | | equipUIEffectLights = JsonMapper.ToObject<int[]>(config.Numerical1); |
| | | dropEffectScales = JsonMapper.ToObject<float[]>(config.Numerical2); |
| | | newEquipIDToGuideID = ConfigParse.ParseIntDict(config.Numerical3); |
| | | |
| | | config = FuncConfigConfig.Get("EquipTip"); |
| | | equipUIEffects = JsonMapper.ToObject<int[]>(config.Numerical1); |
| | | } |
| | | |
| | | |
| | | void BeforePlayerDataInitialize() |
| | | { |
| | | //断线重连不处理 |
| | | if (DTC0102_tagCDBPlayer.isAfterPlayerDataInitialize) |
| | | return; |
| | | selectFloorEquip = null; |
| | | waitEquipOP.Clear(); |
| | | lastShowEquipIndex = -1; |
| | | } |
| | | |
| | | public static int GetItemServerEquipPlace(int itemId) |
| | | { |
| | |
| | | return -1; |
| | | } |
| | | |
| | | var serverEquipPlace = -1; |
| | | switch ((RoleEquipType)config.EquipPlace) |
| | | if (config.EquipPlace > 0 && config.EquipPlace < 13) |
| | | { |
| | | case RoleEquipType.Weapon: |
| | | case RoleEquipType.Weapon2: |
| | | case RoleEquipType.Hat: |
| | | case RoleEquipType.Clothes: |
| | | case RoleEquipType.Belt: |
| | | case RoleEquipType.Trousers: |
| | | case RoleEquipType.Shoes: |
| | | case RoleEquipType.Neck: |
| | | case RoleEquipType.FairyCan1: |
| | | case RoleEquipType.FairyCan2: |
| | | case RoleEquipType.Glove: |
| | | case RoleEquipType.Jade: |
| | | serverEquipPlace = EquipSet.ClientPlaceToServerPlace(new Int2(config.LV, config.EquipPlace)); |
| | | break; |
| | | case RoleEquipType.Wing: |
| | | case RoleEquipType.Guard: |
| | | case RoleEquipType.PeerlessWeapon1: |
| | | case RoleEquipType.PeerlessWeapon2: |
| | | serverEquipPlace = EquipSet.ClientPlaceToServerPlace(new Int2(0, config.EquipPlace)); |
| | | break; |
| | | return config.EquipPlace - 1; |
| | | } |
| | | |
| | | return serverEquipPlace; |
| | | |
| | | return -1; |
| | | } |
| | | |
| | | public int CompareToCurrent(string equipGuid) |
| | | void OnDropEvent(string guid, BattleDrops drops, Action action) |
| | | { |
| | | NotifyItemDrop(drops.dropItemPackIndex, drops.rectTransform); |
| | | action?.Invoke(); |
| | | } |
| | | |
| | | //掉落通知 |
| | | public void NotifyItemDrop(List<int> indexs, RectTransform rect) |
| | | { |
| | | var item = PackManager.Instance.GetItemByGuid(equipGuid); |
| | | // 界面不显示则立即处理 |
| | | if (!UIManager.Instance.IsOpened<HomeWin>()) |
| | | { |
| | | for (int i = 0; i < indexs.Count; i++) |
| | | { |
| | | CalcFloorEquip(indexs[i]); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | OnItemDropEvent?.Invoke(indexs, rect); |
| | | } |
| | | } |
| | | |
| | | public void CalcFloorEquip(int itemIndex) |
| | | { |
| | | if (itemIndex == -1) |
| | | return; |
| | | |
| | | var item = PackManager.Instance.GetItemByIndex(PackType.DropItem, itemIndex); |
| | | if (item == null) |
| | | return; |
| | | |
| | | //非自动模式下,筛选装备打开装备操作界面 |
| | | if (IsEquip(item)) |
| | | { |
| | | OpenEquipExchangeWin(item); |
| | | } |
| | | else |
| | | { |
| | | SendEquipOP(new ushort[] { (ushort)itemIndex }, 0); |
| | | } |
| | | } |
| | | |
| | | private void OnEquipResult(HA814_tagMCMakeItemAnswer info) |
| | | { |
| | | if (info.MakeType != (int)MakeType.EquipOP) |
| | | return; |
| | | if (info.MakeValue == 0) |
| | | return; |
| | | |
| | | waitEquipOPPack = false; |
| | | bool isDone = false; // 换上新装备且分解了旧装备 |
| | | //选中的地板装备进行处理,替换还是找下一件,检查OnEquipOPResultAction |
| | | if (selectFloorEquip != null) |
| | | { |
| | | Debug.Log("OnEquipResult selectFloorEquip ID:" + selectFloorEquip.itemId); |
| | | if (PackManager.Instance.GetItemByIndex(PackType.DropItem, selectFloorEquip.gridIndex) == null) |
| | | { |
| | | selectFloorEquip = GetSelectFloorEquip(); //删除已选择的装备 |
| | | if (info.MakeValue == 2) |
| | | isDone = true; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | selectFloorEquip = GetSelectFloorEquip(); |
| | | if (info.MakeValue == 2) |
| | | isDone = true; |
| | | } |
| | | |
| | | if (selectFloorEquip == null) |
| | | { |
| | | if (UIManager.Instance.IsOpened<EquipExchangeWin>()) |
| | | { |
| | | UIManager.Instance.CloseWindow<EquipExchangeWin>(); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if (!UIManager.Instance.IsOpened<EquipExchangeWin>()) |
| | | { |
| | | UIManager.Instance.OpenWindow<EquipExchangeWin>(); |
| | | } |
| | | } |
| | | |
| | | OnEquipOPResultAction?.Invoke(isDone, lastShowEquipIndex); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 装备操作, // 0 - 拾取非装备物品;1 - 分解;2 - 穿戴/替换 |
| | | /// </summary> |
| | | /// <param name="itemIndexList"></param> |
| | | /// <param name="opType"></param> |
| | | /// <param name="autoDecompose"></param> |
| | | public void SendEquipOP(ushort[] itemIndexList, byte opType, bool autoDecompose = false) |
| | | { |
| | | if (waitEquipOPPack) return; |
| | | |
| | | // NoteFloorEquip(itemIndexList, opType); |
| | | var pack = new CB415_tagCSMainDropItemOP(); |
| | | pack.Count = (byte)itemIndexList.Length; |
| | | pack.IndexList = itemIndexList; |
| | | pack.OPType = opType; |
| | | pack.OPValue = (byte)(autoDecompose ? 1 : 0); // 替换后是否自动分解原装备:0否1是 |
| | | |
| | | if (opType > 0) |
| | | waitEquipOPPack = true; |
| | | GameNetSystem.Instance.SendInfo(pack); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// equipFloorInfo记录地板道具的最新一次信息,用于替换和分解装备的表现 |
| | | /// </summary> |
| | | /// <param name="itemIndexList">地板道具索引</param> |
| | | /// <param name="opType"></param> |
| | | // public void NoteFloorEquip(ushort[] itemIndexList, int opType) |
| | | // { |
| | | // equipFloorInfo.Clear(); |
| | | // foreach (var girdIndex in itemIndexList) |
| | | // { |
| | | // var equip = PackManager.Instance.GetItemByIndex(PackType.DropItem, girdIndex); |
| | | // if (equip == null) continue; |
| | | // equipFloorInfo[girdIndex] = new EquipOnFloorInfo() |
| | | // { |
| | | // equipID = equip.itemId, |
| | | // posX = floorItemCellArr[girdIndex].transform.position.x, |
| | | // posY = floorItemCellArr[girdIndex].transform.position.y, |
| | | // opType = opType |
| | | // }; |
| | | // } |
| | | |
| | | // } |
| | | |
| | | public class EquipOnFloorInfo |
| | | { |
| | | public int equipID; //道具或者装备,道具分解对应不同货币,装备固定货币 |
| | | public float posX; //全局坐标 表现再转成local |
| | | public float posY; |
| | | public int opType; // 0 - 拾取非装备物品;1 - 分解;2 - 穿戴/替换; |
| | | } |
| | | |
| | | // public EquipOnFloorInfo FindExchangeEquipInfo() |
| | | // { |
| | | // foreach (var info in equipFloorInfo) |
| | | // { |
| | | // if (info.Value.opType == 2) |
| | | // return info.Value; |
| | | // } |
| | | // return new EquipOnFloorInfo(); |
| | | // } |
| | | |
| | | public bool OpenEquipExchangeWin(ItemModel equip) |
| | | { |
| | | if (equip == null) |
| | | return false; |
| | | |
| | | // if (!IsEquip(equip)) |
| | | // return false; |
| | | |
| | | waitEquipOP.Enqueue(equip.gridIndex); |
| | | //未回复装备操作结果,否则会显示旧装备 |
| | | if (waitEquipOPPack) |
| | | return false; |
| | | |
| | | // 后续补充引导或者其他情况下,不允许切换装备界面 |
| | | // if (NewBieCenter.Instance.inGuiding) |
| | | // return; |
| | | |
| | | if (UIManager.Instance.IsOpened<EquipExchangeWin>()) |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | |
| | | selectFloorEquip = GetSelectFloorEquip(); |
| | | UIManager.Instance.OpenWindow<EquipExchangeWin>(); |
| | | |
| | | return true; |
| | | |
| | | } |
| | | |
| | | |
| | | ItemModel GetSelectFloorEquip() |
| | | { |
| | | if (waitEquipOP.Count == 0) |
| | | return null; |
| | | |
| | | ItemModel item = PackManager.Instance.GetItemByIndex(PackType.DropItem, waitEquipOP.Dequeue()); |
| | | if (AutoFightModel.Instance.isAutoAttack) |
| | | { |
| | | //自动战力对比, 条件不满足的分解 |
| | | return null; |
| | | |
| | | } |
| | | |
| | | return item; |
| | | } |
| | | |
| | | |
| | | //等级 |
| | | public int GetEquipLV(ItemModel equip) |
| | | { |
| | | if (equip == null) |
| | | { |
| | | return 0; |
| | | } |
| | | |
| | | return equip.GetUseDataFirstValue(22); |
| | | } |
| | | |
| | | return equipSet.CompareToCurrent(equipGuid); |
| | | //基础属性ID列表 |
| | | public List<int> GetEquipBaseAttrs(ItemModel equip) |
| | | { |
| | | if (equip == null) |
| | | { |
| | | return new List<int>(); |
| | | } |
| | | return equip.GetUseData(21); |
| | | } |
| | | |
| | | |
| | | //基础属性值列表 |
| | | public List<int> GetEquipBaseValues(ItemModel equip) |
| | | { |
| | | if (equip == null) |
| | | { |
| | | return new List<int>(); |
| | | } |
| | | return equip.GetUseData(23); |
| | | } |
| | | |
| | | //战斗属性ID列表 |
| | | public List<int> GetEquipFightAttrs(ItemModel equip) |
| | | { |
| | | if (equip == null) |
| | | { |
| | | return new List<int>(); |
| | | } |
| | | return equip.GetUseData(17); |
| | | } |
| | | |
| | | //战斗属性值列表 |
| | | public List<int> GetEquipFightValues(ItemModel equip) |
| | | { |
| | | if (equip == null) |
| | | { |
| | | return new List<int>(); |
| | | } |
| | | return equip.GetUseData(19); |
| | | } |
| | | |
| | | |
| | | //得到装备位对应的部位名称 |
| | | public string GetEquipPlaceName(int place) |
| | | { |
| | | |
| | | return Language.Get("equipPlace" + place); |
| | | } |
| | | |
| | | //是否装备 |
| | | public bool IsEquip(ItemModel item) |
| | | { |
| | | return item.config.EquipPlace != 0; |
| | | } |
| | | |
| | | public bool IsEquip(int itemID) |
| | | { |
| | | return ItemConfig.Get(itemID).EquipPlace != 0; |
| | | } |
| | | } |
| | | |
New file |
| | |
| | | using System;
|
| | | using System.Collections.Generic;
|
| | | using Cysharp.Threading.Tasks;
|
| | | using UnityEngine;
|
| | | using UnityEngine.UI;
|
| | |
|
| | | //装备TIP界面
|
| | | public class EquipTipWin : UIBase
|
| | | {
|
| | | [SerializeField] Image equipImage;
|
| | | [SerializeField] Text itemName;
|
| | | [SerializeField] OutlineEx itemNameOutline;
|
| | | [SerializeField] Text qualityName;
|
| | | [SerializeField] OutlineEx qualityNameOutline;
|
| | | [SerializeField] Text placeName;
|
| | | [SerializeField] Text lvText;
|
| | | [SerializeField] Image bgFlower; //背景花纹变色
|
| | | [SerializeField] List<Text> baseAttrNames;
|
| | | [SerializeField] List<Text> baseAttrValues;
|
| | | [SerializeField] GameObject fightAttrGameObj;
|
| | | [SerializeField] List<GameObject> fightAttrLine;
|
| | | [SerializeField] List<Text> fightAttrNames;
|
| | | [SerializeField] List<Text> fightAttrValues;
|
| | |
|
| | | [SerializeField] UIEffectPlayer uieffect;
|
| | | [SerializeField] RectTransform bgRect;
|
| | |
|
| | | ItemModel equip;
|
| | | protected override void OnPreOpen()
|
| | | {
|
| | | equip = PackManager.Instance.GetItemByGuid(ItemTipUtility.mainTipData.guid);
|
| | | Display(equip);
|
| | | }
|
| | |
|
| | | protected override void OnOpen()
|
| | | {
|
| | | //特效显示依赖rect的排版,放在下一帧
|
| | | RefreshEffect(equip).Forget();
|
| | | }
|
| | |
|
| | | protected override void OnPreClose()
|
| | | {
|
| | | equip = null;
|
| | | }
|
| | |
|
| | | public void Display(ItemModel equip)
|
| | | {
|
| | |
|
| | | equipImage.SetOrgSprite(equip.config.IconKey);
|
| | | itemName.text = UIHelper.AppendColor(equip.config.ItemColor, equip.config.ItemName, true, 1);
|
| | | itemNameOutline.OutlineColor = UIHelper.GetUIOutlineColor(equip.config.ItemColor);
|
| | | qualityName.text = UIHelper.GetQualityNameWithColor(equip.config.ItemColor, Language.Get("equipQualityFormat"));
|
| | | qualityNameOutline.OutlineColor = UIHelper.GetUIOutlineColor(equip.config.ItemColor);
|
| | | placeName.text = EquipModel.Instance.GetEquipPlaceName(equip.config.EquipPlace);
|
| | | lvText.text = Language.Get("EquipExchangeWin7", EquipModel.Instance.GetEquipLV(equip));
|
| | | bgFlower.color = UIHelper.GetUIColor(equip.config.ItemColor);
|
| | |
|
| | |
|
| | | var baseAttrs = EquipModel.Instance.GetEquipBaseAttrs(equip);
|
| | | var baseValues = EquipModel.Instance.GetEquipBaseValues(equip);
|
| | | var fightAttrs = EquipModel.Instance.GetEquipFightAttrs(equip);
|
| | | var fightValues = EquipModel.Instance.GetEquipFightValues(equip);
|
| | |
|
| | | for (var i = 0; i < baseAttrNames.Count; i++)
|
| | | {
|
| | | if (i >= baseAttrs.Count)
|
| | | {
|
| | | baseAttrNames[i].text = "";
|
| | | baseAttrValues[i].text = "";
|
| | | }
|
| | | else
|
| | | {
|
| | | baseAttrNames[i].text = PlayerPropertyConfig.Get(baseAttrs[i]).Name;
|
| | | baseAttrValues[i].text = PlayerPropertyConfig.GetValueDescription(baseAttrs[i], baseValues[i]);
|
| | | }
|
| | | }
|
| | |
|
| | | if (fightAttrs.IsNullOrEmpty())
|
| | | {
|
| | | fightAttrGameObj.SetActive(false);
|
| | | }
|
| | | else
|
| | | {
|
| | | fightAttrGameObj.SetActive(true);
|
| | | for (var i = 0; i < fightAttrNames.Count; i++)
|
| | | {
|
| | | if (i >= fightAttrs.Count)
|
| | | {
|
| | | fightAttrNames[i].SetActive(false);
|
| | | }
|
| | | else
|
| | | {
|
| | | fightAttrNames[i].SetActive(true);
|
| | | fightAttrNames[i].text = PlayerPropertyConfig.Get(fightAttrs[i]).Name;
|
| | | fightAttrValues[i].text = PlayerPropertyConfig.GetValueDescription(fightAttrs[i], fightValues[i]);
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | //延迟处理特效大小
|
| | | async UniTask RefreshEffect(ItemModel equip)
|
| | | { |
| | | await UniTask.DelayFrame(5);
|
| | | int effectID = EquipModel.Instance.equipUIEffects[Math.Min(equip.config.ItemColor, EquipModel.Instance.equipUIEffects.Length) - 1];
|
| | | if (effectID == 0)
|
| | | {
|
| | | uieffect.Stop();
|
| | | }
|
| | | else
|
| | | {
|
| | | uieffect.effectId = effectID;
|
| | | //计算高度缩放比例 特效显示依赖rect的排版
|
| | | uieffect.transform.localScale = new Vector3(0.98f, bgRect.rect.height / uieffect.GetComponent<RectTransform>().rect.height, 1);
|
| | | uieffect.Play();
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
copy from Main/Config/Configs/EquipGSParamConfig.cs.meta
copy to Main/System/Equip/EquipTipWin.cs.meta
File was copied from Main/Config/Configs/EquipGSParamConfig.cs.meta |
| | |
| | | fileFormatVersion: 2 |
| | | guid: f510c442e570ac446af81fa008cc0367 |
| | | guid: c4548b7cf21c8394fb9dc6e8f52676ee |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
New file |
| | |
| | | using DG.Tweening;
|
| | | using System;
|
| | | using System.Linq;
|
| | | using UnityEngine;
|
| | | using UnityEngine.EventSystems;
|
| | | using UnityEngine.UI;
|
| | |
|
| | | public class FloorItemCell : MonoBehaviour, IPointerClickHandler
|
| | | {
|
| | |
|
| | | [SerializeField] Image itemImage;
|
| | | [SerializeField] UIEffectPlayer uieff;
|
| | | [SerializeField] RectTransform scaleObject; //配合品质做特效缩放
|
| | |
|
| | | int itemIndex = -1;
|
| | | bool isPlaying = false;
|
| | |
|
| | | Vector2 startPos = new Vector2(10000, 10000); //起始位置,用于重置
|
| | | /// <summary>
|
| | | /// 播放掉落物品
|
| | | /// </summary>
|
| | | /// <param name="index">掉落背包索引</param>
|
| | | /// <param name="isAnimate">是否播放掉落动画</param>
|
| | | public void Display(int index, bool isAnimate, RectTransform rect)
|
| | | {
|
| | | itemIndex = index;
|
| | | float duration = 0.5f / AutoFightModel.Instance.fightSpeed; //掉落时间
|
| | | var item = PackManager.Instance.GetItemByIndex(PackType.DropItem, index);
|
| | | if (item == null)
|
| | | {
|
| | | this.transform.SetActive(false);
|
| | | return;
|
| | | }
|
| | | itemImage.SetOrgSprite(item.config.IconKey);
|
| | | int effectID = EquipModel.Instance.equipUIEffectLights[Math.Min(item.config.ItemColor, EquipModel.Instance.equipUIEffectLights.Length) - 1];
|
| | | if (effectID == 0)
|
| | | {
|
| | | uieff.Stop();
|
| | | }
|
| | | else
|
| | | {
|
| | | uieff.effectId = effectID;
|
| | | float scale = EquipModel.Instance.dropEffectScales[Math.Min(item.config.ItemColor, EquipModel.Instance.equipUIEffectLights.Length) - 1];
|
| | | scaleObject.localScale = new Vector3(scale, scale, 1);
|
| | | uieff.Play();
|
| | | }
|
| | |
|
| | | if (rect == null)
|
| | | {
|
| | | if (startPos == new Vector2(10000, 10000))
|
| | | {
|
| | | //避免多次随机
|
| | | startPos = new Vector2(UnityEngine.Random.Range(-150, 150), UnityEngine.Random.Range(-150, 150));
|
| | | }
|
| | | }
|
| | | else
|
| | | {
|
| | | //startPos的位置进行范围随机
|
| | | startPos = new Vector2(rect.localPosition.x + UnityEngine.Random.Range(-60, 60), rect.localPosition.y + UnityEngine.Random.Range(-60, 60));
|
| | | }
|
| | | if (isAnimate)
|
| | | {
|
| | | isPlaying = true;
|
| | | //随机方向返回1或者-1
|
| | | int randDir = UnityEngine.Random.Range(0, 2) == 0 ? 1 : -1;
|
| | |
|
| | | this.transform.localPosition = startPos;
|
| | | this.transform.DOLocalPath(new Vector3[] { startPos,
|
| | | new Vector3(startPos.x + randDir * 15, startPos.y + 30f, 0),
|
| | | new Vector3(startPos.x + randDir * 35, startPos.y + UnityEngine.Random.Range(-140, -130), 0) }, duration, PathType.CatmullRom).SetEase(Ease.InOutSine).OnComplete(CompleteDrop);
|
| | | }
|
| | | else
|
| | | {
|
| | | this.transform.localPosition = startPos;
|
| | | // 手动点击或者自动模式下处理
|
| | | // EquipModel.Instance.CalcFloorEquip(itemIndex);
|
| | | // itemIndex = -1;
|
| | | }
|
| | | }
|
| | |
|
| | | public void OnPointerClick(PointerEventData eventData)
|
| | | {
|
| | | if (!isPlaying)
|
| | | CompleteDrop();
|
| | | }
|
| | |
|
| | | void CompleteDrop()
|
| | | {
|
| | | EquipModel.Instance.CalcFloorEquip(itemIndex);
|
| | | isPlaying = false;
|
| | | itemIndex = -1;
|
| | | }
|
| | |
|
| | | // void OnDisable()
|
| | | // {
|
| | | // CompleteDrop();
|
| | | // }
|
| | | }
|
| | |
|
| | |
|
| | |
|
copy from Main/Config/Configs/EquipGSParamConfig.cs.meta
copy to Main/System/Equip/FloorItemCell.cs.meta
File was copied from Main/Config/Configs/EquipGSParamConfig.cs.meta |
| | |
| | | fileFormatVersion: 2 |
| | | guid: f510c442e570ac446af81fa008cc0367 |
| | | guid: ded146761f9ff1a4888dae05204a45b8 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
New file |
| | |
| | | using Cysharp.Threading.Tasks;
|
| | | using DG.Tweening;
|
| | | using System;
|
| | | using System.Collections.Generic;
|
| | | using System.Linq;
|
| | | using UnityEngine;
|
| | | using UnityEngine.UI;
|
| | |
|
| | | public class ItemsOnFloor : MonoBehaviour
|
| | | {
|
| | | [SerializeField] RectTransform floorUI; //掉落道具显示的父类
|
| | | [SerializeField] FloorItemCell floorItemCell; //非装备显示组件
|
| | | [SerializeField] MoneyMoveByPath moneyMoveByPathCell; //掉落物金钱
|
| | |
|
| | | FloorItemCell[] floorItemCells = new FloorItemCell[20]; //包含非装备的战利品掉落
|
| | | MoneyMoveByPath[] moneyMoveByPathArr = new MoneyMoveByPath[20]; //掉落货币,金钱,经验等
|
| | |
|
| | |
|
| | | void Awake()
|
| | | {
|
| | | for (int i = 0; i < floorItemCells.Length; i++)
|
| | | {
|
| | | //将预制体实例化到界面中
|
| | | var inst = Instantiate(floorItemCell, floorUI);
|
| | | inst.gameObject.name = "floorItemCell" + i;
|
| | | inst.transform.localPosition = Vector3.zero;
|
| | | floorItemCells[i] = inst;
|
| | | }
|
| | | for (int i = 0; i < moneyMoveByPathArr.Length; i++)
|
| | | {
|
| | | var mmbpath = Instantiate(moneyMoveByPathCell, floorUI);
|
| | | mmbpath.gameObject.name = "moneyMoveByPath" + i;
|
| | | mmbpath.transform.localPosition = Vector3.zero;
|
| | | moneyMoveByPathArr[i] = mmbpath;
|
| | | }
|
| | | }
|
| | |
|
| | |
|
| | | //主界面切换模式触发
|
| | | private void OnEnable()
|
| | | {
|
| | | //主界面打开和显隐都要刷新
|
| | | Display();
|
| | | EquipModel.Instance.OnItemDropEvent += NotifyPlayItemDrop;
|
| | | PackManager.Instance.DeleteItemEvent += DeleteDropItem;
|
| | | }
|
| | |
|
| | |
|
| | | private void OnDisable()
|
| | | {
|
| | | EquipModel.Instance.OnItemDropEvent -= NotifyPlayItemDrop;
|
| | | PackManager.Instance.DeleteItemEvent -= DeleteDropItem;
|
| | |
|
| | | }
|
| | |
|
| | |
|
| | | void NotifyPlayItemDrop(List<int> itemIndexs, RectTransform rect)
|
| | | {
|
| | | Display(true, itemIndexs, rect);
|
| | | }
|
| | |
|
| | |
|
| | | void DeleteDropItem(PackType packType, string guid, int itemID, int index, int clearType)
|
| | | {
|
| | | if (packType != PackType.DropItem)
|
| | | return;
|
| | |
|
| | | floorItemCells[index].SetActive(false);
|
| | | if (clearType == 1 || index >= moneyMoveByPathArr.Length)
|
| | | {
|
| | | return;
|
| | | }
|
| | |
|
| | | if (!EquipModel.Instance.IsEquip(itemID))
|
| | | {
|
| | | return;
|
| | | }
|
| | |
|
| | | moneyMoveByPathArr[index].transform.localPosition = floorItemCells[index].transform.localPosition;
|
| | | moneyMoveByPathArr[index].SetActive(true);
|
| | | moneyMoveByPathArr[index].PlayAnimation(42, 6);
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 掉落过程的表现 界面格子组件顺序和背包格子顺序一致
|
| | | /// </summary>
|
| | | /// <param name="isAnimate"></param>
|
| | | /// <param name="showCount"></param>
|
| | | public void Display(bool isAnimate = false, List<int> indexList = null, RectTransform rect = null)
|
| | | {
|
| | | for (int i = 0; i < floorItemCells.Length; i++)
|
| | | {
|
| | | var item = floorItemCells[i];
|
| | | var equipModel = PackManager.Instance.GetItemByIndex(PackType.DropItem, i);
|
| | | if (equipModel == null)
|
| | | {
|
| | | //对空物品进行隐藏防范
|
| | | item.SetActive(false);
|
| | | continue;
|
| | | }
|
| | | if (indexList != null && !indexList.Contains(i))
|
| | | {
|
| | | //不干涉其他掉落物品
|
| | | continue;
|
| | | }
|
| | |
|
| | | item.SetActive(true);
|
| | | item.Display(i, isAnimate, rect);
|
| | | }
|
| | | }
|
| | |
|
| | |
|
| | |
|
| | | |
| | | }
|
| | |
|
| | |
|
| | |
|
copy from Main/Config/Configs/EquipGSParamConfig.cs.meta
copy to Main/System/Equip/ItemsOnFloor.cs.meta
File was copied from Main/Config/Configs/EquipGSParamConfig.cs.meta |
| | |
| | | fileFormatVersion: 2 |
| | | guid: f510c442e570ac446af81fa008cc0367 |
| | | guid: e285e681ab9565647a21421b59fdc98a |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | |
| | | public static Dictionary<int, int> MoneyDisplayModel { get; private set; } |
| | | public static int playerMaxLevel { get; private set; } |
| | | |
| | | public static Dictionary<int, string> equipPlaceNameDict { get; private set; } |
| | | public static Dictionary<int, int> moneyDisplayIds { get; private set; } |
| | | public static int expDisplayId { get; private set; } |
| | | |
| | |
| | | // wingEquipLimits = ConfigParse.GetDic<int, int>(GetInputString("WingRealmLimit", 1)); |
| | | // int i = 0; |
| | | // int[] equipPlaces = GetIntArray("EquipArea", 1); |
| | | // string[] equipPlacesNames = GetStringArray("EquipArea", 2); |
| | | // equipPlaceNameDict = new Dictionary<int, string>(); |
| | | // for (i = 0; i < equipPlaces.Length; i++) |
| | | // { |
| | | // if (!equipPlaceNameDict.ContainsKey(equipPlaces[i])) |
| | | // { |
| | | // equipPlaceNameDict.Add(equipPlaces[i], equipPlacesNames[i]); |
| | | // } |
| | | // else |
| | | // { |
| | | // Debug.LogError("EquipArea : 装备位置重复"); |
| | | // } |
| | | // } |
| | | // var _trailBossJson = LitJson.JsonMapper.ToObject(GetInputString("MuneKadoTrialBossHead", 1)); |
| | | // trailBossHeadIcons = new Dictionary<int, string>(); |
| | | // foreach (var _key in _trailBossJson.Keys) |
| | |
| | | } |
| | | } |
| | | |
| | | void DeleteHero(PackType packType, string guid) |
| | | void DeleteHero(PackType packType, string guid, int itemID, int index, int clearType) |
| | | { |
| | | if (packType == PackType.Hero) |
| | | { |
| | |
| | | switch (packType) |
| | | { |
| | | case PackType.Equip: |
| | | // mainTipData = CreateNormalEquipData(guid, operatable); |
| | | mainTipData = new TipData() { guid = guid }; |
| | | break; |
| | | default: |
| | | // if (item.isAuction) |
| | |
| | | |
| | | switch (tipType) |
| | | { |
| | | // case TipType.Equip: |
| | | // WindowCenter.Instance.Open<EquipTipWin>(); |
| | | // break; |
| | | case TipType.Equip: |
| | | UIManager.Instance.OpenWindow<EquipTipWin>(); |
| | | break; |
| | | // case TipType.PetMount: |
| | | // WindowCenter.Instance.Open<PetMountTipWin>(); |
| | | // break; |
| | |
| | | |
| | | |
| | | |
| | | // static TipData CreateNormalEquipData(string guid, bool operatable) |
| | | // static TipData CreateNormalEquipData(string guid) |
| | | // { |
| | | // var item = packModel.GetItemByGuid(guid); |
| | | // var item = PackManager.Instance.GetItemByGuid(guid); |
| | | // if (item == null) |
| | | // { |
| | | // return default(TipData); |
| | |
| | | isAuction = item.isAuction, |
| | | isEquiped = isEquiped, |
| | | isPreview = false, |
| | | score = item.score, |
| | | isOverdue = ItemLogicUtility.Instance.IsOverdue(guid), |
| | | auctionSurplusTime = item.isAuction ? item.auctionSurplusTime : 0, |
| | | overdueSurplusTime = item.overdueSurplusTime, |
| | |
| | | void OnBeforePlayerDataInitialize()
|
| | | {
|
| | | isPackResetOk = true;
|
| | | ClearSortedBetterEquip();
|
| | | }
|
| | |
|
| | | #region 计算装备评分
|
| | |
| | |
|
| | | }
|
| | |
|
| | | public int GetEquipScore(int itemId, Dictionary<int, List<int>> useDataDic = null, bool isPreview = false)
|
| | | {
|
| | | var config = ItemConfig.Get(itemId);
|
| | | if (config == null) return 0;
|
| | | if (config.EquipPlace == 0)
|
| | | {
|
| | | return 0;
|
| | | }
|
| | |
|
| | | var properties = new EquipSorceProperties();
|
| | |
|
| | | if (IsCustomItem(itemId))
|
| | | {
|
| | | properties.AddBaseProperties(config.EffectValueA1, equipBaseProperties);
|
| | | properties.AddCustomProperties(itemId);
|
| | | return CalculateEquipScore(config.EffectValueA1, properties);
|
| | | }
|
| | |
|
| | | properties.AddBaseProperties(itemId, equipBaseProperties);
|
| | |
|
| | |
|
| | | if (useDataDic != null)
|
| | | {
|
| | | if (useDataDic.ContainsKey((int)ItemUseDataKey.legendAttrID))
|
| | | {
|
| | | properties.AddRange(useDataDic[(int)ItemUseDataKey.legendAttrID], useDataDic[(int)ItemUseDataKey.legendAttrValue]);
|
| | | }
|
| | |
|
| | | if (useDataDic.ContainsKey((int)ItemUseDataKey.outOfPrintAttrID))
|
| | | {
|
| | | properties.AddRange(useDataDic[(int)ItemUseDataKey.outOfPrintAttrID], useDataDic[(int)ItemUseDataKey.outOfPrintAttrValue]);
|
| | | }
|
| | | }
|
| | |
|
| | | return CalculateEquipScore(itemId, properties, useDataDic);
|
| | | }
|
| | | |
| | |
|
| | | // private Dictionary<int, int> GetEquipLegendProperties(int itemId)
|
| | | // {
|
| | |
| | | /// <param name="itemId"></param>
|
| | | /// <returns></returns>
|
| | | private Dictionary<PropertyType, float> curEquipAttrDict = new Dictionary<PropertyType, float>(); //存储当前装备属性对应的数值 key 属性 value 属性值
|
| | | private int CalculateEquipScore(int itemId, EquipSorceProperties properties, Dictionary<int, List<int>> useDataDic = null)
|
| | | private void CalculateEquipAttr(int itemId, EquipSorceProperties properties)
|
| | | {
|
| | | var config = ItemConfig.Get(itemId);
|
| | | if (config == null || !GeneralDefine.CompareEquipPlaces.Contains(config.EquipPlace))
|
| | | {
|
| | | return 0;
|
| | | }
|
| | |
|
| | | //properties.AddRange(GetEquipShenProperties(itemId));
|
| | |
|
| | | var minAttack = properties.ContainsKey((int)PropertyType.MinAtk) ? properties[(int)PropertyType.MinAtk] : 0;
|
| | | var maxAttack = properties.ContainsKey((int)PropertyType.MaxAtk) ? properties[(int)PropertyType.MaxAtk] : 0;
|
| | |
| | | properties[(int)PropertyType.MinAtk] = minAttack + attack;
|
| | | properties[(int)PropertyType.MaxAtk] = maxAttack + attack;
|
| | |
|
| | | Equation.Instance.Clear();
|
| | | curEquipAttrDict.Clear();
|
| | |
|
| | | var GSProValueDict = EquipGSParamConfig.GetTagGsProValueDict(config.LV, config.ItemColor, config.SuiteiD > 0 ? 1 : 0, config.StarLevel);
|
| | | foreach (var key in properties.Keys)
|
| | | {
|
| | | var attrType = (PropertyType)key;
|
| | |
| | | curEquipAttrDict.Add(attrType, properties[key]);
|
| | | break;
|
| | | default:
|
| | | if (GSProValueDict != null && GSProValueDict.ContainsKey(attrType))
|
| | | {
|
| | | var curProValue = properties[key] * GSProValueDict[attrType];
|
| | | curEquipAttrDict.Add(attrType, curProValue);
|
| | | }
|
| | | else
|
| | | {
|
| | | curEquipAttrDict.Add(attrType, properties[key]);
|
| | | }
|
| | | curEquipAttrDict.Add(attrType, properties[key]);
|
| | | break;
|
| | | }
|
| | | }
|
| | |
|
| | | foreach (var key in curEquipAttrDict.Keys)
|
| | | {
|
| | | var propertyConfig = PlayerPropertyConfig.Get((int)key);
|
| | | if (propertyConfig != null)
|
| | | {
|
| | | Equation.Instance.AddKeyValue(propertyConfig.Parameter, curEquipAttrDict[key]);
|
| | | }
|
| | | }
|
| | |
|
| | | var skillScore = 0;
|
| | | if (useDataDic != null && useDataDic.ContainsKey((int)ItemUseDataKey.equipSkills))
|
| | | {
|
| | | for (int i = 0; i < useDataDic[(int)ItemUseDataKey.equipSkills].Count; i++)
|
| | | {
|
| | | skillScore += equipSkillScores[useDataDic[(int)ItemUseDataKey.equipSkills][i]];
|
| | | }
|
| | | }
|
| | | else
|
| | | {
|
| | |
|
| | | if (config.AddSkill1 != 0 && equipSkillScores.ContainsKey(config.AddSkill1))
|
| | | {
|
| | | skillScore += equipSkillScores[config.AddSkill1];
|
| | | }
|
| | |
|
| | | if (config.AddSkill2 != 0 && equipSkillScores.ContainsKey(config.AddSkill2))
|
| | | {
|
| | | skillScore += equipSkillScores[config.AddSkill2];
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | |
|
| | | return skillScore + Equation.Instance.Eval<int>(normalGSFormula);
|
| | | |
| | | }
|
| | |
|
| | | #endregion
|
| | |
| | | // }
|
| | | #endregion
|
| | |
|
| | | #region 背包整理后好的同类型最好的装备
|
| | | Dictionary<int, Dictionary<int, ItemModel>> itemModelDict = new Dictionary<int, Dictionary<int, ItemModel>>(); // key1 装备位置索引 key2 背包位置索引
|
| | |
|
| | | public void ClearSortedBetterEquip()
|
| | | {
|
| | | itemModelDict.Clear();
|
| | | }
|
| | |
|
| | | public void SetBagSortBetterEquipList(ItemModel itemModel)
|
| | | {
|
| | | if (itemModel == null || itemModel.packType != PackType.Item) return;
|
| | |
|
| | | if (!IsCanPutOn(itemModel)) return;
|
| | |
|
| | | int equipPlace = itemModel.config.EquipPlace;
|
| | | if (!itemModelDict.ContainsKey(equipPlace))
|
| | | {
|
| | | var dict = new Dictionary<int, ItemModel>();
|
| | | if (IsFightUp(itemModel.itemId, itemModel.score) == 1)
|
| | | {
|
| | | dict.Add(itemModel.gridIndex, itemModel);
|
| | | itemModelDict.Add(equipPlace, dict);
|
| | | }
|
| | | }
|
| | | else
|
| | | {
|
| | | if (IsFightUp(itemModel.itemId, itemModel.score) == 1)
|
| | | {
|
| | | itemModelDict[equipPlace].Add(itemModel.gridIndex, itemModel);
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | public ItemModel GetBagSortBetterEquip(int equipPlace, int index)
|
| | | {
|
| | | ItemModel itemModel = null;
|
| | | if (itemModelDict.ContainsKey(equipPlace))
|
| | | {
|
| | | itemModelDict[equipPlace].TryGetValue(index, out itemModel);
|
| | | }
|
| | | return itemModel;
|
| | | }
|
| | | |
| | |
|
| | | bool IsCanPutOn(ItemModel item)
|
| | | {
|
| | |
| | | return true;
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region 得到物品的品质颜色
|
| | | private Dictionary<int, int> wingRefineQualityDict;
|
| | |
| | |
|
| | | public ItemConfig config { get; private set; }
|
| | | public ItemInfo itemInfo { get; private set; }
|
| | | public int score { get; private set; }
|
| | | private int score;
|
| | | public Dictionary<int, List<int>> useDataDict { get; private set; }
|
| | |
|
| | | public string guid { get { return itemInfo == null ? string.Empty : itemInfo.guid; } }
|
| | |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | |
| | | public class SinglePack |
| | | { |
| | |
| | | return count; |
| | | } |
| | | |
| | | public List<ItemModel> GetItems() |
| | | { |
| | | return items.Values.ToList(); |
| | | } |
| | | |
| | | public List<ItemModel> GetItems(FilterParams filterParams) |
| | | { |
| | | var list = new List<ItemModel>(); |
| | |
| | | itemIDs.Clear(); |
| | | } |
| | | |
| | | public struct FilterParams |
| | | public class FilterParams |
| | | { |
| | | public List<int> levels; |
| | | public List<int> qualitys; |
| | |
| | | public virtual void Init(ItemModel model, bool isCompare = false)
|
| | | {
|
| | | itemId = model.itemId;
|
| | | InitUI(model.guid, model.itemId, (ulong)model.count, model.score, model.isAuction, model.packType, isCompare, model.useDataDict);
|
| | | InitUI(model.guid, model.itemId, (ulong)model.count, model.isAuction, model.packType, isCompare, model.useDataDict);
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | |
| | | public virtual void Init(ItemCellModel model)
|
| | | {
|
| | | itemId = model.itemId;
|
| | | InitUI(model.guid, model.itemId, model.count, model.score, false, model.packType, model.isCompare, model.useDataDic);
|
| | | InitUI(model.guid, model.itemId, model.count, false, model.packType, model.isCompare, model.useDataDic);
|
| | | }
|
| | |
|
| | | private void InitUI(string guid, int itemId, ulong count, int score, bool isAuction, PackType type, bool isCompare, Dictionary<int, List<int>> useDataDic)
|
| | | private void InitUI(string guid, int itemId, ulong count, bool isAuction, PackType type, bool isCompare, Dictionary<int, List<int>> useDataDic)
|
| | | {
|
| | | var config = ItemConfig.Get(itemId);
|
| | | if (config == null) return;
|
| | |
| | | return 99;
|
| | | }
|
| | |
|
| | | if (ItemLogicUtility.Instance.IsRealmEquip(itemId))
|
| | | {
|
| | | return EquipModel.Instance.CompareToCurrent(guid);
|
| | | }
|
| | | else
|
| | | // if (ItemLogicUtility.Instance.IsRealmEquip(itemId))
|
| | | // {
|
| | | // return EquipModel.Instance.CompareToCurrent(guid);
|
| | | // }
|
| | | // else
|
| | | {
|
| | | return 0;
|
| | | }
|
| | |
| | | public event Action<PackType, string, bool> ChangeItemEvent; // 背包类型,GUID,是否创建 |
| | | |
| | | //删除物品,可能批量删除注意效率 |
| | | public event Action<PackType, string> DeleteItemEvent; // 背包类型,GUID |
| | | public event Action<PackType, string, int, int, int> DeleteItemEvent; // 背包类型,GUID, 物品ID,索引, 删除原因 |
| | | |
| | | // 单物品刷新 在得到新物品、物品数量的改变,清理该物品时均会触发 ; 但0725整个背包刷新不触发,如果有需要单独数量刷新事件另外处理 |
| | | // 触发比较频繁,界面使用时可以做个汇总后延迟刷新 |
| | |
| | | public event Action<int> refreshItemDayUseCountEvent; //刷新物品每日使用数量 |
| | | public event Action<int> refreshItemSumUseCountEvent; //刷新物品总使用数量 |
| | | public event Action<PackType, string, bool> RefreshItemLockEvent; //物品锁定刷新 背包类型,guid,锁定状态 |
| | | |
| | | public bool isPlayBetterEquipEffect { get; set; } //整理背包时是否播放特效 |
| | | |
| | | |
| | | private Dictionary<PackType, SinglePack> playerPackDict = new Dictionary<PackType, SinglePack>(); |
| | |
| | | itemSumUseCntDict.Clear(); |
| | | itemGUIDDict.Clear(); |
| | | PackGirdServerBuyCountDict.Clear(); |
| | | isPlayBetterEquipEffect = false; |
| | | } |
| | | |
| | | |
| | |
| | | playerPackDict.Add(packType, new SinglePack(packType)); |
| | | } |
| | | |
| | | if (isPlayBetterEquipEffect) |
| | | { |
| | | ItemLogicUtility.Instance.ClearSortedBetterEquip(); |
| | | } |
| | | |
| | | for (int i = 0; i < packInfo.ItemCount; i++) |
| | | { |
| | |
| | | var item = playerPackDict[packType].UpdateItem(itemInfo); |
| | | AddItemGUIDDict(item, true); |
| | | |
| | | if (isPlayBetterEquipEffect) |
| | | { |
| | | ItemLogicUtility.Instance.SetBagSortBetterEquipList(GetItemByGuid(itemInfo.guid)); |
| | | } |
| | | |
| | | } |
| | | |
| | | if (refrechPackEvent != null) |
| | |
| | | |
| | | public void UpdateItem(H0704_tagRolePackRefresh serverItem) |
| | | { |
| | | isPlayBetterEquipEffect = false; |
| | | SetLookIndex(null); |
| | | PackType type = (PackType)serverItem.PackType; |
| | | if (!playerPackDict.ContainsKey(type)) |
| | |
| | | public void RefreshItemCount(H0707_tagItemCountRefresh refresh) |
| | | { |
| | | SetLookIndex(null); |
| | | isPlayBetterEquipEffect = false; |
| | | PackType type = (PackType)refresh.PackType; |
| | | SinglePack singlePack = null; |
| | | playerPackDict.TryGetValue(type, out singlePack); |
| | |
| | | |
| | | public void RemoveItem(H0709_tagClearItem clearItem) |
| | | { |
| | | isPlayBetterEquipEffect = false; |
| | | SetLookIndex(null); |
| | | PackType type = (PackType)clearItem.PackType; |
| | | |
| | |
| | | guid = itemModel.guid; |
| | | int itemId = itemModel.itemId; |
| | | |
| | | DeleteItemDictByGUID(type, itemModel.guid); |
| | | |
| | | singlePack.RemoveItem(clearItem.ItemIndex); |
| | | DeleteItemDictByGUID(type, itemModel.guid,itemId, clearItem.ItemIndex, clearItem.ClearType); |
| | | |
| | | if (RefreshItemEvent != null) |
| | | { |
| | | RefreshItemEvent(type, clearItem.ItemIndex, itemId); |
| | |
| | | |
| | | public void UseItemSuccess(H0706_tagUseItemSuccess success) |
| | | { |
| | | isPlayBetterEquipEffect = false; |
| | | SetLookIndex(null); |
| | | if (success.PlayerID != PlayerDatas.Instance.baseData.PlayerID) |
| | | { |
| | |
| | | ChangeItemEvent?.Invoke(itemModel.packType, itemModel.guid, showNewItem); |
| | | } |
| | | |
| | | void DeleteItemDictByGUID(PackType type, string guid) |
| | | void DeleteItemDictByGUID(PackType type, string guid, int itemID = 0, int index = 0, int clearType = -1) |
| | | { |
| | | if (itemGUIDDict.ContainsKey(guid)) |
| | | { |
| | | if (itemGUIDDict[guid].packType == type) |
| | | { |
| | | itemGUIDDict.Remove(guid); |
| | | DeleteItemEvent?.Invoke(type, guid); |
| | | DeleteItemEvent?.Invoke(type, guid, itemID, index, clearType); |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | public List<ItemModel> GetItems(PackType packType) |
| | | { |
| | | if (playerPackDict.ContainsKey(packType)) |
| | | { |
| | | return playerPackDict[packType].GetItems(); |
| | | } |
| | | else |
| | | { |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | //通过id找物品,注意检查是否指定背包 |
| | | public string GetItemGUIDByID(int itemId, bool includeAuction = true, PackType packType = PackType.Item) |
| | | { |
New file |
| | |
| | | using System; |
| | | using System.Collections; |
| | | using System.Collections.Generic; |
| | | using System.Text; |
| | | |
| | | using UnityEngine; |
| | | public class AutoFightModel : GameSystemManager<AutoFightModel> |
| | | { |
| | | public int fightSpeed = 1; //战斗倍数:值越大越快,影响战斗表现,掉落速度等 |
| | | |
| | | public bool isAutoAttack; //自动攻击 |
| | | public override void Init() |
| | | { |
| | | |
| | | } |
| | | |
| | | public override void Release() |
| | | { |
| | | |
| | | } |
| | | |
| | | void ParseConfig() |
| | | { |
| | | } |
| | | |
| | | } |
copy from Main/Config/Configs/EquipGSParamConfig.cs.meta
copy to Main/System/Main/AutoFightModel.cs.meta
File was copied from Main/Config/Configs/EquipGSParamConfig.cs.meta |
| | |
| | | fileFormatVersion: 2 |
| | | guid: f510c442e570ac446af81fa008cc0367 |
| | | guid: ba186d3dcc7ee6144b80ba4a293e11de |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
New file |
| | |
| | | using UnityEngine;
|
| | |
|
| | | using DG.Tweening;
|
| | | using Cysharp.Threading.Tasks;
|
| | |
|
| | |
|
| | | public class EquipOnMainUI : MonoBehaviour
|
| | | {
|
| | |
|
| | | [SerializeField] RectTransform[] slotEquips; //装备格子
|
| | | [SerializeField] RectTransform[] flyEquips;
|
| | | [SerializeField] RectTransform flyStartPos;
|
| | |
|
| | |
|
| | | EquipCell[] m_EquipSlots;
|
| | | EquipCell[] m_EquipFlySlots;
|
| | |
|
| | | void Awake()
|
| | | {
|
| | | if (m_EquipSlots == null)
|
| | | {
|
| | | m_EquipSlots = new EquipCell[slotEquips.Length];
|
| | | for (int i = 0; i < slotEquips.Length; i++)
|
| | | {
|
| | | m_EquipSlots[i] = slotEquips[i].GetComponent<EquipCell>();
|
| | | }
|
| | | }
|
| | |
|
| | | if (m_EquipFlySlots == null)
|
| | | {
|
| | | m_EquipFlySlots = new EquipCell[flyEquips.Length];
|
| | | for (int i = 0; i < flyEquips.Length; i++)
|
| | | {
|
| | | m_EquipFlySlots[i] = flyEquips[i].GetComponent<EquipCell>();
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | //主界面切换模式触发
|
| | | private void OnEnable()
|
| | | {
|
| | |
|
| | | PackManager.Instance.refrechPackEvent += OnRefrechPackEvent;
|
| | | //packModel.refreshItemCountEvent += PackModel_refreshItemCountEvent;
|
| | | EquipModel.Instance.OnEquipOPResultAction += OnEquipResult;
|
| | | DisplaySlotEquip();
|
| | | for (int i = 0; i < flyEquips.Length; i++)
|
| | | {
|
| | | flyEquips[i].SetActive(false);
|
| | | }
|
| | | }
|
| | |
|
| | |
|
| | | private void OnDisable()
|
| | | {
|
| | | PackManager.Instance.refrechPackEvent -= OnRefrechPackEvent;
|
| | | //packModel.refreshItemCountEvent -= PackModel_refreshItemCountEvent;
|
| | | EquipModel.Instance.OnEquipOPResultAction -= OnEquipResult;
|
| | | }
|
| | |
|
| | |
|
| | |
|
| | |
|
| | | void OnRefrechPackEvent(PackType type)
|
| | | {
|
| | | if (type == PackType.Equip)
|
| | | {
|
| | | DisplaySlotEquip();
|
| | | }
|
| | | }
|
| | |
|
| | |
|
| | |
|
| | | private void OnEquipResult(bool isDone, int index)
|
| | | {
|
| | | //穿戴或者 替换且分解成功,才做飘的表现,未分解的不做表现
|
| | | if (!isDone)
|
| | | {
|
| | | return;
|
| | | }
|
| | | FlyToEquipGird(index);
|
| | | }
|
| | |
|
| | |
|
| | |
|
| | | //显示装备格子
|
| | | void DisplaySlotEquip()
|
| | | {
|
| | | for (int i = 0; i < slotEquips.Length; i++)
|
| | | {
|
| | | var equipItem = PackManager.Instance.GetItemByIndex(PackType.Equip, i);
|
| | | m_EquipSlots[i].Init(equipItem);
|
| | | }
|
| | | }
|
| | |
|
| | | void FlyToEquipGird(int equipIndex)
|
| | | {
|
| | | var equipInfo = PackManager.Instance.GetItemByIndex(PackType.Equip, equipIndex);
|
| | | var flyEquip = m_EquipFlySlots[equipIndex];
|
| | | if (equipInfo == null)
|
| | | {
|
| | | flyEquip.SetActive(false);
|
| | | return;
|
| | | }
|
| | | int itemID = equipInfo.config.ID;
|
| | | flyEquip.Init(equipInfo);
|
| | | flyEquip.SetActive(true);
|
| | |
|
| | | flyEquip.transform.localPosition = new Vector3(flyStartPos.localPosition.x + Random.Range(-80, 80), flyStartPos.localPosition.y + Random.Range(-20, 20), 0);
|
| | | FlyToEquipCell(flyEquip, equipIndex, equipInfo).Forget();
|
| | |
|
| | |
|
| | | }
|
| | |
|
| | | async UniTask FlyToEquipCell(EquipCell flyEquip, int equipIndex, ItemModel equipInfo)
|
| | | {
|
| | | //等待界面关闭后,才处理后续逻辑
|
| | | while (UIManager.Instance.IsOpened<EquipExchangeWin>())
|
| | | {
|
| | | await UniTask.Yield();
|
| | | }
|
| | |
|
| | |
|
| | | flyEquip.transform.DOMove(new Vector3(slotEquips[equipIndex].position.x, slotEquips[equipIndex].position.y, 0), 0.5f).OnComplete(() =>
|
| | | {
|
| | | flyEquip.SetActive(false);
|
| | |
|
| | | slotEquips[equipIndex].SetActive(true);
|
| | | m_EquipSlots[equipIndex].Init(equipInfo);
|
| | |
|
| | | //itemCell变大再变回1倍
|
| | | slotEquips[equipIndex].transform.DOScale(Vector3.one * 1.3f, 0.3f).OnComplete(() =>
|
| | | {
|
| | | slotEquips[equipIndex].transform.DOScale(Vector3.one, 0.3f);
|
| | | });
|
| | | });
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
copy from Main/Config/Configs/EquipGSParamConfig.cs.meta
copy to Main/System/Main/EquipOnMainUI.cs.meta
File was copied from Main/Config/Configs/EquipGSParamConfig.cs.meta |
| | |
| | | fileFormatVersion: 2 |
| | | guid: f510c442e570ac446af81fa008cc0367 |
| | | guid: 9e81838537ed3f3438cb3559673725f8 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
New file |
| | |
| | | using System.Collections; |
| | | using System.Collections.Generic; |
| | | using UnityEngine; |
| | | |
| | | |
| | | public class FightPowerManager : Singleton<FightPowerManager> |
| | | { |
| | | string propertyFormula; |
| | | |
| | | public FightPowerManager() |
| | | { |
| | | var config = FuncConfigConfig.Get("HeroAttrFormula"); |
| | | propertyFormula = config.Numerical1; |
| | | } |
| | | |
| | | |
| | | //装备战力为最终总战力的结果比(提升整个角色总战力) |
| | | public int CalculatePower(int level) |
| | | { |
| | | // Equation.Instance.Clear(); |
| | | // Equation.Instance.AddKeyValue("equipScoreTotal", CountEquipScore(level)); |
| | | // var power = Equation.Instance.Eval<int>(scoreFormula); |
| | | |
| | | // var propertyContainer = new Properties(); |
| | | |
| | | // Equation.Instance.Clear(); |
| | | // var keys = propertyContainer.keys; |
| | | // for (int i = 0; i < keys.Count; i++) |
| | | // { |
| | | // var id = keys[i]; |
| | | // var value = propertyContainer[id]; |
| | | // var config = PlayerPropertyConfig.Get(id); |
| | | // Equation.Instance.AddKeyValue(config.Parameter, value); |
| | | // } |
| | | |
| | | // var propertyPower = Equation.Instance.Eval<int>(propertyFormula); |
| | | // power += propertyPower; |
| | | |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | //和身上装备对比 |
| | | public long GetFightPowerChange(ItemModel item) |
| | | { |
| | | return 0; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | class Properties |
| | | { |
| | | Dictionary<int, int> tables = new Dictionary<int, int>(); |
| | | |
| | | public List<int> keys { get { return new List<int>(tables.Keys); } } |
| | | |
| | | public int this[int id] { get { return tables[id]; } } |
| | | |
| | | public void Add(int id, int value) |
| | | { |
| | | if (id == 7) |
| | | { |
| | | Add(67, value); |
| | | Add(68, value); |
| | | } |
| | | else |
| | | { |
| | | if (tables.ContainsKey(id)) |
| | | { |
| | | tables[id] = tables[id] + value; |
| | | } |
| | | else |
| | | { |
| | | tables[id] = value; |
| | | } |
| | | } |
| | | } |
| | | |
| | | public void AddRange(List<int> ids, List<int> values) |
| | | { |
| | | if (ids.IsNullOrEmpty() || values.IsNullOrEmpty()) |
| | | { |
| | | return; |
| | | } |
| | | |
| | | var count = Mathf.Min(ids.Count, values.Count); |
| | | for (int i = 0; i < count; i++) |
| | | { |
| | | Add(ids[i], values[i]); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | #region 计算战斗力 |
| | | public static readonly string FightPowerFormula = "FightpowerFormula"; |
| | | |
| | | // public static int GetFightPower(Dictionary<int, int> _propertyDict) |
| | | // { |
| | | // Equation.Instance.Clear(); |
| | | // if (_propertyDict == null || _propertyDict.Count == 0) |
| | | // { |
| | | // return 0; |
| | | // } |
| | | |
| | | // foreach (var _key in _propertyDict.Keys) |
| | | // { |
| | | // PlayerPropertyConfig cfg = PlayerPropertyConfig.Get(_key); |
| | | // if (cfg != null) |
| | | // { |
| | | // if (_key == 7) |
| | | // { |
| | | // Equation.Instance.AddKeyValue("MinAtk", _propertyDict[_key]); |
| | | // Equation.Instance.AddKeyValue("MaxAtk", _propertyDict[_key]); |
| | | // } |
| | | // else if (_key == 24) |
| | | // { |
| | | // Equation.Instance.AddKeyValue("PetMinAtk", _propertyDict[_key]); |
| | | // Equation.Instance.AddKeyValue("PetMaxAtk", _propertyDict[_key]); |
| | | // } |
| | | // else |
| | | // { |
| | | // ulong attrValue = (ulong)_propertyDict[_key]; |
| | | // var fightParm = GetFightPowerParmByAttrId(_key); |
| | | // if (_key == 11) |
| | | // { |
| | | // var playerLv = PlayerDatas.Instance.baseData.LV; |
| | | // var paramConfig = FightPowerParamConfig.Get(playerLv); |
| | | // Equation.Instance.AddKeyValue("AtkSpeedParameter", paramConfig.AtkSpeedParameter); |
| | | // } |
| | | // else |
| | | // { |
| | | // if (fightParm != 0) |
| | | // { |
| | | // attrValue = attrValue * (ulong)fightParm; |
| | | // } |
| | | // } |
| | | // Equation.Instance.AddKeyValue(cfg.Parameter, attrValue); |
| | | // } |
| | | // } |
| | | |
| | | // } |
| | | // FuncConfigConfig funcCfg = FuncConfigConfig.Get(FightPowerFormula); |
| | | // return Equation.Instance.Eval<int>(funcCfg.Numerical1); |
| | | // } |
| | | |
| | | // public static int GetFightPowerParmByAttrId(int attrId) |
| | | // { |
| | | // int playerLv = PlayerDatas.Instance.baseData.LV; |
| | | // FightPowerParamConfig paramConfig = FightPowerParamConfig.Get(playerLv); |
| | | // PlayerPropertyConfig cfg = PlayerPropertyConfig.Get(attrId); |
| | | // if (paramConfig == null || cfg == null) return 0; |
| | | |
| | | // switch (cfg.Parameter) |
| | | // { |
| | | // case "Hit": |
| | | // return paramConfig.Hit; |
| | | // case "Miss": |
| | | // return paramConfig.Miss; |
| | | // case "IgnoreDefRate": |
| | | // return paramConfig.IgnoreDefRate; |
| | | // case "DamChanceDef": |
| | | // return paramConfig.DamChanceDef; |
| | | // case "FaintRate": |
| | | // return paramConfig.FaintRate; |
| | | // case "LuckyHitRateReduce": |
| | | // return paramConfig.LuckyHitRateReduce; |
| | | // case "SkillAtkRate": |
| | | // return paramConfig.SkillAtkRate; |
| | | // case "SkillAtkRateReduce": |
| | | // return paramConfig.SkillAtkRateReduce; |
| | | // case "DamagePerPVP": |
| | | // return paramConfig.DamagePerPVP; |
| | | // case "DamagePerPVPReduce": |
| | | // return paramConfig.DamagePerPVPReduce; |
| | | // case "DamBackPer": |
| | | // return paramConfig.DamBackPer; |
| | | // case "IgnoreDefRateReduce": |
| | | // return paramConfig.IgnoreDefRateReduce; |
| | | // case "FaintDefRate": |
| | | // return paramConfig.FaintDefRate; |
| | | // case "AtkSpeedParameter": |
| | | // return paramConfig.AtkSpeedParameter; |
| | | // case "JobAHurtAddPer": |
| | | // return paramConfig.JobAHurtAddPer; |
| | | // case "JobBHurtAddPer": |
| | | // return paramConfig.JobBHurtAddPer; |
| | | // case "JobCHurtAddPer": |
| | | // return paramConfig.JobCHurtAddPer; |
| | | // case "JobAAtkReducePer": |
| | | // return paramConfig.JobAAtkReducePer; |
| | | // case "JobBAtkReducePer": |
| | | // return paramConfig.JobBAtkReducePer; |
| | | // case "JobCAtkReducePer": |
| | | // return paramConfig.JobCAtkReducePer; |
| | | // case "SuperHitRate": |
| | | // return paramConfig.SuperHitRate; |
| | | // case "LuckyHitRate": |
| | | // return paramConfig.LuckyHitRate; |
| | | // case "SuperHitRateReduce": |
| | | // return paramConfig.SuperHitRateReduce; |
| | | // case "FinalHurtPer": |
| | | // return paramConfig.FinalHurtPer; |
| | | // case "FinalHurtReducePer": |
| | | // return paramConfig.FinalHurtReducePer; |
| | | // case "NPCHurtAddPer": |
| | | // return paramConfig.NPCHurtAddPer; |
| | | // case "NormalHurtPer": |
| | | // return paramConfig.NormalHurtPer; |
| | | // case "FabaoHurtPer": |
| | | // return paramConfig.FabaoHurtPer; |
| | | // case "AffairSpeedPer": |
| | | // return paramConfig.AffairSpeedPer; |
| | | // case "FamilyBossHurtPer": |
| | | // return paramConfig.FamilyBossHurtPer; |
| | | // case "FamilyWarHPPer": |
| | | // return paramConfig.FamilyWarHPPer; |
| | | // case "FamilyWarAtkPer": |
| | | // return paramConfig.FamilyWarAtkPer; |
| | | // case "FamilySitExpPer": |
| | | // return paramConfig.FamilySitExpPer; |
| | | // case "BossFinalHurtPer": |
| | | // return paramConfig.BossFinalHurtPer; |
| | | // } |
| | | |
| | | // return 0; |
| | | // } |
| | | |
| | | #endregion |
| | | |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | [SerializeField] Button changeHeroPosBtn; |
| | | |
| | | [SerializeField] Button autoBtn; |
| | | |
| | | /// <summary> |
| | | /// 初始化组件 |
| | | /// </summary> |
| | |
| | | { |
| | | UIManager.Instance.OpenWindow<MainBossEnterWin>(); |
| | | }); |
| | | |
| | | |
| | | changeHeroPosBtn.AddListener(() => |
| | | { |
| | | HeroUIManager.Instance.selectTeamType = TeamType.Story; |
| | | UIManager.Instance.OpenWindow<HeroPosWin>(); |
| | | }); |
| | | |
| | | 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(); |
| | | } |
| | | |
| | | 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(); |
| | | } |
| | | }); |
| | | } |
| | | |
| | |
| | | taskText.text = taskConfig.TaskDescribe; |
| | | taskNumText.text = string.Format("({0}/{1})", task.CurValue, taskConfig.NeedValue); |
| | | taskNumText.color = task.CurValue >= taskConfig.NeedValue ? UIHelper.GetUIColor(TextColType.NavyYellow) : UIHelper.GetUIColor(TextColType.Red); |
| | | taskEffect.SetActive(TaskManager.Instance.GetMainTaskState() == 2); |
| | | if (TaskManager.Instance.GetMainTaskState() == 2) |
| | | { |
| | | taskEffect.Play(); |
| | | } |
| | | else |
| | | { |
| | | taskEffect.Stop(); |
| | | } |
| | | awardIcon.SetOrgSprite(ItemConfig.Get(taskConfig.AwardItemList[0][0]).IconKey); |
| | | awardCnt.text = taskConfig.AwardItemList[0][1].ToString(); |
| | | } |
New file |
| | |
| | | using DG.Tweening;
|
| | | using System.Collections.Generic;
|
| | | using UnityEngine;
|
| | |
|
| | | //获得货币动画
|
| | | public class MoneyMoveByPath : MonoBehaviour
|
| | | {
|
| | | [Header("第一段动画移动时间")]
|
| | | public float duration1 = 1f; // 动画持续时间
|
| | | [Header("随机初始左右间距")]
|
| | | public float spacing = 50f; // 设置图片之间的间隔
|
| | | [Header("X参考偏移值")]
|
| | | public float XPath = 50f; |
| | | [Header("Y参考偏移值")]
|
| | | public float YPath = 100f;
|
| | | [Header("Y参考偏移值")]
|
| | | public AnimationCurve heightCurve; // 用于定义路径高度的曲线
|
| | | [Header("第二段动画飘到目的地")]
|
| | | public float duration2 = 0.4f; // 动画持续时间
|
| | | public Transform targetPosition;
|
| | | List<ImageEx> imgMoneys = new List<ImageEx>();
|
| | | |
| | | /// <summary>
|
| | | /// 播放掉落动画
|
| | | /// </summary>
|
| | | /// <param name="targetPosition">目的地坐标</param>
|
| | | /// <param name="moneyType">货币类型</param>
|
| | | /// <param name="num">掉几个货币</param>
|
| | | public void PlayAnimation(int moneyType, int num)
|
| | | {
|
| | | int createImgCnt = 0;
|
| | | if (imgMoneys.IsNullOrEmpty())
|
| | | {
|
| | | createImgCnt = num;
|
| | | }
|
| | | else
|
| | | {
|
| | | createImgCnt = Mathf.Max(0, num - imgMoneys.Count);
|
| | | }
|
| | | if (createImgCnt > 0)
|
| | | {
|
| | | for (int i = 0; i < createImgCnt; i++)
|
| | | {
|
| | | var imgMoney = new GameObject("moneyIcon" + i);
|
| | | imgMoney.AddMissingComponent<ImageEx>();
|
| | | //挂父节点
|
| | | imgMoney.transform.SetParentEx(this.transform, Vector3.zero, Quaternion.identity, Vector3.one);
|
| | | var moneyImg = imgMoney.GetComponent<ImageEx>();
|
| | | moneyImg.SetSprite(StringUtility.Contact("Money_Type_", moneyType));
|
| | | moneyImg.raycastTarget = false;
|
| | | moneyImg.GetComponent<RectTransform>().sizeDelta = new Vector2(40, 40);
|
| | | imgMoneys.Add(moneyImg);
|
| | | }
|
| | | }
|
| | |
|
| | | //通过 heightCurve 生成路径,时间为x 总时间为1,y为高度,偏移量为100
|
| | | int pointCount = 30;
|
| | | Vector3[] points = new Vector3[pointCount];
|
| | | for (int i = 0; i < pointCount; i++)
|
| | | {
|
| | | float x = i / (pointCount - 1f);
|
| | | float y = heightCurve.Evaluate(x) * YPath;
|
| | | points[i] = new Vector3(x * XPath, y, 0);
|
| | |
|
| | | }
|
| | |
|
| | |
|
| | | |
| | |
|
| | | for (int i = 0; i < imgMoneys.Count; i++)
|
| | | {
|
| | | var moneyImg = imgMoneys[i];
|
| | | |
| | | if (num <= i)
|
| | | {
|
| | | moneyImg.transform.localScale = Vector3.zero;
|
| | | }
|
| | | else
|
| | | {
|
| | | moneyImg.transform.localScale = Vector3.one;
|
| | | int randDir = Random.Range(0, 2) == 0 ? 1 : -1;
|
| | | float offsetX = Random.Range(0, spacing);
|
| | |
|
| | | // x y 随机下差异
|
| | | float randX = Random.Range(0.2f, 1f);
|
| | | float randY = Random.Range(0.6f, 1f);
|
| | | Vector3[] points2 = new Vector3[pointCount];
|
| | | for (int j = 0; j < points.Length; j++)
|
| | | {
|
| | | points2[j] = new Vector3((points[j].x + offsetX)* randDir * randX, points[j].y * randY, points[j].z);
|
| | | }
|
| | | moneyImg.transform.localPosition = points2[0];
|
| | |
|
| | |
|
| | | moneyImg.transform.DOLocalPath(points2, duration1, PathType.CatmullRom).SetEase(Ease.InOutSine).OnComplete(() =>
|
| | | {
|
| | | if (targetPosition != null)
|
| | | {
|
| | | //移动到目标位置
|
| | | moneyImg.transform.DOMove(targetPosition.position, duration2).OnComplete(() =>
|
| | | {
|
| | | moneyImg.transform.localScale = Vector3.zero;
|
| | | });
|
| | | }
|
| | | else
|
| | | {
|
| | | moneyImg.transform.localScale = Vector3.zero;
|
| | | }
|
| | | });
|
| | |
|
| | |
|
| | | }
|
| | | }
|
| | | }
|
| | | } |
copy from Main/Config/Configs/EquipGSParamConfig.cs.meta
copy to Main/System/Main/MoneyMoveByPath.cs.meta
File was copied from Main/Config/Configs/EquipGSParamConfig.cs.meta |
| | |
| | | fileFormatVersion: 2 |
| | | guid: f510c442e570ac446af81fa008cc0367 |
| | | guid: 4bf9701377419a14f9d4969bc2138ac5 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | |
| | | { |
| | | colorType = text.colorType == RichText.ColorType.Dark ? 0 : 1; |
| | | } |
| | | presentHrefInfo.unlineColor = UIHelper.GetUIColor(quality, colorType == 1); |
| | | presentHrefInfo.unlineColor = UIHelper.GetUIColorByFunc(quality, colorType == 1); |
| | | } |
| | | } |
| | | break; |
| | |
| | | public static Action<bool> OnToggleSingleConfirmEvent; |
| | | public static Action<bool, bool> OnToggleConfirmEventEx; |
| | | //带toggle的确认和取消 |
| | | public static void ToggleConfirmCancel(string title, string content, string toggleTxt, Action<bool, bool> func, bool _toggle = false) |
| | | public static void ToggleConfirmCancel(string title, string content, string toggleTxt, Action<bool, bool> func, string okName = "", bool _toggle = false) |
| | | { |
| | | generalTitle = title; |
| | | generalContent = content; |
| | |
| | | OnToggleSingleConfirmEvent = null; |
| | | OnToggleConfirmEvent = func; |
| | | toggleOpenState = _toggle; |
| | | OKName = null; |
| | | OKName = okName; |
| | | CancelName = null; |
| | | if (!UIManager.Instance.IsOpened<ToggleConfirmWin>()) |
| | | { |
| | |
| | | { |
| | | Weapon = 1, // 主手 |
| | | Weapon2 = 2, // 副手 |
| | | Hat = 3, // 帽子 |
| | | Hat = 3, // 头盔 |
| | | Clothes = 4, // 衣服 |
| | | Belt = 5, // 腰带 |
| | | Trousers = 6, // 裤子 |
| | | Shoes = 7, // 鞋子 |
| | | Glove = 8, //手套 |
| | | Neck = 9, //项链 |
| | | FairyCan1 = 10, //仙器 |
| | | FairyCan2 = 11, //仙器 |
| | | Jade = 12, //玉佩 |
| | | |
| | | Wing = 13, //翅膀 |
| | | Guard = 14, //守护 |
| | | |
| | | PeerlessWeapon1 = 16,//绝世武器 |
| | | PeerlessWeapon2 = 17,//绝世副手 |
| | | |
| | | Mount = 19, //当前的坐骑 |
| | | |
| | | FashionWeapon = 20,//时装武器 |
| | | FashionClothes = 21, //时装衣服 |
| | | FashionWeapon2 = 22,//时装副手 |
| | | |
| | | Wristband = 8, //护腕 |
| | | Shawl = 9, //披肩 |
| | | Neck = 10, //项链 |
| | | Ring= 11, //戒指 |
| | | Amulet = 12, //护符 |
| | | |
| | | retMax, |
| | | }; |
| | |
| | | RuneCompound = 22,//符印合成 |
| | | GatherSoulCompound = 23,//聚魂合成 |
| | | GatherSoulDecompose = 24,//聚魂分解 |
| | | EquipOP, // 25 主界面装备分解/替换回复 对应 B4 15 主线掉落物品操作 #tagCSMainDropItemOP |
| | | |
| | | } |
| | | |
| | |
| | | //品质文字描边颜色 |
| | | public enum QualityTextColType |
| | | { |
| | | None = -1, |
| | | itemcucao = 0, //粗糙 |
| | | itemputong = 1, //普通 |
| | | itemjingliang = 2, //精良 |
| | | itemxiyou = 3, //稀有 |
| | | itemshishi = 4, //史诗 |
| | | itemchuanqi = 5, //传奇 |
| | | itemshenhua = 6, //神话 |
| | | itemwuxia = 7, //无暇 |
| | | itemanjin = 8, //暗金 |
| | | itemjueyi = 9, //绝艺 |
| | | itemyuanzu = 10, //元祖 |
| | | itembuxiu = 11, //不朽 |
| | | itemyonghen = 12, //永恒 |
| | | None = 0, |
| | | itemcucao = 1, //粗糙 |
| | | itemputong = 2, //普通 |
| | | itemjingliang = 3, //精良 |
| | | itemxiyou = 4, //稀有 |
| | | itemshishi = 5, //史诗 |
| | | itemchuanqi = 6, //传奇 |
| | | itemshenhua = 7, //神话 |
| | | itemwuxia = 8, //无暇 |
| | | itemanjin = 9, //暗金 |
| | | itemjueyi = 10, //绝艺 |
| | | itemyuanzu = 11, //元祖 |
| | | itembuxiu = 12, //不朽 |
| | | itemyonghen = 13, //永恒 |
| | | |
| | | red = 13, //红色 |
| | | red = 14, //红色 |
| | | } |
| | | |
| | | public enum TextColType |
| | |
| | | |
| | | if (num >= T) |
| | | { |
| | | return StringUtility.Contact(numto2Decimals(num / T).ToString("0.##"), Language.Get("L1070_0")); |
| | | return StringUtility.Contact(numto2Decimals(num / T).ToString("0.##"), Language.Get("L1070_0")); |
| | | } |
| | | else if (num >= B) |
| | | { |
| | |
| | | public static readonly Color s_BrightPurpleColor = new Color32(218, 72, 213, 255); |
| | | public static readonly Color s_BrightBlueColor = new Color32(0, 107, 227, 255); //006BE3FF |
| | | public static readonly Color s_BrightOrangeColor = new Color32(255, 103, 1, 255); //FF6701FF |
| | | public static readonly Color s_BrightWhiteColor = new Color32(104, 104, 104, 255); //686868 |
| | | public static readonly Color s_BrightWhiteColor = new Color32(255, 255, 255, 255); //ffffff //new Color32(104, 104, 104, 255); //686868 |
| | | public static readonly Color s_BrightGreenColor = new Color32(36, 139, 18, 255); //248b12 |
| | | |
| | | public static readonly Color s_DarkPinkColor = new Color32(255, 124, 124, 255); |
| | |
| | | // return name; |
| | | // } |
| | | |
| | | //物品 各功能品质 |
| | | |
| | | |
| | | //物品 各功能品质 从精良1品质 对应 3开始 |
| | | public static Color GetUIColorByFunc(int itemColor, bool bright = true) |
| | | { |
| | | return GetUIColor(itemColor + 1, bright); |
| | | return GetUIColor(itemColor + 2, bright); |
| | | } |
| | | |
| | | |
| | | //对应品质(树);物品 各功能品质从2开始 用GetUIColorByFunc |
| | | //对应品质(树);物品 各功能品质 用GetUIColorByFunc |
| | | public static Color GetUIColor(int itemColor, bool bright = true) |
| | | { |
| | | switch (itemColor) |
| | | { |
| | | case 0: |
| | | return GetUIColor(TextColType.Gray, bright); |
| | | case 1: |
| | | return GetUIColor(TextColType.White, bright); |
| | | return GetUIColor(TextColType.Gray, bright); |
| | | case 2: |
| | | return GetUIColor(TextColType.itemjingliang, bright); |
| | | return GetUIColor(TextColType.White, bright); |
| | | case 3: |
| | | return GetUIColor(TextColType.itemxiyou, bright); |
| | | return GetUIColor(TextColType.itemjingliang, bright); |
| | | case 4: |
| | | return GetUIColor(TextColType.itemshishi, bright); |
| | | return GetUIColor(TextColType.itemxiyou, bright); |
| | | case 5: |
| | | return GetUIColor(TextColType.itemchuanqi, bright); |
| | | return GetUIColor(TextColType.itemshishi, bright); |
| | | case 6: |
| | | return GetUIColor(TextColType.itemshenhua, bright); |
| | | return GetUIColor(TextColType.itemchuanqi, bright); |
| | | case 7: |
| | | return GetUIColor(TextColType.itemwuxia, bright); |
| | | return GetUIColor(TextColType.itemshenhua, bright); |
| | | case 8: |
| | | return GetUIColor(TextColType.itemanjin, bright); |
| | | return GetUIColor(TextColType.itemwuxia, bright); |
| | | case 9: |
| | | return GetUIColor(TextColType.itemjueyi, bright); |
| | | return GetUIColor(TextColType.itemanjin, bright); |
| | | case 10: |
| | | return GetUIColor(TextColType.itemyuanzu, bright); |
| | | case 11: |
| | | return GetUIColor(TextColType.itembuxiu, bright); |
| | | case 12: |
| | | case 13: |
| | | case 14: |
| | | return GetUIColor(TextColType.itemjueyi, bright); |
| | | case 15: |
| | | case 16: |
| | | case 17: |
| | | case 18: |
| | | case 19: |
| | | return GetUIColor(TextColType.itemyuanzu, bright); |
| | | case 20: |
| | | case 21: |
| | | case 22: |
| | | case 23: |
| | | case 24: |
| | | return GetUIColor(TextColType.itembuxiu, bright); |
| | | case 25: |
| | | case 26: |
| | | case 27: |
| | | case 28: |
| | | case 29: |
| | | return GetUIColor(TextColType.itemyonghen, bright); |
| | | |
| | | |
| | |
| | | return bright ? s_BrightWhiteColor : s_DarkWhiteColor; |
| | | } |
| | | |
| | | //对应品质(树);物品 各功能品质从2开始 用GetUIOutlineColorByFunc |
| | | //对应品质(树);物品 各功能品质 用GetUIOutlineColorByFunc |
| | | public static Color GetUIOutlineColor(int quality) |
| | | { |
| | | return GetUIOutlineColor((QualityTextColType)quality); |
| | | switch (quality) |
| | | { |
| | | case 1: |
| | | case 2: |
| | | case 3: |
| | | case 4: |
| | | case 5: |
| | | case 6: |
| | | case 7: |
| | | case 8: |
| | | case 9: |
| | | return GetUIOutlineColor((QualityTextColType)quality); |
| | | case 10: |
| | | case 11: |
| | | case 12: |
| | | case 13: |
| | | case 14: |
| | | return GetUIOutlineColor(QualityTextColType.itemjueyi); |
| | | case 15: |
| | | case 16: |
| | | case 17: |
| | | case 18: |
| | | case 19: |
| | | return GetUIOutlineColor(QualityTextColType.itemyuanzu); |
| | | case 20: |
| | | case 21: |
| | | case 22: |
| | | case 23: |
| | | case 24: |
| | | return GetUIOutlineColor(QualityTextColType.itembuxiu); |
| | | case 25: |
| | | case 26: |
| | | case 27: |
| | | case 28: |
| | | case 29: |
| | | return GetUIOutlineColor(QualityTextColType.itemyonghen); |
| | | } |
| | | return GetUIOutlineColor(QualityTextColType.itemputong); |
| | | } |
| | | |
| | | //物品 各功能品质 |
| | | //物品 各功能品质 从精良1品质 对应 3开始 |
| | | public static Color GetUIOutlineColorByFunc(int quality) |
| | | { |
| | | return GetUIOutlineColor((QualityTextColType)(quality + 1)); |
| | | return GetUIOutlineColor((QualityTextColType)(quality + 2)); |
| | | } |
| | | |
| | | //描边颜色,对应品质(树) |
| | |
| | | return new Color32(0, 0, 0, 128); |
| | | } |
| | | |
| | | private static Regex m_TextColorRegex = new Regex("<color=#[0-9a-zA-Z]+>(.*)</color>", RegexOptions.Singleline); |
| | | // private static Regex m_TextColorRegex = new Regex("<color=#[0-9a-zA-Z]+>(.*)</color>", RegexOptions.Singleline); |
| | | |
| | | public static string AppendColor(TextColType type, string msg, bool bright = true) |
| | | { |
| | |
| | | { |
| | | case TextColType.None: |
| | | case TextColType.White: |
| | | return StringUtility.Contact("<color=#", bright ? "686868" : "f7f7f7", ">", msg, "</color>"); |
| | | return StringUtility.Contact("<color=#", bright ? "ffffff" : "ffffff", ">", msg, "</color>"); |
| | | case TextColType.titleSelectColor: |
| | | return StringUtility.Contact("<color=#7F4139>", msg, "</color>"); |
| | | case TextColType.titleUnSelectColor: |
| | |
| | | case TextColType.Pink: |
| | | return StringUtility.Contact("<color=#", bright ? "f6408d" : "ff7c7c", ">", msg, "</color>"); |
| | | case TextColType.Green: |
| | | return StringUtility.Contact("<color=#", bright ? "109d06" : "35e122", ">", msg, "</color>"); |
| | | return StringUtility.Contact("<color=#", bright ? "109d06" : "2ae337", ">", msg, "</color>"); |
| | | case TextColType.NavyBrown: |
| | | return StringUtility.Contact("<color=#", "6e4c31", ">", msg, "</color>"); |
| | | return StringUtility.Contact("<color=#6e4c31>", msg, "</color>"); |
| | | case TextColType.DarkGreen: |
| | | return StringUtility.Contact("<color=#", "109d06", ">", msg, "</color>"); |
| | | return StringUtility.Contact("<color=#109d06>", msg, "</color>"); |
| | | case TextColType.Black: |
| | | return StringUtility.Contact("<color=#", "000000", ">", msg, "</color>"); |
| | | return StringUtility.Contact("<color=#000000>", msg, "</color>"); |
| | | case TextColType.LightWhite: |
| | | return StringUtility.Contact("<color=#", "f5f646", ">", msg, "</color>"); |
| | | return StringUtility.Contact("<color=f5f646>", msg, "</color>"); |
| | | case TextColType.LightGreen: |
| | | return StringUtility.Contact("<color=#", "8ddc11", ">", msg, "</color>"); |
| | | return StringUtility.Contact("<color=#8ddc11>", msg, "</color>"); |
| | | case TextColType.Gray: |
| | | return StringUtility.Contact("<color=#", "84797b", ">", msg, "</color>"); |
| | | return StringUtility.Contact("<color=#84797b>", msg, "</color>"); |
| | | case TextColType.lightYellow: |
| | | return StringUtility.Contact("<color=#", "fcedb9", ">", msg, "</color>"); |
| | | return StringUtility.Contact("<color=#fcedb9>", msg, "</color>"); |
| | | case TextColType.NavyYellow: |
| | | return StringUtility.Contact("<color=#", "f2ee02", ">", msg, "</color>"); |
| | | return StringUtility.Contact("<color=#f2ee02>", msg, "</color>"); |
| | | case TextColType.itemjingliang: |
| | | // 729de4 精良 |
| | | return StringUtility.Contact("<color=#729de4>", msg, "</color>"); |
| | | case TextColType.itemxiyou: |
| | | // c87bfa稀有 |
| | | return StringUtility.Contact("<color=#c87bfa>", msg, "</color>"); |
| | | case TextColType.itemshishi: |
| | | // f6de56 史诗 |
| | | return StringUtility.Contact("<color=#f6de56>", msg, "</color>"); |
| | | case TextColType.itemchuanqi: |
| | | // fe8534 传奇 |
| | | return StringUtility.Contact("<color=#fe8534>", msg, "</color>"); |
| | | case TextColType.itemshenhua: |
| | | // fe4a47 神话 |
| | | return StringUtility.Contact("<color=#fe4a47>", msg, "</color>"); |
| | | case TextColType.itemwuxia: |
| | | // eb5ce9 无瑕 |
| | | return StringUtility.Contact("<color=#eb5ce9>", msg, "</color>"); |
| | | case TextColType.itemanjin: |
| | | // f9e29f 暗金 |
| | | return StringUtility.Contact("<color=#f9e29f>", msg, "</color>"); |
| | | case TextColType.itemjueyi: |
| | | // cdfef2 绝艺 |
| | | return StringUtility.Contact("<color=#cdfef2>", msg, "</color>"); |
| | | case TextColType.itemyuanzu: |
| | | // dfbbed 元祖 |
| | | return StringUtility.Contact("<color=#dfbbed>", msg, "</color>"); |
| | | case TextColType.itembuxiu: |
| | | // 5eeff2 不朽 |
| | | return StringUtility.Contact("<color=#5eeff2>", msg, "</color>"); |
| | | case TextColType.itemyonghen: |
| | | // f5b4ea 永恒 |
| | | return StringUtility.Contact("<color=#f5b4ea>", msg, "</color>"); |
| | | } |
| | | return msg; |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | public static string AppendColor(int itemColor, string msg, bool bright = true) |
| | | //物品 各功能品质 从精良1品质 对应 3开始 |
| | | /// <summary> |
| | | /// 颜色定义根据分组处理,如普通物品的颜色精良是1开始,树和装备也是粗糙1开始,需要调整匹配 |
| | | /// </summary> |
| | | /// <param name="itemColor"></param> |
| | | /// <param name="msg"></param> |
| | | /// <param name="bright"></param> |
| | | /// <param name="colorGroupType"></param> |
| | | /// <returns></returns> |
| | | public static string AppendColor(int itemColor, string msg, bool bright = true, int colorGroupType = 0) |
| | | { |
| | | if (colorGroupType == 0) |
| | | { |
| | | itemColor = itemColor + 2; |
| | | } |
| | | |
| | | switch (itemColor) |
| | | { |
| | | |
| | | case 0: |
| | | return AppendColor(TextColType.Gray, msg, bright); |
| | | case 1: |
| | | return AppendColor(TextColType.White, msg, bright); |
| | | return AppendColor(TextColType.Gray, msg, bright); |
| | | case 2: |
| | | return AppendColor(TextColType.itemjingliang, msg, bright); |
| | | return AppendColor(TextColType.White, msg, bright); |
| | | case 3: |
| | | return AppendColor(TextColType.itemxiyou, msg, bright); |
| | | return AppendColor(TextColType.itemjingliang, msg, bright); |
| | | case 4: |
| | | return AppendColor(TextColType.itemshishi, msg, bright); |
| | | return AppendColor(TextColType.itemxiyou, msg, bright); |
| | | case 5: |
| | | return AppendColor(TextColType.itemchuanqi, msg, bright); |
| | | return AppendColor(TextColType.itemshishi, msg, bright); |
| | | case 6: |
| | | return AppendColor(TextColType.itemshenhua, msg, bright); |
| | | return AppendColor(TextColType.itemchuanqi, msg, bright); |
| | | case 7: |
| | | return AppendColor(TextColType.itemwuxia, msg, bright); |
| | | return AppendColor(TextColType.itemshenhua, msg, bright); |
| | | case 8: |
| | | return AppendColor(TextColType.itemanjin, msg, bright); |
| | | return AppendColor(TextColType.itemwuxia, msg, bright); |
| | | case 9: |
| | | return AppendColor(TextColType.itemjueyi, msg, bright); |
| | | return AppendColor(TextColType.itemanjin, msg, bright); |
| | | case 10: |
| | | return AppendColor(TextColType.itemyuanzu, msg, bright); |
| | | case 11: |
| | | return AppendColor(TextColType.itembuxiu, msg, bright); |
| | | case 12: |
| | | case 13: |
| | | case 14: |
| | | return AppendColor(TextColType.itemjueyi, msg, bright); |
| | | case 15: |
| | | case 16: |
| | | case 17: |
| | | case 18: |
| | | case 19: |
| | | return AppendColor(TextColType.itemyuanzu, msg, bright); |
| | | case 20: |
| | | case 21: |
| | | case 22: |
| | | case 23: |
| | | case 24: |
| | | return AppendColor(TextColType.itembuxiu, msg, bright); |
| | | case 25: |
| | | case 26: |
| | | case 27: |
| | | case 28: |
| | | case 29: |
| | | return AppendColor(TextColType.itemyonghen, msg, bright); |
| | | |
| | | } |
| | |
| | | } |
| | | #endregion |
| | | |
| | | #region 计算战斗力 |
| | | public static readonly string FightPowerFormula = "FightpowerFormula"; |
| | | |
| | | // public static int GetFightPower(Dictionary<int, int> _propertyDict) |
| | | // { |
| | | // Equation.Instance.Clear(); |
| | | // if (_propertyDict == null || _propertyDict.Count == 0) |
| | | // { |
| | | // return 0; |
| | | // } |
| | | |
| | | // foreach (var _key in _propertyDict.Keys) |
| | | // { |
| | | // PlayerPropertyConfig cfg = PlayerPropertyConfig.Get(_key); |
| | | // if (cfg != null) |
| | | // { |
| | | // if (_key == 7) |
| | | // { |
| | | // Equation.Instance.AddKeyValue("MinAtk", _propertyDict[_key]); |
| | | // Equation.Instance.AddKeyValue("MaxAtk", _propertyDict[_key]); |
| | | // } |
| | | // else if (_key == 24) |
| | | // { |
| | | // Equation.Instance.AddKeyValue("PetMinAtk", _propertyDict[_key]); |
| | | // Equation.Instance.AddKeyValue("PetMaxAtk", _propertyDict[_key]); |
| | | // } |
| | | // else |
| | | // { |
| | | // ulong attrValue = (ulong)_propertyDict[_key]; |
| | | // var fightParm = GetFightPowerParmByAttrId(_key); |
| | | // if (_key == 11) |
| | | // { |
| | | // var playerLv = PlayerDatas.Instance.baseData.LV; |
| | | // var paramConfig = FightPowerParamConfig.Get(playerLv); |
| | | // Equation.Instance.AddKeyValue("AtkSpeedParameter", paramConfig.AtkSpeedParameter); |
| | | // } |
| | | // else |
| | | // { |
| | | // if (fightParm != 0) |
| | | // { |
| | | // attrValue = attrValue * (ulong)fightParm; |
| | | // } |
| | | // } |
| | | // Equation.Instance.AddKeyValue(cfg.Parameter, attrValue); |
| | | // } |
| | | // } |
| | | |
| | | // } |
| | | // FuncConfigConfig funcCfg = FuncConfigConfig.Get(FightPowerFormula); |
| | | // return Equation.Instance.Eval<int>(funcCfg.Numerical1); |
| | | // } |
| | | |
| | | // public static int GetFightPowerParmByAttrId(int attrId) |
| | | // { |
| | | // int playerLv = PlayerDatas.Instance.baseData.LV; |
| | | // FightPowerParamConfig paramConfig = FightPowerParamConfig.Get(playerLv); |
| | | // PlayerPropertyConfig cfg = PlayerPropertyConfig.Get(attrId); |
| | | // if (paramConfig == null || cfg == null) return 0; |
| | | |
| | | // switch (cfg.Parameter) |
| | | // { |
| | | // case "Hit": |
| | | // return paramConfig.Hit; |
| | | // case "Miss": |
| | | // return paramConfig.Miss; |
| | | // case "IgnoreDefRate": |
| | | // return paramConfig.IgnoreDefRate; |
| | | // case "DamChanceDef": |
| | | // return paramConfig.DamChanceDef; |
| | | // case "FaintRate": |
| | | // return paramConfig.FaintRate; |
| | | // case "LuckyHitRateReduce": |
| | | // return paramConfig.LuckyHitRateReduce; |
| | | // case "SkillAtkRate": |
| | | // return paramConfig.SkillAtkRate; |
| | | // case "SkillAtkRateReduce": |
| | | // return paramConfig.SkillAtkRateReduce; |
| | | // case "DamagePerPVP": |
| | | // return paramConfig.DamagePerPVP; |
| | | // case "DamagePerPVPReduce": |
| | | // return paramConfig.DamagePerPVPReduce; |
| | | // case "DamBackPer": |
| | | // return paramConfig.DamBackPer; |
| | | // case "IgnoreDefRateReduce": |
| | | // return paramConfig.IgnoreDefRateReduce; |
| | | // case "FaintDefRate": |
| | | // return paramConfig.FaintDefRate; |
| | | // case "AtkSpeedParameter": |
| | | // return paramConfig.AtkSpeedParameter; |
| | | // case "JobAHurtAddPer": |
| | | // return paramConfig.JobAHurtAddPer; |
| | | // case "JobBHurtAddPer": |
| | | // return paramConfig.JobBHurtAddPer; |
| | | // case "JobCHurtAddPer": |
| | | // return paramConfig.JobCHurtAddPer; |
| | | // case "JobAAtkReducePer": |
| | | // return paramConfig.JobAAtkReducePer; |
| | | // case "JobBAtkReducePer": |
| | | // return paramConfig.JobBAtkReducePer; |
| | | // case "JobCAtkReducePer": |
| | | // return paramConfig.JobCAtkReducePer; |
| | | // case "SuperHitRate": |
| | | // return paramConfig.SuperHitRate; |
| | | // case "LuckyHitRate": |
| | | // return paramConfig.LuckyHitRate; |
| | | // case "SuperHitRateReduce": |
| | | // return paramConfig.SuperHitRateReduce; |
| | | // case "FinalHurtPer": |
| | | // return paramConfig.FinalHurtPer; |
| | | // case "FinalHurtReducePer": |
| | | // return paramConfig.FinalHurtReducePer; |
| | | // case "NPCHurtAddPer": |
| | | // return paramConfig.NPCHurtAddPer; |
| | | // case "NormalHurtPer": |
| | | // return paramConfig.NormalHurtPer; |
| | | // case "FabaoHurtPer": |
| | | // return paramConfig.FabaoHurtPer; |
| | | // case "AffairSpeedPer": |
| | | // return paramConfig.AffairSpeedPer; |
| | | // case "FamilyBossHurtPer": |
| | | // return paramConfig.FamilyBossHurtPer; |
| | | // case "FamilyWarHPPer": |
| | | // return paramConfig.FamilyWarHPPer; |
| | | // case "FamilyWarAtkPer": |
| | | // return paramConfig.FamilyWarAtkPer; |
| | | // case "FamilySitExpPer": |
| | | // return paramConfig.FamilySitExpPer; |
| | | // case "BossFinalHurtPer": |
| | | // return paramConfig.BossFinalHurtPer; |
| | | // } |
| | | |
| | | // return 0; |
| | | // } |
| | | |
| | | #endregion |
| | | |
| | | |
| | | #region 得到金钱数量根据金钱类型 |
| | | |
| | |
| | | |
| | | #endregion |
| | | |
| | | #region 得到装备位对应的部位名称 |
| | | public static string GetEquipPlaceName(int place) |
| | | #region 得到装备位或者祝福树品质名称 带颜色 |
| | | public static string GetQualityNameWithColor(int quality, string format="{0}") |
| | | { |
| | | if (GeneralDefine.equipPlaceNameDict.ContainsKey(place)) |
| | | { |
| | | return GeneralDefine.equipPlaceNameDict[place]; |
| | | } |
| | | return ""; |
| | | return AppendColor(quality, string.Format(format, Language.Get("equipQuality" + quality)), true, 1); |
| | | } |
| | | #endregion |
| | | |