private void OnMsg_GetSummSkinList(MobaMessage msg) { SkinPanel componentInChildren = this.tranSkinParent.gameObject.GetComponentInChildren <SkinPanel>(); if (componentInChildren != null && !string.IsNullOrEmpty(this.heroNPC)) { componentInChildren.RefreshUISkinPanel(this.heroNPC); componentInChildren.ReFreshPrice(this.heroID, this.skinID); } SkinPanel.IsWearSkin(this.heroID, this.skinID); }
private void OnMsg_SkinWear(MobaMessage msg) { if (msg.Param == null || null == this.tranSkinParent) { return; } int num = (int)msg.Param; if (this.skinID == num) { SkinPanel componentInChildren = this.tranSkinParent.gameObject.GetComponentInChildren <SkinPanel>(); SkinPanel.IsWearSkin(this.heroID, this.skinID); componentInChildren.SetWearBtnState(this.heroID, this.skinID); } }
public bool IsWear(long heroid, int skinid) { return(SkinPanel.IsWearSkin(heroid, skinid)); }
public void setHeroName(string heroId, long heroid, int skinId = 0, bool isSame = false) { if (Singleton <PvpSelectHeroView> .Instance.gameObject != null && Singleton <PvpSelectHeroView> .Instance.gameObject.activeInHierarchy) { Singleton <PropertyView> .Instance.HeroNpc = heroId; } this.list_goodsdata.Clear(); this.list_goodsdata.AddRange(ModelManager.Instance.Get_ShopGoodsList()); if (this.list_goodsdata == null) { return; } string price = null; List <GoodsData> list = new List <GoodsData>(); list = this.list_goodsdata.FindAll((GoodsData obj) => obj.Type == 2); List <GoodsData> list2 = new List <GoodsData>(); if (list == null) { return; } list2 = list.FindAll((GoodsData obj) => obj.ElementId == skinId.ToString()); if (list2 == null) { return; } if (list2.Count == 0) { price = null; } else { price = this.StringPrice(list2); } this.SetWearBtnState(heroid, skinId); this.SetBuyBtnState(skinId); this._heroName = heroId; if (this._skins == null) { this._skins = new List <Skin>(); } else { foreach (Skin current in this._skins) { UnityEngine.Object.Destroy(current.gameObject); } if (this._copy != null) { UnityEngine.Object.Destroy(this._copy.gameObject); } this._skins.Clear(); } List <SkinInfo> list3 = new List <SkinInfo>(); List <SkinInfo> list4 = new List <SkinInfo>(); SysHeroMainVo sysHeroMainVo = BaseDataMgr.instance.GetDicByType <SysHeroMainVo>()[heroId] as SysHeroMainVo; SysGameResVo sysGameResVo = BaseDataMgr.instance.GetDicByType <SysGameResVo>()[sysHeroMainVo.Loading_icon] as SysGameResVo; Texture tex = CachedRes.getTex(sysGameResVo.path); list4.Add(new SkinInfo(tex, this.GetSkinPrice(0))); if (sysHeroMainVo.skin_id != "[]") { int[] stringToInt = StringUtils.GetStringToInt(sysHeroMainVo.skin_id, ','); if (skinId == 0) { list3.Add(new SkinInfo(tex, this.GetSkinPrice(0))); int[] array = stringToInt; int id; for (int i = 0; i < array.Length; i++) { id = array[i]; if (list != null) { list2 = list.FindAll((GoodsData obj) => obj.ElementId == id.ToString()); if (list2 == null || list2.Count == 0) { price = null; } else { price = this.StringPrice(list2); } } list3.Add(new SkinInfo(id, this.ParsePrice(price), SkinPanel.IsPossessSkinId(id) || SkinPanel.IsWearSkin(heroid, id))); } } else { list3.Add(new SkinInfo(skinId, this.ParsePrice(price), SkinPanel.IsPossessSkinId(skinId) || SkinPanel.IsWearSkin(heroid, skinId))); int[] array2 = stringToInt; int it2; for (int j = 0; j < array2.Length; j++) { it2 = array2[j]; if (list != null) { list2 = list.FindAll((GoodsData obj) => obj.ElementId == it2.ToString()); if (list2 == null || list2.Count == 0) { price = null; } else { price = this.StringPrice(list2); } } if (it2 > skinId) { list3.Add(new SkinInfo(it2, this.ParsePrice(price), SkinPanel.IsPossessSkinId(it2) || SkinPanel.IsWearSkin(heroid, it2))); } } if (!list3.Contains(list3.Find((SkinInfo obj) => obj.skinId == 0))) { list3.Add(new SkinInfo(tex, this.GetSkinPrice(0))); } int[] array3 = stringToInt; int it; for (int k = 0; k < array3.Length; k++) { it = array3[k]; if (list != null) { list2 = list.FindAll((GoodsData obj) => obj.ElementId == it.ToString()); if (list2 == null || list2.Count == 0) { price = null; } else { price = this.StringPrice(list2); } } if (it < skinId) { list3.Add(new SkinInfo(it, this.ParsePrice(price), SkinPanel.IsPossessSkinId(it) || SkinPanel.IsWearSkin(heroid, it))); } } } } if (!list3.Contains(list3.Find((SkinInfo obj) => obj.skinId == 0))) { list3.Add(new SkinInfo(tex, this.GetSkinPrice(0))); } this._copy = NGUITools.AddChild(base.gameObject, Skin.prefab).GetComponent <Skin>(); List <Skin> list5 = new List <Skin>(); for (int l = 0; l < list3.Count; l++) { if (!(ToolsFacade.ServerCurrentTime < new DateTime(2016, 12, 19, 0, 0, 0)) || list3[l].skinId != 102802) { Skin component = NGUITools.AddChild(base.gameObject, Skin.prefab).GetComponent <Skin>(); SkinInfo skinInfo = list3[l]; component.name = "texture:" + l; component.setSkinInfo(skinInfo, this.IsPossess(skinInfo.skinId), this.IsWear(heroid, skinInfo.skinId)); component.toAlpha = 1f; list5.Add(component); } } if (!isSame) { base.gameObject.transform.localPosition = Vector3.zero; if (list5.Count >= 2) { if (list5.Count >= 3) { base.gameObject.transform.localPosition = base.gameObject.transform.localPosition + new Vector3(-81f, -81f, 0f); } else { base.gameObject.transform.localPosition = base.gameObject.transform.localPosition + new Vector3(-45f, -81f, 0f); } } else { base.gameObject.transform.localPosition = base.gameObject.transform.localPosition + new Vector3(0f, -81f, 0f); } } for (int m = 0; m < list5.Count; m++) { this._skins.Add(list5[m]); } this._oldPoses = this._poses; Vector3 vector = new Vector3(-300f, 0f, 0f); Vector3 a = new Vector3(0f, 0f, 0f); Vector3 a2 = new Vector3(142f, 12f, 0f); float num = 0.8f; this._skins[0].toPos = vector; this._poses = new List <Vector3>(); this._alphas = new List <float>(); this._poses.Add(vector); for (int n = 0; n <= this._skins.Count; n++) { Vector3 b = a2 * (float)n; this._poses.Add(a + b); } this._scales = new List <float>(); this._scales.Add(1f); for (int num2 = 0; num2 <= this._skins.Count; num2++) { if (num2 == 0) { this._scales.Add(1f); } else { float item = (num2 < 2) ? num : (Mathf.Pow(num, (float)num2) - 0.064f); this._scales.Add(item); } } this._alphas.Add(0f); for (int num3 = 0; num3 < this._skins.Count; num3++) { if (num3 > 2) { this._alphas.Add(0f); } else { this._alphas.Add(1f / (float)(num3 + 1)); } } this._alphas.Add(0f); if (isSame && this._oldPoses != null) { this._poses = this._oldPoses; } foreach (Skin current2 in this._skins) { int index = this._skins.IndexOf(current2) + 1; current2.trans.localPosition = this._poses[index]; current2.trans.localScale = new Vector3(this._scales[index], this._scales[index], 1f); current2.SetAlpha(this._alphas[index]); } this.resetDepth(); }