Exemplo n.º 1
0
        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;
        }
Exemplo n.º 2
0
        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;
            }
        }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
        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);
            }
        }
Exemplo n.º 5
0
        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;
        }
Exemplo n.º 7
0
    void LoadRoomConfig()
    {
        currentRoomConf = saveManager.LoadRoomSet();

/*        if (currentRoomConf == null)
 *          currentRoomConf = new RoomConfig();*/
    }
Exemplo n.º 8
0
        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));
        }
Exemplo n.º 9
0
        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);
            }
        }
Exemplo n.º 10
0
        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"));
        }
Exemplo n.º 11
0
    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;
                    }
                }
            }
        }
    }
Exemplo n.º 12
0
        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);
                }
            }
        }
Exemplo n.º 13
0
 public static void Awake(this GameControllerComponent self, RoomConfig config)
 {
     self.Config            = config;
     self.BasePointPerMatch = config.BasePointPerMatch;
     self.Multiples         = config.Multiples;
     self.MinThreshold      = config.MinThreshold;
 }
Exemplo n.º 14
0
    /// <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);
    }
Exemplo n.º 15
0
        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);
                }
            }
        }
Exemplo n.º 16
0
        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()));
        }
Exemplo n.º 17
0
        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()));
        }
Exemplo n.º 18
0
    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);
    }
Exemplo n.º 19
0
 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;
 }
Exemplo n.º 20
0
        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);
        }
Exemplo n.º 21
0
        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
     });
 }
Exemplo n.º 23
0
 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
     });
 }
Exemplo n.º 24
0
    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;
    }
Exemplo n.º 25
0
        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();
        }
Exemplo n.º 26
0
        public async Task CreateRoom(string roomId)
        {
            var room = new RoomConfig
            {
                RoomId     = roomId,
                PlayerList = new PlayerList()
            };

            _roomList.AddRoom(room);

            await UpdateRoomInfo();
        }
Exemplo n.º 27
0
 // 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());
 }
Exemplo n.º 28
0
 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);
 }
Exemplo n.º 29
0
        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);
        }
Exemplo n.º 30
0
        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);
        }
Exemplo n.º 31
0
        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();
        }
Exemplo n.º 32
0
        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);
        }