void OpenWndByType() { FashionWndType _type = GameCenter.fashionMng.CurFashionWndType; for (int i = 0; i < toggles.Length; i++) { if (toggles[i].value) { _type = (FashionWndType)(i); break; } } GameCenter.fashionMng.CurFashionWndType = _type; GameCenter.fashionMng.SetCurFashionInfo(); // RefreshItems(_type); switch (_type) { case FashionWndType.CLOTHES: if (fashionObj != null) { fashionObj.SetActive(true); } if (titleObj != null) { titleObj.SetActive(false); } RefreshFashion(); break; case FashionWndType.WEAPON: if (fashionObj != null) { fashionObj.SetActive(true); } if (titleObj != null) { titleObj.SetActive(false); } RefreshFashion(); break; case FashionWndType.TITLE: if (fashionObj != null) { fashionObj.SetActive(false); } if (titleObj != null) { titleObj.SetActive(true); } RefreshTitle(); break; } }
/// <summary> /// 重置数据 /// </summary> void ResetData() { ownFashionList.Clear(); tempFashionList.Clear(); clothesFashionDic.Clear(); weaponFashionDic.Clear(); fashionDic.Clear(); cacheFashionDic.Clear(); AllAttrNum.Clear(); CurFashionWndType = FashionWndType.CLOTHES; inUseClothesFashion = null; inUseWeaponFashion = null; CurTargetFashion = null; isFirstTime = true; fashionLev = 0; fashionExp = 0; }
void RefreshFashionContainer(FashionWndType _type) { if (_type == FashionWndType.CLOTHES) { if (fashionContainer != null) { fashionContainer.transform.DestroyChildren(); fashionContainer.RefreshItems(GameCenter.fashionMng.clothesFashionList); } } else if (_type == FashionWndType.WEAPON) { if (fashionContainer != null) { fashionContainer.transform.DestroyChildren(); fashionContainer.RefreshItems(GameCenter.fashionMng.weaponFashionList); } } GameCenter.fashionMng.SetCurFashionInfo(); }
/// <summary> /// 获取所有的时装 /// </summary> /// <param name="_pt"></param> protected void S2C_GetFashionList(Pt _pt) { pt_model_clothes_list_d412 pt = _pt as pt_model_clothes_list_d412; //Debug.Log("收到时装协议"); if (pt != null) { fashionLev = pt.model_lev; fashionExp = pt.model_exp; if (fashionDic.Count < 1) { GetAllFashion(); } RefreshTemporaryFashion(); if (fashionDic != null) { //GetAllTitle (); ownFashionList.Clear(); tempFashionList.Clear(); AllAttrNum.Clear(); InUseClothesFashion = null; InUseWeaponFashion = null; } for (int i = 0; i < pt.model_list.Count; i++) { RemainTime time = null; if (pt.model_list[i].remain_time > 0) { time = new RemainTime(pt.model_list[i].remain_time, Time.time); } FashionInfo fashion = new FashionInfo(pt.model_list[i].model_id, pt.model_list[i].own_state, pt.model_list[i].put_state, time); if (!isFirstTime) { if (!cacheFashionDic.ContainsKey(fashion.FashionID)) { if (fashion.FashionType == 1) { CurFashionWndType = FashionWndType.WEAPON; } if (fashion.FashionType == 2) { CurFashionWndType = FashionWndType.CLOTHES; } GameCenter.uIMng.SwitchToSubUI(SubGUIType.SUBFASHION); } } fashionDic[fashion.FashionID] = fashion; if (pt.model_list[i].put_state == 1) { if (fashion.FashionType == 1) { InUseWeaponFashion = fashion; } if (fashion.FashionType == 2) { InUseClothesFashion = fashion; } } if (pt.model_list[i].own_state == 1) { ownFashionList.Add(fashion); } if (fashion.FashionType == 1) { weaponFashionDic[fashion.FashionID] = fashion; if (fashion.RemainTime != null) { if (fashion.TempID != 0) { if (weaponFashionDic.ContainsKey(fashion.TempID)) { weaponFashionDic.Remove(fashion.TempID); } } } else { if (fashion.ForeverTempID != 0) { if (weaponFashionDic.ContainsKey(fashion.ForeverTempID)) { weaponFashionDic.Remove(fashion.ForeverTempID); } } } } if (fashion.FashionType == 2) { clothesFashionDic[fashion.FashionID] = fashion; if (fashion.RemainTime != null) { if (fashion.TempID != 0) { if (clothesFashionDic.ContainsKey(fashion.TempID)) { clothesFashionDic.Remove(fashion.TempID); } } } else { if (fashion.ForeverTempID != 0) { if (clothesFashionDic.ContainsKey(fashion.ForeverTempID)) { clothesFashionDic.Remove(fashion.ForeverTempID); } } } } if (pt.model_list[i].remain_time > 0) { tempFashionList.Add(fashion); // Debug.Log ("时装列表发来的时间为"+pt.model_list [i].remain_time); } // Debug.Log("时装列表的长度为" + pt.model_list.Count + "时装ID为" + pt.model_list[i].model_id); cacheFashionDic[fashion.FashionID] = fashion; } if (ownFashionList.Count > 0) { for (int i = 0; i < ownFashionList.Count; i++) { for (int j = 0; j < ownFashionList[i].Attribute.Count; j++) { ActorPropertyTag act = (ActorPropertyTag)ownFashionList[i].Attribute[j].eid; AllAttrNum.Add(new AttributePair(act, ownFashionList[i].Attribute[j].count)); } } } if (tempFashionList.Count > 0) { for (int i = 0; i < tempFashionList.Count; i++) { for (int j = 0; j < tempFashionList[i].Attribute.Count; j++) { ActorPropertyTag act = (ActorPropertyTag)tempFashionList[i].Attribute[j].eid; AllAttrNum.Add(new AttributePair(act, tempFashionList[i].Attribute[j].count)); } } } } if (isFirstTime) { isFirstTime = false; } SortFashion(); if (OnUpdateFashionList != null) { OnUpdateFashionList(); } //Debug.Log("此时的衣服时装ID" + GameCenter.mainPlayerMng.MainPlayerInfo.GetServerData().clothesFashionID + "武器ID" + GameCenter.mainPlayerMng.MainPlayerInfo.GetServerData().weaponFashionID); }