public void buttonClick(GameObject sender) { if (asid != 0 && babyObj != null) { DestroyBaby((ENTITY_ID)asid, true, babyObj); } int [] ids = (int [])UIEventListener.Get(sender).parameter; int uId = ids [0]; int asseId = ids[1]; asid = asseId; for (int i = 0; i < itemsList.Count; i++) { if (sender.name.Equals(itemsList[i].name)) { UISprite [] sps = sender.GetComponentsInChildren <UISprite>(true); for (int k = 0; k < sps.Length; k++) { if (sps[k].transform.name == "selectBackground") { sps[k].enabled = true; break; } } } else { UISprite [] sps = sender.GetComponentsInChildren <UISprite>(true); for (int k = 0; k < sps.Length; k++) { if (sps[k].transform.name == "selectBackground") { sps[k].enabled = false; break; } } } } Baby Inst = GamePlayer.Instance.GetBabyInst(uId); if (Inst == null) { return; } SetBabyInfo(Inst.InstName, Inst.GetIprop(PropertyType.PT_HpCurr), Inst.GetIprop(PropertyType.PT_MpCurr), Inst.GetIprop(PropertyType.PT_Land), Inst.GetIprop(PropertyType.PT_Water), Inst.GetIprop(PropertyType.PT_Fire), Inst.GetIprop(PropertyType.PT_Wind)); GameManager.Instance.GetActorClone((ENTITY_ID)asseId, (ENTITY_ID)0, EntityType.ET_Baby, AssetLoadCallBack, new ParamData(Inst.InstId), "UI"); }
void RefreshGrowingUp(int uid) { if (GamePlayer.Instance.babies_list_.Count == 0) { ClearText(); } else { enterBtn.isEnabled = true; Uid = uid; Inst = GamePlayer.Instance.GetBabyInst(uid); BabyData bdata = BabyData.GetData(Inst.GetIprop(PropertyType.PT_TableId)); mofaLabel.text = "[-][666666]" + Inst.gear_[(int)BabyInitGear.BIG_Magic].ToString() + "/" + bdata._BIG_Magic; tiliLabel.text = "[-][666666]" + Inst.gear_[(int)BabyInitGear.BIG_Stama].ToString() + "/" + bdata._BIG_Stama; suduLabel.text = "[-][666666]" + Inst.gear_[(int)BabyInitGear.BIG_Speed].ToString() + "/" + bdata._BIG_Speed; qiangduLabel.text = "[-][666666]" + Inst.gear_[(int)BabyInitGear.BIG_Power].ToString() + "/" + bdata._BIG_Power; liLiangLabel.text = "[-][666666]" + Inst.gear_[(int)BabyInitGear.BIG_Strength].ToString() + "/" + bdata._BIG_Strength; type = bdata._Tpye; tiliSlider.value = (Inst.gear_[(int)BabyInitGear.BIG_Stama] * 1f) / (bdata._BIG_Stama * 1f); liliangSlider.value = (Inst.gear_[(int)BabyInitGear.BIG_Strength] * 1f) / (bdata._BIG_Strength * 1f); qiangduSlider.value = (Inst.gear_[(int)BabyInitGear.BIG_Power] * 1f) / (bdata._BIG_Power * 1f); suduSlider.value = (Inst.gear_[(int)BabyInitGear.BIG_Speed] * 1f) / (bdata._BIG_Speed * 1f); mofaSlider.value = (Inst.gear_[(int)BabyInitGear.BIG_Magic] * 1f) / (bdata._BIG_Magic * 1f); int dd = Inst.gear_[(int)BabyInitGear.BIG_Magic] + Inst.gear_[(int)BabyInitGear.BIG_Stama] + Inst.gear_[(int)BabyInitGear.BIG_Speed] + Inst.gear_[(int)BabyInitGear.BIG_Power] + Inst.gear_[(int)BabyInitGear.BIG_Strength]; dangshuLable.text = dd.ToString(); } }
void Refresh(int uid) { if (GamePlayer.Instance.babies_list_.Count == 0) { ClearText(); } else { float [] addPoints = new float[5]; Inst = GamePlayer.Instance.GetBabyInst(uid); if (Inst == null) { return; } BabyData bdata = BabyData.GetData(Inst.GetIprop(PropertyType.PT_TableId)); HeadIconLoader.Instance.LoadIcon(EntityAssetsData.GetData(bdata._AssetsID).assetsIocn_, babyIcon); HeadIconLoader.Instance.LoadIcon(bdata._RaceIcon, raceIcon); babyNameLabel.text = Inst.InstName; if (Inst.intensifyLevel_ == 10) { enterBtn.isEnabled = false; newLevel.gameObject.SetActive(false); raSp.gameObject.SetActive(false); raaSp.gameObject.SetActive(false); oldLevel.text = LanguageManager.instance.GetValue("babyAlreadyOnTop"); PetIntensiveData petData = PetIntensiveData.GetData((int)Inst.intensifyLevel_); oldChengzhang.text = petData.grow_.ToString(); chneglv.text = petData.probability_ + "%"; newChengzhang.text = ""; } else { newLevel.gameObject.SetActive(true); raSp.gameObject.SetActive(true); enterBtn.isEnabled = true; raaSp.gameObject.SetActive(true); oldLevel.text = Inst.intensifyLevel_.ToString(); PetIntensiveData petData = PetIntensiveData.GetData((int)Inst.intensifyLevel_); oldChengzhang.text = petData.grow_.ToString(); PetIntensiveData petNData = PetIntensiveData.GetData((int)Inst.intensifyLevel_ + 1); newChengzhang.text = petNData.grow_.ToString(); newLevel.text = (Inst.intensifyLevel_ + 1).ToString(); chneglv.text = petNData.probability_ + "%"; if (BagSystem.instance.GetItemMaxNum((uint)itemID()) >= itemCount()) { enterBtn.isEnabled = true; } else { enterBtn.isEnabled = false; } } updateUI(null); } }
void OnEnable() { Uid = MainbabyProperty.idss[0]; Inst = GamePlayer.Instance.GetBabyInst(Uid); BabyData bdata = BabyData.GetData(Inst.GetIprop(PropertyType.PT_TableId)); mofaLabel.text = "[-][666666]" + Inst.gear_[(int)BabyInitGear.BIG_Magic].ToString() + "[-][33FF66]" + " -" + (bdata._BIG_Magic - Inst.gear_[(int)BabyInitGear.BIG_Magic]); tiLiLabel.text = "[-][666666]" + Inst.gear_[(int)BabyInitGear.BIG_Stama].ToString() + "[-][33FF66]" + " -" + (bdata._BIG_Stama - Inst.gear_[(int)BabyInitGear.BIG_Stama]); SuduLabel.text = "[-][666666]" + Inst.gear_[(int)BabyInitGear.BIG_Speed].ToString() + "[-][33FF66]" + " -" + (bdata._BIG_Speed - Inst.gear_[(int)BabyInitGear.BIG_Speed]); QiangduLabel.text = "[-][666666]" + Inst.gear_[(int)BabyInitGear.BIG_Power].ToString() + "[-][33FF66]" + " -" + (bdata._BIG_Power - Inst.gear_[(int)BabyInitGear.BIG_Power]); LiliangLabel.text = "[-][666666]" + Inst.gear_[(int)BabyInitGear.BIG_Strength].ToString() + "[-][33FF66]" + " -" + (bdata._BIG_Strength - Inst.gear_[(int)BabyInitGear.BIG_Strength]); }
void addItem(List <Baby> babys) { Refresh(); for (int i = 0; i < babys.Count; i++) { GameObject o = GameObject.Instantiate(item) as GameObject; o.SetActive(true); o.name = o.name + i; o.transform.parent = grid.transform; MainBabyListCell mbCell = o.GetComponent <MainBabyListCell>(); Baby inst = GamePlayer.Instance.GetBabyInst(babys[i].InstId); mbCell.BabyMainData = babys[i]; BabyData bab = BabyData.GetData(inst.GetIprop(PropertyType.PT_TableId)); string ReformItem = bab._ReformItem; // if(MainbabyReformUI.isMainbabyReformUI) // { // if(babys[i].isForBattle_) // { // mbCell.chuzhanButton.gameObject.SetActive(true); // mbCell.chuzhanButton.isEnabled = false; // mbCell.daimingButton.gameObject.SetActive(false); // }else // { // mbCell.chuzhanButton.gameObject.SetActive(false); // mbCell.daimingButton.gameObject.SetActive(true); // mbCell.daimingButton.isEnabled = false; // } // } // if(ReformItem == "") // { // mbCell.ban.gameObject.SetActive(true); // // // }else // if(inst.GetIprop(PropertyType.PT_Level)>1) // { // mbCell.ban.gameObject.SetActive(true); // // }else // { // mbCell.ban.gameObject.SetActive(false); // } o.transform.localScale = new Vector3(1, 1, 1); UIManager.SetButtonEventHandler(o, EnumButtonEvent.OnClick, buttonClick, babys[i].InstId, babys[i].GetIprop(PropertyType.PT_AssetId)); grid.repositionNow = true; } }
private void buttonClick(ButtonScript obj, object args, int param1, int param2) { Baby inst = GamePlayer.Instance.GetBabyInst(param1); BabyData bab = BabyData.GetData(inst.GetIprop(PropertyType.PT_TableId)); string ReformItem = bab._ReformItem; if (ReformItem == "") { PopText.Instance.Show(LanguageManager.instance.GetValue("babygaizao1")); } else if (inst.GetIprop(PropertyType.PT_Level) > 1) { PopText.Instance.Show(LanguageManager.instance.GetValue("babygaizao2")); } else { if (MainbabyReformUI.ShowbabyInfoOk != null) { MainbabyReformUI.ShowbabyInfoOk(inst, ReformItem, bab._ReformMonster); } gameObject.SetActive(false); } }
void Update() { _babyMainData = GamePlayer.Instance.GetBabyInst(_babyMainData.InstId); if (_babyMainData != null) { if (_babyMainData.GetIprop(PropertyType.PT_Free) > 0) { this.gameObject.GetComponent <UISprite>().MarkOn(UISprite.MarkAnthor.MA_RightTop, -10f, -10f); } else { this.gameObject.GetComponent <UISprite>().MarkOff(); } } }
public void SetData(Baby inst) { inst_ = inst; name_.text = inst_.InstName; realName_ = BabyData.GetData((int)inst.GetEntity().properties_[(int)PropertyType.PT_TableId])._Name; level_.text = (inst_.GetIprop(PropertyType.PT_Level)).ToString(); float tax = 0f; GlobalValue.Get(Constant.C_MallTax, out tax); tax_.text = string.Format("[ff0000]{0}[-]", ((int)(tax * 100f)).ToString()); SkillData skill = null; UITexture tex = null; GameObject texGo = null; for (int i = 0; i < inst_.SkillInsts.Count; ++i) { skill = SkillData.GetData((int)inst_.SkillInsts[i].skillID_, (int)inst_.SkillInsts[i].skillLevel_); if (skill._Name.Equals(LanguageManager.instance.GetValue("playerPro_FightBack")) || skill._Name.Equals(LanguageManager.instance.GetValue("playerPro_Dodge"))) { continue; } tex = skills_[i].GetComponentInChildren <UITexture>(); if (tex == null) { texGo = new GameObject(); texGo.layer = LayerMask.NameToLayer("UI"); tex = texGo.AddComponent <UITexture>(); tex.transform.parent = skills_[i].transform; texGo.transform.localPosition = Vector3.zero; texGo.transform.localScale = Vector3.one; tex.depth = skills_[i].GetComponent <UISprite>().depth + 1; } HeadIconLoader.Instance.LoadIcon(skill._ResIconName, tex); } BabyCellUI cell = UIManager.Instance.AddBabyCellUI(icon_, inst); UIManager.SetButtonEventHandler(cell.gameObject, EnumButtonEvent.OnClick, OnClickIcon, 0, 0); UIManager.SetButtonEventHandler(sellBtn_.gameObject, EnumButtonEvent.OnClick, OnSell, 0, 0); UIManager.SetButtonEventHandler(cancelBtn_.gameObject, EnumButtonEvent.OnClick, (ButtonScript obj, object args, int param1, int param2) => { gameObject.SetActive(false); }, 0, 0); gameObject.SetActive(true); }
void OnEnable() { if (GamePlayer.Instance.babies_list_.Count == 0) { ClearText(); } else { Uid = MainbabyProperty.idss[0]; Inst = GamePlayer.Instance.GetBabyInst(Uid); BabyData bdata = BabyData.GetData(Inst.GetIprop(PropertyType.PT_TableId)); type = bdata._Tpye; int Magic = bdata._BIG_Magic - Inst.gear_[(int)BabyInitGear.BIG_Magic]; int Stama = bdata._BIG_Stama - Inst.gear_[(int)BabyInitGear.BIG_Stama]; int Speed = bdata._BIG_Speed - Inst.gear_[(int)BabyInitGear.BIG_Speed]; int Power = bdata._BIG_Power - Inst.gear_[(int)BabyInitGear.BIG_Power]; int Strength = bdata._BIG_Strength - Inst.gear_[(int)BabyInitGear.BIG_Strength]; int num = Magic + Stama + Speed + Power + Strength; onesp.spriteName = BabyData.GetBabyLeveSp(num) + "_big"; oldBdata = bdata; mofaLabel.text = "[-][666666]" + Inst.gear_[(int)BabyInitGear.BIG_Magic].ToString() + "/" + bdata._BIG_Magic; tiliLabel.text = "[-][666666]" + Inst.gear_[(int)BabyInitGear.BIG_Stama].ToString() + "/" + bdata._BIG_Stama; suduLabel.text = "[-][666666]" + Inst.gear_[(int)BabyInitGear.BIG_Speed].ToString() + "/" + bdata._BIG_Speed; qiangduLabel.text = "[-][666666]" + Inst.gear_[(int)BabyInitGear.BIG_Power].ToString() + "/" + bdata._BIG_Power; liLiangLabel.text = "[-][666666]" + Inst.gear_[(int)BabyInitGear.BIG_Strength].ToString() + "/" + bdata._BIG_Strength; tiliSlider.value = (Inst.gear_[(int)BabyInitGear.BIG_Stama] * 1f) / (bdata._BIG_Stama * 1f); liliangSlider.value = (Inst.gear_[(int)BabyInitGear.BIG_Strength] * 1f) / (bdata._BIG_Strength * 1f); qiangduSlider.value = (Inst.gear_[(int)BabyInitGear.BIG_Power] * 1f) / (bdata._BIG_Power * 1f); suduSlider.value = (Inst.gear_[(int)BabyInitGear.BIG_Speed] * 1f) / (bdata._BIG_Speed * 1f); mofaSlider.value = (Inst.gear_[(int)BabyInitGear.BIG_Magic] * 1f) / (bdata._BIG_Magic * 1f); int dd = Inst.gear_[(int)BabyInitGear.BIG_Magic] + Inst.gear_[(int)BabyInitGear.BIG_Stama] + Inst.gear_[(int)BabyInitGear.BIG_Speed] + Inst.gear_[(int)BabyInitGear.BIG_Power] + Inst.gear_[(int)BabyInitGear.BIG_Strength]; dangshuLable.text = dd.ToString(); } if (GlobalValue.isBattleScene(StageMgr.Scene_name)) { enterBtn.gameObject.SetActive(false); } }
bool IsbabyS() { if (Inst == null) { return(false); } BabyData bdata = BabyData.GetData(Inst.GetIprop(PropertyType.PT_TableId)); int Magic = bdata._BIG_Magic - Inst.gear_[(int)BabyInitGear.BIG_Magic]; int Stama = bdata._BIG_Stama - Inst.gear_[(int)BabyInitGear.BIG_Stama]; int Speed = bdata._BIG_Speed - Inst.gear_[(int)BabyInitGear.BIG_Speed]; int Power = bdata._BIG_Power - Inst.gear_[(int)BabyInitGear.BIG_Power]; int Strength = bdata._BIG_Strength - Inst.gear_[(int)BabyInitGear.BIG_Strength]; int num = Magic + Stama + Speed + Power + Strength; string l = BabyData.GetBabyLeveSp(num); if (l.Equals("S")) { return(true); } return(false); }
void Start() { InitUIText(); UpdateUI(); BabyProperty = UpdateUI; Attributes.Add(tili); Attributes.Add(liliang); Attributes.Add(Qiangdu); Attributes.Add(sudu); Attributes.Add(mofa); GamePlayer.Instance.babyUpdateIpropEvent += new RequestEventHandler <int>(UpdateUI); if (Inst != null) { if (Inst.GetIprop(PropertyType.PT_Free) == 0) { tuijian.gameObject.SetActive(false); } else { tuijian.gameObject.SetActive(true); } for (int i = 0; i < Attributes.Count; i++) { if (i == BabyData.StrongestAttribute(Inst.GetIprop(PropertyType.PT_TableId))) { tuijian.transform.position = new Vector3(tuijian.transform.position.x, Attributes[i].transform.position.y, tuijian.transform.position.z); } } } else { tuijian.gameObject.SetActive(false); } jiaBtns.Add(tiliJa, PropertyType.PT_Stama); jiaBtns.Add(liliangJa, PropertyType.PT_Strength); jiaBtns.Add(QiangduJa, PropertyType.PT_Power); jiaBtns.Add(suduJa, PropertyType.PT_Speed); jiaBtns.Add(mofaJa, PropertyType.PT_Magic); jianBtns.Add(tiliJan, PropertyType.PT_Stama); jianBtns.Add(liliangJan, PropertyType.PT_Strength); jianBtns.Add(QiangduJan, PropertyType.PT_Power); jianBtns.Add(suduJan, PropertyType.PT_Speed); jianBtns.Add(mofaJan, PropertyType.PT_Magic); foreach (UIButton bt in jiaBtns.Keys) { UIEventListener.Get(bt.gameObject).onPress = myonPress; } foreach (UIButton bt in jianBtns.Keys) { UIEventListener.Get(bt.gameObject).onPress = myonPressJian; } UIManager.SetButtonEventHandler(queding.gameObject, EnumButtonEvent.OnClick, OnClickqueding, 0, 0); UIManager.SetButtonEventHandler(tiliJa.gameObject, EnumButtonEvent.OnClick, OnClicktiliJa, (int)PropertyType.PT_Stama, 0); // UIManager.SetButtonEventHandler (tiliJa.gameObject, EnumButtonEvent.TouchDown, OnClickTouchDown, (int)PropertyType.PT_Stama, 0); UIManager.SetButtonEventHandler(tiliJan.gameObject, EnumButtonEvent.OnClick, OnClictiliJan, (int)PropertyType.PT_Stama, 0); UIManager.SetButtonEventHandler(liliangJa.gameObject, EnumButtonEvent.OnClick, OnClicktiliJa, (int)PropertyType.PT_Strength, 0); UIManager.SetButtonEventHandler(liliangJan.gameObject, EnumButtonEvent.OnClick, OnClictiliJan, (int)PropertyType.PT_Strength, 0); UIManager.SetButtonEventHandler(QiangduJa.gameObject, EnumButtonEvent.OnClick, OnClicktiliJa, (int)PropertyType.PT_Power, 0); UIManager.SetButtonEventHandler(QiangduJan.gameObject, EnumButtonEvent.OnClick, OnClictiliJan, (int)PropertyType.PT_Power, 0); UIManager.SetButtonEventHandler(suduJa.gameObject, EnumButtonEvent.OnClick, OnClicktiliJa, (int)PropertyType.PT_Speed, 0); UIManager.SetButtonEventHandler(suduJan.gameObject, EnumButtonEvent.OnClick, OnClictiliJan, (int)PropertyType.PT_Speed, 0); UIManager.SetButtonEventHandler(mofaJa.gameObject, EnumButtonEvent.OnClick, OnClicktiliJa, (int)PropertyType.PT_Magic, 0); UIManager.SetButtonEventHandler(mofaJan.gameObject, EnumButtonEvent.OnClick, OnClictiliJan, (int)PropertyType.PT_Magic, 0); //UIManager.SetButtonEventHandler (GrowingUpBtn.gameObject, EnumButtonEvent.OnClick, OnClickGrowingUp,0, 0); queding.gameObject.SetActive(false); UIManager.SetButtonEventHandler(shuxingBtn.gameObject, EnumButtonEvent.OnClick, OnClickshuxingBtn, 0, 0); UIManager.SetButtonEventHandler(shuxingClose.gameObject, EnumButtonEvent.OnClick, OnClickshuxingClose, 0, 0); GuideManager.Instance.RegistGuideAim(propertyContainer, GuideAimType.GAT_MainBabyPropertyContainer); GuideManager.Instance.RegistGuideAim(queding.gameObject, GuideAimType.GAT_MainBabyPropertyConfirm); GuideManager.Instance.ProcEvent(ScriptGameEvent.SGE_BabyUIPropertySwitch); if (GlobalValue.isBattleScene(StageMgr.Scene_name)) { SetattackBtnState(false); } }
void SetBabyInfo(Baby inst) { skillDatas.Clear(); if (inst == null) { return; } nameLabel.text = inst.InstName; loyaltyLabel.text = inst.GetIprop(PropertyType.PT_Glamour).ToString(); levelLabel.text = inst.GetIprop(PropertyType.PT_Level).ToString(); diSlider.value = BabyData.GetData(inst.GetIprop(PropertyType.PT_TableId))._Ground / 10f; fengSlider.value = BabyData.GetData(inst.GetIprop(PropertyType.PT_TableId))._Wind / 10f; shuiSlider.value = BabyData.GetData(inst.GetIprop(PropertyType.PT_TableId))._Water / 10f; huoSlider.value = BabyData.GetData(inst.GetIprop(PropertyType.PT_TableId))._Fire / 10f; leixngSp.spriteName = BabyData.GetData(inst.GetIprop(PropertyType.PT_TableId))._Tpye.ToString(); zhandouliLabel.text = inst.GetIprop(PropertyType.PT_FightingForce).ToString(); for (int i = 0; i < skillIcons.Length; ++i) { //初始化 Listener = UIEventListener.Get(skillIcons[i].GetComponent <UIButton>().gameObject); Listener.onPress = null; UIManager.RemoveButtonEventHandler(skillIcons[i].gameObject, EnumButtonEvent.OnClick); Transform ssp = skillIcons[i].transform.FindChild("suo000"); ssp.gameObject.SetActive(false); ssp = skillIcons[i].transform.FindChild("skillicon"); ssp.gameObject.SetActive(false); } BabyData bdata = BabyData.GetData(inst.GetIprop(PropertyType.PT_TableId)); for (int i = 0; i < inst.SkillInsts.Count; i++) { SkillData sdata = SkillData.GetMinxiLevelData((int)inst.SkillInsts[i].skillID_); if (sdata._Name.Equals(LanguageManager.instance.GetValue("playerPro_FightBack"))) { continue; } if (sdata._Name.Equals(LanguageManager.instance.GetValue("playerPro_Dodge"))) { continue; } skillDatas.Add(sdata); } for (int i = 0; i < skillDatas.Count; ++i) { if (i > skillIcons.Length) { break; /// rongcuo } if (i > bdata._SkillNum) { break; ///错误 } skillIcons[i].gameObject.SetActive(true); Transform ssp = skillIcons[i].transform.FindChild("suo000"); ssp.gameObject.SetActive(false); ssp = skillIcons[i].transform.FindChild("skillicon"); ssp.gameObject.SetActive(true); UITexture sp = skillIcons[i].GetComponentInChildren <UITexture>(); iconNames_.Add(skillDatas[i]._ResIconName); HeadIconLoader.Instance.LoadIcon(skillDatas[i]._ResIconName, sp); Listener = UIEventListener.Get(skillIcons[i].GetComponent <UIButton>().gameObject); Listener.parameter = skillDatas[i]._Id; Listener.onPress = buttonPress; } for (int i = 0; i < skillIcons.Length; i++) { if (i < skillDatas.Count) { Transform ps = skillIcons [i].transform.FindChild("Ps"); ps.gameObject.SetActive(false); } if (i < bdata._SkillNum && i >= skillDatas.Count) { Transform ps = skillIcons [i].transform.FindChild("Ps"); ps.gameObject.SetActive(true); skillIcons [i].gameObject.SetActive(true); UIManager.SetButtonEventHandler(skillIcons [i].gameObject, EnumButtonEvent.OnClick, OnClickSkillNpc, 0, 0); } if (i >= bdata._SkillNum) { skillIcons [i].gameObject.SetActive(false); } } int Protect = 0; oldLevel = 0; GlobalValue.Get(Constant.C_AucGoodProtect, out Protect); //FormatTimeHasDay ((int)inst.GetInst ().lastSellTime_); //int day = (Protect - GlobalInstanceFunction.Instance.DayPass ((int)inst.GetInst ().lastSellTime_)); dongjieSp.text = FormatTimeHasDay((int)inst.GetInst().lastSellTime_); //LanguageManager.instance.GetValue ("dongjie").Replace ("{n}",day.ToString()); if (inst.GetInst().lastSellTime_ <= 0) { dongjieObj.SetActive(false); } else { dongjieObj.SetActive(true); } curExp = (long)inst.Properties[(int)PropertyType.PT_Exp]; maxExp = ExpData.GetBabyMaxExp(inst.GetIprop(PropertyType.PT_Level)); if (inst.GetIprop(PropertyType.PT_Level) > 1) { oldLevel = (inst.GetIprop(PropertyType.PT_Level) - 1); } else { oldExp = 0; } oldExp = ExpData.GetBabyMaxExp(oldLevel); long s = curExp - oldExp; if (s < 0) { s = 0; } Expl.value = (s * 1f) / ((maxExp - oldExp) * 1f); exptextLbel.text = s + "/" + (maxExp - oldExp); // if(inst.GetIprop(PropertyType.PT_Level)>1) // { // oldLevel = (inst.GetIprop(PropertyType.PT_Level)-1); // }else // { // oldexp = 0; // } // oldexp = ExpData.GetBabyMaxExp(oldLevel); // // int fExp = 0; // int bExp = 0; // if(inst.GetIprop(PropertyType.PT_Level)>1) // { // fExp = (curExp-oldexp); // bExp = (maxExp-oldexp); // exptextLbel.text = fExp + "/" + bExp; // } // else // { // fExp = curExp; // bExp = maxExp; // exptextLbel.text = curExp + "/" + maxExp; // } // Expl.value = (float)fExp / (float)bExp; // Expl.value = (curExp * 1f) / (maxExp * 1f); //Debug.Log ("curexp ==" + curExp + " maxExp==" + maxExp + " oldExp==" + oldexp + " (maxExp-oldExp)" + (maxExp - oldexp)); }
void SetBabyData(Baby ba) { BabyData bdata = BabyData.GetData(ba.GetIprop(PropertyType.PT_TableId)); gongjiLable.text = ba.GetIprop(PropertyType.PT_Attack).ToString(); fangyuLable.text = ba.GetIprop(PropertyType.PT_Defense).ToString(); minjieLable.text = ba.GetIprop(PropertyType.PT_Agile).ToString(); jingshenLable.text = ba.GetIprop(PropertyType.PT_Spirit).ToString(); huifuLable.text = ba.GetIprop(PropertyType.PT_Reply).ToString(); bishaLable.text = ba.GetIprop(PropertyType.PT_Crit).ToString(); mingzhongLable.text = ba.GetIprop(PropertyType.PT_Hit).ToString(); fanjiLable.text = ba.GetIprop(PropertyType.PT_counterpunch).ToString(); shanduoLable.text = ba.GetIprop(PropertyType.PT_Dodge).ToString(); jinengLable.text = bdata._SkillNum.ToString(); babysuo.SetActive(ba.GetInst().isLock_); instId = ba.InstId; HeadIconLoader.Instance.LoadIcon(EntityAssetsData.GetData(BabyData.GetData(ba.GetIprop(PropertyType.PT_TableId))._AssetsID).assetsIocn_, babyIcon); //iconkuang.spriteName = BabyData.GetPetQuality(bdata._PetQuality); int Magic = bdata._BIG_Magic - ba.gear_[(int)BabyInitGear.BIG_Magic]; int Stama = bdata._BIG_Stama - ba.gear_[(int)BabyInitGear.BIG_Stama]; int Speed = bdata._BIG_Speed - ba.gear_[(int)BabyInitGear.BIG_Speed]; int Power = bdata._BIG_Power - ba.gear_[(int)BabyInitGear.BIG_Power]; int Strength = bdata._BIG_Strength - ba.gear_[(int)BabyInitGear.BIG_Strength]; int num = Magic + Stama + Speed + Power + Strength; pinjiSp.spriteName = BabyData.GetBabyLeveSp(num); }
void Refresh(int uid) { if (GamePlayer.Instance.babies_list_.Count == 0) { ClearText(); } else { if (uid != Uid) { return; } enterBtn.isEnabled = true; Uid = MainbabyProperty.idss[0]; Inst = GamePlayer.Instance.GetBabyInst(Uid); BabyData bdata = BabyData.GetData(Inst.GetIprop(PropertyType.PT_TableId)); type = bdata._Tpye; int Magic = bdata._BIG_Magic - Inst.gear_[(int)BabyInitGear.BIG_Magic]; int Stama = bdata._BIG_Stama - Inst.gear_[(int)BabyInitGear.BIG_Stama]; int Speed = bdata._BIG_Speed - Inst.gear_[(int)BabyInitGear.BIG_Speed]; int Power = bdata._BIG_Power - Inst.gear_[(int)BabyInitGear.BIG_Power]; int Strength = bdata._BIG_Strength - Inst.gear_[(int)BabyInitGear.BIG_Strength]; int num = Magic + Stama + Speed + Power + Strength; twoSp.spriteName = BabyData.GetBabyLeveSp(num) + "_big"; mofaLabel.text = "[-][666666]" + Inst.gear_[(int)BabyInitGear.BIG_Magic].ToString() + "/" + bdata._BIG_Magic; tiliLabel.text = "[-][666666]" + Inst.gear_[(int)BabyInitGear.BIG_Stama].ToString() + "/" + bdata._BIG_Stama; suduLabel.text = "[-][666666]" + Inst.gear_[(int)BabyInitGear.BIG_Speed].ToString() + "/" + bdata._BIG_Speed; qiangduLabel.text = "[-][666666]" + Inst.gear_[(int)BabyInitGear.BIG_Power].ToString() + "/" + bdata._BIG_Power; liLiangLabel.text = "[-][666666]" + Inst.gear_[(int)BabyInitGear.BIG_Strength].ToString() + "/" + bdata._BIG_Strength; tiliSlider.value = (Inst.gear_[(int)BabyInitGear.BIG_Stama] * 1f) / (bdata._BIG_Stama * 1f); liliangSlider.value = (Inst.gear_[(int)BabyInitGear.BIG_Strength] * 1f) / (bdata._BIG_Strength * 1f); qiangduSlider.value = (Inst.gear_[(int)BabyInitGear.BIG_Power] * 1f) / (bdata._BIG_Power * 1f); suduSlider.value = (Inst.gear_[(int)BabyInitGear.BIG_Speed] * 1f) / (bdata._BIG_Speed * 1f); mofaSlider.value = (Inst.gear_[(int)BabyInitGear.BIG_Magic] * 1f) / (bdata._BIG_Magic * 1f); int dd = Inst.gear_[(int)BabyInitGear.BIG_Magic] + Inst.gear_[(int)BabyInitGear.BIG_Stama] + Inst.gear_[(int)BabyInitGear.BIG_Speed] + Inst.gear_[(int)BabyInitGear.BIG_Power] + Inst.gear_[(int)BabyInitGear.BIG_Strength]; dangshuLable.text = dd.ToString(); tishiObj.SetActive(true); EffectAPI.PlayUIEffect((EFFECT_ID)GlobalValue.EFFECT_UI_pinzhijinjie, jiaotouSp.transform, null, (GameObject obj) => { obj.transform.localPosition = Vector3.zero; }); GlobalInstanceFunction.Instance.Invoke(() => { if (hasDestroyed) { return; } tishiObj.SetActive(false); int Magic1 = oldBdata._BIG_Magic - Inst.gear_[(int)BabyInitGear.BIG_Magic]; int Stama1 = oldBdata._BIG_Stama - Inst.gear_[(int)BabyInitGear.BIG_Stama]; int Speed1 = oldBdata._BIG_Speed - Inst.gear_[(int)BabyInitGear.BIG_Speed]; int Power1 = oldBdata._BIG_Power - Inst.gear_[(int)BabyInitGear.BIG_Power]; int Strength1 = oldBdata._BIG_Strength - Inst.gear_[(int)BabyInitGear.BIG_Strength]; int num1 = Magic1 + Stama1 + Speed1 + Power1 + Strength1; onesp.spriteName = BabyData.GetBabyLeveSp(num1) + "_big"; oldBdata = bdata; }, 1f); } }
void RefreshItem(int babyId) { if (grid == null) { return; } foreach (Transform tra in grid.transform) { Destroy(tra.gameObject); } skillIds.Clear(); skillDatas.Clear(); items.Clear(); Inst = GamePlayer.Instance.GetBabyInst(babyId); BabyData bdata = BabyData.GetData(Inst.GetIprop(PropertyType.PT_TableId)); for (int i = 0; i < Inst.SkillInsts.Count; i++) { SkillData sdata = SkillData.GetMinxiLevelData((int)Inst.SkillInsts[i].skillID_); if (sdata._Name.Equals(LanguageManager.instance.GetValue("playerPro_FightBack"))) { continue; } if (sdata._Name.Equals(LanguageManager.instance.GetValue("playerPro_Dodge"))) { continue; } if (!skillDatas.Contains(sdata)) { skillDatas.Add(sdata); } } for (int i = 0; i < bdata._SkillNum; i++) { GameObject o = GameObject.Instantiate(item) as GameObject; o.SetActive(true); o.name = o.name + i; o.transform.parent = grid.transform; o.transform.localScale = new Vector3(1, 1, 1); BSkillCell bcell = o.GetComponent <BSkillCell>(); // if(i<bdata.skillNum_) // { if (i < skillDatas.Count) { LearnType = 1; bcell.SData = skillDatas[i]; bcell.SetUIDisableb(true); // bcell.TishiLabel.gameObject.SetActive(false); // bcell.IconSuo.gameObject.SetActive(false); UIManager.SetButtonParam(o.gameObject, 0, i); skillIds.Add(skillDatas[i]._Id); } else { LearnType = 2; bcell.SetUIDisableb(false); // bcell.TishiLabel.text ="学习技能"; // bcell.TishiLabel.gameObject.SetActive(false); // bcell.nameLabel.gameObject.SetActive(false); // bcell.LevelLabel.gameObject.SetActive(false); // bcell.Icon.gameObject.SetActive(true); // bcell.IconSuo.gameObject.SetActive(false); // bcell.IconKuang.gameObject.SetActive(true); } // } // else // { // LearnType = 3; // bcell.TishiLabel.text ="尚未解锁"; // bcell.TishiLabel.gameObject.SetActive(false); // bcell.nameLabel.gameObject.SetActive(false); // bcell.LevelLabel.gameObject.SetActive(false); // bcell.Icon.gameObject.SetActive(false); // bcell.IconKuang.gameObject.SetActive(true); // bcell.IconSuo.gameObject.SetActive(true); // } UIManager.SetButtonEventHandler(o, EnumButtonEvent.OnClick, OnClickLearn, LearnType, i); items.Add(o); grid.repositionNow = true; if (i == 2) { GuideManager.Instance.RegistGuideAim(o, GuideAimType.GAT_ThirdLearningBabySkill_SkillSlot); } } }
public void SetIProp(uint guid, COM_PropValue[] props) { if (GamePlayer.Instance.isInBattle) //如果主角在战斗中 { _CacheProp(guid, props); return; } if (GamePlayer.Instance.isMineBaby((int)guid)) { Baby oldBaby = GamePlayer.Instance.GetBabyInst((int)guid); if (oldBaby != null) { for (int i = 0; i < props.Length; ++i) { int val = 0; string fmtStr = ""; bool needPop1 = true; switch (props[i].type_) { case PropertyType.PT_Attack: val = (int)props[i].value_ - oldBaby.GetIprop(PropertyType.PT_Attack); fmtStr += "攻击"; break; case PropertyType.PT_Defense: val = (int)props[i].value_ - oldBaby.GetIprop(PropertyType.PT_Defense); fmtStr += "防御"; break; case PropertyType.PT_Agile: val = (int)props[i].value_ - oldBaby.GetIprop(PropertyType.PT_Agile); fmtStr += "敏捷"; break; case PropertyType.PT_Spirit: val = (int)props[i].value_ - oldBaby.GetIprop(PropertyType.PT_Spirit); fmtStr += "精神"; break; case PropertyType.PT_Reply: val = (int)props[i].value_ - oldBaby.GetIprop(PropertyType.PT_Reply); fmtStr += "回复"; break; case PropertyType.PT_Magicattack: val = (int)props[i].value_ - oldBaby.GetIprop(PropertyType.PT_Magicattack); fmtStr += "魔攻"; break; case PropertyType.PT_Magicdefense: val = (int)props[i].value_ - oldBaby.GetIprop(PropertyType.PT_Magicdefense); fmtStr += "魔抗"; break; //case PropertyType.PT_Damage: // val = (int)props[i].value_ - GamePlayer.Instance.GetIprop(PropertyType.PT_Damage); // fmtStr += "伤害"; // break; //case PropertyType.PT_SneakAttack: // val = (int)props[i].value_ - GamePlayer.Instance.GetIprop(PropertyType.PT_SneakAttack); // fmtStr += "偷袭"; // break; case PropertyType.PT_Crit: val = (int)props[i].value_ - oldBaby.GetIprop(PropertyType.PT_Crit); fmtStr += "必杀"; break; case PropertyType.PT_Hit: val = (int)props[i].value_ - oldBaby.GetIprop(PropertyType.PT_Hit); fmtStr += "命中"; break; case PropertyType.PT_counterpunch: val = (int)props[i].value_ - oldBaby.GetIprop(PropertyType.PT_counterpunch); fmtStr += "反击"; break; case PropertyType.PT_Dodge: val = (int)props[i].value_ - oldBaby.GetIprop(PropertyType.PT_Dodge); fmtStr += "闪躲"; break; case PropertyType.PT_HpMax: val = (int)props[i].value_ - oldBaby.GetIprop(PropertyType.PT_HpMax); fmtStr += "生命上限"; break; case PropertyType.PT_MpMax: val = (int)props[i].value_ - oldBaby.GetIprop(PropertyType.PT_MpMax); fmtStr += "魔法上限"; break; case PropertyType.PT_Diamond: needPop1 = false; val = (int)props[i].value_ - oldBaby.GetIprop(PropertyType.PT_Diamond); CommonEvent.ExcuteRewardDiamond(val, "ByDefault"); break; default: break; } if (val == 0) { continue; } if (needPop1) { PopText.Instance.Show(string.Format("{0}{1}{2}", oldBaby.InstName + " " + fmtStr, val > 0 ? "+" : "", val), val > 0 ? PopText.WarningType.WT_Tip: PopText.WarningType.WT_Warning); } } } } Entity e = GamePlayer.Instance.GetUnit(guid); if (e != null) { if (e.InstId == GamePlayer.Instance.InstId) { for (int i = 0; i < props.Length; ++i) { int val = 0; string fmtStr = ""; bool needPop = true; switch (props[i].type_) { case PropertyType.PT_Attack: val = (int)props[i].value_ - GamePlayer.Instance.GetIprop(PropertyType.PT_Attack); fmtStr += "攻击"; break; case PropertyType.PT_Defense: val = (int)props[i].value_ - GamePlayer.Instance.GetIprop(PropertyType.PT_Defense); fmtStr += "防御"; break; case PropertyType.PT_Agile: val = (int)props[i].value_ - GamePlayer.Instance.GetIprop(PropertyType.PT_Agile); fmtStr += "敏捷"; break; case PropertyType.PT_Spirit: val = (int)props[i].value_ - GamePlayer.Instance.GetIprop(PropertyType.PT_Spirit); fmtStr += "精神"; break; case PropertyType.PT_Reply: val = (int)props[i].value_ - GamePlayer.Instance.GetIprop(PropertyType.PT_Reply); fmtStr += "回复"; break; case PropertyType.PT_Magicattack: val = (int)props[i].value_ - GamePlayer.Instance.GetIprop(PropertyType.PT_Magicattack); fmtStr += "魔攻"; break; case PropertyType.PT_Magicdefense: val = (int)props[i].value_ - GamePlayer.Instance.GetIprop(PropertyType.PT_Magicdefense); fmtStr += "魔抗"; break; //case PropertyType.PT_Damage: // val = (int)props[i].value_ - GamePlayer.Instance.GetIprop(PropertyType.PT_Damage); // fmtStr += "伤害"; // break; //case PropertyType.PT_SneakAttack: // val = (int)props[i].value_ - GamePlayer.Instance.GetIprop(PropertyType.PT_SneakAttack); // fmtStr += "偷袭"; // break; case PropertyType.PT_Crit: val = (int)props[i].value_ - GamePlayer.Instance.GetIprop(PropertyType.PT_Crit); fmtStr += "必杀"; break; case PropertyType.PT_Hit: val = (int)props[i].value_ - GamePlayer.Instance.GetIprop(PropertyType.PT_Hit); fmtStr += "命中"; break; case PropertyType.PT_counterpunch: val = (int)props[i].value_ - GamePlayer.Instance.GetIprop(PropertyType.PT_counterpunch); fmtStr += "反击"; break; case PropertyType.PT_Dodge: val = (int)props[i].value_ - GamePlayer.Instance.GetIprop(PropertyType.PT_Dodge); fmtStr += "闪躲"; break; case PropertyType.PT_HpMax: val = (int)props[i].value_ - GamePlayer.Instance.GetIprop(PropertyType.PT_HpMax); fmtStr += "生命上限"; break; case PropertyType.PT_MpMax: val = (int)props[i].value_ - GamePlayer.Instance.GetIprop(PropertyType.PT_MpMax); fmtStr += "魔法上限"; break; case PropertyType.PT_Diamond: needPop = false; val = (int)props[i].value_ - GamePlayer.Instance.GetIprop(PropertyType.PT_Diamond); CommonEvent.ExcuteRewardDiamond(val, "ByDefault"); break; default: break; } if (val == 0) { continue; } if (needPop) { PopText.Instance.Show(string.Format("{0}{1}{2}", fmtStr, val > 0 ? "+" : "", val), val > 0 ? PopText.WarningType.WT_Tip: PopText.WarningType.WT_Warning); } } } e.SetIprop(props); if (UpdatePlayermake != null) { UpdatePlayermake(); } } else { ClientLog.Instance.LogError("Can not found entity " + guid.ToString()); } }