示例#1
0
 public void HFTNeedNewHFT(GameServer gs)
 {
     #if UNITY_EDITOR
     UnityEditor.EditorUtility.DisplayDialog(
         "HappyFunTimes",
         "This game needs a newer version of HappyFunTimes",
         "Ok");
     #endif
 }
        public HFTPlayerManager(GameServer server, GameObject gameObject, int maxPlayers, int timeoutForDisconnectedPlayerToReconnect, GetGameObject getGameObjectFn)
        {
            m_log = new HFTLog("PlayerManager");
            m_maxPlayers = maxPlayers;
            m_gameObject = gameObject;
            m_getGameObject = getGameObjectFn;
            m_timeoutForDisconnectedPlayersToReconnect = timeoutForDisconnectedPlayerToReconnect;

            server.OnPlayerConnect += StartNewPlayer;

            ResetState();
        }
示例#3
0
        // Use this for initialization
        void Start()
        {
            m_rand = new System.Random();

            GameServer.Options options = new GameServer.Options();
            options.gameId = "simple";
            options.controllerUrl = "http://localhost:8080/examples/simple/index.html";
            m_server = new GameServer(options, gameObject);
            m_server.Init();

            m_server.OnPlayerConnect += StartNewPlayer;
            m_server.OnConnect += Connected;
            m_server.OnDisconnect += Disconnected;
        }
        void Awake()
        {
            m_connectToServerOnStart = enabled;
            m_options = new HFTRuntimeOptions(happyfuntimesOptions);

            m_server = new GameServer(m_options, gameObject);
            m_server.OnConnect += Connected;
            m_server.OnDisconnect += Disconnected;

            m_hftManager = new HFTManager();
            m_hftManager.OnReady += StartGameServer;
            m_hftManager.OnFail  += FailedToStart;

            m_playerManager = new HFTPlayerManager(m_server, gameObject, players.Length, timeoutForDisconnectedPlayersToReconnect, GetPlayer);
        }
示例#5
0
 public void HFTInitializeRunner(GameServer gs)
 {
     m_gameServer = gs;
     m_gameServer.OnConnectFailure += Run;
 }
        void Awake()
        {
            m_connectToServerOnStart = enabled;
            m_options = new HFTRuntimeOptions(happyfuntimesOptions);

            m_server = new GameServer(m_options, gameObject);
            m_server.OnConnect += Connected;
            m_server.OnDisconnect += Disconnected;

            m_hftManager = new HFTManager();
            m_hftManager.OnReady += StartGameServer;
            m_hftManager.OnFail += FailedToStart;

            if (maxPlayers > 0)
            {
                int timeoutForDisconnectedPlayerToReconnect = 0;
                m_playerManager = new HFTPlayerManager(m_server, gameObject, maxPlayers, timeoutForDisconnectedPlayerToReconnect, GetPrefab);
            }
            else
            {
                m_server.OnPlayerConnect += StartNewPlayer;
            }
        }
示例#7
0
 public RealNetPlayer(GameServer server, string id, string name, Options options = null) : base(server, name)
 {
     m_id        = id;
     m_sessionId = options != null ? options.sessionId : "";
 }
 public RealNetPlayer(GameServer server, string id, string name, Options options = null)
     : base(server, name)
 {
     m_id = id;
     m_sessionId = options != null ? options.sessionId : "";
 }