void _Packet(ScMazeEffectPropChange p) { if (p.propIds == null || p.propIds.Length == 0) { return; } ushort[] pr = new ushort[p.propIds.Length]; System.Array.Copy(p.propIds, pr, p.propIds.Length); //更新自己的道具信息 if (m_labyrinthSelfInfo == null) { Logger.LogError("recv ScMazeEffectPropChange msg but the self info is null......."); return; } m_labyrinthSelfInfo.attackProps = pr; DispatchModuleEvent(EventRefreshSelfAttackProp, m_labyrinthSelfInfo); if (m_labyrinthSelfInfo.attackProps != null) { string str = string.Empty; for (int i = 0; i < labyrinthSelfInfo.attackProps.Length; i++) { PropItemInfo item = ConfigManager.Get <PropItemInfo>(labyrinthSelfInfo.attackProps[i]); str += Util.Format("{0} {1} {2} ", item.ID, (LabyrinthPropSubType)item.subType, item.itemName); } Logger.LogInfo("ScMazeEffectPropChange,props ={0}", str); } }
private void OnDetectBtnClick(GameObject sender) { if (moduleBordlands.isHasAnyBoss) { moduleGlobal.ShowMessage(ConfigText.GetDefalutString(TextForMatType.BorderlandUIText, 34)); return; } PItem2 cost = moduleBordlands.detectCostDic.Get(moduleBordlands.currentDetectTimes); //次数满了 if (cost == null) { moduleGlobal.ShowMessage(ConfigText.GetDefalutString(TextForMatType.BorderlandUIText, 35)); return; } PropItemInfo prop = ConfigManager.Get <PropItemInfo>(cost.itemTypeId); if (prop == null) { Logger.LogError("detect cost type error,id = {0}", cost.itemTypeId); return; } uint remian = modulePlayer.GetMoneyCount((CurrencySubType)prop.subType); if (cost.num > remian) { moduleGlobal.ShowMessage(ConfigText.GetDefalutString(TextForMatType.BorderlandUIText, 36)); return; } moduleBordlands.SendRefreshBoss(); }
public void InitCreatureData(Creature creature, PMazePlayer info) { this.creature = creature; roleInfo = info; PropItemInfo weaponInfo = ConfigManager.Get <PropItemInfo>(info.fashion.weapon); if (weaponInfo) { LoadPlayerRuntimeAnimator(Creature.GetAnimatorName(weaponInfo.subType, info.gender), weaponInfo.subType, info.gender); } CreatePlayerCollider(); InitPVECreatureBehaviour(); switch (playerType) { //随机坐标 case LabyrinthCreatureType.OutLabyrinth: float x = Random.Range((float)Level.current.edge.x, (float)Level.current.edge.y); float z = Random.Range((float)Level.current.zEdge.x, (float)Level.current.zEdge.y); creaturePos = new Vector3(x, 0, z); break; //服务器返回的坐标 case LabyrinthCreatureType.InLabyrinth: creaturePos = info.pos == null ? Vector3.zero : info.pos.ToVector3(); break; } }
private void CreateItems(List <ItemPair> rList) { if (rList == null || rList.Count == 0) { return; } for (var i = 0; i < rList.Count; i++) { var item = rList[i]; if (item.count <= 0) { continue; } var itemInfo = PropItemInfo.Get((ushort)item.itemId); if (!itemInfo || !itemInfo.IsValidVocation(modulePlayer.proto)) { continue; } var t = itemRoot.AddNewChild(itemTemplete); t.SafeSetActive(true); itemCache.Add(t); Util.SetItemInfoSimple(t, itemInfo); Util.SetText(t.GetComponent <Text>("numberdi/count"), item.count.ToString()); } }
public void HeadBox(int boxid)//设置头像框 { get(); if (boxid == 0 || boxid == 1) { Logger.LogError("this player head id is {0}", boxid); boxid = 901;//如果为零则自动成为默认头像 } PropItemInfo BoxInfo = ConfigManager.Get <PropItemInfo>(boxid); if (BoxInfo == null) { Logger.LogError("headbox datda error null id is {0}", boxid); return; } string[] mesh = BoxInfo.mesh; if (mesh != null && mesh.Length > 0) { AtlasHelper.SetShared(headbox_bottom, mesh[0]); if (mesh.Length > 1 && headbox_top != null) { AtlasHelper.SetShared(headbox_top, mesh[1]); } } else { Logger.LogError("headbox datda error" + boxid); } }
public void RefreshChangeEquipPart(EquipType equipType, PItem item = null, bool equiped = false) { data = item; this.equipType = equipType; IniteChangeEquipPart(equipType); RefreshIntentComponent(equipType); if (m_equipedImage) { m_equipedImage.gameObject.SetActive(equiped); } if (toggle) { toggle.isOn = false; } if (item == null) { return; } PropItemInfo info = ConfigManager.Get <PropItemInfo>(item.itemTypeId); RefreshPublic(info); }
private void CreateItems(List <PItem2> rList) { if (rList == null || rList.Count == 0) { return; } ClearItemCache(); Sort(rList); for (var i = 0; i < rList.Count; i++) { var item = rList[i]; if (item.num <= 0) { continue; } var itemInfo = PropItemInfo.Get(item.itemTypeId); if (!itemInfo || !itemInfo.IsValidVocation(modulePlayer.proto)) { continue; } var t = itemRoot.AddNewChild(itemTemplete); t.SafeSetActive(true); itemCache.Add(t); Util.SetItemInfo(t, itemInfo, item.level, (int)item.num, true, item.star); } }
protected override List <string> OnBuildPreloadAssets(List <string> assets = null) { base.OnBuildPreloadAssets(assets); PropItemInfo weaponInfo = ConfigManager.Get <PropItemInfo>(moduleLabyrinth.sneakPlayerDetail.fashion.weapon); LoadStateMachineEffect(assets, weaponInfo.subType, weaponInfo.ID, 0, 1); // @TODO: 尽管现在性别绑定到职业了,但逻辑上必须使用性别 LoadAllBuffAsset(assets); // enermy model var model = ConfigManager.Get <CreatureInfo>(moduleLabyrinth.lastSneakPlayer.GetProto()); if (model) { assets.AddRange(model.models); } //添加装备和时装 assets.AddRange(CharacterEquip.GetEquipAssets(moduleLabyrinth.sneakPlayerDetail.fashion)); assets.AddRange(CharacterEquip.GetAnimatorAssets(moduleLabyrinth.sneakPlayerDetail.fashion)); var pet = moduleLabyrinth.lastSneakPlayer.pet; if (pet != null && pet.itemId > 0) { var petInfo = PetInfo.Create(pet); if (petInfo != null) { Module_Battle.BuildPetPreloadAssets(assets, petInfo); } } assets.AddRange(FillLabyrithBuffAsset()); return(assets); }
public void ChangeNewFashion(PShopItem item, Creature creature) { PItem newItem = moduleEquip.GetNewPItem(item.itemTypeId, item.itemTypeId); PropItemInfo info = ConfigManager.Get <PropItemInfo>(newItem.itemTypeId); PItem containItem = m_changeFashion.Find((p) => { var _info = p.GetPropItem(); if (!_info) { return(false); } return(_info.itemType == PropType.FashionCloth && info.subType == _info.subType); }); if (containItem != null) { m_changeFashion.Remove(containItem); m_changeFashion.Add(newItem); } else { m_changeFashion.Add(newItem); } CharacterEquip.ChangeCloth(creature, m_changeFashion); changedCloth = true; }
private void SetReleaseData(RectTransform rt, PropItemInfo info) { if (info == null) { return; } Util.SetItemInfoSimple(rt, info); var now = rt.Find("slider/Text").GetComponent <Text>(); var all = rt.Find("slider/Text (2)").GetComponent <Text>(); var have = moduleCangku.GetItemCount(info.ID); Util.SetText(now, have.ToString()); var PropInfo = ConfigManager.Get <Compound>(info.compose); if (PropInfo == null) { return; } Util.SetText(all, PropInfo.sourceNum.ToString()); var fill = rt.Find("slider/fill").GetComponent <Image>(); fill.fillAmount = (float)have / (float)PropInfo.sourceNum; if (have > PropInfo.sourceNum) { fill.fillAmount = 1; } }
public void ResetRobotAttribute(PRoleAttr roleAttrs, PFashion fashion = null) { CreatureInfo originalInfo = ConfigManager.Get <CreatureInfo>(configID); if (originalInfo == null) { Logger.LogError("configID = {0} connot be loaded,please check out!!", configID); return; } CreatureInfo info = roleAttrs.ToCreatureInfo(originalInfo.Clone <CreatureInfo>()); //如果有时装的话,刷新武器数据 if (fashion != null) { PropItemInfo item = ConfigManager.Get <PropItemInfo>(fashion.weapon); if (item != null) { info.weaponID = item.subType; info.weaponItemID = item.ID; } item = ConfigManager.Get <PropItemInfo>(fashion.gun); if (item != null) { info.offWeaponID = item.subType; info.offWeaponItemID = item.ID; } } UpdateConfig(info); }
private void SetInsoulInfo()//设置入魂的信息 { //武器的id if (item == null) { return; } WeaponAttribute dInfo = ConfigManager.Get <WeaponAttribute>(item.itemTypeId); if (dInfo == null) { return; } //元素小图 AtlasHelper.SetShared(elementicongroup, m_elementData[(int)(dInfo.elementType) - 1]); AtlasHelper.SetShared(m_fill.gameObject, m_elementFill[(int)(dInfo.elementType) - 1]); AtlasHelper.SetShared(m_fillelement, m_elementIcon[(int)(dInfo.elementType) - 1]); PropItemInfo elementInfo = ConfigManager.Get <PropItemInfo>(dInfo.elementId); AtlasHelper.SetItemIcon(elementdebris, elementInfo); m_eleMaxYes.gameObject.SetActive(false); elementMax.anchoredPosition = new Vector3(0, 30, 0); ElementNext(); Element_up(); }
private void SetJumpInfo() { WeaponAttribute DeInfos = ConfigManager.Get <WeaponAttribute>(m_item.itemTypeId); if (DeInfos == null) { return; } PropItemInfo debrInfos = ConfigManager.Get <PropItemInfo>(DeInfos.debrisId);// 武器碎片信息 if (debrInfos == null) { return; } var need = 0; if (m_item.growAttr.equipAttr.star - 1 >= DeInfos.quality.Length || m_item.growAttr.equipAttr.star == 0) { Logger.LogDetail("this star is error"); return; } if (DeInfos.quality[m_item.growAttr.equipAttr.star - 1] != null) { need = DeInfos.quality[m_item.growAttr.equipAttr.star - 1].debrisNum; } moduleGlobal.SetTargetMatrial(debrInfos.ID, need); }
public int GetWeaponIndex(PropItemInfo info) { if (!info) { return(-1); } if (info.itemType == PropType.FashionCloth) { return(6); } else { switch ((WeaponSubType)info.subType) { case WeaponSubType.LongSword: return(0); case WeaponSubType.Katana: return(1); case WeaponSubType.Spear: return(2); case WeaponSubType.GiantAxe: return(3); case WeaponSubType.Gloves: return(4); case WeaponSubType.Gun: return(5); } } return(-1); }
public void UpdateCurrent(PropItemInfo value) { if (_UpdateCurrent(value) && value && m_e) { m_e.OnChanged(this); } }
public Color[] GetCurSuiteColor(PropItemInfo prop) { if (prop == null) { return(GeneralConfigInfo.defaultConfig.norRColor); } int number = 0; if (!m_suiteDic.TryGetValue(prop.suite, out number)) { return(GeneralConfigInfo.defaultConfig.norRColor); } //如果是大于4件套,显示黄色 if (number >= 4) { return(GeneralConfigInfo.defaultConfig.fourSColor); } var index = GetSuiteIndex(prop); switch (index) { case -1: return(GeneralConfigInfo.defaultConfig.norRColor); case 0: return(GeneralConfigInfo.defaultConfig.twoSOColor); case 1: return(GeneralConfigInfo.defaultConfig.twoSTColor); case 2: return(GeneralConfigInfo.defaultConfig.twoSThColor); } return(GeneralConfigInfo.defaultConfig.norRColor); }
public void RefreshHeadBoxItem(PropItemInfo info) { IniteCompent(); if (info == null) { return; } AtlasHelper.SetItemIcon(icon, info); headBox_name.text = info.itemName; var item = Module_Cangku.instance.GetItemByID(info.ID); lockBtn.SafeSetActive(item == null); if (lockBtn.gameObject.activeInHierarchy) { lockBtn.onClick.RemoveAllListeners(); lockBtn.onClick.AddListener(() => { Module_Global.instance.UpdateGlobalTip((ushort)info.ID, true, false); }); } string GetID = Util.Format("{0},{1}", Module_Player.instance.roleInfo.roleId, info.ID); int ID = PlayerPrefs.GetInt(Util.Format("{0}", GetID)); newLockImage.SafeSetActive(Module_Equip.instance.HasProp(info.ID) && (ID != info.ID && info.ID != 901) && ID != Module_Set.instance.SelectBoxID); slecton.SafeSetActive(info.ID == Module_Set.instance.SelectBoxID); }
private int GetSuiteIndex(PropItemInfo prop) { if (prop == null) { return(-1); } var index = 0; if (m_suiteDic.ContainsKey(prop.suite)) { foreach (var item in m_suiteDic) { if (item.Value < 2) { continue; } if (item.Key != prop.suite) { index++; } else { return(index); } } } return(-1); }
public void RefreshDisselectableExpItem(EvolveMaterial item, uint totalCount) { InitComponent(); m_propInfo = ConfigManager.Get <PropItemInfo>(item.propId); if (m_propInfo == null) { return; } Util.SetItemInfo(m_itemObj, m_propInfo, 0, 0, false); bool enough = totalCount >= item.num; string totalStr = enough ? totalCount.ToString() : GeneralConfigInfo.GetNoEnoughColorString(totalCount.ToString()); Util.SetText(m_countText, ConfigText.GetDefalutString(TextForMatType.EquipIntentyUI, 16), totalStr, item.num); if (m_icon) { EventTriggerListener.Get(m_icon.gameObject).onClick = (obj) => { if (m_propInfo) { Module_Global.instance.SetTargetMatrial(m_propInfo.ID, (int)item.num); } } } ; } }
public void lengthAdd(string name, PropItemInfo info, Color col, int star) { namenum.Add(name); Info.Add(info); m_color.Add(col); start.Add(star); }
private void Sort(List <PItem2> rList) { rList.Sort((l, r) => 1000 * ((PropItemInfo.Get(r.itemTypeId) != null ? PropItemInfo.Get(r.itemTypeId).quality : 0).CompareTo(PropItemInfo.Get(l.itemTypeId) != null ? PropItemInfo.Get(l.itemTypeId).quality : 0)) + 100 * ((PropItemInfo.Get(l.itemTypeId) != null ? PropItemInfo.Get(l.itemTypeId).itemType : 0).CompareTo(PropItemInfo.Get(r.itemTypeId) != null ? PropItemInfo.Get(r.itemTypeId).itemType : 0)) + 10 * ((PropItemInfo.Get(l.itemTypeId) != null ? PropItemInfo.Get(l.itemTypeId).subType : 0).CompareTo(PropItemInfo.Get(r.itemTypeId) != null ? PropItemInfo.Get(r.itemTypeId).subType : 0)) + l.itemTypeId.CompareTo(r.itemTypeId)); }
private void SetItemData(Transform node, PShopItem data) { if (data == null) { return; } PropItemInfo psi = ConfigManager.Get <PropItemInfo>(data.itemTypeId); if (psi == null) { return; } Image icon = node.Find("icon").GetComponent <Image>(); Text orderName = node.Find("title").GetComponent <Text>(); Image priceIcon = node.Find("consume/number/icon").GetComponent <Image>(); Text price = node.Find("consume/number").GetComponent <Text>(); Image newMark = node.Find("newInfo").GetComponent <Image>(); Button btnBuy = node.Find("bug_Btn").GetComponent <Button>(); Text textBtnBuy = node.Find("bug_Btn/buy_Txt").GetComponent <Text>(); Text textdesc = node.Find("des").GetComponent <Text>(); Util.SetText(textBtnBuy, ConfigText.GetDefalutString(TextForMatType.NpcDatingRest, 1)); Util.SetText(textdesc, psi.desc); //菜品描述 Util.SetText(orderName, psi.itemNameId); AtlasHelper.SetItemIcon(icon, psi); //菜品图标 PropItemInfo itemInfo = ConfigManager.Get <PropItemInfo>(data.currencyType); AtlasHelper.SetItemIcon(priceIcon, itemInfo);//设置货币的icon string strPrice = "×" + data.currencyNum; //如果是免费的,则显示免费字样 priceIcon.SafeSetActive(data.currencyNum > 0); if (data.currencyNum > 0) { Util.SetText(price, strPrice); } else { Util.SetText(price, ConfigText.GetDefalutString(TextForMatType.NpcDatingRest, 2)); //免费字样看文本 } bool enoughMoney = CheckMoney(data.currencyType, data.currencyNum); price.color = ColorGroup.GetColor(ColorManagerType.NpcDatingRestOrder, enoughMoney); newMark.SafeSetActive(data.isNew == 0); var btnIndex = btnBuy.transform.parent.GetSiblingIndex(); if (m_itemDataDic.ContainsKey(btnIndex)) { m_itemDataDic.Remove(btnIndex); } m_itemDataDic.Add(btnIndex, data); }
private bool _UpdateCurrent(PropItemInfo value) { if (m_current == value) { return(true); } var rr = !m_current && value || m_current && value && m_current.sex != value.sex; m_current = value; isSet = m_current && (m_current.subType == (int)FashionSubType.TwoPieceSuit || m_current.subType == (int)FashionSubType.FourPieceSuit); if (rr) { UpdateRenderer(value.sex); } if (!node) { return(true); } //隐藏所有子节点 if (!m_current || m_current.mesh.Length < 1) { if (type == FashionSubType.Hair) { Util.DisableAllChildren(node); } else if (type == FashionSubType.HeadDress || type == FashionSubType.HairDress || type == FashionSubType.FaceDress || type == FashionSubType.NeckDress) { SetDisableChildren(type); } return(true); } var iid = m_current.ID; var asset = isSet ? i > current.mesh.Length ? "" : m_current.mesh[i - 1] : m_current.mesh[0]; if (string.IsNullOrEmpty(asset)) { return(true); } Level.PrepareAsset <GameObject>(asset, t => { if (t && iid == currentItem && valid) { _UpdateCurrent(t, Module_Cangku.instance?.FashionShow((FashionSubType)m_current?.subType)); } if (m_e) { m_e.OnChanged(this); } }); return(false); }
//-------------------------------------------------------------------------------------- public void RefreshMainPart(EquipType equipType, PItem item = null, Action <PItem> OnPreview = null) { IniteMainCompent(equipType); data = item; this.equipType = equipType; if (item != null) { restrainId = item.itemTypeId; havePanel.gameObject.SetActive(true); if (empty) { empty.gameObject.SetActive(false); } PropItemInfo propInfo = ConfigManager.Get <PropItemInfo>(item.itemTypeId); if (propInfo == null) { return; } RefreshPublic(propInfo); //refresh intent if (equipType == EquipType.Weapon || equipType == EquipType.Gun || equipType == EquipType.Cloth) { RefreshIntentComponent(equipType); intentifyOrDetail_btn.onClick.RemoveAllListeners(); intentifyOrDetail_btn.onClick.AddListener(() => { OnPreview?.Invoke(item); }); } else { intentifyOrDetail_btn.SetInteractable(true); intentifyOrDetail_text.text = "详情"; intentifyOrDetail_btn.onClick.RemoveAllListeners(); intentifyOrDetail_btn.onClick.AddListener(() => { Module_Global.instance.UpdateGlobalTip(item.itemTypeId); }); } } else//空位栏显示--仅有配饰才会没有 { if (empty) { empty.gameObject.SetActive(true); empty_text.text = ConfigText.GetDefalutString(TextForMatType.EquipUIText, 9); } havePanel.gameObject.SetActive(false); intentifyOrDetail_text.text = "详情"; intentifyOrDetail_btn.onClick.RemoveAllListeners(); intentifyOrDetail_btn.SetInteractable(false); } }
private void SetheadInfo(RectTransform rt, PropItemInfo info) { HeadBoxItme item = rt.gameObject.transform.gameObject.GetComponentDefault <HeadBoxItme>(); if (item != null && info != null) { item.RefreshHeadBoxItem(info); } }
private void Refresh(ushort itemTypeId, bool drop, PItem item = null, int haveNum = -1, bool showStar = false) { m_petSkill?.gameObject.SetActive(false); var info = PropItemInfo.Get(itemTypeId); if (info == null) { return; } int count = (int)Module_Player.instance.GetCount(itemTypeId); if (item != null) { count = Module_Cangku.instance.GetItemCount(item.itemId); } if (haveNum != -1) { count = haveNum; } Util.SetItemInfo(wupin, info, 0, count); var ct = wupin.GetComponent <Text>("numberdi/count"); ct.gameObject.SetActive(count > 0); Util.SetText(ct, ConfigText.GetDefalutString(204, 30), count); var TextInfo = ConfigManager.Get <ConfigText>(info.desc); tip_text.text = TextInfo ? TextInfo.text[0].Replace("\\n", "\n") : string.Empty; m_rTime.transform.parent.gameObject.SetActive(false); dropBtn.gameObject.SetActive(false); var dropOpen = Module_Guide.instance.HasFinishGuide(GeneralConfigInfo.defaultConfig.dropOpenID); if (drop && dropOpen) { Module_Global.instance.m_dropList = Module_Global.instance.GetDropJump(itemTypeId); dropBtn.gameObject.SetActive(Module_Global.instance.m_dropList != null && Module_Global.instance.m_dropList.Count > 0); dropBtn.onClick.RemoveAllListeners(); if (showStar) { dropBtn.onClick.AddListener(NormalJumpClick); } else { dropBtn.onClick.AddListener(JumpClick); } } cancle_btn.onClick.RemoveAllListeners(); cancle_btn.onClick.AddListener(() => { Destroy(this); }); }
public string GetRomaString(PropItemInfo prop) { if (prop == null) { return(""); } var index = prop.subType - 1 < 0 ? 0 : prop.subType - 1; return(Util.GetString(10103, index)); }
private void CloseInfo(PExpendItem[] expend, int throughTimes) { GeneralConfigInfo generalInfo = GeneralConfigInfo.defaultConfig; if (generalInfo == null) { Logger.LogError("pet time is null"); return; } var remainTimes = 0; if (Module_Home.instance.LocalPetInfo != null) { remainTimes = Module_Home.instance.LocalPetInfo.times; } var sysnText = pettask_txt[10] + remainTimes + pettask_txt[9]; Util.SetText(m_restTimes, sysnText); sureopen.onClick.RemoveAllListeners(); sureopen.onClick.AddListener(() => { Module_Home.instance.Opentask(); }); if (expend.Length == 0) { Logger.LogDetail("NO expend"); m_expendTip.gameObject.SetActive(false); return; } m_expendTip.gameObject.SetActive(true); int propid = expend[0].expendid; int propnum = expend[0].expendnum; PropItemInfo item = ConfigManager.Get <PropItemInfo>(propid);//id 是1 或者2 if (item == null) { Logger.LogError("expend prop is null"); m_expendTip.gameObject.SetActive(false); return; } AtlasHelper.SetItemIcon(costimage, item); int num = (int)Module_Player.instance.roleInfo.diamond; if (propid == 1) { num = (int)Module_Player.instance.roleInfo.coin; } var synthetic = "×" + propnum.ToString() + pettask_txt[8] + num + pettask_txt[9]; Util.SetText(havenum, synthetic); }
/// <summary> /// 设置指定道具图标到目标 /// </summary> /// <param name="i">目标对象</param> /// <param name="item">道具</param> /// <param name="onComplete">设置结束回调</param> /// <param name="useNativeSize">是否使用原始尺寸</param> public static void SetItemIcon(Image i, PropItemInfo item, Action <UIAtlasTarget> onComplete = null, bool useNativeSize = false) { if (item && item.itemType == PropType.Currency && string.IsNullOrEmpty(item.icon)) { SetCurrencyIcon(i, (CurrencySubType)item.subType, onComplete, useNativeSize); } else { UIAtlasTarget.SetSprite(i, !item ? null : item.itemType == PropType.Rune ? Rune : Icons, item ? item.icon : null, onComplete, useNativeSize); } }
public static PetInfo Create(PropItemInfo rConfig) { var res = new PetInfo(); res._grade = 1; res._level = 1; res._exp = 0; res._status = 0; res.CPetInfo = rConfig; return(res); }