Beispiel #1
0
 public void EnterRoomWnd()
 {
     audioSvc.PlayAudioInUI(audioSvc.uiAudio);
     audioSvc.PlayBGMusic(Constants.BGRoom3);
     roomPanel = (RoomPanel)UIManager.Instance.PushPanel(UIPanelType.Room);
     //roomPanel.SetWndState();
 }
Beispiel #2
0
    // Use this for initialization
    void Awake()
    {
        roomPanel = FindObjectOfType(typeof(RoomPanel)) as RoomPanel;
        transform.Find("ChatMsgBg/ConfirmButton").GetComponent <Button>().onClick.AddListener(delegate()
        {
            int id = roomPanel.FindIdByName(transform.Find("PlayerNameText").GetComponent <Text>().text);

            if (id == -1)
            {
                return;
            }
            roomPanel.OnChangeSeatConfirmClick("Y" + "," + id);
            DestroyImmediate(gameObject);
        });
        transform.Find("ChatMsgBg/RefuseButton").GetComponent <Button>().onClick.AddListener(delegate()
        {
            int id = roomPanel.FindIdByName(transform.Find("PlayerNameText").GetComponent <Text>().text);
            if (id == -1)
            {
                return;
            }
            roomPanel.OnChangeSeatConfirmClick("Y" + "," + id);
            DestroyImmediate(gameObject);
        });
    }
Beispiel #3
0
 public override void Awake()
 {
     requestCode = RequestCode.Game;
     actionCode  = ActionCode.StartGame;
     roomPanel   = GetComponent <RoomPanel>();
     base.Awake();
 }
 public override void Awake()
 {
     requestCode = RequestCode.Room;
     actionCode  = ActionCode.UpdateRoom;
     roomPanel   = GetComponent <RoomPanel>();
     base.Awake();
 }
Beispiel #5
0
 //callback
 public override void OnJoinedRoom()
 {
     print("Joined Room");
     LobbyPanel.SetActive(false);
     RoomPanel.SetActive(true);
     RoomName_display.text = PhotonNetwork.CurrentRoom.Name;
     EnterRoom();
 }
Beispiel #6
0
 public override void Awake()
 {
     this.requestCode = RequestCode.Game;
     this.actionCode  = ActionCode.StartGame;
     roomPanel        = GetComponent <RoomPanel>();
     Debug.Log("actionCode:" + actionCode);
     base.Awake();
 }
Beispiel #7
0
 //请求加入房主ID为ID的房间
 public void OnJoinClickRequest(int id)
 {
     uIManager.PopPanel();
     uIManager.PushPanel(UIPanelType.Room);
     roomPanel = uIManager.PeekStack().GetComponent <RoomPanel>();
     roomPanel.startBtn.gameObject.SetActive(false);
     joinRoomRequest.SendRequest(id);
 }
 public void SendRequest()
 {
     if (roomPanel == null)
     {
         roomPanel = GameObject.Find("RoomPanel(Clone)").GetComponent <RoomPanel>();
     }
     base.SendRequest("r");
 }
Beispiel #9
0
    public override void Awake()
    {
        //获取UI控制脚本对象
        roomPanel = GetComponent <RoomPanel>();

        this.requestCode = RequestCode.Room;
        this.actionCode  = ActionCode.CreateRoom;
        base.Awake();
    }
Beispiel #10
0
 /// <summary>
 /// 响应按钮事件 初始化房间的操作
 /// </summary>
 void InitRoom()
 {
     GameAudio.instance.PlayAudioSourceUI("click_btn");
     NetStart.myInfo.roomNum = CreatRoom();//自己的信息修改
     RoomPanel.Open().Display(NetStart.myInfo);
     RoomPanel.Open().inPutField.text = NetStart.myInfo.id + "的房间";
     //RoomCommand.RefreshThisRoomInfo(NetStart.myInfo.roomNum);
     Close();
 }
Beispiel #11
0
        public void DeleteRoomPanel()
        {
            if (roomPanel != null)
            {
                GameObject.Destroy(roomPanel.gameObject);
            }

            roomPanel = null;
        }
Beispiel #12
0
    // Use this for initialization
    void Awake()
    {
        roomPanel = transform.parent.parent.GetComponent <RoomPanel>();
        transform.Find("ChangeSeatButton").GetComponent <Button>().onClick.AddListener(OnChangeSeatButtonClick);
        text      = transform.Find("ChangeSeatButton/Text").GetComponent <Text>();
        readyText = transform.Find("ReadyText").GetComponent <Text>();

        image = transform.Find("Image").GetComponent <Image>();
    }
Beispiel #13
0
    // 패널 변경
    void ShowPanel(GameObject CurPanel)
    {
        LobbyPanel.SetActive(false);
        DisconnectPanel.SetActive(false);
        RoomPanel.SetActive(false);
        LeaderBoardPanel.SetActive(false);

        CurPanel.SetActive(true);
    }
 public override void Awake()
 {
     //requestCode = RequestCode.Room;
     //actionCode = ActionCode.CreatRoom;
     requestType = RequestType.Room;
     actionType  = ActionType.CreateRoom;
     base.Awake();
     _roomPanel = this.GetComponent <RoomPanel>();
 }
Beispiel #15
0
 public void SetRoomInfo(int id, string userName, string totalCount, string winCount, RoomPanel roomPanel)
 {
     this.roomPanel                  = roomPanel;
     this.id                         = id;
     Txt_UserName.text               = userName;
     Txt_TotalCount.text             = "总场次:" + totalCount;
     Txt_WinCount.text               = "胜利:" + winCount;
     gameObject.transform.localScale = Vector3.one;
 }
    public void SendRequest()
    {
        string data = "0";

        requestCode = RequestCode.Room;
        actionCode  = ActionCode.ListRoom;
        roomPanel   = GetComponent <RoomPanel>();
        Debug.Log("ListRoomRequest-----requestCode-------->" + requestCode + "-----actionCode---" + actionCode);
        base.SendRequest(data);
    }
Beispiel #17
0
        /// <summary>
        ///     Crea un nuevo Room y lo agrega al panel2D
        /// </summary>
        /// <param name="name"></param>
        /// <param name="pos"></param>
        public RoomsEditorRoom createRoom(string name, Point pos, Size size)
        {
            var rPanel = new RoomPanel(name, this, pos, size);
            var room   = new RoomsEditorRoom(name, rPanel);

            Rooms.Add(room);

            panel2d.Controls.Add(room.RoomPanel.Label);

            return(room);
        }
    private void CreatRoomButtonClicked()
    {
        //显示RoomPanel
        RoomPanel roomPanel = GameFacade.Instance.UiManager.PushPanel(PanelType.Room) as RoomPanel;

        //发送创建房间请求
        if (roomPanel.creatRoomRequest == null)
        {
            roomPanel.creatRoomRequest = roomPanel.GetComponent <CreatRoomRequest>();
        }
        roomPanel.creatRoomRequest.SendRequest();
    }
 private void Update()
 {
     if (userDataList != null)
     {
         LoadRoomItem(userDataList);
         userDataList = null;
     }
     if (ud1 != null && ud2 != null)
     {
         RoomPanel roompanel = uiMng.PushPanel(UIPanelType.Room) as RoomPanel;
         roompanel.SetBlueUserSync(ud1);
         roompanel.SetRedUserSync(ud2);
         ud1 = null; ud2 = null;
     }
 }
Beispiel #20
0
 void Update()
 {
     if (roomList != null)
     {
         LoadRoomItem(roomList);
         roomList = null;
     }
     if (udList != null)
     {
         RoomPanel panel = uiMng.PushPanel(UIPanelType.Room) as RoomPanel;
         panel.SetAllPlayerSync(udList);
         panel.SetLocalPlayerSync(facade.GetUserData());
         udList = null;
     }
 }
    void OnRoomReceived(RoomInfo room)
    {
        int index = panelList.FindIndex(x => x.RoomName == room.Name);

        if (index == -1)//Room is not in the panelList
        {
            GameObject gbj   = Instantiate(roomPanel, panelRect, false);
            RoomPanel  panel = gbj.GetComponent <RoomPanel>();

            panel.SetRoom(room);
            panel.JoinButton.onClick.AddListener(() => OnClickJoinRoom(panel.RoomName, room));
            panelList.Add(panel);
            index = (panelList.Count - 1);
        }
    }
 private void SwitchToPanel(GameObject panelToActivate)
 {
     panelToActivate.SetActive(true);
     if (MainMenuPanel != panelToActivate)
     {
         MainMenuPanel.SetActive(false);
     }
     if (LobbyPanel != panelToActivate)
     {
         LobbyPanel.SetActive(false);
     }
     if (RoomPanel != panelToActivate)
     {
         RoomPanel.SetActive(false);
     }
 }
Beispiel #23
0
 void Update()
 {
     //异步形式显示房间列表
     if (userDataList != null)
     {
         LoadRoomList(userDataList);
         userDataList = null;
     }
     if (ud1 != null || ud2 != null)
     {
         RoomPanel roomPanel = uiManager.PushPanel(UIPanelType.Room) as RoomPanel; //通过返回值获取roomPanel对象
         roomPanel.SetRoomDataSync(ud1, ud2);                                      //异步显示房间内玩家信息
         ud1 = null;
         ud2 = null;
     }
 }
Beispiel #24
0
    /// <summary>
    /// 打开游戏场景
    /// </summary>
    void OpenGameScene()
    {
        RoomPanel.Close();
        GameAudio.instance.PlayAudioSourceBG("Guess");
        GameAudio.instance.PlayAudioSourceUI("start");

        //开始游戏就将房间信息保存,后面的命令(除玩家退出)基本就不会获取房间信息了
        currentRoom = DataDo.Json2Object <RoomInfo>(Decode.DecodSecondContendBtye(bytes));
        SceneManager.LoadScene("GameScene");
        UnityAction <Scene, LoadSceneMode> onLoaded = null;

        onLoaded = (Scene scene, LoadSceneMode mode) =>
        {
            GamePanel.Open().Init(currentRoom);
            SceneManager.sceneLoaded -= onLoaded;
        };
        SceneManager.sceneLoaded += onLoaded;
    }
Beispiel #25
0
 public void SwapPanel(Panel p)
 {
     //If no panel has been placed yet, get rid of the default one
     if (RoomPanel != null)
     {
         //we should never need the designer panel again, so dispose it
         RoomPanel.Dispose();
         this.Controls.Remove(RoomPanel);
     }
     else
     {
         //we may return to this panel later, so don't dispose it
         this.Controls.Remove(CurrentPanel);
     }
     CurrentPanel = p;
     p.Size       = new Size(607, 304);
     p.Location   = new Point(144, 27);
     this.Controls.Add(p);
 }
Beispiel #26
0
    public void JoinRoomResponse(MainPack pack)
    {
        switch (pack.ReturnCode)
        {
        case ReturnCode.Succeed:
            UIManager.Instance.ShowMessage("加入房间成功!");
            RoomPanel roomPanel = UIManager.Instance.PushPanel(PanelName.Room).GetComponent <RoomPanel>();
            roomPanel.UpdatePlayerList(pack);
            break;

        case ReturnCode.Fail:
            UIManager.Instance.ShowMessage("加入房间失败!");
            break;

        default:
            UIManager.Instance.ShowMessage("房间不存在!");
            break;
        }
    }
Beispiel #27
0
    public void CreateRoomResponse(MainPack pack)
    {
        Debug.Log("CreateRoomResponse");
        switch (pack.ReturnCode)
        {
        case ReturnCode.Succeed:

            UIManager.Instance.ShowMessage("创建成功!");
            RoomPanel roomPanel = UIManager.Instance.PushPanel(PanelName.Room, PanelType.normalPanel).GetComponent <RoomPanel>();
            roomPanel.UpdatePlayerList(pack);
            break;

        case ReturnCode.Fail:
            UIManager.Instance.ShowMessage("创建失败!");
            break;

        default:
            Debug.Log("def");
            break;
        }
    }
    //加入房间时的响应
    public void OnJoinResponse(RetuenCode returnCode, UserData owner, UserData self)
    {
        switch (returnCode)
        {
        case RetuenCode.Sucess:
            RoomPanel roomPanel = UIMng.PushPanel(UIPanelType.Room) as RoomPanel;
            if (roomPanel != null)
            {
                roomPanel.SetBlueResult(owner.Username, owner.TotalCount.ToString(), owner.WinCount.ToString());
                roomPanel.SetRedResult(self.Username, self.TotalCount.ToString(), self.WinCount.ToString());
                Facade.SetCurrentRoleType(RoleType.Red);    //设置当前角色类型为红色
            }

            break;

        case RetuenCode.Fail:
            Facade.ShowMsg("房间已满,无法加入");
            break;

        case RetuenCode.NotFound:
            Facade.ShowMsg("房间未找到");
            break;
        }
    }
Beispiel #29
0
 public void SetPanel(BasePanel panel)
 {
     // 设置值时需要强制转型
     roomPanel = panel as RoomPanel;
 }
Beispiel #30
0
 public void SetPanel(BasePanel panel)
 {
     roomPanel = panel as RoomPanel;
 }
        /// <summary>
        /// Crea un nuevo Room y lo agrega al panel2D
        /// </summary>
        /// <param name="name"></param>
        /// <param name="pos"></param>
        public RoomsEditorRoom createRoom(string name, Point pos, Size size)
        {
            RoomPanel rPanel = new RoomPanel(name, this, pos, size);
            RoomsEditorRoom room = new RoomsEditorRoom(name, rPanel);
            rooms.Add(room);

            panel2d.Controls.Add(room.RoomPanel.Label);

            return room;
        }