public static async ETVoid OnCreateGameRoom(string gameName, long userId, int bureau, int ruleBit, int peopleCount) { Session session = Game.Scene.GetComponent <SessionComponent>().Session; G2C_CowCowCreateGameRoomGate g2c_Create = (G2C_CowCowCreateGameRoomGate)await session.Call(new C2G_CowCowCreateGameRoomGate() { Name = gameName, UserID = userId, Bureau = bureau, RuleBit = ruleBit, People = peopleCount, }); if (g2c_Create.Error == 0) { Game.EventSystem.Run(CowCowEventIdType.CreateGameRoom, g2c_Create); } }
public static UI Create(G2C_CowCowCreateGameRoomGate room) { try { ResourcesComponent rc = ETModel.Game.Scene.GetComponent <ResourcesComponent>(); rc.LoadBundle(UICowCowAB.CowCow_Prefabs); GameObject ab = (GameObject)rc.GetAsset(UICowCowAB.CowCow_Prefabs, UICowCowType.CowCowGameRoom); GameObject gameObject = UnityEngine.Object.Instantiate(ab); UI ui = ComponentFactory.Create <UI, string, GameObject>(UICowCowType.CowCowGameRoom, gameObject); ui.AddComponent <UICowCow_GameRoomComponent>(); //加入游戏房间组件 ui.GetComponent <UICowCow_GameRoomComponent>().Init(room.GameName, room.Bureau, room.RuleBit, room.RoomID, room.People, room.CurBureau); ui.GetComponent <UICowCow_GameRoomComponent>().AddLocalGamer(room.GamerInfo); ui.GetComponent <UICowCow_GameRoomComponent>().ShowHideInviteButton(true); return(ui); } catch (Exception e) { Log.Error(e); return(null); } }