public override View OnCreateView(LayoutInflater p0, ViewGroup p1, Bundle p2) { var view = p0.Inflate(Resource.Layout.Lobby, p1, false); _builder = RoomConfig.InvokeBuilder((GameActivity)Activity); _builder.SetMessageReceivedListener((GameActivity)Activity); var autoMatch = view.FindViewById<Button>(Resource.Id.AutoMatch); autoMatch.Click += delegate { var am = RoomConfig.CreateAutoMatchCriteria(1, 1, 0); _builder.SetAutoMatchCriteria(am); _config = _builder.Build(); ((GameActivity)Activity).GamesClient.CreateRoom(_config); Activity.Window.AddFlags(WindowManagerFlags.KeepScreenOn); autoMatch.Enabled = false; }; var hostGame = view.FindViewById<Button>(Resource.Id.HostGame); hostGame.Click += delegate { var intent = ((GameActivity)Activity).GamesClient.GetSelectPlayersIntent(1, 1); StartActivityForResult(intent, FriendsIntent); }; var joinGame = view.FindViewById<Button>(Resource.Id.JoinGame); joinGame.Click += delegate { var intent = ((GameActivity)Activity).GamesClient.InvitationInboxIntent; StartActivityForResult(intent, InboxIntent); }; return view; }
public Auditorium(ASystem system, RoomConfig config) : base(system, config) { if (((AuditoriumSystem)system).BlindsProcessorEIC == null) { ((AuditoriumSystem)system).BlindsProcessorEIC = new ThreeSeriesTcpIpEthernetIntersystemCommunications(0x0a, "30.92.1.185", system.ControlSystem); ((AuditoriumSystem)system).BlindsProcessorEIC.Register(); } var eic = ((AuditoriumSystem)system).BlindsProcessorEIC; switch (Id) { case 1: _blindRelays[1] = new UpDownRelays(eic.BooleanInput[1], eic.BooleanInput[2], UpDownRelayModeType.Momentary); _blindRelays[2] = new UpDownRelays(eic.BooleanInput[3], eic.BooleanInput[4], UpDownRelayModeType.Momentary); break; case 2: _blindRelays[1] = new UpDownRelays(system.ControlSystem.RelayPorts[1], system.ControlSystem.RelayPorts[2], UpDownRelayModeType.Momentary); _blindRelays[2] = new UpDownRelays(system.ControlSystem.RelayPorts[3], system.ControlSystem.RelayPorts[4], UpDownRelayModeType.Momentary); foreach (var relays in _blindRelays.Values) { relays.Register(); } break; } }
public async Task Connection(string groupName) { if (string.IsNullOrEmpty(groupName) || groupName == "undefined") { throw new Exception("不正常連線"); } RoomConfig room; int[] leftList = new int[0]; lock (block) { room = _roomList.SearchRoom(groupName); if (room == null) { room = new RoomConfig(); } else if (room.PlayerList.GetList().Count <= 4) { leftList = room.PlayerList.GetLeftList(); } else { throw new Exception("人數已滿"); } } await Groups.AddToGroupAsync(Context.ConnectionId, groupName); await Clients.Group(groupName).SendAsync("GetLeftList", leftList); }
public void AddRoom(int roomid, bool enabled) { try { if (!this._valid) { throw new InvalidOperationException("Not Initialized"); } if (roomid <= 0) { throw new ArgumentOutOfRangeException(nameof(roomid), "房间号需要大于0"); } var config = new RoomConfig { RoomId = roomid, AutoRecord = enabled, }; this.AddRoom(config); } catch (Exception ex) { logger.Debug(ex, "AddRoom 添加 {roomid} 直播间错误 ", roomid); } }
public virtual Task <PlayRoom> CreateEmptyRoomAsync(RoomConfig config) { var room = new StandardPlayRoom(config); Rooms.Add(room); return(Task.FromResult(room as PlayRoom)); }
public DuelResult(DuelResultAdministrator admin, int bp, int exp, bool win, int opponent, RoomConfig config, int roomID) { InitializeComponent(); this.MaxHeight = SystemParameters.MaximizedPrimaryScreenHeight; _admin = admin; _admin.RevengeAnswer += _admin_RevengeAnswer; string text; if (win) { text = "Félicitations pour ta victoire !"; } else { text = "Dommage tu viens de perdre... Tu feras mieux la prochaine fois !"; } text += Environment.NewLine + Environment.NewLine; text += "Tu as remporté " + bp.ToString() + " BPs et " + exp.ToString() + " points d'expériences."; popText.Text = text; _config = config; _opponent = opponent; _roomID = roomID; this.Loaded += DuelResult_Loaded; btnRevenge.MouseLeftButtonDown += BtnRevenge_MouseLeftButtonDown; }
void LoadRoomConfig() { currentRoomConf = saveManager.LoadRoomSet(); /* if (currentRoomConf == null) * currentRoomConf = new RoomConfig();*/ }
public void Save(string path) { var room = new RoomConfig(); room.SizeX = Width; room.SizeY = Height; room.PlayerStartPosition = PlayerStartPosition; room.TileSize = TileSize; room.Tiles = Tiles.Select(t => new RoomConfig.Tile { Position = t.Position, TextureName = t.TextureName, SpawnGroup = t.SpawnGroup }); room.Inanimates = Inanimates.Select(i => new RoomConfig.Inanimate { Position = i.Position, Type = (InanimateType)Enum.Parse(typeof(InanimateType), i.Type) }); room.Enemies = Enemies.Select(i => new RoomConfig.Enemy { Position = i.Position, Type = (EnemyType)Enum.Parse(typeof(EnemyType), i.Type) }); File.WriteAllText(path, JsonConvert.SerializeObject(room)); }
public static void ChangeLevelCount(this RoomConfig config, int newLevelCount) { var data = config.RoomData; var prevCount = config.PlatformLayer.Count; // how many levels does the room have newLevelCount = Mathf.Clamp(newLevelCount, 1, config.MaxPlatformCount); if (newLevelCount == prevCount) { return; } for (var i = prevCount; i < newLevelCount; i++) { var platform = ScriptableObject.CreateInstance <PlatformLayerConfig>(); platform.name = $"{config.name} lvl {i}"; platform.SetTilesSet(data.Settings.TileSet); platform.SetGrid(data.Settings.Grid); platform.Position = Vector2Int.zero; platform.InitSize(data.Size.Vector2Int()); config.PlatformLayer.Add(platform); } for (var i = prevCount; i > newLevelCount; i--) { config.PlatformLayer.RemoveAt(i - 1); } }
public IActionResult CreateRoom(IFormCollection createRoom) { if (session.Keys.Contains("RoomId")) { throw new Exception("已经在一个房间里,不能再建"); } if (!decimal.TryParse(createRoom["TicketPrice"].ToString(), out decimal ticketPrice_)) { ticketPrice_ = 0; } string gameName_ = createRoom["gameProject"].ToString(); IGameProject gameProject_ = LoadGameProject(gameName_); IInningeGame inningeGame_ = new InningeGame(gameProject_); if (!int.TryParse(createRoom["PlayerCountTopLimit"].ToString(), out int limitCount_)) { limitCount_ = 1; } IRoomConfig roomConfig_ = new RoomConfig(inningeGame_) { Affiche = createRoom["Affiche"], Name = createRoom["Name"], PlayerCountTopLimit = limitCount_, SecretKey = createRoom["SecretKey"], TicketPrice = ticketPrice_ }; IRoom room_ = new Room(player, roomConfig_); BoundingEventOfRoom(room_); var gameCityId = createRoom["gameCityId"]; WriteToSeeion(gameCityId, room_); return(RedirectToAction("RoomsList")); }
private void ApplyConfig(RoomConfig conf) { if (conf == null) { return; } foreach (string dirtyPair in conf.pickedItemsAndVariants) { string[] strs = dirtyPair.Split('+'); var item = ScriptableList <RoomItemConfig> .instance.GetItemByID(strs[0]); if (item != null) { var privewingItems = FindObjectsOfType <IChangable>(); //just tag previewing gameobjects with this foreach (var it in privewingItems) { if (it.gameObject.name == item.furnitureType.ToString()) { var rotation = it.gameObject.transform.rotation; //save starting rotation if (item.mesh != null) { it.gameObject.GetComponent <MeshFilter>().mesh = item.mesh; } it.gameObject.GetComponent <MeshRenderer>().material = item.material; it.gameObject.GetComponent <MeshRenderer>().material.color = conf.GetActiveVariant(item).color; it.transform.rotation = rotation; } } } } }
public override void OnActivityResult(int request, int response, Intent data) { if (request == FriendsIntent) { if (response == (int)Result.Ok) { var players = ((Java.Util.ArrayList)data.Extras.Get(GamesClient.ExtraPlayers)).ToArray(); var invites = players.Select(x => x.ToString()).ToList(); _builder.AddPlayersToInvite(invites); _config = _builder.Build(); ((GameActivity)Activity).GamesClient.CreateRoom(_config); Activity.Window.AddFlags(WindowManagerFlags.KeepScreenOn); } } if (request == InboxIntent) { if (response == (int)Result.Ok) { var invitation = (IInvitation)data.Extras.Get(GamesClient.ExtraInvitation); ((GameActivity)Activity).AcceptInvite(invitation.InvitationId); } } }
public static void Awake(this GameControllerComponent self, RoomConfig config) { self.Config = config; self.BasePointPerMatch = config.BasePointPerMatch; self.Multiples = config.Multiples; self.MinThreshold = config.MinThreshold; }
/// <summary> /// 设置配置信息 /// </summary> public void SetConfigValu(RoomConfig data) { this.configData = data; IsConfigRoom = true; RoomIdLanle.gameObject.SetActive(false); transform.GetComponent <UISprite>().spriteName = "BG_MyRoom_waiting"; switch (data.roomType) { case FrameworkForCSharp.Utils.RoomType.PK: ConfigTypeLable.text = "讨赏"; break; case FrameworkForCSharp.Utils.RoomType.WDH: ConfigTypeLable.text = "无挡胡"; break; case FrameworkForCSharp.Utils.RoomType.ZB: ConfigTypeLable.text = "栽宝"; break; case FrameworkForCSharp.Utils.RoomType.NN: ConfigTypeLable.text = "牛牛"; break; case FrameworkForCSharp.Utils.RoomType.Other: break; default: break; } RoomDecLanle.text = "总局数:" + data.GameCount; this.gameObject.SetActive(true); }
public override void OnActivityResult(int request, int response, Intent data) { if (request == FriendsIntent) { if (response == (int)Result.Ok) { var players = ((Java.Util.ArrayList) data.Extras.Get(GamesClient.ExtraPlayers)).ToArray(); var invites = players.Select(x => x.ToString()).ToList(); _builder.AddPlayersToInvite(invites); _config = _builder.Build(); ((GameActivity)Activity).GamesClient.CreateRoom(_config); Activity.Window.AddFlags(WindowManagerFlags.KeepScreenOn); } } if (request == InboxIntent) { if (response == (int)Result.Ok) { var invitation = (IInvitation)data.Extras.Get(GamesClient.ExtraInvitation); ((GameActivity)Activity).AcceptInvite(invitation.InvitationId); } } }
private static void Client_ChoicePopBox(PlayerInfo player, RoomConfig config, ChoiceBoxType type, string pass) { ChoicePopBox box = new ChoicePopBox(player, config, type, pass); box.Topmost = true; box.Show(); Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(() => box.Activate())); }
private static void Client_ShadowDuelRequest(PlayerInfo target, RoomConfig config, Bet bet) { ShadowDuelRequest sdr = new ShadowDuelRequest(target, config, bet, Client.DuelRequestAdmin); sdr.Show(); sdr.Results += (b, result) => Sdr_Results(target, config, b, result); Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(() => sdr.Activate())); }
private static Room ConfigToRoom(RoomConfig roomConfig) { Room newRoom = ScriptableObject.CreateInstance <Room>(); newRoom.scale = roomConfig.scale; newRoom.wall = roomConfig.walls; newRoom.type = roomConfig.roomType; return(newRoom); }
internal void Load(RoomConfig c) { _tiles = c.Tiles.Select(t => new RoomTileViewModel { Position = t.Position, TextureName = t.TextureName, SpawnGroup = t.SpawnGroup }).ToList(); PlayerStartPosition = c.PlayerStartPosition; }
public MultiPurpose(ASystem system, RoomConfig config) : base(system, config) { var eic = ((AuditoriumSystem)system).BlindsProcessorEIC; _blindRelays[1] = new UpDownRelays(eic.BooleanInput[5], eic.BooleanInput[6], UpDownRelayModeType.Momentary); _blindRelays[2] = new UpDownRelays(eic.BooleanInput[7], eic.BooleanInput[8], UpDownRelayModeType.Momentary); }
internal PlayRoom(RoomConfig config, string name) : this(name) { this.Config = config; this.LobbyMatchKeys = config.LobbyMatchKeys; this.MaxPlayerCount = config.MaxPlayerCount; this.SetProperty <bool>(config.IsOpen, "IsOpen"); this.SetProperty <bool>(config.IsVisible, "IsVisible"); this.ExpectedUsers = config.ExpectedUsers; }
public void SendDuelResultAnswer(bool result, RoomConfig config, int opponent, int roomID) { Client.Send(PacketType.DuelResultAnswer, new StandardClientDuelResultAnswer { Config = config, Opponent = opponent, Result = result, RoomID = roomID }); }
private static void Sdr_Results(PlayerInfo target, RoomConfig config, Bet bet, bool result) { Client.Send(PacketType.ShadowDuelRequestAnswer, new StandardClientShadowDuelAnswer { Result = result, BetSerealized = JsonConvert.SerializeObject(bet), BType = bet.BType, Config = config, Player = target }); }
void Start() { uiControl = transform.root.GetComponent <UIControl>(); rectTransform = GetComponent <RectTransform>(); redLobbyButton = transform.Find("LobbyButtons/Lobby-0").GetComponent <RoomConfig>(); greenLobbyButton = transform.Find("LobbyButtons/Lobby-1").GetComponent <RoomConfig>(); blueLobbyButton = transform.Find("LobbyButtons/Lobby-2").GetComponent <RoomConfig>(); lobbyHeader = transform.Find("LobbyHeader").GetComponent <RectTransform>(); rectTransform.anchoredPosition = downPos; IsVisible = false; }
public RoomList(RoomConfig roomConfig, ServerLoggingConfig loggingConfig, MessagePackSerializerOptions serializerOptions) { _roomConfig = roomConfig; _loggingConfig = loggingConfig; _serializerOptions = serializerOptions; _rooms = new Dictionary <int, Room>(); _roomInfoList = new Dictionary <int, RoomInfo>(); _disposeIntervalStopWatch = new Stopwatch(); _rand = new Random(); }
public async Task CreateRoom(string roomId) { var room = new RoomConfig { RoomId = roomId, PlayerList = new PlayerList() }; _roomList.AddRoom(room); await UpdateRoomInfo(); }
// Accept the given invitation. void AcceptInviteToRoom(string invId) { // accept the invitation Log.Debug(TAG, "Accepting invitation: " + invId); RoomConfig.Builder roomConfigBuilder = RoomConfig.InvokeBuilder(this); roomConfigBuilder.SetInvitationIdToAccept(invId) .SetMessageReceivedListener(this) .SetRoomStatusUpdateListener(this); SwitchToScreen(Resource.Id.screen_wait); KeepScreenOn(); ResetGameVars(); GamesClass.RealTimeMultiplayer.Join(mGoogleApiClient, roomConfigBuilder.Build()); }
public GameCityTest() { _mock = new MockRepository(MockBehavior.Default); _playerFactory = _mock.Create <IPlayerJoinRoom>(); _roomFactory = _mock.Create <Room>(); _cityManager = _mock.Create <ICityManager>().Object; _gameCity_ticket_0 = new GameCity("拉斯维加斯", _cityManager); _gameCity_ticket_5 = new GameCity("拉斯维加斯", _cityManager, ticketPrice_: 5); _player = _mock.Create <IPlayerJoinRoom>().Object; _inningGame = _mock.Create <IInningeGame>().Object; _roomConfig = new RoomConfig(_inningGame); _room = new Room(DateTime.Now.AddHours(1), 10, _inningGame, _player, ticketPrice_: 50); }
public void AcceptInvite(string invitationId) { //auto accept _roomFragment = new RoomFragment(); SupportFragmentManager.BeginTransaction() .Replace(Resource.Id.FragmentContainer, _roomFragment) .Commit(); var builder = RoomConfig.InvokeBuilder(this); builder.SetInvitationIdToAccept(invitationId); builder.SetMessageReceivedListener(this); GamesClient.JoinRoom(builder.Build()); Window.AddFlags(WindowManagerFlags.KeepScreenOn); }
public void SendJson(string rawJson, RoomConfig config) { if (!namespaceManager.TopicExists(config.ServiceBusTopic)) { namespaceManager.CreateTopic(config.ServiceBusTopic); } TopicClient Client = TopicClient.CreateFromConnectionString(connectionString, config.ServiceBusTopic); BrokeredMessage message = new BrokeredMessage(rawJson); message.Properties.Add("Location", config.Location); // message.TimeToLive = TimeSpan.FromMinutes(5); Client.Send(message); }
public PlayRoom(RoomConfig config) { Config = config; Name = config.Name; IsVisible = !config.IsVisible.HasValue || config.IsVisible.Value; IsOpen = !config.IsOpen.HasValue || config.IsOpen.Value; EmptyTimeToLive = config.EmptyTimeToLive ?? 3600; PlayerTimeToKeep = config.PlayerTimeToKeep ?? 600; ExpectedMemberPeerIds = config.ExpectedUsers; MaxPlayerCount = config.MaxPlayerCount ?? (byte)10; CustomRoomProperties = config.CustomRoomProperties ?? new Hashtable(); }
public static GameSession CreateGameSession(Zone zone, User user1, User user2) { RoomConfig cfg = new RoomConfig(); int sessid = GetLowestFreeSessionID(); cfg.room_name = "morabaraba_" + sessid; cfg.max_users = 2; Room gameroom = new Room(cfg); zone.RoomManager.AddRoom(gameroom); var sess = new GameSession(sessid, gameroom, user1, user2); gameSessions.Add(sessid, sess); return(sess); }