예제 #1
0
    public void GetInformations(int id, int place, int chips, string pseudo, NetworkPlayer play)
    {
        ServerSystem system = dealer.system;

        if (id > system.Players.Count - 1)
        {
            Player TempStats = new Player(place, play, pseudo, chips);
            system.Players.Add(TempStats);
        }
        else
        {
            system.Players[id].place  = place;
            system.Players[id].pseudo = pseudo;
            system.Players[id].player = play;
            system.Players[id].chips  = chips;
        }

        if (play == Network.player)
        {
            myID       = id;
            selfPlayer = system.Players[id];
            if (pseudo == "")
            {
                selfPlayer.pseudo = hud.NameText.text;
                if (selfPlayer.pseudo == "")
                {
                    selfPlayer.pseudo = pseudoRandom[Random.Range(0, pseudoRandom.Count)];
                }
                CardsSplitter.toolsSplitter.networkView.RPC("SetClientInformations", RPCMode.Server, myID, selfPlayer.pseudo);
            }
        }

        system.Players[id].UpdateUI();
    }
예제 #2
0
        void OnDestroy()
        {
            ServerSystem.Destroy();


            UnInitLobbyMainSystems();
        }
예제 #3
0
 /// <summary>
 /// 唤醒
 /// </summary>
 void Start()
 {
     UnInitLobbyMainSystems();
     //初始化各个子系统
     ServerSystem.Init();
     InitLobbyMainSystems();
     Inited = true;
 }
예제 #4
0
        /// <summary>
        /// 唤醒
        /// </summary>
        void Start()
        {
            instance = this;

            //初始化各个子系统
            ServerSystem.Init();


            InitLobbyMainSystems();
            Inited = true;
        }
예제 #5
0
    void Start()
    {
        system = this.GetComponent <ServerSystem>();
        gDeck  = new Deck(CardsSplitter.toolsSplitter);
        gDeck.Mix();
        SetDeck();

        for (int i = 0; i < 3; i++)
        {
            DealerAndBlindsPlayers.Add(null);
        }
    }
예제 #6
0
    private void Awake()
    {
        Instance = this;
        DontDestroyOnLoad(gameObject);
        dic = new Dictionary <string, SyncPosition>();
        OnlineData data = new OnlineData();

        data.id        = playerid;
        data.desirePos = player.transform.position;
        data.speed     = 4f;
        player.GetComponent <SyncPosition>().data = data;
        player.transform.GetChild(0).GetComponent <TextMeshPro>().text = playerid;
        dic.Add(playerid, player.GetComponent <SyncPosition>());
    }
예제 #7
0
        public void SendJoystickMoveRateLimited(float2 nextMove)
        {
            double currentTimeMs = World.TinyEnvironment().frameTime;

            accumulatedMove.x += nextMove.x;
            accumulatedMove.y += nextMove.y;

            accumulatedMove.x = (float)math.clamp(accumulatedMove.x, -1.0, 1.0);
            accumulatedMove.y = (float)math.clamp(accumulatedMove.y, -1.0, 1.0);

            if (currentTimeMs > (lastUpdateMs + updateRateMs))
            {
                // if (accumulatedMove.x < deadZone && accumulatedMove.y < deadZone)
                ServerSystem.SendJoystickToServer(accumulatedMove.x, accumulatedMove.y);
                lastUpdateMs      = currentTimeMs;
                accumulatedMove.x = 0;
                accumulatedMove.y = 0;
            }
        }
예제 #8
0
        //子系统的更新
        void Update()
        {
            ServerSystem.Update();

            UpdateLobbyMainSystems();
        }
예제 #9
0
 protected override void OnStartRunning()
 {
     ServerSystem.ConnectToServer(127, 0, 0, 1, 9002);
 }
예제 #10
0
        private static void _server_Started()
        {
            var world           = new World();
            var commandRecorder = new EntityCommandRecorder();

            var scene = new Scene("Server", world, commandRecorder);

            var networkedEntities = new NetworkedEntities(world);
            var physicsSystem     = new PhysicsSystem();

            var editors = new List <IEditor>()
            {
                //new EditorConsole(_client.Scene),
                new SelectedEntitySystem(world),
                new EntityInspector(world),
                new EntityList(world),
                new SystemList(scene),
                new AverageMetricValue(),
                new MetricGraph()
            };

            _editorMenu.AddEditorSet("Server", editors);
            scene.AddSystems(editors);

            var parallelRunner = new DefaultParallelRunner(4);

            var serverSystem = new ServerSystem(world, _messageTargetMap);

            serverSystem.AddListener(new TransformMessageApplier(networkedEntities));
            serverSystem.AddListener(new InputForceApplier(physicsSystem, world));
            serverSystem.AddListener(new SimpleCameraMover(physicsSystem, networkedEntities));
            serverSystem.AddListener(new VoxelEditReceiver(physicsSystem));
            serverSystem.AddListener(new VoxelSpaceLoadReciever(world));

            scene.AddSystem(serverSystem);

            var voxelTypes = LoadVoxelTypes();

            var worldVoxelSpace = world.CreateEntity();

            worldVoxelSpace.Set(new NetworkedEntity()
            {
                Id = Guid.NewGuid()
            });
            worldVoxelSpace.Set(new Transform(worldVoxelSpace));
            worldVoxelSpace.Set(new VoxelSpace(32, 1, worldVoxelSpace));
            worldVoxelSpace.Set(new EntityMetaData()
            {
                Name = "Voxel Space"
            });

            scene.AddSystem(new WorldSpaceLoader((e) => { }, world, worldVoxelSpace, 4, 3, 32));
            scene.AddSystem(new ChunkGeneratorSystem(commandRecorder, parallelRunner, new ChunkGenerator(), world));

            scene.AddSystem(new VoxelSpaceExpanderSystem((e) => { }, world));

            scene.AddSystem(new PhysicsBlockFinder(world, parallelRunner));

            scene.AddSystem(new VoxelSpaceChangePropogator(world));
            scene.AddSystem(new VoxelStaticBodyGenerator(physicsSystem, world));
            scene.AddSystem(new VoxelSpaceDynamicBodyGenerator(physicsSystem, world));
            scene.AddSystem(physicsSystem);
            scene.AddSystem(new DynamicBodyPositionSync(world));

            scene.AddSystem(new CharacterInputSystem(physicsSystem, world));

            scene.AddSystem(new EntityRemovalSync(world));
            scene.AddSystem(new ClientEntityAssignmentSystem());
            scene.AddSystem(new TransformChangeServerSystem(world));
            scene.AddSystem(new VoxelSpaceAddedServerSystem(world));
            scene.AddSystem(new VoxelGridExistenceServerSystem(world));
            scene.AddSystem(new VoxelGridChangeServerSystem(world));
            scene.AddSystem(new ComponentSyncServerSystem <EntityMetaData>(world));

            scene.AddSystem(new FlagClearingSystem <NeighbourMemberChanged>(world));

            _server.SetScene(scene);
        }