/// <summary> /// 退出房间 /// </summary> void ExitRoom() { GameAudio.instance.PlayAudioSourceUI("close_btn"); MMunePanel.Open(); Close(); RoomCommand.ExitRoom(NetStart.myInfo.roomNum, NetStart.myInfo.id);//发送退出命令给服务器 }
private IEnumerator LoadingScene() { //yield return new WaitForSeconds(8.0f); AsyncOperation op = SceneManager.LoadSceneAsync("Scenes/MainScence"); UnityAction <Scene, LoadSceneMode> onLoaded = null; onLoaded = (Scene scene, LoadSceneMode mode) => { MMunePanel.Open(); SceneManager.sceneLoaded -= onLoaded; }; SceneManager.sceneLoaded += onLoaded; op.allowSceneActivation = false; int displayProgress = 0; //当前展示进度 int toProgress = 100; //总进度 displayProgress = (int)op.progress * 100; //化整 while (displayProgress < toProgress) { displayProgress++; progressUI.fillAmount = op.progress; Debug.Log("++++++++++++ " + displayProgress); yield return(new WaitForEndOfFrame()); } op.allowSceneActivation = true; }
public override void DoCommand() { friendListInfo = DataDo.Json2Object <List <PersonalInfo> >(Decode.DecodFirstContendBtye(bytes)); //Debug.Log("查找到好友人数:" + friendListInfo.Count); if (MMunePanel.Get()) { MMunePanel.Get().UpdateFriendList(friendListInfo); } }
public override void DoCommand()//接收排行榜 { //Rank.loadRank = true; //服务器是封装的是什么类型,客户端解析的时候就用什么类型去解 rankList = DataDo.Json2Object <List <PersonalInfo> >(Decode.DecodFirstContendBtye(bytes)); if (MMunePanel.Get()) { MMunePanel.Get().UpdateRankList(rankList); } }
GameObject roomPrefb; //房间预制件 void Start() { close_B.onClick.AddListener(() => { GameAudio.instance.PlayAudioSourceUI("close_btn"); MMunePanel.Open(); Close(); }); creatRoom_B.onClick.AddListener(InitRoom); //roomPrefb = (GameObject)Resources.Load("Prefabs/room"); }
public static void LoadMMenuScene() { // LoadingPanel.Open();//.LoadTo("MainScence"); SceneManager.LoadScene("Scenes/MainScence"); UnityAction <Scene, LoadSceneMode> onLoaded = null; onLoaded = (Scene scene, LoadSceneMode mode) => { MMunePanel.Open(); SceneManager.sceneLoaded -= onLoaded; }; SceneManager.sceneLoaded += onLoaded; }
public void Start()//是函数,启动时我们只执行一次,里面的循环体不受影响 { MMunePanel.Close(); chatfriendPrefb = (GameObject)Resources.Load("Prefabs/chat/chatManPreb"); //动态加载聊天好友预制件 msg_you_Prefb = (GameObject)Resources.Load("Prefabs/chat/msg_you"); //msg_you预制件 msg_me_Prefb = (GameObject)Resources.Load("Prefabs/chat/msg_me"); //msg_me预制件 exit_B.onClick.AddListener(() => { GameAudio.instance.PlayAudioSourceUI("close_btn"); MMunePanel.Open(); Close(); }); //DisplayChatManList(); UpdateMsg(); }
public override void DoCommand() { NetStart.myInfo = DataDo.Json2Object <PersonalInfo>(Decode.DecodFirstContendBtye(bytes)); //if (NetStart.myInfo.status == 1)//登录成功--进行主界面数据的获取--跳转界面 { NetStart.isLogin = true;//登录标志(在线) SceneManager.LoadScene("Scenes/MainScence"); UnityAction <Scene, LoadSceneMode> onLoaded = null; onLoaded = (Scene scene, LoadSceneMode mode) => { MMunePanel.Open(); WelcomePanel.Open(); SceneManager.sceneLoaded -= onLoaded; }; SceneManager.sceneLoaded += onLoaded; } }
void Exit() { GameAudio.instance.PlayAudioSourceUI("close_btn"); GameAudio.instance.PlayAudioSourceBG("Main"); Close(); GamePanel.Close(); //退出房间 RoomCommand.ExitRoom(GameCommand.currentRoom.roomID, NetStart.myInfo.id); SceneManager.LoadScene("Scenes/MainScence"); UnityAction <Scene, LoadSceneMode> onLoaded = null; onLoaded = (Scene scene, LoadSceneMode mode) => { MMunePanel.Open(); SceneManager.sceneLoaded -= onLoaded; }; SceneManager.sceneLoaded += onLoaded; }
/// <summary> /// 心跳包 查好友 查排行 发送 /// </summary> void Refresh_Send() { if (isLogin) { if (Time.time - lastTime >= heartBeatTime) { HeartbeatCommand.Heartbeat_Send();//心跳包发送 if (MMunePanel.Get()) { RankCommand.Rank_Send(); //获取查询排行的命令 SelectFriendCommand.SelectFriendList(); //查找所有好友 } if (RoomsHallPanel.Get()) { RoomCommand.SelectRooms();//获取所有房间 } //if (RoomPanel.Get()) //{ // RoomCommand.RefreshThisRoomInfo(myInfo.roomNum);//刷新当前房间信息 //} lastTime = Time.time; } } }