public FashionInfo(int _id, int _own, int _put, RemainTime _time) { fashionData = new FashionServerData(); fashionData.id = _id; fashionData.isOwn = _own; fashionData.isPut = _put; fashionData.remainTime = _time; // skillData.rune_use = _curRune; }
/// <summary> /// 获得公会战剩余时间 /// </summary> /// <param name="_pt"></param> public void S2C_GetGuildFightRemainTime(Pt _pt) { pt_guild_battle_rest_time_d695 pt = _pt as pt_guild_battle_rest_time_d695; if (pt != null) { RemainTime t = new RemainTime(pt.time, Time.time); remainTime = t; //Debug.Log("收到公会战剩余时间"+t.remainTime); if (OnGetGuildFightTimeUpdate != null) { OnGetGuildFightTimeUpdate(); } } }
/// <summary> /// 获得穿上的时装 /// </summary> /// <param name="_pt"></param> protected void S2C_PutFashion(Pt _pt) { pt_updata_model_clothes_d414 pt = _pt as pt_updata_model_clothes_d414; if (pt != null) { RemainTime time = null; if (pt.time > 0) { time = new RemainTime(pt.time, Time.time); } FashionInfo F = new FashionInfo(pt.model_id); if (pt.put_state == 1) { FashionInfo fashion = new FashionInfo(pt.model_id, 1, pt.put_state, time); if (fashion.FashionType == 1) { InUseWeaponFashion = fashion; } if (fashion.FashionType == 2) { InUseClothesFashion = fashion; } } if (pt.put_state == 0) { if (F.FashionType == 1) { InUseWeaponFashion = null; } if (F.FashionType == 2) { InUseClothesFashion = null; } } GameCenter.mainPlayerMng.MainPlayerInfo.UpdateEquipment(F.Item, (pt.put_state == 1)); //eid为时装的物品表ID } //if (OnUpdateFashion != null) { // OnUpdateFashion (); //} if (OnChangeTargetFashion != null) { OnChangeTargetFashion(); } }
private IEnumerator UpdateTimeCoroutine(float frequency) //0.1f { RemainTime = _startTime; SetText(RemainTime < 10 ? "0" + RemainTime.ToString() : RemainTime.ToString(), ":", "0"); while (RemainTime > 0) { yield return(new WaitForSeconds(frequency)); RemainTime -= frequency; int remainSec = (int)Mathf.Floor(RemainTime + 0.01f); //+0.01f для исправления погрешности float int remainMs = MathfUtils.FracDecimalToCeil(RemainTime); SetText(remainSec < 10 ? "0" + remainSec.ToString() : remainSec.ToString(), ":", remainMs.ToString()); } if (RemainTime <= 0) { SetText("00", ":", "0"); } }
public void Tick() { RemainTime = RemainTime.Add(TimeSpan.FromSeconds(1)); OnPropertyChanged("Display"); }
/// <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); }