/// <summary> /// 创建净数据对象 /// </summary> /// <param name="_id"></param> /// <returns></returns> public static MainEntourage CreateDummy(MercenaryInfo _info) { GameObject newGO = null; if (GameCenter.instance.dummyOpcPrefab != null) { newGO = Instantiate(GameCenter.instance.dummyOpcPrefab) as GameObject; newGO.name = "Dummy MPC [" + _info.ServerInstanceID + "]"; } else { newGO = new GameObject("Dummy MPC[" + _info.ServerInstanceID + "]"); } newGO.tag = "Entourage"; newGO.SetMaskLayer(LayerMask.NameToLayer("Entourage")); MainEntourage newMPC = newGO.AddComponent <MainEntourage>(); newMPC.isDummy_ = true; newMPC.moveFSM = newGO.AddComponent <MainEntourageMoveFSM>(); MainEntourageMoveFSM movefsm = newMPC.moveFSM as MainEntourageMoveFSM; movefsm.SetInfo(_info); newMPC.id = _info.ServerInstanceID; newMPC.actorInfo = _info; newMPC.curMoveSpeed = newMPC.actorInfo.StaticSpeed * MOVE_SPEED_BASE; newMPC.CurRealSpeed = newMPC.curMoveSpeed; newMPC.InitPos(); return(newMPC); }
public void SetInfo(MercenaryInfo _info) { MercenaryInfoData = _info; //if (qualityList.Count < 6) //{ // qualityList.Clear(); // qualityList.Add(new Color(231f / 255, 1, 232f / 255)); // qualityList.Add(new Color(110f / 255, 245f / 255, 116f / 255)); // qualityList.Add(new Color(60f / 255, 179f / 255, 1)); // qualityList.Add(new Color(189f / 255, 84f / 255, 1)); // qualityList.Add(new Color(1, 106 / 255, 44f / 255)); // qualityList.Add(new Color(1, 0, 0)); //} headIcon.spriteName = _info.Icon; powerLabel.text = _info.Power.ToString(); id = _info.ConfigId; nameLabel.text = _info.PetName; quality.color = _info.PetNameColor; //int qualityVal = _info.Aptitude; //if (qualityVal < 21) //{ // if (qualityList.Count > 0) quality.color = qualityList[0]; //} //else if (qualityVal < 41) //{ // if (qualityList.Count > 1) quality.color = qualityList[1]; //} //else if (qualityVal < 61) //{ // if (qualityList.Count > 2) quality.color = qualityList[2]; //} //else if (qualityVal < 81) //{ // if (qualityList.Count > 3) quality.color = qualityList[3]; //} //else if (qualityVal < 101) //{ // if (qualityList.Count > 4) quality.color = qualityList[4]; //} //else //{ // if (qualityList.Count > 5) quality.color = qualityList[5]; //} if (_info.IsActive == (int)PetChange.GUARD)//守护 { leaderTag.gameObject.SetActive(false); guardTag.gameObject.SetActive(true); } else if (_info.IsActive == (int)PetChange.FINGHTING)//出战 { leaderTag.gameObject.SetActive(true); guardTag.gameObject.SetActive(false); } else//没有出战状态 { leaderTag.gameObject.SetActive(false); guardTag.gameObject.SetActive(false); } }
/// <summary> /// 主玩家不需要dummy状态,因此直接创建 by吴江 /// </summary> /// <param name="_data"></param> /// <param name="_callback"></param> protected AssetMng.DownloadID Create(MercenaryInfo _data, System.Action <MainEntourage, EResult> _callback) { return(exResources.GetEntourage(_data.AssetName, delegate(GameObject _asset, EResult _result) { if (_result != EResult.Success) { _callback(null, _result); return; } this.gameObject.name = "MainEntourage[" + actorInfo.ServerInstanceID + "]"; GameObject newGo = Instantiate(_asset) as GameObject; animationRoot = newGo.transform; newGo.name = _asset.name; newGo.transform.parent = transform; newGo.transform.localEulerAngles = Vector3.zero; newGo.transform.localPosition = Vector3.zero; newGo.AddComponent <SmartActorAnimFSM>(); newGo.AddComponent <SmartActorRendererCtrl>(); this.gameObject.AddComponent <FXCtrl>(); newGo.transform.localScale *= actorInfo.ModelScale; newGo.SetActive(false); newGo.SetActive(true); Init(); isDummy_ = false; _callback(this, _result); })); }
/// <summary> /// 创建净数据对象 /// </summary> /// <param name="_id"></param> /// <returns></returns> public static OtherEntourage CreateDummy(MercenaryInfo _info) { GameObject newGO = null; if (GameCenter.instance.dummyOpcPrefab != null) { newGO = Instantiate(GameCenter.instance.dummyOpcPrefab) as GameObject; newGO.name = "Dummy OPE [" + _info.ServerInstanceID + "]"; } else { newGO = new GameObject("Dummy OPE[" + _info.ServerInstanceID + "]"); } newGO.tag = "Entourage"; newGO.SetMaskLayer(LayerMask.NameToLayer("Entourage")); OtherEntourage newOPC = newGO.AddComponent <OtherEntourage>(); newOPC.isDummy_ = true; newOPC.moveFSM = newGO.AddComponent <ActorMoveFSM>(); newOPC.id = _info.ServerInstanceID; newOPC.actorInfo = _info; newOPC.curMoveSpeed = newOPC.actorInfo.StaticSpeed * MOVE_SPEED_BASE; newOPC.CurRealSpeed = newOPC.curMoveSpeed; newOPC.RegistMoveEvent(true); newOPC.transform.localRotation = new Quaternion(0, _info.RotationY, 0, 0); GameCenter.curGameStage.PlaceGameObjectFromServer(newOPC, _info.ServerPos.x, _info.ServerPos.z, (int)newOPC.transform.localEulerAngles.y); GameCenter.curGameStage.AddObject(newOPC); return(newOPC); }
/// <summary> /// 非经过我同意禁用本接口 by吴江 /// </summary> /// <param name="_info"></param> /// <param name="_callBack"></param> /// <returns></returns> public bool TryPreviewSingelEntourage(MercenaryInfo _info, System.Action <PreviewEntourage> _callBack) { if (_info != null) { PreviewEntourage pp = PreviewEntourage.CreateDummy(_info); pp.mutualExclusion = false; pp.StartAsyncCreate(_callBack); return(true); } return(false); }
/// <summary> /// 宠物激活时弹出模型UI /// </summary> void OnShowPetModel(MercenaryInfo _petInfo) { if (Time.time - GameCenter.mainPlayerMng.MainPlayerInfo.loginTime < 10) { return; } GameCenter.wingMng.modelType = ModelType.PET; GameCenter.wingMng.needShowPetInfo = _petInfo; GameCenter.wingMng.isNotShowTrialWingModel = true; GameCenter.uIMng.SwitchToUI(GUIType.NONE); GameCenter.uIMng.GenGUI(GUIType.SHOWMODELUI, true); }
protected void S2C_BuffUpdate(Pt _info) { pt_scene_chg_buff_c008 pt = _info as pt_scene_chg_buff_c008; if (pt != null) { BuffInfo bf = new BuffInfo(pt); switch ((ObjectType)pt.obj_sort) { case ObjectType.Player: if (pt.oid == GameCenter.mainPlayerMng.MainPlayerInfo.ServerInstanceID) { GameCenter.mainPlayerMng.MainPlayerInfo.Update(bf, bf.BuffTypeID, (int)pt.oid); } else { OtherPlayerInfo info = GameCenter.sceneMng.GetOPCInfo((int)pt.oid); if (info != null) { info.Update(bf, bf.BuffTypeID, (int)pt.oid); } } break; case ObjectType.MOB: MonsterInfo mob = GameCenter.sceneMng.GetMobInfo((int)pt.oid); if (mob != null) { mob.Update(bf, bf.BuffTypeID, (int)pt.oid); } break; case ObjectType.Entourage: MercenaryInfo ent = null; if (GameCenter.mercenaryMng.curMercernaryInfo != null && (int)pt.oid == GameCenter.mercenaryMng.curMercernaryInfo.ServerInstanceID) { ent = GameCenter.mercenaryMng.curMercernaryInfo; } else { ent = GameCenter.sceneMng.GetEntourageInfo((int)pt.oid); } if (ent != null) { ent.Update(bf, bf.BuffTypeID, (int)pt.oid); } break; default: break; } } }
public bool TryPreviewSingelEntourage(MercenaryInfo _info, UITexture _showLabel) { curShowLabel = _showLabel; CancelAllDownLoad(); if (_info != null) { PreviewEntourage pp = PreviewEntourage.CreateDummy(_info); pp.StartAsyncCreate(CreateEntourageCallBack); return(true); } return(false); }
protected void S2C_BuffDelete(Pt _info) { pt_scene_remove_buff_c009 pt = _info as pt_scene_remove_buff_c009; if (pt != null) { switch ((ObjectType)pt.obj_sort) { case ObjectType.Player: if (pt.oid == GameCenter.mainPlayerMng.MainPlayerInfo.ServerInstanceID) { GameCenter.mainPlayerMng.MainPlayerInfo.Update(null, (int)pt.buff_type, (int)pt.oid); } else { OtherPlayerInfo info = GameCenter.sceneMng.GetOPCInfo((int)pt.oid) as OtherPlayerInfo; if (info != null) { info.Update(null, (int)pt.buff_type, (int)pt.oid); } } break; case ObjectType.MOB: MonsterInfo mob = GameCenter.sceneMng.GetMobInfo((int)pt.oid) as MonsterInfo; if (mob != null) { mob.Update(null, (int)pt.buff_type, (int)pt.oid); } break; case ObjectType.Entourage: MercenaryInfo ent = null; if (GameCenter.mercenaryMng.curMercernaryInfo != null && (int)pt.oid == GameCenter.mercenaryMng.curMercernaryInfo.ServerInstanceID) { ent = GameCenter.mercenaryMng.curMercernaryInfo; } else { ent = GameCenter.sceneMng.GetEntourageInfo((int)pt.oid); } if (ent != null) { ent.Update(null, (int)pt.buff_type, (int)pt.oid); } break; default: break; } } }
/// <summary> /// 注销 /// </summary> void UnRegist() { MsgHander.UnRegist(0xD417, S2C_GetWingData); MsgHander.UnRegist(0xD420, S2C_GetWingUpData); MsgHander.UnRegist(0xD443, S2C_GetWingState); wingDic.Clear(); curWingID = 0; curUseWingInfo = null; needShowWingInfo = null; needShowMountInfo = null; needShowPetInfo = null; modelType = ModelType.NONE; isNotShowTrialWingModel = false; }
/// <summary> /// 改名字反馈协议 /// </summary> protected void S2C_GetPetNewName(Pt _msg) { pt_update_pet_name_d426 msg = _msg as pt_update_pet_name_d426; MercenaryInfo info = null; if (mercenaryInfoList.ContainsKey(msg.pet_type)) { info = mercenaryInfoList[msg.pet_type] as MercenaryInfo; } if (info != null) { info.UpdateAfterChange(msg); } }
protected void LoadEntourage() { if (configID <= 0) return; NewPetRef refData = ConfigMng.Instance.GetNewPetRef(configID); MercenaryInfo info = new MercenaryInfo(refData); GameCenter.previewManager.TryPreviewSingelEntourage(info, (x) => { x.transform.parent = this.transform; x.transform.localPosition = Vector3.zero; x.transform.localEulerAngles = Vector3.zero; x.transform.localScale = Vector3.one * scale; x.FaceToNoLerp(lookRotation); x.gameObject.SetMaskLayer(LayerMask.NameToLayer("NGUI")); }); }
public bool TryPreviewSingelEntourage(int _configID, UITexture _showLabel) { curShowLabel = _showLabel; CancelAllDownLoad(); NewPetRef refData = ConfigMng.Instance.GetNewPetRef(_configID); MercenaryInfo info = new MercenaryInfo(refData); if (info != null) { PreviewEntourage pp = PreviewEntourage.CreateDummy(info); pp.StartAsyncCreate(CreateEntourageCallBack); return(true); } return(false); }
/// <summary> /// 返回宠物最新状态和宠物技能合成状态 /// </summary> protected void S2C_FixMercenaryInfo(Pt _msg) { pt_pet_updata_state_d404 msg = _msg as pt_pet_updata_state_d404; if (msg != null) { if (msg.state == (int)PetChange.COMPODESKILLBOOK) { isComposedBook = true; } else { if (mercenaryInfoList.ContainsKey(msg.pet_type)) { MercenaryInfo info = mercenaryInfoList[msg.pet_type] as MercenaryInfo; if (info != null) { if (curMercernaryInfo != null && curMercernaryInfo.ConfigId == msg.pet_type) { if (msg.state != (int)PetChange.FINGHTING) { curMercernaryInfo = null; } } else { if (msg.state == (int)PetChange.FINGHTING) { curMercernaryInfo = info; } } info.UpdateAfterChange(msg); } } if (curPetId == noPet && mercenaryInfoList.Count <= 0) { curMercernaryInfo = null; } } SetRedRemind(); } //抛出数据变化的事件 if (OnMercenaryListUpdate != null) { OnMercenaryListUpdate(); } }
public void Init(MercenaryInfo _actorInfo) { if (_actorInfo == null) { return; } actorInfo = _actorInfo; followRange = _actorInfo.FollowRange; stopFollowRange = _actorInfo.StopFollowRange; pveAtkRange = _actorInfo.PveAtkRange; pveMasterAtkRange = _actorInfo.PveMasterAtkRange; pveReturnRange = _actorInfo.PveReturnRange; pvpAttackRange = _actorInfo.PvpAttackRange; pvpDefenseRange = _actorInfo.PvpDefenseRange; pvpMasterAtkRange = _actorInfo.PvpMasterAtkRange; teleportRange = _actorInfo.TeleportRange; InitTalkWaitDic(); }
/// <summary> /// 其他玩家坐骑、宠物更新 /// </summary> /// <param name="_pt">Point.</param> public void UpdateInfo(pt_look_pet_ride_info_d713 _pt) { if (_pt != null) { if (_pt.ride_skin_id != 0) { curMountInfo = new MountInfo(new MountData(_pt.ride_skin_id, _pt.ride_lev), this, true); } else if (_pt.ride_type != 0)//没有坐骑 { curMountInfo = new MountInfo(new MountData(_pt.ride_type, _pt.ride_lev), this); } if (_pt.target_pet_list.Count > 0) { curPetInfo = new MercenaryInfo(_pt.target_pet_list[0], GameCenter.mainPlayerMng.MainPlayerInfo); } } }
/// <summary> /// 清理所有的硬直状态(一般是由于切换场景) /// </summary> //public void CleanLockState() //{ // foreach (var item in lockStateList.Keys) // { // C2S_FinishedLockState(item); // } // lockStateList.Clear(); //} /// <summary> /// 设置佣兵信息 by吴江 /// </summary> /// <param name="_info"></param> public void SetEntourage(MainEntourage _entourage, MercenaryInfo _info) { entourage = _entourage; entourageDefaultAbilityList.Clear(); entourageNormalAbility = null; if (entourage == null) { return; } for (int i = 0; i < _info.PetSkillList.Count; i++) { AbilityInstance instance = new AbilityInstance((int)_info.PetSkillList[i], 1, 1, entourage, null); instance.FullCD(); entourageDefaultAbilityList.Add(instance); } entourageNormalAbility = new AbilityInstance(_info.NormalSkill, 1, entourage, null); AttackDiffTime = entourageNormalAbility.AbilityCD; }
/// <summary> /// 注销 /// </summary> void UnRegist() { MsgHander.UnRegist(0xD402, S2C_GetAllMercenayDataList); MsgHander.UnRegist(0xD404, S2C_FixMercenaryInfo); MsgHander.UnRegist(0xD409, S2C_GetMercenaryPromote); MsgHander.UnRegist(0xD410, S2C_GetUpdataAfterChange); MsgHander.UnRegist(0xD426, S2C_GetPetNewName); MsgHander.UnRegist(0xD751, S2C_GetCopyBook); MsgHander.UnRegist(0xD01F, S2C_EntrouageAwake); mercenaryInfoList.Clear(); petSkillByCopyAll.Clear(); allPetSkillBook.Clear(); choosedBookInMat.Clear(); curPetId = noPet; zhuPetId = noPet; fuPetId = noPet; curUseEggPetId = noPet; emptyNest = 0; choosedSkillId = 0; curPetInfo = null; }
/// <summary> /// 融合的反馈协议 /// </summary> protected void S2C_GetUpdataAfterChange(Pt _msg) { pt_fuse_info_d410 msg = _msg as pt_fuse_info_d410; if (msg != null) { MercenaryInfo info = null; if (mercenaryInfoList.ContainsKey(msg.pet_type)) { info = mercenaryInfoList[msg.pet_type] as MercenaryInfo; } if (info != null) { info.UpdateAfterChange(msg); } SetRedRemind(); } if (OnMixUpdate != null) { OnMixUpdate(); } }
/// <summary> /// 创建净数据对象 /// </summary> /// <param name="_id"></param> /// <returns></returns> public static PreviewEntourage CreateDummy(MercenaryInfo _info) { GameObject newGO = null; if (GameCenter.instance.dummyOpcPrefab != null) { newGO = Instantiate(GameCenter.instance.dummyOpcPrefab) as GameObject; newGO.name = "Dummy OPE [" + _info.ServerInstanceID + "]"; } else { newGO = new GameObject("Dummy OPE[" + _info.ServerInstanceID + "]"); } newGO.tag = "Entourage"; newGO.SetMaskLayer(LayerMask.NameToLayer("Preview")); PreviewEntourage newOPC = newGO.AddComponent <PreviewEntourage>(); newOPC.isDummy_ = true; newOPC.id = _info.ServerInstanceID; newOPC.actorInfo = _info; newOPC.transform.localRotation = new Quaternion(0, _info.RotationY, 0, 0); return(newOPC); }
/// <summary> /// 返回宠物属性变化信息 /// </summary> protected void S2C_GetMercenaryPromote(Pt _msg) { pt_pet_updata_property_d409 msg = _msg as pt_pet_updata_property_d409; if (msg != null) { MercenaryInfo info = null; if (mercenaryInfoList.ContainsKey(msg.pet_type)) { info = mercenaryInfoList[msg.pet_type] as MercenaryInfo; } if (info != null) { info.UpdateAfterChange(msg); } SetRedRemind(); } //抛出数据变化的事件 if (OnMercenaryListUpdate != null) { OnMercenaryListUpdate(); } }
/// <summary> /// 关闭窗口延时2秒 /// </summary> void CloseWnd() { if (okBtn != null) { UIEventListener.Get(okBtn.gameObject).onClick = delegate { GameCenter.uIMng.ReleaseGUI(GUIType.SHOWMODELUI); } } ; } /// <summary> /// 试用翅膀模型 /// </summary> void ShowTrialWingModel() { if (GameCenter.wingMng.isNotShowTrialWingModel) { return; } if (GameCenter.wingMng.WingDic.Count != 0) { GameCenter.uIMng.ReleaseGUI(GUIType.SHOWMODELUI); GameCenter.uIMng.SwitchToUI(GUIType.NONE); return; } if (attGo != null) { attGo.SetActive(true); } GameCenter.wingMng.C2S_RequestChangeWing(WingRef.id, true); if (nameLabel != null) { nameLabel.text = "[b]" + WingRef.name; } for (int i = 0; i < attriLabel.Count; i++) { AttributeTypeRef attributeRef = ConfigMng.Instance.GetAttributeTypeRef((ActorPropertyTag)Enum.ToObject(typeof(ActorPropertyTag), WingRef.property_list[i].eid)); if (attriLabel[i] != null) { attriLabel[i].text = attributeRef == null ? string.Empty : attributeRef.stats; } if (attriNum[i] != null) { attriNum[i].text = WingRef.property_list[i].count.ToString(); } } if (modelTex != null) { GameCenter.previewManager.TryPreviewSingleEquipment(new EquipmentInfo(WingRef.itemui, EquipmentBelongTo.PREVIEW), modelTex); } //展示翅膀模型的时候直接开启一次固定的锁屏引导 //Debug.Log("展示翅膀模型开启引导"); //Debug.Log("当前玩家的Vip等级:"+ GameCenter.vipMng.VipData.vLev); if (GameCenter.vipMng.VipData.vLev < 1) { Invoke("DelayShow", 2.0f); } } /// <summary> /// 展示模型 /// </summary> void ShowModel() { switch (GameCenter.wingMng.modelType) { case ModelType.WING: WingInfo _wingInfo = GameCenter.wingMng.needShowWingInfo; if (_wingInfo != null) //刷新通用翅膀模型 { GameCenter.previewManager.TryPreviewSingleEquipment(new EquipmentInfo(_wingInfo.refData.itemui, EquipmentBelongTo.PREVIEW), modelTex); if (nameLabel != null) { nameLabel.text = "[b]" + _wingInfo.WingName; } } break; case ModelType.ILLUSION: case ModelType.MOUNT: MountInfo _mountInfo = GameCenter.wingMng.needShowMountInfo; if (_mountInfo != null) { GameCenter.previewManager.TryPreviewSingelMount(_mountInfo, modelTex); if (nameLabel != null) { nameLabel.text = "[b]" + _mountInfo.MountName; } } break; case ModelType.PET: MercenaryInfo _petInfo = GameCenter.wingMng.needShowPetInfo; if (_petInfo != null) { GameCenter.previewManager.TryPreviewSingelEntourage(_petInfo, modelTex); if (nameLabel != null) { nameLabel.text = "[b]" + _petInfo.PetName; } } break; } } /// <summary> /// 延迟翅膀引导 /// </summary> void DelayShow() { GameCenter.noviceGuideMng.OpenGuide(100041, 1); } }
/// <summary> /// 得到宠物链表信息 /// </summary> protected void S2C_GetAllMercenayDataList(Pt _msg) { pt_pet_list_d402 msg = _msg as pt_pet_list_d402; if (msg != null) { for (int i = 0; i < msg.pet_list.Count; i++) { PetData data = new PetData(msg.pet_list[i]); //Debug.Log("发来的宠物serverInstanceID: " + data.configId + ", 宠物type: " + data.type + " , 宠物状态: " + data.status + " , 战力:" + data.fight_score + " , 天魂: " + data.tian_soul + " , 地魂 : " + data.di_soul + " , 命魂 : " + data.life_soul); //Debug.Log(" allPetCount : " + msg.pet_list.Count + " , name : " + data.pet_name + " , id : " + data.configId); //for (int j = 0; j < data.pet_skill.Count; j++) //{ // Debug.Log(" skillid : " + data.pet_skill[j] + data.configId); //} if (mercenaryInfoList.ContainsKey((int)data.configId)) { MercenaryInfo info = mercenaryInfoList[(int)data.configId] as MercenaryInfo; if (info != null) { info.Update(data, info.ServerInstanceID); if (curMercernaryInfo != null && curMercernaryInfo.ConfigId == (int)data.configId) { if (info.IsActive != (int)PetChange.FINGHTING) { curMercernaryInfo = null; } } else { if (info.IsActive == (int)PetChange.FINGHTING) { curMercernaryInfo = info; } } } } else { MercenaryInfo info = new MercenaryInfo(data, GameCenter.mainPlayerMng.MainPlayerInfo); mercenaryInfoList[info.ConfigId] = info; if (OnGetNewPetUpdate != null) { OnGetNewPetUpdate(info); } if (curMercernaryInfo != null && curMercernaryInfo.ConfigId == (int)data.configId) { if (info.IsActive != (int)PetChange.FINGHTING) { curMercernaryInfo = null; } } else { if (info.IsActive == (int)PetChange.FINGHTING) { curMercernaryInfo = info; } } } if (data.status == (int)PetChange.FINGHTING) { curPetId = data.configId; } } if (msg.pet_list.Count > 0) { SetRedRemind(); if (curPetId == noPet) { curPetId = (int)msg.pet_list[0].id;//默认当前展示的id为第一个 } } } //抛出数据变化的事件 if (OnMercenaryListUpdate != null) { OnMercenaryListUpdate(); } }
/// <summary> /// 刷新界面宠物信息 /// </summary> public void RefreshPetInfoWnd() { NoStar(mingHunStarList); NoStar(tianHunStarList); NoStar(diHunStarList); if (GameCenter.mercenaryMng.curPetId == MercenaryMng.noPet) { ShowNoPet(); return; } curInfo = GameCenter.mercenaryMng.GetMercenaryById(GameCenter.mercenaryMng.curPetId); if (curInfo == null) { ShowNoPet(); return; } if (ziZhiLab != null) { ziZhiLab.text = curInfo.Aptitude.ToString(); } if (levelLabe != null) { levelLabe.text = curInfo.Level.ToString(); } if (growUpLabel != null) { growUpLabel.text = curInfo.GrowUp.ToString(); } if (petTex != null) { GameCenter.previewManager.TryPreviewSingelEntourage(curInfo, petTex); } if (petNameInput != null) { petNameInput.value = curInfo.NoColorName; } //属性、成长、精魂数值 if (propertyInfoVal.Length >= 9) { for (int j = 0; j < curInfo.PropertyList.Count; j++) { if (curInfo.PropertyList[j].type == 1) { propertyInfoVal[0].text = curInfo.PropertyList[j].num.ToString(); } if (curInfo.PropertyList[j].type == 7) { propertyInfoVal[1].text = curInfo.PropertyList[j].num.ToString(); } if (curInfo.PropertyList[j].type == 9) { propertyInfoVal[2].text = curInfo.PropertyList[j].num.ToString(); } } NewPetDataRef petData = ConfigMng.Instance.GetPetDataRef(curInfo.GrowUp); if (petData != null) { for (int j = 0; j < petData.chengZhang.Count; j++) { if (petData.chengZhang[j].eid == 1) { propertyInfoVal[3].text = petData.chengZhang[j].count.ToString(); } if (petData.chengZhang[j].eid == 7) { propertyInfoVal[4].text = petData.chengZhang[j].count.ToString(); } if (petData.chengZhang[j].eid == 9) { propertyInfoVal[5].text = petData.chengZhang[j].count.ToString(); } } } if (curInfo.GrowUp <= 0) { propertyInfoVal[3].text = "0"; propertyInfoVal[4].text = "0"; propertyInfoVal[5].text = "0"; } for (int j = 0; j < curInfo.SoulPropertyList.Count; j++) { if (curInfo.SoulPropertyList[j].type == 1) { propertyInfoVal[6].text = curInfo.SoulPropertyList[j].num.ToString(); } if (curInfo.SoulPropertyList[j].type == 7) { propertyInfoVal[7].text = curInfo.SoulPropertyList[j].num.ToString(); } if (curInfo.SoulPropertyList[j].type == 9) { propertyInfoVal[8].text = curInfo.SoulPropertyList[j].num.ToString(); } } } ShowStar(tianHunStarList, curInfo.Tian_soul); ShowStar(diHunStarList, curInfo.Di_soul); ShowStar(mingHunStarList, curInfo.Life_soul); ShowSkill(); //出战状态(出战、休息两状态切换) if (curInfo.IsActive == 1) { if (fightBtn != null) { fightBtn.gameObject.SetActive(false); } if (restBtn != null) { restBtn.gameObject.SetActive(true); } } else { if (fightBtn != null) { fightBtn.gameObject.SetActive(true); } if (restBtn != null) { restBtn.gameObject.SetActive(false); } } }
public void SetInfo(MercenaryInfo _refInfo) { refInfo = _refInfo; }
/// <summary> /// 刷新 /// </summary> void Refresh() { FDictionary mercenaryInfoList = GameCenter.mercenaryMng.mercenaryInfoList; if (mercenaryInfoList.Count <= 0) { if (aptitudeLab != null) { aptitudeLab.text = "0"; } if (propertyAptitude != null) { propertyAptitude.text = ConfigMng.Instance.GetUItext(33, new string[2] { "0", "0" }); } if (petAttLab != null) { petAttLab.text = "0"; } if (playerAttLab != null) { playerAttLab.text = "0"; } if (petHitLab != null) { petHitLab.text = "0"; } if (playerHitLab != null) { playerHitLab.text = "0"; } if (petCrazyHitLab != null) { petCrazyHitLab.text = "0"; } if (playerCrazyHitLab != null) { playerCrazyHitLab.text = "0"; } if (nameLab != null) { nameLab.text = null; } if (petTex != null) { petTex.mainTexture = null; } for (int i = 0, max = petBDSkillList.Count; i < max; i++) { petBDSkillList[i].gameObject.SetActive(false); } return; } if (GameCenter.mercenaryMng.curPetId != MercenaryMng.noPet) { float propr = 0; curInfo = GameCenter.mercenaryMng.GetMercenaryById(GameCenter.mercenaryMng.curPetId); if (curInfo != null) { ShowSkill(); if (aptitudeLab != null) { aptitudeLab.text = curInfo.Aptitude.ToString(); } NewPetDataRef petDataRef = ConfigMng.Instance.GetPetDataRef(curInfo.Aptitude); if (petDataRef != null) { if (propertyAptitude != null) { propertyAptitude.text = ConfigMng.Instance.GetUItext(33, new string[2] { (((float)petDataRef.zhiZi) / 10000 * 100).ToString(), skillProperty.ToString() }); } } propr = ((float)petDataRef.zhiZi) / 10000 * 100 + skillProperty; int attr = 0; for (int j = 0; j < curInfo.PropertyList.Count; j++) { if (curInfo.PropertyList[j].type == 1 || curInfo.PropertyList[j].type == 2) { attr = curInfo.PropertyList[j].num; if (petAttLab != null) { petAttLab.text = attr.ToString(); } if (playerAttLab != null) { playerAttLab.text = ((int)(attr * propr) / 100).ToString(); } } if (curInfo.PropertyList[j].type == 7) { if (petHitLab != null) { petHitLab.text = curInfo.PropertyList[j].num.ToString(); } if (playerHitLab != null) { playerHitLab.text = ((int)(curInfo.PropertyList[j].num * propr) / 100).ToString(); } } if (curInfo.PropertyList[j].type == 9) { if (petCrazyHitLab != null) { petCrazyHitLab.text = curInfo.PropertyList[j].num.ToString(); } if (playerCrazyHitLab != null) { playerCrazyHitLab.text = ((int)(curInfo.PropertyList[j].num * propr) / 100).ToString(); } } } if (nameLab != null) { nameLab.text = curInfo.PetName; } if (petTex != null) { GameCenter.previewManager.TryPreviewSingelEntourage(curInfo, petTex); } if (curInfo.IsActive == 2)//守护 { if (cancelGuardBtn != null) { cancelGuardBtn.gameObject.SetActive(true); } if (guardBtn != null) { guardBtn.gameObject.SetActive(false); } } else//没有状态 { if (cancelGuardBtn != null) { cancelGuardBtn.gameObject.SetActive(false); } if (guardBtn != null) { guardBtn.gameObject.SetActive(true); } } } } }
/// <summary> /// 根据宠物id获取宠物数据 /// </summary> public MercenaryInfo GetMercenaryById(int _id) { MercenaryInfo info = mercenaryInfoList[_id] as MercenaryInfo; return(info); }
/// <summary> /// 显示技能状态 /// </summary> void FreshAllSkill() { ShowBookItem(); if (GameCenter.mercenaryMng.curPetId == MercenaryMng.noPet || GameCenter.mercenaryMng.mercenaryInfoList.Count <= 0) { if (skillObj != null) { skillObj.SetActive(false); } return; } if (skillObj != null) { skillObj.SetActive(true); } GameCenter.mercenaryMng.emptyNest = 0; FDictionary petSkillNumRefTable = ConfigMng.Instance.GetPetSkillNumRefTable(); curInfo = GameCenter.mercenaryMng.GetMercenaryById(GameCenter.mercenaryMng.curPetId); Dictionary <int, NewPetSkillNumRef> skillNumList = new Dictionary <int, NewPetSkillNumRef>(); for (int i = 0; i < petSkillList.Count; i++) { petSkillList[i].SkillNumRef = null; petSkillList[i].SkillRef = null; } if (curInfo != null) { int i = 0; int count = 0; foreach (NewPetSkillNumRef dataRef in petSkillNumRefTable.Values) { if (petSkillList.Count > i && i < 10) { petSkillList[i].SkillNumRef = dataRef; int growup = dataRef.chengZhang; int aptitude = dataRef.zizhi; if ((growup <= curInfo.GrowUp) && (aptitude <= curInfo.Aptitude)) { ++GameCenter.mercenaryMng.emptyNest;//统计空槽 } else { if (dataRef.chengZhang != 0) { skillNumList[dataRef.chengZhang] = dataRef;//保存没有解锁的数据 } else { skillNumList[dataRef.zizhi] = dataRef; } } } i++; } List <int> list = new List <int>(skillNumList.Keys);//按顺序存放数据 list.Sort(); count = GameCenter.mercenaryMng.emptyNest; for (int j = 0; j < petSkillList.Count; j++) { if (j < count) { if (curInfo.SkillList.Count > j && GameCenter.mercenaryMng.emptyNest > 0) { --GameCenter.mercenaryMng.emptyNest; petSkillList[j].SkillRef = ConfigMng.Instance.GetPetSkillRef((int)curInfo.SkillList[j]);//填充空槽 UIEventListener.Get(petSkillList[j].leanerdSkill.gameObject).onClick -= OnClickSkill; UIEventListener.Get(petSkillList[j].leanerdSkill.gameObject).onClick += OnClickSkill; UIEventListener.Get(petSkillList[j].leanerdSkill.gameObject).parameter = petSkillList[j].SkillRef; } else { petSkillList[j].ShowNoLock(); } } else { if (list.Count > (j - count) && skillNumList.ContainsKey(list[j - count])) { petSkillList[j].SkillNumRef = skillNumList[list[j - count]];//按顺序摆放解锁条件 petSkillList[j].ShowUnlockSkillInfo(); } } } } }
/// <summary> /// 刷新显示升级信息 /// </summary> void RefreshPromoteInfo() { FDictionary mercenaryInfoList = GameCenter.mercenaryMng.mercenaryInfoList; if (mercenaryInfoList.Count <= 0 || GameCenter.mercenaryMng.curPetId == MercenaryMng.noPet) { if (curNameLab != null) { curNameLab.text = string.Empty; } if (nameLab != null) { nameLab.text = string.Empty; } if (curGrowUpValLab != null) { curGrowUpValLab.text = "0"; } if (curSp != null) { curSp.gameObject.SetActive(false); } if (nextSp != null) { nextSp.gameObject.SetActive(false); } if (attValLab != null) { attValLab.text = "0"; } if (hitValLab != null) { hitValLab.text = "0"; } if (crazyHitValLab != null) { crazyHitValLab.text = "0"; } if (GrowUpAfterPromoteLab != null) { GrowUpAfterPromoteLab.text = "0"; } if (attAfterPromoteLab != null) { attAfterPromoteLab.text = "0"; } if (hitAfterPromoteLab != null) { hitAfterPromoteLab.text = "0"; } if (crazyHitAfterPromoteLab != null) { crazyHitAfterPromoteLab.text = "0"; } if (coinLab != null) { coinLab.text = "0"; } if (foodLab != null) { foodLab.text = "0"; } if (upLevelUislider != null) { upLevelUislider.value = 0; } if (upBtnRedSp != null) { upBtnRedSp.gameObject.SetActive(false); } expLab.text = 0 + "/" + 0; for (int i = 0, max = petHonorList.Count; i < max; i++) { if (petHonorList[i] != null) { petHonorList[i].gameObject.SetActive(false); } } return; } curInfo = GameCenter.mercenaryMng.GetMercenaryById(GameCenter.mercenaryMng.curPetId); if (curInfo == null) { return; } NewPetDataRef petData = null; NewPetDataRef nextPetData = null; czid = curInfo.GrowUp; len = ConfigMng.Instance.GetPetDataRefTable.Count - 1; if (czid < len) { fullLev.gameObject.SetActive(false); promoteBtn.gameObject.SetActive(true); } else { fullLev.gameObject.SetActive(true); promoteBtn.gameObject.SetActive(false); } if (czid <= len && czid <= len) { petData = ConfigMng.Instance.GetPetDataRef(czid); } if ((czid + 1) <= len && (czid + 1) <= len) { nextPetData = ConfigMng.Instance.GetPetDataRef(czid + 1); } else { nextPetData = petData; } if (curNameLab != null) { curNameLab.text = curInfo.PetName; } if (nameLab != null) { nameLab.text = curInfo.PetName; } if (curGrowUpValLab != null) { curGrowUpValLab.text = czid.ToString(); //当前成长值 } if (curSp != null) { curSp.gameObject.SetActive(true); curSp.spriteName = curInfo.Icon; } int growTitle = 0; if (nextSp != null) { nextSp.gameObject.SetActive(true); nextSp.spriteName = curInfo.Icon; } int curatt = 0; if (czid <= 0) { attValLab.text = "0"; hitValLab.text = "0"; crazyHitValLab.text = "0"; upLevelUislider.value = 0;//当前成长经验/升级所需成长经验 if (expLab != null && nextPetData != null) { expLab.text = 0 + "/" + nextPetData.cZExp; } } else if (petData != null) { int curExp = 0; if (czid < len) { curExp = curInfo.GrowUpExp; } else { curExp = petData.cZExp; } if (upLevelUislider != null && nextPetData != null) { upLevelUislider.value = (float)curExp / nextPetData.cZExp; //当前成长经验/升级所需成长经验 } if (expLab != null) { expLab.text = curExp + "/" + nextPetData.cZExp; } if (petData != null) { growTitle = petData.cZTitle; } for (int j = 0; j < petData.chengZhang.Count; j++) { if (petData.chengZhang[j].eid == (int)PetProperty.PETATT) { curatt = petData.chengZhang[j].count; if (attValLab != null) { attValLab.text = curatt.ToString(); } } if (petData.chengZhang[j].eid == (int)PetProperty.PETHIT) { if (hitValLab != null) { hitValLab.text = petData.chengZhang[j].count.ToString(); } } if (petData.chengZhang[j].eid == (int)PetProperty.PETCRI) { if (crazyHitValLab != null) { crazyHitValLab.text = petData.chengZhang[j].count.ToString(); } } } } if (GrowUpAfterPromoteLab != null) { if (czid < (ConfigMng.Instance.GetPetDataRefTable.Count - 1)) { GrowUpAfterPromoteLab.text = (curInfo.GrowUp + 1).ToString();//提升后的成长值 } else { GrowUpAfterPromoteLab.text = curInfo.GrowUp.ToString(); } } int att = 0; int hit = 0; int cri = 0; if (nextPetData != null) { growItem = nextPetData.cZIem; for (int i = 0; i < nextPetData.chengZhang.Count; i++) { if (nextPetData.chengZhang[i].eid == (int)PetProperty.PETATT) { att = nextPetData.chengZhang[i].count; } if (nextPetData.chengZhang[i].eid == (int)PetProperty.PETHIT) { hit = nextPetData.chengZhang[i].count; } if (nextPetData.chengZhang[i].eid == (int)PetProperty.PETCRI) { cri = nextPetData.chengZhang[i].count; } } } if (attAfterPromoteLab != null) { attAfterPromoteLab.text = (att).ToString(); //提升后的攻击 } if (hitAfterPromoteLab != null) { hitAfterPromoteLab.text = (hit).ToString(); //提升后的命中 } if (crazyHitAfterPromoteLab != null) { crazyHitAfterPromoteLab.text = (cri).ToString(); //提升后的暴击 } bool isItemEnough = false; bool isCoinEnough = false; if (growItem.Count > 0 && MainPlayerInfo != null) { for (int i = 0; i < growItem.Count; i++) { if (growItem[i].eid == 5) { if (MainPlayerInfo.TotalCoinCount < (ulong)growItem[i].count) { coinLab.text = growItem[i].count + "/" + "[ff0000]" + MainPlayerInfo.TotalCoinCount; } else { coinLab.text = growItem[i].count + "/" + "[6ef574]" + MainPlayerInfo.TotalCoinCount;//需要的金币/拥有的 isCoinEnough = true; } } else { itemId = growItem[i].eid; itemRef = ConfigMng.Instance.GetEquipmentRef(itemId); if (GameCenter.inventoryMng.GetNumberByType(growItem[i].eid) >= growItem[i].count) { isItemEnough = true; if (foodLab != null) { foodLab.text = growItem[i].count + "/" + "[6ef574]" + GameCenter.inventoryMng.GetNumberByType(growItem[i].eid); } } else { if (foodLab != null) { foodLab.text = growItem[i].count + "/" + "[ff0000]" + GameCenter.inventoryMng.GetNumberByType(growItem[i].eid); } } } } } if (!isItemEnough) { if (diamondLab != null && MainPlayerInfo != null && itemRef != null) { diamondLab.text = itemRef.diamonPrice + "/" + MainPlayerInfo.TotalDiamondCount.ToString(); } } else { if (diamondLab != null && MainPlayerInfo != null) { diamondLab.text = "0/" + MainPlayerInfo.TotalDiamondCount.ToString(); } } if (isItemEnough && isCoinEnough && czid < (ConfigMng.Instance.GetPetDataRefTable.Count - 1)) { upBtnRedSp.gameObject.SetActive(true); } else { upBtnRedSp.gameObject.SetActive(false); } ShowHonor(growTitle); }
/// <summary> /// 刷新界面 /// </summary> void RefreshXiuLingInfo() { FDictionary mercenaryInfoList = GameCenter.mercenaryMng.mercenaryInfoList; if (mercenaryInfoList.Count <= 0) { if (AttLabAfterTrainTH != null) { AttLabAfterTrainTH.text = "0"; } tianRedRemind.gameObject.SetActive(false); tianfullLev.gameObject.SetActive(false); tianHunTrainBtn.gameObject.SetActive(false); if (expSp.Count > 2 && expRatio.Length > 2) { expSp[0].fillAmount = 0; expRatio[0].text = "0"; expSp[1].fillAmount = 0; expRatio[1].text = "0"; expSp[2].fillAmount = 0; expRatio[2].text = "0"; } if (HitLabAfterTrainDH != null) { HitLabAfterTrainDH.text = "0"; } if (CrazyHitLabAfterTrainMH != null) { CrazyHitLabAfterTrainMH.text = "0"; } if (coinLab != null) { coinLab.text = "0"; } if (lxPillLab != null) { lxPillLab.text = "0"; } NoStar(mingHunStarList); NoStar(tianHunStarList); NoStar(diHunStarList); return; } if (curInfo == null || (curInfo != null && curInfo.ConfigId != GameCenter.mercenaryMng.curPetId)) { curInfo = GameCenter.mercenaryMng.GetMercenaryById(GameCenter.mercenaryMng.curPetId); } if (curInfo != null) { ShowStar(tianHunStarList, curInfo.Tian_soul); ShowStar(diHunStarList, curInfo.Di_soul); ShowStar(mingHunStarList, curInfo.Life_soul); NewPetDataRef tHPetData = ConfigMng.Instance.GetPetDataRef(curInfo.Tian_soul > 0 ? curInfo.Tian_soul + 1 : 1); NewPetDataRef dHPetData = ConfigMng.Instance.GetPetDataRef(curInfo.Di_soul > 0 ? curInfo.Di_soul + 1 : 1); NewPetDataRef lifePetData = ConfigMng.Instance.GetPetDataRef(curInfo.Life_soul > 0 ? curInfo.Life_soul + 1 : 1); if (curInfo.Tian_soul <= 0) { NoStar(tianHunStarList); } if (curInfo.Di_soul <= 0) { NoStar(diHunStarList); } if (curInfo.Life_soul <= 0) { NoStar(mingHunStarList); } bool isCoinEnough = false; bool isItemEnough = false; if (curInfo.LxItem.Count > 0) { for (int i = 0; i < curInfo.LxItem.Count; i++) { if (curInfo.LxItem[i].eid == 5) { if (MainPlayerInfo != null) { if (MainPlayerInfo.TotalCoinCount < (ulong)curInfo.LxItem[i].count) { coinLab.text = curInfo.LxItem[i].count + "/" + "[ff0000]" + MainPlayerInfo.TotalCoinCount; } else { isCoinEnough = true; coinLab.text = curInfo.LxItem[i].count + "/" + "[6ef574]" + MainPlayerInfo.TotalCoinCount; } } } else { itemId = curInfo.LxItem[i].eid; itemRef = ConfigMng.Instance.GetEquipmentRef(itemId); if (GameCenter.inventoryMng.GetNumberByType(curInfo.LxItem[i].eid) >= curInfo.LxItem[i].count) { isItemEnough = true; if (lxPillLab != null) { lxPillLab.text = curInfo.LxItem[i].count + "/" + "[6ef574]" + GameCenter.inventoryMng.GetNumberByType(curInfo.LxItem[i].eid); } } else { if (lxPillLab != null) { lxPillLab.text = curInfo.LxItem[i].count + "/" + "[ff0000]" + GameCenter.inventoryMng.GetNumberByType(curInfo.LxItem[i].eid); } } } } } if (MainPlayerInfo != null) { if (!isItemEnough) { if (itemRef != null && diamondLab != null) { diamondLab.text = itemRef.diamonPrice + "/" + MainPlayerInfo.TotalDiamondCount.ToString(); } } else { if (diamondLab != null) { diamondLab.text = "0/" + MainPlayerInfo.TotalDiamondCount.ToString(); } } } if (curInfo.Tian_soul >= 32) { tianRedRemind.gameObject.SetActive(false); tianfullLev.gameObject.SetActive(true); tianHunTrainBtn.gameObject.SetActive(false); } else { if (isCoinEnough && isItemEnough) { tianRedRemind.gameObject.SetActive(true); } else { tianRedRemind.gameObject.SetActive(false); } tianfullLev.gameObject.SetActive(false); tianHunTrainBtn.gameObject.SetActive(true); } if (curInfo.Di_soul >= 32) { diRedRemind.gameObject.SetActive(false); difullLev.gameObject.SetActive(true); diHunTrainBtn.gameObject.SetActive(false); } else { difullLev.gameObject.SetActive(false); diHunTrainBtn.gameObject.SetActive(true); if (isCoinEnough && isItemEnough) { diRedRemind.gameObject.SetActive(true); } else { diRedRemind.gameObject.SetActive(false); } } if (curInfo.Life_soul >= 32) { mingRedRemind.gameObject.SetActive(false); mingfullLev.gameObject.SetActive(true); mingHunTrainBtn.gameObject.SetActive(false); } else { mingfullLev.gameObject.SetActive(false); mingHunTrainBtn.gameObject.SetActive(true); if (isCoinEnough && isItemEnough) { mingRedRemind.gameObject.SetActive(true); } else { mingRedRemind.gameObject.SetActive(false); } } for (int j = 0, max = curInfo.SoulPropertyList.Count; j < max; j++) { if (curInfo.SoulPropertyList[j].type == (int)PetProperty.PETATT && tHPetData != null) { float attr = curInfo.SoulPropertyList[j].num; float needVal = 0; if (tHPetData.lXExp.Count > 0 && curInfo.Tian_soul < 32) { needVal = tHPetData.lXExp[0]; } else { needVal = attr; } float posy = -128; if (needVal != 0) { posy = -128 + (attr / needVal) * 136; } if (AttLabAfterTrainTH != null) { AttLabAfterTrainTH.text = (attr).ToString(); } if (expSp.Count > 0) { expSp[0].transform.localPosition = new Vector3 (expSp[0].transform.localPosition.x, posy, 0); } if (expRatio.Length > 0) { expRatio[0].text = attr + "/" + needVal; } } if (curInfo.SoulPropertyList[j].type == (int)PetProperty.PETHIT && dHPetData != null) { float val = curInfo.SoulPropertyList[j].num; float needVal = 0; if (dHPetData.lXExp.Count > 1 && curInfo.Di_soul < 32) { needVal = dHPetData.lXExp[1]; } else { needVal = val; } float posy = -128; if (needVal != 0) { posy = -128 + (val / needVal) * 136; } if (HitLabAfterTrainDH != null) { HitLabAfterTrainDH.text = val.ToString(); } if (expSp.Count > 1) { expSp[1].transform.localPosition = new Vector3 (expSp[1].transform.localPosition.x, posy, 0); } if (expRatio.Length > 1) { expRatio[1].text = val + "/" + needVal; } } if (curInfo.SoulPropertyList[j].type == (int)PetProperty.PETCRI && lifePetData != null) { float val = curInfo.SoulPropertyList[j].num; float needVal = 0; if (lifePetData.lXExp.Count > 2 && curInfo.Life_soul < 32) { needVal = lifePetData.lXExp[2]; } else { needVal = val; } float posy = -128; if (needVal != 0) { posy = -128 + (val / needVal) * 136; } if (CrazyHitLabAfterTrainMH != null) { CrazyHitLabAfterTrainMH.text = val.ToString(); } if (expSp.Count > 2) { expSp[2].transform.localPosition = new Vector3 (expSp[2].transform.localPosition.x, posy, 0); } if (expRatio.Length > 2) { expRatio[2].text = val + "/" + needVal; } } } } }