예제 #1
0
    //-------------------------------------------------------------------------------------------------------
    // SnapShot:  single-shot save current Player state to World-saves

    internal void SnapShot()
    {
        Debug.Log("SnapShot: " + Player);
        if (Player.Equals(""))
        {
            return;                             // no active player
        }
        // CT snapshot source
        if (ctsnapshot != null)
        {
            ctsnapshot.close();
        }
        ctsnapshot = new CTlib.CThttp(Session + "/" + Inventory + "/_" + Player, blocksPerSegment, true, true, true, Server);
        ctsnapshot.login(user, password);
        ctsnapshot.setAsync(AsyncMode);

//        serverConnect();  // reset Player folder paths

        string CTstateString = CTserdes.serialize(this, JSON_Format ? CTserdes.Format.JSON : CTserdes.Format.CSV);

        if (CTstateString == null)
        {
            return;                                     // meh
        }
        // archive World state
        ctsnapshot.setTime(ServerTime());
        ctsnapshot.putData(CTchannel, CTstateString);
        ctsnapshot.flush();
    }
예제 #2
0
    //----------------------------------------------------------------------------------------------------------------
    // Connect to CTweb server
    // Note:  this updates *Player* in PUT file path

    public void serverConnect()
    {
        if (Player == null || Player.Equals(""))
        {
//			Debug.Log("OOPS serverConnect null Player!!!!!!");
            return;
        }
        //        Debug.Log("serverConnect: " + Player);
        // CT vidcap source
        if (EnableScreenCap)
        {
            if (ctvideo != null)
            {
                ctvideo.close();
            }
            ctvideo = new CTlib.CThttp(Session + "/ScreenCap/" + Player, blocksPerSegment, true, false, false, Server);
            ctvideo.login(user, password);
            ctvideo.setAsync(AsyncMode);
        }

        /*
         *      // CT snapshot source
         *      if (ctsnapshot != null) ctsnapshot.close();
         * ctsnapshot = new CTlib.CThttp(Session + "/" + Inventory + "/_" + Player, blocksPerSegment, true, true, true, Server);
         *      ctsnapshot.login(user, password);
         *      ctsnapshot.setAsync(AsyncMode);
         */

        // CT player source
        if (ctplayer != null)
        {
            ctplayer.close();
        }
        if (Player.Equals(Observer))
        {
            return;                                   // observers are read-only
        }
        ctplayer = new CTlib.CThttp(Session + "/GamePlay/" + Player, blocksPerSegment, true, true, true, Server);
        ctplayer.login(user, password);
        ctplayer.setAsync(AsyncMode);
    }