Example #1
0
 //更新房间列表
 public void UpdateRoom(SockRoomInfo room)
 {
     if (m_dicRoomList.ContainsKey(room.roomId))
     {
         m_dicRoomList [room.roomId].InitRoomItem(room);
     }
 }
Example #2
0
 //添加房间
 public void AddRoom(SockRoomInfo room)
 {
     if (!m_dicRoomList.ContainsKey(room.roomId))
     {
         //to add...
         Object prefab = PrefabLoader.loadFromPack("ZQ/roomItem");
         if (prefab != null)
         {
             GameObject obj = Instantiate(prefab) as GameObject;
             RED.AddChild(obj, m_grid.gameObject);
             RadarRoomItem roomItem = obj.GetComponent <RadarRoomItem> ();
             roomItem.InitRoomItem(room);
             m_dicRoomList.Add(room.roomId, roomItem);
         }
         else
         {
             RED.LogWarning("ZQ/roomItem    not find");
         }
         m_grid.Reposition();
     }
     else
     {
         UpdateRoom(room);
     }
 }
Example #3
0
    public void InitRoomItem(SockRoomInfo room)
    {
        m_data          = room;
        m_txtLv.text    = "Lv" + room.masterLevel.ToString();
        m_txtCount.text = room.nowRoomMemberNum.ToString() + "/" + room.roomMaxMemberNum.ToString();
        m_txtName.text  = room.masterName;

        m_btnJoin.isEnabled = (room.joinState == 1);
    }
Example #4
0
 //删除房间
 public void DelRoom(SockRoomInfo room)
 {
     if (m_dicRoomList.ContainsKey(room.roomId))
     {
         m_dicRoomList [room.roomId].transform.parent = null;
         Destroy(m_dicRoomList [room.roomId].gameObject);
         m_grid.Reposition();
     }
 }
Example #5
0
    //创建房间成功
    public void CreateRoomSuc(SockCreatRoomResponse resp)
    {
        m_dicRoomList.Clear();
        SockRoomInfo room = new SockRoomInfo();

        room.roomId           = resp.data.room.roomId;
        room.joinState        = 1;
        room.roomMaxMemberNum = resp.data.room.roomMaxMemberNum;
        room.nowRoomMemberNum = resp.data.room.nowRoomMemberNum;
        room.masterName       = Core.Data.playerManager.RTData.nickName;
        room.masterLevel      = Core.Data.playerManager.RTData.curLevel;

        m_dicRoomList.Add(resp.data.room.roomId, room);
        curRoom = resp.data;
    }