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); }
protected override void OnCreateCreatures() { base.OnCreateCreatures(); // Create default player m_player.regenRagePercent = 0.3f; // Regen 30% rage every second moduleAI.AddCreatureToCampDic(m_player); var info = modulePlayer.BuildPlayerInfo(modulePlayer.proto); info.name = Util.GetString(9208); m_enermy = Creature.Create(info, new Vector3_(CombatConfig.spvpStart.y, 0, 0), new Vector3(0, 90, 0), false, "enermy", info.name); m_enermy.FaceTo(player); var es = Module_Equip.SelectRandomEquipments(m_player.gender, m_player.roleProto); m_enermy.avatar = es[0] + "_" + es[1] + "_" + es[2]; m_enermy.avatarBox = m_player.avatarBox; m_enermy.roleProto = m_player.roleProto; moduleAI.AddCreatureToCampDic(m_enermy); CharacterEquip.ChangeCloth(m_enermy, es); m_enermy.maxHealth = (int)(player.attack + player.elementAttack) * 20; m_enermy.health = m_enermy.maxHealth; m_enermy.regenHealthPercent = 0.3; player.AddEventListener(CreatureEvents.DEAD, OnCreatureDead); m_enermy.AddEventListener(CreatureEvents.DEAD, OnCreatureDead); EventManager.AddEventListener(CreatureEvents.Dying, OnCreatureDying); }
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 void RefreshCoinCost(int totalExp) { int totalNum = Module_Equip.GetCoinCost(equipType, data.GetCurrentTotalExp(), totalExp, m_limitIntentifyInfo); bool moneyEnough = Module_Player.instance.roleInfo.coin >= totalNum; Util.SetText(m_cost, (int)TextForMatType.EquipIntentyUI, 14, moneyEnough ? totalNum.ToString() : GeneralConfigInfo.GetNoEnoughColorString(totalNum.ToString())); }
public override void RefreshPanel(PItem item, EquipType type) { base.RefreshPanel(item, type); int level = data.GetIntentyLevel(); Util.SetText(m_levelText, (int)TextForMatType.EquipEvolveUI, 3, level.ToString()); m_levelText.SafeSetActive(level > 0); level = data.GetEvolveLevel(); //获取的是下一级的进阶显示 EvolveEquipInfo info = moduleEquip.GetEvolveInfo(equipType, level + 1); if (info == null) { return; } List <PItem> currenProps = moduleEquip.GetBagProps(PropType.EvolveProp); RefreshMatItem(info.materials, currenProps); RefreshLevel(); RefreshAttributes(info); bool moneyEnough = Module_Player.instance.roleInfo.coin > info.costNumber; Util.SetText(m_evoCostText, moneyEnough ? info.costNumber.ToString() : GeneralConfigInfo.GetNoEnoughColorString(info.costNumber.ToString())); bool materialEnough = Module_Equip.GetMaterialEnoughState(info.materials, currenProps); m_evoBtn.SetInteractable(moneyEnough && materialEnough && SendEvolve); }
/// <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); } }
private void RefreshCoinCost(int totalExp) { int totalNum = Module_Equip.GetCoinCost(equipType, data.GetCurrentTotalExp(), totalExp, m_maxLimitIntentifyInfo); bool moneyEnough = Module_Player.instance.roleInfo.coin > totalNum; Util.SetText(m_intenCostText, moneyEnough ? totalNum.ToString() : GeneralConfigInfo.GetNoEnoughColorString(totalNum.ToString())); //m_intenBtn.SetInteractable(); m_intenBtn.interactable = moneyEnough && !m_maxLevel && m_swallowExp > 0 && sendStreng; }
public void RefreshTotalExp() { List <int> expDetails = Module_Equip.GetReallyExpDetail(data.GetCurrentTotalExp(), m_swallowExp, m_maxLimitIntentifyInfo); int totalExp = expDetails.GetValue(0); m_swallowExp = expDetails.GetValue(1); m_swallowText.text = m_swallowExp.ToString(); m_previewIntentifyInfo = moduleEquip.GetLimitIntenLevelByExp(equipType, data.GetIntentyLevel(), totalExp, data.HasEvolved()); RefreshCoinCost(totalExp); }
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 RefreshDetail() { RefreshSwallowDisplay(); List <int> expDetails = Module_Equip.GetReallyExpDetail(data.GetCurrentTotalExp(), swallowExp, m_limitIntentifyInfo); totalExp = expDetails.GetValue(0); swallowExp = expDetails.GetValue(1); Util.SetText(m_swallowExpText, Util.Format(ConfigText.GetDefalutString(TextForMatType.EquipIntentyUI, 15), swallowExp)); m_previewIntentifyInfo = moduleEquip.GetLimitIntenLevelByExp(equipType, data.GetIntentyLevel(), totalExp, data.HasEvolved()); int level = data.GetIntentyLevel(); int nextLevel = m_previewIntentifyInfo == null ? level : m_previewIntentifyInfo.level; m_levelPreview.RefreshDetail(level, nextLevel, false); RefreshBar(); RefreshCoinCost(totalExp); }
public override void InitComponent() { base.InitComponent(); moduleEquip = Module_Equip.instance; m_levelPreview = new AttributeItem(transform.Find("levelchange")); m_expBars = Util.GetExpBars(transform.Find("progressbar")); m_expText = transform.GetComponent <Text>("level_bar_text"); m_cost = transform.GetComponent <Text>("consume_txt"); m_swallowExpText = transform.GetComponent <Text>("exp_txt"); m_confirmBtn = transform.GetComponent <Button>("confirm_btn"); m_exitBtn = transform.GetComponent <Button>("close_button"); ScrollView s = transform.GetComponent <ScrollView>("scrollView"); m_dataSource = new DataSource <PItem>(new List <PItem>(), s, RefreshItem, OnItemClick); }
public override void RefreshPanel(PItem item, PItem cache) { base.RefreshPanel(item, cache); if (item.InvalidGrowAttr()) { canClick = true; return; } EquipType type = Module_Equip.GetEquipTypeByID(item.itemTypeId); int level = item.GetIntentyLevel(); int limitLevel = moduleEquip.GetLimitIntenLevel(type, level, true); m_currentLevel.text = level.ToString(); m_nextLimitLevel.text = limitLevel.ToString(); if (!m_t) { canClick = true; } }
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(); }