• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Net.NetworkSessionProperties类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Microsoft.Xna.Framework.Net.NetworkSessionProperties的典型用法代码示例。如果您正苦于以下问题:C# NetworkSessionProperties类的具体用法?C# NetworkSessionProperties怎么用?C# NetworkSessionProperties使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



NetworkSessionProperties类属于Microsoft.Xna.Framework.Net命名空间,在下文中一共展示了NetworkSessionProperties类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: CreateMatch

 public void CreateMatch()
 {
     if (Gamer.SignedInGamers.Count == 0 && !Guide.IsVisible)
     {
         Guide.ShowSignIn(1, false);
         return;
     }
     else if (Gamer.SignedInGamers.Count == 0)
     {
         return;
     }
     StateManager.NetworkData.LeaveSession();
     if (StateManager.NetworkData.AvailableSessions != null)
     {
         if (!StateManager.NetworkData.AvailableSessions.IsDisposed)
         {
             StateManager.NetworkData.AvailableSessions.Dispose();
         }
         StateManager.NetworkData.AvailableSessions = null;
     }
     LoadingScreen lScr = StateManager.AllScreens[ScreenType.LoadingScreen.ToString()] as LoadingScreen;
     lScr.Reset();
     lScr.UserCallback = new PGCGame.CoreTypes.Delegates.AsyncHandlerMethod(FinishLanSectorHost);
     lScr.LoadingText = "Hosting\n"+(StateManager.NetworkData.SessionType == NetworkSessionType.SystemLink ? "LAN" : "LIVE")+" sector...";
     lScr.ScreenFinished += new EventHandler(hosting_finish);
     //lScr.ScreenFinished += new EventHandler(lScr_ScreenFinished);
     NetworkSessionProperties netSession = new NetworkSessionProperties();
     netSession[(int)NetworkSessionPropertyType.SessionType] = (int)StateManager.NetworkData.SessionMode;
     NetworkSession.BeginCreate(StateManager.NetworkData.SessionType, new SignedInGamer[] { Gamer.SignedInGamers[0] }, 8, 0, netSession, lScr.Callback, null);
     StateManager.ScreenState = CoreTypes.ScreenType.LoadingScreen;
 }
开发者ID:GreatMindsRobotics,项目名称:PGCGame,代码行数:31,代码来源:NetworkMatchTypeSelectionScreen.cs


示例2: FindSession

        public void FindSession(NetworkSessionType sessionType, int maxLocalPlayers, NetworkSessionProperties properties)
        {
            // all sessions found
            AvailableNetworkSessionCollection availableSessions;
            // The session we'll join
            AvailableNetworkSession availableSession = null;

            availableSessions = NetworkSession.Find(sessionType, maxLocalPlayers, properties);

            // Get a session with available gamer slots
            foreach (AvailableNetworkSession  curSession in availableSessions)
            {
                int TotalSessionSlots = curSession.OpenPublicGamerSlots + curSession.OpenPrivateGamerSlots;
                if (TotalSessionSlots > curSession.CurrentGamerCount)
                {
                    availableSession = curSession;
                }
            }

            // if a session was found, connect to it
            if (availableSession != null)
            {
                networkHelper.session = NetworkSession.Join(availableSession);
            }
        }
开发者ID:bradleat,项目名称:trafps,代码行数:25,代码来源:Session.cs


示例3: Find

        public void Find()
        {
            NetworkSessionProperties props = new NetworkSessionProperties();

            findResult = NetworkSession.BeginFind(NetworkSessionType.SystemLink,
                1, props, new AsyncCallback(GotResult), null);
            PendingFind = true;
        }
开发者ID:o3a,项目名称:ZombieSmashersXNA4,代码行数:8,代码来源:NetConnect.cs


示例4: Host

        public void Host()
        {
            if (netPlay.NetSession != null)
                netPlay.NetSession.Dispose();

            NetworkSessionProperties props = new NetworkSessionProperties();

            createResult = NetworkSession.BeginCreate(NetworkSessionType.SystemLink,
                1, 2, 0, props, new AsyncCallback(GotResult), null);
            PendingHost = true;
        }
开发者ID:o3a,项目名称:ZombieSmashersXNA4,代码行数:11,代码来源:NetConnect.cs


示例5: ConvertFromLiveSessionProperties

        /// <summary>
        /// Converts a NetworkSessionProperties instance to the SessionProperties
        /// </summary>
        internal static SessionProperties ConvertFromLiveSessionProperties(NetworkSessionProperties networkSessionProperties)
        {
            if (networkSessionProperties == null)
                return null;

            var sessionProperties = new SessionProperties();

            for (int i = 0; i < networkSessionProperties.Count; i++)
            {
                sessionProperties[i] = networkSessionProperties[i];
            }

            return sessionProperties;
        }
开发者ID:rc183,项目名称:igf,代码行数:17,代码来源:LiveSessionProperties.cs


示例6: ConvertToLiveSessionProperties

        /// <summary>
        /// Converts a SessionProperties instance to the NetworkSessionProperties
        /// </summary>
        internal static NetworkSessionProperties ConvertToLiveSessionProperties(SessionProperties sessionProperties)
        {
            if (sessionProperties == null)
                return null;

            var networkSessionProperties = new NetworkSessionProperties();
            
            for (int i = 0; i < sessionProperties.Count; i++)
            {
                networkSessionProperties[i] = sessionProperties[i];
            }

            return networkSessionProperties;
        }
开发者ID:rc183,项目名称:igf,代码行数:17,代码来源:LiveSessionProperties.cs


示例7: CreateSession

        public void CreateSession(NetworkSessionType sessionType, int maxLocalPlayers, int maxGamers, 
            int privateSlots, NetworkSessionProperties properties)
        {
            if (networkHelper.session == null)
            {
                networkHelper.session = NetworkSession.Create(sessionType, maxLocalPlayers,
                    maxGamers, privateSlots, properties);

                // If the host goes out, another machine will asume as a new host
                networkHelper.session.AllowHostMigration = true;
                // Allow players to join a game in progress
                networkHelper.session.AllowJoinInProgress = true;

                eventHandler.HookSessionEvents();
            }
        }
开发者ID:bradleat,项目名称:trafps,代码行数:16,代码来源:Session.cs


示例8: CreateNetwork

        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public IAsyncResult CreateNetwork(Game game, NetworkSessionType sessionType, int maxLocalGamers, int maxGamers, int privateGamerSlots, NetworkSessionProperties sessionProperties, bool AllowHostMigration, bool AllowJoinInProgress)
        {
            SessionManager sessionManager = new SessionManager(game);

            IAsyncResult asyncResult = sessionManager.CreateSession(sessionType, maxLocalGamers, maxGamers, privateGamerSlots, sessionProperties);
            /*
            if (networkHelper.NetworkGameSession != null)
            {
                if (AllowHostMigration == true)
                    networkHelper.NetworkGameSession.AllowHostMigration = true;

                if (AllowJoinInProgress == true)
                    networkHelper.NetworkGameSession.AllowJoinInProgress = true;
                return asyncResult;
            }
            else
            {
                //throw new Exception("Session was not Created");
                return asyncResult;

            }*/
            return asyncResult;
        }
开发者ID:bradleat,项目名称:trafps,代码行数:27,代码来源:NetworkInterface.cs


示例9: Create

		public static NetworkSession Create (
         NetworkSessionType sessionType,			// Type of session being hosted.
         IEnumerable<SignedInGamer> localGamers,	// Maximum number of local players on the same gaming machine in this network session.
         int maxGamers,								// Maximum number of players allowed in this network session.  For Zune-based games, this value must be between 2 and 8; 8 is the maximum number of players supported in the session.
         int privateGamerSlots,						// Number of reserved private session slots created for the session. This value must be less than maximumGamers. 
         NetworkSessionProperties sessionProperties // Properties of the session being created.
		)
		{
			try
			{
				if ( maxGamers < 2 || maxGamers > 8 ) 
					throw new ArgumentOutOfRangeException( "Maximum number of gamers must be between 2 and 8."  );
				if ( privateGamerSlots < 0 || privateGamerSlots > maxGamers ) 
					throw new ArgumentOutOfRangeException( "Private session slots must be between 0 and maximum number of gamers."  );
			
				networkSessionType = sessionType;
			
				throw new NotImplementedException();
			}
			finally
			{
			}
		} 
开发者ID:HaKDMoDz,项目名称:Zazumo,代码行数:23,代码来源:NetworkSession.cs


示例10: Create

 public static NetworkSession Create(NetworkSessionType sessionType, int maxLocalGamers, int maxGamers, int privateGamerSlots, NetworkSessionProperties sessionProperties)
 {
   return NetworkSession.EndCreate(NetworkSession.BeginCreate(sessionType, maxLocalGamers, maxGamers, privateGamerSlots, sessionProperties, (AsyncCallback) null, (object) null));
 }
开发者ID:tanis2000,项目名称:FEZ,代码行数:4,代码来源:NetworkSession.cs


示例11: BeginFind

 private static IAsyncResult BeginFind(NetworkSessionType sessionType, int hostGamer, int maxLocalGamers, NetworkSessionProperties searchProperties, AsyncCallback callback, object asyncState)
 {
   if (sessionType == NetworkSessionType.Local)
     throw new ArgumentException("NetworkSessionType cannot be NetworkSessionType.Local");
   if (maxLocalGamers < 1 || maxLocalGamers > 4)
     throw new ArgumentOutOfRangeException("maxLocalGamers must be between 1 and 4.");
   else
     return new NetworkSessionAsynchronousFind(NetworkSession.Find).BeginInvoke(sessionType, hostGamer, maxLocalGamers, searchProperties, callback, asyncState);
 }
开发者ID:tanis2000,项目名称:FEZ,代码行数:9,代码来源:NetworkSession.cs


示例12: BeginCreate

 public static IAsyncResult BeginCreate(NetworkSessionType sessionType, IEnumerable<SignedInGamer> localGamers, int maxGamers, int privateGamerSlots, NetworkSessionProperties sessionProperties, AsyncCallback callback, object asyncState)
 {
   int hostingGamerIndex = NetworkSession.GetHostingGamerIndex(localGamers);
   return NetworkSession.BeginCreate(sessionType, hostingGamerIndex, 4, maxGamers, privateGamerSlots, sessionProperties, callback, asyncState);
 }
开发者ID:tanis2000,项目名称:FEZ,代码行数:5,代码来源:NetworkSession.cs


示例13: RefreshAvailableSessions

        /// <summary>
        /// Refreshes the current list of available sessions.
        /// </summary>
        /// <param name="searchParameters">Optional parameters to filter by.</param>
        public static void RefreshAvailableSessions(NetworkSessionProperties searchParameters = null)
        {
            AvailableSessions.Clear();

            if (HasActiveSession || availableAsync != null)
                return;

            availableAsync = null;

            try
            {
                AvailableNetworkSessionCollection availableSessions
                    = NetworkSession.Find(NetworkSessionType.SystemLink, MaxLocalGamers, searchParameters);
                foreach (AvailableNetworkSession session in availableSessions)
                    AvailableSessions.Add(new AvailableSession(session));
            }
            catch (Exception e)
            {
                ReportError(e.Message);
            }
        }
开发者ID:BeauPrime,项目名称:Networking,代码行数:25,代码来源:Network.cs


示例14: RefreshAvailableSessionsAsync

        /// <summary>
        /// Refreshes the current list of available sessions asynchronously.
        /// </summary>
        /// <param name="searchParameters">Optional parameters to filter by.</param>
        public static void RefreshAvailableSessionsAsync(NetworkSessionProperties searchParameters, Action<bool> callback)
        {
            if (HasActiveSession || availableAsync != null)
            {
                if ( callback != null )
                    callback(false);
                return;
            }

            availableCallback = callback;

            try
            {
                availableAsync = NetworkSession.BeginFind(NetworkSessionType.SystemLink, MaxLocalGamers, searchParameters, AvailableAsyncFinished, null);
            }
            catch (Exception e)
            {
                ReportError(e.Message);
                if ( availableCallback != null )
                    availableCallback(false);
                AvailableAsyncClear();
            }
        }
开发者ID:BeauPrime,项目名称:Networking,代码行数:27,代码来源:Network.cs


示例15: CreateSession

 /// <summary>
 /// Creates a session with the given parameters.
 /// </summary>
 /// <param name="maxGamers">Maximum number of gamers allowed.</param>
 /// <param name="allowHostMigration">If host migration is allowed.</param>
 /// <param name="properties">Properties to initialize the session with.</param>
 /// <param name="initializeFunction">The optional function to call to initialize the session.</param>
 public static bool CreateSession(int maxGamers, bool allowHostMigration, NetworkSessionProperties properties, ActiveSession.ActiveSessionDelegate initializeFunction )
 {
     if (IsLocked)
         return false;
     #if DEBUG
     Log.Trace("Creating session...", 2.0f);
     #endif
     try
     {
         NetworkSession session = NetworkSession.Create(NetworkSessionType.SystemLink, MaxLocalGamers, maxGamers, 0, properties);
         session.AllowHostMigration = allowHostMigration;
         ActiveSession = new ActiveSession(session, initializeFunction);
         return true;
     }
     catch( Exception e)
     {
         ReportError(e.Message);
         ActiveSession.EndSession();
         return false;
     }
 }
开发者ID:BeauPrime,项目名称:Networking,代码行数:28,代码来源:Network.cs


示例16: CreateSessionAsync

        /// <summary>
        /// Creates a session with the given parameters asynchronously.
        /// </summary>
        /// <param name="maxGamers">Maximum number of gamers allowed.</param>
        /// <param name="allowHostMigration">If host migration is allowed.</param>
        /// <param name="properties">Properties to initialize the session with.</param>
        /// <param name="initializeFunction">The optional function to call to initialize the session.</param>
        public static void CreateSessionAsync(int maxGamers, bool allowHostMigration, NetworkSessionProperties properties, ActiveSession.ActiveSessionDelegate initializeFunction, Action<bool> callback)
        {
            if (IsLocked)
            {
                if (callback != null)
                    callback(false);
                return;
            }
            #if DEBUG
            Log.Trace("Creating session...", 2.0f);
            #endif
            createAsyncAllowHostMigration = allowHostMigration;
            createAsyncFunction = initializeFunction;
            createAsyncCallback = callback;

            try
            {
                createAsync = NetworkSession.BeginCreate(NetworkSessionType.SystemLink, MaxLocalGamers, maxGamers, 0, properties, CreateAsyncFinished, null);
            }
            catch (Exception e)
            {
                ReportError(e.Message);
                if ( createAsyncCallback != null )
                    createAsyncCallback(false);
                CreateAsyncClear();
            }
        }
开发者ID:BeauPrime,项目名称:Networking,代码行数:34,代码来源:Network.cs


示例17: Create

 public static NetworkSession Create(NetworkSessionType sessionType, int maxLocalGamers, int maxGamers, int privateGamerSlots, NetworkSessionProperties sessionProperties)
 {
     throw new NotImplementedException();
 }
开发者ID:sergios1234,项目名称:monoxna,代码行数:4,代码来源:NetworkSession.cs


示例18: BeginCreate

 public static IAsyncResult BeginCreate(NetworkSessionType sessionType, int maxLocalGamers, int maxGamers, int privateGamerSlots, NetworkSessionProperties sessionProperties, AsyncCallback callback, object asyncState)
 {
     throw new NotImplementedException();
 }
开发者ID:sergios1234,项目名称:monoxna,代码行数:4,代码来源:NetworkSession.cs


示例19: Find

 public static AvailableNetworkSessionCollection Find(NetworkSessionType sessionType, IEnumerable<SignedInGamer> localGamers, NetworkSessionProperties searchProperties)
 {
     throw new NotImplementedException();
 }
开发者ID:sergios1234,项目名称:monoxna,代码行数:4,代码来源:NetworkSession.cs


示例20: Find

 public static AvailableNetworkSessionCollection Find(NetworkSessionType sessionType, IEnumerable<SignedInGamer> localGamers, NetworkSessionProperties searchProperties)
 {
   int hostingGamerIndex = NetworkSession.GetHostingGamerIndex(localGamers);
   return NetworkSession.EndFind(NetworkSession.BeginFind(sessionType, hostingGamerIndex, 4, searchProperties, (AsyncCallback) null, (object) null));
 }
开发者ID:tanis2000,项目名称:FEZ,代码行数:5,代码来源:NetworkSession.cs



注:本文中的Microsoft.Xna.Framework.Net.NetworkSessionProperties类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Storage.StorageDevice类代码示例发布时间:2022-05-26
下一篇:
C# Net.NetworkSession类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap