Esempio n. 1
0
        /// <summary>
        /// Start listening on a specific port.
        /// </summary>
        /// <param name="port">The port.</param>
        public void Start(int port)
        {
            if (!listener.IsListening)
            {
                listener.Prefixes.Add(String.Format(@"http://*:{0}/", port));
                listener.Start();

                // Reset events
                stop.Reset();
                ready.Reset();

                // Threads
                listenerThread = new Thread(HandleRequest);
                workerThread   = new Thread(Worker);

                listenerThread.Start();
                workerThread.Start();
            }
            else
            {
                if (Config.DebugLog != (int)DebugState.None)
                {
                    VDebug.LogWarningFormat("[Volplane (Web Listener)] WebListener already running on port: {0}.", port);
                }
            }
        }
Esempio n. 2
0
    public string FindByColumnValue(string c, string v)
    {
        string json = "{\"" + c + "\":\"" + v + "\"}";

        VDebug.Log("FindByColumnValue json: " + json);
        return(FindByColumnValue(json));
    }
Esempio n. 3
0
    private void OnBuddyBlocked(BaseEvent evt)
    {
        Buddy  buddy   = (Buddy)evt.Params["buddy"];
        string message = (buddy.IsBlocked ? " blocked" : "unblocked");

        VDebug.LogError("Buddy " + buddy.Name + " is " + message);
    }
Esempio n. 4
0
        public void Delete()
        {
            string sql = "delete from " + this.TableName + this.whereCondition;

            VDebug.Track(sql);
            this.mysqlHelper.ExecuteNonQuery(sql);
        }
Esempio n. 5
0
    private void OnExtensionResponse(BaseEvent evt)
    {
        VDebug.LogError("Extension response");
        string cmd = (string)evt.Params["cmd"];

        if (cmd == "add")
        {
            SFSObject pObj = (SFSObject)evt.Params["params"];
            VDebug.LogError("Success! " + pObj.GetInt("res"));
        }
        else if (cmd == "admMsg")
        {
            VDebug.LogError("admin message response!");
        }
        else if (cmd == "guicmd")
        {
            SFSObject pObj = (SFSObject)evt.Params["params"];
            string    js   = pObj.GetUtfString("js");
            VDebug.LogError("guicmd executing: " + js);
            GameGUI.Inst.ExecuteJavascriptOnGui(js);
        }
        else if (cmd == "numUsers")
        {
            SFSObject pObj  = (SFSObject)evt.Params["params"];
            string    room  = pObj.GetUtfString("room");
            int       users = pObj.GetInt("users");
            VDebug.LogError(room + " has " + users + " users");
            GameGUI.Inst.guiLayer.SendGuiLayerNumUsersInRoom(room, users);
        }
    }
Esempio n. 6
0
    void InitBrowserTexture()
    {
        bTex = GetComponent <CollabBrowserTexture>();
        bTex.AddLoadCompleteEventListener(OnLoadComplete);
        if (bTex.id == CollabBrowserId.NONE)
        {
            bTex.id = CollabBrowserId.TEAMWEB + id;
        }

        if (GameManager.Inst.ServerConfig == "LocalTest" && id == 6)
        {
            VDebug.LogError("UCI Hack for id 6 -- making id slide presenter for backwards compatiblity");
            bTex.id = CollabBrowserId.SLIDEPRESENT;
            return;
        }

        if (CommunicationManager.redirectVideo)
        {
            bTex.redirectLoadingURL.Add("www.youtube.com", RedirectHelper.HandleYouTube);
            bTex.redirectLoadingURL.Add("vimeo.com", RedirectHelper.HandleVimeo);
        }

        // lock down team room screens, open them up on the guilayer side.
        if (GameManager.Inst.ServerConfig != "UCI")
        {
            bTex.minWriteAccessType = PlayerType.LEADER;
        }
    }
Esempio n. 7
0
	} // End of Awake().


    void Start(){
        if(isLocalPlayer || (playerScript != null && playerScript.isBot)){
            navAgent = gameObject.AddComponent<NavMeshAgent>();
            navAgent.angularSpeed = 9999f;
            navAgent.height = 3.5f;

            navAgent.speed = 0f;
        }

        if (isLocalPlayer && loadDestinationIndicators) {
            if (goToIndicatorPrefab == null || pathfindingDest == null){
                VDebug.LogError("Warning: goto indicator and/or pathfinding destination prefab(s) have not been set");
                if (goToIndicatorPrefab == null)
                    goToIndicatorPrefab = (GameObject)Resources.Load("Avatars/Effects/PathfindingGoTo");
                if (pathfindingDest == null)
                    pathfindingDestPrefab = (GameObject)Resources.Load("Avatars/Effects/PathfindingDest");
            }

            goToIndicator = Instantiate(goToIndicatorPrefab) as GameObject;
            pathfindingDest = Instantiate(pathfindingDestPrefab) as GameObject;
        }
        else{
            goToIndicator = new GameObject();
            pathfindingDest = new GameObject();
        }

    } // End of Start().
Esempio n. 8
0
        public bool Insert(Condition data)
        {
            String sql = "insert into  " + this.TableName;

            int    i      = 0;
            String fields = "(";
            String values = "(";

            foreach (var key in data.Keys)
            {
                fields += key;
                values += "'" + data[key] + "'";
                if (data.Keys.Count - 1 != i)
                {
                    fields += " , ";
                    values += " , ";
                }
                i++;
            }
            fields += ")";
            values += ")";

            sql += fields + " value" + values;
            VDebug.Track(sql);
            this.mysqlHelper.ExecuteNonQuery(sql);
            return(true);
        }
Esempio n. 9
0
    private void setCO2Values()
    {
        float   co2Current = -1.0f;
        float   co2Cap     = -1.0f;
        JSValue result     = bTex.ExecuteJavaScriptWithResult("var elem = document.getElementById('ajaxDiv_invbudget').getElementsByTagName('nobr'); if (elem != null) {elem.item(3).firstChild.nodeValue;}");

        if (IsValidJavaResult(result))
        {
            co2Current = (float)result.ToDouble();
        }
        else
        {
            VDebug.LogError("Failed to set current CO2 value.");
        }

        result = bTex.ExecuteJavaScriptWithResult("var elem = document.getElementById('ajaxDiv_invbudget').getElementsByTagName('nobr'); if (elem != null) {elem.item(2).firstChild.nodeValue;}");
        if (IsValidJavaResult(result))
        {
            co2Cap = (float)result.ToDouble();
        }
        else
        {
            VDebug.LogError("Failed to set cap CO2 value.");
        }
        if (co2Cap != -1.0f && co2Current != -1.0f)
        {
            BizSimManager.Inst.Polluting = co2Current > co2Cap;
        }
    }
Esempio n. 10
0
    public static void SetPlayMode(string playModeStr)
    {
        if (GameManager.buildType == GameManager.BuildType.DEMO)
        {
            VDebug.LogError("Demo version, forcing sim to demo bizsimType");
            playMode = SimPlayMode.DEMO;
            return;
        }

        switch (playModeStr.ToLower())
        {
        case "singleplayer":
        case "single":
            playMode = SimPlayMode.SINGLE_PLAYER;
            break;

        case "demo":
            playMode = SimPlayMode.DEMO;
            break;

        case "multiplayer":
        case "multi":
            playMode = SimPlayMode.MULTI_PLAYER;
            break;

        default:
            Debug.LogError("Unknown playmode: " + playModeStr);
            break;
        }
    }
Esempio n. 11
0
    private void OnBeginLoading(System.Object sender, Awesomium.Mono.BeginLoadingEventArgs args)
    {
        if (args.Url.Length < 1)
        {
            return;
        }

        if (IsBlackListedLoad(args.Url))
        {
            webView.GoBack();
            return;
        }

        if (HandleRedirectLoad(args.Url))
        {
            return;
        }

        SetToLoadingTexture();
        if (args.Url != lastURL)
        {
            lastURL = args.Url;
            RaiseLoadBeginEvent(args.Url);
        }
        else
        {
            VDebug.Log("skipping url: " + args.Url);
        }
        goingBack    = false;
        goingForward = false;
    }
Esempio n. 12
0
 void Update()
 {
     if (www != null && sendGuilayerProgress && Time.frameCount % 2 == 0)
     {
         GameGUI.Inst.guiLayer.SendGuiLayerProgress(name, www.progress);
         VDebug.LogError("Download Progress: " + www.progress);
     }
 }
Esempio n. 13
0
 public void RefreshWebView()
 {
     if (CheckWebView() && !webView.IsLoadingPage)
     {
         VDebug.Log("Refresh server data");
         webView.Reload();
     }
 }
Esempio n. 14
0
 public bool ExecuteJavascript(string cmd)
 {
     if (!loading && htmlPanel != null)
     {
         VDebug.Log("HTMLGuiLayer - ExecuteJavascript: " + cmd);
         htmlPanel.browserTexture.ExecuteJavaScript(cmd);
     }
     return(!loading);
 }
Esempio n. 15
0
        /// <summary>
        /// Gets called when websocket connection is opened.
        /// </summary>
        protected override void OnOpen()
        {
            base.OnOpen();

            if (Config.DebugLog != (int)DebugState.None)
            {
                VDebug.LogFormat("[Volplane (Websocket Service)] Socket connection opened on port: {0:D}.", Config.LocalWebsocketPort);
            }
        }
Esempio n. 16
0
 public MysqlHelper(ConnectParam connectParam)
 {
     this.ConnectParams    = connectParam;
     this.ConnectionString = "server=" + connectParam.Server +
                             ";user id=" + connectParam.UserID +
                             ";password="******";database=" + connectParam.Database;
     VDebug.Track(this.ConnectionString);
 }
Esempio n. 17
0
        /// <summary>
        /// Gets called when websocket connection throws an error.
        /// </summary>
        /// <param name="e">Error event data.</param>
        protected override void OnError(ErrorEventArgs e)
        {
            base.OnError(e);

            if (Config.DebugLog != (int)DebugState.None)
            {
                VDebug.LogErrorFormat("[Volplane (Websocket Service)] {0:G}", e.Message);
                VDebug.LogException(e.Exception);
            }
        }
Esempio n. 18
0
 /// <summary>
 /// Awake is called when the script instance is being loaded.
 /// </summary>
 void Awake()
 {
     if (Instance != null)
     {
         Destroy(this);
         return;
     }
     debugs   = new List <string>();
     Instance = this;
 }
Esempio n. 19
0
        public bool GetBoolean(string key)
        {
            var value = GetValue(key);

            if (value == null)
            {
                VDebug.LogError(key + " == null");
                return(false);
            }
            return(value.Boolean);
        }
Esempio n. 20
0
        public double GetNumber(string key)
        {
            var value = GetValue(key);

            if (value == null)
            {
                VDebug.LogError(key + " == null");
                return(double.NaN);
            }
            return(value.Number);
        }
Esempio n. 21
0
    public JSValue ExecuteJavascriptWithValue(string cmd)
    {
        JSValue ret = null;

        if (!loading && htmlPanel != null)
        {
            VDebug.Log("HTMLGuiLayer - ExecuteJavascriptWithValue: " + cmd);
            ret = htmlPanel.browserTexture.ExecuteJavaScriptWithResult(cmd);
        }
        return(ret);
    }
Esempio n. 22
0
        /// <summary>
        /// Gets called when websocket connection is closed.
        /// </summary>
        /// <param name="e">Closed event data.</param>
        protected override void OnClose(CloseEventArgs e)
        {
            base.OnClose(e);

            // TODO: Inform VolplaneAgent?

            if (Config.DebugLog != (int)DebugState.None)
            {
                VDebug.LogFormat("[Volplane (Websocket Service)] Socket connection closed. Code: {0:D}.", e.Code);
            }
        }
Esempio n. 23
0
        public JSONArray GetArray(string key)
        {
            var value = GetValue(key);

            if (value == null)
            {
                VDebug.LogError(key + " == null");
                return(null);
            }
            return(value.Array);
        }
Esempio n. 24
0
        public JSONObject GetObject(string key)
        {
            var value = GetValue(key);

            if (value == null)
            {
                VDebug.LogError(key + " == null");
                return(null);
            }
            return(value.Obj);
        }
Esempio n. 25
0
    byte GetCurrentRecordedLevel()
    {
        LevelInfo levelInfo = GameManager.Inst.LevelLoadedInfo;

        if (levelInfo.level == GameManager.Level.CONNECT)
        {
            VDebug.LogError("Recording from Connection level, try based on smartfox room");
            levelInfo = LevelInfo.GetInfo(CommunicationManager.LevelToLoad);
        }
        return((byte)levelInfo.level);
    }
Esempio n. 26
0
 public Table OpenTable(String tableName)
 {
     if (true == this.CheckTable(tableName, this.ConnectParams.Database))
     {
         return(new Table(tableName, this));
     }
     else
     {
         VDebug.Error("Table is not exits!");
         return(null);
     }
 }
Esempio n. 27
0
 private void InitCallback(WWW downloadObj)
 {
     if (!string.IsNullOrEmpty(downloadObj.error))
     {
         VDebug.LogError("Error downloading config cache directive from web: " + downloadObj.error);
         Init();
     }
     else
     {
         customCacheStr = downloadObj.text.Substring(0, 1);
         VDebug.LogError("Setting custom cache string: " + customCacheStr);
         Init();
     }
 }
Esempio n. 28
0
 private bool Init(string evtType)
 {
     if (!File.Exists(recordFilename))
     {
         CreateRecordFile(recordFilename);
         AddAllCurrentUsers();
         AddAllCurrentRoomVariables();
         if (evtType == SFSEvent.USER_ENTER_ROOM)
         {
             VDebug.LogError("Don't add user twice, stopping user enter room event");
             return(false);
         }
     }
     return(true);
 }
Esempio n. 29
0
    JSValue AttemptLogin()
    {
        VDebug.LogError("Time until attempt login: "******"showLoginDialog();";

        Debug.LogError(cmd);
        JSValue retValue = ExecuteJavascriptWithValue(cmd);

        if (retValue == null)
        {
            Debug.LogError("Got null trying to login");
            loginOnUpdate = true;
        }
        return(retValue);
    }
Esempio n. 30
0
    private void AddAllCurrentUsers()
    {
#if !UNITY_WEBPLAYER
        using (BinaryWriter writer = new BinaryWriter(File.Open(recordFilename, FileMode.Append, FileAccess.Write)))
        {
            VDebug.LogError("Adding all current users");
            foreach (SFSUser u in CommunicationManager.LastJoinedRoom.UserList)
            {
                if (u != CommunicationManager.MySelf || (RecordingPlayer.Active && RecordingPlayer.Inst.RecordMyActions))
                {
                    RecordUserEnterExit(writer, u, SFSEvent.USER_ENTER_ROOM, CommunicationManager.LastJoinedRoom);
                }
            }
        }
#endif
    }