コード例 #1
0
ファイル: UIStageMenu.cs プロジェクト: moto2002/snowbattle
    // 显示更新 战斗准备
    void UpdateBattlePreparation()
    {
        for (int i = 0; i < Team.Singleton.TeamNum; ++i)
        {
            if (false == m_teamList.ContainsKey(i))
            {
                UIStageMenuTeamItem item = UIStageMenuTeamItem.Create();
                item.SetParent(m_battlePreparation.transform);
                m_teamList.Add(i, item);
            }
        }

        int curTeamIndex = Team.Singleton.m_curTeamIndex;

        foreach (KeyValuePair <int, UIStageMenuTeamItem> item in m_teamList)
        {
            if (item.Key == curTeamIndex)
            {
                item.Value.ShowWindow();
            }
            else
            {
                item.Value.HideWindow();
            }
        }

        HideAllModel();

        if (!m_teamList.ContainsKey(curTeamIndex))
        {
            Team.Singleton.m_curTeamIndex = 0;
            curTeamIndex = 0;
        }

        UIStageMenuTeamItem teamItem = m_teamList[curTeamIndex];

        teamItem.ShowWindow();

        AddModel(Team.Singleton.GetCard(curTeamIndex, Team.EDITTYPE.enMain), teamItem.m_mainModelObj);
        AddModel(Team.Singleton.GetCard(curTeamIndex, Team.EDITTYPE.enDeputy), teamItem.m_deputyModelObj);
        AddModel(Team.Singleton.GetCard(curTeamIndex, Team.EDITTYPE.enSupport), teamItem.m_supportModelObj);
        AddModel(Team.Singleton.Comrade, teamItem.m_comradeModelObj);

        UILabel mainTips    = teamItem.m_mainTips;
        UILabel deputyTips  = teamItem.m_deputyTips;
        UILabel supportTips = teamItem.m_supportTips;
        UILabel comradeTips = teamItem.m_comradeTips;

        HeroInfo info   = null;
        CSItem   csItem = null;

        csItem = Team.Singleton.Chief;
        // 主角色
        if (null != csItem)
        {
            m_battleBtn.isEnabled = true;

            info = GameTable.HeroInfoTableAsset.Lookup(csItem.IDInTable);
            if (null != info)
            {
                OccupationInfo occupationInfo = GameTable.OccupationInfoAsset.LookUp(info.Occupation);
                if (null != occupationInfo)
                {
                    mainTips.text  = Localization.Get("CardLevel") + csItem.Level + "\n";
                    mainTips.text += Localization.Get("Occ:") + occupationInfo.m_name + "\n";
                    mainTips.text += Localization.Get("Hp:") + csItem.GetHp() + "\n";
                    mainTips.text += Localization.Get("PhyAtk:") + csItem.GetPhyAttack() + "\n";
                    mainTips.text += Localization.Get("MagAtk:") + csItem.GetMagAttack() + "\n";
                    mainTips.text += Localization.Get("Def:") + csItem.GetPhyDefend();
                }
            }

            teamItem.m_noMainTipsLab.SetActive(false);
        }
        // 没有主角色 不可以进行战斗
        else
        {
            m_battleBtn.isEnabled = false;
            teamItem.m_noMainTipsLab.SetActive(true);
        }

        csItem = Team.Singleton.Deputy;
        // 副角色
        if (null != csItem)
        {
            info = GameTable.HeroInfoTableAsset.Lookup(csItem.IDInTable);
            if (null != info)
            {
                OccupationInfo occupationInfo = GameTable.OccupationInfoAsset.LookUp(info.Occupation);
                if (null != occupationInfo)
                {
                    deputyTips.text  = Localization.Get("CardLevel") + csItem.Level + "\n";
                    deputyTips.text += Localization.Get("Occ:") + occupationInfo.m_name + "\n";
                    deputyTips.text += Localization.Get("Hp:") + csItem.GetHp() + "\n";
                    deputyTips.text += Localization.Get("PhyAtk:") + csItem.GetPhyAttack() + "\n";
                    deputyTips.text += Localization.Get("MagAtk:") + csItem.GetMagAttack() + "\n";
                    deputyTips.text += Localization.Get("Def:") + csItem.GetPhyDefend();
                }
            }
        }

        csItem = Team.Singleton.Support;
        // 支援角色
        if (null != csItem)
        {
            info = GameTable.HeroInfoTableAsset.Lookup(csItem.IDInTable);
            if (null != info)
            {
                OccupationInfo occupationInfo = GameTable.OccupationInfoAsset.LookUp(info.Occupation);
                if (null != occupationInfo)
                {
                    supportTips.text  = Localization.Get("CardLevel") + csItem.Level + "\n";
                    supportTips.text += Localization.Get("Occ:") + occupationInfo.m_name + "\n";
                    supportTips.text += Localization.Get("Hp:") + csItem.GetHp() + "\n";
                    supportTips.text += Localization.Get("PhyAtk:") + csItem.GetPhyAttack() + "\n";
                    supportTips.text += Localization.Get("MagAtk:") + csItem.GetMagAttack() + "\n";
                    supportTips.text += Localization.Get("Def:") + csItem.GetPhyDefend();
                }
            }
        }

        csItem = Team.Singleton.Comrade;
        // 战友
        if (null != csItem)
        {
            info = GameTable.HeroInfoTableAsset.Lookup(csItem.IDInTable);
            if (null != info)
            {
                OccupationInfo occupationInfo = GameTable.OccupationInfoAsset.LookUp(info.Occupation);
                if (null != occupationInfo)
                {
                    comradeTips.text  = Localization.Get("CardLevel") + csItem.Level + "\n";
                    comradeTips.text += Localization.Get("Occ:") + occupationInfo.m_name + "\n";
                    comradeTips.text += Localization.Get("Hp:") + csItem.GetHp() + "\n";
                    comradeTips.text += Localization.Get("PhyAtk:") + csItem.GetPhyAttack() + "\n";
                    comradeTips.text += Localization.Get("MagAtk:") + csItem.GetMagAttack() + "\n";
                    comradeTips.text += Localization.Get("Def:") + csItem.GetPhyDefend();
                }
            }
        }


        //      TweenPosition temp = m_battlePreparation.gameObject.transform.GetComponent<TweenPosition>();
//         if (null == temp)
//         {
//             return;
//         }
//
//         Vector3 posV = m_battlePreparation.gameObject.transform.localPosition;
//         posV.x = 0;
//
//         TweenPosition.Begin(m_battlePreparation.gameObject, 0.5f, posV).method = UITweener.Method.EaseIn;



//         temp = m_battleBtn.gameObject.transform.GetComponent<TweenPosition>();
//         if (null == temp)
//         {
//             return;
//         }
//
//         posV = m_battleBtn.gameObject.transform.localPosition;
//         posV.x = 330;
//
//         TweenPosition.Begin(m_battleBtn.gameObject, 0.5f, posV).method = UITweener.Method.EaseIn;

        //m_battlePreparation.gameObject.SetActive(true);
        m_battleBtn.gameObject.SetActive(true);
        m_level.gameObject.SetActive(false);

        TweenPosition temp = m_name.gameObject.transform.GetComponent <TweenPosition>();

        if (null == temp)
        {
            return;
        }

        Vector3 posV = m_name.gameObject.transform.localPosition;

        posV.x = -700;

        TweenPosition.Begin(m_name.gameObject, 0.5f, posV).method = UITweener.Method.EaseIn;

        m_curType = (int)CurType.enBattleType;
    }
コード例 #2
0
ファイル: Player.cs プロジェクト: moto2002/snowbattle
    public override void OnInitProps()
    {
        base.OnInitProps();
        CurrentTableInfo = GameTable.HeroInfoTableAsset.Lookup(IDInTable);
        if (CurrentTableInfo == null)
        {
            return;
        }
        if (0 == Props.GetProperty_Int32(ENProperty.vocationid))
        {
            Props.SetProperty_Int32(ENProperty.vocationid, 1);
        }
        //显示玩家名称
        AddPlayerName();

        HP              = CurrentTableInfo.FHPMax;
        MaxHP           = CurrentTableInfo.FHPMax;
        MoveSpeed       = CurrentTableInfo.MoveSpeed;
        MovebackSpeed   = CurrentTableInfo.MovebackSpeed;
        AnimationSpeed  = CurrentTableInfo.AnimationSpeed;
        AttackAnimSpeed = 1;
        Props.SetProperty_Int32(ENProperty.islive, 1);
        Props.SetProperty_Float(ENProperty.phyattack, (int)CurrentTableInfo.FPhyAttack);
        Props.SetProperty_Float(ENProperty.phydefend, (int)CurrentTableInfo.FPhyDefend);
        Props.SetProperty_Float(ENProperty.magattack, (int)CurrentTableInfo.FMagAttack);
        Props.SetProperty_Float(ENProperty.magdefend, (int)CurrentTableInfo.FMagDefend);
        Props.SetProperty_Float(ENProperty.avoid, (int)CurrentTableInfo.FAvoid);
        Props.SetProperty_Float(ENProperty.hit, (int)CurrentTableInfo.HitRate);
        Props.SetProperty_Float(ENProperty.crit, (int)CurrentTableInfo.CritRate);
        Props.SetProperty_Float(ENProperty.critParam, (int)CurrentTableInfo.CritParam);
        Props.SetProperty_Float(ENProperty.stamina, (float)CurrentTableInfo.StaminaMax);
        Props.SetProperty_Float(ENProperty.maxStamina, (float)CurrentTableInfo.StaminaMax);
        Props.SetProperty_Float(ENProperty.FResist, (float)CurrentTableInfo.FResist);
        Props.SetProperty_Float(ENProperty.AnitInterfere, (float)CurrentTableInfo.AnitInterfereRate);
        Props.SetProperty_Float(ENProperty.AnitInterrupt, (float)CurrentTableInfo.AnitInterruptRate);
        Props.SetProperty_Float(ENProperty.AnitRepel, (float)CurrentTableInfo.AnitRepelRate);
        Props.SetProperty_Float(ENProperty.AnitLauncher, (float)CurrentTableInfo.AnitLauncherRate);
        Props.SetProperty_Float(ENProperty.WoundParam, CurrentTableInfo.WoundParam);
        Props.SetProperty_Int32(ENProperty.WeaponID, CurrentTableInfo.WeaponId);
        Props.SetProperty_Float(ENProperty.ModelScale, CurrentTableInfo.ModelScale);

        CSItem card = CardBag.Singleton.GetCardByGuid(GUID);

        if (card == null)
        {
            if (Type == ActorType.enFollow)
            {
                card = Team.Singleton.Comrade;
            }
        }
        if (card != null)
        {
            MaxHP = card.GetHp();
            HP    = MaxHP;
            Level = card.Level;
            Props.SetProperty_Float(ENProperty.phyattack, card.GetPhyAttack());
            Props.SetProperty_Float(ENProperty.magattack, card.GetMagAttack());
            Props.SetProperty_Float(ENProperty.phydefend, card.GetPhyDefend());
            Props.SetProperty_Float(ENProperty.magdefend, card.GetMagDefend());

            PropertyCustomValue value = Props.GetProperty_Custom(ENProperty.SkillIDList);
            if (value == null)
            {
                Debug.LogWarning("ENProperty.SkillIDList is null");
                return;
            }
            PropertyValueIntListView skillIDList = value as PropertyValueIntListView;
            if (skillIDList == null)
            {
                Debug.LogWarning("ENProperty.SkillIDList cast fail");
                return;
            }
            for (int i = 0; i < card.SkillItemInfoList.Length; ++i)
            {
                skillIDList.m_list[i] = card.SkillItemInfoList[i].m_skillID;
            }
            Props.SetProperty_Custom(ENProperty.SkillIDList, skillIDList);
        }
    }