Esempio n. 1
0
    void onClientConnect(NetworkMessage msg)
    {
        OtherPlayerInfo info = msg.ReadMessage <OtherPlayerInfo>();

        if (!info.id.Equals(this.player.identity.netId))
        {
            Player        player = ClientScene.FindLocalObject(info.id).GetComponent <Player>();
            List <Equip>  equips = (List <Equip>)Tools.byteArrayToObject(info.equipment);
            List <string> color  = (List <string>)Tools.byteArrayToObject(info.color);
            player.setColor(color);
            player.playerName = info.characterName;
            foreach (Equip equip in equips)
            {
                if (equip == null)
                {
                    continue;
                }
                player.setEquipModel(equip);
            }
            player.nameTag = (GameObject)Instantiate(Resources.Load("Prefabs/NameTag"));
            player.nameTag.transform.SetParent(GameObject.Find("WorldSpaceCanvas").transform);
            player.nameTag.GetComponent <Text>().text = info.characterName;
            this.player.otherPlayers.Add(player);
        }
    }
Esempio n. 2
0
 protected void RefreshPlayer(OtherPlayerInfo _info)
 {
     playerName = _info.Name;
     if (playerObj != null)
     {
         playerObj.SetActive(true);
     }
     if (CurTargetLv != null)
     {
         CurTargetLv.text = "[" + _info.LevelDes + "]";
     }
     if (CurTargetName != null)
     {
         CurTargetName.text = _info.Name;
     }
     if (CurTargetIcon != null)
     {
         CurTargetIcon.spriteName = _info.IconName;
         CurTargetIcon.MakePixelPerfect();
     }
     if (Creamobj != null)
     {
         Creamobj.SetActive(false);
     }
     if (go != null)
     {
         go.SetActive(false);
     }
     _info.OnBaseUpdate -= RefreshHp;
     _info.OnBaseUpdate += RefreshHp;
 }
Esempio n. 3
0
    //待招募化身数据列表返回
    void S2C_InvitationPlayer(Pt _info)
    {
        pt_update_recruit_robot_list_d746 info = _info as pt_update_recruit_robot_list_d746;

        if (info == null)
        {
            return;
        }
        ClearInviTations();
        OtherPlayerData other = null;

        for (int i = 0; i < info.recruit_robot_list.Count; i++)
        {
            st.net.NetBase.recruit_robot_list data = info.recruit_robot_list[i];
            other = new OtherPlayerData();
            other.serverInstanceID = data.uid;
            other.name             = data.name;
            other.prof             = data.prof;
            other.baseValueDic[ActorBaseTag.Level]      = (ulong)data.lev;
            other.baseValueDic[ActorBaseTag.FightValue] = (ulong)data.fight_score;
            OtherPlayerInfo otherInfo = new OtherPlayerInfo(other);
            if (!openInvitationPlayerData.Contains(otherInfo))
            {
                openInvitationPlayerData.Add(otherInfo);
            }
        }
        if (OpenInvitationPlayer != null && GameCenter.teamMng.isInTeam)
        {
            OpenInvitationPlayer();
        }
    }
Esempio n. 4
0
 public void SetPlayer(OtherPlayerInfo _player)
 {
     player = _player;
     if (player == null)
     {
         return;
     }
     if (name != null)
     {
         name.text = player.Name;
     }
     if (lev != null)
     {
         lev.text = player.LevelDes;
     }
     if (fight != null)
     {
         fight.text = player.FightValue.ToString();
     }
     if (profName != null)
     {
         profName.text = player.ProfName;
     }
     if (icon != null)
     {
         icon.spriteName = player.IconName;
     }
     if (isSelect != null)
     {
         isSelect.value = false;
         isSelect.GetComponent <BoxCollider>().enabled = true;
     }
 }
Esempio n. 5
0
 protected void OnClickNearbyPlayerBtn(GameObject go)
 {
     curNearbyPlayerInfo = UIEventListener.Get(go).parameter as OtherPlayerInfo;
     if (btnParent != null)
     {
         btnParent.gameObject.SetActive(true);
     }
 }
Esempio n. 6
0
    /// <summary>
    /// 多人准备好友
    /// </summary>
    void OnClickFriend(GameObject games)
    {
        OtherPlayerInfo data = UIEventListener.Get(games).parameter as OtherPlayerInfo;

        if (!GameCenter.duplicateMng.CopyTeams.ContainsKey(data.ServerInstanceID))
        {
            GameCenter.duplicateMng.C2S_ReqCopyInFriend(data.ServerInstanceID);
        }
    }
Esempio n. 7
0
    /// <summary>
    /// 创建净数据对象
    /// </summary>
    /// <param name="_id"></param>
    /// <returns></returns>
    public static OtherPlayer CreateDummy(OtherPlayerInfo _info)
    {
        GameObject newGO = null;

        if (GameCenter.instance.dummyOpcPrefab != null)
        {
            newGO      = Instantiate(GameCenter.instance.dummyOpcPrefab) as GameObject;
            newGO.name = "Dummy OPC [" + _info.ServerInstanceID + "]";
        }
        else
        {
            newGO = new GameObject("Dummy OPC[" + _info.ServerInstanceID + "]");
        }
        newGO.tag = "Player";
        if (_info.IsActor)
        {
            newGO.SetMaskLayer(LayerMask.NameToLayer("CGPlayer"));
        }
        else
        {
            newGO.SetMaskLayer(LayerMask.NameToLayer("OtherPlayer"));
        }
        OtherPlayer newOPC = newGO.AddComponent <OtherPlayer>();

        newOPC.isDummy_  = true;
        newOPC.moveFSM   = newGO.AddComponent <ActorMoveFSM>();
        newOPC.id        = _info.ServerInstanceID;
        newOPC.actorInfo = _info;

        if (_info.Movespd != 0)
        {
            newOPC.curMoveSpeed = (float)newOPC.actorInfo.StaticSpeed * (float)_info.Movespd / 100f;        //由c002获得
        }
        else
        {
            newOPC.curMoveSpeed = newOPC.actorInfo.StaticSpeed * MOVE_SPEED_BASE;
        }
        //Debug.Log("_info.Movespd:" + _info.Movespd + ",newOPC.actorInfo.StaticSpeed:" + newOPC.actorInfo.StaticSpeed);
        newOPC.CurRealSpeed = newOPC.curMoveSpeed;
        newOPC.RegistMoveEvent(true);
        newOPC.transform.localRotation = new Quaternion(0, _info.RotationY, 0, 0);
        GameCenter.curGameStage.PlaceGameObjectFromServer(newOPC, _info.ServerPos.x, _info.ServerPos.z, (int)newOPC.transform.localEulerAngles.y);
        GameCenter.curGameStage.AddObject(newOPC);
        if (!newOPC.actorInfo.IsActor) //过场动画演员不展示名字
        {
            newOPC.height       = newOPC.actorInfo.NameHeight;
            newOPC.nameHeight   = newOPC.height;
            newOPC.headTextCtrl = newOPC.gameObject.AddComponent <HeadTextCtrl>();
            newOPC.headTextCtrl.SetRelationship(newOPC.GetRelationship());
            newOPC.headTextCtrl.SetRelationColor(newOPC.GetRelationshipColor());
            newOPC.headTextCtrl.SetName("[b]" + (newOPC.actorInfo.Name));
            newOPC.headTextCtrl.SetGuildName(newOPC.actorInfo.GuildName);
            newOPC.headTextCtrl.SetTitleSprite(newOPC.actorInfo.TitleIcon);
            newOPC.InitNameColor();
        }
        return(newOPC);
    }
Esempio n. 8
0
//	void SelectOnChange(){
//		if(isSelect != null && isSelect.value){
//
//		}
//	}

//	void OnEnable(){
//		if(isSelect != null){
//			isSelect.startsActive = false;
//			isSelect.GetComponent<BoxCollider>().enabled = true;
//		}
//	}
//
    void OnDisable()
    {
        if (isSelect != null)
        {
            isSelect.value = false;
            isSelect.GetComponent <BoxCollider>().enabled = true;
        }
        player = null;
    }
Esempio n. 9
0
    public void TeamData(CopySceneTeamPlayerInfo player, CopyInItemDataInfo _data)   //int _copyGroupID)
    {
        data = _data;
        if (player == null)
        {
            teamData = null;
            if (isAvatar != null)
            {
                isAvatar.SetActive(false);
            }
        }
        else
        {
            OtherPlayerInfo info = GameCenter.duplicateMng.GetInvitationPlayerData(player.pId);
            if (info != null)
            {
                st.net.NetBase.team_member_list baseInfo = new st.net.NetBase.team_member_list();
                baseInfo.uid      = (uint)info.ServerInstanceID;
                baseInfo.name     = info.Name;
                baseInfo.prof     = (uint)info.Prof;
                baseInfo.fighting = (uint)info.FightValue;
                baseInfo.lev      = (uint)info.Level;
                teamData          = new TeamMenberInfo(baseInfo);
                if (isAvatar != null)
                {
                    isAvatar.SetActive(player.isAvatar);
                }
            }
            else
            {
                if (player.pId == GameCenter.teamMng.LeaderId && GameCenter.teamMng.isLeader)
                {
                    st.net.NetBase.team_member_list mPlayer = new st.net.NetBase.team_member_list();
                    mPlayer.uid      = (uint)GameCenter.mainPlayerMng.MainPlayerInfo.ServerInstanceID;
                    mPlayer.prof     = (uint)GameCenter.mainPlayerMng.MainPlayerInfo.Prof;
                    mPlayer.fighting = (uint)GameCenter.mainPlayerMng.MainPlayerInfo.FightValue;
                    mPlayer.lev      = (uint)GameCenter.mainPlayerMng.MainPlayerInfo.CurLevel;
                    mPlayer.name     = GameCenter.mainPlayerMng.MainPlayerInfo.Name;
                    teamData         = new TeamMenberInfo(mPlayer);
                }
                else
                {
                    if (GameCenter.teamMng.TeammatesDic.ContainsKey(player.pId))
                    {
                        teamData = GameCenter.teamMng.TeammatesDic[player.pId] as TeamMenberInfo;
                    }
                }

                if (isAvatar != null)
                {
                    isAvatar.SetActive(false);
                }
            }
        }
        ShowData();
    }
Esempio n. 10
0
 public void SetInfo(OtherPlayerInfo _info)
 {
     if (info != null)
     {
         info.OnBaseUpdate -= Refresh;
     }
     info = _info;
     info.OnBaseUpdate += Refresh;
     Refresh();
 }
Esempio n. 11
0
    protected void OnClickMailBtn(GameObject _obj)
    {
        OtherPlayerInfo info = actorInfo as OtherPlayerInfo;

        if (info != null)
        {
            GameCenter.mailBoxMng.mailWriteData = new MailWriteData(info.Name);
        }
        GameCenter.uIMng.SwitchToSubUI(SubGUIType.BMail);
    }
Esempio n. 12
0
    protected void OnClickNearbyPlayerBtn(GameObject go)
	{
        curNearbyPlayerInfo = UIEventListener.Get(go).parameter as OtherPlayerInfo;
        if (btnParent != null) btnParent.gameObject.SetActive(true);
        if (curNearbyPlayerInfo != null)
        {
            OtherPlayer other = GameCenter.curGameStage.GetOtherPlayer(curNearbyPlayerInfo.ServerInstanceID);
            if (GameCenter.curMainPlayer != null && other != null)
                GameCenter.curMainPlayer.CurTarget = other;
        }
	}
Esempio n. 13
0
 public void Updata(OtherPlayerInfo _data)
 {
     configId = _data.ServerInstanceID;
     isOnline = true;
     prof     = _data.Prof;
     name     = _data.Name;
     lev      = (int)_data.Level;
     //intimacy = _data.i;
     //placeName = _data.sc;
     fight = _data.FightValue;
 }
Esempio n. 14
0
    protected void S2C_BuffUpdate(Pt _info)
    {
        pt_scene_chg_buff_c008 pt = _info as pt_scene_chg_buff_c008;

        if (pt != null)
        {
            BuffInfo bf = new BuffInfo(pt);
            switch ((ObjectType)pt.obj_sort)
            {
            case ObjectType.Player:
                if (pt.oid == GameCenter.mainPlayerMng.MainPlayerInfo.ServerInstanceID)
                {
                    GameCenter.mainPlayerMng.MainPlayerInfo.Update(bf, bf.BuffTypeID, (int)pt.oid);
                }
                else
                {
                    OtherPlayerInfo info = GameCenter.sceneMng.GetOPCInfo((int)pt.oid);
                    if (info != null)
                    {
                        info.Update(bf, bf.BuffTypeID, (int)pt.oid);
                    }
                }
                break;

            case ObjectType.MOB:
                MonsterInfo mob = GameCenter.sceneMng.GetMobInfo((int)pt.oid);
                if (mob != null)
                {
                    mob.Update(bf, bf.BuffTypeID, (int)pt.oid);
                }
                break;

            case ObjectType.Entourage:
                MercenaryInfo ent = null;
                if (GameCenter.mercenaryMng.curMercernaryInfo != null && (int)pt.oid == GameCenter.mercenaryMng.curMercernaryInfo.ServerInstanceID)
                {
                    ent = GameCenter.mercenaryMng.curMercernaryInfo;
                }
                else
                {
                    ent = GameCenter.sceneMng.GetEntourageInfo((int)pt.oid);
                }
                if (ent != null)
                {
                    ent.Update(bf, bf.BuffTypeID, (int)pt.oid);
                }
                break;

            default:
                break;
            }
        }
    }
Esempio n. 15
0
 protected void RefreshMonsterOwner(int _id)//add 鲁家旗刷新最高伤害击杀者
 {
     if (_id == 0)
     {
         go.SetActive(false);
         return;
     }
     go.SetActive(true);
     curId = _id;
     //击杀者就是主玩家
     if (_id == GameCenter.mainPlayerMng.MainPlayerInfo.ServerInstanceID)
     {
         mainPlayerInfo = GameCenter.mainPlayerMng.MainPlayerInfo;
         if (mainPlayerInfo != null)
         {
             if (playerIcon != null)
             {
                 playerIcon.spriteName = mainPlayerInfo.IconName;
                 playerIcon.MakePixelPerfect();
             }
             SetOwerHp();
             if (levAndNameLabel != null)
             {
                 levAndNameLabel.text = mainPlayerInfo.LevelDes + "[" + mainPlayerInfo.Name + "]";
             }
             mainPlayerInfo.OnBaseUpdate -= RefreshMonsterOwnerHp;
             mainPlayerInfo.OnBaseUpdate += RefreshMonsterOwnerHp;
         }
     }
     else//击杀者是其他玩家
     {
         data = GameCenter.sceneMng.GetOPCInfo(_id);
         if (data != null)
         {
             if (playerIcon != null)
             {
                 playerIcon.spriteName = data.IconName;
                 playerIcon.MakePixelPerfect();
             }
             SetOtherHp();
             if (levAndNameLabel != null)
             {
                 levAndNameLabel.text = data.LevelDes + "[" + data.Name + "]";
             }
             data.OnBaseUpdate -= RefreshOtherMonsterOwnerHp;
             data.OnBaseUpdate += RefreshOtherMonsterOwnerHp;
         }
         else
         {
             go.SetActive(false);
         }
     }
 }
Esempio n. 16
0
    protected void S2C_BuffDelete(Pt _info)
    {
        pt_scene_remove_buff_c009 pt = _info as pt_scene_remove_buff_c009;

        if (pt != null)
        {
            switch ((ObjectType)pt.obj_sort)
            {
            case ObjectType.Player:
                if (pt.oid == GameCenter.mainPlayerMng.MainPlayerInfo.ServerInstanceID)
                {
                    GameCenter.mainPlayerMng.MainPlayerInfo.Update(null, (int)pt.buff_type, (int)pt.oid);
                }
                else
                {
                    OtherPlayerInfo info = GameCenter.sceneMng.GetOPCInfo((int)pt.oid) as OtherPlayerInfo;
                    if (info != null)
                    {
                        info.Update(null, (int)pt.buff_type, (int)pt.oid);
                    }
                }
                break;

            case ObjectType.MOB:
                MonsterInfo mob = GameCenter.sceneMng.GetMobInfo((int)pt.oid) as MonsterInfo;
                if (mob != null)
                {
                    mob.Update(null, (int)pt.buff_type, (int)pt.oid);
                }
                break;

            case ObjectType.Entourage:
                MercenaryInfo ent = null;
                if (GameCenter.mercenaryMng.curMercernaryInfo != null && (int)pt.oid == GameCenter.mercenaryMng.curMercernaryInfo.ServerInstanceID)
                {
                    ent = GameCenter.mercenaryMng.curMercernaryInfo;
                }
                else
                {
                    ent = GameCenter.sceneMng.GetEntourageInfo((int)pt.oid);
                }
                if (ent != null)
                {
                    ent.Update(null, (int)pt.buff_type, (int)pt.oid);
                }
                break;

            default:
                break;
            }
        }
    }
Esempio n. 17
0
    //计算战斗力通过OtherPlayerInfo
    public static int CalculatedCombat(OtherPlayerInfo playerInfo)
    {
        if (playerInfo == null)
        {
            return(0);
        }
        int totalCombat = 0;

        for (int i = 0; i < playerInfo.heros.Count; i++)
        {
            totalCombat += playerInfo.heros[i].attr1[0];
        }
        return(totalCombat);
    }
Esempio n. 18
0
    protected override void OnOpen()
    {
        base.OnOpen();
        NPC npc = GameCenter.curMainPlayer.CurTarget as NPC;

        if (npc != null)
        {
            CurNpcInfo = GameCenter.sceneMng.GetNPCInfo(npc.id);
        }
        Model model = GameCenter.curMainPlayer.CurTarget as Model;

        if (model != null)
        {
            CurModelInfo = GameCenter.sceneMng.GetModelInfo(model.id);
        }
    }
Esempio n. 19
0
    /// <summary>
    /// 创建净数据对象
    /// </summary>
    /// <param name="_id"></param>
    /// <returns></returns>
    public static Model CreateDummy(OtherPlayerInfo _info)
    {
        GameObject newGO = null;

        if (GameCenter.instance.dummyOpcPrefab != null)
        {
            newGO      = Instantiate(GameCenter.instance.dummyOpcPrefab) as GameObject;
            newGO.name = "Dummy Model [" + _info.ServerInstanceID + "]";
        }
        else
        {
            newGO = new GameObject("Dummy Model[" + _info.ServerInstanceID + "]");
        }
        newGO.tag = "Player";
        if (_info.IsActor)
        {
            newGO.SetMaskLayer(LayerMask.NameToLayer("CGPlayer"));
        }
        else
        {
            newGO.SetMaskLayer(LayerMask.NameToLayer("OtherPlayer"));
        }
        Model newOPC = newGO.AddComponent <Model>();

        newOPC.isDummy_  = true;
        newOPC.id        = _info.ServerInstanceID;
        newOPC.actorInfo = _info;
        newOPC.typeID    = ObjectType.Model;
        newOPC.transform.localRotation = new Quaternion(0, _info.RotationY, 0, 0);
        GameCenter.curGameStage.PlaceGameObjectFromServer(newOPC, _info.ServerPos.x, _info.ServerPos.z, (int)newOPC.transform.localEulerAngles.y);
        GameCenter.curGameStage.AddObject(newOPC);
        if (!newOPC.actorInfo.IsActor) //过场动画演员不展示名字
        {
            newOPC.height       = newOPC.actorInfo.NameHeight;
            newOPC.nameHeight   = newOPC.height * newOPC.scaleValue;
            newOPC.headTextCtrl = newOPC.gameObject.AddComponent <HeadTextCtrl>();
            newOPC.headTextCtrl.SetName(newOPC.actorInfo.Name);
            newOPC.headTextCtrl.SetTitle(newOPC.actorInfo.TitleName);
        }
        return(newOPC);
    }
Esempio n. 20
0
 void OnOPCInfoListUpdate()
 {
     if (isMain)
     {
         info = GameCenter.mainPlayerMng.MainPlayerInfo;
     }
     else
     {
         OtherPlayerInfo otherInfo = null;
         foreach (int _info in GameCenter.sceneMng.OPCInfoDictionary.Keys)
         {
             if (otherInfo == null)
             {
                 otherInfo = GameCenter.sceneMng.OPCInfoDictionary[_info]  as OtherPlayerInfo;
             }
         }
         info = otherInfo;
     }
     if (info == null)
     {
         return;
     }
     Show();
     if (name != null)
     {
         name.text = info.Name;
     }
     if (lev != null)
     {
         lev.text = info.LevelDes;
     }
     if (icon != null)
     {
         icon.spriteName = info.IconName;
     }
     info.OnBaseUpdate     += ShowBase;
     info.OnPropertyUpdate += ShowProperty;
 }
Esempio n. 21
0
    /// <summary>
    /// 交易开始
    /// </summary>
    /// <param name="_info"></param>
    private void S2C_OnGetTradeStart(Pt _info)
    {
        pt_trade_start_d633 pt = _info as pt_trade_start_d633;

        if (pt != null)
        {
            tradeID = (int)pt.session_id;
            OtherPlayerInfo op = GameCenter.sceneMng.GetOPCInfo(tradeTargetUid);
            if (op != null)
            {
                TradeTargetName = op.Name;
                //    Debug.Log("交易对象的名字" + op.Name);
            }
            else
            {
                TradeTargetName = "交易对象";
                Debug.LogError("交易的对象在场景中没有找到!by黄洪兴");
            }

            GameCenter.uIMng.SwitchToUI(GUIType.TRADE);
        }
        //Debug.Log("收到交易开始协议" + (int)pt.session_id);
    }
Esempio n. 22
0
    protected AssetMng.DownloadID Create(OtherPlayerInfo _info,
                                         System.Action <OtherPlayer, EResult> _callback)
    {
        return(exResources.GetRace(_info.Prof,
                                   delegate(GameObject _asset, EResult _result)
        {
            if (GameCenter.IsDummyDestroyed(ObjectType.Player, _info.ServerInstanceID))
            {
                _callback(null, EResult.Failed);
                return;
            }
            if (_result != EResult.Success)
            {
                _callback(null, _result);
                return;
            }
            this.gameObject.name = "Other Player [" + _info.ServerInstanceID + "]";

            GameObject newGo = Instantiate(_asset) as GameObject;
            newGo.name = _asset.name;
            newGo.transform.parent = this.gameObject.transform;
            newGo.transform.localEulerAngles = Vector3.zero;
            newGo.transform.localPosition = Vector3.zero;
            newGo.AddComponent <PlayerAnimFSM>();
            newGo.AddComponent <PlayerRendererCtrl>();
            newGo.SetActive(false);
            newGo.SetActive(true);
            this.gameObject.AddComponent <FXCtrl>();


            isDummy_ = false;
            animationRoot = newGo.transform;
            Init();

            _callback(this, _result);
        }));
    }
Esempio n. 23
0
    /// <summary>
    /// 收到交易请求
    /// </summary>
    /// <param name="_info"></param>
    private void S2C_OnGetTradeReq(Pt _info)
    {
        pt_req_trade_s2c_d631 pt = _info as pt_req_trade_s2c_d631;

        if (pt != null)
        {
            tradeReqID     = (int)pt.req_id;
            tradeTargetUid = (int)pt.uid;
            OtherPlayerInfo op = GameCenter.sceneMng.GetOPCInfo(tradeTargetUid);
            if (op != null)
            {
                TradeTargetName = op.Name;
                //    Debug.Log("交易对象的名字" + op.Name);
            }
            else
            {
                TradeTargetName = "交易对象";
                Debug.LogError("交易的对象在场景中没有找到!by黄洪兴");
            }

            OnGetTradeReq();
        }
        //Debug.Log("收到交易请求协议");
    }
Esempio n. 24
0
    /// <summary>
    /// 服务端确认复活
    /// </summary>
    /// <param name="_pt"></param>
    protected void S2C_Reborn(Pt _pt)
    {
        pt_revive_d205 msg = _pt as pt_revive_d205;
        int            id  = (int)msg.revive_uid;

        if (id == GameCenter.mainPlayerMng.MainPlayerInfo.ServerInstanceID)
        {
            //if(msg.revive_sort == (int)RebornType.REBORNCURMAP)
            //successTime = (int)Time.time;
            mainPlayerInfo.Reborn(msg);
            if (OnRebornEvent != null)
            {
                OnRebornEvent((int)msg.revive_sort);
            }
        }
        else
        {
            OtherPlayerInfo opc = GameCenter.sceneMng.GetOPCInfo(id);
            if (opc != null)
            {
                opc.Reborn(msg);
            }
        }
    }
Esempio n. 25
0
    public void SetArenaPlayer(OtherPlayerInfo other)
    {
        if (icon != null)
        {
            icon.spriteName = other.IconHalf;
            icon.MakePixelPerfect();
        }
        if (fight != null)
        {
            fight.text = other.FightValue.ToString();
        }
        if (name != null)
        {
            name.text = other.Name;
        }
        if (rank != null)
        {
            rank.text = ConfigMng.Instance.GetUItext(20, new string[1] {
                GameCenter.arenaMng.ArenaServerDataInfo.GetPlayerRank(other.ServerInstanceID)
            });
        }
        if (btnParent != null)
        {
            btnParent.SetActive(false);
        }

        UIEventListener.Get(killBtn).onClick = delegate {
            if (GameCenter.arenaMng.ArenaServerDataInfo.surplus_time > 0)
            {
                MessageST mst = new MessageST();
                mst.messID = 236;
                GameCenter.messageMng.AddClientMsg(mst);
            }
            else if (GameCenter.arenaMng.ArenaServerDataInfo.challenge_num <= 0)
            {
                //MessageST mst = new MessageST();
                //mst.messID = 168;
                //GameCenter.messageMng.AddClientMsg(mst);

                StepConsumptionRef stepData = ConfigMng.Instance.GetStepConsumptionRef(GameCenter.arenaMng.ArenaServerDataInfo.buyChallengeTimes + 1);
                int goldNum = 0;
                if (stepData.areaTime.Count > 0)
                {
                    goldNum = stepData.areaTime[0].count;
                }
                else
                {
                    Debug.Log("StepConsumptionRef配置出错");
                    return;
                }
                if (!GameCenter.arenaMng.ShowAreaTimeTip)
                {
                    if (GameCenter.mainPlayerMng.MainPlayerInfo.TotalDiamondCount < (ulong)goldNum)
                    {
                        GoToRecharge();
                    }
                    else
                    {
                        GameCenter.arenaMng.C2S_ReqBuyChallengeTimes();
                        GameCenter.arenaMng.C2S_RepArenaKill(other.ServerInstanceID);
                    }
                }
                else
                {
                    MessageST mst = new MessageST();
                    object[]  pa  = { 1 };
                    mst.pars    = pa;
                    mst.delPars = delegate(object[] ob)
                    {
                        if (ob.Length > 0)
                        {
                            bool b = (bool)ob[0];
                            if (b)
                            {
                                GameCenter.arenaMng.ShowAreaTimeTip = false;
                            }
                        }
                    };
                    mst.messID = 488;
                    mst.words  = new string[1] {
                        goldNum.ToString()
                    };
                    mst.delYes = delegate
                    {
                        if (GameCenter.mainPlayerMng.MainPlayerInfo.TotalDiamondCount < (ulong)goldNum)
                        {
                            GoToRecharge();
                        }
                        else
                        {
                            GameCenter.arenaMng.C2S_ReqBuyChallengeTimes();
                            GameCenter.arenaMng.C2S_RepArenaKill(other.ServerInstanceID);
                        }
                    };
                    GameCenter.messageMng.AddClientMsg(mst);
                }
            }
            else
            {
                GameCenter.arenaMng.C2S_RepArenaKill(other.ServerInstanceID);
            }
        };
        UIEventListener.Get(checkBtn).onClick = delegate {
            GameCenter.previewManager.C2S_AskOPCPreview(other.ServerInstanceID);
        };
        UIEventListener.Get(firendBtn).onClick = delegate {
            GameCenter.friendsMng.C2S_AddFriend(other.ServerInstanceID);
        };
        UIEventListener.Get(emailBtn).onClick = delegate {
            GameCenter.mailBoxMng.mailWriteData = new MailWriteData(other.Name);
            GameCenter.uIMng.SwitchToSubUI(SubGUIType.BMail);
        };
        UIEventListener.Get(chatBtn).onClick = delegate {
            GameCenter.chatMng.OpenPrivateWnd(other.Name);
        };
        UIEventListener.Get(btnParent).onClick = delegate {
            btnParent.SetActive(false);
        };
    }
Esempio n. 26
0
    protected void Refresh()
    {
        if (btnParent != null)
        {
            btnParent.SetActive(false);
        }
        if (actorInfo != null)
        {
            actorInfo.OnBaseUpdate -= RefreshHp;
        }
        if (GameCenter.curMainPlayer.CurTarget != null)
        {
            switch (GameCenter.curMainPlayer.CurTarget.typeID)
            {
            case ObjectType.Player:
                OtherPlayerInfo opcInfo = GameCenter.sceneMng.GetOPCInfo(GameCenter.curMainPlayer.CurTarget.id);
                if (opcInfo != null)
                {
                    actorInfo = opcInfo;
                    btnParent.SetActive(false);
                    RefreshPlayer(opcInfo);
                    actorInfo.OnBaseUpdate += RefreshHp;
                    RefreshLable();
                }
                if (resultMapDisable)
                {
                    GameCenter.uIMng.ShowMapMenu(true);
                    resultMapDisable = false;
                }
                break;

            case ObjectType.MOB:
                MonsterInfo mobInfo = GameCenter.sceneMng.GetMobInfo(GameCenter.curMainPlayer.CurTarget.id);
                if (mobInfo != null)
                {
                    actorInfo = mobInfo;
                    btnParent.SetActive(false);
                    RefreshMonster(mobInfo);
                    actorInfo.OnBaseUpdate += RefreshHp;
                    RefreshLable();
                    if (mobInfo.IsBoss)
                    {
                        if (mobInfo.OwnerID != 0)
                        {
                            RefreshMonsterOwner(mobInfo.OwnerID);
                        }
                        resultMapDisable = true;
                        GameCenter.uIMng.ShowMapMenu(false);
                    }
                    else
                    {
                        if (resultMapDisable)
                        {
                            GameCenter.uIMng.ShowMapMenu(true);
                            resultMapDisable = false;
                        }
                    }
                }
                break;

//                case ObjectType.NPC:
//                    NPCInfo npcInfo = GameCenter.sceneMng.GetNPCInfo(GameCenter.curMainPlayer.CurTarget.id);
//                    if (npcInfo != null)
//                    {
//                        actorInfo = npcInfo;
//                        btnParent.SetActive(false);
//                        RefreshNPC(npcInfo);
//						if (progressHp != null)
//							progressHp.value = (1.0f);
//                        if (HpLable != null)
//                            HpLable.text = 100 + "/" + 100;
//                    }
//                    break;
            default:
                actorInfo = null;
                CloseUI();
                if (resultMapDisable)
                {
                    GameCenter.uIMng.ShowMapMenu(true);
                    resultMapDisable = false;
                }
                break;
            }
        }
        else
        {
            if (resultMapDisable)
            {
                GameCenter.uIMng.ShowMapMenu(true);
                resultMapDisable = false;
            }
            actorInfo = null;
            CloseUI();
        }
    }
Esempio n. 27
0
    void ShowPlayer()
    {
        if (itemPlayerUI == null)
        {
            return;
        }
        if (ListPlayer.Count <= 0)
        {
            if (noInvitate != null)
            {
                noInvitate.gameObject.SetActive(true);
            }
            itemPlayerUI.gameObject.SetActive(false);
            return;
        }
        if (noInvitate != null)
        {
            noInvitate.gameObject.SetActive(false);
        }
        InvitationPlayerUI playerUI = null;
        GameObject         go       = null;
        OtherPlayerInfo    data     = null;

        for (int j = 0; j < items.Count; j++)
        {
            items[j].gameObject.SetActive(false);
        }
        int i = 0;

        for (; i < ListPlayer.Count; i++)
        {
            data = ListPlayer[i];
            if (GameCenter.duplicateMng.CopyTeams.ContainsKey(data.ServerInstanceID))
            {
                continue;
            }
            if (items.Count <= i)
            {
                go = (GameObject)GameObject.Instantiate(itemPlayerUI.gameObject);
                go.transform.parent        = itemPlayerUI.transform.parent;
                go.transform.localPosition = Vector3.zero;
                go.transform.localScale    = Vector3.one;
                go.name  = "InvitationPlayer" + data.ServerInstanceID;
                playerUI = go.GetComponent <InvitationPlayerUI>();
                items.Add(playerUI);
            }
            else
            {
                go       = items[i].gameObject;
                playerUI = items[i];
            }
            playerUI.SetPlayer(data);
            if (playerUI.btn != null)
            {
                UIEventListener.Get(playerUI.btn).onClick   = OnClickFriend;
                UIEventListener.Get(playerUI.btn).parameter = data;
            }
            if (playerUI.isSelect != null)
            {
                EventDelegate.Remove(playerUI.isSelect.onChange, SelectOnChange);
                EventDelegate.Add(playerUI.isSelect.onChange, SelectOnChange);
            }
            go.SetActive(true);
        }

        for (; i < items.Count; i++)
        {
            items[i].gameObject.SetActive(false);
        }

        if (grid != null)
        {
            grid.repositionNow = true;
        }
        if (panel != null)
        {
            SpringPanel.Begin(panel.gameObject, panelStartPosition, 10f);
        }
        SetToggleBox();
    }