Exemplo n.º 1
0
    public PlayerAttrInfo LookUp(int level)
    {
        PlayerAttrInfo info = null;

        if (m_map.TryGetValue(level, out info))
        {
            return(info);
        }
        return(null);
    }
Exemplo n.º 2
0
    // 获得队伍最大数量
    public int GetTeamMax()
    {
        PlayerAttrInfo info = GameTable.playerAttrTableAsset.LookUp(GetLevel());

        if (null == info)
        {
            return(0);
        }
        return(info.m_teamNum);
    }
Exemplo n.º 3
0
    // 获得领导力
    public int GetLeadership()
    {
        PlayerAttrInfo info = GameTable.playerAttrTableAsset.LookUp(GetLevel());

        if (null == info)
        {
            return(0);
        }
        return(info.m_leaderShip);
    }
Exemplo n.º 4
0
    //获取最大军资
    public int GetMaxEnergy()
    {
        PlayerAttrInfo playerAttrInfo = GameTable.playerAttrTableAsset.LookUp(GetLevel());

        if (null == playerAttrInfo)
        {
            return(0);
        }

        return(playerAttrInfo.m_energy);
    }
Exemplo n.º 5
0
    // 获得最大体力
    public int GetMaxStamina()
    {
        PlayerAttrInfo playerAttrInfo = GameTable.playerAttrTableAsset.LookUp(GetLevel());

        if (null == playerAttrInfo)
        {
            return(0);
        }

        return(playerAttrInfo.m_stamina);
    }
Exemplo n.º 6
0
    public void Load(byte[] bytes)
    {
        m_map = new Dictionary <int, PlayerAttrInfo>();
        BinaryHelper helper = new BinaryHelper(bytes);

        int sceneCount = helper.ReadInt();

        for (int index = 0; index < sceneCount; ++index)
        {
            PlayerAttrInfo info = new PlayerAttrInfo();
            info.Load(helper);
            m_map.Add(info.m_level, info);
        }
    }
Exemplo n.º 7
0
    void UpdateInfo()
    {
        m_level.text = string.Format(Localization.Get("LevelChange"), User.Singleton.GetLevel());

        PlayerAttrInfo playerAttrInfo = GameTable.playerAttrTableAsset.LookUp(LevelUp.Singleton.m_oldLevel);

        if (null == playerAttrInfo)
        {
            return;
        }

        string str = "";

        // 体力上限变化
        int oldMax = playerAttrInfo.m_stamina;
        int curMax = User.Singleton.GetMaxStamina();

        if (oldMax != curMax)
        {
            str = str + string.Format(Localization.Get("StaminaChange"), curMax) + "\n";
        }

        // 军资上限变化
        oldMax = playerAttrInfo.m_energy;
        curMax = User.Singleton.GetMaxEnergy();

        if (oldMax != curMax)
        {
            str = str + string.Format(Localization.Get("EnergyChange"), curMax) + "\n";
        }

        // 队伍栏变化
        if (MainButtonList.Singleton.IsTeamMaxChange())
        {
            str = str + string.Format(Localization.Get("TeamNumChange"), User.Singleton.GetTeamMax()) + "\n";;
        }

        // 统帅力上限变化
        oldMax = playerAttrInfo.m_leaderShip;
        curMax = User.Singleton.GetLeadership();

        if (oldMax != curMax)
        {
            str = str + string.Format(Localization.Get("LeaderShipChange"), curMax) + "\n";
        }

        m_info.text = str;
    }
Exemplo n.º 8
0
    // 获得队伍上限是否有变化
    public bool IsTeamMaxChange()
    {
        if (GameTable.playerAttrTableAsset == null)
        {
            return(false);
        }

        if (GameTable.playerAttrTableAsset == null)
        {
            return(false);
        }

        // 升级前的
        PlayerAttrInfo playerInfo = GameTable.playerAttrTableAsset.LookUp(User.Singleton.m_lastLevel);

        if (playerInfo == null)
        {
            return(false);
        }

        int oldTeamNum = playerInfo.m_teamNum;

        playerInfo = GameTable.playerAttrTableAsset.LookUp(User.Singleton.GetLevel());
        if (playerInfo == null)
        {
            return(false);
        }
        int newTeamNum = playerInfo.m_teamNum;

        if (newTeamNum != oldTeamNum)
        {
            return(true);
        }

        return(false);
    }
Exemplo n.º 9
0
    // 经验条 上涨的 变化
    void ExpBarUp()
    {
        if (false == BattleSummary.Singleton.m_expBarChange)
        {
            return;
        }

        int level = User.Singleton.GetLevel();
        int exp   = User.Singleton.GetExp();



        int oldExp   = BattleSummary.Singleton.m_oldExp;
        int oldLevel = BattleSummary.Singleton.m_oldLevel;

        // 是否显示 技能升级界面
        bool bShowSkillLevelUp = true;

        // 等级没有变化则 直接涨到目地 数值即可
        if (level == BattleSummary.Singleton.m_oldLevel)
        {
            if (oldExp >= exp)
            {
                BattleSummary.Singleton.m_expBarChange = false;
                oldExp = exp;
            }

            BattleSummary.Singleton.m_oldExp = oldExp + 20;

            PlayerAttrInfo playerAttrInfo = GameTable.playerAttrTableAsset.LookUp(oldLevel);
            if (null == playerAttrInfo)
            {
                return;
            }

            int needExp = playerAttrInfo.m_needExp;

            m_expBar.value = (float)oldExp / (float)needExp;
            m_level.text   = Localization.Get("CardLevel") + level.ToString();

            m_expDetail.text  = exp.ToString() + "/" + needExp.ToString();
            m_expPercent.text = exp * 100 / needExp + "%";

            //Debug.LogError("oldExp:" + oldExp + ",needExp:" + needExp + " m_expBar.value:" + m_expBar.value + ",exp:" + exp);
        }
        // 如果等级变化了 则先 涨满 相应的 等级经验 然后再涨到相应目标数据
        else
        {
            oldExp = 0;
            if (BattleSummary.Singleton.m_oldLevel < level)
            {
                if (m_expBar.value >= 0.9)
                {
                    m_expBar.value = 0f;
                    BattleSummary.Singleton.m_oldLevel = BattleSummary.Singleton.m_oldLevel + 1;
                    m_level.text = Localization.Get("CardLevel") + BattleSummary.Singleton.m_oldLevel.ToString();
                }
                else
                {
                    m_expBar.value = m_expBar.value + 0.1f;
                }
                //Debug.Log("ExpBarUp m_expBar.value:" + m_expBar.value);
            }

            // 如果升级了

            if (BattleSummary.Singleton.m_oldLevel >= level)
            {
                // 让下一阶段动画停止播放
                m_currentCorroutineIndex++;

                // 经验涨完 后显示升级界面
                LevelUp.Singleton.Show();

                bShowSkillLevelUp = false;
            }
            //Debug.LogError(BattleSummary.Singleton.m_oldLevel + ",level:" + level);
        }

        if (bShowSkillLevelUp)
        {
            // 显示技能升级
            if (LevelUp.Singleton.m_skillList.Count > 0)
            {
                // 让下一阶段动画停止播放
                m_currentCorroutineIndex++;

                LevelUp.Singleton.ShowSkill();
            }
        }
    }
Exemplo n.º 10
0
    void UpdateInfo()
    {
        FloorInfo info = GameTable.FloorInfoTableAsset.LookUp(StageMenu.Singleton.m_curFloorId);

        if (null == info)
        {
            Debug.Log("UIBattleSummary UpdateInfo FloorInfo info==null BattleSu mmary.Singleton.m_floorId=" + StageMenu.Singleton.m_curFloorId);
            return;
        }
        m_floorName.text = info.m_name;


        m_maxCombo.text    = BattleSummary.Singleton.m_maxComboCount.ToString();
        m_reliveCount.text = BattleSummary.Singleton.m_reliveCount.ToString();
        m_bossKilled.text  = BattleSummary.Singleton.m_killBossCount.ToString();
        m_elapsedTime.text = BattleSummary.Singleton.GetPassStageTime();


        int killedBossScore  = BattleSummary.Singleton.GetKilledBossScore();
        int elapsedTimeScore = BattleSummary.Singleton.GetElapsedTimeScore();
        int maxComboScore    = BattleSummary.Singleton.GetMaxComboScore();
        int reliveCountScore = BattleSummary.Singleton.GetReliveScore();
        int totalScore       = killedBossScore + elapsedTimeScore + maxComboScore + reliveCountScore;

        //Debug.Log("killedBossScore:" + killedBossScore + ",elapsedTimeScore:" + elapsedTimeScore + ",maxComboScore:" + maxComboScore + ",reliveCountScore:" + reliveCountScore + ",reliveCountScore:" + reliveCountScore);

        m_bossKilledScore.text  = killedBossScore.ToString();
        m_elapsedTimeScore.text = elapsedTimeScore.ToString();
        m_maxComboScore.text    = maxComboScore.ToString();
        m_reliveCountScore.text = reliveCountScore.ToString();

        m_totalScore.text = totalScore.ToString();
        string strRank = BattleSummary.Singleton.GetRank(totalScore, StageMenu.Singleton.m_curFloorId);


        BattleSummary.Singleton.m_curRank = strRank;
        UILabel rank = FindChildComponent <UILabel>(strRank);

        if (rank != null)
        {
            rank.gameObject.SetActive(true);
        }

        m_coinMultiply.text = BattleSummary.Singleton.GetMoneyParam().ToString();
        m_coin.text         = BattleSummary.Singleton.GetBaseMoney().ToString();
        m_exp.text          = BattleSummary.Singleton.GetBaseExp().ToString();
        m_expMultiply.text  = BattleSummary.Singleton.GetExpParam().ToString();

        SetAnimationSpeed("ui-battlevictory-00", 1.0f);
        AnimationClip clip = WindowRoot.GetComponent <Animation>().GetClip("ui-battlevictory-00");

        // 当 第一段动画播完后 没有任何操作则 播放第二段动画
        MainGame.Singleton.StartCoroutine(CoroutineAnimationEnd(++m_currentCorroutineIndex, clip.length, ENSTAGE.enStage1));


        foreach (UITexture item in m_itemList)
        {
            GameObject.Destroy(item.gameObject);
        }
        m_itemList.Clear();

        PlayerAttrInfo playerAttrInfo = GameTable.playerAttrTableAsset.LookUp(User.Singleton.GetLevel());

        if (null == playerAttrInfo)
        {
            return;
        }

        int needExp = playerAttrInfo.m_needExp;
        int exp     = User.Singleton.GetExp();

        m_expDetail.text = exp.ToString() + "/" + needExp.ToString();

        m_expPercent.text = exp * 100 / needExp + "%";
    }
Exemplo n.º 11
0
    // 更新队伍界面相关信息
    public void UpdateInfo()
    {
        // 队伍索引
        int index = Team.Singleton.m_curTeamIndex;

        UpdateTeamIndexItem();

        Debug.Log("当前队伍索引index:" + index);

        HideAllModel();

        // 允许 最大队伍数量
        PlayerAttrInfo playerInfo = GameTable.playerAttrTableAsset.LookUp(User.Singleton.GetLevel());

//         if (null != playerInfo && index+1 > playerInfo.m_teamNum)
//         {
//             // 显示 要达到的等级 并且重置界面
//             m_main.SetActive(false);
//             m_deputy.SetActive(false);
//             m_support.SetActive(false);
//
//             m_teamTips.gameObject.SetActive(true);
//
//            m_teamTipsText.text = string.Format(Localization.Get("TeamUnLockLevel"), playerInfo.m_unlockTeamLevel);
//            return;
//      }

        m_left.gameObject.SetActive(true);
        m_right.gameObject.SetActive(true);

        if (index == 0)
        {
            m_left.gameObject.SetActive(false);
        }
        else if (index == Team.Singleton.m_teamList.Count - 1)
        {
            m_right.gameObject.SetActive(false);
        }
        m_teamNum.GetComponent <UILabel>().text      = playerInfo.m_teamNum.ToString();
        m_curTeamIndex.GetComponent <UILabel>().text = (index + 1) + "";

        m_teamTips.gameObject.SetActive(false);

        // 实际领导力消耗
        int realCost = 0;

        // 主角色
        CSItem card = Team.Singleton.GetCard(index, Team.EDITTYPE.enMain);

        if (null != card)
        {
            // 姓名
            HeroInfo info = GameTable.HeroInfoTableAsset.Lookup(card.IDInTable);

            if (null == info)
            {
                Debug.LogWarning("null == hero card.IDInTable:" + card.IDInTable);
            }
            else
            {
                m_main.SetActive(true);
                m_mainLv.GetComponent <UILabel>().text = Localization.Get("CardLevel") + card.Level;

                AddModel(card, m_mainModel);

                // 星级
                RarityRelativeInfo rarityInfo = GameTable.RarityRelativeAsset.LookUp(info.Rarity);
                IconInfomation     icon       = GameTable.IconInfoTableAsset.Lookup(rarityInfo.m_iconId);
                m_mainRank.GetComponent <UITexture>().mainTexture = PoolManager.Singleton.LoadIcon <Texture>(icon.dirName);
                realCost = realCost + info.Cost;

                OccupationInfo occupationInfo = GameTable.OccupationInfoAsset.LookUp(info.Occupation);
                icon = GameTable.IconInfoTableAsset.Lookup(occupationInfo.m_iconId);
                m_mainOcc.GetComponent <UITexture>().mainTexture = PoolManager.Singleton.LoadIcon <Texture>(icon.dirName);

                m_mainName.GetComponent <UILabel>().text = info.StrName;
            }
        }
        else
        {
            m_main.SetActive(false);
        }

        // 副角色
        card = Team.Singleton.GetCard(index, Team.EDITTYPE.enDeputy);
        if (null != card)
        {
            // 姓名
            HeroInfo info = GameTable.HeroInfoTableAsset.Lookup(card.IDInTable);
            if (null == info)
            {
                Debug.LogWarning("null == hero card.IDInTable:" + card.IDInTable);
            }
            else
            {
                m_deputy.SetActive(true);
                m_deputyLv.GetComponent <UILabel>().text = Localization.Get("CardLevel") + card.Level;

                AddModel(card, m_deputyModel);

                // 星级

                RarityRelativeInfo rarityInfo = GameTable.RarityRelativeAsset.LookUp(info.Rarity);
                IconInfomation     icon       = GameTable.IconInfoTableAsset.Lookup(rarityInfo.m_iconId);
                m_deputyRank.GetComponent <UITexture>().mainTexture = PoolManager.Singleton.LoadIcon <Texture>(icon.dirName);

                realCost = realCost + info.Cost;


                OccupationInfo occupationInfo = GameTable.OccupationInfoAsset.LookUp(info.Occupation);
                icon = GameTable.IconInfoTableAsset.Lookup(occupationInfo.m_iconId);
                m_deputyOcc.GetComponent <UITexture>().mainTexture = PoolManager.Singleton.LoadIcon <Texture>(icon.dirName);

                m_deputyName.GetComponent <UILabel>().text = info.StrName;
            }
        }
        else
        {
            m_deputy.SetActive(false);
        }

        // 支持角色
        card = Team.Singleton.GetCard(index, Team.EDITTYPE.enSupport);
        if (null != card)
        {
            // 姓名
            HeroInfo info = GameTable.HeroInfoTableAsset.Lookup(card.IDInTable);
            if (info != null)
            {
                m_support.SetActive(true);
                m_supportLv.GetComponent <UILabel>().text = Localization.Get("CardLevel") + card.Level;
                // 星级
                RarityRelativeInfo rarityInfo = GameTable.RarityRelativeAsset.LookUp(info.Rarity);
                IconInfomation     icon       = GameTable.IconInfoTableAsset.Lookup(rarityInfo.m_iconId);
                m_supportRank.GetComponent <UITexture>().mainTexture = PoolManager.Singleton.LoadIcon <Texture>(icon.dirName);

                realCost = realCost + info.Cost;

                AddModel(card, m_supportModel);


                OccupationInfo occupationInfo = GameTable.OccupationInfoAsset.LookUp(info.Occupation);
                icon = GameTable.IconInfoTableAsset.Lookup(occupationInfo.m_iconId);
                m_supportOcc.GetComponent <UITexture>().mainTexture = PoolManager.Singleton.LoadIcon <Texture>(icon.dirName);

                m_supportName.GetComponent <UILabel>().text = info.StrName;
            }
            else
            {
                Debug.Log("The info is null: " + card.IDInTable);
            }
        }
        else
        {
            m_support.SetActive(false);
        }

        // 玩家的领导力
        int playerLeadship = User.Singleton.GetLeadership();

        // 超过玩家的领导力显示红色
        if (realCost > playerLeadship)
        {
            m_costText.color = Color.red;
        }
        else
        {
            m_costText.color = Color.white;
        }
        // 领导力
        m_costText.text = realCost + "/" + playerLeadship;
    }