Exemple #1
0
    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));
    }
Exemple #2
0
    void Start()
    {
        sItem.SetActive(false);
        dItem.SetActive(false);
        if (GamePlayer.Instance.BattleBaby != null)
        {
            if (!GamePlayer.Instance.BattleBaby.isDead)
            {
                babykuang.SetActive(true);
                //babyExpLabel.text = "+"+ Battle.Instance.BattleBabyExp.ToString();
                HeadIconLoader.Instance.LoadIcon(EntityAssetsData.GetData((int)GamePlayer.Instance.BattleBaby.Properties[(int)PropertyType.PT_AssetId]).assetsIocn_, babyIcon);
                HeadIconLoader.Instance.LoadIcon(BabyData.GetData((int)GamePlayer.Instance.BattleBaby.GetIprop(PropertyType.PT_TableId))._RaceIcon, RaceIcon);
                BabyExp.value     = (float)GamePlayer.Instance.BattleBaby.GetIprop(PropertyType.PT_Exp) / ExpData.GetBabyMaxExp(GamePlayer.Instance.BattleBaby.GetIprop(PropertyType.PT_Level));
                babyExpLabel.text = Battle.Instance.BattleBabyExp.ToString();
                //StartCoroutine(NumScrollEffect((int)Battle.Instance.BattleBabyExp,babyExpLabel));
            }
        }
        else
        {
            babykuang.SetActive(false);
        }

        playerExpLabel.text = Battle.Instance.BattleReward.playExp_.ToString();
        //StartCoroutine(NumScrollEffect((int)Battle.Instance.BattleReward.playExp_,playerExpLabel));
        MoneyLabel.text = Battle.Instance.BattleReward.money_.ToString();
        //StartCoroutine(NumScrollEffect((int)Battle.Instance.BattleReward.money_,MoneyLabel));

        HeadIconLoader.Instance.LoadIcon(EntityAssetsData.GetData((int)GamePlayer.Instance.Properties[(int)PropertyType.PT_AssetId]).assetsIocn_, playerIcon);

        long curExp   = (long)GamePlayer.Instance.Properties [(int)PropertyType.PT_Exp];
        long macExp   = ExpData.GetPlayerMaxExp(GamePlayer.Instance.GetIprop(PropertyType.PT_Level));
        long valueExp = curExp / macExp;

        playerExp.value = (float)valueExp;


//		levelup.gameObject.SetActive(false);
//		clevelup.gameObject.SetActive (false);
        hasDestroyed = false;
        //babyL.gameObject.SetActive (false);
        //playerL.gameObject.SetActive (false);
        GlobalInstanceFunction.Instance.Invoke(() => { OnClickclose(null, null, 0, 0); }, 5f);
        //skillItem.SetActive (false);
        //iItem.SetActive (false);
        bool isFlag = true;

        // Battle.Instance.BattleReward.skills_;

        for (int i = 0; i < Battle.Instance.BattleReward.skills_.Length; i++)
        {
            if (i < 5)
            {
                cskills.Add(Battle.Instance.BattleReward.skills_[i]);
            }
        }

        List <COM_Skill> tmpsk = new List <COM_Skill>();

        for (int i = 0; i < cskills.Count; ++i)
        {
            if (tmpsk.Count == 0)
            {
                tmpsk.Add(cskills[i]);
            }
            else
            {
                for (int j = 0; j < tmpsk.Count; ++j)
                {
                    if (tmpsk[j].skillID_ == cskills[i].skillID_)
                    {
                        tmpsk[j].skillExp_  += cskills[i].skillExp_;
                        tmpsk[j].skillLevel_ = cskills[i].skillLevel_;
                        isFlag = false;
                    }
                }
                if (isFlag)
                {
                    tmpsk.Add(cskills[i]);
                    isFlag = true;
                }
            }
        }

        AddSkillItems(tmpsk);
        item = Battle.Instance.BattleReward.items_;
        AddPropsItems(item);
//			for(int i = 0 ;i <item.Length;i++)
//			{
//				ItemData idata = ItemData.GetData((int)item[i]);
//				itemDa.Add(idata);
//			}
//		    PlayerName = GamePlayer.Instance.InstName;
//			PlayerExp = Battle.Instance.BattleReward.playExp_.ToString ();
//			playerL.text = PlayerName;
//			playerE.text = PlayerExp;
//		   moneyLabel.text = Battle.Instance.BattleReward.money_.ToString ();
        //HeadIconLoader.Instance.LoadIcon (EntityAssetsData.GetData((int)GamePlayer.Instance.Properties[(int)PropertyType.PT_AssetId]).assetsIocn_, icon);


//		    if (GamePlayer.Instance.BattleBaby != null)
//			{
//				if(!GamePlayer.Instance.BattleBaby.isDead)
//				{
//				    chongObj.gameObject.SetActive(true);
//					if(GamePlayer.Instance.BattleBaby.isLevelUp_)
//					{
//					clevelup.gameObject.SetActive(true);
//					    //PopText.Instance.Show (levelup.mainTexture);
//						EffectAPI.PlayUIEffect((EFFECT_ID)GlobalValue.EFFECT_PlayerLvUpOnUI, transform);
//					}
//					babyL.gameObject.SetActive(true);
//					babyE.gameObject.SetActive(true);
//					fuhaoSp.gameObject.SetActive(true);
//					//textSp.gameObject.SetActive(true);
//					babyName = GamePlayer.Instance.BattleBaby.InstName;
//					babyExp = Battle.Instance.BattleBabyExp.ToString();
//                    Battle.Instance.BattleBabyExp = 0;
//					babyL.text = babyName;
//					babyE.text = babyExp;
//				HeadIconLoader.Instance.LoadIcon (EntityAssetsData.GetData((int)GamePlayer.Instance.BattleBaby.Properties[(int)PropertyType.PT_AssetId]).assetsIocn_, cicon);
//				HeadIconLoader.Instance.LoadIcon (BabyData.GetData((int)GamePlayer.Instance.BattleBaby.GetIprop(PropertyType.PT_TableId)).RaceIcon_, raceIcon);
//			   }
//
//			}
//			else
//			{
//				babyL.gameObject.SetActive(false);
//				babyE.gameObject.SetActive(false);
//				fuhaoSp.gameObject.SetActive(false);
//			    chongObj.gameObject.SetActive(false);
//
//			}



        GamePlayer.Instance.OpenSystemEnvetString += new RequestEventHandler <int> (UpdateOpenSystemStr);

        //GameManager.Instance.GetActorClone((ENTITY_ID)GamePlayer.Instance.Properties[(int)PropertyType.PT_AssetId], (ENTITY_ID)GamePlayer.Instance.WeaponAssetID, AssetLoadCallBack, new ParamData(GamePlayer.Instance.InstId), "UI");

        UIManager.SetButtonEventHandler(closeBtn.gameObject, EnumButtonEvent.OnClick, OnClickclose, 0, 0);

        GuideManager.Instance.RegistGuideAim(closeBtn.gameObject, GuideAimType.GAT_BattleRewardClose);

        GuideManager.Instance.ProcEvent(ScriptGameEvent.SGE_BattleOverRewardOpen);
    }