//主面板显示-查看物品详情 public void OnShow(int itemID, int x, int y) { nowEquipPart = EquipPart.None; titleText.text = "物品信息"; goRt.sizeDelta = new Vector2(712f - 232f - 238f, 520f); listRt.sizeDelta = new Vector2(0, 450f); numText.text = ""; HideFuncBtn(4); closeBtn.GetComponent <RectTransform>().localScale = Vector3.zero; if (itemID == -1) { UpdateInfo(null); } else { UpdateInfo(gc.itemDic[itemID]); } HideBatch(); SetAnchoredPosition(x, y); GetComponent <CanvasGroup>().alpha = 1f; GetComponent <CanvasGroup>().blocksRaycasts = true; transform.SetAsLastSibling(); isShow = true; }
public bool OnEquipPartsChanged(EquipWear equipWear, EquipPart equipPart, int suitTag) { bool hasConflt = equipWear.HasConflictEquip((int)conflit, (int)equipPart, suitTag); switch (op) { case ConflitOp.REMOVE: return(hasConflt); case ConflitOp.HIDE: if (skiGo.activeSelf == hasConflt) { skiGo.SetActive(!hasConflt); } break; case ConflitOp.SHOW: if (skiGo.activeSelf != hasConflt) { skiGo.SetActive(hasConflt); } break; } return(false); }
public void PutOn(EquipPart epart, string equipRes, System.Action <ObjBase> cb) { Equip equip = GetEquip(epart); if (null != equip) { if (equip.res == equipRes) { return; } PutOff(epart); } equip = new Equip(equipRes, epart); int epartInt = (int)epart; putOns.Add(epartInt, equip); equip.Load(() => { Equip loadedeEquip = GetEquip(epart); if (loadedeEquip == equip) { PutOn(equip, epartInt); } if (cb != null) { cb(loadedeEquip); } }); }
/// <summary> /// 增加装备 /// </summary> /// <param name="equip"></param> public void AddEquip(EquipData equip) { _allData = null; if (_id.ContainsKey(equip.md5)) { _id[equip.md5] = equip; } else { _id.Add(equip.md5, equip); } EquipPart part = (EquipPart)equip.JsonData.EquiPrat; if (_type.ContainsKey(part)) { if (!_type[part].Contains(equip.md5)) { _type[part].Add(equip.md5); } } else { List <string> values = new List <string>() { equip.md5, }; _type.Add(part, values); } }
//主面板显示-地区库房查询 public void OnShow(short districtID, int x, int y, byte col) { nowDistrictID = districtID; nowEquipPart = EquipPart.None; if (districtID != -1) { titleText.text = "鉴定仓库[" + gc.districtDic[districtID].name + "]"; funcBtn[3].GetComponent <RectTransform>().localScale = Vector2.one; funcBtn[3].GetComponent <Image>().color = new Color(132 / 255f, 236 / 255f, 137 / 255f, 255 / 255f); funcBtn[3].transform.GetChild(0).GetComponent <Text>().text = "<<全部收藏"; funcBtn[3].onClick.RemoveAllListeners(); funcBtn[3].onClick.AddListener(delegate() { gc.ItemToCollectionAll(districtID); }); funcBtn[2].GetComponent <RectTransform>().localScale = Vector2.one; funcBtn[2].GetComponent <Image>().color = new Color(132 / 255f, 236 / 255f, 137 / 255f, 255 / 255f); funcBtn[2].transform.GetChild(0).GetComponent <Text>().text = "<<收藏"; funcBtn[2].onClick.RemoveAllListeners(); funcBtn[2].onClick.AddListener(delegate() { gc.ItemToCollection(nowItemID); }); funcBtn[1].GetComponent <RectTransform>().localScale = Vector2.one; funcBtn[1].GetComponent <Image>().color = new Color(243 / 255f, 160 / 255f, 135 / 255f, 255 / 255f); funcBtn[1].transform.GetChild(0).GetComponent <Text>().text = "放售>>"; funcBtn[1].onClick.RemoveAllListeners(); funcBtn[1].onClick.AddListener(delegate() { gc.ItemToGoods(nowItemID); }); funcBtn[0].GetComponent <RectTransform>().localScale = Vector2.one; funcBtn[0].GetComponent <Image>().color = new Color(243 / 255f, 160 / 255f, 135 / 255f, 255 / 255f); funcBtn[0].transform.GetChild(0).GetComponent <Text>().text = "全部放售>>"; funcBtn[0].onClick.RemoveAllListeners(); funcBtn[0].onClick.AddListener(delegate() { gc.ItemToGoodsAll(districtID); }); } else { titleText.text = "收藏仓库"; funcBtn[0].GetComponent <RectTransform>().localScale = Vector2.one; funcBtn[0].GetComponent <Image>().color = new Color(243 / 255f, 160 / 255f, 135 / 255f, 255 / 255f); funcBtn[0].transform.GetChild(0).GetComponent <Text>().text = "出售>>"; funcBtn[0].onClick.RemoveAllListeners(); funcBtn[0].onClick.AddListener(delegate() { gc.ItemSales(nowItemID); }); funcBtn[1].GetComponent <RectTransform>().localScale = Vector2.one; funcBtn[1].GetComponent <Image>().color = new Color(243 / 255f, 160 / 255f, 135 / 255f, 255 / 255f); funcBtn[1].transform.GetChild(0).GetComponent <Text>().text = "批量出售>>"; funcBtn[1].onClick.RemoveAllListeners(); funcBtn[1].onClick.AddListener(delegate() { ShowBatch("sale"); }); HideFuncBtn(2); } closeBtn.GetComponent <RectTransform>().localScale = Vector3.one; UpdateAllInfo(districtID, col); HideBatch(); SetAnchoredPosition(x, y); GetComponent <CanvasGroup>().alpha = 1f; GetComponent <CanvasGroup>().blocksRaycasts = true; transform.SetAsLastSibling(); isShow = true; }
public Equip GetEquip(EquipPart epart) { int epartId = (int)epart; if (putOns.ContainsKey(epartId)) { return(putOns[epartId]); } return(null); }
/// <summary> /// 穿戴装备 /// </summary> public void TakeEquip(EquipData equip, HeroData hero) { if (equip.HeroId != 0) { return; } EquipPart part = equip.JsonData.EquiPrat; hero[0, PartToIndex(part)] = equip.md5; equip.HeroId = hero.HeroId; }
public void Init(GameObject objRoot) { m_equipPart = (EquipPart)Player.Instance.GetPart(emPartType.emPart_Equip); m_gridView = objRoot.gameObject.GetComponent <UIGridView>(); if (m_gridView == null) { m_gridView = objRoot.gameObject.AddComponent <UIGridView>(); } m_gridView.Init(); m_gridView.DataSource = this; m_gridView.ViewDelegate = this; }
/// <summary> /// 获取指定类型的装备 /// </summary> /// <param name="part"></param> /// <returns></returns> public EquipData[] GetEquipByPart(EquipPart part) { List <string> md5s; _type.TryGetValue(part, out md5s); if (md5s == null) { return(null); } EquipData[] ret = new EquipData[md5s.Count]; GetSpecifyEquip(_type[part].ToArray(), ref ret); return(ret); }
private int GetType(EquipPart part, HeroData heroData) { switch (part) { case EquipPart.Body: case EquipPart.Shoes: case EquipPart.Helmet: return(heroData.JsonData.armortpye); case EquipPart.Weapon: return(heroData.JsonData.weapontype); default: return(0); } }
public bool OnEquipPartsChanged(EquipWear equipWear, EquipPart equipPart) { if (null == skis) { return(false); } bool ret = false; foreach (var ski in skis) { if (ski.OnEquipPartsChanged(equipWear, equipPart, suitTag)) { ret = true; } } return(ret); }
private string HasCanDress(EquipPart part, int heroType) { EquipData[] equips = EquipMgr.GetSingleton().GetEquipByPart(part); if (equips == null) { return(""); } for (int i = 0; i < equips.Length; ++i) { int type = equips[i].JsonData.Type; bool dress = part == EquipPart.Weapon ? type == heroType : type <= heroType; if (equips[i].HeroId == 0 && dress) { return(equips[i].md5); } } return(""); }
public void PutOff(EquipPart epart) { if (null == allBones) { return; } int epartInt = (int)epart; if (putOns.ContainsKey(epartInt)) { Equip equip = putOns[epartInt]; equip.PutOff(); equip.Release(); EnableOriginPart(epartInt, true); putOns.Remove(epartInt); OnEquipPartsChanged(epartInt, false); } }
public void SetView(HeroData heroData) { dontTakePart.Clear(); EquipData[] equips = heroData.GetEquip(); for (int i = 0; i < partDic.Count; ++i) { EquipData data = equips[i]; EquipPart part = (EquipPart)(i + 1); if (data == null) { dontTakePart.Add(part); partDic[part].image.gameObject.SetActive(false); partDic[part].level.text = ""; continue; } partDic[part].image.gameObject.SetActive(true); EventListener.Get(partArray[i].image.gameObject).OnClick = e => { if (data == null) { return; } UIFace.GetSingleton().Open(UIID.StrengthenTip, data); }; if (partDic.ContainsKey(part)) { int id = JsonMgr.GetSingleton().GetItemConfigByID(data.EquipId).icon; partDic[part].image.sprite = ResourceMgr.Instance.LoadSprite(id); partDic[part].level.text = data.StrengthenLv > 0 ? "+" + data.StrengthenLv : ""; if (partDic[part].floor != null) { partDic[part].floor.SetAlpha(data.StrengthenLv); } } } for (int i = 0; i < dontTakePart.Count; i++) { string md5 = EquipMgr.GetSingleton().TestCanDress(dontTakePart[i], heroData); partDic[dontTakePart[i]].cr.SetAlpha(md5 != "" ? 1 : 0); } }
public void EquipPart(EquipPart part) { fashionList = new List <FashionPositionInfo>(); FashionPositionInfo fpi = new FashionPositionInfo(); fpi.fasionID = 0; fpi.presentName = "0"; fpi.replace = false; fpi.equipName = ""; for (int i = 0; i < part.partPath.Length; ++i) //length = 8 { string path = part.partPath[i]; if (string.IsNullOrEmpty(path)) { path = XEquipUtil.GetDefaultPath((EPartType)i, (entity as NativeRole).defEquip); } fpi.equipName = path; fashionList.Add(fpi); } EquipAll(fashionList.ToArray()); }
//主面板显示-选择强化装备 public void OnShowByChoose(string type, int buidingID, int x, int y) { nowDistrictID = -1; nowEquipPart = EquipPart.None; titleText.text = "物品选择"; funcBtn[0].GetComponent <RectTransform>().localScale = Vector2.one; funcBtn[0].GetComponent <Image>().color = new Color(243 / 255f, 160 / 255f, 135 / 255f, 255 / 255f); funcBtn[0].transform.GetChild(0).GetComponent <Text>().text = "选择"; funcBtn[0].onClick.RemoveAllListeners(); funcBtn[0].onClick.AddListener(delegate() { if (type == "strengthen") { BuildingPanel.Instance.strengthenTargetID = nowItemID; BuildingPanel.Instance.UpdateStrengthenPart(gc.buildingDic[buidingID]); } else if (type == "inlay") { BuildingPanel.Instance.inlayTargetID = nowItemID; BuildingPanel.Instance.UpdateInlayPart(gc.buildingDic[buidingID]); } isChooseTarget = false; OnHide(); }); HideFuncBtn(3); closeBtn.GetComponent <RectTransform>().localScale = Vector3.one; UpdateAllInfo(-1, 2); HideBatch(); SetAnchoredPosition(x, y); GetComponent <CanvasGroup>().alpha = 1f; GetComponent <CanvasGroup>().blocksRaycasts = true; transform.SetAsLastSibling(); isShow = true; }
//主面板显示-角色装备操作 public void OnShow(int heroID, EquipPart equipPart, int x, int y) { nowEquipPart = equipPart; titleText.text = "物品选择"; funcBtn[0].GetComponent <RectTransform>().localScale = Vector2.one; funcBtn[0].GetComponent <Image>().color = new Color(229 / 255f, 181 / 255f, 105 / 255f, 255 / 255f); funcBtn[0].transform.GetChild(0).GetComponent <Text>().text = "装备"; funcBtn[0].onClick.RemoveAllListeners(); funcBtn[0].onClick.AddListener(delegate() { gc.HeroEquipSet(heroID, equipPart, nowItemID); }); HideFuncBtn(3); closeBtn.GetComponent <RectTransform>().localScale = Vector3.one; UpdateAllInfoToEquip(equipPart); HideBatch(); SetAnchoredPosition(x, y); GetComponent <CanvasGroup>().alpha = 1f; GetComponent <CanvasGroup>().blocksRaycasts = true; transform.SetAsLastSibling(); isShow = true; }
private void Preview(EquipPart part) { //1.mesh collection List <CombineInstance> ciList = new List <CombineInstance>(); Texture[] m_tex = new Texture[8]; DefaultEquip.RowData data = XTableMgr.GetTable <DefaultEquip>().GetByUID(m_profession + 1); string name = ""; for (int i = 0; i < part.partPath.Length; ++i) { string path = part.partPath[i]; CombineInstance ci = new CombineInstance(); if (string.IsNullOrEmpty(path)) { path = XEquipUtil.GetDefaultPath((EPartType)i, data); } else if (name == "") { int index = path.LastIndexOf("_"); if (index >= 0) { name = path.Substring(0, index); } } if (!string.IsNullOrEmpty(path)) { path = "Assets/Resources/Equipments/" + path; Mesh mesh = AssetDatabase.LoadAssetAtPath <Mesh>(path + AssetType.Asset); Texture tex = AssetDatabase.LoadAssetAtPath <Texture>(path + AssetType.TGA); if (mesh != null) { ci.mesh = mesh; m_tex[i] = tex; } if (ci.mesh != null) { ciList.Add(ci); } } } if (ciList.Count > 0) { if (newGo != null) { GameObject.DestroyImmediate(newGo); } string skinPrfab = "Assets/Resources/Prefabs/" + combineConfig.PrefabName[m_profession] + AssetType.Prefab; newGo = GameObject.Instantiate(AssetDatabase.LoadAssetAtPath <Object>(skinPrfab)) as GameObject; if (name != "") { newGo.name = name; } newGo.transform.localRotation = Quaternion.Euler(new Vector3(0, 180, 0)); //2.combine Transform t = newGo.transform; SkinnedMeshRenderer newSmr = t.GetComponent <SkinnedMeshRenderer>(); newSmr.sharedMesh = new Mesh(); newSmr.sharedMesh.CombineMeshes(ciList.ToArray(), true, false); //3.set material Material mat = new Material(Shader.Find("Custom/Skin/RimlightBlend8")); for (int i = 0; i < m_tex.Length; ++i) { mat.SetTexture("_Tex" + i.ToString(), m_tex[i]); } newSmr.sharedMaterial = mat; if (data.WeaponPoint != null && data.WeaponPoint.Length > 0) { string weapon = data.WeaponPoint[0].ToString(); Transform trans = newGo.transform.Find(weapon); if (trans != null) { string path = part.mainWeapon; if (string.IsNullOrEmpty(path)) { path = data.Weapon; } GameObject mainWeapon = AssetDatabase.LoadAssetAtPath <GameObject>("Assets/Resources/Equipments/" + path + AssetType.Prefab); if (mainWeapon != null) { GameObject instance = GameObject.Instantiate(mainWeapon) as GameObject; instance.transform.parent = trans; instance.transform.localPosition = Vector3.zero; instance.transform.localRotation = Quaternion.identity; instance.transform.localScale = Vector3.one; } } } } }
private int PartToIndex(EquipPart part) { return((int)part - 1); }
protected virtual void OnGUI() { m_profession = 1;//Archer if (m_FashionList == null || m_EquipList == null) { return; } //时装 GUILayout.BeginHorizontal(); GUILayout.BeginVertical(); GUILayout.BeginHorizontal(); EditorGUILayout.LabelField("时装", GUILayout.MaxWidth(100)); GUILayout.EndHorizontal(); fashionScrollPos = GUILayout.BeginScrollView(fashionScrollPos, false, false); for (int i = 0; i < m_FashionList.Count; ++i) { EquipPart part = m_FashionList[i]; for (int j = 0; j < part.suitName.Count; ++j) { GUILayout.BeginHorizontal(); EditorGUILayout.LabelField(part.suitName[j], GUILayout.MaxWidth(150)); if (j == 0) { if (GUILayout.Button("Preview", GUILayout.MaxWidth(100))) { Preview(part); } } GUILayout.EndHorizontal(); } GUILayout.Space(5); } EditorGUILayout.EndScrollView(); GUILayout.EndVertical(); //装备 GUILayout.BeginVertical(); GUILayout.BeginHorizontal(); EditorGUILayout.LabelField("装备", GUILayout.MaxWidth(100)); GUILayout.EndHorizontal(); equipScrollPos = GUILayout.BeginScrollView(equipScrollPos, false, false); List <EquipPart> currentEquipPrefession = m_EquipList; for (int i = 0; i < currentEquipPrefession.Count; ++i) { EquipPart part = currentEquipPrefession[i]; for (int j = 0; j < part.suitName.Count; ++j) { GUILayout.BeginHorizontal(); EditorGUILayout.LabelField(part.suitName[j], GUILayout.MaxWidth(200)); if (j == 0) { if (GUILayout.Button("Preview", GUILayout.MaxWidth(100))) { Preview(part); } } GUILayout.EndHorizontal(); } GUILayout.Space(5); } EditorGUILayout.EndScrollView(); GUILayout.EndVertical(); GUILayout.EndHorizontal(); }
private void Preview(EquipPart part) { role.GetComponent <XEquipComponent>().EquipPart(part); }
public void OnGUI() { GUILayout.BeginHorizontal(); GUILayout.Space(space); GUILayout.BeginVertical(); GUILayout.Label("时装"); fashionScrollPos = GUILayout.BeginScrollView(fashionScrollPos, false, false); for (int i = 0; i < m_FashionList.Count; ++i) { EquipPart part = m_FashionList[i]; for (int j = 0; j < part.suitName.Count; ++j) { GUILayout.BeginHorizontal(); GUILayout.Label(part.suitName[j], GUILayout.MaxWidth(150)); if (j == 0) { if (GUILayout.Button("Preview", GUILayout.MaxWidth(100))) { Preview(part); } } GUILayout.EndHorizontal(); } GUILayout.Space(5); } GUILayout.EndScrollView(); GUILayout.EndVertical(); GUILayout.Space(space); GUILayout.BeginVertical(); GUILayout.Label("装备"); equipScrollPos = GUILayout.BeginScrollView(equipScrollPos, false, false); for (int i = 0; i < m_EquipList.Count; ++i) { EquipPart part = m_EquipList[i]; for (int j = 0; j < part.suitName.Count; ++j) { GUILayout.BeginHorizontal(); GUILayout.Label(part.suitName[j], GUILayout.MaxWidth(200)); if (j == 0) { if (GUILayout.Button("Preview", GUILayout.MaxWidth(100))) { Preview(part); } } GUILayout.EndHorizontal(); } GUILayout.Space(5); } GUILayout.EndScrollView(); GUILayout.EndVertical(); GUILayout.Space(space); GUILayout.BeginVertical(); GUILayout.Label("动作"); for (int i = 0, max = anims.Length; i < max; i++) { if (GUILayout.Button(anims[i])) { role.GetComponent <XAnimComponent>().SetTrigger(anims[i]); } } GUILayout.Space(10); GUILayout.Label("武器"); for (int i = 0, max = weapons.Length; i < max; i++) { if (GUILayout.Button(weapons[i])) { role.GetComponent <XEquipComponent>().AttachWeapon(weapons[i]); } } GUILayout.Space(10); GUILayout.Label("发型"); for (int i = 0, max = colors.Length; i < max; i++) { if (GUILayout.Button(colors[i].ToString())) { role.GetComponent <XEquipComponent>().ChangeHairColor(colors[i]); } } GUILayout.EndVertical(); GUILayout.EndHorizontal(); }
public Equip(string res, EquipPart epart) { this.res = res; this.epart = epart; }
/// <summary> /// 注册部件 /// </summary> protected virtual void registParts() { _list = new PlayerBasePart[17]; int i = 0; system = new SystemPart(); system.setMe(this); _list[i++] = system; func = new FuncPart(); func.setMe(this); _list[i++] = func; activity = new ActivityPart(); activity.setMe(this); _list[i++] = activity; role = new RolePart(); role.setMe(this); _list[i++] = role; scene = new ScenePart(); scene.setMe(this); _list[i++] = scene; character = new CharacterPart(); character.setMe(this); _list[i++] = character; social = new SocialPart(); social.setMe(this); _list[i++] = social; bag = new BagPart(); bag.setMe(this); _list[i++] = bag; mail = new MailPart(); mail.setMe(this); _list[i++] = mail; quest = new QuestPart(); quest.setMe(this); _list[i++] = quest; guide = new GuidePart(); guide.setMe(this); _list[i++] = guide; friend = new FriendPart(); friend.setMe(this); _list[i++] = friend; equip = new EquipPart(); equip.setMe(this); _list[i++] = equip; team = new TeamPart(); team.setMe(this); _list[i++] = team; union = new UnionPart(); union.setMe(this); _list[i++] = union; achievement = new AchievementPart(); achievement.setMe(this); _list[i++] = achievement; pet = new PetPart(); pet.setMe(this); _list[i++] = pet; }
public static void MakeEquip(string name, int[] fashionIDs, List <EquipPart> equipList, TempEquipSuit tmpFashionData, int suitID) { FashionList fashionList = XTableMgr.GetTable <FashionList>(); if (fashionIDs != null) { tmpFashionData.hash = 0; tmpFashionData.data.Clear(); bool threePart = false; for (int i = 0; i < fashionIDs.Length; ++i) { int fashionID = fashionIDs[i]; FashionList.RowData row = fashionList.GetByUID(fashionID); if (row != null) { List <ThreePart> tpLst = new List <ThreePart>(); if (row.EquipPos == 7 || row.EquipPos == 8 || row.EquipPos == 9) { ThreePart tp = FindThreePart(suitID, tpLst); if (row.EquipPos == 9) { tp.part[2] = row.ModelPrefabArcher; } threePart = true; } else { if (row.ReplaceID != null && row.ReplaceID.Length > 1) { FashionList.RowData replace = fashionList.GetByUID(row.ReplaceID[1]); if (replace != null) { if (replace.EquipPos == row.EquipPos) { row = replace; } } } string path = row.ModelPrefabArcher; if (!string.IsNullOrEmpty(path)) { Hash(ref tmpFashionData.hash, path); TempEquipData data = new TempEquipData(); data.row = row; data.path = path; tmpFashionData.data.Add(data); } } } } if (threePart) { return; } bool findSame = false; TempEquipSuit suit = tmpFashionData; if (suit.hash == 0) { return; } for (int j = 0; j < equipList.Count; ++j) { EquipPart part = equipList[j]; if (part != null && part.hash == suit.hash) { part.suitName.Add(name); findSame = true; break; } } if (!findSame) { EquipPart part = new EquipPart(); part.hash = suit.hash; part.suitName.Add(name); for (int j = 0; j < suit.data.Count; ++j) { TempEquipData data = suit.data[j]; int partPos = ConvertPart(data.row.EquipPos); if (partPos < part.partPath.Length) { part.partPath[partPos] = data.path; } else if (partPos == part.partPath.Length) { part.mainWeapon = data.path; } } equipList.Add(part); } } }
//物品列表-角色装备操作-更新 public void UpdateListToEquip(EquipPart equipPart, byte columns) { List <ItemObject> itemObjects = new List <ItemObject>(); foreach (KeyValuePair <int, ItemObject> kvp in gc.itemDic) { if (kvp.Value.districtID == -1 && kvp.Value.heroID == -1)//在收藏库 并且没被英雄装备 { switch (equipPart) { case EquipPart.Weapon: if (DataManager.mItemDict[kvp.Value.prototypeID].TypeBig == ItemTypeBig.Weapon) { itemObjects.Add(kvp.Value); } break; case EquipPart.Subhand: if (DataManager.mItemDict[kvp.Value.prototypeID].TypeBig == ItemTypeBig.Subhand) { itemObjects.Add(kvp.Value); } break; case EquipPart.Head: if ((DataManager.mItemDict[kvp.Value.prototypeID].TypeSmall == ItemTypeSmall.HeadH || DataManager.mItemDict[kvp.Value.prototypeID].TypeSmall == ItemTypeSmall.HeadL)) { itemObjects.Add(kvp.Value); } break; case EquipPart.Body: if ((DataManager.mItemDict[kvp.Value.prototypeID].TypeSmall == ItemTypeSmall.BodyH || DataManager.mItemDict[kvp.Value.prototypeID].TypeSmall == ItemTypeSmall.BodyL)) { itemObjects.Add(kvp.Value); } break; case EquipPart.Hand: if ((DataManager.mItemDict[kvp.Value.prototypeID].TypeSmall == ItemTypeSmall.HandH || DataManager.mItemDict[kvp.Value.prototypeID].TypeSmall == ItemTypeSmall.HandL)) { itemObjects.Add(kvp.Value); } break; case EquipPart.Back: if ((DataManager.mItemDict[kvp.Value.prototypeID].TypeSmall == ItemTypeSmall.BackH || DataManager.mItemDict[kvp.Value.prototypeID].TypeSmall == ItemTypeSmall.BackL)) { itemObjects.Add(kvp.Value); } break; case EquipPart.Foot: if ((DataManager.mItemDict[kvp.Value.prototypeID].TypeSmall == ItemTypeSmall.FootH || DataManager.mItemDict[kvp.Value.prototypeID].TypeSmall == ItemTypeSmall.FootL)) { itemObjects.Add(kvp.Value); } break; case EquipPart.Neck: if (DataManager.mItemDict[kvp.Value.prototypeID].TypeSmall == ItemTypeSmall.Neck) { itemObjects.Add(kvp.Value); } break; case EquipPart.Finger1: if (DataManager.mItemDict[kvp.Value.prototypeID].TypeSmall == ItemTypeSmall.Finger) { itemObjects.Add(kvp.Value); } break; case EquipPart.Finger2: if (DataManager.mItemDict[kvp.Value.prototypeID].TypeSmall == ItemTypeSmall.Finger) { itemObjects.Add(kvp.Value); } break; } } } if (columns == 2) { goRt.sizeDelta = new Vector2(712f, 520f); listRt.sizeDelta = new Vector2(470f, 450f); } else if (columns == 1) { goRt.sizeDelta = new Vector2(712f - 232f, 520f); listRt.sizeDelta = new Vector2(470f - 232f, 450f); } GameObject go; for (int i = 0; i < itemObjects.Count; i++) { if (i < itemGoPool.Count) { go = itemGoPool[i]; itemGoPool[i].transform.GetComponent <RectTransform>().localScale = Vector2.one; } else { go = Instantiate(Resources.Load("Prefab/UILabel/Label_Item")) as GameObject; go.transform.SetParent(itemListGo.transform); itemGoPool.Add(go); } int row = i == 0 ? 0 : (i % columns); int col = i == 0 ? 0 : (i / columns); go.GetComponent <RectTransform>().anchoredPosition = new Vector2(4f + row * 224f, -4 + col * -22f); go.transform.GetChild(0).GetComponent <Image>().sprite = Resources.Load <Sprite>("Image/ItemPic/" + itemObjects[i].pic); go.transform.GetChild(1).GetComponent <Text>().text = "<color=#" + gc.OutputItemRankColorString(itemObjects[i].rank) + ">" + itemObjects[i].name + (itemObjects[i].level == 0 ? "" : (" +" + itemObjects[i].level)) + "</color>"; go.transform.GetComponent <InteractiveLabel>().index = itemObjects[i].objectID; go.transform.GetComponent <InteractiveLabel>().labelType = LabelType.ItemToSet; int index = i; go.transform.GetComponent <Button>().onClick.AddListener(delegate() { nowItemID = itemObjects[index].objectID; UpdateInfo(gc.itemDic[itemObjects[index].objectID]); HeroPanel.Instance.UpdateFightInfo(gc.heroDic[HeroPanel.Instance.nowSelectedHeroID], ItemListAndInfoPanel.Instance.nowEquipPart, gc.itemDic[itemObjects[index].objectID], 1); }); } for (int i = itemObjects.Count; i < itemGoPool.Count; i++) { itemGoPool[i].transform.GetComponent <RectTransform>().localScale = Vector2.zero; } itemListGo.transform.GetComponent <RectTransform>().sizeDelta = new Vector2(157f, Mathf.Max(425f, 4 + (itemObjects.Count / columns) * 22f)); numText.text = itemObjects.Count.ToString(); }
//默认信息更新-角色装备操作 public void UpdateAllInfoToEquip(EquipPart equipPart) { UpdateListToEquip(equipPart, 1); UpdateInfo(null); }
public void EquipItem(EquipmentItemData item, EquipPart part) { if (item.info.category != Character.ItemPartMap [part]) { throw new System.Exception("can not equip " + item.info.name + " on " + part.ToString() + ", not proper item part"); } item.part = part; equipments [(int)part] = item; }
/// <summary> /// 检测是否有可以穿戴的装备 /// </summary> /// <param name="part">部位</param> /// <param name="heroType">没有限制填0</param> /// <returns></returns> public string TestCanDress(EquipPart part, HeroData heroData) { int dress = GetType(part, heroData); return(HasCanDress(part, dress)); }