private ShowCreatureInfo.SizeAndPos[] GetShowInfoData(PItem item) { var info = item.GetPropItem(); if (!info) { return(null); } var type = Module_Equip.GetEquipTypeByItem(item); var showId = type == EquipType.Cloth ? 300 : info.subType + 100; var showInfo = ConfigManager.Get <ShowCreatureInfo>(showId); if (showInfo == null) { Logger.LogError("can not find config showCreatureInfo, please check config [{0}]", showId); return(null); } var showData = showInfo.GetDataByIndex(info.ID); if (showData == null) { showData = showInfo.forData.Length > 0 ? showInfo.forData[0] : null; Logger.LogWarning("cause ShowCreatureInfo.Id = [{0}] with itemTypeId = [{1}] cannot be finded,we use itemTypeId = [{2}] to instead!", showId, info.ID, showData == null ? "null" : showData.index.ToString()); } return(showData?.data); }
private List <string> GetItemModels(PItem item) { var l = new List <string>(); if (item == null) { return(l); } var type = Module_Equip.GetEquipTypeByItem(item); var info = item.GetPropItem(); if (type == EquipType.Cloth) { var model = info?.previewModel; if (!string.IsNullOrEmpty(model)) { l.Add(model); } } else if (type == EquipType.Gun || type == EquipType.Weapon) { var weapon = WeaponInfo.GetWeapon(info.subType, info.ID); weapon.GetAllAssets(l); } return(l); }
/// <summary> /// 获取当前总经验 /// </summary> /// <param name="pitemData"></param> /// <returns></returns> public static int GetCurrentTotalExp(this PItem pitemData) { int level = pitemData.GetIntentyLevel(); EquipType type = Module_Equip.GetEquipTypeByItem(pitemData); var info = ConfigManager.Find <IntentifyEquipInfo>(o => o.type == type && o.level == level); return(pitemData.GetCurrentLevelExp() + (info == null ? 0 : info.exp)); }
public void RefreshSelf() { if (data != null) { var type = Module_Equip.GetEquipTypeByItem(data); RefreshPanel(data, type); } }
public void LoadItemModel(PItem item, int layer = Layers.WEAPON) { cullingMask = 1 << layer; if (null != itemRenderCamera) { itemRenderCamera.cullingMask = cullingMask; } HideOtherModels(); if (item == null || !(Level.current is Level_Home)) { return; } var level = Level.current; var models = GetItemModels(item); Module_Global.instance?.LockUI("", 0.5f); Level.PrepareAssets(models, r => { if (!r) { Module_Global.instance?.UnLockUI(); return; } //when loaded complete ,must reget models models = GetItemModels(item); var data = GetShowInfoData(item); var equipType = Module_Equip.GetEquipTypeByItem(item); for (var i = 0; i < models.Count; i++) { var go = level.startPos.Find(models[i])?.gameObject; if (!go) { go = Level.GetPreloadObject <GameObject>(models[i]); if (go == null) { Logger.LogError("equip with propId {1} and asset name {0} cannot be loaded,please check config", models[i], item.itemTypeId); } else { go.transform.SetParent(level.startPos.transform); go.transform.localPosition = RootPosition; } objectModels.Add(go); } SetWeaponInfo(go, data.GetValue <ShowCreatureInfo.SizeAndPos>(i), layer, equipType); } Module_Global.instance?.UnLockUI(); }); }
private List <PItem> EquipShow(EquipType type) { List <PItem> equip = new List <PItem>(); for (int i = 0; i < newProp.Count; i++) { var p = Module_Equip.GetEquipTypeByItem(newProp[i]); if (type == p) { equip.Add(newProp[i]); } } return(equip); }
private void SetBtnClick() { foreach (Transform obj in m_btnGroup) { obj.GetComponent <Button>().interactable = true; obj.Find("mark").gameObject.SetActive(false); obj.GetComponent <Button>().onClick.RemoveAllListeners(); } m_strengBtn.onClick.AddListener(delegate { if (m_strengHint.activeInHierarchy) { var max = moduleEquip.GetLimitIntenLevelByExp(Module_Equip.GetEquipTypeByItem(item), item.GetIntentyLevel(), moduleEquip.GetBagTotalIntentyExp() + item.GetCurrentTotalExp(), item.HasEvolved()); if (max == null) { return; } if (moduleEquip.IntentyRead.ContainsKey(item.itemId)) { moduleEquip.IntentyRead[item.itemId] = max.level; } else { moduleEquip.IntentyRead.Add(item.itemId, max.level); } } moduleEquip.operateItem = item; ShowAsync <Window_Strength>(); }); m_advancedBtn.onClick.AddListener(delegate { if (m_advancedHint.activeInHierarchy) { int leftLevel = item.GetIntentyLevel(); int nextLimitLevel = moduleEquip.GetLimitIntenLevel(Module_Equip.GetEquipTypeByItem(item), leftLevel, true); if (moduleEquip.EvolveRead.ContainsKey(item.itemId)) { moduleEquip.EvolveRead[item.itemId] = nextLimitLevel; } else { moduleEquip.EvolveRead.Add(item.itemId, nextLimitLevel); } } moduleEquip.operateItem = item; ShowAsync <Window_Evolution>(); }); m_soulBtn.onClick.AddListener(delegate { if (m_soulHint.activeInHierarchy) { var wea = ConfigManager.Get <WeaponAttribute>(item.itemTypeId); if (wea != null) { var read = moduleEquip.InsoulLevel(wea.elementId, (int)item.growAttr.equipAttr.expr, item.growAttr.equipAttr.level); if (moduleEquip.InsoulRead.ContainsKey(item.itemId)) { moduleEquip.InsoulRead[item.itemId] = read; } else { moduleEquip.InsoulRead.Add(item.itemId, read); } //记录为已读状态 存储当前可达到的最高级 } } moduleForging.InsoulItem = item.Clone(); ShowAsync <Window_Merge>(); }); m_orderBtn.onClick.AddListener(delegate { if (m_orderHint.activeInHierarchy) { var have = moduleEquip.UpLoadRead.Exists(a => a == item.itemId); if (!have) { moduleEquip.UpLoadRead.Add(item.itemId); } } moduleForging.UpLoadItem = item.Clone(); ShowAsync <Window_Upload>(); }); m_sublimaBtn.onClick.AddListener(delegate { var currentItem = moduleEquip.GetProp(item.itemId); if (moduleFurnace.IsSublimationMax(currentItem)) { moduleGlobal.ShowMessage(249, 20); return; } moduleFurnace.currentSublimationItem = currentItem; ShowAsync <Window_Sublimation>(); }); m_spiritBtn.onClick.AddListener(delegate { moduleFurnace.currentSoulItem = moduleEquip.GetProp(item.itemId); ShowAsync <Window_Soul>(); }); m_btnClearSuit?.onClick.AddListener(delegate { m_clearSuit.Initialize(moduleEquip.GetProp(item.itemId)); }); SetBtnHint(); }