//玩家操作 void DrawHandle() { TestPropertyPart prop = m_hero.m_propPart; TestBagPart bag = m_hero.m_bagPart; TestTaskPart task = m_hero.m_taskPart; TestLevelPart level = m_hero.m_levelPart; using (new AutoBeginHorizontal(GUILayout.Height(150))) { //重命名 using (new AutoBeginVertical()) { inputName = GUILayout.TextField(inputName, GUILayout.Width(150)); if (GUILayout.Button("改名字", GUILayout.Width(50))) { IoBuffer s = m_socket.GetStream(); s.Write(inputName); m_socket.Send(TestMSG.TMSG_ROLE, TMSG_ROLE.RENAME, s); } } //任务操作 //关卡操作 using (new AutoBeginVertical()) { if (GUILayout.Button("挑战关卡1", GUILayout.Width(70))) { IoBuffer s = m_socket.GetStream(); s.Write(1); m_socket.Send(TestMSG.TMSG_LEVEL, TMSG_LEVEL.FIGHT_OVER, s); } if (GUILayout.Button("挑战关卡2", GUILayout.Width(70))) { IoBuffer s = m_socket.GetStream(); s.Write(2); m_socket.Send(TestMSG.TMSG_LEVEL, TMSG_LEVEL.FIGHT_OVER, s); } } } }
void OnGUI() { if (m_socket == null) { if (GUILayout.Button("登录")) { m_socket = TestClientSocket.Connect(); IoBuffer s = m_socket.GetStream(); m_socket.Send(TestMSG.TMSG_ROLE, TMSG_ROLE.LOGIN, s); } return; } using (new AutoChangeColor(Color.green)) { //绘制玩家信息 DrawInfo(); //绘制玩家操作 DrawHandle(); } }