コード例 #1
0
        public async Task BroadcastSessionToServer()
        {
            if (SessionContext.CurrentLevel.Scene is BossScene scene)
            {
                BossGamePlatform p = new BossGamePlatform
                {
                    Monster = (StendenClicker.Library.AbstractMonster.Boss)SessionContext.CurrentLevel.Monster,
                    Scene   = scene
                };

                await MultiPlayerHub.Invoke("broadcastSessionBoss", SessionContext.HostPlayerId, SessionContext.CurrentPlayerList, p);
            }
            else
            {
                NormalGamePlatform p = new NormalGamePlatform
                {
                    Monster = (StendenClicker.Library.AbstractMonster.Normal)SessionContext.CurrentLevel.Monster,
                    Scene   = (NormalScene)SessionContext.CurrentLevel.Scene
                };

                await MultiPlayerHub.Invoke <bool>("broadcastSessionNormal", SessionContext.HostPlayerId, SessionContext.CurrentPlayerList, p).ContinueWith((task) =>
                {
                    bool success = task.Result;
                });
            }
        }
コード例 #2
0
        private void ReceiveBossMonsterBroadcast(List <Player> players, BossGamePlatform pl, bool force)
        {
            MultiPlayerSession session = new MultiPlayerSession
            {
                CurrentPlayerList = players,
                CurrentLevel      = new GamePlatform()
                {
                    Monster = pl.Monster, Scene = pl.Scene
                },
                ForceUpdate = force
            };

            UpdateSession(session);
        }