示例#1
0
文件: PVP.cs 项目: tapenjoyGame/cry
    public void OnBattleStart(pd_PvpPlayerInfo info)
    {
        if (m_AvailableBattleCount <= 0)
        {
            Popup.Instance.Show(ePopupMode.PVPDelayReset, false);
            //Tooltip.Instance.ShowMessageKey("PVPNotAvailableLimit");
            return;
        }
        //else if (m_NextAvailableBattleTime > Network.Instance.ServerTime)
        //{
        //    //Tooltip.Instance.ShowMessageKey("PVPNotAvailableTime");
        //    Popup.Instance.Show(ePopupMode.PVPDelayReset, true);
        //    return;
        //}

        m_SelectedEnemyInfo = info;
        C2G.PvpGetBattleInfo packet = new C2G.PvpGetBattleInfo();
        packet.enemy_account_idx = info.account_idx;
        Network.GameServer.JsonAsync <C2G.PvpGetBattleInfo, C2G.PvpGetBattleInfoAck>(packet, OnPvpGetBattleInfoHandler);
    }
示例#2
0
    //---------------------------------------------------------------------------
    public void Init(pd_PvpPlayerInfo info, bool selected)
    {
        m_PVPInfo = info;
        if (info.rank <= 3)
        {
            m_SpriteRank.spriteName = string.Format("arena_ranking_{0}", info.rank);
            m_labelRank.gameObject.SetActive(false);
            m_SpriteRank.gameObject.SetActive(true);
        }
        else
        {
            m_labelRank.text = info.rank.ToString();
            m_labelRank.gameObject.SetActive(true);
            m_SpriteRank.gameObject.SetActive(false);
        }

        m_labelMessage.text = info.message;

        if (m_Profile == null)
        {
            m_Profile = NGUITools.AddChild(m_ProfileIndicator, m_ProfilePrefab).GetComponent <PlayerProfile>();
        }

        m_Profile.UpdateProfile(info.leader_creature, info.nickname, info.player_level);

// #if !UNITY_EDITOR
//         if (selected == true)
//         {
//             m_BtnDetail.GetComponent<BoxCollider2D>().enabled = false;
//             m_BtnDetail.SetState(UIButtonColor.State.Disabled, true);
//             m_BtnDetail.enabled = false;
//         }
//         else
// #endif
//         {
//             m_BtnDetail.GetComponent<BoxCollider2D>().enabled = true;
//             m_BtnDetail.SetState(UIButtonColor.State.Normal, true);
//             m_BtnDetail.enabled = true;
//         }
        m_BG.SetSpriteActive(selected);
    }
示例#3
0
文件: PVP.cs 项目: tapenjoyGame/cry
    //int m_BattleDelay = 0;
    void OnPVPGetInfo(C2G.PVPGetInfo packet, C2G.PVPGetInfoAck ack)
    {
        if (ack.pvp_player_infos == null || ack.pvp_player_infos.Count == 0)
        {
            bNeedDefenseTeamSet         = true;
            ShowPopupSetDefenseTeamTime = Time.realtimeSinceStartup + ShowPopupSetDefenseTeamTimeGap;
            return;
        }

        m_LastOffenseTime = ack.last_offense_at;
        //m_AvailableBattleCount = ack.available_daily_battle_count;
        m_MyPvpInfo   = ack.pvp_player_infos[0];
        m_EnemiesInfo = ack.pvp_player_infos.GetRange(1, ack.pvp_player_infos.Count - 1);

        if (m_Profile == null)
        {
            m_Profile = NGUITools.AddChild(ProfileIndicator, PrefabProfile).GetComponent <PlayerProfile>();
        }
        m_Profile.UpdateProfile(Network.PlayerInfo.leader_creature, Network.PlayerInfo.nickname, Network.PlayerInfo.player_level);

        UpdateInfo();
    }
示例#4
0
    public void Init(pd_PvpPlayerInfo info, Action <pd_PvpPlayerInfo> OnCallback = null)
    {
        if (info == null)
        {
            m_ToggleContents.value = false;
            return;
        }
        m_ToggleContents.value = true;

        m_Info = info;

        m_LabelPower.text = Localization.Format("PowerValue", info.team_power);

        m_LabelRank.text = Localization.Format("PVPRank", info.rank);

        if (m_Profile == null)
        {
            m_Profile = NGUITools.AddChild(ProfileIndicator, PrefabProfile).GetComponent <PlayerProfile>();
        }
        m_Profile.UpdateProfile(info.leader_creature, info.nickname, info.player_level);

        m_OnStartBattleClick = OnCallback;
    }
示例#5
0
文件: PVP.cs 项目: tapenjoyGame/cry
    public PVPBattleInfo(pd_PvpPlayerInfo enemy_info, C2G.PvpGetBattleInfoAck ack)
    {
        this.enemy_info = enemy_info;

        for (int i = 0; i < ack.creatures.Count; ++i)
        {
            List <pd_EquipData> equips = ack.equips.FindAll(e => e.creature_idx == ack.creatures[i].creature_idx);
            pd_EquipData        weapon = equips.Find(e => EquipInfoManager.Instance.GetInfoByIdn(e.equip_idn).CategoryInfo.EquipType == SharedData.eEquipType.weapon);
            pd_EquipData        armor  = equips.Find(e => EquipInfoManager.Instance.GetInfoByIdn(e.equip_idn).CategoryInfo.EquipType == SharedData.eEquipType.armor);
            List <Rune>         runes  = ack.runes.FindAll(r => r.creature_idx == ack.creatures[i].creature_idx).Select(e => new Rune(e)).ToList();
            Creatures.Add(new Creature(ack.creatures[i], weapon, armor, runes));
        }

        this.enemy_team_data = new TeamData(ack.team_data.team_type, null);
        enemy_team_data.SetCreatures(ack.team_data.creature_infos.Select(c => new TeamCreature(Creatures.Find(lc => lc.Idx == c.team_creature_idx), c.auto_skill_index)).ToList(), false);
        if (ack.team_data.leader_creature_idx > 0)
        {
            Creature leader_creature = Creatures.Find(c => c.Idx == ack.team_data.leader_creature_idx);
            if (leader_creature != null)
            {
                enemy_team_data.SetLeaderCreature(leader_creature, ack.team_data.use_leader_skill_type);
            }
        }
    }