Beispiel #1
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);
    }
Beispiel #2
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;
        }
    }
Beispiel #3
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().
Beispiel #4
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;
        }
    }
Beispiel #5
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;
        }
    }
Beispiel #6
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);
        }
    }
Beispiel #7
0
 void Update()
 {
     if (www != null && sendGuilayerProgress && Time.frameCount % 2 == 0)
     {
         GameGUI.Inst.guiLayer.SendGuiLayerProgress(name, www.progress);
         VDebug.LogError("Download Progress: " + www.progress);
     }
 }
Beispiel #8
0
        public JSONObject GetObject(string key)
        {
            var value = GetValue(key);

            if (value == null)
            {
                VDebug.LogError(key + " == null");
                return(null);
            }
            return(value.Obj);
        }
Beispiel #9
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);
    }
Beispiel #10
0
        public JSONArray GetArray(string key)
        {
            var value = GetValue(key);

            if (value == null)
            {
                VDebug.LogError(key + " == null");
                return(null);
            }
            return(value.Array);
        }
Beispiel #11
0
        public bool GetBoolean(string key)
        {
            var value = GetValue(key);

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

            if (value == null)
            {
                VDebug.LogError(key + " == null");
                return(double.NaN);
            }
            return(value.Number);
        }
Beispiel #13
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();
     }
 }
Beispiel #14
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);
    }
Beispiel #15
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);
 }
Beispiel #16
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
    }
Beispiel #17
0
        /// <summary>
        /// Writes a JSON formatted file. The filename can be set by the submitted JSON data.
        /// If the given path leads to a directory instead of a file, the data must contain a 'name' property
        /// which will be used for file creation.
        /// </summary>
        /// <returns>The name property of the JSON data, or null if no name property is specified.</returns>
        /// <param name="jsonData">JSON data.</param>
        /// <param name="filePath">File path.</param>
        /// <param name="prettify">If set to <c>true</c> prettify JSON output.</param>
        public static string WriteJSON(JToken jsonData, string filePath, bool prettify = true)
        {
            StringBuilder sbContent = new StringBuilder(1024);

            if (prettify)
            {
                sbContent.Insert(0, jsonData.ToString(Newtonsoft.Json.Formatting.Indented));
            }
            else
            {
                sbContent.Insert(0, jsonData.ToString());
            }

            filePath = Regex.Replace(filePath, @"[\\\/]", Path.DirectorySeparatorChar.ToString());

            // Check if path is a directory
            if (Path.GetExtension(filePath) == String.Empty)
            {
                if ((jsonData.Type == JTokenType.Object) && (jsonData["name"] == null))
                {
                    if (Config.DebugLog == (int)DebugState.All)
                    {
                        VDebug.LogError("[Volplane (FileManager)] Invalid file path. Could not write file.");
                    }

                    return(null);
                }

                filePath = Path.Combine(filePath, String.Format("{0:G}.json", (string)jsonData["name"]));
            }

            // Write file
            using (StreamWriter writer = new StreamWriter(filePath, false, Encoding.UTF8))
            {
                writer.NewLine = "\n";
                writer.Write(sbContent);
                writer.WriteLine();
            }

            if ((jsonData.Type == JTokenType.Object) && (jsonData["name"] != null))
            {
                return((string)jsonData["name"]);
            }

            return(null);
        }
Beispiel #18
0
    IEnumerator UploadFileCo(string localFileName, string uploadURL)
    {
        WWW localFile = new WWW("file:///" + localFileName);

        yield return(localFile);

        if (localFile.error == null)
        {
            VDebug.LogError("Loaded file successfully");
        }
        else
        {
            Debug.LogError("Open file error: " + localFile.error);
            GameGUI.Inst.guiLayer.SendGuiLayerUploadComplete(localFileName, "Error Opening File: " + localFile.error);
            yield break; // stop the coroutine here
        }

        // build form
        WWWForm postForm = new WWWForm();
        string  mimeType = (localFileName.EndsWith(".txt")) ? "text/plain" : "application/octet-stream";

        postForm.AddBinaryData("theFile", localFile.bytes, localFileName, mimeType);
        postForm.AddField("action", "virbela upload");
        postForm.AddField("who", CommunicationManager.CurrentUserProfile.Username);

        // upload
        WWW upload = new WWW(uploadURL, postForm);

        yield return(upload);

        if (upload.error == null)
        {
            VDebug.LogError("upload done :" + upload.text);
            GameGUI.Inst.guiLayer.SendGuiLayerUploadComplete(localFileName);
        }
        else
        {
            Debug.LogError("Error during upload: " + upload.error);
            GameGUI.Inst.guiLayer.SendGuiLayerUploadComplete(localFileName, upload.error);
        }
        Destroy(this);
    }
Beispiel #19
0
 /// <summary>
 /// Gets called when a new HTTP context is received.
 /// </summary>
 /// <param name="result">Context result.</param>
 private void ContextReady(IAsyncResult result)
 {
     try
     {
         // Enqueue context and flag as ready
         lock (contextQueue)
         {
             contextQueue.Enqueue(listener.EndGetContext(result));
             ready.Set();
         }
     }
     catch (Exception e)
     {
         if ((Config.DebugLog != (int)DebugState.None) && listener.IsListening)
         {
             VDebug.LogError("[Volplane (Web Listener)] WebListener failed resolving context.");
             VDebug.LogException(e);
         }
     }
 }
Beispiel #20
0
    // Use this for initialization
    void Start()
    {
        htmlPanel        = this.gameObject.AddComponent(typeof(HTMLPanelGUI)) as HTMLPanelGUI;
        htmlPanel.width  = Screen.width;
        htmlPanel.height = Screen.height;
        htmlPanel.RegisterNotificationCallback("InitComplete", delegate(JSValue[] args)
        {
            VDebug.LogError("Loading complete: " + (DateTime.Now - startLoadHTMLTime).TotalSeconds);
            if (loading)
            {
                Debug.LogError("JavaScript Execution started BEFORE awesomium finished loading page!!");
                loading = false;
            }
            if (!skipLogin && GameManager.Inst.LevelLoaded == GameManager.Level.CONNECT)
            {
                System.Version currClientVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
                Debug.LogError("Client version: " + currClientVersion.ToString() + " req: " + CommunicationManager.clientVersionRequirement);
                if (CommunicationManager.clientVersionRequirement == "")
                {
                    // no version requirement specified, hand control to the guilayer.
                    WebHelper.ClearCache = true;
                    HandleClientVersion(currClientVersion.ToString());
                    return;
                }
                System.Version clientReq = new System.Version(CommunicationManager.clientVersionRequirement);
                if (currClientVersion >= clientReq)
                {
                    AttemptLogin();
                }
                else
                {
                    ExecuteJavascriptWithValue(SetGUIVersionJSCmd() + SetBuildTypeCmd() + SetConfigCmd() + "showUpdateDialog();");
                }
            }
            else
            {
                Debug.LogError((skipLogin) ? "Login screen skipped" : "GUI Layer has been reloaded in another scene!");
                skipLogin = false;
            }
        });
        htmlPanel.RegisterNotificationCallback("Authentication_Success", delegate(JSValue[] args)
        {
            GameGUI.Inst.fadeOut = true;

            loginArgs = args[1].ToString();
            loggingIn = true;
        });
        htmlPanel.RegisterNotificationCallback("MouseUp_MouseClick", delegate(JSValue[] args) {
            string json = args[1].ToString();
            VDebug.Log("mouseup fields: " + json);
            GameObject hitObject = MouseHelpers.GetCurrentGameObjectHit();
            if (hitObject != null)
            {
                if (GameManager.Inst.LocalPlayer.gameObject == hitObject)
                {
                    string cmd = "OnLocalPlayerClick(" + json + ");";
                    ExecuteJavascript(cmd);
                }
                else
                {
                    PlayerController playerController = hitObject.GetComponent <PlayerController>();
                    if (playerController != null)
                    {
                        Player p   = playerController.playerScript;
                        string cmd = "OnPlayerClick(" + p.Id + ", " + p.Name + ", " + json + ");";
                        ExecuteJavascript(cmd);
                    }

                    WebPanel webPanel = hitObject.GetComponent <WebPanel>();
                    if (webPanel != null)
                    {
                        string cmd = "OnWebPanelClick(" + webPanel.browserTexture.id + ", " + json + ");";
                        ExecuteJavascript(cmd);
                    }


                    //string go = hitObject.name;// +hitObject.GetInstanceID();
                    //Debug.Log("We clicked something: " + go);
                    //string cmd = "OnUnityObjectClick('" + go + "', " + json + ");";
                    ////Debug.Log(cmd);
                    //ExecuteJavaScript(cmd);
                }
            }
        });
        htmlPanel.RegisterNotificationCallback("Out_UnityDebugLog", delegate(JSValue[] args) {
            string json           = args[1].ToString();
            JSONObject jsonObject = JSONObject.Parse(json);
            string msg            = jsonObject.GetString("msg");
            Debug.Log("Out_UnitDebugLog: " + msg);
        });
        htmlPanel.RegisterNotificationCallback("Clicked_QuitButton", delegate(JSValue[] args)
        {
            Application.Quit();
        });
        htmlPanel.RegisterNotificationCallback("Closed_DialogWindow", delegate(JSValue[] args)
        {
            AnnouncementManager.Inst.AnnouncementClosed();
        });
        htmlPanel.RegisterNotificationCallback("Clicked_AvatarButton", delegate(JSValue[] args)
        {
            GameManager.Inst.LoadLevel(GameManager.Level.AVATARSELECT);
        });
        htmlPanel.RegisterNotificationCallback("Clicked_ToggleVoice", delegate(JSValue[] args)
        {
            VoiceManager.Inst.ToggleToTalk = !VoiceManager.Inst.ToggleToTalk;
        });
        htmlPanel.RegisterNotificationCallback("VoicePush", delegate(JSValue[] args)
        {
            VoiceManager.Inst.PushToTalkButtonDown = args[1].ToBoolean();
        });
        htmlPanel.RegisterNotificationCallback("Clicked_RefreshAll", delegate(JSValue[] args)
        {
            if (GameManager.Inst.LevelLoaded == GameManager.Level.BIZSIM)
            {
                BizSimManager.Inst.ReloadAll();
            }
        });
        htmlPanel.RegisterNotificationCallback("Update_UserList", delegate(JSValue[] args)
        {
            GameGUI.Inst.userListMgr.RebuildHTMLUserList();
        });
        htmlPanel.RegisterNotificationCallback("Update_Timer", delegate(JSValue[] args)
        {
            UpdateTimer();
        });
        htmlPanel.RegisterNotificationCallback("Update_VoiceToggle", delegate(JSValue[] args)
        {
            // ask unity if the voice is toggled on or off
            InitVoiceToggle();
        });
        htmlPanel.RegisterNotificationCallback("Play_ButtonClickSound", delegate(JSValue[] args)
        {
            SoundManager.Inst.PlayClick();
        });
        htmlPanel.RegisterNotificationCallback("Clicked_LogoutButton", delegate(JSValue[] args)
        {
            CommunicationManager.Inst.LogOut();
        });


        // Tooltips
        htmlPanel.RegisterNotificationCallback("Set_Tooltip", delegate(JSValue[] args)
        {
            if (args.Length <= 1)
            {
                Debug.LogError("attempting to change fixed tooltip, but didn't find an argument.");
                return;
            }
            GameGUI.Inst.SetFixedTooltip(args[1].ToString());
        });
        htmlPanel.RegisterNotificationCallback("Clear_Tooltip", delegate(JSValue[] args)
        {
            GameGUI.Inst.ClearFixedTooltip();
            GameGUI.Inst.tooltipAvoidRect = new Rect(0, 0, 0, 0); // clear avoidance rectangle
        });
        htmlPanel.RegisterNotificationCallback("Set_TooltipAvoidRect", delegate(JSValue[] args)
        {
            if (args.Length <= 4)
            {
                Debug.LogError("attempting to change fixed tooltip avoidance rectangle, but didn't find enough arguments.");
                return;
            }
            GameGUI.Inst.tooltipAvoidRect = new Rect(int.Parse(args[1].ToString()), int.Parse(args[2].ToString()), int.Parse(args[3].ToString()), int.Parse(args[4].ToString()));
        });

        // Microphone selection menu
        htmlPanel.RegisterNotificationCallback("Open_Mic_Menu", delegate(JSValue[] args)
        {
            VoiceManager.Instance.micSelectMenuOpen = true;
        });
        htmlPanel.RegisterNotificationCallback("Close_Mic_Menu", delegate(JSValue[] args)
        {
            VoiceManager.Instance.micSelectMenuOpen = false;
        });
        htmlPanel.RegisterNotificationCallback("Toggle_Mic_Menu", delegate(JSValue[] args)
        {
            VoiceManager.Instance.micSelectMenuOpen = !VoiceManager.Instance.micSelectMenuOpen;
        });

        // Seed console with text and move cursor to the front of the input.
        htmlPanel.RegisterNotificationCallback("Seed_Console", delegate(JSValue[] args)
        {
            if (args.Length <= 1)
            {
                GameGUI.Inst.consoleGui.SeedConsole("");
                return;
            }
            GameGUI.Inst.consoleGui.SeedConsole(args[1].ToString());
        });

        htmlPanel.RegisterNotificationCallback("Issue_ConsoleCmd", delegate(JSValue[] args)
        {
            if (args.Length <= 1)
            {
                Debug.LogError("attempting to issue console command, but didn't find an argument.");
                return;
            }
            ConsoleInterpreter.Inst.ProcCommand(args[1].ToString());
        });
        htmlPanel.RegisterNotificationCallback("Issue_FacConsoleCmd", delegate(JSValue[] args)
        {
            if (args.Length <= 1)
            {
                Debug.LogError("attempting to issue console command, but didn't find an argument.");
                return;
            }
            ConsoleInterpreter.Inst.ProcCommand(args[1].ToString(), PlayerType.LEADER);
        });
        htmlPanel.RegisterNotificationCallback("Write_ToConsole", delegate(JSValue[] args)
        {
            string msg = (args.Length <= 1) ? "" : args[1].ToString();
            GameGUI.Inst.WriteToConsoleLog(msg);
        });
        htmlPanel.RegisterNotificationCallback("Open_Browser", delegate(JSValue[] args)
        {
            if (args.Length <= 1)
            {
                Debug.LogError("no url specified for Open_Browser command.");
            }
            OpenInExternalBrowser(args[1].ToString());
        });
        htmlPanel.RegisterNotificationCallback("Click_AvatarChangeCharacter", delegate(JSValue[] args)
        {
            if (args.Length < 2)
            {
                Debug.LogError("no url specified for Open_Browser command.");
                return;
            }
            int modelIdx;
            if (!int.TryParse(args[1].ToString(), out modelIdx))
            {
                Debug.LogError(args[1] + " not a valid int");
                return;
            }
            GameGUI.Inst.customizeAvatarGui.ChangeCharacter(modelIdx);
        });
        htmlPanel.RegisterNotificationCallback("Click_AvatarOption", delegate(JSValue[] args)
        {
            if (args.Length < 3)
            {
                Debug.LogError("Click_AvatarOption - not enough arguments: elementName, newIndex " + args.Length);
                return;
            }

            int optionIdx;
            if (!int.TryParse(args[2].ToString(), out optionIdx))
            {
                Debug.LogError(args[2] + " not a valid int");
                return;
            }
            GameGUI.Inst.customizeAvatarGui.ChangeElement(args[1].ToString(), optionIdx);
        });
        htmlPanel.RegisterNotificationCallback("Click_AvatarRotate", delegate(JSValue[] args)
        {
            if (args.Length < 3)
            {
                Debug.LogError("Click_AvatarRotate - not enough arguments: is_left, is_down");
                return;
            }

            GameGUI.Inst.customizeAvatarGui.HandleRotateBtn(args[1].ToBoolean());
            GameGUI.Inst.customizeAvatarGui.HandleRotateDown(args[2].ToBoolean());
        });
        htmlPanel.RegisterNotificationCallback("Click_AvatarDone", delegate(JSValue[] args)
        {
            bool save = true;
            if (args.Length > 1)
            {
                save = args[1].ToBoolean();
            }
            GameGUI.Inst.customizeAvatarGui.HandleDoneBtn(save);
        });
        htmlPanel.RegisterNotificationCallback("Confirm_Action", delegate(JSValue[] args)
        {
            string action = (args.Length > 1) ? args[1].ToString() : "";
            if (GameManager.Inst.LevelLoaded == GameManager.Level.BIZSIM)
            {
                BizSimManager.Inst.HandleAction(action);
            }
        });
        htmlPanel.RegisterNotificationCallback("Send_SFSRequest", delegate(JSValue[] args)
        {
            if (args.Length < 2)
            {
                Debug.LogError("Not enough arguments for Send_SFSRequest");
                return;
            }

            string msg        = (args.Length > 2) ? args[2].ToString() : "";
            ISFSObject msgObj = new SFSObject();
            msgObj.PutUtfString("msg", msg);
            ExtensionRequest request = new ExtensionRequest(args[1].ToString(), msgObj);
            CommunicationManager.SendMsg(request);
        });
        htmlPanel.RegisterNotificationCallback("Set_InputFocus", delegate(JSValue[] args)
        {
            if (args.Length < 2)
            {
                Debug.LogError("Set_InputFocus needs true/false argument");
                return;
            }
            hasInputFocus = args[1].ToString() == "true";
        });
        htmlPanel.RegisterNotificationCallback("Toggle_ClickOffElement", delegate(JSValue[] args)
        {
            if (args.Length < 2)
            {
                Debug.LogError("Toggle_ClickOffElement needs true/false argument");
                return;
            }

            clickOffElementOpen = args[1].ToString() == "true";
        });
        htmlPanel.RegisterNotificationCallback("Overlay_URL", delegate(JSValue[] args)
        {
            if (args.Length < 2)
            {
                Debug.LogError("Overlay_URL needs url");
                return;
            }
            string url = args[1].ToString();
            int width  = (args.Length > 2) ? args[2].ToInteger() : (int)(0.75f * Screen.width);
            int height = (args.Length > 3) ? args[3].ToInteger() : (int)(0.75f * Screen.height);

            GameManager.Inst.OverlayMgr.SetURL(url, width, height);
        });
        htmlPanel.RegisterNotificationCallback("Scale_PresentTool", delegate(JSValue[] args)
        {
            if (args.Length <= 1)
            {
                Debug.LogError("attempting to scale present tool, but didn't find an argument.");
                return;
            }
            GameGUI.Inst.presentToolScale = (float)args[1].ToDouble();
        });
        htmlPanel.RegisterNotificationCallback("Set_GameGUIGutter", delegate(JSValue[] args)
        {
            if (args.Length <= 1)
            {
                Debug.LogError("attempting to set game gui gutter, but didn't find an argument.");
                return;
            }
            GameGUI.Inst.gutter = args[1].ToInteger();
        });
        htmlPanel.RegisterNotificationCallback("Hide_PresentUI", delegate(JSValue[] args)
        {
            GameGUI.Inst.showPresentToolButtons = false;
        });
        htmlPanel.RegisterNotificationCallback("Open_FileDialog", delegate(JSValue[] args)
        {
            string file = NativePanels.OpenFileDialog(null);
            string cmd  = "handleOpenFile(\"" + file + "\");";
            ExecuteJavascript(cmd);
        });
        htmlPanel.RegisterNotificationCallback("Set_Clipboard", delegate(JSValue[] args)
        {
            if (args.Length <= 1)
            {
                Debug.LogError("attempting to set clipboard, but didn't find an argument.");
                return;
            }
            ClipboardHelper.Clipboard = args[1].ToString();
        });
        htmlPanel.RegisterNotificationCallback("Set_GUIVisibility", delegate(JSValue[] args)
        {
            if (args.Length <= 1)
            {
                Debug.LogError("attempting to set gui visibility, but didn't find an argument.");
                return;
            }
            GameGUI.Inst.VisibilityFlags = args[1].ToInteger();
        });
        htmlPanel.RegisterNotificationCallback("Update_TutorialCode", delegate(JSValue[] args)
        {
            if (args.Length <= 1)
            {
                Debug.LogError("attempting to update tutorial code, but didn't find an argument.");
                return;
            }
            CommunicationManager.CurrentUserProfile.UpdateTutorial(args[1].ToInteger());
        });



        htmlPanel.RegisterNotificationCallback("Request_AvatarOptions", SendGuiLayerAvatarOptions);
        htmlPanel.RegisterNotificationCallback("Request_GameIds", SendGuiLayerNumGames);
        htmlPanel.RegisterNotificationCallback("Request_TeamInfo", SendGuiLayerTeamInfo);
        htmlPanel.RegisterNotificationCallback("Request_MicInfo", SendGuiLayerMicInfo);
        htmlPanel.RegisterNotificationCallback("Request_TeacherClassInfo", SendGuiLayerTeamTeacherClass);
        htmlPanel.RegisterNotificationCallback("Request_PanelTitle", SendGuiLayerPanelTitle);
        htmlPanel.RegisterNotificationCallback("Request_PanelURL", SendGuiLayerPanelURL);
        htmlPanel.RegisterNotificationCallback("Request_PanelSelection", SendGuiLayerPanelSelection);
        htmlPanel.RegisterNotificationCallback("Request_GetClipboard", SendGuiLayerClipboard);
        htmlPanel.RegisterNotificationCallback("Request_GUIVisibility", SendGuiLayerGUIVisibility);
        htmlPanel.RegisterNotificationCallback("Request_PlayerInfo", SendGuiLayerPlayerInfo);
        htmlPanel.RegisterNotificationCallback("Request_WorkingDir", SendGuiLayerWorkingDir);
        htmlPanel.RegisterNotificationCallback("Request_ReplayUpdate", SendGuiLayerReplayPosInfo);
        htmlPanel.RegisterNotificationCallback("Request_TutorialCode", SendGuiLayerTutorialCode);
        htmlPanel.RegisterNotificationCallback("Request_HardwareInfo", SendGuiLayerHardwareInfo);

#if PATCHER_ENABLE
        //startingFile = GameManager.Inst.guipatcher.path + startingFile;
        Debug.LogError("HTMLGuiLayer - starting file: " + startingFile);
#endif
    }
Beispiel #21
0
 private void OnBuddyRemoved(BaseEvent evt)
 {
     VDebug.LogError("buddy removed");
 }
Beispiel #22
0
    private void OnBuddyAdded(BaseEvent evt)
    {
        Buddy buddy = (Buddy)evt.Params["buddy"];

        VDebug.LogError("Buddy " + buddy.Name + " added");
    }
Beispiel #23
0
 private void OnBuddyError(BaseEvent evt)
 {
     VDebug.LogError("Buddy list error: " + (string)evt.Params["errorMessage"]);
 }
Beispiel #24
0
 // Buddy list handlers
 private void OnBuddyListInit(BaseEvent evt)
 {
     VDebug.LogError("Buddy list init");
 }