Ejemplo n.º 1
0
    private void TryRemovePlayer(int playerID)
    {
        ForceItem_N forceItem = this.FindForceItemByPlayerID(playerID);

        if (forceItem != null)
        {
            this.m_ForceDic[forceItem.GetForceID()].Remove(playerID);
            forceItem.ExitForceByNet(playerID);
        }
    }
Ejemplo n.º 2
0
    public static void ChangePlayerStateByNet(int playerID, int state)
    {
        if (null == Instance)
        {
            return;
        }
        ForceItem_N forceItem = Instance.FindForceItemByPlayerID(playerID);

        if (forceItem != null)
        {
            forceItem.ChangePlayerState(playerID, state);
        }
    }
Ejemplo n.º 3
0
    public static void ChangePlayerDelayByNet(int playerID, int delay)
    {
        if (null == Instance)
        {
            return;
        }
        ForceItem_N forceItem = Instance.FindForceItemByPlayerID(playerID);

        if (forceItem != null)
        {
            forceItem.ChangePlayerDelay(playerID, delay);
        }
    }
Ejemplo n.º 4
0
 //log:lz-2016.05.09  1.玩家存在于某个的阵营就是改变阵营,先从原来的阵营移除,然后加入新的阵营,  2.否者 就直接加入
 public static void ChangeRoomPlayerByNet(RoomPlayerInfo playerInfo)
 {
     if (null == Instance)
     {
         return;
     }
     Instance.TryRemovePlayer(playerInfo.mId);
     if (Instance.m_ForceDic != null && Instance.m_ForceDic.Count() > 0)
     {
         ForceItem_N newForceItem = Instance.m_ForceItemList.FirstOrDefault(item => item.GetForceID() == playerInfo.mFocreID);
         if (null != newForceItem)
         {
             newForceItem.JoinForceByNet(playerInfo, Instance.m_IsRoomMaster);
             Instance.m_ForceDic[playerInfo.mFocreID].Add(playerInfo.mId, playerInfo.mRoleID);
             Instance.ActiveStartBtn();
         }
     }
 }
Ejemplo n.º 5
0
    private void InitAllForce()
    {
        List <ForceDesc>  roomForceList = ForceSetting.Instance.HumanForce;
        List <PlayerDesc> roomRoleList  = ForceSetting.Instance.HumanPlayer;

        for (int i = 0; i < roomForceList.Count(); i++)
        {
            GameObject forceItemGo = GameObject.Instantiate(this.ForcePrefab);
            forceItemGo.transform.parent        = this.ForceTable.transform;
            forceItemGo.transform.localPosition = Vector3.zero;
            forceItemGo.transform.localScale    = Vector3.one;
            forceItemGo.gameObject.name         = "ForceItem" + i.ToString("D4");
            ForceItem_N forceItem = forceItemGo.GetComponent <ForceItem_N>();
            forceItem.RepositionEvent        = () => this.RepostionForceTable();
            forceItem.ChangePlayerForceEvent = this.ChangePlayerTeamToNet;
            forceItem.KickPlayerEvent        = this.KickPlayerToNet;
            List <PlayerDesc> roleListForForce = roomRoleList.Where(a => a.Force == roomForceList[i].ID).ToList();
            forceItem.SetForceInfo(roomForceList[i], roleListForForce);
            this.m_ForceItemList.Add(forceItem);
            this.m_ForceDic.Add(roomForceList[i].ID, new Dictionary <int, int>());
        }
        this.RepostionForceTable();
    }