Esempio n. 1
0
        public void WarpRemote(string anchorName, string zoneName)
        {
            NetworkZoneTemplate template = NetworkZoneTemplate.GetZoneBySceneName(zoneName);

            UpdateCooldown(20);

            DatabaseManager.singleton.SaveDataPlayer(this.gameObject);

            // -- uses OpenMMO NetworkManager singleton instead of the Mirror one
            OpenMMO.Network.NetworkManager.singleton.TrySwitchServerPlayer(this.gameObject.name, anchorName, zoneName);

            NetworkServer.Destroy(this.gameObject);
        }
Esempio n. 2
0
        public void WarpRemote(string anchorName, string zoneName, int token = 0)
        {
            UpdateCooldown(GameRulesTemplate.singleton.remoteWarpDelay);

            NetworkZoneTemplate template = NetworkZoneTemplate.GetZoneBySceneName(zoneName);

            // -- update anchor & zone
            this.GetComponent <PlayerComponent>().tablePlayerZones.anchorname = anchorName;
            this.GetComponent <PlayerComponent>().tablePlayerZones.zonename   = zoneName;
            securityToken = token;     // token must not be set in table, can be fetched via GetToken

            // -- save player
            DatabaseManager.singleton.SaveDataPlayer(this.gameObject);

            OpenMMO.Network.NetworkManager.singleton.SwitchServerPlayer(this.connectionToClient, this.gameObject.name, anchorName, zoneName, securityToken);

            NetworkServer.Destroy(this.gameObject);
        }
        public void WarpRemote(string anchorName, string zoneName)
        {
            NetworkZoneTemplate template = NetworkZoneTemplate.GetZoneBySceneName(zoneName);

            UpdateCooldown(20);

            DatabaseManager.singleton.SaveDataPlayer(this.gameObject);

            // -- uses OpenMMO NetworkManager singleton instead of the Mirror one
            OpenMMO.Network.NetworkManager.singleton.TrySwitchServerPlayer(this.gameObject.name, anchorName, zoneName);

            /*
             * TODO, NOTE, BUG
             * wrong, thats client side, must be server side
             * also we must save anchorName and zoneName here
             */

            NetworkServer.Destroy(this.gameObject);
        }
        void LoginPlayer_NetworkPortals(NetworkConnection conn, GameObject player, GameObject prefab, string userName, string playerName)
        {
            PlayerComponent     pc          = player.GetComponent <PlayerComponent>();
            string              zoneName    = pc.tablePlayerZones.zonename;
            NetworkZoneTemplate currentZone = pc.currentZone;

            if (!String.IsNullOrWhiteSpace(zoneName) && zoneName != currentZone.name)
            {
                string anchorName = pc.tablePlayerZones.anchorname;
                pc.WarpRemote(anchorName, zoneName);
            }


            // ------- OBSOLETE -------

            /*
             *      // where was the player saved the last time?
             *      string lastScene = Database.singleton.GetCharacterScene(player.name);
             *
             *      if (lastScene != "" && lastScene != SceneManager.GetActiveScene().name)
             *      {
             *              print("[Zones]: " + player.name + " was last saved on another scene, transferring to: " + lastScene);
             *
             *              // ask client to switch server
             *              conn.Send(
             *                      new SwitchServerMsg
             *                      {
             *                              scenePath = lastScene,
             *                              characterName = player.name
             *                      }
             *              );
             *
             *              // immediately destroy so nothing messes with the new
             *              // position and so it's not saved again etc.
             *              NetworkServer.Destroy(player);
             *      }
             */
        }